IMP  2.0.0
The Integrative Modeling Platform
MultipleBinormalRestraint.h
Go to the documentation of this file.
1 /**
2  * \file MultipleBinormalRestraint.h
3  * \brief 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/Restraint.h>
15 #include <IMP/Particle.h>
16 #include <IMP/ParticleTuple.h>
17 #include <IMP/generic.h>
18 
19 IMPMODELLER_BEGIN_NAMESPACE
20 
21 class BinormalTerm;
22 
23 //! 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 Particles passed to the restraint, by implementing
26  equation A.76 in the
27  \external{http://salilab.org/modeller/9v7/manual/node441.html, Modeller manual}.
28  The two angles are typically the phi and psi dihedrals of a residue.
29  */
30 class IMPMODELLEREXPORT MultipleBinormalRestraint : public Restraint
31 {
32  std::vector<BinormalTerm> terms_;
33  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 
49 };
50 
51 //! A single binormal term in a MultipleBinormalRestraint.
53 {
54  double correlation_, weight_;
55  std::pair<double, double> means_, stdevs_;
56 
57  double evaluate(const double dihedral[2], double &sin1, double &sin2,
58  double &cos1, double &cos2, double &rho) const;
59 public:
60  BinormalTerm(): correlation_(-1), weight_(-1),
61  means_(-1,-1), stdevs_(-1,-1){}
62  friend class MultipleBinormalRestraint;
63 
64  void set_correlation(double correlation) { correlation_ = correlation; }
65  void set_weight(double weight) { weight_ = weight; }
66  void set_means(FloatPair means) { means_ = means; }
67  void set_standard_deviations(FloatPair stdevs) {
68  stdevs_ = stdevs;
69  }
71  {out << "correlation: " << correlation_
72  << "; weight: " << weight_
73  << "; means: " << means_.first << ", " << means_.second
74  << "; standard deviations: " << stdevs_.first << ", "
75  << stdevs_.second;});
76 };
78 
79 IMPMODELLER_END_NAMESPACE
80 
81 #endif /* IMPMODELLER_MULTIPLE_BINORMAL_RESTRAINT_H */