IMP  2.0.1
The Integrative Modeling Platform
Cosine.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/Cosine.h \brief Cosine function.
3  *
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5  */
6 
7 #ifndef IMPCORE_COSINE_H
8 #define IMPCORE_COSINE_H
9 
10 #include <IMP/core/core_config.h>
11 #include <IMP/UnaryFunction.h>
13 
14 IMPCORE_BEGIN_NAMESPACE
15 
16 //! %Cosine function.
17 /** This evaluates the function
18  |k| - k cos(nf + a)
19  where k is a force constant, n the periodicity, a the phase, and f the
20  input value. This is most commonly used for dihedral angle restraints,
21  e.g. in the CHARMM force field.
22  */
23 class IMPCOREEXPORT Cosine : public UnaryFunction
24 {
25 public:
26  //! Constructor.
27  /** \param[in] force_constant Force constant (score units)
28  \param[in] periodicity Periodicity (generally 1-6)
29  \param[in] phase Phase (radians)
30  */
31  Cosine(Float force_constant, int periodicity, Float phase) :
32  force_constant_(force_constant), periodicity_(periodicity),
33  phase_(phase) {}
34 
35  virtual DerivativePair evaluate_with_derivative(double feature) const;
36 
37  virtual double evaluate(double feature) const;
38 
40 
41  void do_show(std::ostream &out) const;
42 
43  private:
44  Float force_constant_;
45  int periodicity_;
46  Float phase_;
47 };
48 
49 IMPCORE_END_NAMESPACE
50 
51 #endif /* IMPCORE_COSINE_H */