def phi(i, j, k): mol = Molecule([ Atom('H', args[i - 1]), Atom('H', args[j - 1]), Atom('H', args[k - 1]) ]) return BondAngle(mol[0], mol[1], mol[2])
def test_misc(self): # getitem self.assertEqual(Molecule.from_z_matrix("O")[0].symbol, "O") # contains mol = Molecule.from_z_matrix("O") self.assertIn(mol[0], mol) self.assertNotIn(Atom("H", 0, 0, 0), mol) # less than self.assertLess(mol, Molecule("O 0.0 0.0 1.0"))
def test_zmat(self): self.assertEqual( Molecule([Atom("O", [0.0, 0.0, 0.0])]), Molecule.from_z_matrix(""" O """)) self.assertEqual( Molecule([Atom("O", [0.0, 0.0, 0.0]), Atom("O", [0.0, 0.0, 1.0])]), Molecule.from_z_matrix(""" O1 O2 O1 1.0 """)) self.assertEqual( Molecule([ Atom("O", [0.0, 0.0, 0.0]), Atom("H", [0.0, 0.0, 1.0]), Atom("H", [0.0, -1.0, 0.0]) ]), Molecule.from_z_matrix(""" O H1 O 1.0 H2 O 1.0 H1 90 """))
def R(i, j): # This is ugly... # TODO figure out a better way to do this mol = Molecule([Atom('H', args[i - 1]), Atom('H', args[j - 1])]) return BondLength(mol[0], mol[1])
def test_init(self): self.assertEqual(Molecule("H 1 -1 0"), Molecule([Atom('H', [1, -1, 0])]))
def test_groups_1(self): m = Molecule([ Atom('C', [0.00000000, 0.00000000, 0.00000000]), Atom('C', [0.00000000, 0.00000000, 4.76992933]), Atom('O', [0.00000000, -1.04316184, 0.61707065]), Atom('O', [0.01905095, 1.04298787, 4.15285868]), Atom('C', [-0.11039651, 1.34908096, 0.68132447]), Atom('C', [-0.13501595, -1.34683982, 4.08860486]), Atom('C', [0.10780157, 0.01502933, -1.51597276]), Atom('C', [0.10750912, -0.01699557, 6.28590209]), Atom('H', [-0.08557151, 1.24276213, 1.76717696]), Atom('H', [-0.10825342, -1.24099210, 3.00275237]), Atom('H', [0.69789248, 2.01081145, 0.34934100]), Atom('H', [0.66105324, -2.02322149, 4.42058833]), Atom('H', [-1.04824273, 1.83250625, 0.38051647]), Atom('H', [-1.08153441, -1.81305690, 4.38941286]), Atom('H', [0.11566492, -1.00528185, -1.90094854]), Atom('H', [0.13400478, 1.00300183, 6.67087787]), Atom('H', [-0.72590461, 0.57377279, -1.95554705]), Atom('H', [-0.73626218, -0.56042012, 6.72547638]), Atom('H', [1.02679855, 0.52908924, -1.82068069]), Atom('H', [1.01696471, -0.54775311, 6.59061002]) ], units=Angstroms) groups = m.geometric_subgroups() self.assertEqual(len(groups), 2)
def test_errors_15(self): # Stupid things to do to _init_atom_list self.assertRaises(TypeError, Molecule, [Atom("O", 1.0, 1.0, 1.0), [7.5, 5.0, 3.5]])