def setUp(self): self.orb1 = MOrbital() self.orb1_dup = MOrbital() self.aoc1 = AO_Contrib(1, 'Mn', 'px', 0.3) self.aoc1_dup = AO_Contrib(1, 'Mn', 'px', 0.3) self.aoc2 = AO_Contrib(2, 'O', 'f-1', 0.5) self.aoc3 = AO_Contrib(2, 'O', 'f+2', 0.2) self.orb2 = MOrbital(1, None, -0.34, 1.00, [self.aoc1, self.aoc2, self.aoc3]) self.orb3 = MOrbital(1, None, -0.14, 0.50, [self.aoc2, self.aoc1, self.aoc3])
def test_read_write(self): op = OP('H2O.dat') ao_contrib = AO_Contrib(1, 'O', 'px', 100.0) self.assertEqual(op.orb_list[4].contributions[0], ao_contrib) c1 = AO_Contrib(0, 'H', 's', 19.6) c2 = AO_Contrib(1, 'O', 'pz', 30.4) c3 = AO_Contrib(1, 'O', 'py', 30.4) c4 = AO_Contrib(2, 'H', 's', 19.6) contributions = [c1, c2, c3, c4] mo = MOrbital(2, None, -0.49905, 2, contributions) self.assertEqual(op[2], mo) op.write('tmp.csv', 'csv') op_dup = OP('tmp.csv') self.assertEqual(op, op_dup) os.remove('tmp.csv') # Test UKS open shell op = OP('H2O+.dat') ao_contrib = AO_Contrib(1, 'O', 'px', 100.0, 1) self.assertEqual(op.orb_list[3].contributions[0], ao_contrib)
def test_sub(self): # A - A = O contribution aoc0 = AO_Contrib(1, 'Mn', 'px', 0.0) self.assertEqual(self.aoc1 - self.aoc1_dup, aoc0) aoc_1_2 = AO_Contrib(0, '', '', -0.2) self.assertEqual(self.aoc1 - self.aoc2, aoc_1_2)
def setUp(self): self.aoc1 = AO_Contrib(1, 'Mn', 'px', 0.3) self.aoc1_dup = AO_Contrib(1, 'Mn', 'px', 0.3) self.aoc2 = AO_Contrib(2, 'O', 'f-1', 0.5) self.aoc3 = AO_Contrib(2, 'O', 'f+2', 0.2)