IMP  2.1.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  public:
25  //! Constructor.
26  /** \param[in] force_constant Force constant (score units)
27  \param[in] periodicity Periodicity (generally 1-6)
28  \param[in] phase Phase (radians)
29  */
30  Cosine(Float force_constant, int periodicity, Float phase)
31  : force_constant_(force_constant),
32  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 */
virtual DerivativePair evaluate_with_derivative(double feature) const
Calculate score and derivative with respect to the given feature.
Import IMP/kernel/UnaryFunction.h in the namespace.
Cosine function.
Definition: Cosine.h:23
Abstract single variable functor class for score functions.
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition: base/types.h:23
Import IMP/kernel/unary_function_macros.h in the namespace.
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20
Cosine(Float force_constant, int periodicity, Float phase)
Constructor.
Definition: Cosine.h:30