IMP logo
IMP Reference Guide  2.6.1
The Integrative Modeling Platform
RigidBodyUmbrella.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/RigidBodyUmbrella.h
3  * \brief Distance restraint between two particles.
4  *
5  * Copyright 2007-2016 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_RIGIDBODY_UMBRELLA_H
10 #define IMPCORE_RIGIDBODY_UMBRELLA_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/core/internal/tunneler_helpers.h>
14 #include "DistancePairScore.h"
15 #include "XYZ.h"
16 #include <IMP/generic.h>
17 
18 #include <IMP/Restraint.h>
19 
20 #include <iostream>
21 
22 IMPCORE_BEGIN_NAMESPACE
23 
24 //! Umbrella-like restraint for rigid bodies
25 /**
26  * Let \f$x\f$ be the reduced coordinates (ie centroid+rotation) of some rigid
27  * body, relative to a reference rigid body. Let \f$x_0\f$ be the center of the
28  * umbrella. Then the restraint score is
29  * \f[ E(x) = \frac{\alpha}{2} d^2(x,x_0) \f]
30  * \f$d\f$ is the distance between x and x_0
31  * \f[d^2(x,x_0) = d^2_\text{eucl}(COM,COM_0) + k*d^2_\text{quat}(Q,Q_0)\f]
32  * \f$d_\text{eucl}\f$ is the 3D euclidian distance
33  * \f$d_\text{quat}\f$ is the geodesic distance between two rotations, i.e. the
34  * angle of the rotation \f$Q\cdot Q_0^{-1}\f$
35  *
36  * \see RigidBodyTunneler
37  */
38 class IMPCOREEXPORT RigidBodyUmbrella : public Restraint {
39  public:
40  //! Create the restraint by specifying \f$x_0\f$ directly.
41  /** \param[in] m Model containing the ParticleIndexes.
42  \param[in] pi rigid body particle index to restrain
43  \param[in] ref rigid body particle index of reference
44  \param[in] x0 \f$x_0\f$ the restraint center
45  \param[in] alpha \f$\alpha\f$ restraint stiffness
46  \param[in] k \f$k\f$ relative weight between centroid and quaternion
47  restraints
48  \param[in] name restraint name
49  */
51  ParticleIndex ref, Floats x0, double alpha,
52  double k, std::string name = "RigidBodyUmbrella %1%");
53 
54  //! Create the restraint by specifying \f$x_0\f$ as a linear interpolation.
55  /**
56  * The restraint input is the triplet \f$\lambda,x_1,x_2\f$ with
57  * \f$\lambda\in [0,1]\f$ such that the restraint center is at
58  * \f[ x_0 = (1-\lambda) x_1 + \lambda x_2 \f]
59  *
60  * \param[in] m Model containing the ParticleIndexes.
61  * \param[in] pi rigid body particle index to restrain
62  * \param[in] ref rigid body particle index of reference
63  * \param[in] lambda \f$\lambda\f$ the restraint center
64  * \param[in] x1 \f$x_1\f$ the restraint center when \f$\lambda=0\f$
65  * \param[in] x2 \f$x_2\f$ the restraint center when \f$\lambda=1\f$
66  * \param[in] alpha \f$\alpha\f$ restraint stiffness
67  * \param[in] k \f$k\f$ relative weight between centroid and quaternion
68  * restraints
69  * \param[in] name restraint name
70  */
72  ParticleIndex ref, double lambda, Floats x1,
73  Floats x2, double alpha, double k,
74  std::string name = "RigidBodyUmbrella %1%");
75 
76  void set_x0(Floats x0) {x0_ = internal::Coord(x0); }
77  void set_x0(double lambda, Floats x1, Floats x2) {
78  x0_ = interpolate(lambda, x1, x2);
79  }
80  Floats get_x0() const {
81  return x0_.as_floats();
82  }
83  Floats get_x() const {
84  ParticleIndexes pis(1, pi_);
85  internal::Coord x(internal::get_coordinates_from_rbs(get_model(), pis,
86  ref_));
87  return x.as_floats();
88  }
89  void set_alpha(double alpha) { alpha_ = alpha; }
90  void set_k(double k) { k_ = k; }
91 
92  protected:
93  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
96 
97  private:
98  internal::Coord interpolate(double lambda, Floats x1, Floats x2) const;
99 
100  private:
101  ParticleIndex pi_, ref_;
102  internal::Coord x0_;
103  double alpha_, k_;
104 };
105 
106 IMPCORE_END_NAMESPACE
107 
108 #endif /* IMPCORE_RIGIDBODY_UMBRELLA_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Simple XYZ decorator.
Umbrella-like restraint for rigid bodies.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
A Score on the distance between a pair of particles.
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
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.