Index: kernel/test/misc/test_model.py =================================================================== --- kernel/test/misc/test_model.py (revision 622) +++ kernel/test/misc/test_model.py (working copy) @@ -36,10 +36,10 @@ """Check restraint methods""" m = IMP.Model() self.assertRaises(IndexError, m.get_restraint, IMP.RestraintIndex(0)); - self.assertEqual(m.number_of_restraints(), 0) + self.assertEqual(m.get_number_of_restraints(), 0) r = DummyRestraint() m.add_restraint(r) - self.assertEqual(m.number_of_restraints(), 1) + self.assertEqual(m.get_number_of_restraints(), 1) newr = m.get_restraint(IMP.RestraintIndex(0)) self.assert_(isinstance(newr, IMP.Restraint)) self.assertRaises(IndexError, m.get_restraint, IMP.RestraintIndex(1)); @@ -51,10 +51,10 @@ """Check particle methods""" m = IMP.Model() p = IMP.Particle() - self.assertEqual(m.number_of_particles(), 0) + self.assertEqual(m.get_number_of_particles(), 0) pi = m.add_particle(p) self.assertEqual(pi, IMP.ParticleIndex(0)) - self.assertEqual(m.number_of_particles(), 1) + self.assertEqual(m.get_number_of_particles(), 1) self.assertNotEqual(m.get_particle(IMP.ParticleIndex(0)), None) self.assertRaises(IndexError, m.get_particle, IMP.ParticleIndex(1)) for s in m.get_particles(): Index: kernel/include/IMP/score_states/BondDecoratorListScoreState.h =================================================================== --- kernel/include/IMP/score_states/BondDecoratorListScoreState.h (revision 622) +++ kernel/include/IMP/score_states/BondDecoratorListScoreState.h (working copy) @@ -50,7 +50,7 @@ return bonds_.end(); } - unsigned int number_of_bonds() const { + unsigned int get_number_of_bonds() const { return bonds_.size(); } Index: kernel/include/IMP/score_states/NonbondedListScoreState.h =================================================================== --- kernel/include/IMP/score_states/NonbondedListScoreState.h (revision 622) +++ kernel/include/IMP/score_states/NonbondedListScoreState.h (working copy) @@ -251,7 +251,7 @@ return nbl_; } - unsigned int number_of_nonbonded() const { + unsigned int get_number_of_nonbonded() const { IMP_check(get_nbl_is_valid(), "Must call update first", ValueException); return nbl_.size(); Index: kernel/include/IMP/optimizers/MoverBase.h =================================================================== --- kernel/include/IMP/optimizers/MoverBase.h (revision 622) +++ kernel/include/IMP/optimizers/MoverBase.h (working copy) @@ -52,7 +52,7 @@ \param [in] j The index of the attribute. */ Float get_float(unsigned int i, unsigned int j) const { - IMP_assert(number_of_particles() == floats_.size(), + IMP_assert(get_number_of_particles() == floats_.size(), "Only call get_float from within generate_proposal"); return get_particle(i)->get_value(get_float_key(j)); } @@ -62,7 +62,7 @@ \param [in] j The index of the attribute. */ Int get_int(unsigned int i, unsigned int j) const { - IMP_assert(number_of_particles() == ints_.size(), + IMP_assert(get_number_of_particles() == ints_.size(), "Only call get_int from within generate_proposal"); return get_particle(i)->get_value(get_int_key(j)); } Index: kernel/include/IMP/internal/units.h =================================================================== --- kernel/include/IMP/internal/units.h (revision 622) +++ kernel/include/IMP/internal/units.h (working copy) @@ -119,6 +119,8 @@ typedef Multiply::type, Centimeter>::type CubicCentimeter; typedef Divide::type GramPerCubicCentimeter; +typedef Shift::type NanoSecond; +typedef Shift::type FemtoSecond; Index: kernel/include/IMP/macros.h =================================================================== --- kernel/include/IMP/macros.h (revision 622) +++ kernel/include/IMP/macros.h (working copy) @@ -267,7 +267,7 @@ /** \short Clear the contents of the container */ \ void clear_##lcname##s(); \ /** \short return the number of objects*/ \ - unsigned int number_of_##lcname##s() const { \ + unsigned int get_number_of_##lcname##s() const { \ return lcname##_vector_.size();} \ /** \short Get object refered to by the index \throws IndexException if the index is out of range @@ -324,7 +324,7 @@ //! Use this to add a container of IMP objects /** - Such a container adds public methods add_foo, get_foo, number_of_foo + Such a container adds public methods add_foo, get_foo, get_number_of_foo and a private type foo_iterator, with methods foo_begin, foo_end. \param[in] protection The level of protection for the container. \param[in] Ucname The name of the type in uppercase @@ -377,7 +377,7 @@ //! Use this to add a set of IMP objects owned by the containing one /** - Such a container adds public methods add_foo, get_foo, number_of_foo + Such a container adds public methods add_foo, get_foo, get_number_of_foo and a private type foo_iterator, with methods foo_begin, foo_end. \param[in] Ucname The name of the type in uppercase \param[in] lcname The name of the type in lower case Index: kernel/src/Model.cpp =================================================================== --- kernel/src/Model.cpp (revision 622) +++ kernel/src/Model.cpp (working copy) @@ -116,9 +116,9 @@ get_version_info().show(out); - out << number_of_particles() << " particles" << std::endl; - out << number_of_restraints() << " restraints" << std::endl; - out << number_of_score_states() << " score states" << std::endl; + out << get_number_of_particles() << " particles" << std::endl; + out << get_number_of_restraints() << " restraints" << std::endl; + out << get_number_of_score_states() << " score states" << std::endl; out << std::endl; } Index: kernel/src/Restraint.cpp =================================================================== --- kernel/src/Restraint.cpp (revision 622) +++ kernel/src/Restraint.cpp (working copy) @@ -41,7 +41,7 @@ void Restraint::set_model(Model* model) { - IMP_assert(model==NULL || number_of_particles()==0 + IMP_assert(model==NULL || get_number_of_particles()==0 || model == get_particle(0)->get_model() || (model_ && model_.get() == model), "Model* different from Particle Model*"); @@ -62,7 +62,7 @@ // The index line is to disable a warning IMP_LIST_IMPL(Restraint, Particle, particle,Particle*, { - IMP_assert(number_of_particles()==0 + IMP_assert(get_number_of_particles()==0 || obj->get_model() == (*particles_begin())->get_model(), "All particles in Restraint must belong to the " "same Model."); Index: kernel/src/restraints/BondDecoratorRestraint.cpp =================================================================== --- kernel/src/restraints/BondDecoratorRestraint.cpp (revision 622) +++ kernel/src/restraints/BondDecoratorRestraint.cpp (working copy) @@ -64,7 +64,7 @@ { out << "Bond decorator restraint with unary function "; f_->show(out); - out << " on " << bl_->number_of_bonds() << " bonds"; + out << " on " << bl_->get_number_of_bonds() << " bonds"; out << std::endl; } Index: kernel/src/restraints/TripletChainRestraint.cpp =================================================================== --- kernel/src/restraints/TripletChainRestraint.cpp (revision 622) +++ kernel/src/restraints/TripletChainRestraint.cpp (working copy) @@ -31,8 +31,8 @@ << " doesn't accomplish anything."<< std::endl); } else { Restraint::add_particles(ps); - chain_splits_.back()= Restraint::number_of_particles(); - chain_splits_.push_back(Restraint::number_of_particles()); + chain_splits_.back()= Restraint::get_number_of_particles(); + chain_splits_.push_back(Restraint::get_number_of_particles()); } } @@ -41,7 +41,7 @@ int cur_break=0; unsigned int i=2; float score=0; - while (i < Restraint::number_of_particles()) { + while (i < Restraint::get_number_of_particles()) { /*IMP_LOG(VERBOSE, "Chain eval on " << Restraint::get_particle(i-2)->get_index() << Restraint::get_particle(i-1)->get_index() Index: kernel/src/restraints/PairListRestraint.cpp =================================================================== --- kernel/src/restraints/PairListRestraint.cpp (revision 622) +++ kernel/src/restraints/PairListRestraint.cpp (working copy) @@ -29,11 +29,11 @@ { IMP_CHECK_OBJECT(ss_.get()); - IMP_assert(number_of_particles()%2 == 0, "There should be an even number" + IMP_assert(get_number_of_particles()%2 == 0, "There should be an even number" << " of particles"); Float score=0; - for (unsigned int i=0; i< number_of_particles(); i+=2) { + for (unsigned int i=0; i< get_number_of_particles(); i+=2) { score += ss_->evaluate(get_particle(i), get_particle(i+1), accum); } Index: kernel/src/restraints/ConnectivityRestraint.cpp =================================================================== --- kernel/src/restraints/ConnectivityRestraint.cpp (revision 622) +++ kernel/src/restraints/ConnectivityRestraint.cpp (working copy) @@ -76,7 +76,7 @@ boost::property > Graph; typedef boost::graph_traits::edge_descriptor Edge; typedef boost::graph_traits::vertex_descriptor Vertex; - Graph g(Restraint::number_of_particles()); + Graph g(Restraint::get_number_of_particles()); const float tag_weight= -std::numeric_limits::max(); for (unsigned int i=0; i< num_sets; ++i) { Index: kernel/src/restraints/SingletonListRestraint.cpp =================================================================== --- kernel/src/restraints/SingletonListRestraint.cpp (revision 622) +++ kernel/src/restraints/SingletonListRestraint.cpp (working copy) @@ -30,7 +30,7 @@ Float score=0; - for (unsigned int i=0; i< number_of_particles(); ++i) { + for (unsigned int i=0; i< get_number_of_particles(); ++i) { score += ss_->evaluate(get_particle(i), accum); } Index: kernel/src/restraints/PairChainRestraint.cpp =================================================================== --- kernel/src/restraints/PairChainRestraint.cpp (revision 622) +++ kernel/src/restraints/PairChainRestraint.cpp (working copy) @@ -31,8 +31,8 @@ << " doesn't accomplish anything."<< std::endl); } else { Restraint::add_particles(ps); - chain_splits_.back()= Restraint::number_of_particles(); - chain_splits_.push_back(Restraint::number_of_particles()); + chain_splits_.back()= Restraint::get_number_of_particles(); + chain_splits_.push_back(Restraint::get_number_of_particles()); } } @@ -41,7 +41,7 @@ int cur_break=0; unsigned int i=1; float score=0; - while (i < Restraint::number_of_particles()) { + while (i < Restraint::get_number_of_particles()) { /*IMP_LOG(VERBOSE, "Chain eval on " << Restraint::get_particle(i-2)->get_index() << Restraint::get_particle(i-1)->get_index() Index: kernel/src/score_states/CoverBondsScoreState.cpp =================================================================== --- kernel/src/score_states/CoverBondsScoreState.cpp (revision 622) +++ kernel/src/score_states/CoverBondsScoreState.cpp (working copy) @@ -84,7 +84,7 @@ void CoverBondsScoreState::show(std::ostream &out) const { - out << "CoverBondsScoreState on " << bl_->number_of_bonds() + out << "CoverBondsScoreState on " << bl_->get_number_of_bonds() << " bonds " << std::endl; } Index: kernel/src/score_states/GravityCenterScoreState.cpp =================================================================== --- kernel/src/score_states/GravityCenterScoreState.cpp (revision 622) +++ kernel/src/score_states/GravityCenterScoreState.cpp (working copy) @@ -62,7 +62,7 @@ void GravityCenterScoreState:: transform_derivatives(DerivativeAccumulator *accpt) { - size_t nchildren = number_of_particles(); + size_t nchildren = get_number_of_particles(); if (nchildren > 0) { // we know center is OK since update was called XYZDecorator d(center_); Index: kernel/src/score_states/BipartiteNonbondedListScoreState.cpp =================================================================== --- kernel/src/score_states/BipartiteNonbondedListScoreState.cpp (revision 622) +++ kernel/src/score_states/BipartiteNonbondedListScoreState.cpp (working copy) @@ -85,14 +85,14 @@ Float cost; switch (a_){ case QUADRATIC: - cost= 10*mc0_->number_of_particles()* mc1_->number_of_particles(); + cost= 10*mc0_->get_number_of_particles()* mc1_->get_number_of_particles(); break; case BBOX: - cost= 1000*(mcr_->number_of_particles()); + cost= 1000*(mcr_->get_number_of_particles()); break; default: IMP_assert(0, "Bad algorithm"); - cost= 1000*(mcr_->number_of_particles()); + cost= 1000*(mcr_->get_number_of_particles()); } if (P::update(mc+ mcr_->get_max(), cost)) { @@ -133,7 +133,7 @@ << P::get_cutoff() << " and slack " << P::get_slack() << std::endl); process_sets(mc0_->get_particles(), mc1_->get_particles()); P::set_nbl_is_valid(true); - IMP_LOG(TERSE, "NBL has " << P::number_of_nonbonded() + IMP_LOG(TERSE, "NBL has " << P::get_number_of_nonbonded() << " pairs" << std::endl); } @@ -214,7 +214,7 @@ << " " << gr(ps0[i]) << " and " << ps1[j]->get_index() << " " << dj << gr(ps1[j]) - << " size is " << number_of_nonbonded() << std::endl); + << " size is " << get_number_of_nonbonded() << std::endl); } } } Index: kernel/src/score_states/AllNonbondedListScoreState.cpp =================================================================== --- kernel/src/score_states/AllNonbondedListScoreState.cpp (revision 622) +++ kernel/src/score_states/AllNonbondedListScoreState.cpp (working copy) @@ -79,18 +79,18 @@ Float cost; switch (a_){ case QUADRATIC: - cost = 10 * square(mc_->number_of_particles()); + cost = 10 * square(mc_->get_number_of_particles()); break; case BBOX: - cost = 1000 * mc_->number_of_particles(); + cost = 1000 * mc_->get_number_of_particles(); break; case GRID: // completely made up - cost = 2000 * mc_->number_of_particles(); + cost = 2000 * mc_->get_number_of_particles(); break; default: IMP_failure("Bad algorithm", ErrorException()); - cost = 10 * mc_->number_of_particles(); + cost = 10 * mc_->get_number_of_particles(); } if (P::update(mc, cost)) { mc_->reset(); @@ -124,7 +124,7 @@ IMP_failure("Bad algorithm in AllNBL::rebuild", ErrorException()); } set_nbl_is_valid(true); - IMP_LOG(TERSE, "NBL has " << P::number_of_nonbonded() + IMP_LOG(TERSE, "NBL has " << P::get_number_of_nonbonded() << " pairs" << std::endl); } @@ -335,7 +335,7 @@ << " " << gr(ps[i]) << " and " << ps[j]->get_index() << " " << dj << gr(ps[j]) - << " size is " << number_of_nonbonded() + << " size is " << get_number_of_nonbonded() << " distance is " << distance(di, dj) << " max is " << mc_->get_max() << std::endl); } Index: kernel/src/optimizers/MoverBase.cpp =================================================================== --- kernel/src/optimizers/MoverBase.cpp (revision 622) +++ kernel/src/optimizers/MoverBase.cpp (working copy) @@ -16,18 +16,19 @@ void MoverBase::propose_move(float f) { - if (number_of_float_keys() != 0) { - floats_.resize(number_of_particles(), Floats(number_of_float_keys(), 0)); + if (get_number_of_float_keys() != 0) { + floats_.resize(get_number_of_particles(), + Floats(get_number_of_float_keys(), 0)); } - if (number_of_int_keys() != 0) { - ints_.resize(number_of_particles(), Ints(number_of_int_keys(), 0)); + if (get_number_of_int_keys() != 0) { + ints_.resize(get_number_of_particles(), Ints(get_number_of_int_keys(), 0)); } - for (unsigned int i=0; i< number_of_particles(); ++i) { + for (unsigned int i=0; i< get_number_of_particles(); ++i) { Particle *p = get_particle(i); - for (unsigned int j=0; j< number_of_float_keys(); ++j) { + for (unsigned int j=0; j< get_number_of_float_keys(); ++j) { floats_[i][j]= p->get_value(get_float_key(j)); } - for (unsigned int j=0; j< number_of_int_keys(); ++j) { + for (unsigned int j=0; j< get_number_of_int_keys(); ++j) { ints_[i][j]= p->get_value(get_int_key(j)); } } @@ -36,12 +37,12 @@ void MoverBase::reject_move() { - for (unsigned int i=0; i< number_of_particles(); ++i) { + for (unsigned int i=0; i< get_number_of_particles(); ++i) { Particle *p = get_particle(i); - for (unsigned int j=0; j< number_of_float_keys(); ++j) { + for (unsigned int j=0; j< get_number_of_float_keys(); ++j) { p->set_value(get_float_key(j), floats_[i][j]); } - for (unsigned int j=0; j< number_of_int_keys(); ++j) { + for (unsigned int j=0; j< get_number_of_int_keys(); ++j) { p->set_value(get_int_key(j), ints_[i][j]); } } Index: kernel/src/optimizers/BrownianDynamics.cpp =================================================================== --- kernel/src/optimizers/BrownianDynamics.cpp (revision 622) +++ kernel/src/optimizers/BrownianDynamics.cpp (working copy) @@ -92,7 +92,7 @@ { clear_particles(); FloatKeys xyzk=XYZDecorator::get_xyz_keys(); - for (unsigned int i = 0; i < get_model()->number_of_particles(); ++i) { + for (unsigned int i = 0; i < get_model()->get_number_of_particles(); ++i) { Particle *p = get_model()->get_particle(i); if (p->has_attribute(xyzk[0]) && p->get_is_optimized(xyzk[0]) && p->has_attribute(xyzk[1]) && p->get_is_optimized(xyzk[1]) @@ -118,14 +118,14 @@ bool BrownianDynamics::step() { - std::vector new_pos(number_of_particles()); + std::vector new_pos(get_number_of_particles()); bool noshrink=true; while (!propose_step(new_pos)) { cur_dt_= cur_dt_/2.0; noshrink=false; } - for (unsigned int i=0; i< number_of_particles(); ++i) { + for (unsigned int i=0; i< get_number_of_particles(); ++i) { XYZDecorator d(get_particle(i)); for (unsigned int j=0; j< 3; ++j) { d.set_coordinate(j, new_pos[i][j]); @@ -143,7 +143,7 @@ IMP_LOG(VERBOSE, "dt is " << cur_dt_ << std::endl); - for (unsigned int i=0; i< number_of_particles(); ++i) { + for (unsigned int i=0; i< get_number_of_particles(); ++i) { Particle *p= get_particle(i); XYZDecorator d(p); IMP_IF_CHECK(CHEAP) { Index: kernel/src/optimizers/movers/NormalMover.cpp =================================================================== --- kernel/src/optimizers/movers/NormalMover.cpp (revision 622) +++ kernel/src/optimizers/movers/NormalMover.cpp (working copy) @@ -30,9 +30,9 @@ boost::normal_distribution > sampler(random_number_generator, mrng); - for (unsigned int i = 0; i < number_of_particles(); ++i) { + for (unsigned int i = 0; i < get_number_of_particles(); ++i) { if (rand(random_number_generator) > probability) continue; - for (unsigned int j = 0; j < number_of_float_keys(); ++j) { + for (unsigned int j = 0; j < get_number_of_float_keys(); ++j) { float c = get_float(i, j); float r = sampler(); // Check for NaN (x!=x when x==NaN) (can only use std::isnan with C99) Index: kernel/src/optimizers/movers/BallMover.cpp =================================================================== --- kernel/src/optimizers/movers/BallMover.cpp (revision 622) +++ kernel/src/optimizers/movers/BallMover.cpp (working copy) @@ -57,13 +57,13 @@ void BallMover::generate_move(float scale) { - std::vector center(number_of_float_keys()); - for (unsigned int i = 0; i < number_of_particles(); ++i) { - for (unsigned int j = 0; j < number_of_float_keys(); ++j) { + std::vector center(get_number_of_float_keys()); + for (unsigned int i = 0; i < get_number_of_particles(); ++i) { + for (unsigned int j = 0; j < get_number_of_float_keys(); ++j) { center[j] = get_float(i, j); } std::vector npos = random_point_in_sphere(center, scale * radius_); - for (unsigned int j = 0; j < number_of_float_keys(); ++j) { + for (unsigned int j = 0; j < get_number_of_float_keys(); ++j) { propose_value(i, j, npos[j]); } } Index: kernel/src/optimizers/MolecularDynamics.cpp =================================================================== --- kernel/src/optimizers/MolecularDynamics.cpp (revision 622) +++ kernel/src/optimizers/MolecularDynamics.cpp (working copy) @@ -52,7 +52,7 @@ degrees_of_freedom_ = 0; clear_particles(); - for (unsigned int i = 0; i < get_model()->number_of_particles(); ++i) { + for (unsigned int i = 0; i < get_model()->get_number_of_particles(); ++i) { Particle *p = get_model()->get_particle(i); if (p->has_attribute(cs_[0]) && p->get_is_optimized(cs_[0]) && p->has_attribute(cs_[1]) && p->get_is_optimized(cs_[1])