IMP logo
IMP Reference Guide  2.10.0
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-2018 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 Restraint {
41  public:
43  const ParticlesTemp &b,
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) { maximum_penetration_ = d; }
55  /** If the two molecules' bounding sphere surfaces are separated by more
56  than this distance, infinity is returned.
57  */
58  void set_maximum_separation(double s) { maximum_separation_ = s; }
59  /** Set the thickness to use for the external complementarity layer.*/
61  complementarity_thickness_ = th;
62  update_voxel();
63  }
64  /** Set the value to use for external complementarity voxels.
65  */
66  void set_complementarity_value(double th) { complementarity_value_ = th; }
67  /** Set the thickness of the interior layers. */
68  void set_interior_layer_thickness(double th) {
69  interior_thickness_ = th;
70  update_voxel();
71  }
72 
73  void set_penetration_coefficient(double pc) { penetration_coef_ = pc; }
74 
75  void set_complementarity_coefficient(double cc) {
76  complementarity_coef_ = cc;
77  }
78 
79  void set_boundary_coefficient(double bc) { boundary_coef_ = bc; }
80  float get_voxel_size() const { return voxel_size_; }
81  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
82  const IMP_OVERRIDE;
85 #ifndef IMP_DOXYGEN
86  double unprotected_evaluate_if_good(DerivativeAccumulator *accum,
87  double max) const;
88 #endif
89  private:
90  typedef std::pair<algebra::Transformation3D, algebra::DenseGrid3D<float> >
91  GridPair;
93  GridObject *get_grid_object(core::RigidBody rb,
94  const ParticlesTemp &a, ObjectKey ok,
95  double thickness, double value,
96  double interior_thickness, double voxel) const;
98  double thickness, double value,
99  double interior_thickness,
100  double voxel) const;
101  void update_voxel();
102  ParticlesTemp a_, b_;
103  core::RigidBody rba_, rbb_;
104  ObjectKey ok_;
105  // parameters
106  double maximum_separation_, maximum_penetration_score_;
107  double maximum_penetration_;
108  double complementarity_thickness_, complementarity_value_;
109  double penetration_coef_, complementarity_coef_, boundary_coef_;
110  double interior_thickness_, voxel_size_;
111 };
112 
113 IMPMULTIFIT_END_NAMESPACE
114 
115 #endif /* IMPMULTIFIT_COMPLEMENTARITY_RESTRAINT_H */
Compute the complementarity between two molecules.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A modifier which variables within a ball.
algebra::GridD< 3, algebra::DenseGridStorageD< 3, float >, float > get_grid(DensityMap *in_map)
Return a dense grid containing the voxels of the passed density map.
functionality for defining rigid bodies
All grids that are in the Python API should be defined here.
A dense grid of values.
A decorator for a rigid body.
Definition: rigid_bodies.h:82
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:54