9 #ifndef IMPDOMINO_PARTICLE_STATES_H
10 #define IMPDOMINO_PARTICLE_STATES_H
12 #include <IMP/domino/domino_config.h>
27 #include <boost/unordered_map.hpp>
29 IMPDOMINO_BEGIN_NAMESPACE
40 virtual unsigned int get_number_of_particle_states()
const = 0;
41 virtual void load_particle_state(
unsigned int,
kernel::Particle *)
const = 0;
54 "This is not a defaultly produced"
57 "Out of range state found, this is not a default "
59 return static_cast<unsigned int>(v[0]);
84 "I don't know about particle " << p->get_name());
85 return enumerators_.find(p)->second;
88 return enumerators_.find(p) != enumerators_.end();
92 ret.reserve(enumerators_.size());
93 for (Map::const_iterator it = enumerators_.begin();
94 it != enumerators_.end(); ++it) {
95 ret.push_back(it->first);
97 std::sort(ret.begin(), ret.end());
107 "Cannot have 0 states for a particle: \"" << p->get_name()
128 virtual unsigned int get_number_of_particle_states() const
IMP_OVERRIDE;
129 virtual
void load_particle_state(
unsigned int, kernel::
Particle *) const
143 : ParticleStates(
"XYZStates %1%"),
145 nn_(
new algebra::NearestNeighbor3D(states)) {}
155 return nn_->get_nearest_neighbors(v, 1)[0];
157 virtual unsigned int get_number_of_particle_states() const IMP_OVERRIDE;
158 virtual
void load_particle_state(
unsigned int, kernel::
Particle *) const
179 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
208 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
222 : ParticleStates(
"CompoundStates %1%"), a_(a), b_(b) {}
223 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
244 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
265 unsigned int cur = permutation_[i];
267 "Out of range state returned. This is perplexing.");
270 virtual unsigned int get_number_of_particle_states() const IMP_OVERRIDE;
271 virtual
void load_particle_state(
unsigned int, kernel::
Particle *) const
277 inline unsigned int PermutationStates::get_number_of_particle_states()
const {
278 return inner_->get_number_of_particle_states();
280 inline void PermutationStates::load_particle_state(
unsigned int i,
282 return inner_->load_particle_state(get_inner_state(i), p);
303 IMPDOMINO_END_NAMESPACE
unsigned int get_inner_state(unsigned int i) const
Import IMP/kernel/SingletonContainer.h in the namespace.
unsigned int get_nearest_state(const algebra::VectorKD &v) const
Return the state closest to a given embedding.
Store a list of kernel::ParticlesTemp.
A Bayesian inference-based sampler.
#define IMP_CHECK_OBJECT(obj)
Perform some basic validity checks on the object for memory debugging.
A smart pointer to a ref-counted Object that is a class member.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
ParticlesTemp get_particles(kernel::Model *m, const ParticleIndexes &ps)
Sample best solutions using Domino.
Represent a subset of the particles being optimized.
Import IMP/kernel/macros.h in the namespace.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
algebra::VectorKD get_embedding(unsigned int i) const
Return an embedding of the state.
virtual algebra::VectorKD get_embedding(unsigned int i) const
Return an embedding of the state.
Object(std::string name)
Construct an object with the given name.
functionality for defining rigid bodies
Import IMP/kernel/Sampler.h in the namespace.
Various important macros for implementing decorators.
IndexStates(unsigned int n, IntKey k=IntKey("state"))
Class to handle individual model particles.
A class for storing lists of IMP items.
Common base class for heavy weight IMP objects.
A Bayesian inference-based sampler.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
A nullptr-initialized pointer to an IMP Object.
void set_particle_states(kernel::Particle *p, ParticleStates *e)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Functions to generate vectors.
Simple 3D rotation class.
Subset get_subset() const
Return the subset corresponding to all the particles.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
IMP::kernel::IntKey IntKey
virtual unsigned int get_nearest_state(const algebra::VectorKD &v) const
Return the state closest to a given embedding.