IMP  2.1.0
The Integrative Modeling Platform
MultipleBinormalRestraint.h
Go to the documentation of this file.
1 /**
2  * \file MultipleBinormalRestraint.h
3  * \brief kernel::Modeller-style multiple binormal (phi/psi) restraint.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMODELLER_MULTIPLE_BINORMAL_RESTRAINT_H
10 #define IMPMODELLER_MULTIPLE_BINORMAL_RESTRAINT_H
11 
12 #include <IMP/modeller/modeller_config.h>
13 
14 #include <IMP/kernel/Restraint.h>
15 #include <IMP/kernel/Particle.h>
17 #include <IMP/generic.h>
18 
19 IMPMODELLER_BEGIN_NAMESPACE
20 
21 class BinormalTerm;
22 
23 //! kernel::Modeller-style multiple binormal (phi/psi) restraint.
24 /** This implements a multiple binormal restraint on the two dihedral angles
25  between the two quads of kernel::Particles passed to the restraint, by implementing
26  equation A.76 in the
27  \external{http://salilab.org/modeller/9v7/manual/node441.html, kernel::Modeller manual}.
28  The two angles are typically the phi and psi dihedrals of a residue.
29  */
30 class IMPMODELLEREXPORT MultipleBinormalRestraint : public kernel::Restraint
31 {
32  std::vector<BinormalTerm> terms_;
33  kernel::ParticleQuad q1_, q2_;
34 public:
35  //! Create the multiple binormal restraint.
36  /** After creating the restraint, call add_term one or more times to add
37  BinormalTerms to the restraint.
38  \param[in] q1 First quad of particles.
39  \param[in] q2 Second quad of particles.
40  */
42 
43  //! Add a single BinormalTerm to the restraint.
44  void add_term(const BinormalTerm &term) {
45  terms_.push_back(term);
46  }
47 
48  virtual double
49  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
50  const IMP_OVERRIDE;
51  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
53 };
54 
55 //! A single binormal term in a MultipleBinormalRestraint.
57 {
58  double correlation_, weight_;
59  std::pair<double, double> means_, stdevs_;
60 
61  double evaluate(const double dihedral[2], double &sin1, double &sin2,
62  double &cos1, double &cos2, double &rho) const;
63 public:
64  BinormalTerm(): correlation_(-1), weight_(-1),
65  means_(-1,-1), stdevs_(-1,-1){}
66  friend class MultipleBinormalRestraint;
67 
68  void set_correlation(double correlation) { correlation_ = correlation; }
69  void set_weight(double weight) { weight_ = weight; }
70  void set_means(FloatPair means) { means_ = means; }
71  void set_standard_deviations(FloatPair stdevs) {
72  stdevs_ = stdevs;
73  }
74  IMP_SHOWABLE_INLINE(BinormalTerm,
75  {out << "correlation: " << correlation_
76  << "; weight: " << weight_
77  << "; means: " << means_.first << ", " << means_.second
78  << "; standard deviations: " << stdevs_.first << ", "
79  << stdevs_.second;});
80 };
82 
83 IMPMODELLER_END_NAMESPACE
84 
85 #endif /* IMPMODELLER_MULTIPLE_BINORMAL_RESTRAINT_H */
Class for adding derivatives from restraints to the model.
std::pair< double, double > FloatPair
A generic pair of floats.
Definition: base/types.h:27
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
A single binormal term in a MultipleBinormalRestraint.
Abstract base class for all restraints.
void add_term(const BinormalTerm &term)
Add a single BinormalTerm to the restraint.
A restraint is a term in an IMP ScoringFunction.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Classes to handle individual model particles.
Classes to handle individual model particles.
kernel::Modeller-style multiple binormal (phi/psi) restraint.
virtual ModelObjectsTemp do_get_inputs() const =0
Import IMP/kernel/generic.h in the namespace.