class GaussianMPATest(bettertest.TestCase): """Mulliken Population Analysis test""" def setUp(self): self.data, self.logfile = getfile(Gaussian, "basicGaussian03", "dvb_sp.out") self.analysis = MPA(self.data) self.analysis.logger.setLevel(0) self.analysis.calculate() def testsum(self): """Do the Mulliken charges sum up to the total formal charge?""" formalcharge = sum(self.data.atomnos) - self.data.charge totalpopulation = sum(self.analysis.fragcharges) self.assertInside(totalpopulation, formalcharge, 0.001)
class GaussianMPATest(bettertest.TestCase): """Mulliken Population Analysis test""" def setUp(self): self.data, self.logfile = getfile(Gaussian, "basicGaussian03", "dvb_sp.out") self.analysis = MPA(self.data) self.analysis.logger.setLevel(0) self.analysis.calculate() def testsum(self): """Do the Mulliken charges sum up to the total formal charge?""" formalcharge = sum(self.data.atomnos) - self.data.charge totalpopulation = sum(self.analysis.fragcharges) self.assertInside(totalpopulation, formalcharge, 0.001)
class GaussianMPATest(unittest.TestCase): """Mulliken Population Analysis test""" def setUp(self): self.data, self.logfile = getdatafile(Gaussian, "basicGaussian03", ["dvb_un_sp.out"]) self.analysis = MPA(self.data) self.analysis.logger.setLevel(0) self.analysis.calculate() def testsumcharges(self): """Do the Mulliken charges sum up to the total formal charge?""" formalcharge = sum(self.data.atomnos) - self.data.charge totalpopulation = sum(self.analysis.fragcharges) self.assertAlmostEqual(totalpopulation, formalcharge, delta=1.0e-3) def testsumspins(self): """Do the Mulliken spins sum up to the total formal spin?""" formalspin = self.data.homos[0] - self.data.homos[1] totalspin = sum(self.analysis.fragspins) self.assertAlmostEqual(totalspin, formalspin, delta=1.0e-3)
class GaussianMPATest(unittest.TestCase): """Mulliken Population Analysis test""" def setUp(self): self.data, self.logfile = getdatafile(Gaussian, "basicGaussian03", ["dvb_un_sp.out"]) self.analysis = MPA(self.data) self.analysis.logger.setLevel(0) self.analysis.calculate() def testsumcharges(self): """Do the Mulliken charges sum up to the total formal charge?""" formalcharge = sum(self.data.atomnos) - self.data.charge totalpopulation = sum(self.analysis.fragcharges) self.assertAlmostEqual(totalpopulation, formalcharge, delta=1.0e-3) def testsumspins(self): """Do the Mulliken spins sum up to the total formal spin?""" formalspin = self.data.homos[0] - self.data.homos[1] totalspin = sum(self.analysis.fragspins) self.assertAlmostEqual(totalspin, formalspin, delta=1.0e-3)