Index: kernel/test/particles/test_particles.py =================================================================== --- kernel/test/particles/test_particles.py (revision 449) +++ kernel/test/particles/test_particles.py (working copy) @@ -37,7 +37,7 @@ """Check that operations fail on inactivated particles""" p0 = self.particles[0] p1 = self.particles[1] - r = IMP.DistanceRestraint(p0, p1, IMP.Harmonic(10.0, 0.1)) + r = IMP.DistanceRestraint(IMP.Harmonic(10.0, 0.1), p0, p1) self.model.add_restraint(r) p0.set_is_active(False) self.assertRaises(ValueError, p0.get_value, xkey) Index: kernel/test/distance/test_distance.py =================================================================== --- kernel/test/distance/test_distance.py (revision 449) +++ kernel/test/distance/test_distance.py (working copy) @@ -35,7 +35,7 @@ for sf in (IMP.HarmonicUpperBound(mean, 0.1), IMP.HarmonicLowerBound(mean, 0.1), IMP.Harmonic(mean, 0.1)): - r = IMP.DistanceRestraint(p1, p2, sf) + r = IMP.DistanceRestraint(sf, p1, p2) self.rsrs.append(r) def _make_restraints(self): @@ -53,28 +53,29 @@ # all should be 0.0 for fs in (IMP.HarmonicUpperBound(3.0, 0.1), IMP.HarmonicLowerBound(3.0, 0.1), IMP.Harmonic(3.0, 0.1)): - r = IMP.DistanceRestraint(self.particles[1], - self.particles[0], fs) + r = IMP.DistanceRestraint(fs, self.particles[1], + self.particles[0]) self.rsrs.append(r) # exceed lower bound for fs in (IMP.HarmonicUpperBound(5.0, 0.1), IMP.HarmonicLowerBound(5.0, 0.1), IMP.Harmonic(5.0, 0.1)): - r = IMP.DistanceRestraint(self.particles[1], - self.particles[2], fs) + r = IMP.DistanceRestraint(fs, self.particles[1], + self.particles[2]) self.rsrs.append(r) # exceed upper bound for fs in (IMP.HarmonicUpperBound(4.0, 0.1), IMP.HarmonicLowerBound(4.0, 0.1), IMP.Harmonic(4.0, 0.1)): - r = IMP.DistanceRestraint(self.particles[0], - self.particles[2], fs) + r = IMP.DistanceRestraint(fs, self.particles[0], + self.particles[2]) self.rsrs.append(r) def test_show(self): """Test Restraint::show() method""" - r = IMP.DistanceRestraint(self.particles[1], - self.particles[0], IMP.Harmonic(0.0, 0.1)) + r = IMP.DistanceRestraint( IMP.Harmonic(0.0, 0.1), + self.particles[1], + self.particles[0]) r.show() def test_distance(self): Index: kernel/test/misc/test_restraint_sets.py =================================================================== --- kernel/test/misc/test_restraint_sets.py (revision 449) +++ kernel/test/misc/test_restraint_sets.py (working copy) @@ -17,9 +17,9 @@ 20.0, 74.0, -80.0)) # separate particles by 5.0: - self.distrsr = IMP.DistanceRestraint(self.particles[0], - self.particles[1], - IMP.Harmonic(5.0, 0.1)) + self.distrsr = IMP.DistanceRestraint(IMP.Harmonic(5.0, 0.1), + self.particles[0], + self.particles[1]) # add restraints self.rset = IMP.RestraintSet("distance_rsrs") Index: kernel/test/restraints/test_angles.py =================================================================== --- kernel/test/restraints/test_angles.py (revision 449) +++ kernel/test/restraints/test_angles.py (working copy) @@ -36,7 +36,7 @@ print str(i) l= One() self.stupid_hack.append(l) - r= IMP.AngleRestraint(ps[i-2],ps[i-1], ps[i], l) + r= IMP.AngleRestraint(l, ps[i-2],ps[i-1], ps[i]) s.add_restraint(r) #print r.evaluate(None) #print r.thisown Index: kernel/test/restraints/test_list.py =================================================================== --- kernel/test/restraints/test_list.py (revision 449) +++ kernel/test/restraints/test_list.py (working copy) @@ -30,7 +30,7 @@ p= IMP.Particle() m.add_particle(p) os= OneSingle() - s= IMP.SingletonListRestraint(m.get_particles(), os) + s= IMP.SingletonListRestraint(os, m.get_particles()) m.add_restraint(s) score= m.evaluate(False) self.assertEqual(score, 10, "Wrong score") @@ -47,8 +47,8 @@ d.set_coordinates_are_optimized(True) v= IMP.Vector3D(3,1,5) l= Linear() - s= IMP.DistanceToSingletonScore(v, l) - r= IMP.SingletonListRestraint(m.get_particles(), s) + s= IMP.DistanceToSingletonScore(l, v) + r= IMP.SingletonListRestraint(s, m.get_particles()) m.add_restraint(r) e= m.evaluate(False) self.assertEqual(e,5, "Wrong distance in score") Index: kernel/test/restraints/test_dihedral.py =================================================================== --- kernel/test/restraints/test_dihedral.py (revision 449) +++ kernel/test/restraints/test_dihedral.py (working copy) @@ -18,18 +18,18 @@ particles.append(IMP.utils.XYZParticle(model, 0.0, 0.0, 0.0)) particles.append(IMP.utils.XYZParticle(model, math.cos(system_angle), math.sin(system_angle), 0.0)) - r = IMP.DistanceRestraint(particles[0], particles[1], - IMP.Harmonic(1.0, 0.1)) + r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1), + particles[0], particles[1]) model.add_restraint(r) - r = IMP.DistanceRestraint(particles[1], particles[2], - IMP.Harmonic(1.0, 0.1)) + r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1), + particles[1], particles[2]) model.add_restraint(r) - r = IMP.DistanceRestraint(particles[2], particles[3], - IMP.Harmonic(1.0, 0.1)) + r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1), + particles[2], particles[3]) model.add_restraint(r) - rsr = IMP.DihedralRestraint(particles[0], particles[1], particles[2], - particles[3], - IMP.Harmonic(scored_angle, 0.1)) + rsr = IMP.DihedralRestraint(IMP.Harmonic(scored_angle, 0.1), + particles[0], particles[1], particles[2], + particles[3]) model.add_restraint(rsr) return model, rsr Index: kernel/test/restraints/test_angle.py =================================================================== --- kernel/test/restraints/test_angle.py (revision 449) +++ kernel/test/restraints/test_angle.py (working copy) @@ -17,14 +17,12 @@ particles.append(IMP.utils.XYZParticle(model, 0.0, 0.0, 0.0)) particles.append(IMP.utils.XYZParticle(model, -math.cos(system_angle), math.sin(system_angle), 0.0)) - r = IMP.DistanceRestraint(particles[0], particles[1], - IMP.Harmonic(1.0, 0.1)) + r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1),particles[0], particles[1]) model.add_restraint(r) - r = IMP.DistanceRestraint(particles[1], particles[2], - IMP.Harmonic(1.0, 0.1)) + r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1), particles[1], particles[2]) model.add_restraint(r) - rsr = IMP.AngleRestraint(particles[0], particles[1], particles[2], - IMP.Harmonic(scored_angle, 0.1)) + rsr = IMP.AngleRestraint(IMP.Harmonic(scored_angle, 0.1), + particles[0], particles[1], particles[2]) model.add_restraint(rsr) return model, rsr Index: kernel/test/restraints/test_pairlist.py =================================================================== --- kernel/test/restraints/test_pairlist.py (revision 449) +++ kernel/test/restraints/test_pairlist.py (working copy) @@ -36,7 +36,7 @@ ps.append(IMP.ParticlePair(p, last)) last= p os= IndexDiff() - s= IMP.PairListRestraint(ps, os) + s= IMP.PairListRestraint(os, ps) m.add_restraint(s) score= m.evaluate(False) print str(score) Index: kernel/test/modeller/test_exclusion_volumes.py =================================================================== --- kernel/test/modeller/test_exclusion_volumes.py (revision 449) +++ kernel/test/modeller/test_exclusion_volumes.py (working copy) @@ -126,14 +126,14 @@ p2 = self.particles[i+1] mean = p1.get_value(radius) + p2.get_value(radius) sf = IMP.HarmonicUpperBound(mean, 0.1) - rsrs.append(IMP.DistanceRestraint(p1, p2, sf)) + rsrs.append(IMP.DistanceRestraint(sf, p1, p2)) for i in range(5, 11): p1 = self.particles[i] p2 = self.particles[i+1] mean = p1.get_value(radius) + p2.get_value(radius) sf = IMP.HarmonicUpperBound(mean, 0.1) - rsrs.append(IMP.DistanceRestraint(p1, p2, sf)) + rsrs.append(IMP.DistanceRestraint(sf, p1, p2)) # create the exclusion volume for each protein score_func_params_lb = IMP.BasicScoreFuncParams("harmonic_lower_bound", 0.0, 0.1) @@ -192,14 +192,14 @@ p2 = self.particles[i+1] mean = p1.get_value(radius) + p2.get_value(radius) sf = IMP.HarmonicUpperBound(mean, 0.1) - rsrs.append(IMP.DistanceRestraint(p1, p2, sf)) + rsrs.append(IMP.DistanceRestraint(sf, p1, p2)) for i in range(5, 11): p1 = self.particles[i] p2 = self.particles[i+1] mean = p1.get_value(radius) + p2.get_value(radius) sf = IMP.HarmonicUpperBound(mean, 0.1) - rsrs.append(IMP.DistanceRestraint(p1, p2, sf)) + rsrs.append(IMP.DistanceRestraint(sf, p1, p2)) # create the exclusion volume for each protein score_func_params_lb = IMP.BasicScoreFuncParams("harmonic_lower_bound", 0.0, 0.1) Index: kernel/test/states/test_cmm_log.py =================================================================== --- kernel/test/states/test_cmm_log.py (revision 449) +++ kernel/test/states/test_cmm_log.py (working copy) @@ -72,7 +72,7 @@ d1.set_z(1) a= IMP.CMMLogOptimizerState(nm, IMP.Particles([p0,p1])) a.set_skip_steps(20) - r= IMP.DistanceRestraint(p0, p1, IMP.Harmonic(0,10)); + r= IMP.DistanceRestraint( IMP.Harmonic(0,10), p0, p1); m.add_restraint(r); o.add_optimizer_state(a) o.optimize(11) Index: kernel/test/states/test_vrml_log.py =================================================================== --- kernel/test/states/test_vrml_log.py (revision 449) +++ kernel/test/states/test_vrml_log.py (working copy) @@ -73,7 +73,7 @@ d1.set_z(1) a= IMP.VRMLLogOptimizerState(nm, IMP.Particles([p0,p1])) a.set_skip_steps(20) # kind of a hack - r= IMP.DistanceRestraint(p0, p1, IMP.Harmonic(0,10)); + r= IMP.DistanceRestraint(IMP.Harmonic(0,10), p0, p1); m.add_restraint(r); o.add_optimizer_state(a) o.optimize(11) Index: kernel/test/states/test_nonbonded_list.py =================================================================== --- kernel/test/states/test_nonbonded_list.py (revision 449) +++ kernel/test/states/test_nonbonded_list.py (working copy) @@ -36,7 +36,7 @@ s= IMP.AllNonbondedListScoreState(m.get_particles()) m.add_score_state(s) o= OnePair() - r= IMP.NonbondedRestraint(s, o, 15) + r= IMP.NonbondedRestraint(o, s, 15) m.add_restraint(r) score= m.evaluate(False) self.assertEqual(score, 45, "Wrong score") @@ -63,10 +63,10 @@ s.add_bonded_list(b) m.add_score_state(s) o= OnePair() - r= IMP.NonbondedRestraint(s, o, 10) + r= IMP.NonbondedRestraint(o, s, 10) os=OneScore() print os(6) - br= IMP.BondDecoratorRestraint(b, os) + br= IMP.BondDecoratorRestraint(os, b) m.add_restraint(r) m.add_restraint(br) score= m.evaluate( False ) @@ -90,7 +90,7 @@ s= IMP.AllNonbondedListScoreState(ps) m.add_score_state(s) o= OnePair() - r= IMP.NonbondedRestraint(s, o, 15) + r= IMP.NonbondedRestraint(o, s, 15) m.add_restraint(r) score= m.evaluate(False) self.assertEqual(score, 1225, "Wrong score") @@ -112,7 +112,7 @@ s= IMP.BipartiteNonbondedListScoreState(ps0, ps1, 1000) m.add_score_state(s) o= OnePair() - r= IMP.NonbondedRestraint(s, o, 15) + r= IMP.NonbondedRestraint(o, s, 15) m.add_restraint(r) score= m.evaluate(False) self.assertEqual(score, 25, "Wrong score") @@ -131,7 +131,7 @@ s= IMP.AllSphereNonbondedListScoreState(m.get_particles(), rk) m.add_score_state(s) o= OnePair() - r= IMP.NonbondedRestraint(s, o, 15) + r= IMP.NonbondedRestraint(o, s, 15) m.add_restraint(r) score= m.evaluate(False) self.assertEqual(score, 45, "Wrong score") @@ -151,7 +151,7 @@ m.add_score_state(s) sd= IMP.SphereDistancePairScore(IMP.HarmonicLowerBound(0,1), rk) - r= IMP.NonbondedRestraint(s, sd, 1) + r= IMP.NonbondedRestraint(sd, s, 1) m.add_restraint(r) score= m.evaluate(False) opt= IMP.ConjugateGradients() Index: kernel/test/optimizers/test_md_optimizer.py =================================================================== --- kernel/test/optimizers/test_md_optimizer.py (revision 449) +++ kernel/test/optimizers/test_md_optimizer.py (working copy) @@ -129,6 +129,8 @@ ekinetic = self.md.get_kinetic_energy() tkinetic = self.md.get_kinetic_temperature(ekinetic) diff = abs(tkinetic - desired) + print diff + print tolerance self.assert_(diff < tolerance) def test_temperature(self): Index: kernel/test/optimizers/test_sd_optimizer.py =================================================================== --- kernel/test/optimizers/test_sd_optimizer.py (revision 449) +++ kernel/test/optimizers/test_sd_optimizer.py (working copy) @@ -36,7 +36,7 @@ p2 = self.particles[pairs[1]] mean = p1.get_value(radkey) + p2.get_value(radkey) sf = IMP.Harmonic(mean, 0.1) - rsr = IMP.DistanceRestraint(p1, p2, sf) + rsr = IMP.DistanceRestraint(sf, p1, p2) self.rsrs.append(rsr) # add restraints Index: kernel/include/IMP/singleton_scores/DistanceToSingletonScore.h =================================================================== --- kernel/include/IMP/singleton_scores/DistanceToSingletonScore.h (revision 449) +++ kernel/include/IMP/singleton_scores/DistanceToSingletonScore.h (working copy) @@ -25,7 +25,7 @@ internal::ObjectPointer f_; Vector3D pt_; public: - DistanceToSingletonScore(const Vector3D& pt, UnaryFunction *f); + DistanceToSingletonScore(UnaryFunction *f, const Vector3D& pt); virtual ~DistanceToSingletonScore(){} virtual Float evaluate(Particle *a, DerivativeAccumulator *da); Index: kernel/include/IMP/singleton_scores/AttributeSingletonScore.h =================================================================== --- kernel/include/IMP/singleton_scores/AttributeSingletonScore.h (revision 449) +++ kernel/include/IMP/singleton_scores/AttributeSingletonScore.h (working copy) @@ -24,7 +24,7 @@ internal::ObjectPointer f_; FloatKey k_; public: - AttributeSingletonScore(FloatKey k, UnaryFunction *f); + AttributeSingletonScore(UnaryFunction *f, FloatKey k); virtual ~AttributeSingletonScore(){} virtual Float evaluate(Particle *a, DerivativeAccumulator *da); Index: kernel/include/IMP/SingletonScore.h =================================================================== --- kernel/include/IMP/SingletonScore.h (revision 449) +++ kernel/include/IMP/SingletonScore.h (working copy) @@ -24,6 +24,9 @@ */ //! Abstract score function for a single particle. +/** SingletonScores should take a UnaryFunction as their first + argument if such is needed. +*/ class IMPDLLEXPORT SingletonScore : public internal::Object { public: Index: kernel/include/IMP/restraints/SingletonListRestraint.h =================================================================== --- kernel/include/IMP/restraints/SingletonListRestraint.h (revision 449) +++ kernel/include/IMP/restraints/SingletonListRestraint.h (working copy) @@ -28,10 +28,11 @@ { public: //! Create the list restraint. - /** \param[in] ps The list of particles to use in the restraint. - \param[in] ss The function to apply to each particle. + /** \param[in] ss The function to apply to each particle. + \param[in] ps The list of particles to use in the restraint. */ - SingletonListRestraint(const Particles &ps, SingletonScore *ss); + SingletonListRestraint(SingletonScore *ss, + const Particles &ps=Particles()); IMP_RESTRAINT(internal::kernel_version_info) Index: kernel/include/IMP/restraints/NonbondedRestraint.h =================================================================== --- kernel/include/IMP/restraints/NonbondedRestraint.h (revision 449) +++ kernel/include/IMP/restraints/NonbondedRestraint.h (working copy) @@ -30,13 +30,13 @@ { public: //! Create the nonbonded restraint. - /** \param[in] nbl The non-bonded list to use to get the list + /** \param[in] ps The pair score function to apply to the pairs. This + object is deleted upon destruction. + \param[in] nbl The non-bonded list to use to get the list of particles. - \param[in] ps The pair score function to apply to the pairs. This - object is deleted upon destruction. \param[in] max_dist Pairs beyond this distance may be dropped. */ - NonbondedRestraint(NonbondedListScoreState *nbl, PairScore *ps, + NonbondedRestraint(PairScore *ps, NonbondedListScoreState *nbl, Float max_dist= std::numeric_limits::max()); virtual ~NonbondedRestraint(){} Index: kernel/include/IMP/restraints/DihedralRestraint.h =================================================================== --- kernel/include/IMP/restraints/DihedralRestraint.h (revision 449) +++ kernel/include/IMP/restraints/DihedralRestraint.h (working copy) @@ -22,14 +22,14 @@ { public: //! Create the dihedral restraint. - /** \param[in] p1 Pointer to first particle in dihedral restraint. + /** \param[in] score_func Scoring function for the restraint. + \param[in] p1 Pointer to first particle in dihedral restraint. \param[in] p2 Pointer to second particle in dihedral restraint. \param[in] p3 Pointer to third particle in dihedral restraint. \param[in] p4 Pointer to fourth particle in dihedral restraint. - \param[in] score_func Scoring function for the restraint. */ - DihedralRestraint(Particle* p1, Particle* p2, Particle* p3, Particle *p4, - UnaryFunction* score_func); + DihedralRestraint( UnaryFunction* score_func, + Particle* p1, Particle* p2, Particle* p3, Particle *p4); virtual ~DihedralRestraint(); IMP_RESTRAINT(internal::kernel_version_info) Index: kernel/include/IMP/restraints/BondDecoratorRestraint.h =================================================================== --- kernel/include/IMP/restraints/BondDecoratorRestraint.h (revision 449) +++ kernel/include/IMP/restraints/BondDecoratorRestraint.h (working copy) @@ -36,11 +36,11 @@ { public: //! Create the bond restraint. - /** \param[in] bl The BondDecoratorListScoreState to use to get the list + /** \param[in] f The UnaryFunction to apply to the particles. + \param[in] bl The BondDecoratorListScoreState to use to get the list of bonds. - \param[in] f The UnaryFunction to apply to the particles. */ - BondDecoratorRestraint(BondDecoratorListScoreState *bl, UnaryFunction *f); + BondDecoratorRestraint(UnaryFunction *f, BondDecoratorListScoreState *bl); virtual ~BondDecoratorRestraint(){} IMP_RESTRAINT(internal::kernel_version_info) Index: kernel/include/IMP/restraints/AngleRestraint.h =================================================================== --- kernel/include/IMP/restraints/AngleRestraint.h (revision 449) +++ kernel/include/IMP/restraints/AngleRestraint.h (working copy) @@ -24,13 +24,13 @@ { public: //! Create the angle restraint. - /** \param[in] p1 Pointer to first particle in angle restraint. + /** \param[in] score_func Scoring function for the restraint. + \param[in] p1 Pointer to first particle in angle restraint. \param[in] p2 Pointer to second particle in angle restraint. \param[in] p3 Pointer to third particle in angle restraint. - \param[in] score_func Scoring function for the restraint. */ - AngleRestraint(Particle* p1, Particle* p2, Particle* p3, - UnaryFunction* score_func); + AngleRestraint(UnaryFunction* score_func, + Particle* p1, Particle* p2, Particle* p3); virtual ~AngleRestraint(){} IMP_RESTRAINT(internal::kernel_version_info) Index: kernel/include/IMP/restraints/PairListRestraint.h =================================================================== --- kernel/include/IMP/restraints/PairListRestraint.h (revision 449) +++ kernel/include/IMP/restraints/PairListRestraint.h (working copy) @@ -29,10 +29,10 @@ { public: //! Create the list restraint. - /** \param[in] ps The list of particle pairs to use in the restraint. - \param[in] ss The function to apply to each particle. + /** \param[in] ss The function to apply to each particle. + \param[in] ps The list of particle pairs to use in the restraints */ - PairListRestraint(const ParticlePairs &ps, PairScore *ss); + PairListRestraint(PairScore *ss, const ParticlePairs &ps=ParticlePairs()); virtual ~PairListRestraint(); IMP_RESTRAINT(internal::kernel_version_info) Index: kernel/include/IMP/restraints/DistanceRestraint.h =================================================================== --- kernel/include/IMP/restraints/DistanceRestraint.h (revision 449) +++ kernel/include/IMP/restraints/DistanceRestraint.h (working copy) @@ -29,12 +29,12 @@ { public: //! Create the distance restraint. - /** \param[in] p1 Pointer to first particle in distance restraint. + /** \param[in] score_func Scoring function for the restraint. + \param[in] p1 Pointer to first particle in distance restraint. \param[in] p2 Pointer to second particle in distance restraint. - \param[in] score_func Scoring function for the restraint. */ - DistanceRestraint(Particle* p1, Particle* p2, - UnaryFunction* score_func); + DistanceRestraint(UnaryFunction* score_func, + Particle* p1, Particle* p2); virtual ~DistanceRestraint() {} IMP_RESTRAINT(internal::kernel_version_info) Index: kernel/include/IMP/Restraint.h =================================================================== --- kernel/include/IMP/Restraint.h (revision 449) +++ kernel/include/IMP/Restraint.h (working copy) @@ -35,6 +35,12 @@ */ //! Abstract class for representing restraints +/** Restraints should take their score function or UnaryFunction + as the first argument. Restraints which act on large numbers of + particles should allow the particle list to be skipped in the + constructor and should provide methods so that the set of particles + can be modified after construction. + */ class IMPDLLEXPORT Restraint : public internal::Object { public: Index: kernel/include/IMP/decorators/XYZDecorator.h =================================================================== --- kernel/include/IMP/decorators/XYZDecorator.h (revision 449) +++ kernel/include/IMP/decorators/XYZDecorator.h (working copy) @@ -85,7 +85,7 @@ //! Get a vector containing the keys for x,y,z /** This is quite handy for initializing movers and things. */ - const FloatKeys get_xyz_keys() const { + static const FloatKeys get_xyz_keys() { decorator_initialize_static_data(); return key_; } Index: kernel/include/IMP/PairScore.h =================================================================== --- kernel/include/IMP/PairScore.h (revision 449) +++ kernel/include/IMP/PairScore.h (working copy) @@ -22,6 +22,9 @@ */ //! Abstract score function for a pair of particles. +/** PairScores should take a UnaryFunction as their first + argument if such is needed. +*/ class IMPDLLEXPORT PairScore : public internal::Object { public: Index: kernel/include/IMP/TripletScore.h =================================================================== --- kernel/include/IMP/TripletScore.h (revision 449) +++ kernel/include/IMP/TripletScore.h (working copy) @@ -23,6 +23,9 @@ */ //! Abstract score function for a triplet of particles. +/** TripletScores should take a UnaryFunction as their first + argument if such is needed. +*/ class IMPDLLEXPORT TripletScore : public internal::Object { public: Index: kernel/src/singleton_scores/AttributeSingletonScore.cpp =================================================================== --- kernel/src/singleton_scores/AttributeSingletonScore.cpp (revision 449) +++ kernel/src/singleton_scores/AttributeSingletonScore.cpp (working copy) @@ -12,9 +12,9 @@ namespace IMP { -AttributeSingletonScore::AttributeSingletonScore(FloatKey k, - UnaryFunction *f): f_(f), - k_(k){} +AttributeSingletonScore::AttributeSingletonScore(UnaryFunction *f, + FloatKey k): f_(f), + k_(k){} Float AttributeSingletonScore::evaluate(Particle *b, DerivativeAccumulator *da) Index: kernel/src/singleton_scores/DistanceToSingletonScore.cpp =================================================================== --- kernel/src/singleton_scores/DistanceToSingletonScore.cpp (revision 449) +++ kernel/src/singleton_scores/DistanceToSingletonScore.cpp (working copy) @@ -66,9 +66,9 @@ } // namespace internal -DistanceToSingletonScore::DistanceToSingletonScore(const Vector3D &v, - UnaryFunction *f): f_(f), - pt_(v){} +DistanceToSingletonScore::DistanceToSingletonScore(UnaryFunction *f, + const Vector3D &v): f_(f), + pt_(v){} Float DistanceToSingletonScore::evaluate(Particle *b, DerivativeAccumulator *da) Index: kernel/src/restraints/ProximityRestraint.cpp =================================================================== --- kernel/src/restraints/ProximityRestraint.cpp (revision 449) +++ kernel/src/restraints/ProximityRestraint.cpp (working copy) @@ -39,9 +39,8 @@ // create the restraint UnaryFunction *sf = score_func_params->create_score_func(); - dist_rsrs_[idx] = new DistanceRestraint(get_particle(i), - get_particle(j), - sf); + dist_rsrs_[idx] = new DistanceRestraint(sf, get_particle(i), + get_particle(j)); idx++; } } @@ -84,9 +83,8 @@ IMP_LOG(VERBOSE, i << " " << j << " add distance: " << actual_mean); score_func_params->set_mean(actual_mean); UnaryFunction *sf = score_func_params->create_score_func(); - dist_rsrs_[idx] = new DistanceRestraint(get_particle(i), - get_particle(j), - sf); + dist_rsrs_[idx] = new DistanceRestraint(sf, get_particle(i), + get_particle(j)); idx++; } } Index: kernel/src/restraints/NonbondedRestraint.cpp =================================================================== --- kernel/src/restraints/NonbondedRestraint.cpp (revision 449) +++ kernel/src/restraints/NonbondedRestraint.cpp (working copy) @@ -16,8 +16,8 @@ namespace IMP { -NonbondedRestraint::NonbondedRestraint(NonbondedListScoreState *nbl, - PairScore *ps, +NonbondedRestraint::NonbondedRestraint(PairScore *ps, + NonbondedListScoreState *nbl, Float md) : nbl_(nbl), sf_(ps), max_dist_(md) { Index: kernel/src/restraints/DihedralRestraint.cpp =================================================================== --- kernel/src/restraints/DihedralRestraint.cpp (revision 449) +++ kernel/src/restraints/DihedralRestraint.cpp (working copy) @@ -18,8 +18,9 @@ namespace IMP { -DihedralRestraint::DihedralRestraint(Particle* p1, Particle* p2, Particle* p3, - Particle* p4, UnaryFunction* score_func) +DihedralRestraint::DihedralRestraint(UnaryFunction* score_func, + Particle* p1, Particle* p2, Particle* p3, + Particle* p4) { add_particle(p1); add_particle(p2); Index: kernel/src/restraints/BondDecoratorRestraint.cpp =================================================================== --- kernel/src/restraints/BondDecoratorRestraint.cpp (revision 449) +++ kernel/src/restraints/BondDecoratorRestraint.cpp (working copy) @@ -15,9 +15,10 @@ namespace IMP { -BondDecoratorRestraint::BondDecoratorRestraint(BondDecoratorListScoreState *s, - UnaryFunction *f): bl_(s), - f_(f){} +BondDecoratorRestraint +::BondDecoratorRestraint(UnaryFunction *f, + BondDecoratorListScoreState *s): bl_(s), + f_(f){} Float BondDecoratorRestraint::evaluate(DerivativeAccumulator *accum) { Index: kernel/src/restraints/AngleRestraint.cpp =================================================================== --- kernel/src/restraints/AngleRestraint.cpp (revision 449) +++ kernel/src/restraints/AngleRestraint.cpp (working copy) @@ -11,8 +11,8 @@ namespace IMP { -AngleRestraint::AngleRestraint(Particle* p1, Particle* p2, Particle* p3, - UnaryFunction* score_func) + AngleRestraint::AngleRestraint(UnaryFunction* score_func, + Particle* p1, Particle* p2, Particle* p3) { add_particle(p1); add_particle(p2); Index: kernel/src/restraints/PairListRestraint.cpp =================================================================== --- kernel/src/restraints/PairListRestraint.cpp (revision 449) +++ kernel/src/restraints/PairListRestraint.cpp (working copy) @@ -15,8 +15,8 @@ namespace IMP { -PairListRestraint::PairListRestraint(const ParticlePairs &ps, - PairScore *s) : ss_(s) +PairListRestraint::PairListRestraint(PairScore *s, + const ParticlePairs &ps) : ss_(s) { add_particle_pairs(ps); } Index: kernel/src/restraints/PairConnectivityRestraint.cpp =================================================================== --- kernel/src/restraints/PairConnectivityRestraint.cpp (revision 449) +++ kernel/src/restraints/PairConnectivityRestraint.cpp (working copy) @@ -52,9 +52,8 @@ } else { IMP_LOG(VERBOSE, "Adding possible restraint: " << i << " " << j); UnaryFunction *sf = score_func_params->create_score_func(); - rs_iter->rsr_ = new DistanceRestraint(get_particle(i), - get_particle(j), - sf); + rs_iter->rsr_ = new DistanceRestraint(sf, get_particle(i), + get_particle(j)); rs_iter->part1_idx_ = i; rs_iter->part2_idx_ = j; @@ -116,9 +115,8 @@ } else { IMP_LOG(VERBOSE, "Adding possible restraint: " << i << " " << j); UnaryFunction *sf = score_func_params->create_score_func(); - rs_iter->rsr_ = new DistanceRestraint(get_particle(i), - get_particle(j), - sf); + rs_iter->rsr_ = new DistanceRestraint(sf, get_particle(i), + get_particle(j)); rs_iter->part1_idx_ = i; rs_iter->part2_idx_ = j; Index: kernel/src/restraints/DistanceRestraint.cpp =================================================================== --- kernel/src/restraints/DistanceRestraint.cpp (revision 449) +++ kernel/src/restraints/DistanceRestraint.cpp (working copy) @@ -17,8 +17,8 @@ namespace IMP { -DistanceRestraint::DistanceRestraint(Particle* p1, Particle* p2, - UnaryFunction* score_func) : +DistanceRestraint::DistanceRestraint(UnaryFunction* score_func, + Particle* p1, Particle* p2) : dp_(score_func) { add_particle(p1); Index: kernel/src/restraints/SingletonListRestraint.cpp =================================================================== --- kernel/src/restraints/SingletonListRestraint.cpp (revision 449) +++ kernel/src/restraints/SingletonListRestraint.cpp (working copy) @@ -15,8 +15,9 @@ namespace IMP { -SingletonListRestraint::SingletonListRestraint(const Particles &ps, - SingletonScore *s) : ss_(s) +SingletonListRestraint::SingletonListRestraint(SingletonScore *s, + const Particles &ps): + ss_(s) { add_particles(ps); } Index: kernel/src/restraints/ExclusionVolumeRestraint.cpp =================================================================== --- kernel/src/restraints/ExclusionVolumeRestraint.cpp (revision 449) +++ kernel/src/restraints/ExclusionVolumeRestraint.cpp (working copy) @@ -74,9 +74,8 @@ // create the restraint UnaryFunction *sf = score_func_params->create_score_func(); - dist_rsrs_.push_back(new DistanceRestraint(get_particle(i), - get_particle(j), - sf)); + dist_rsrs_.push_back(new DistanceRestraint(sf, get_particle(i), + get_particle(j))); } } } @@ -127,9 +126,8 @@ // create the restraint UnaryFunction *sf = score_func_params->create_score_func(); - dist_rsrs_.push_back(new DistanceRestraint(get_particle(i), - get_particle(j), - sf)); + dist_rsrs_.push_back(new DistanceRestraint(sf, get_particle(i), + get_particle(j))); idx++; } } Index: kernel/src/optimizers/MolecularDynamics.cpp =================================================================== --- kernel/src/optimizers/MolecularDynamics.cpp (revision 449) +++ kernel/src/optimizers/MolecularDynamics.cpp (working copy) @@ -135,7 +135,9 @@ ekinetic += mass * (vx * vx + vy * vy + vz * vz); } - return 0.5 * ekinetic * conversion; + + float ret= 0.5 * ekinetic * conversion; + return ret; } Float MolecularDynamics::get_kinetic_temperature(Float ekinetic) const @@ -146,7 +148,8 @@ // E = (n/2)kT n=degrees of freedom, k = Boltzmann constant // Boltzmann constant, in kcal/mol const Float boltzmann = 8.31441 / 4186.8; - return 2.0 * ekinetic / (degrees_of_freedom_ * boltzmann); + float ret= 2.0 * ekinetic / (degrees_of_freedom_ * boltzmann); + return ret; } } Index: kernel/pyext/IMP/utils.py =================================================================== --- kernel/pyext/IMP/utils.py (revision 449) +++ kernel/pyext/IMP/utils.py (working copy) @@ -87,8 +87,7 @@ mean = particles[i].get_value(radius_name) \ + particles[j].get_value(radius_name) sf = IMP.HarmonicLowerBound(mean, sd) - rsrs.append(IMP.DistanceRestraint(particles[i], particles[j], - sf)) + rsrs.append(IMP.DistanceRestraint(sf, particles[i], particles[j])) def write_pdb(model, fname): Index: kernel/pyext/IMP/modeller_intf.py =================================================================== --- kernel/pyext/IMP/modeller_intf.py (revision 449) +++ kernel/pyext/IMP/modeller_intf.py (working copy) @@ -246,18 +246,18 @@ # Generators to make IMP Restraint objects from Modeller features def _DistanceRestraintGenerator(form, modalities, atoms, parameters): unary_func_gen = _unary_func_generators[form] - return IMP.DistanceRestraint(atoms[0], atoms[1], - unary_func_gen(parameters, modalities)) + return IMP.DistanceRestraint(unary_func_gen(parameters, modalities), + atoms[0], atoms[1]) def _AngleRestraintGenerator(form, modalities, atoms, parameters): unary_func_gen = _unary_func_generators[form] - return IMP.AngleRestraint(atoms[0], atoms[1], atoms[2], - unary_func_gen(parameters, modalities)) + return IMP.AngleRestraint(unary_func_gen(parameters, modalities), + atoms[0], atoms[1], atoms[2]) def _DihedralRestraintGenerator(form, modalities, atoms, parameters): unary_func_gen = _unary_func_generators[form] - return IMP.DihedralRestraint(atoms[0], atoms[1], atoms[2], atoms[3], - unary_func_gen(parameters, modalities)) + return IMP.DihedralRestraint(unary_func_gen(parameters, modalities), + atoms[0], atoms[1], atoms[2], atoms[3]) def _get_protein_atom_particles(protein): """Given a protein particle, get the flattened list of all child atoms""" Index: kernel/pyext/IMP/xml_loader.py =================================================================== --- kernel/pyext/IMP/xml_loader.py (revision 449) +++ kernel/pyext/IMP/xml_loader.py (working copy) @@ -200,7 +200,7 @@ score_func_params = get_basic_score_func_params(score_func_str, distance, sd) sf = score_func_params.create_score_func() - model.restraints.append(IMP.DistanceRestraint(p1, p2, sf)) + model.restraints.append(IMP.DistanceRestraint(sf, p1, p2)) model.restraint_sets[rs_idx].add_restraint(model.restraints[-1]) Index: kernel/pyext/IMP.i =================================================================== --- kernel/pyext/IMP.i (revision 449) +++ kernel/pyext/IMP.i (working copy) @@ -33,28 +33,28 @@ args[1].thisown=0 %} %pythonprepend DistanceRestraint::DistanceRestraint %{ - args[2].thisown=0 + args[0].thisown=0 %} %pythonprepend AngleRestraint::AngleRestraint %{ - args[3].thisown=0 + args[0].thisown=0 %} %pythonprepend DihedralRestraint::DihedralRestraint %{ - args[4].thisown=0 + args[0].thisown=0 %} %pythonprepend TorusRestraint::TorusRestraint %{ args[3].thisown=0 %} %pythonprepend NonbondedRestraint::NonbondedRestraint %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend BondDecoratorRestraint::BondDecoratorRestraint %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend SingletonListRestraint::SingletonListRestraint %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend PairListRestraint::PairListRestraint %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend TripletChainRestraint::TripletChainRestraint %{ args[0].thisown=0 @@ -63,16 +63,16 @@ args[0].thisown=0 %} %pythonprepend DistancePairScore::DistancePairScore %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend SphereDistancePairScore::SphereDistancePairScore %{ args[0].thisown=0 %} %pythonprepend DistanceToSingletonScore::DistanceToSingletonScore %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend AttributeSingletonScore::AttributeSingletonScore %{ - args[1].thisown=0 + args[0].thisown=0 %} %pythonprepend AngleTripletScore::AngleTripletScore %{ args[0].thisown=0