Index: kernel/test/states/test_nonbonded_list.py
===================================================================
--- kernel/test/states/test_nonbonded_list.py	(revision 467)
+++ kernel/test/states/test_nonbonded_list.py	(working copy)
@@ -119,6 +119,8 @@
         self.assertEqual(score, 25, "Wrong score")
     def test_spheres2(self):
         """Test the nonbonded list of spheres (num pairs)"""
+        # This uses the internal checks of the nonbonded list to
+        # verify correctness
         m= IMP.Model()
         rk= IMP.FloatKey("radius")
         for i in range(0,100):
Index: kernel/test/unary_functions/test_harmonic.py
===================================================================
--- kernel/test/unary_functions/test_harmonic.py	(revision 467)
+++ kernel/test/unary_functions/test_harmonic.py	(working copy)
@@ -9,11 +9,11 @@
         """Test Harmonic accessors"""
         func = IMP.Harmonic(10.0, 1.0)
         self.assertEqual(func.get_mean(), 10.0)
-        self.assertEqual(func.get_sd(), 1.0)
+        self.assertEqual(func.get_k(), 1.0)
         func.set_mean(5.0)
-        func.set_sd(2.0)
+        func.set_k(2.0)
         self.assertEqual(func.get_mean(), 5.0)
-        self.assertEqual(func.get_sd(), 2.0)
+        self.assertEqual(func.get_k(), 2.0)
 
     def test_show(self):
         """Check Harmonic::show() method"""
Index: kernel/test/restraints/test_dihedral.py
===================================================================
--- kernel/test/restraints/test_dihedral.py	(revision 467)
+++ kernel/test/restraints/test_dihedral.py	(working copy)
@@ -18,16 +18,17 @@
         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(IMP.Harmonic(1.0, 0.1),
+        k = IMP.Harmonic.k_from_standard_deviation(.1)
+        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, k),
                                   particles[0], particles[1])
         model.add_restraint(r)
-        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1),
+        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, k),
                                   particles[1], particles[2])
         model.add_restraint(r)
-        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1),
+        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, k),
                                   particles[2], particles[3])
         model.add_restraint(r)
-        rsr = IMP.DihedralRestraint(IMP.Harmonic(scored_angle, 0.1),
+        rsr = IMP.DihedralRestraint(IMP.Harmonic(scored_angle, k),
                                     particles[0], particles[1], particles[2],
                                     particles[3])
         model.add_restraint(rsr)
Index: kernel/test/restraints/test_angle.py
===================================================================
--- kernel/test/restraints/test_angle.py	(revision 467)
+++ kernel/test/restraints/test_angle.py	(working copy)
@@ -17,11 +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(IMP.Harmonic(1.0, 0.1),particles[0], particles[1])
+        k = IMP.Harmonic.k_from_standard_deviation(0.1)
+        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, k),particles[0], particles[1])
         model.add_restraint(r)
-        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, 0.1), particles[1], particles[2])
+        r = IMP.DistanceRestraint(IMP.Harmonic(1.0, k), particles[1], particles[2])
         model.add_restraint(r)
-        rsr = IMP.AngleRestraint(IMP.Harmonic(scored_angle, 0.1),
+        rsr = IMP.AngleRestraint(IMP.Harmonic(scored_angle, k),
                                  particles[0], particles[1], particles[2])
         model.add_restraint(rsr)
         return model, rsr
@@ -36,7 +37,7 @@
             self.assert_(model.evaluate(False) < 1e-6)
             # When the angle is different, score should be far from zero:
             model, rsr = self._setup_particles(angles[i], angles[-i-1])
-            self.assert_(model.evaluate(False) > 10.0)
+            self.assert_(model.evaluate(False) > 2.0)
             # Optimizing should reduce the score to zero:
             opt = IMP.ConjugateGradients()
             opt.set_model(model)
Index: kernel/include/IMP/unary_functions/Harmonic.h
===================================================================
--- kernel/include/IMP/unary_functions/Harmonic.h	(revision 467)
+++ kernel/include/IMP/unary_functions/Harmonic.h	(working copy)
@@ -23,7 +23,7 @@
 class IMPDLLEXPORT Harmonic : public UnaryFunction
 {
 public:
-  Harmonic(Float mean, Float sd) : mean_(mean), sd_(sd) {}
+  Harmonic(Float mean, Float k) : mean_(mean), k_(k) {}
 
   virtual ~Harmonic() {}
 
@@ -32,9 +32,9 @@
     return mean_;
   }
 
-  //! \return the standard deviation of this function
-  Float get_sd() const {
-    return sd_;
+  //! \return the spring constant
+  Float get_k() const {
+    return k_;
   }
 
   //! Set the mean of this function
@@ -42,16 +42,19 @@
     mean_ = mean;
   }
 
-  //! Set the standard deviation of this function
-  void set_sd(Float sd) {
-    sd_ = sd;
+  //! Set the spring constant
+  void set_k(Float k) {
+    k_ = k;
   }
 
   //! Calculate harmonic score with respect to the given feature.
   /** \param[in] feature Value of feature being tested.
       \return Score
    */
-  virtual Float operator()(Float feature);
+  virtual Float operator()(Float feature) {
+    Float d;
+    return operator()(feature, d);
+  }
 
   //! Calculate harmonic score and derivative with respect to the given feature.
   /** \param[in] feature Value of feature being tested.
@@ -59,15 +62,28 @@
                         the feature value.
       \return Score
    */
-  virtual Float operator()(Float feature, Float& deriv);
+  virtual Float operator()(Float feature, Float& deriv) {
+    Float e = (feature - mean_);
+    deriv = k_*e / 2.0;
+    return k_*e * e;
+  }
 
   void show(std::ostream &out=std::cout) const {
-    out << "Harmonic: " << mean_ << " and " << sd_ << std::endl;
+    out << "Harmonic: " << mean_ << " and " << k_ << std::endl;
   }
 
-protected:
+  //! Return the k to use for a given modeller standard deviation
+  /** See the Modeller paper for an explaination.
+      Convert standard deviation to force constant, by dividing it 
+      by sqrt(RT/2) where T=297.15K and energy units are kcal/mol.
+   */
+  static Float k_from_standard_deviation(Float sd, Float t=297.15) {
+    return (8.3145*0.0002388459*t/2) / square(sd);
+  }
+
+private:
   Float mean_;
-  Float sd_;
+  Float k_;
 };
 
 } // namespace IMP
Index: kernel/include/IMP/unary_functions/HarmonicLowerBound.h
===================================================================
--- kernel/include/IMP/unary_functions/HarmonicLowerBound.h	(revision 467)
+++ kernel/include/IMP/unary_functions/HarmonicLowerBound.h	(working copy)
@@ -18,7 +18,7 @@
 class IMPDLLEXPORT HarmonicLowerBound : public Harmonic
 {
 public:
-  HarmonicLowerBound(Float mean, Float sd) : Harmonic(mean, sd) {}
+  HarmonicLowerBound(Float mean, Float k) : Harmonic(mean, k) {}
   virtual ~HarmonicLowerBound() {}
 
   //! Calculate lower-bound harmonic score with respect to the given feature.
@@ -26,7 +26,13 @@
       \param[in] feature Value of feature being tested.
       \return Score
   */
-  virtual Float operator()(Float feature);
+  virtual Float operator()(Float feature) {
+    if (feature >= Harmonic::get_mean()) {
+      return 0.0;
+    } else {
+      return Harmonic::operator()(feature);
+    }
+  }
 
   //! Calculate lower-bound harmonic score and derivative for a feature.
   /** If the feature is greater than or equal to the mean, the score is zero.
@@ -35,10 +41,18 @@
                         the feature value.
       \return Score
    */
-  virtual Float operator()(Float feature, Float& deriv);
+  virtual Float operator()(Float feature, Float& deriv) {
+    if (feature >= Harmonic::get_mean()) {
+      deriv = 0.0;
+      return 0.0;
+    } else {
+      return Harmonic::operator()(feature, deriv);
+    }
+  }
 
   void show(std::ostream &out=std::cout) const {
-    out << "HarmonicLB: " << mean_ << " and " << sd_ << std::endl;
+    out << "HarmonicLB: " << Harmonic::get_mean() 
+        << " and " << Harmonic::get_k() << std::endl;
   }
 };
 
Index: kernel/include/IMP/unary_functions/SConscript
===================================================================
--- kernel/include/IMP/unary_functions/SConscript	(revision 467)
+++ kernel/include/IMP/unary_functions/SConscript	(working copy)
@@ -1,10 +1,13 @@
+Import('env')
 import os.path
-Import('env')
-
-files = ['Harmonic.h', 'HarmonicLowerBound.h', 'HarmonicUpperBound.h',
-         'OpenCubicSpline.h', 'ClosedCubicSpline.h', 'Cosine.h', 'Linear.h']
-
-# Install the include files:
-includedir = os.path.join(env['includedir'], 'IMP', 'unary_functions')
+files=[]
+files.append( 'ClosedCubicSpline.h' )
+files.append( 'Cosine.h' )
+files.append( 'Harmonic.h' )
+files.append( 'HarmonicLowerBound.h' )
+files.append( 'HarmonicUpperBound.h' )
+files.append( 'Linear.h' )
+files.append( 'OpenCubicSpline.h' )
+includedir = os.path.join(env['includedir'], 'IMP', 'unary_functions' )
 inst = env.Install(includedir, files)
 env.Alias('install', inst)
Index: kernel/include/IMP/unary_functions/HarmonicUpperBound.h
===================================================================
--- kernel/include/IMP/unary_functions/HarmonicUpperBound.h	(revision 467)
+++ kernel/include/IMP/unary_functions/HarmonicUpperBound.h	(working copy)
@@ -26,7 +26,13 @@
       \param[in] feature Value of feature being tested.
       \return Score
    */
-  virtual Float operator()(Float feature);
+  virtual Float operator()(Float feature) {
+    if (feature <= Harmonic::get_mean()) {
+      return 0.0;
+    } else {
+      return Harmonic::operator()(feature);
+    }
+  }
 
   //! Calculate upper-bound harmonic score and derivative for a feature.
   /** If the feature is less than or equal to the mean, the score is zero.
@@ -35,10 +41,18 @@
                         the feature value.
       \return Score
    */
-  virtual Float operator()(Float feature, Float& deriv);
+  virtual Float operator()(Float feature, Float& deriv) {
+    if (feature <= Harmonic::get_mean()) {
+      deriv = 0.0;
+      return 0.0;
+    } else {
+      return Harmonic::operator()(feature, deriv);
+    }
+  }
 
   void show(std::ostream &out=std::cout) const {
-    out << "HarmonicLUB: " << mean_ << " and " << sd_ << std::endl;
+    out << "HarmonicLUB: " << Harmonic::get_mean() 
+        << " and " << Harmonic::get_k() << std::endl;
   }
 };
 
Index: kernel/src/unary_functions/Harmonic.cpp
===================================================================
--- kernel/src/unary_functions/Harmonic.cpp	(revision 467)
+++ kernel/src/unary_functions/Harmonic.cpp	(working copy)
@@ -1,44 +0,0 @@
-/**
- *  \file Harmonic.cpp  \brief Harmonic function.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#include "IMP/unary_functions/Harmonic.h"
-#include "IMP/log.h"
-
-namespace IMP
-{
-
-//! Calculate harmonic score with respect to the given feature.
-/** \param[in] feature Value of feature being tested.
-    \return Score
- */
-Float Harmonic::operator()(Float feature)
-{
-  Float dummy;
-
-  return operator()(feature, dummy);
-}
-
-//! Calculate harmonic score and derivative with respect to the given feature.
-/** \param[in] feature Value of feature being tested.
-    \param[out] deriv Partial derivative of the score with respect to
-                      the feature value.
-    \return Score
- */
-Float Harmonic::operator()(Float feature, Float& deriv)
-{
-  Float e;
-  Float sd;
-
-  // convert standard deviation to force constant, by dividing by sqrt(RT/2)
-  // where T=297.15K and energy units are kcal/mol
-  sd = sd_ / 0.54318464;
-  e = (feature - mean_) / sd;
-  deriv = e / sd * 2.0;
-  return e * e;
-}
-
-}  // namespace IMP
Index: kernel/src/unary_functions/HarmonicLowerBound.cpp
===================================================================
--- kernel/src/unary_functions/HarmonicLowerBound.cpp	(revision 467)
+++ kernel/src/unary_functions/HarmonicLowerBound.cpp	(working copy)
@@ -1,46 +0,0 @@
-/**
- *  \file HarmonicLowerBound.cpp  \brief Harmonic lower bound function.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#include "IMP/unary_functions/HarmonicLowerBound.h"
-#include "IMP/log.h"
-
-namespace IMP
-{
-
-//! Calculate lower-bound harmonic score with respect to the given feature.
-/** If the feature is greater than or equal to the mean, the score is zero.
-    \param[in] feature Value of feature being tested.
-    \return Score
- */
-Float HarmonicLowerBound::operator()(Float feature)
-{
-  if (feature >= mean_) {
-    return 0.0;
-  } else {
-    return Harmonic::operator()(feature);
-  }
-}
-
-
-//! Calculate lower-bound harmonic score and derivative for a feature.
-/** If the feature is greater than or equal to the mean, the score is zero.
-    \param[in] feature Value of feature being tested.
-    \param[out] deriv Partial derivative of the score with respect to
-                      the feature value.
-    \return Score
- */
-Float HarmonicLowerBound::operator()(Float feature, Float& deriv)
-{
-  if (feature >= mean_) {
-    deriv = 0.0;
-    return 0.0;
-  } else {
-    return Harmonic::operator()(feature, deriv);
-  }
-}
-
-}  // namespace IMP
Index: kernel/src/unary_functions/HarmonicUpperBound.cpp
===================================================================
--- kernel/src/unary_functions/HarmonicUpperBound.cpp	(revision 467)
+++ kernel/src/unary_functions/HarmonicUpperBound.cpp	(working copy)
@@ -1,46 +0,0 @@
-/**
- *  \file HarmonicUpperBound.cpp  \brief Harmonic upper bound function.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#include "IMP/unary_functions/HarmonicUpperBound.h"
-#include "IMP/log.h"
-
-namespace IMP
-{
-
-//! Calculate upper-bound harmonic score with respect to the given feature.
-/** If the feature is less than or equal to the mean, the score is zero.
-    \param[in] feature Value of feature being tested.
-    \return Score
- */
-Float HarmonicUpperBound::operator()(Float feature)
-{
-  if (feature <= mean_) {
-    return 0.0;
-  } else {
-    return Harmonic::operator()(feature);
-  }
-}
-
-
-//! Calculate upper-bound harmonic score and derivative for a feature.
-/** If the feature is less than or equal to the mean, the score is zero.
-    \param[in] feature Value of feature being tested.
-    \param[out] deriv Partial derivative of the score with respect to
-                      the feature value.
-    \return Score
- */
-Float HarmonicUpperBound::operator()(Float feature, Float& deriv)
-{
-  if (feature <= mean_) {
-    deriv = 0.0;
-    return 0.0;
-  } else {
-    return Harmonic::operator()(feature, deriv);
-  }
-}
-
-}  // namespace IMP
Index: kernel/src/unary_functions/SConscript
===================================================================
--- kernel/src/unary_functions/SConscript	(revision 467)
+++ kernel/src/unary_functions/SConscript	(working copy)
@@ -1,7 +1,6 @@
 Import('env')
-
-files = ['Harmonic.cpp', 'HarmonicLowerBound.cpp', 'HarmonicUpperBound.cpp',
-         'OpenCubicSpline.cpp', 'ClosedCubicSpline.cpp', 'Cosine.cpp']
-
-files = [File(x) for x in files]
+files=[]
+files.append(File( 'ClosedCubicSpline.cpp' ))
+files.append(File( 'Cosine.cpp' ))
+files.append(File( 'OpenCubicSpline.cpp' ))
 Return('files')