IMP
2.1.1
The Integrative Modeling Platform
|
Class for storing model, its restraints, constraints, and particles. More...
#include "IMP/Model.h"
Public Member Functions | |
Model (std::string name="Model %1%") | |
ParticleIndex | add_particle (std::string name) |
Add particle to the model. | |
void | add_undecorator (ParticleIndex pi, Undecorator *d) |
void | clear_particle_caches (ParticleIndex pi) |
double | evaluate (bool tf, bool warn=true) |
bool | get_has_particle (ParticleIndex p) const |
double | get_maximum_score (Restraint *r) const |
double | get_maximum_score () const |
ModelObjectsTemp | get_model_objects () const |
unsigned int | get_number_of_particles () const |
unsigned int | get_number_of_restraints () const |
ModelObjectsTemp | get_optimized_particles () const |
Particle * | get_particle (ParticleIndex p) const |
ParticleIndexes | get_particle_indexes () |
std::string | get_particle_name (ParticleIndex pi) |
Get the name of a particle. | |
ParticlesTemp | get_particles () const |
Restraint * | get_restraint (unsigned int i) const |
RestraintSet * | get_root_restraint_set () |
virtual std::string | get_type_name () const |
virtual ::IMP::base::VersionInfo | get_version_info () const |
Get information about the module and version of the object. | |
operator Restraint * () const | |
ParticleIterator | particles_begin () const |
ParticleIterator | particles_end () const |
void | remove_particle (ParticleIndex pi) |
void | remove_particle (Particle *p) |
void | set_maximum_score (Restraint *r, double s) |
void | set_maximum_score (double s) |
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::base::Object | |
virtual void | clear_caches () |
virtual void | do_destroy () |
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 is 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) |
void | remove_attribute (TypeKey attribute_key, ParticleIndex particle) |
bool | get_has_attribute (TypeKey attribute_key, ParticleIndex particle) const |
void | set_attribute (TypeKey attribute_key, ParticleIndex particle, Type value) |
Type | get_attribute (TypeKey attribute_key, ParticleIndex particle) |
void | add_cache_attribute (TypeKey attribute_key, ParticleIndex particle, Type value) |
void | set_is_optimized (TypeKey attribute_key, ParticleIndex particle, bool true_or_false) |
Optimized attributes are the parameters of the model. More... | |
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 (kernel::ModelKey mk, base::Object *o) |
base::Object * | get_data (kernel::ModelKey mk) const |
void | remove_data (kernel::ModelKey mk) |
bool | get_has_data (kernel::ModelKey mk) const |
Additional Inherited Members | |
Protected Member Functions inherited from IMP::base::Object | |
Object (std::string name) | |
Construct an object with the given name. More... | |
Object () | |
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.
Definition at line 72 of file kernel/declare_Model.h.
IMP::kernel::Model::Model | ( | std::string | name = "Model %1%" | ) |
Construct an empty model
void IMP::kernel::Model::add_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
Type | value | ||
) |
void IMP::kernel::Model::add_cache_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
Type | value | ||
) |
Cache attributes, unklike 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.
void IMP::kernel::Model::add_data | ( | kernel::ModelKey | mk, |
base::Object * | o | ||
) |
Store a piece of data in the model referenced by the key.
void IMP::kernel::Model::add_undecorator | ( | ParticleIndex | pi, |
Undecorator * | d | ||
) |
Add the passed Undecorator to the particle.
void IMP::kernel::Model::clear_particle_caches | ( | ParticleIndex | pi | ) |
Clear all the cache attributes of a given particle.
double IMP::kernel::Model::evaluate | ( | bool | tf, |
bool | warn = true |
||
) |
Type IMP::kernel::Model::get_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) |
base::Object* IMP::kernel::Model::get_data | ( | kernel::ModelKey | mk | ) | const |
Get back some data stored in the model.
bool IMP::kernel::Model::get_has_data | ( | kernel::ModelKey | mk | ) | const |
Check if the model has a certain piece of data attached.
bool IMP::kernel::Model::get_has_particle | ( | ParticleIndex | p | ) | const |
Get the particle from an index.
double IMP::kernel::Model::get_maximum_score | ( | Restraint * | r | ) | const |
double IMP::kernel::Model::get_maximum_score | ( | ) | const |
ModelObjectsTemp IMP::kernel::Model::get_model_objects | ( | ) | const |
Get all the ModelObjects associated with this Model.
unsigned int IMP::kernel::Model::get_number_of_particles | ( | ) | const |
unsigned int IMP::kernel::Model::get_number_of_restraints | ( | ) | const |
ModelObjectsTemp IMP::kernel::Model::get_optimized_particles | ( | ) | const |
Particle* IMP::kernel::Model::get_particle | ( | ParticleIndex | p | ) | const |
Get the particle from an index.
ParticleIndexes IMP::kernel::Model::get_particle_indexes | ( | ) |
Get all particle indexes
ParticlesTemp IMP::kernel::Model::get_particles | ( | ) | const |
Restraint* IMP::kernel::Model::get_restraint | ( | unsigned int | i | ) | const |
RestraintSet* IMP::kernel::Model::get_root_restraint_set | ( | ) |
IMP::kernel::Model::operator Restraint * | ( | ) | const |
Definition at line 388 of file kernel/declare_Model.h.
ParticleIterator IMP::kernel::Model::particles_begin | ( | ) | const |
ParticleIterator IMP::kernel::Model::particles_end | ( | ) | const |
void IMP::kernel::Model::remove_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) |
void IMP::kernel::Model::remove_data | ( | kernel::ModelKey | mk | ) |
Remove data stored in the model.
void IMP::kernel::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::kernel::Model::remove_particle | ( | Particle * | p | ) |
void IMP::kernel::Model::set_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
Type | value | ||
) |
void IMP::kernel::Model::set_is_optimized | ( | TypeKey | attribute_key, |
ParticleIndex | particle, | ||
bool | true_or_false | ||
) |
They will be modified by the samplers and optimizers.
void IMP::kernel::Model::set_maximum_score | ( | Restraint * | r, |
double | s | ||
) |
void IMP::kernel::Model::set_maximum_score | ( | double | s | ) |
void IMP::kernel::Model::update | ( | ) |
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.