def test_energeticModes(self):
     emodes = NormalModes.EnergeticModes(self.universe)
     fc = emodes.force_constants[6:]
     self.assertAlmostEqual(fc[0], 757849.3957485439, 5)
     self.assertAlmostEqual(fc[1], 1041551.2240706938, 5)
     self.assertAlmostEqual(fc[2], 1388251.2, 5)
     for i in range(len(emodes)):
         mi = emodes.rawMode(i)
         norm_sq = mi.dotProduct(mi)
         self.assertAlmostEqual(norm_sq, 1.)
         for j in range(i + 1, len(emodes)):
             overlap = mi.dotProduct(emodes.rawMode(j))
             self.assert_(overlap < 1.e-15)
     self.assertAlmostEqual(emodes[6].norm(), 0.0025656740328985168)
     self.assertAlmostEqual(emodes[7].norm(), 0.0021885627126988836)
     self.assertAlmostEqual(emodes[8].norm(), 0.0018956532696964624)
     f = emodes.fluctuations()
     self.assertAlmostEqual(f[self.universe.water.O], 3.359215370401356e-06)
     self.assertAlmostEqual(f[self.universe.water.H1],
                            2.061890142153454e-06)
     self.assertAlmostEqual(f[self.universe.water.H2],
                            2.061890142153454e-06)
     af = emodes.anisotropicFluctuations()
     self.assertAlmostEqual(f[self.universe.water.O],
                            af[self.universe.water.O].trace())
     self.assertAlmostEqual(f[self.universe.water.H1],
                            af[self.universe.water.H1].trace())
     self.assertAlmostEqual(f[self.universe.water.H2],
                            af[self.universe.water.H2].trace())
 def setUp(self):
     self.universe = MMTK.InfiniteUniverse(HarmonicForceField())
     self.universe.peptide = Protein('bala1')
     self.emodes = NormalModes.EnergeticModes(self.universe)
     self.rm = RigidMotionSubspace(self.universe,
                                   self.universe.peptide.residues())
     self.pd = PairDistanceSubspace(self.universe, [
         (self.universe.peptide[0][0].O, self.universe.peptide[0][-1].CH3)
     ])
Example #3
0
 def test_normal_modes(self):
     emodes = NormalModes.EnergeticModes(self.universe)
     MMTK.save(emodes, 'test.pickle')
     restored_modes = MMTK.load('test.pickle')
     for i in range(len(emodes)):
         self.assertEqual(emodes[i].force_constant,
                          restored_modes[i].force_constant)
         err = N.minimum.reduce(
             N.fabs(N.ravel(emodes[i].array - restored_modes[i].array)))
         self.assert_(err < 1.e-15)