Class to handle individual model particles.
A IMP::Particle is a mapping between keys and values.
Four possible types of values:
To use an attribute you first create a key
Creating a key is expensive and should not be done often.
Then use it to manipulate the attribute.
p.add_attribute(f, initial_value, whether_attribute_is_optimized) p.set_attribute(f, new_value) p.remove_attribute(f)
This class contains particle methods and indexes to particle attributes. To prevent a particle from being moved by the optimizer during optimization, mark all of its attributes as being non-optimizable (set_is_optimized method). Note that this only affects the optimizer, ScoreStates may still change the particle attributes.
A particle may only belong to one model.
Any attempt to access or change an attribute which the particle does not have results is undefined. It will throw an exception if checks are on or possibly just crash if they are not. Likewise an attempt to touch an inactive particle is also undefined (and will throw an exception if checks are enabled).
|Particle (Model *m, std::string name="P%1%")|
|Construct a particle and add it to the Model. |
|bool||get_is_active () const|
|Get whether the particle is active. |
|virtual std::string||get_type_name () const|
|virtual ::IMP::VersionInfo||get_version_info () const|
|void||add_attribute (KeyType name, Type initial_value)|
|void||remove_attribute (KeyType name)|
|bool||has_attribute (KeyType name) const|
|Type||get_value (KeyType name) const|
Add cached data to a particle
Restraints and Constraints can cache data in a particle in order to accelerate computations. This data must obey the following rules:
When a Particle is changed in such a way that the cached data might be affected, the clear_caches() method should be called. Yes, this is very vague. We don't have a more precise prescription yet.
|void||add_cache_attribute (IntKey name, unsigned int value)|
|void||add_cache_attribute (ObjectKey name, Object *value)|
Float attributes can be optimized, meaning the optimizer is allowed to change their value in order to improve the score. As a result, there are a number of extra methods to manipulate them.
All distances are assumed to be in angstroms and derivatives in kcal/mol angstrom. This is not enforced.
|void||add_attribute (FloatKey name, const Float initial_value, bool optimized)|
|void||add_to_derivative (FloatKey key, Float value, const DerivativeAccumulator &da)|
|void||set_is_optimized (FloatKey k, bool tf)|
|bool||get_is_optimized (FloatKey k) const|
|Float||get_derivative (FloatKey name) const|
Control whether incremental updates are being used. See the incremental updates page for a more detailed description.
|bool||get_is_changed () const|
|Return true if this particle has been changed since the last evaluate call. |
|Particle *||get_prechange_particle () const|
|Return the shadow particle having attribute values from the last evaluation. |
|static Particle *||get_from (Object *o)|
Get whether the particle is active.
Restraints referencing the particle are only evaluated for 'active' particles.