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 override;
129 virtual void load_particle_state(
unsigned int,
Particle *)
const
145 nn_(
new algebra::NearestNeighbor3D(states)) {}
156 return nn_->get_nearest_neighbors(v, 1)[0];
158 virtual unsigned int get_number_of_particle_states()
const override;
159 virtual void load_particle_state(
unsigned int,
Particle *)
const
180 virtual unsigned int get_number_of_particle_states()
const override;
181 virtual void load_particle_state(
unsigned int,
Particle *)
const
209 virtual unsigned int get_number_of_particle_states()
const override;
210 virtual void load_particle_state(
unsigned int,
Particle *)
const
224 virtual unsigned int get_number_of_particle_states()
const override;
225 virtual void load_particle_state(
unsigned int,
Particle *)
const
245 virtual unsigned int get_number_of_particle_states()
const override;
246 virtual void load_particle_state(
unsigned int,
Particle *)
const
266 unsigned int cur = permutation_[i];
268 "Out of range state returned. This is perplexing.");
271 virtual unsigned int get_number_of_particle_states()
const override;
272 virtual void load_particle_state(
unsigned int,
Particle *)
const
278 inline unsigned int PermutationStates::get_number_of_particle_states()
const {
279 return inner_->get_number_of_particle_states();
281 inline void PermutationStates::load_particle_state(
unsigned int i,
283 return inner_->load_particle_state(get_inner_state(i), p);
304 IMPDOMINO_END_NAMESPACE
unsigned int get_nearest_state(const algebra::VectorKD &v) const override
Return the state closest to a given embedding.
unsigned int get_inner_state(unsigned int i) const
A container for Singletons.
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)
Get the particles from a list of indexes.
Represent a subset of the particles being optimized.
algebra::VectorKD get_embedding(unsigned int i) const override
Return an embedding of the state.
Various general useful macros for IMP.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
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.
Key< 1 > IntKey
The type used to identify int attributes in the Particles.
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 lists of object pointers.
A nullptr-initialized pointer to an IMP Object.
Object(std::string name)
Construct an object with the given name.
Class to handle individual particles of a Model object.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Functions to search over vectors.
void set_particle_states(Particle *p, ParticleStates *e)
Subset get_subset() const
Return the subset corresponding to all the particles.
virtual unsigned int get_nearest_state(const algebra::VectorKD &v) const
Return the state closest to a given embedding.