IMP logo

IMP::Particle Class Reference


Detailed Description

Class to handle individual model particles.

Note:
Direct manipuation of particles is considered advanced and Particles should only be manipulated through IMP::Decorator derived classes.
A IMP::Particle is a mapping between keys and values.

Four possible types of values:

To use an attribute you first create a key

   f= IMP.FloatKey("MyAttribute")
   
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).

Inheritance diagram for IMP::Particle:

Inheritance graph
[legend]

Public Member Functions

bool get_is_active () const
 Get whether the particle is active.
Modelget_model () const
virtual std::string get_type_name () const
def get_value
virtual ::IMP::VersionInfo get_version_info () const
 Particle (Model *m, std::string name="P%1%")
 Construct a particle and add it to the Model.
Float Attributes
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)
Float get_derivative (FloatKey name) const
bool get_is_optimized (FloatKey k) const
void set_is_optimized (FloatKey k, bool tf)
Attribute manipulation
For each type of attribute and their corresponding key type, the Particle provides the following methods. The Type is the type of the attribute (Float, Int, Particle * etc.) and KeyType is the type of the key (FloatKey, IntKey, ParticleKey etc.).

void add_attribute (KeyType name, Type initial_value)
Type get_value (KeyType name) const
bool has_attribute (KeyType name) const
void remove_attribute (KeyType name)
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:
  • it must be optional
  • if multiple restraints add the same attribute, it must all be equivalent

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 (ObjectKey name, Object *value)
void add_cache_attribute (IntKey name, unsigned int value)
void clear_caches ()
Incremental Updates
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.
Particleget_prechange_particle () const
 Return the shadow particle having attribute values from the last evaluation.

Friends

template<class T >
void IMP::internal::unref (T *)

Member Function Documentation

bool IMP::Particle::get_is_active (  )  const

Get whether the particle is active.

Restraints referencing the particle are only evaluated for 'active' particles.

Returns:
true it the particle is active.

Model* IMP::Particle::get_model (  )  const

Get pointer to Model containing this particle.

Exceptions:
InvalidStateException if no Model contains this particle.


The documentation for this class was generated from the following files:

Generated on Mon Mar 8 23:08:43 2010 for IMP by doxygen 1.5.8