IMP  2.1.1
The Integrative Modeling Platform
ComplementarityRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multifit/ComplementarityRestraint.h
3  * \brief Calculate weighted excluded volume between rigid bodies
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_COMPLEMENTARITY_RESTRAINT_H
10 #define IMPMULTIFIT_COMPLEMENTARITY_RESTRAINT_H
11 
12 #include <IMP/multifit/multifit_config.h>
13 #include <IMP/core/rigid_bodies.h>
14 #include <IMP/core/DataObject.h>
16 
17 IMPMULTIFIT_BEGIN_NAMESPACE
18 
19 //! Compute the complementarity between two molecules.
20 /**
21  The score returned is infinity if the two molecules overlap by more
22  than the value set for set_maximum_penetration_score() or if the
23  two molecules are separated by more than set_maximum_separation().
24 
25  Otherwise, the integral of the set_complementarity_value() value over
26  a layer of thickness set_complementarity_thickness() around the molecule
27  is returned.
28 
29  \note currently each of the particle lists must belong to exactly one
30  rigid body. And, currently, each rigid body can only be associated with
31  one list of particles (that is, there cannot be multiple restraints with
32  different lists of particles that all belong to the same rigid body).
33 
34  \note The restraint does not support derivatives.
35 
36  \note The restraint pretty much only makes sense for use with Domino as it
37  returns infinity for many cases. Monte Carlo might make sense with certain
38  parameters.
39 */
40 class IMPMULTIFITEXPORT ComplementarityRestraint : public kernel::Restraint
41 {
42 public:
44  std::string name="ComplementarityRestraint %1%");
45  /** If the two molecules have a penetration score of more than this,
46  infinity is returned as the score. This score is roughly the number of
47  cubic angstroms that the two molecules overlap (assuming only one
48  internal layer). */
50  maximum_penetration_score_=s;
51  }
52  /** Alternatively, you can bound the maximum allowed penetration.
53  */
54  void set_maximum_penetration(double d) {
55  maximum_penetration_=d;
56  }
57  /** If the two molecules' bounding sphere surfaces are separated by more
58  than this distance, infinity is returned.
59  */
60  void set_maximum_separation(double s) {
61  maximum_separation_=s;
62  }
63  /** Set the thickness to use for the external complementarity layer.*/
65  complementarity_thickness_=th;
66  update_voxel();
67  }
68  /** Set the value to use for external complementarity voxels.
69  */
70  void set_complementarity_value(double th) {
71  complementarity_value_=th;
72  }
73  /** Set the thickness of the interior layers. */
74  void set_interior_layer_thickness(double th) {
75  interior_thickness_=th;
76  update_voxel();
77  }
78 
79  void set_penetration_coefficient(double pc)
80  {
81  penetration_coef_ = pc;
82  }
83 
84  void set_complementarity_coefficient(double cc)
85  {
86  complementarity_coef_ = cc;
87  }
88 
89  void set_boundary_coefficient(double bc)
90  {
91  boundary_coef_ = bc;
92  }
93  float get_voxel_size() const {return voxel_size_;}
94  virtual double
95  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
96  const IMP_OVERRIDE;
97  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
99 #ifndef IMP_DOXYGEN
100  double unprotected_evaluate_if_good(DerivativeAccumulator *accum,
101  double max) const;
102 #endif
103  private:
104  typedef std::pair<algebra::Transformation3D,
105  algebra::DenseGrid3D<float> > GridPair;
107  GridObject *get_grid_object(core::RigidBody rb,
108  const kernel::ParticlesTemp &a,
109  ObjectKey ok,
110  double thickness,
111  double value,
112  double interior_thickness,
113  double voxel) const;
116  double thickness,
117  double value,
118  double interior_thickness,
119  double voxel) const;
120  void update_voxel();
121  kernel::ParticlesTemp a_, b_;
122  core::RigidBody rba_, rbb_;
123  ObjectKey ok_;
124  // parameters
125  double maximum_separation_, maximum_penetration_score_;
126  double maximum_penetration_;
127  double complementarity_thickness_, complementarity_value_;
128  double penetration_coef_, complementarity_coef_, boundary_coef_;
129  double interior_thickness_, voxel_size_;
130 };
131 
132 IMPMULTIFIT_END_NAMESPACE
133 
134 #endif /* IMPMULTIFIT_COMPLEMENTARITY_RESTRAINT_H */
Simple 3D transformation class.
A base class for Keys.
Definition: kernel/Key.h:46
Compute the complementarity between two molecules.
Class for adding derivatives from restraints to the model.
A modifier which variables within a ball.
algebra::GridD< 3, algebra::DenseGridStorageD< 3, float >, float > get_grid(DensityMap *in_map)
functionality for defining rigid bodies
A restraint is a term in an IMP ScoringFunction.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual ModelObjectsTemp do_get_inputs() const =0
A class to represent a voxel grid.
A decorator for a rigid body.
Definition: rigid_bodies.h:75