IMP  2.2.0
The Integrative Modeling Platform
CentroidOfRefined.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/CentroidOfRefined.h
3  * \brief Set the coordinates of the particle to be the centoid of the
4  * refined particles.
5  *
6  * Copyright 2007-2014 IMP Inventors. All rights reserved.
7  */
8 
9 #ifndef IMPCORE_CENTROID_OF_REFINED_H
10 #define IMPCORE_CENTROID_OF_REFINED_H
11 
12 #include <IMP/core/core_config.h>
13 #include "XYZ.h"
14 #include <IMP/Refiner.h>
15 #include <IMP/macros.h>
16 #include <IMP/base/Pointer.h>
17 #include <IMP/Decorator.h>
18 #include <IMP/SingletonModifier.h>
19 #include "DerivativesToRefined.h"
20 
21 IMPCORE_BEGIN_NAMESPACE
22 
23 //! Set the coordinates of the particle to be the centoid of the particles.
24 /** An exception is thrown if there are no refined particles. The weight
25  FloatKey can be FloatKey and then all the weights will be equal.
26 
27  \see CoverRefined
28  \see DerivativesToRefined
29  \see DerivativesFromRefined
30  */
31 class IMPCOREEXPORT CentroidOfRefined : public SingletonModifier {
33  FloatKeys ks_;
34  FloatKey w_;
35 
36  public:
37  //! Set the keys ks to be the average of the refined particles.
39  FloatKeys ks = XYZ::get_xyz_keys());
40  virtual void apply_index(kernel::Model *m, kernel::ParticleIndex a) const
41  IMP_OVERRIDE;
43  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
45  kernel::Model *m, const kernel::ParticleIndexes &pis) const IMP_OVERRIDE;
48 };
49 
50 //! A particle that is the centroid of other particles.
51 /** A decorator which constrains a particle to be the centroid of a
52  set of other particles. The centroid is updated before model
53  evaluation and its derivatives are copied to its children,
54  using a constraint that is created at setup time.
55 
56  \usesconstraint
57 */
59  Centroid is computed before each evaluation);
60 
61 IMPCORE_END_NAMESPACE
62 
63 #endif /* IMPCORE_CENTROID_OF_REFINED_H */
#define IMP_SUMMARIZE_DECORATOR_DECL(Name, Parent, Members, SetupDoc)
Create a decorator that computes some sort of summary info on a set.
Import IMP/kernel/Decorator.h in the namespace.
Import IMP/kernel/SingletonModifier.h in the namespace.
Accumulate the derivatives of the refined particles.
A nullptr-initialized pointer to an IMP Object.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:147
A particle that is the centroid of other particles.
Import IMP/kernel/macros.h in the namespace.
virtual void apply_index(kernel::Model *m, kernel::ParticleIndex v) const
Simple xyz decorator.
A base class for modifiers of kernel::ParticlesTemp.
Import IMP/kernel/Refiner.h in the namespace.
virtual ModelObjectsTemp do_get_inputs(kernel::Model *m, const ParticleIndexes &pis) const
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual ModelObjectsTemp do_get_outputs(kernel::Model *m, const ParticleIndexes &pis) const
#define IMP_SINGLETON_MODIFIER_METHODS(Name)
Abstract class to implement hierarchical methods.
Set the coordinates of the particle to be the centoid of the particles.
Key< 0, true > FloatKey
The type used to identify float attributes in the Particles.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72