Skip to content

Commit

Permalink
Tests: add_atom_to_zmat_with_arbitrary_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Dec 30, 2024
1 parent 3d12c48 commit 1287947
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions arc/species/zmat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1815,5 +1815,46 @@ def test_map_index_to_int(self):
with self.assertRaises(TypeError):
zmat.map_index_to_int('XY5486')

def test_add_atom_to_zmat_with_arbitrary_parameters(self):
"""Test the add_atom_to_zmat_with_arbitrary_parameters() function."""
z = {'symbols': ('N', 'N', 'H', 'H'),
'coords': ((None, None, None),
('R_1_0', None, None),
('R_2_1', 'A_2_1_0', None),
('R_3_2', 'A_3_2_0', 'D_3_2_0_1')),
'vars': {'R_1_0': 1.453439904003661, 'R_2_1': 1.0201432886642632, 'A_2_1_0': 121.26532344550412,
'R_3_2': 1.7439821177668233, 'A_3_2_0': 66.26220791342335, 'D_3_2_0_1': 359.99999758516344},
'map': {0: 0, 1: 1, 2: 2, 3: 3}}
new_zmat = zmat.add_atom_to_zmat_with_arbitrary_parameters(z,
element='Cl',
r_index=2,
a_indices=(1, 2),
d_indices=(3, 0, 2),
r_value=1.5,
a_value=120.0,
d_value=180.0,
)
expected_zmat = {'coords': ((None, None, None),
('R_1_0', None, None),
('R_2_1', 'A_2_1_0', None),
('R_3_2', 'A_3_2_0', 'D_3_2_0_1'),
('R_4_3', 'A_4_3_2', 'D_4_3_2_1')),
'map': {0: 0, 1: 1, 2: 4, 3: 2, 4: 3},
'symbols': ('N', 'N', 'Cl', 'H', 'H'),
'vars': {'A_2_1_0': 43.01291287044753,
'A_3_2_0': 116.8334890957394,
'A_4_3_2': 91.26532248920621,
'D_3_2_0_1': 0.002298234646018697,
'D_4_3_2_1': 359.9987217859366,
'R_1_0': 1.4534399860223848,
'R_2_1': 1.3268298846789657,
'R_3_2': 1.5000000794728576,
'R_4_3': 1.7439820494121707}}
self.assertEqual(new_zmat['symbols'], expected_zmat['symbols'])
self.assertEqual(new_zmat['vars'], expected_zmat['vars'])
self.assertEqual(new_zmat['coords'], expected_zmat['coords'])



if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))

0 comments on commit 1287947

Please sign in to comment.