IMP logo
Public Member Functions | Static Public Member Functions | Related Functions

IMP::ConfigurationSet Class Reference


Detailed Description

A class to store a set of configurations of a model.

The class maintains a set of structures found by a Sampler protocol and allows them to be queried and loaded and saved.

import IMP.example
import IMP.statistics

(m,c)=IMP.example.create_model_and_particles()
ps= IMP.core.DistancePairScore(IMP.core.HarmonicLowerBound(1,1))
r= IMP.container.PairsRestraint(ps, IMP.container.ClosePairContainer(c, 2.0))
m.add_restraint(r)
# we don't want to see lots of log messages about restraint evaluation
m.set_log_level(IMP.WARNING)

# the container (c) stores a list of particles, which are alse XYZR particles
# we can construct a list of all the decorated particles
xyzrs= c.get_particles()

s= IMP.core.MCCGSampler(m)
s.set_number_of_attempts(10)
# but we do want something to watch
s.set_log_level(IMP.TERSE)
s.set_number_of_monte_carlo_steps(10)
# find some configurations which move the particles far apart
configs= s.get_sample();
for i in range(0, configs.get_number_of_configurations()):
    configs.load_configuration(i)
    # print out the sphere containing the point set
    # - Why? - Why not?
    sphere= IMP.core.get_enclosing_sphere(xyzrs)
    print sphere

# cluster the solutions based on their coordinates
e= IMP.statistics.ConfigurationSetXYZEmbedding(configs, c)

# of course, this doesn't return anything of interest since the points are
# randomly distributed, but, again, why not?
clustering = IMP.statistics.create_lloyds_kmeans(e, 3, 1000)
for i in range(0,clustering.get_number_of_clusters()):
    # load the configuration for a central point
    configs.load_configuration(clustering.get_cluster_representative(i))
    sphere= IMP.core.get_enclosing_sphere(xyzrs)
    print sphere

Examples: nup84 cg, sample 0, nup84 rb, analyze 0

Inheritance diagram for IMP::ConfigurationSet:

Public Member Functions

 ConfigurationSet (Model *m, std::string name="ConfigurationSet %1%")
Modelget_model () const
unsigned int get_number_of_configurations () const
virtual std::string get_type_name () const
virtual ::IMP::VersionInfo get_version_info () const
void load_configuration (int i) const
 Load the ith configuration into the Model.
void remove_configuration (unsigned int i)
void save_configuration ()
 Save the current configuration of the Model.

Static Public Member Functions

static ConfigurationSetget_from (Object *o)

Related Functions

(Note that these are not member functions.)
ConfigurationSetread_configuration_set (std::string fname, const Particles &ps, const FloatKeys &keys)
void read_configuration_set (std::string fname, const Particles &ps, const FloatKeys &keys, ConfigurationSet *out)
void write_configuration_set (ConfigurationSet *cs, const Particles &ps, const FloatKeys &keys, std::string fname)

Member Function Documentation

void IMP::ConfigurationSet::load_configuration ( int  i) const

Load the ith configuration into the Model.

Passing -1 returns it to the base configuration.


Friends And Related Function Documentation

ConfigurationSet * read_configuration_set ( std::string  fname,
const Particles &  ps,
const FloatKeys &  keys 
) [related]

Read a set of configurations from a file created by write_binary_model(). The function read_configuration_set() requires NetCDF in order to function.

void read_configuration_set ( std::string  fname,
const Particles &  ps,
const FloatKeys &  keys,
ConfigurationSet out 
) [related]

Read a set of configurations from a file created by write_binary_model() into an existing configuration set. The function read_configuration_set() requires NetCDF in order to function.

void write_configuration_set ( ConfigurationSet cs,
const Particles &  ps,
const FloatKeys &  keys,
std::string  fname 
) [related]

Write a configuration set to a file. The function write_configuration_set() requires NetCDF in order to function.


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

Generated on Thu Mar 24 2011 02:01:43 for IMP by doxygen 1.7.3