IMP  2.3.0
The Integrative Modeling Platform
core/symmetry.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/symmetry.h \brief Implement various types of symmetry
3  *
4  * Copyright 2007-2014 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPCORE_SYMMETRY_H
9 #define IMPCORE_SYMMETRY_H
10 #include <IMP/core/core_config.h>
13 #include "XYZ.h"
14 #include "rigid_bodies.h"
15 
16 IMPCORE_BEGIN_NAMESPACE
17 
18 //! A a decorator for a particle with an associated reference particle.
19 /** This decorator is primarily designed to be used for implementing
20  symmetry.
21  */
22 class IMPCOREEXPORT Reference : public Decorator {
23  static void do_setup_particle(kernel::Model *m, kernel::ParticleIndex pi,
24  kernel::ParticleIndex refi) {
25  m->add_attribute(get_reference_key(), pi, refi);
26  }
27 
28  public:
30  /** Make the first particle reference the passed particle. */
32  kernel::Particle *get_reference_particle() const {
33  return get_particle()->get_value(get_reference_key());
34  }
35 
36  static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex pi) {
37  return m->get_has_attribute(get_reference_key(), pi);
38  }
39 
40  static kernel::ParticleIndexKey get_reference_key();
41 };
42 
43 IMP_DECORATORS(Reference, References, kernel::ParticlesTemp);
44 
45 //! Set the coordinates of a particle to be a transformed version of a reference
46 /** The passed particles must be Reference particles and XYZ particles and must
47  not be RigidBody particles.
48  \see TransformationSymmetry
49  */
51  : public SingletonModifier {
54 
55  public:
56  //! Create with both reflection and translation
58  const algebra::Reflection3D &r);
59 
60  virtual void apply_index(kernel::Model *m, kernel::ParticleIndex p) const
68 };
69 
70 //! Set the coordinates of a particle to be a transformed version of a reference
71 /** The passed particles must be Reference particles and XYZ particles and
72  can be RigidBody particles iff the reference particle is a rigid body.
73  \see TransformationAndReflectionSymmetry
74  */
75 class IMPCOREEXPORT TransformationSymmetry : public SingletonModifier {
77 
78  public:
79  //! Create with both reflection and translation
81 
82  virtual void apply_index(kernel::Model *m, kernel::ParticleIndex p) const
90 };
91 
92 IMPCORE_END_NAMESPACE
93 #endif /* IMPCORE_SYMMETRY_H */
Simple 3D transformation class.
A base class for Keys.
Definition: kernel/Key.h:46
Set the coordinates of a particle to be a transformed version of a reference.
Definition: core/symmetry.h:75
Particle * get_particle() const
Returns the particle decorated by this decorator.
A a decorator for a particle with an associated reference particle.
Definition: core/symmetry.h:22
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
#define IMP_DECORATOR_METHODS(Name, Parent)
virtual void apply_index(kernel::Model *m, kernel::ParticleIndex v) const
Simple XYZ decorator.
A base class for modifiers of kernel::ParticlesTemp.
functionality for defining rigid bodies
virtual ModelObjectsTemp do_get_inputs(kernel::Model *m, const ParticleIndexes &pis) const
Class to handle individual model particles.
Reflect about a plane in 3D.
Definition: Reflection3D.h:20
Simple 3D transformation class.
virtual ModelObjectsTemp do_get_outputs(kernel::Model *m, const ParticleIndexes &pis) const
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
Reflect about a plane in 3D.
Set the coordinates of a particle to be a transformed version of a reference.
Definition: core/symmetry.h:50
#define IMP_SINGLETON_MODIFIER_METHODS(Name)
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#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.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73