IMP logo
IMP Reference Guide  2.20.1
The Integrative Modeling Platform
IMP::ConfigurationSet Class Reference

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

#include <IMP/ConfigurationSet.h>

+ Inheritance diagram for IMP::ConfigurationSet:

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.

1 ## \example kernel/basic_optimization.py
2 # This illustrates a basic main loop for optimization and searching for the
3 # best scoring conformation.
4 #
5 
6 from __future__ import print_function
7 import IMP.container
8 import IMP.statistics
9 import sys
10 
11 IMP.setup_from_argv(sys.argv, "Basic optimization")
12 
13 # Make 100 particles randomly distributed in a cubic box
14 m = IMP.Model()
17  IMP.algebra.Vector3D(10,10,10))
18 for i in range(100):
19  p = m.add_particle("p")
20  lsc.add(p)
23  d.set_coordinates_are_optimized(True)
24 
28 # we don't want to see lots of log messages about restraint evaluation
29 m.set_log_level(IMP.WARNING)
30 
31 # the container (lsc) stores a list of particle indices
32 pis = lsc.get_contents()
33 
35 s.set_scoring_function(sf)
36 s.set_number_of_attempts(10)
37 # but we do want something to watch
38 s.set_log_level(IMP.TERSE)
39 s.set_number_of_monte_carlo_steps(10)
40 # find some configurations which move the particles far apart
41 configs = s.create_sample()
42 for i in range(0, configs.get_number_of_configurations()):
43  configs.load_configuration(i)
44  # print out the sphere containing the point set
45  # - Why? - Why not?
47  print(sphere)
48 
49 # cluster the solutions based on their coordinates
51 
52 # of course, this doesn't return anything of interest since the points are
53 # randomly distributed, but, again, why not?
54 clustering = IMP.statistics.create_lloyds_kmeans(e, 3, 1000)
55 for i in range(0, clustering.get_number_of_clusters()):
56  # load the configuration for a central point
57  configs.load_configuration(clustering.get_cluster_representative(i))
59  print(sphere)

Definition at line 28 of file ConfigurationSet.h.

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 override
 
virtual ::IMP::VersionInfo get_version_info () const override
 Get information about the module and version of the object. More...
 
void load_configuration (int i) const
 Load the ith configuration into the Model. More...
 
void remove_configuration (unsigned int i)
 
void save_configuration ()
 Save the current configuration of the Model. 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)
 

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 ()
 

Member Function Documentation

virtual ::IMP::VersionInfo IMP::ConfigurationSet::get_version_info ( ) const
overridevirtual

Get information about the module and version of the object.

Reimplemented from IMP::Object.

Definition at line 43 of file ConfigurationSet.h.

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

Load the ith configuration into the Model.

Passing -1 returns it to the base configuration.

void IMP::ConfigurationSet::save_configuration ( )

Save the current configuration of the Model.


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