8 #ifndef IMPCORE_MOVER_BASE_H
9 #define IMPCORE_MOVER_BASE_H
11 #include <IMP/core/core_config.h>
14 #include <IMP/internal/container_helpers.h>
19 IMPCORE_BEGIN_NAMESPACE
22 #if defined(IMP_DOXYGEN) || IMP_HAS_DEPRECATED
37 void do_propose_value(
unsigned int i,
38 unsigned int j,
Float t) {
41 "Out of range particle");
42 if (get_model()->get_is_optimized(keys_[j],
44 get_model()->set_attribute(keys_[j], particles_[i],
47 ->get_attribute(keys_[j],
50 "Tried to set, but it didn't work.");
53 << keys_[j] <<
" of particle "
54 << get_model()->get_particle(particles_[i])->get_name()
63 virtual ParticlesTemp propose_move(
Float f);
66 return IMP::internal::get_particle(get_model(), particles_);
70 unsigned int get_number_of_particles()
const {
71 return particles_.size();
73 unsigned int get_number_of_keys()
const {
76 std::string get_particle_name(
unsigned int i)
const {
77 return get_model()->get_particle(particles_[i])->get_name();
83 virtual void do_move (
Float f) =0;
92 return get_model()->get_attribute(keys_[j], particles_[i]);
101 do_propose_value(i, j, t);
107 Mover(IMP::internal::get_model(ps), name),
109 particles_(IMP::internal::
get_index(ps)) {}
113 inline ParticlesTemp MoverBase::propose_move(
Float f)
115 values_.resize(particles_.size(),
117 for (
unsigned int i=0; i< particles_.size(); ++i) {
118 for (
unsigned int j=0; j< keys_.size(); ++j) {
119 values_[i][j]= get_value(i,j);
123 return IMP::internal::get_particle(get_model(), particles_);
127 inline void MoverBase::reset_move()
129 for (
unsigned int i=0; i< particles_.size(); ++i) {
130 for (
unsigned int j=0; j< keys_.size(); ++j) {
131 get_model()->set_attribute(keys_[j], particles_[i], values_[i][j]);
139 IMPCORE_END_NAMESPACE