def test_dihedral_add(self): """Test add normal dihedral.""" with path("saddle.test.data", "2h-azirine.xyz") as mol_path: mol = Utils.load_file(mol_path) # create a water molecule internal = Internal(mol.coordinates, mol.numbers, 0, 1) internal.add_bond(0, 1) internal.add_bond(1, 2) internal.add_bond(1, 3) # fake add dihed internal.add_dihedral(0, 2, 3, 4) assert len(internal.ic) == 3 internal.add_dihedral(0, 1, 2, 3) assert len(internal.ic) == 4 assert internal.ic_values[3] == dihed_angle(internal.coordinates[:4])
def test_dihedral_repeak(self): with path("saddle.test.data", "h2o2.xyz") as mol_path: mol = Utils.load_file(mol_path) h2o2 = Internal(mol.coordinates, mol.numbers, 0, 1) h2o2.add_bond(0, 1) h2o2.add_bond(1, 2) h2o2.add_bond(2, 3) h2o2.add_bond(3, 2) h2o2.add_bond(0, 2) h2o2.add_bond(1, 3) assert len(h2o2.ic) == 5 h2o2.add_dihedral(0, 1, 2, 3) assert len(h2o2.ic) == 6 h2o2.add_dihedral(0, 2, 1, 3) assert len(h2o2.ic) == 6
def test_new_dihed(self): with path("saddle.test.data", "h2o2.xyz") as mol_path: mol = Utils.load_file(mol_path) h2o2 = Internal(mol.coordinates, mol.numbers, 0, 1) h2o2.add_bond(0, 1) h2o2.add_bond(1, 2) h2o2.add_bond(2, 3) assert len(h2o2.ic) == 3 h2o2.add_dihedral(0, 1, 2, 3, special=True) assert len(h2o2.ic) == 5 assert h2o2.b_matrix.shape == (5, 12) h2o2.add_dihedral(3, 1, 2, 0) assert len(h2o2.ic) == 5 h2o2.add_dihedral(3, 2, 1, 0, special=True) assert len(h2o2.ic) == 5 ref_b = h2o2.b_matrix.copy() h2o2._regenerate_ic() assert_allclose(h2o2.b_matrix, ref_b)