IMP  2.1.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-2013 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:
29 
31  /** Make the first particle reference the passed particle. */
33  kernel::Particle *get_reference_particle() const {
34  return get_particle()->get_value(get_reference_key());
35  }
36 
38  return m->get_has_attribute(get_reference_key(), pi);
39  }
40 
41  static kernel::ParticleIndexKey get_reference_key();
42 };
43 
44 IMP_DECORATORS(Reference, References, kernel::ParticlesTemp);
45 
46 //! Set the coordinates of a particle to be a transformed version of a reference
47 /** The passed particles must be Reference particles and XYZ particles and must
48  not be RigidBody particles.
49  \see TransformationSymmetry
50  */
52  : public SingletonModifier {
55 
56  public:
57  //! Create with both reflection and translation
59  const algebra::Reflection3D &r);
60 
61  virtual void apply_index(kernel::Model *m, kernel::ParticleIndex p) const
62  IMP_OVERRIDE;
64  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
66  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
69 };
70 
71 //! Set the coordinates of a particle to be a transformed version of a reference
72 /** The passed particles must be Reference particles and XYZ particles and
73  can be RigidBody particles iff the reference particle is a rigid body.
74  \see TransformationAndReflectionSymmetry
75  */
76 class IMPCOREEXPORT TransformationSymmetry : public SingletonModifier {
78 
79  public:
80  //! Create with both reflection and translation
82 
83  virtual void apply_index(kernel::Model *m, kernel::ParticleIndex p) const
84  IMP_OVERRIDE;
86  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
88  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
91 };
92 
93 IMPCORE_END_NAMESPACE
94 #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:76
Particle * get_particle() const
A a decorator for a particle with an associated reference particle.
Definition: core/symmetry.h:22
#define IMP_DECORATOR_METHODS(Name, Parent)
Simple xyz decorator.
A base class for modifiers of ParticlesTemp.
static bool get_is_setup(Particle *p)
Return true if the particle can be cast to the decorator.
functionality for defining rigid bodies
virtual ModelObjectsTemp do_get_inputs(kernel::Model *m, const ParticleIndexes &pis) const
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
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:51
#define IMP_SINGLETON_MODIFIER_METHODS(Name)
virtual void apply_index(kernel::Model *m, ParticleIndex v) const
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Class for storing model, its restraints, constraints, and particles.