def testProperties(self): lj = LennardJones() lj.epsilon = 2.0 lj.sigma = 2.0 lj.cutoff = 4.0 lj.shift = 0.0 # here we test energy computation, as testing property access # would always work self.assertAlmostEqual(lj.computeEnergy(2.0), 0.0) self.assertAlmostEqual(lj.computeEnergy(2.0 * 2.0**(1.0 / 6.0)), -2.0)
def testEnergy(self): lj = LennardJones(epsilon=2.0, sigma=2.0) # root self.assertAlmostEqual(lj.computeEnergy(2.0), 0.0) self.assertAlmostEqual(lj.computeEnergy(2.0, 0.0, 0.0), 0.0) # minimum self.assertAlmostEqual(lj.computeEnergy(2.0 * 2.0**(1.0 / 6.0)), -2.0) self.assertAlmostEqual( lj.computeEnergy(0.0, 2.0 * 2.0**(1.0 / 6.0), 0.0), -2.0)