Index: kernel/src/optimizers/movers/BallMover.cpp =================================================================== --- kernel/src/optimizers/movers/BallMover.cpp (revision 388) +++ kernel/src/optimizers/movers/BallMover.cpp (working copy) @@ -54,7 +54,7 @@ for (unsigned int i = 0; i < vars.size(); ++i) { add_key(vars[i]); } - max_step_ = max; + set_radius(max); } void BallMover::generate_move(float scale) @@ -64,7 +64,7 @@ for (unsigned int j = 0; j < number_of_float_keys(); ++j) { center[j] = get_float(i, j); } - std::vector npos = random_point_in_sphere(center, scale * max_step_); + std::vector npos = random_point_in_sphere(center, scale * radius_); for (unsigned int j = 0; j < number_of_float_keys(); ++j) { propose_value(i, j, npos[j]); } Index: kernel/src/optimizers/movers/NormalMover.cpp =================================================================== --- kernel/src/optimizers/movers/NormalMover.cpp (revision 388) +++ kernel/src/optimizers/movers/NormalMover.cpp (working copy) @@ -17,12 +17,11 @@ const FloatKeys &vars, Float max) { - IMP_assert(max != 0, "Must have some width"); add_particles(pis); for (unsigned int i = 0; i < vars.size(); ++i) { add_key(vars[i]); } - stddev_ = max; + set_sigma(max); } void NormalMover::generate_move(float scale) Index: kernel/include/IMP/optimizers/movers/BallMover.h =================================================================== --- kernel/include/IMP/optimizers/movers/BallMover.h (revision 388) +++ kernel/include/IMP/optimizers/movers/BallMover.h (working copy) @@ -1,5 +1,6 @@ /** - * \file BallMover.h \brief A modifier which perturbs a discrete variable. + * \file BallMover.h + * \brief A modifier which variables within a ball. * * Copyright 2007-8 Sali Lab. All rights reserved. * @@ -23,13 +24,30 @@ class IMPDLLEXPORT BallMover :public MoverBase { public: + /** The attributes are perturbed within a pall whose dimensionality is + given by the number of attributes and radius by the given value. + \param[in] ps The particles to perturb. + \param[in] vars The variables to use (normally the keys for x,y,z) + \param[in] radius The radius deviation to use. + */ BallMover(const Particles &pis, const FloatKeys &vars, - Float max); + Float radius); + //! + void set_radius(Float radius) { + IMP_check(radius > 0, "The radius must be positive", + ValueException("Negative radius")); + radius_=radius; + } + //! + Float get_radius() const { + return radius_; + } protected: + /** \internal */ void generate_move(float a); private: - Float max_step_; + Float radius_; }; } // namespace IMP Index: kernel/include/IMP/optimizers/movers/NormalMover.h =================================================================== --- kernel/include/IMP/optimizers/movers/NormalMover.h (revision 388) +++ kernel/include/IMP/optimizers/movers/NormalMover.h (working copy) @@ -1,6 +1,6 @@ /** * \file NormalMover.h - * \brief A modifier which perturbs a point with a gaussian. + * \brief A modifier which perturbs a point with a normal distribution. * * Copyright 2007-8 Sali Lab. All rights reserved. * @@ -15,22 +15,34 @@ namespace IMP { -//! Modify a set of continuous variables. -/** The variables are perturbed within a ball of the - given radius. - \ingroup mover +//! Modify a set of continuous variables using a normal distribution. +/** \ingroup mover */ class IMPDLLEXPORT NormalMover :public MoverBase { public: - NormalMover(const Particles &pis, const FloatKeys &vars, - Float stdev); + /** + \param[in] ps The particles to perturb. + \param[in] vars The variables to use (normally the keys for x,y,z) + \param[in] sigma The standard deviation to use. + */ + NormalMover(const Particles &ps, const FloatKeys &vars, + Float sigma); void set_particles(const Particles &ps) { MoverBase::clear_particles(); MoverBase::add_particles(ps); } + void set_sigma(Float sigma) { + IMP_check(sigma > 0, "Sigma must be positive", + ValueException("Negative sigma")); + stddev_=sigma; + } + Float get_sigma() const { + return stddev_; + } protected: - virtual void generate_move(float f); + /** \internal */ + virtual void generate_move(float f); private: Float stddev_; }; Index: kernel/include/IMP/optimizers/MoverBase.h =================================================================== --- kernel/include/IMP/optimizers/MoverBase.h (revision 388) +++ kernel/include/IMP/optimizers/MoverBase.h (working copy) @@ -60,7 +60,7 @@ } Particle *get_particle(unsigned int i) const { IMP_check(i< ps_.size(), "Bad index in MoverBase::get_particle", - IndexException()); + IndexException("Particle index out of range in mover base")); return ps_[i]; } @@ -114,7 +114,9 @@ \param[in] t The value to propose */ void propose_value(unsigned int i, unsigned int j, Float t) { - get_particle(i)->set_value(fkeys_[j], t); + if (get_particle(i)->get_is_optimized(fkeys_[j])) { + get_particle(i)->set_value(fkeys_[j], t); + } } //! Propose a value /** \param[in] i The index of the particle.