IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
rigid_bodies.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/rigid_bodies.h
3  * \brief functionality for defining rigid bodies
4  *
5  * Copyright 2007-2015 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCORE_RIGID_BODIES_H
9 #define IMPCORE_RIGID_BODIES_H
10 
11 #include <IMP/core/core_config.h>
12 #include "internal/rigid_bodies.h"
13 
14 #include "XYZ.h"
15 #include "XYZR.h"
16 #include <IMP/SingletonContainer.h>
17 #include <IMP/SingletonModifier.h>
18 #include <IMP/Refiner.h>
19 #include <IMP/algebra/Vector3D.h>
20 #include <IMP/algebra/Rotation3D.h>
23 
24 IMPCORE_BEGIN_NAMESPACE
25 
26 IMP_DECORATORS_DECL(RigidMember, RigidMembers);
27 
28 //! A decorator for a rigid body
29 /** A rigid body particle describes a set of particles, known
30  as the members, which move rigidly together. The rigid body
31  is represented as an algebra::ReferenceFrame3D coupled
32  with local coordinates (RigidMember::get_internal_coordinates())
33  for the members expressed in that reference frame. The
34  global coordinates of the members are accessed, as with
35  other global coordinates, via the XYZ::get_coordinates().
36 
37  Since the
38  members are simply a set of particles which move together
39  they don't (necessarily) define a shape. For example,
40  the members of the rigid body made from a molecular hierarchy
41  would include particles corresponding to intermediate levels
42  of the hierarchy. As a result, methods
43  that use rigid bodies usually should simply take the list of
44  particles they are interested in and then check for rigid
45  bodies internally.
46 
47  The initial reference of the rigid body is computed from
48  the coordinates, masses and radii of the particles
49  passed to the constructor, based on diagonalizing the
50  inertial tensor (which is not stored, currently).
51 
52  RigidBodies can be nested (that is, a RigidBody can have
53  another RigidBody as a member). This can be useful for
54  organizational reasons as well as for accelerating
55  computations since operations are affected by
56  the total number of children contained in the rigid body
57  being operated on. Examples of this include collision detection
58  where if you have multiple representations of geometry at
59  different resolutions it is faster to put each of them
60  in a separate rigid body and then create one rigid body
61  containing all of them.
62 
63  It is often desirable to randomize the orientation of a rigid
64  body:
65  \include randomize_rigid_body.py
66 
67  \usesconstraint
68 
69  \see RigidMember
70  \see NonRigidMember
71  \see RigidBodyMover
72  \see RigidClosePairsFinder
73  \see RigidBodyDistancePairScore
74  */
75 class IMPCOREEXPORT RigidBody : public XYZ {
76  private:
77  /* Computes the coordinates of p given its internal (local)
78  coordinates and the current position and orientation of the
79  rigid body.
80  */
82 
83  void add_member_internal(Particle *p,
84  const algebra::ReferenceFrame3D &rf);
85 
86  void on_change();
87 
88  static void teardown_constraints(Particle *p);
89 
90  static ObjectKey get_constraint_key_0();
91 
92  static ObjectKey get_constraint_key_1();
93 
94  // setup rigid body attributes with particles in ps, using their
95  // center of mass, inertia tensor to initialize the reference frame
96  static void do_setup_particle(Model *m, ParticleIndex pi,
98 
99  // setup a rigid body with specified reference frame
100  static void do_setup_particle(Model *m, ParticleIndex pi,
101  const algebra::ReferenceFrame3D &rf);
102 
103  void setup_score_states();
104 
105  // add a member associated with xyz coords (if it has a ref frame,
106  // it is still being ignored)
107  void add_point_member(ParticleIndex pi);
108 
109  // add a member associated with a reference frame
110  void add_rigid_body_member(ParticleIndex pi);
111 
112  public:
113  RigidMembers get_rigid_members() const;
114 
115  //! Returns a list of all members that are not themselves decorated as
116  //! rigid bodies, in the form of particle indexes.
118  static ParticleIndexes empty;
119  if (get_model()->get_has_attribute(internal::rigid_body_data().members_,
120  get_particle_index())) {
121  return get_model()->get_attribute(internal::rigid_body_data().members_,
123  } else {
124  return empty;
125  }
126  }
127 
128  //! Get all members that are themselves decorated as rigid bodies,
129  //! as model particle indexes
131  static ParticleIndexes empty;
132  if (get_model()->get_has_attribute(
133  internal::rigid_body_data().body_members_, get_particle_index())) {
134  return get_model()->get_attribute(
135  internal::rigid_body_data().body_members_, get_particle_index());
136  } else {
137  return empty;
138  }
139  }
140 
141  //! Get the particle indexes of any member of this rigid body, regardless
142  //! of whether it is itself a rigid body or not
144  return get_member_particle_indexes() + get_body_member_particle_indexes();
145  }
146 
148 
149  /**
150  Create a rigid body for pi with the particle indexes ps as its members.
151  The coordinates of pi are set to the center of mass of ps and the rotation
152  of its reference frame is based on the diagonalized inertia tensor of ps.
153 
154  @note If size(ps)=1, then its reference frame is copied if it is a
155  rigid body, or its rotation is set to identity if it is not
156  a rigid body.
157  */
159 
160  /**
161  Create a rigid body with the passed reference frame as its initial
162  position.
163  */
165 
166  //! Make the rigid body no longer rigid.
167  static void teardown_particle(RigidBody rb);
168 
169  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(RigidBody);
170  ~RigidBody();
171 
172  //! Return true if the particle is a rigid body
173  static bool get_is_setup(Model *m, ParticleIndex pi) {
174  return internal::get_has_required_attributes_for_body(m, pi);
175  }
176 
177  // swig doesn't support using, so the method is wrapped
178  //! Get the coordinates of the particle
180 
181  //! Get the reference frame for the local coordinates
184  get_model()->get_attribute(internal::rigid_body_data().quaternion_[0],
186  get_model()->get_attribute(internal::rigid_body_data().quaternion_[1],
188  get_model()->get_attribute(internal::rigid_body_data().quaternion_[2],
190  get_model()->get_attribute(internal::rigid_body_data().quaternion_[3],
191  get_particle_index()));
192  IMP_USAGE_CHECK_FLOAT_EQUAL(v.get_squared_magnitude(), 1,
193  "Rotation is not a unit vector: " << v);
194  /*if (v.get_squared_magnitude() > 0){
195  v = v.get_unit_vector();
196  } else {
197  v = algebra::VectorD<4>(1,0,0,0);
198  }*/
199  bool assume_normalized = true;
200  IMP::algebra::Rotation3D rot(v, assume_normalized);
203  }
204 
205  //! Set the current reference frame
206  /** All members of the rigid body will have their coordinates updated
207  immediately.
208  \see IMP::core::transform(RigidBody,const algebra::Transformation3D&)
209  \see set_reference_frame_lazy()
210  */
211  void set_reference_frame(const IMP::algebra::ReferenceFrame3D &tr);
212 
213  //! Change the reference, delay updating the members until evaluate
214  /** \see set_reference_frame()
215  */
216  void set_reference_frame_lazy(const IMP::algebra::ReferenceFrame3D &tr);
217 
218  /** Update the reference frame of the rigid body based on aligning
219  the current global coordinates of the passed rigid body members
220  onto their old local coordinates. Non-passed members are ignored.
221 
222  This method is useful for updating the rigid body after new
223  global coordinates were loaded for the members. The members are
224  passed explicitly since, typically, some are desired to just
225  move along with the newly loaded rigid body.
226 
227  \note This requires at least three members that are not colinear
228  to work.
229  */
230  void set_reference_frame_from_members(const ParticleIndexes &members);
231 
232 #ifndef IMP_DOXYGEN
233  /** This takes a Cartesian derivative in global coordinates,
234  and a location in internal coordinates.
235 
236  It is currently hidden since the function signature is highly ambiguous.
237  */
238  inline void add_to_derivatives(const algebra::Vector3D &derivative,
239  const algebra::Vector3D &local_location,
241 
242  // faster if all is cached
243  inline void add_to_derivatives(const algebra::Vector3D &derivative,
244  const algebra::Vector3D &global_derivative,
245  const algebra::Vector3D &local_location,
246  const algebra::Rotation3D &rot,
248 #endif
249 
250  /** The units are kCal/Mol/Radian */
252  algebra::Vector3D ret;
253  for (unsigned int i = 0; i < 3; ++i) {
254  ret[i] = get_model()->get_derivative(
255  internal::rigid_body_data().torque_[i], get_particle_index());
256  }
257  return ret;
258  }
259 
260  //! Returns true if the rigid body coordinates are flagged as
261  //! optimized for Optimizer objects
262  bool get_coordinates_are_optimized() const;
263 
264  //! Set whether the rigid body coordinates are flagged as optimized
265  //! for Optimizer objects
266  void set_coordinates_are_optimized(bool tf);
267 
268  //! Normalize the quaternion
269  void normalize_rotation();
270 
271  //! Update the global coordinates of the members based on
272  //! their local coordinates and this rigid body's reference frame
273  void update_members();
274 
275  //! Get the derivatives of the quaternion
276  algebra::VectorD<4> get_rotational_derivatives() const;
277 
278 #ifndef IMP_DOXYGEN
279  unsigned int get_number_of_members() const {
280  return get_body_member_particle_indexes().size() +
281  get_member_particle_indexes().size();
282  }
283 
284  RigidMember get_member(unsigned int i) const;
285 #endif
286  //! Add a proper member that moves rigidly with this rigid body,
287  //! properly handling rigid bodies and XYZ particles.
288  /**
289  Add p to the list of members. If p is a valid RigidBody, it is added
290  as a rigid body member, otherwise it is added as a point member
291  (for which the rotation is not tracked). By default, p is considered
292  a strictly rigid member, in that its local coordinates are not expected
293  to change independently.
294 
295  \see add_non_rigid_member
296  */
297  void add_member(ParticleIndexAdaptor p);
298 
299  /** Add a non-rigid member, for which internal coordinates may change
300  independently.
301 
302  @note Currently RigidBody non-rigid members are not handled properly.
303  */
304  void add_non_rigid_member(ParticleIndexAdaptor p);
305 
306  /** Set whether a particular member is flagged as a rigid member
307  or as a non-rigid member. This affects the way the rigid body
308  updates the coordinates and / or reference frame of its members.
309  */
310  void set_is_rigid_member(ParticleIndex pi, bool tf);
311 };
312 
313 #ifndef IMP_DOXYGEN
314 // inline implementation
315 void RigidBody::add_to_derivatives(const algebra::Vector3D &deriv_local,
316  const algebra::Vector3D &deriv_global,
317  const algebra::Vector3D &local,
318  const algebra::Rotation3D &rot,
319  DerivativeAccumulator &da) {
320  // const algebra::Vector3D deriv_global= rot*deriv_local;
321  // IMP_LOG_TERSE( "Accumulating rigid body derivatives" << std::endl);
322  algebra::VectorD<4> q(0, 0, 0, 0);
323  for (unsigned int j = 0; j < 4; ++j) {
324  algebra::Vector3D v = rot.get_derivative(local, j);
325  q[j] = deriv_global * v;
326  }
327  XYZ::add_to_derivatives(deriv_global, da);
328  for (unsigned int j = 0; j < 4; ++j) {
329  get_model()->add_to_derivative(internal::rigid_body_data().quaternion_[j],
330  get_particle_index(), q[j], da);
331  }
332  algebra::Vector3D torque = algebra::get_vector_product(local, deriv_local);
333  for (unsigned int i = 0; i < 3; ++i) {
334  get_model()->add_to_derivative(internal::rigid_body_data().torque_[i],
335  get_particle_index(), torque[i], da);
336  }
337 }
338 
339 // inline implementation
340 void RigidBody::add_to_derivatives(const algebra::Vector3D &deriv_local,
341  const algebra::Vector3D &local,
342  DerivativeAccumulator &da) {
343  algebra::Rotation3D rot =
344  get_reference_frame().get_transformation_to().get_rotation();
345  const algebra::Vector3D deriv_global = rot * deriv_local;
346  add_to_derivatives(deriv_local, deriv_global, local, rot, da);
347 }
348 #endif
349 
350 
351 /** It is often useful to store precalculated properties of the rigid body
352  for later use. These need to be cleared out when the rigid body changes.
353  To make sure this happens, register the key here.
354 */
355 void IMPCOREEXPORT add_rigid_body_cache_key(ObjectKey k);
356 
357 //! A member of a rigid body, it has internal (local) coordinates
358 class IMPCOREEXPORT RigidBodyMember : public XYZ {
360 
361  RigidBody get_rigid_body() const;
362 
363  //! Return the internal (local) coordinates of this member
364  /** These coordinates are relative to the reference frame of the
365  rigid body that owns it
366  */
368  return get_model()->get_internal_coordinates(get_particle_index());
369  }
370 
371  //! set the internal (local) coordinates for this member
373  get_model()->get_internal_coordinates(get_particle_index()) = v;
374  get_rigid_body().get_model()->clear_particle_caches(get_particle_index());
375  }
376 
377  //! Set the internal (local) coordinates of this member,
378  //! assuming it is a rigid body itself
379  /** Set the internal (local) coordinates of this rigid body
380  relative to the reference frame of the rigid body that owns it
381  */
384  get_model()->get_has_attribute(
385  internal::rigid_body_data().lquaternion_[0], get_particle_index()),
386  "Can only set the internal transformation if member is"
387  << " a rigid body itself.");
388  set_internal_coordinates(v.get_translation());
389 
390  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[0],
392  v.get_rotation().get_quaternion()[0]);
393  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[1],
395  v.get_rotation().get_quaternion()[1]);
396  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[2],
398  v.get_rotation().get_quaternion()[2]);
399  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[3],
401  v.get_rotation().get_quaternion()[3]);
402  get_rigid_body().get_model()->clear_particle_caches(get_particle_index());
403  }
404 
405  //! Return the internal (local) coordinates of this member,
406  //! assuming it is a rigid body itself
407  /** Return the internal (local) coordinates of this rigid body
408  relative to the reference frame of the rigid body that owns it
409  */
412  get_model()->get_has_attribute(
413  internal::rigid_body_data().lquaternion_[0], get_particle_index()),
414  "Can only set the internal transformation if member is a "
415  << "rigid body itself.");
416  algebra::Vector3D tr =
417  get_model()->get_internal_coordinates(get_particle_index());
419  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[0],
421  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[1],
423  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[2],
425  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[3],
426  get_particle_index()));
427  return algebra::Transformation3D(rot, tr);
428  }
429 
430  ~RigidBodyMember();
431  //! sets the global coordinates of this member using XYZ::set_coordinates()
432  // this is here since swig does like using statements
433  void set_coordinates(const algebra::Vector3D &center) {
434  XYZ::set_coordinates(center);
435  }
436 
437 #ifndef IMP_DOXYGEN
438  //! Set the global coordinates from the internal coordinates,
439  //! using tr as a reference frame
441  set_coordinates(tr.get_transformed(get_internal_coordinates()));
442  }
443 #endif
444  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(RigidBodyMember);
445 
446  //! return true if it is a rigid member
448  return internal::get_has_required_attributes_for_member(m, p);
449  }
450 
451  static FloatKeys get_internal_coordinate_keys() {
452  return internal::rigid_body_data().child_keys_;
453  }
454 };
455 
456 //! A decorator for a particle that is part of a rigid body, and is
457 //! actually rigid
458 /**
459  RigidMember particles, as opposed to NonRigidMember particles, are
460  not expected to change their internal (local) coordinates or
461  reference frames, and their global coordinates are expected to
462  change only through setting the coordinates (or reference frame) of
463  the rigid body that owns them.
464 
465  \see RigidBody
466  */
467 class IMPCOREEXPORT RigidMember : public RigidBodyMember {
468  public:
470 
471  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(RigidMember);
472  ~RigidMember();
473 
474  //! return true if it is a rigid member
476  return internal::get_has_required_attributes_for_rigid_member(m, p);
477  }
478 };
479 
480 //! A decorator for a particle that is part of a rigid body but not rigid
481 /** NonRigidMembers, like RigidMembers, have internal coordinates and move
482  along with the rigid body. However, it is expected that their internal
483  coordinates will change, and so they are not part of structures that
484  assume rigidity.
485 
486  \see RigidBody
487  */
488 class IMPCOREEXPORT NonRigidMember : public RigidBodyMember {
489  public:
491  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(NonRigidMember);
492  ~NonRigidMember();
493 
494  //! return true if it is a rigid member
495  static bool get_is_setup(Model *m, ParticleIndex p) {
496  return internal::get_has_required_attributes_for_non_member(m, p);
497  }
498 };
499 
500 #ifndef IMP_DOXYGEN
501 
502 class IMPCOREEXPORT RigidMembersRefiner : public Refiner {
503  public:
504  RigidMembersRefiner(std::string name = "RigidMembersRefiner%d")
505  : Refiner(name) {}
506  virtual bool get_can_refine(Particle *) const IMP_OVERRIDE;
507 #ifndef SWIG
508  using Refiner::get_refined;
509 #endif
510  virtual const ParticlesTemp get_refined(Particle *) const
511  IMP_OVERRIDE;
512  virtual ModelObjectsTemp do_get_inputs(
513  Model *m, const ParticleIndexes &pis) const IMP_OVERRIDE;
514  IMP_OBJECT_METHODS(RigidMembersRefiner);
515 };
516 
517 namespace internal {
518 IMPCOREEXPORT RigidMembersRefiner *get_rigid_members_refiner();
519 }
520 #endif
521 
522 //! Transform a rigid body
523 /** The transformation is applied current conformation of the rigid
524  body, as opposed to replacing the current conformation, as in
525  RigidBody::set_reference_frame().
526 
527  \see RigidBody
528  \see algebra::Transformation3D
529 */
530 inline void transform(RigidBody a, const algebra::Transformation3D &tr) {
531  a.set_reference_frame(get_transformed(a.get_reference_frame(), tr));
532 }
533 
534 /** Compute the rigid body reference frame given a set of input particles.
535  */
536 IMPCOREEXPORT algebra::ReferenceFrame3D get_initial_reference_frame(
537  Model *m, const ParticleIndexes &pis);
538 
539 inline algebra::ReferenceFrame3D get_initial_reference_frame(
540  const ParticlesTemp &ps) {
541  if (ps.empty()) {
542  return algebra::ReferenceFrame3D();
543  }
544  return get_initial_reference_frame(ps[0]->get_model(),
545  get_indexes(ps));
546 }
547 
548 /** Create a set of rigid bodies that are bound together for efficiency.
549  These rigid bodies cannot nest or have other dependencies amongst them.
550 
551  All rigid bodies have the default reference frame.
552 
553  \note Do not use this with DOMINO as all the rigid bodies use the same
554  ScoreState and so will be considered inter-dependent.
555 */
556 IMPCOREEXPORT ParticlesTemp create_rigid_bodies(Model *m,
557  unsigned int n,
558  bool no_members =
559  false);
560 
561 IMP_DECORATORS_DEF(RigidMember, RigidMembers);
562 IMP_DECORATORS(RigidBody, RigidBodies, XYZs);
563 
564 /** Show the rigid body hierarchy rooted at passed body. */
565 IMPCOREEXPORT void show_rigid_body_hierarchy(RigidBody rb,
566  TextOutput out =
567  TextOutput(std::cout));
568 
569 //! Return the index of the outer-most rigid body containing the member.
570 /** Use this to, for example, group particles into rigid bodies. */
571 IMPCOREEXPORT ParticleIndex get_root_rigid_body(RigidMember m);
572 
573 IMPCORE_END_NAMESPACE
574 
575 #endif /* IMPCORE_RIGID_BODIES_H */
Key< 4, true > ObjectKey
The type used to identify an Object attribute.
Definition: base_types.h:48
void add_to_derivatives(const algebra::Vector3D &v, DerivativeAccumulator &d)
Add something to the derivative of the coordinates.
Definition: XYZ.h:79
void set_internal_coordinates(const algebra::Vector3D &v) const
set the internal (local) coordinates for this member
Definition: rigid_bodies.h:372
A Modifier on ParticlesTemp.
Simple 3D transformation class.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Definition: Decorator.h:186
A member of a rigid body, it has internal (local) coordinates.
Definition: rigid_bodies.h:358
A container for Singletons.
ParticleIndex get_root_rigid_body(RigidMember m)
Return the index of the outer-most rigid body containing the member.
#define IMP_USAGE_CHECK_FLOAT_EQUAL(expra, exprb, message)
Definition: check_macros.h:178
algebra::Vector3D get_coordinates() const
Get the coordinates of the particle.
Definition: rigid_bodies.h:179
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Model * get_model() const
Returns the Model containing the particle.
Definition: Decorator.h:189
ParticlesTemp create_rigid_bodies(Model *m, unsigned int n, bool no_members=false)
Index< ParticleIndexTag > ParticleIndex
Definition: base_types.h:154
bool get_coordinates_are_optimized() const
Get whether the coordinates are optimized.
Definition: XYZ.h:86
void add_rigid_body_cache_key(ObjectKey k)
const Vector4D & get_quaternion() const
Return the quaternion so that it can be stored.
Definition: Rotation3D.h:192
Simple XYZ decorator.
A reference frame in 3D.
void show_rigid_body_hierarchy(RigidBody rb, TextOutput out=TextOutput(std::cout))
void clear_particle_caches(ParticleIndex pi)
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition: base_types.h:82
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
const Rotation3D & get_rotation() const
returns the rotation associated with this transformation
algebra::Vector3D get_torque() const
Definition: rigid_bodies.h:251
static bool get_is_setup(Model *m, ParticleIndexAdaptor p)
return true if it is a rigid member
Definition: rigid_bodies.h:475
virtual bool get_can_refine(Particle *) const
Return true if this refiner can refine that particle.
Definition: Refiner.h:51
Vector3D get_vector_product(const Vector3D &p1, const Vector3D &p2)
Returns the vector product (cross product) of two vectors.
Definition: Vector3D.h:31
void set_reference_frame(const IMP::algebra::ReferenceFrame3D &tr)
Set the current reference frame.
A Cartesian vector in D-dimensions.
Definition: VectorD.h:52
Refine a particle into a list of particles.
void set_coordinates(const algebra::Vector3D &v)
set all coordinates from a vector
Definition: XYZ.h:62
static bool get_is_setup(Model *m, ParticleIndex pi)
Return true if the particle is a rigid body.
Definition: rigid_bodies.h:173
const ParticleIndexes & get_member_particle_indexes() const
Definition: rigid_bodies.h:117
static bool get_is_setup(Model *m, ParticleIndexAdaptor p)
return true if it is a rigid member
Definition: rigid_bodies.h:447
Represent an XYZR particle with a sphere.
void set_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
const algebra::Vector3D & get_coordinates() const
Convert it to a vector.
Definition: XYZ.h:107
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
Vector3D get_transformed(const Vector3D &o) const
transform
A decorator for a particle that is part of a rigid body but not rigid.
Definition: rigid_bodies.h:488
Simple 3D rotation class.
void set_internal_transformation(const algebra::Transformation3D &v)
Definition: rigid_bodies.h:382
3D rotation class.
Definition: Rotation3D.h:46
void set_coordinates_are_optimized(bool tf) const
Set whether the coordinates are optimized.
Definition: XYZ.h:92
void set_coordinates(const algebra::Vector3D &center)
sets the global coordinates of this member using XYZ::set_coordinates()
Definition: rigid_bodies.h:433
#define IMP_DECORATOR_METHODS(Name, Parent)
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Abstract class to implement hierarchical methods.
Definition: Refiner.h:34
Simple 3D vector class.
Class to handle individual model particles.
Definition: Particle.h:37
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
void transform(RigidBody a, const algebra::Transformation3D &tr)
Transform a rigid body.
Definition: rigid_bodies.h:530
Simple 3D rotation class.
ParticleIndexes get_member_indexes() const
Definition: rigid_bodies.h:143
const ParticleIndexes & get_body_member_particle_indexes() const
Definition: rigid_bodies.h:130
A decorator for a rigid body.
Definition: rigid_bodies.h:75
const Vector3D & get_translation() const
returns the translation vector associated with this transformation
algebra::Transformation3D get_internal_transformation() const
Definition: rigid_bodies.h:410
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
Decorator for a sphere-like particle.
ParticleIndexes get_indexes(const ParticlesTemp &ps)
static bool get_is_setup(Model *m, ParticleIndex p)
return true if it is a rigid member
Definition: rigid_bodies.h:495
#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.
const algebra::Vector3D & get_internal_coordinates() const
Return the internal (local) coordinates of this member.
Definition: rigid_bodies.h:367
IMP::algebra::ReferenceFrame3D get_reference_frame() const
Get the reference frame for the local coordinates.
Definition: rigid_bodies.h:182