IMP  2.4.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(kernel::Particle *p,
84  const algebra::ReferenceFrame3D &rf);
85 
86  void on_change();
87 
88  static void teardown_constraints(kernel::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(kernel::Model *m, kernel::ParticleIndex pi,
98 
99  // setup a rigid body with specified reference frame
100  static void do_setup_particle(kernel::Model *m, kernel::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(kernel::ParticleIndex pi);
108 
109  // add a member associated with a reference frame
110  void add_rigid_body_member(kernel::ParticleIndex pi);
111 
112  public:
113  /** This method does not return non-rigid members.
114 
115  \deprecated_at{2.2} Use get_rigid_members() instead.
116  */
117  IMPCORE_DEPRECATED_FUNCTION_DECL(2.2)
118  RigidMembers get_members() const {
119  IMPCORE_DEPRECATED_FUNCTION_DEF(2.2, "Use get_rigid_members() instead.");
120  return get_rigid_members();
121  }
122 
123  RigidMembers get_rigid_members() const;
124 
125  //! Returns a list of all members that are not themselves decorated as
126  //! rigid bodies, in the form of particle indexes.
128  static kernel::ParticleIndexes empty;
129  if (get_model()->get_has_attribute(internal::rigid_body_data().members_,
130  get_particle_index())) {
131  return get_model()->get_attribute(internal::rigid_body_data().members_,
133  } else {
134  return empty;
135  }
136  }
137 
138  //! Get all members that are themselves decorated as rigid bodies,
139  //! as model particle indexes
141  static kernel::ParticleIndexes empty;
142  if (get_model()->get_has_attribute(
143  internal::rigid_body_data().body_members_, get_particle_index())) {
144  return get_model()->get_attribute(
145  internal::rigid_body_data().body_members_, get_particle_index());
146  } else {
147  return empty;
148  }
149  }
150 
151  //! Get the particle indexes of any member of this rigid body, regardless
152  //! of whether it is itself a rigid body or not
154  return get_member_particle_indexes() + get_body_member_particle_indexes();
155  }
156 
158 
159  /**
160  Create a rigid body for pi with the particle indexes ps as its members.
161  The coordinates of pi are set to the center of mass of ps and the rotation
162  of its reference frame is based on the diagonalized inertia tensor of ps.
163 
164  @note If size(ps)=1, then its reference frame is copied if it is a
165  rigid body, or its rotation is set to identity if it is not
166  a rigid body.
167  */
169 
170  /**
171  Create a rigid body with the passed reference frame as its initial
172  position.
173  */
175 
176  //! Make the rigid body no longer rigid.
177  static void teardown_particle(RigidBody rb);
178 
179  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(RigidBody);
180  ~RigidBody();
181 
182  //! Return true if the particle is a rigid body
184  return internal::get_has_required_attributes_for_body(m, pi);
185  }
186 
187  // swig doesn't support using, so the method is wrapped
188  //! Get the coordinates of the particle
190 
191  //! Get the reference frame for the local coordinates
194  get_model()->get_attribute(internal::rigid_body_data().quaternion_[0],
196  get_model()->get_attribute(internal::rigid_body_data().quaternion_[1],
198  get_model()->get_attribute(internal::rigid_body_data().quaternion_[2],
200  get_model()->get_attribute(internal::rigid_body_data().quaternion_[3],
201  get_particle_index()));
202  IMP_USAGE_CHECK_FLOAT_EQUAL(v.get_squared_magnitude(), 1,
203  "Rotation is not a unit vector: " << v);
204  /*if (v.get_squared_magnitude() > 0){
205  v = v.get_unit_vector();
206  } else {
207  v = algebra::VectorD<4>(1,0,0,0);
208  }*/
209  bool assume_normalized = true;
210  IMP::algebra::Rotation3D rot(v, assume_normalized);
213  }
214 
215  //! Set the current reference frame
216  /** All members of the rigid body will have their coordinates updated
217  immediately.
218  \see IMP::core::transform(RigidBody,const algebra::Transformation3D&)
219  \see set_reference_frame_lazy()
220  */
221  void set_reference_frame(const IMP::algebra::ReferenceFrame3D &tr);
222 
223  //! Change the reference, delay updating the members until evaluate
224  /** \see set_reference_frame()
225  */
226  void set_reference_frame_lazy(const IMP::algebra::ReferenceFrame3D &tr);
227 
228  /** Update the reference frame of the rigid body based on aligning
229  the current global coordinates of the passed rigid body members
230  onto their old local coordinates. Non-passed members are ignored.
231 
232  This method is useful for updating the rigid body after new
233  global coordinates were loaded for the members. The members are
234  passed explicitly since, typically, some are desired to just
235  move along with the newly loaded rigid body.
236 
237  \note This requires at least three members that are not colinear
238  to work.
239  */
240  void set_reference_frame_from_members(const kernel::ParticleIndexes &members);
241 
242 #ifndef IMP_DOXYGEN
243  /** This takes a Cartesian derivative in global coordinates,
244  and a location in internal coordinates.
245 
246  It is currently hidden since the function signature is highly ambiguous.
247  */
248  inline void add_to_derivatives(const algebra::Vector3D &derivative,
249  const algebra::Vector3D &local_location,
251 
252  // faster if all is cached
253  inline void add_to_derivatives(const algebra::Vector3D &derivative,
254  const algebra::Vector3D &global_derivative,
255  const algebra::Vector3D &local_location,
256  const algebra::Rotation3D &rot,
258 #endif
259 
260  /** The units are kCal/Mol/Radian */
262  algebra::Vector3D ret;
263  for (unsigned int i = 0; i < 3; ++i) {
264  ret[i] = get_model()->get_derivative(
265  internal::rigid_body_data().torque_[i], get_particle_index());
266  }
267  return ret;
268  }
269 
270  //! Returns true if the rigid body coordinates are flagged as
271  //! optimized for Optimizer objects
272  bool get_coordinates_are_optimized() const;
273 
274  //! Set whether the rigid body coordinates are flagged as optimized
275  //! for Optimizer objects
276  void set_coordinates_are_optimized(bool tf);
277 
278  //! Normalize the quaternion
279  void normalize_rotation();
280 
281  //! Update the global coordinates of the members based on
282  //! their local coordinates and this rigid body's reference frame
283  void update_members();
284 
285  //! Get the derivatives of the quaternion
286  algebra::VectorD<4> get_rotational_derivatives() const;
287 
288 #ifndef IMP_DOXYGEN
289  unsigned int get_number_of_members() const {
290  return get_body_member_particle_indexes().size() +
291  get_member_particle_indexes().size();
292  }
293 
294  RigidMember get_member(unsigned int i) const;
295 #endif
296  //! Add a proper member that moves rigidly with this rigid body,
297  //! properly handling rigid bodies and XYZ particles.
298  /**
299  Add p to the list of members. If p is a valid RigidBody, it is added
300  as a rigid body member, otherwise it is added as a point member
301  (for which the rotation is not tracked). By default, p is considered
302  a strictly rigid member, in that its local coordinates are not expected
303  to change independently.
304 
305  \see add_non_rigid_member
306  */
307  void add_member(kernel::ParticleIndexAdaptor p);
308 
309  /** Add a non-rigid member, for which internal coordinates may change
310  independently.
311 
312  @note Currently RigidBody non-rigid members are not handled properly.
313  */
314  void add_non_rigid_member(kernel::ParticleIndexAdaptor p);
315 
316  /** Set whether a particular member is flagged as a rigid member
317  or as a non-rigid member. This affects the way the rigid body
318  updates the coordinates and / or reference frame of its members.
319  */
320  void set_is_rigid_member(kernel::ParticleIndex pi, bool tf);
321 };
322 
323 
324 // inline implementation
325 void RigidBody::add_to_derivatives(const algebra::Vector3D &deriv_local,
326  const algebra::Vector3D &deriv_global,
327  const algebra::Vector3D &local,
328  const algebra::Rotation3D &rot,
329  DerivativeAccumulator &da) {
330  // const algebra::Vector3D deriv_global= rot*deriv_local;
331  // IMP_LOG_TERSE( "Accumulating rigid body derivatives" << std::endl);
332  algebra::VectorD<4> q(0, 0, 0, 0);
333  for (unsigned int j = 0; j < 4; ++j) {
334  algebra::Vector3D v = rot.get_derivative(local, j);
335  q[j] = deriv_global * v;
336  }
337  XYZ::add_to_derivatives(deriv_global, da);
338  for (unsigned int j = 0; j < 4; ++j) {
339  get_model()->add_to_derivative(internal::rigid_body_data().quaternion_[j],
340  get_particle_index(), q[j], da);
341  }
342  algebra::Vector3D torque = algebra::get_vector_product(local, deriv_local);
343  for (unsigned int i = 0; i < 3; ++i) {
344  get_model()->add_to_derivative(internal::rigid_body_data().torque_[i],
345  get_particle_index(), torque[i], da);
346  }
347 }
348 
349 // inline implementation
350 void RigidBody::add_to_derivatives(const algebra::Vector3D &deriv_local,
351  const algebra::Vector3D &local,
352  DerivativeAccumulator &da) {
353  algebra::Rotation3D rot =
354  get_reference_frame().get_transformation_to().get_rotation();
355  const algebra::Vector3D deriv_global = rot * deriv_local;
356  add_to_derivatives(deriv_local, deriv_global, local, rot, da);
357 }
358 
359 
360 
361 /** It is often useful to store precalculated properties of the rigid body
362  for later use. These need to be cleared out when the rigid body changes.
363  To make sure this happens, register the key here.
364 */
365 void IMPCOREEXPORT add_rigid_body_cache_key(ObjectKey k);
366 
367 //! A member of a rigid body, it has internal (local) coordinates
368 class IMPCOREEXPORT RigidBodyMember : public XYZ {
370 
371  RigidBody get_rigid_body() const;
372 
373  //! Return the internal (local) coordinates of this member
374  /** These coordinates are relative to the reference frame of the
375  rigid body that owns it
376  */
378  return get_model()->get_internal_coordinates(get_particle_index());
379  }
380 
381  //! set the internal (local) coordinates for this member
383  get_model()->get_internal_coordinates(get_particle_index()) = v;
384  get_rigid_body().get_model()->clear_particle_caches(get_particle_index());
385  }
386 
387  //! Set the internal (local) coordinates of this member,
388  //! assuming it is a rigid body itself
389  /** Set the internal (local) coordinates of this rigid body
390  relative to the reference frame of the rigid body that owns it
391  */
394  get_model()->get_has_attribute(
395  internal::rigid_body_data().lquaternion_[0], get_particle_index()),
396  "Can only set the internal transformation if member is"
397  << " a rigid body itself.");
398  set_internal_coordinates(v.get_translation());
399 
400  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[0],
402  v.get_rotation().get_quaternion()[0]);
403  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[1],
405  v.get_rotation().get_quaternion()[1]);
406  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[2],
408  v.get_rotation().get_quaternion()[2]);
409  get_model()->set_attribute(internal::rigid_body_data().lquaternion_[3],
411  v.get_rotation().get_quaternion()[3]);
412  get_rigid_body().get_model()->clear_particle_caches(get_particle_index());
413  }
414 
415  //! Return the internal (local) coordinates of this member,
416  //! assuming it is a rigid body itself
417  /** Return the internal (local) coordinates of this rigid body
418  relative to the reference frame of the rigid body that owns it
419  */
422  get_model()->get_has_attribute(
423  internal::rigid_body_data().lquaternion_[0], get_particle_index()),
424  "Can only set the internal transformation if member is a "
425  << "rigid body itself.");
426  algebra::Vector3D tr =
427  get_model()->get_internal_coordinates(get_particle_index());
429  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[0],
431  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[1],
433  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[2],
435  get_model()->get_attribute(internal::rigid_body_data().lquaternion_[3],
436  get_particle_index()));
437  return algebra::Transformation3D(rot, tr);
438  }
439 
440  ~RigidBodyMember();
441  //! sets the global coordinates of this member using XYZ::set_coordinates()
442  // this is here since swig does like using statements
443  void set_coordinates(const algebra::Vector3D &center) {
444  XYZ::set_coordinates(center);
445  }
446 
447 #ifndef IMP_DOXYGEN
448  //! Set the global coordinates from the internal coordinates,
449  //! using tr as a reference frame
451  set_coordinates(tr.get_transformed(get_internal_coordinates()));
452  }
453 #endif
454  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(RigidBodyMember);
455 
456  //! return true if it is a rigid member
458  return internal::get_has_required_attributes_for_member(m, p);
459  }
460 
461  static FloatKeys get_internal_coordinate_keys() {
462  return internal::rigid_body_data().child_keys_;
463  }
464 };
465 
466 //! A decorator for a particle that is part of a rigid body, and is
467 //! actually rigid
468 /**
469  RigidMember particles, as opposed to NonRigidMember particles, are
470  not expected to change their internal (local) coordinates or
471  reference frames, and their global coordinates are expected to
472  change only through setting the coordinates (or reference frame) of
473  the rigid body that owns them.
474 
475  \see RigidBody
476  */
477 class IMPCOREEXPORT RigidMember : public RigidBodyMember {
478  public:
480 
481  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(RigidMember);
482  ~RigidMember();
483 
484  //! return true if it is a rigid member
486  return internal::get_has_required_attributes_for_rigid_member(m, p);
487  }
488 };
489 
490 //! A decorator for a particle that is part of a rigid body but not rigid
491 /** NonRigidMembers, like RigidMembers have internal coordinates and move
492  along with the rigid body. However, it is expected that their internal
493  coordinates will change, and so they are not part of structures that
494  assume rigidity.
495 
496  \see RigidBody
497  */
498 class IMPCOREEXPORT NonRigidMember : public RigidBodyMember {
499  public:
501  IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(NonRigidMember);
502  ~NonRigidMember();
503 
504  //! return true if it is a rigid member
506  return internal::get_has_required_attributes_for_non_member(m, p);
507  }
508 };
509 
510 #ifndef IMP_DOXYGEN
511 
512 class IMPCOREEXPORT RigidMembersRefiner : public Refiner {
513  public:
514  RigidMembersRefiner(std::string name = "RigidMembersRefiner%d")
515  : Refiner(name) {}
516  virtual bool get_can_refine(kernel::Particle *) const IMP_OVERRIDE;
517 #ifndef SWIG
518  using Refiner::get_refined;
519 #endif
520  virtual const kernel::ParticlesTemp get_refined(kernel::Particle *) const
521  IMP_OVERRIDE;
522  virtual kernel::ModelObjectsTemp do_get_inputs(
523  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
524  IMP_OBJECT_METHODS(RigidMembersRefiner);
525 };
526 
527 namespace internal {
528 IMPCOREEXPORT RigidMembersRefiner *get_rigid_members_refiner();
529 }
530 #endif
531 
532 //! Transform a rigid body
533 /** The transformation is applied current conformation of the rigid
534  body, as opposed to replacing the current conformation, as in
535  RigidBody::set_reference_frame().
536 
537  \see RigidBody
538  \see algebra::Transformation3D
539 */
540 inline void transform(RigidBody a, const algebra::Transformation3D &tr) {
541  a.set_reference_frame(get_transformed(a.get_reference_frame(), tr));
542 }
543 
544 /** Compute the rigid body reference frame given a set of input particles.
545  */
546 IMPCOREEXPORT algebra::ReferenceFrame3D get_initial_reference_frame(
547  kernel::Model *m, const kernel::ParticleIndexes &pis);
548 
549 inline algebra::ReferenceFrame3D get_initial_reference_frame(
550  const kernel::ParticlesTemp &ps) {
551  if (ps.empty()) {
552  return algebra::ReferenceFrame3D();
553  }
554  return get_initial_reference_frame(ps[0]->get_model(),
555  kernel::get_indexes(ps));
556 }
557 
558 /** Create a set of rigid bodies that are bound together for efficiency.
559  These rigid bodies cannot nest or have other dependencies amongst them.
560 
561  All rigid bodies have the default reference frame.
562 
563  \note Do not use this with DOMINO as all the rigid bodies use the same
564  ScoreState and so will be considered inter-dependent.
565 */
566 IMPCOREEXPORT kernel::ParticlesTemp create_rigid_bodies(kernel::Model *m,
567  unsigned int n,
568  bool no_members =
569  false);
570 
571 IMP_DECORATORS_DEF(RigidMember, RigidMembers);
572 IMP_DECORATORS(RigidBody, RigidBodies, XYZs);
573 
574 /** Show the rigid body hierarchy rooted at passed body. */
575 IMPCOREEXPORT void show_rigid_body_hierarchy(RigidBody rb,
576  base::TextOutput out =
577  base::TextOutput(std::cout));
578 
579 //! Return the index of the outer-most rigid body containing the member.
580 /** Use this to, for example, group particles into rigid bodies. */
581 IMPCOREEXPORT kernel::ParticleIndex get_root_rigid_body(RigidMember m);
582 
583 IMPCORE_END_NAMESPACE
584 
585 #endif /* IMPCORE_RIGID_BODIES_H */
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:382
Import IMP/kernel/SingletonModifier.h in the namespace.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Simple 3D transformation class.
ParticleIndexes get_indexes(const ParticlesTemp &ps)
A base class for Keys.
Definition: kernel/Key.h:46
Class for adding derivatives from restraints to the model.
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
A member of a rigid body, it has internal (local) coordinates.
Definition: rigid_bodies.h:368
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Import IMP/kernel/SingletonContainer.h in the namespace.
IMP::kernel::DerivativeAccumulator DerivativeAccumulator
#define IMP_USAGE_CHECK_FLOAT_EQUAL(expra, exprb, message)
Definition: check_macros.h:180
algebra::Vector3D get_coordinates() const
Get the coordinates of the particle.
Definition: rigid_bodies.h:189
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex pi)
Return true if the particle is a rigid body.
Definition: rigid_bodies.h:183
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
const kernel::ParticleIndexes & get_member_particle_indexes() const
Definition: rigid_bodies.h:127
#define IMP_DECORATOR_METHODS(Name, Parent)
Model * get_model() const
Returns the Model containing the particle.
bool get_coordinates_are_optimized() const
Get whether the coordinates are optimized.
Definition: XYZ.h:86
void add_rigid_body_cache_key(ObjectKey k)
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
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.
virtual bool get_can_refine(Particle *) const
Return true if this refiner can refine that particle.
const Rotation3D & get_rotation() const
returns the rotation associated with this transformation
algebra::Vector3D get_torque() const
Definition: rigid_bodies.h:261
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
Import IMP/kernel/Refiner.h in the namespace.
void set_coordinates(const algebra::Vector3D &v)
set all coordinates from a vector
Definition: XYZ.h:62
IMP::kernel::Model Model
kernel::ParticleIndexes get_member_indexes() const
Definition: rigid_bodies.h:153
Represent an XYZR particle with a sphere.
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
void set_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndexAdaptor p)
return true if it is a rigid member
Definition: rigid_bodies.h:485
const algebra::Vector3D & get_coordinates() const
Convert it to a vector.
Definition: XYZ.h:107
Class to handle individual model 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:498
Simple 3D rotation class.
void set_internal_transformation(const algebra::Transformation3D &v)
Definition: rigid_bodies.h:392
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
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndexAdaptor p)
return true if it is a rigid member
Definition: rigid_bodies.h:457
base::Index< ParticleIndexTag > ParticleIndex
Key< 4, true > ObjectKey
The type used to identify an Object attribute.
void set_coordinates(const algebra::Vector3D &center)
sets the global coordinates of this member using XYZ::set_coordinates()
Definition: rigid_bodies.h:443
IMP::kernel::Particle Particle
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex p)
return true if it is a rigid member
Definition: rigid_bodies.h:505
void show_rigid_body_hierarchy(RigidBody rb, base::TextOutput out=base::TextOutput(std::cout))
kernel::ParticlesTemp create_rigid_bodies(kernel::Model *m, unsigned int n, bool no_members=false)
VectorD< 3 > Vector3D
Definition: VectorD.h:395
kernel::ParticleIndex get_root_rigid_body(RigidMember m)
Return the index of the outer-most rigid body containing the member.
Simple 3D vector class.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:170
void transform(RigidBody a, const algebra::Transformation3D &tr)
Transform a rigid body.
Definition: rigid_bodies.h:540
Simple 3D rotation class.
void clear_particle_caches(ParticleIndex pi)
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:420
Abstract class to implement hierarchical methods.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Decorator for a sphere-like particle.
const kernel::ParticleIndexes & get_body_member_particle_indexes() const
Definition: rigid_bodies.h:140
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
const algebra::Vector3D & get_internal_coordinates() const
Return the internal (local) coordinates of this member.
Definition: rigid_bodies.h:377
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73
IMP::algebra::ReferenceFrame3D get_reference_frame() const
Get the reference frame for the local coordinates.
Definition: rigid_bodies.h:192