IMP logo
IMP Reference Guide  2.7.0
The Integrative Modeling Platform
modeller/MultipleBinormalRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/modeller/MultipleBinormalRestraint.h
3  * \brief Modeller-style multiple binormal (phi/psi) restraint.
4  *
5  * Copyright 2007-2017 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/Restraint.h>
15 #include <IMP/Particle.h>
16 #include <IMP/generic.h>
17 
18 IMPMODELLER_BEGIN_NAMESPACE
19 
20 class BinormalTerm;
21 
22 //! Modeller-style multiple binormal (phi/psi) restraint.
23 /** This implements a multiple binormal restraint on the two dihedral angles
24  between the two quads of Particles passed to the restraint, by
25  implementing
26  equation A.77 in the
27  \external{https://salilab.org/modeller/9.16/manual/node491.html,
28  Modeller manual}.
29  The two angles are typically the phi and psi dihedrals of a residue.
30  \deprecated_at{2.7} Moved to core::MultipleBinormalRestraint
31 
32  */
33 class IMPMODELLEREXPORT MultipleBinormalRestraint : public Restraint {
34  std::vector<BinormalTerm> terms_;
35  ParticleIndexQuad q1_, q2_;
36 
37  public:
38 
39  //! Create the multiple binormal restraint.
40  /** After creating the restraint, call add_term one or more times to add
41  BinormalTerms to the restraint.
42  \param[in] m Model.
43  \param[in] q1 First quad of particles.
44  \param[in] q2 Second quad of particles.
45  */
46  IMPMODELLER_DEPRECATED_OBJECT_DECL(2.7)
48  const ParticleIndexQuad &q2);
49 
50  //! Add a single BinormalTerm to the restraint.
51  void add_term(const BinormalTerm &term) { terms_.push_back(term); }
52 
53  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
54  const IMP_OVERRIDE;
57 };
58 
59 //! A single binormal term in a MultipleBinormalRestraint.
60 class BinormalTerm {
61  double correlation_, weight_;
62  std::pair<double, double> means_, stdevs_;
63 
64  double evaluate(const double dihedral[2], double &sin1, double &sin2,
65  double &cos1, double &cos2, double &rho) const;
66 
67  public:
68  BinormalTerm()
69  : correlation_(-1), weight_(-1), means_(-1, -1), stdevs_(-1, -1) {
70  }
71  friend class MultipleBinormalRestraint;
72 
73  void set_correlation(double correlation) { correlation_ = correlation; }
74  void set_weight(double weight) { weight_ = weight; }
75  void set_means(FloatPair means) { means_ = means; }
76  void set_standard_deviations(FloatPair stdevs) { stdevs_ = stdevs; }
77  IMP_SHOWABLE_INLINE(BinormalTerm, {
78  out << "correlation: " << correlation_ << "; weight: " << weight_
79  << "; means: " << means_.first << ", " << means_.second
80  << "; standard deviations: " << stdevs_.first << ", " << stdevs_.second;
81  });
82 };
84 
85 IMPMODELLER_END_NAMESPACE
86 
87 #endif /* IMPMODELLER_MULTIPLE_BINORMAL_RESTRAINT_H */
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
std::pair< double, double > FloatPair
A generic pair of floats.
Definition: types.h:27
A more IMP-like version of the std::vector.
Definition: Vector.h:39
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
A single binormal term in a MultipleBinormalRestraint.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Definition: value_macros.h:23
void add_term(const BinormalTerm &term)
Add a single BinormalTerm to the restraint.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Modeller-style multiple binormal (phi/psi) restraint.
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:52
Various important functionality for implementing decorators.