IMP logo
IMP Reference Guide  2.5.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-2015 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(Model *m, ParticleIndex pi,
24  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  Particle *get_reference_particle() const {
33  return get_particle()->get_value(get_reference_key());
34  }
35 
36  static bool get_is_setup(Model *m, ParticleIndex pi) {
37  return m->get_has_attribute(get_reference_key(), pi);
38  }
39 
40  static ParticleIndexKey get_reference_key();
41 };
42 
43 IMP_DECORATORS(Reference, References, 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(Model *m, ParticleIndex p) const
63  Model *m, const ParticleIndexes &pis) const IMP_OVERRIDE;
65  Model *m, const ParticleIndexes &pis) const IMP_OVERRIDE;
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(Model *m, ParticleIndex p) const
85  Model *m, const ParticleIndexes &pis) const IMP_OVERRIDE;
87  Model *m, const ParticleIndexes &pis) const IMP_OVERRIDE;
90 };
91 
92 IMPCORE_END_NAMESPACE
93 #endif /* IMPCORE_SYMMETRY_H */
A base class for modifiers of ParticlesTemp.
virtual void apply_index(Model *m, ParticleIndex v) const
Simple 3D transformation class.
Set the coordinates of a particle to be a transformed version of a reference.
Definition: core/symmetry.h:75
A a decorator for a particle with an associated reference particle.
Definition: core/symmetry.h:22
#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
virtual ModelObjectsTemp do_get_outputs(Model *m, const ParticleIndexes &pis) const =0
Simple XYZ decorator.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
#define IMP_SINGLETON_MODIFIER_METHODS(Name)
functionality for defining rigid bodies
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const =0
Reflect about a plane in 3D.
Definition: Reflection3D.h:20
Simple 3D transformation class.
Particle * get_particle() const
Returns the particle decorated by this decorator.
Definition: Decorator.h:169
#define IMP_DECORATOR_METHODS(Name, Parent)
Class to handle individual model particles.
Definition: Particle.h:37
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
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_OVERRIDE
Cause a compile error if this method does not override a parent method.