IMP Reference Guide
2.7.0
The Integrative Modeling Platform
|
Class for storing model, its restraints, constraints, and particles. More...
#include "IMP/Model.h"
Class for storing model, its restraints, constraints, and particles.
The Model maintains a standard IMP
container for each of Particle, ScoreState and Restraint object types.
Each Float attribute has an associated range which reflects the range of values that it is expected to take on during optimization. The optimizer can use these ranges to make the optimization process more efficient. By default, the range estimates are simply the range of values for that attribute in the various particles, but it can be set to another value. For example, an attribute storing an angle could have the range set to (0,PI).
The ranges are not enforced; they are just guidelines. In order to enforce ranges, see, for example, IMP::example::ExampleSingletonModifier.
Public Member Functions | |
Model (std::string name="Model %1%") | |
Construct an empty model. More... | |
ParticleIndex | add_particle (std::string name) |
Add particle to the model. More... | |
void | add_undecorator (ParticleIndex pi, Undecorator *d) |
Add the passed Undecorator to the particle. More... | |
void | clear_particle_caches (ParticleIndex pi) |
Clear all the cache attributes of a given particle. More... | |
bool | get_has_particle (ParticleIndex p) const |
Check whether a given particle index exists. More... | |
ModelObjectsTemp | get_model_objects () const |
Get all the ModelObjects associated with this Model. More... | |
Particle * | get_particle (ParticleIndex p) const |
Get the particle from an index. More... | |
ParticleIndexes | get_particle_indexes () |
Get all particle indexes. More... | |
std::string | get_particle_name (ParticleIndex pi) |
Get the name of a particle. More... | |
virtual std::string | get_type_name () const |
virtual ::IMP::VersionInfo | get_version_info () const |
Get information about the module and version of the object. More... | |
void | remove_particle (ParticleIndex pi) |
Remove a particle from the Model. More... | |
void | update () |
Sometimes it is useful to be able to make sure the model is up to date. More... | |
Public Member Functions inherited from IMP::Object | |
virtual void | clear_caches () |
CheckLevel | get_check_level () const |
LogLevel | get_log_level () const |
void | set_check_level (CheckLevel l) |
void | set_log_level (LogLevel l) |
Set the logging level used in this object. More... | |
void | set_was_used (bool tf) const |
void | show (std::ostream &out=std::cout) const |
const std::string & | get_name () const |
void | set_name (std::string name) |
States | |
ScoreStates can be added to the Model in order to keep them alive as long as the model is alive. Being added does affect their ability to perform their required action. See ScoreState for more information.
| |
void | remove_score_state (ScoreState *d) |
void | remove_score_states (const ScoreStates &d) |
void | set_score_states (const ScoreStates &ps) |
void | set_score_states_order (const ScoreStates &objs) |
unsigned int | add_score_state (ScoreState *obj) |
void | add_score_states (const ScoreStates &objs) |
void | clear_score_states () |
unsigned int | get_number_of_score_states () const |
bool | get_has_score_states () |
ScoreState * | get_score_state (unsigned int i) const |
ScoreStates | get_score_states () const |
void | reserve_score_states (unsigned int sz) |
Accessing attributes | |
All the attribute data associated with each Particle are stored in the Model. For each type of attribute, there are the methods detailed below (where, eg, TypeKey is FloatKey or StringKey) | |
void | add_attribute (TypeKey attribute_key, ParticleIndex particle, Type value) |
add particle atribute with the specied key and initial value More... | |
void | remove_attribute (TypeKey attribute_key, ParticleIndex particle) |
remove particle attribute with the specied key More... | |
bool | get_has_attribute (TypeKey attribute_key, ParticleIndex particle) const |
return true if particle has attribute with the specified key More... | |
void | set_attribute (TypeKey attribute_key, ParticleIndex particle, Type value) |
set the value of particle attribute with the specified key More... | |
Type | get_attribute (TypeKey attribute_key, ParticleIndex particle) |
get the value of the particle attribute with the specified key More... | |
void | add_cache_attribute (TypeKey attribute_key, ParticleIndex particle, Type value) |
void | set_is_optimized (TypeKey attribute_key, ParticleIndex particle, bool true_or_false) |
Storing data in the model | |
One can store data associated with the model. This is used, for example, to keep a central ScoreState to normalize rigid body rotational variables. | |
void | add_data (ModelKey mk, Object *o) |
Store a piece of data in the model referenced by the key. More... | |
Object * | get_data (ModelKey mk) const |
Get back some data stored in the model. More... | |
void | remove_data (ModelKey mk) |
Remove data stored in the model. More... | |
bool | get_has_data (ModelKey mk) const |
Check if the model has a certain piece of data attached. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from IMP::Object | |
Object (std::string name) | |
Construct an object with the given name. More... | |
virtual void | do_destroy () |
IMP::Model::Model | ( | std::string | name = "Model %1%" | ) |
Construct an empty model.
void IMP::Model::add_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
Type | value | ||
) |
add particle atribute with the specied key and initial value
void IMP::Model::add_cache_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
Type | value | ||
) |
Cache attributes, unlike normal attributes, can be added during evaluation. They are also cleared by the clear_cache_attributes() method. Cache attributes should be used when one is adding data to a particle to aid scoring (eg cache the rigid body collision acceleration structure).
When some pertinent aspect of the particle changes, the clear method should be called (yes, this is a bit vague). Examples where it should be cleared include changing the set of members of a core::RigidBody or their coordinates, changing the members of an atom::Hierarchy.
Store a piece of data in the model referenced by the key.
ParticleIndex IMP::Model::add_particle | ( | std::string | name | ) |
Add particle to the model.
void IMP::Model::add_undecorator | ( | ParticleIndex | pi, |
Undecorator * | d | ||
) |
Add the passed Undecorator to the particle.
void IMP::Model::clear_particle_caches | ( | ParticleIndex | pi | ) |
Clear all the cache attributes of a given particle.
Type IMP::Model::get_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) |
get the value of the particle attribute with the specified key
bool IMP::Model::get_has_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) | const |
return true if particle has attribute with the specified key
bool IMP::Model::get_has_data | ( | ModelKey | mk | ) | const |
Check if the model has a certain piece of data attached.
bool IMP::Model::get_has_particle | ( | ParticleIndex | p | ) | const |
ModelObjectsTemp IMP::Model::get_model_objects | ( | ) | const |
Get all the ModelObjects associated with this Model.
Particle* IMP::Model::get_particle | ( | ParticleIndex | p | ) | const |
ParticleIndexes IMP::Model::get_particle_indexes | ( | ) |
Get all particle indexes.
std::string IMP::Model::get_particle_name | ( | ParticleIndex | pi | ) |
Get the name of a particle.
|
virtual |
Get information about the module and version of the object.
Reimplemented from IMP::Object.
void IMP::Model::remove_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) |
remove particle attribute with the specied key
void IMP::Model::remove_data | ( | ModelKey | mk | ) |
Remove data stored in the model.
void IMP::Model::remove_particle | ( | ParticleIndex | pi | ) |
Remove a particle from the Model.
The particle will then be inactive and cannot be used for anything and all data stored in the particle is lost.
void IMP::Model::set_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
Type | value | ||
) |
set the value of particle attribute with the specified key
void IMP::Model::set_is_optimized | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
bool | true_or_false | ||
) |
Optimized attributes are the parameters of the model that are allowed to be modified by samplers and optimizers
void IMP::Model::update | ( | ) |
Sometimes it is useful to be able to make sure the model is up to date.
This method updates all the state but does not necessarily compute the score. Use this to make sure that your containers and rigid bodies are up to date.