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,
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]);
74 typedef boost::unordered_map<
Particle *,
84 "I don't know about particle " << p->get_name());
85 return enumerators_.find(p)->second;
87 bool get_has_particle(
Particle *p)
const {
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,
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,
Particle *) const
179 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
180 virtual void load_particle_state(
unsigned int,
Particle *)
const
208 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
209 virtual void load_particle_state(
unsigned int,
Particle *)
const
222 : ParticleStates(
"CompoundStates %1%"), a_(a), b_(b) {}
223 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
224 virtual void load_particle_state(
unsigned int,
Particle *)
const
244 virtual unsigned int get_number_of_particle_states()
const IMP_OVERRIDE;
245 virtual void load_particle_state(
unsigned int,
Particle *)
const
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,
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
A container for Singletons.
unsigned int get_nearest_state(const algebra::VectorKD &v) const
Return the state closest to a given embedding.
Store a list of ParticleIndexes.
A Bayesian inference-based sampler.
#define IMP_CHECK_OBJECT(obj)
Perform some basic validity checks on the object for memory debugging.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Sample best solutions using Domino.
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
Represent a subset of the particles being optimized.
Various general useful macros for IMP.
Key< 1, true > IntKey
The type used to identify int attributes in the Particles.
#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.
Common base class for heavy weight IMP objects.
virtual algebra::VectorKD get_embedding(unsigned int i) const
Return an embedding of the state.
functionality for defining rigid bodies
Base class for all samplers.
Various important macros for implementing decorators.
A smart pointer to a ref-counted Object that is a class member.
IndexStates(unsigned int n, IntKey k=IntKey("state"))
A class for storing lists of IMP items.
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.
Object(std::string name)
Construct an object with the given name.
Class to handle individual model particles.
#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.
void set_particle_states(Particle *p, ParticleStates *e)
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.
virtual unsigned int get_nearest_state(const algebra::VectorKD &v) const
Return the state closest to a given embedding.