IMP
2.0.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) |
ScoringFunction * | create_model_scoring_function () |
Create a scoring function object from the model restraints. More... | |
ModelObjectsTemp | get_model_objects () const |
void | remove_particle (ParticleIndex pi) |
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 IMP::base::VersionInfo | get_version_info () const =0 |
Get information about the module and version of the object. | |
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) |
Related Functions | |
(Note that these are not member functions.) | |
typedef IMP::base::Vector < IMP::base::WeakPointer < Model > > | ModelsTemp |
Related Functions inherited from IMP::base::Object | |
typedef IMP::base::Vector < IMP::base::WeakPointer < Object > > | ObjectsTemp |
States | |
The Model stores a list of ScoreStates which are given an opportunity to update the stored Particles and their internal state before and after the restraints are evaluated. Use the methods below to manipulate the list of ScoreState objects. The value type for the iterators is a ScoreState*.
| |
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) |
Statistics | |
The Model can gather various statistics about the restraints and score states used. To use this feature, first turn on statistics gather and then run your optimization (or just call evaluate).
| |
void | clear_all_statistics () |
void | set_gather_statistics (bool tf) |
bool | get_gather_statistics () const |
void | show_all_statistics (std::ostream &out=std::cout) const |
void | show_restraint_time_statistics (std::ostream &out=std::cout) const |
void | show_restraint_score_statistics (std::ostream &out=std::cout) const |
RestraintStatistics | get_restraint_statistics (Restraint *r) const |
void | show_score_state_time_statistics (std::ostream &out=std::cout) const |
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... | |
Model Data | |
Arbitrary non-particle data can be associated with the Model. This can be used for Model-level caches and such. | |
void | add_data (ModelKey mk, base::Object *o) |
base::Object * | get_data (ModelKey mk) const |
void | remove_data (ModelKey mk) |
bool | get_has_data (ModelKey mk) const |
Methods to debug particles | |
It is sometimes useful to inspect the list of all particles when debugging. These methods allow you to do that.
The value type for the iterators is a Particle*. | |
unsigned int | get_number_of_particles () const |
ParticlesTemp | get_particles () const |
Particle * | get_particle (ParticleIndex p) const |
ParticleIterator | particles_begin () const |
ParticleIterator | particles_end () const |
Additional Inherited Members | |
Protected Member Functions inherited from IMP::base::Object | |
Object (std::string name) | |
Construct an object with the given name. More... | |
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 80 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_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.
Definition at line 114 of file kernel/declare_Model.h.
ScoringFunction* IMP::kernel::Model::create_model_scoring_function | ( | ) |
Create a scoring function from the model restraints, which can be used to evaluate the score over this model particles.
Type IMP::kernel::Model::get_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) |
ModelObjectsTemp IMP::kernel::Model::get_model_objects | ( | ) | const |
Get all the ModelObjects associated with this Model.
void IMP::kernel::Model::remove_attribute | ( | TypeKey | attribute_key, |
ParticleIndex | particle | ||
) |
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::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::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.
|
related |
Pass a set of objects.
Definition at line 70 of file kernel/base_types.h.