@@ -293,28 +293,6 @@ def test_get_principal_axes_from_tensor_returns_axes_and_moments():
293293 assert vals .shape == (3 ,)
294294
295295
296- def test_get_UA_masses_sums_bonded_hydrogens ():
297- ax = AxesCalculator ()
298-
299- heavy = _FakeAtom (index = 0 , mass = 12.0 , position = [0 , 0 , 0 ])
300- h1 = _FakeAtom (index = 1 , mass = 1.0 , position = [1 , 0 , 0 ])
301- h2 = _FakeAtom (index = 2 , mass = 1.0 , position = [0 , 1 , 0 ])
302-
303- bonded_atoms = _FakeAtomGroup (
304- [h1 , h2 ], select_map = {"mass 1 to 1.1" : _FakeAtomGroup ([h1 , h2 ])}
305- )
306-
307- mol = _FakeAtomGroup (
308- [heavy , h1 , h2 ],
309- select_map = {
310- "bonded index 0" : bonded_atoms ,
311- },
312- )
313-
314- masses = ax .get_UA_masses (mol )
315- assert masses == [14.0 ]
316-
317-
318296def test_get_molecule_axes_sorts_eigenvalues_desc_by_abs (monkeypatch ):
319297 ax = AxesCalculator ()
320298 mol = MagicMock ()
@@ -810,7 +788,6 @@ def _select_atoms(q):
810788 "get_bonded_axes" ,
811789 lambda system , atom , dimensions : (np .eye (3 ), np .array ([1.0 , 1.0 , 1.0 ])),
812790 )
813- monkeypatch .setattr (ax , "get_UA_masses" , lambda _ag : [12.0 , 12.0 ])
814791
815792 trans_axes , rot_axes , center , moi = ax .get_UA_axes (
816793 data_container , index = 0 , res_position = None
@@ -933,13 +910,11 @@ def test_get_residue_axes_from_topology_no_neighbor_bonds_uses_cached_indices(
933910
934911 monkeypatch .setattr (ax , "get_molecule_axes" , get_principal )
935912
936- box = np .array ([20.0 , 30.0 , 40.0 ])
937913 trans_axes , rot_axes , center , moi = ax .get_residue_axes_from_topology (
938914 u = universe ,
939915 mol = mol ,
940916 residue_atoms = residue_atoms ,
941917 topology = topology ,
942- box = box ,
943918 )
944919
945920 np .testing .assert_allclose (trans_axes , np .eye (3 ) * 2.0 )
@@ -972,11 +947,7 @@ def test_get_residue_axes_from_topology_neighbor_bonds_uses_molecule_axes(
972947 monkeypatch .setattr (ax , "get_molecule_axes" , get_molecule )
973948
974949 trans_axes , rot_axes , center , moi = ax .get_residue_axes_from_topology (
975- u = universe ,
976- mol = mol ,
977- residue_atoms = residue_atoms ,
978- topology = topology ,
979- box = None ,
950+ u = universe , mol = mol , residue_atoms = residue_atoms , topology = topology
980951 )
981952
982953 make_whole .assert_called_once_with (mol .atoms )
@@ -1005,12 +976,9 @@ def test_get_UA_axes_from_topology_multiple_heavy_uses_cached_indices_and_box(
1005976 residue_ua_masses = (13.0 , 14.0 ),
1006977 )
1007978
1008- get_tensor = MagicMock (return_value = np .eye (3 ))
1009- get_principal = MagicMock (return_value = (np .eye (3 ) * 2.0 , np .array ([3.0 , 2.0 , 1.0 ])))
979+ get_principal = MagicMock (return_value = (np .eye (3 ) * 2.0 ))
1010980 get_bonded = MagicMock (return_value = (np .eye (3 ) * 4.0 , np .array ([1.0 , 1.0 , 1.0 ])))
1011-
1012- monkeypatch .setattr (ax , "get_moment_of_inertia_tensor" , get_tensor )
1013- monkeypatch .setattr (ax , "get_principal_axes_from_tensor" , get_principal )
981+ monkeypatch .setattr (ax , "get_principal_axes_from_group" , get_principal )
1014982 monkeypatch .setattr (ax , "get_bonded_axes_from_topology" , get_bonded )
1015983
1016984 box = np .array ([20.0 , 30.0 , 40.0 ])
@@ -1026,19 +994,7 @@ def test_get_UA_axes_from_topology_multiple_heavy_uses_cached_indices_and_box(
1026994 np .testing .assert_allclose (center , heavy_atom .position )
1027995 np .testing .assert_allclose (moi , np .array ([1.0 , 1.0 , 1.0 ]))
1028996
1029- get_tensor .assert_called_once ()
1030- tensor_kwargs = get_tensor .call_args .kwargs
1031- np .testing .assert_allclose (
1032- tensor_kwargs ["center_of_mass" ], np .array ([9.0 , 8.0 , 7.0 ])
1033- )
1034- np .testing .assert_allclose (
1035- tensor_kwargs ["positions" ], np .array ([[1.0 , 2.0 , 3.0 ], [4.0 , 5.0 , 6.0 ]])
1036- )
1037- np .testing .assert_allclose (tensor_kwargs ["masses" ], np .array ([13.0 , 14.0 ]))
1038- np .testing .assert_allclose (tensor_kwargs ["dimensions" ], box )
1039-
1040997 get_principal .assert_called_once ()
1041- np .testing .assert_allclose (get_principal .call_args .args [0 ], np .eye (3 ))
1042998 get_bonded .assert_called_once_with (
1043999 u = universe ,
10441000 heavy_atom = heavy_atom ,
0 commit comments