Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CharmmPeriodicFunc.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file src/core/scoring/constraints/CharmmPeriodicFunc.cc
11 /// @brief Definition for periodic functions
12 /// @author Florian Richter, floric@u.washington.edu
13 
14 
16 
17 #include <math.h>
18 
19 #include <iostream>
20 
21 
22 namespace core {
23 namespace scoring {
24 namespace constraints {
25 
26 
27 Real
29 {
30  return 0.5 * k_ * (1 - cos( n_periodic_ * ( x - x0_ ) ) );
31 }
32 
33 Real
35 {
36  return 0.5 * k_ * n_periodic_ * sin( n_periodic_ * (x - x0_ ) );
37 }
38 
39 void
40 CharmmPeriodicFunc::read_data( std::istream& in )
41 {
42  in >> x0_ >> n_periodic_ >> k_;
43 }
44 
45 void
46 CharmmPeriodicFunc::show_definition(std::ostream &out ) const
47 {
48  out << "CHARMM_PERIODIC " << x0_ << " " << n_periodic_ << " " << k_ << std::endl;
49 }
50 
51 //copied from HarmonicFunc.cc
52 Size
53 CharmmPeriodicFunc::show_violations( std::ostream& out, Real x, Size verbose_level, Real threshold) const
54 {
55  if (verbose_level > 100 ) {
56  out << "CHARMM_PERIODIC " << func(x) << std::endl;
57  }
58  return Func::show_violations( out, x, verbose_level, threshold);
59 
60 }
61 
62 
63 } //constraints
64 } //scoring
65 } //core
66 
67