@@ -22,6 +22,7 @@ def shared_data_base():
2222 "reduced_universe" : reduced_universe ,
2323 "force_covariances" : {"ua" : {}, "res" : [], "poly" : []},
2424 "torque_covariances" : {"ua" : {}, "res" : [], "poly" : []},
25+ "flexible_dihedrals" : {"ua" : 0 , "res" : [0 ]},
2526 "n_frames" : 5 ,
2627 "reporter" : MagicMock (),
2728 }
@@ -42,6 +43,7 @@ def shared_groups():
4243 "reduced_universe" : ru ,
4344 "force_covariances" : {"ua" : {}, "res" : [], "poly" : []},
4445 "torque_covariances" : {"ua" : {}, "res" : [], "poly" : []},
46+ "flexible_dihedrals" : {"ua" : [], "res" : []},
4547 "n_frames" : 5 ,
4648 "reporter" : MagicMock (),
4749 }
@@ -131,6 +133,7 @@ def test_run_raises_on_unknown_level(shared_data, monkeypatch):
131133
132134 shared_data ["force_covariances" ] = {"ua" : {}, "res" : [], "poly" : []}
133135 shared_data ["torque_covariances" ] = {"ua" : {}, "res" : [], "poly" : []}
136+ shared_data ["flexible_dihedrals" ] = {"ua" : [], "res" : []}
134137
135138 with pytest .raises (ValueError ):
136139 node .run (shared_data )
@@ -143,6 +146,7 @@ def test_run_united_atom_branch_stores_results(shared_data, monkeypatch):
143146 shared_data ["groups" ] = {0 : [0 ]}
144147 shared_data ["force_covariances" ] = {"ua" : {}, "res" : [], "poly" : []}
145148 shared_data ["torque_covariances" ] = {"ua" : {}, "res" : [], "poly" : []}
149+ shared_data ["flexible_dihedrals" ] = {"ua" : [], "res" : []}
146150
147151 fake_pair = MagicMock (trans = 1.0 , rot = 2.0 )
148152 monkeypatch .setattr (
@@ -164,6 +168,7 @@ def test_unknown_level_raises(shared_data):
164168 shared_data ["groups" ] = {0 : [0 ]}
165169 shared_data ["force_covariances" ] = {"ua" : {}, "res" : [], "poly" : []}
166170 shared_data ["torque_covariances" ] = {"ua" : {}, "res" : [], "poly" : []}
171+ shared_data ["flexible_dihedrals" ] = {"ua" : [], "res" : []}
167172
168173 with pytest .raises (ValueError ):
169174 node .run (shared_data )
@@ -177,6 +182,7 @@ def test_polymer_branch_executes(shared_data, monkeypatch):
177182
178183 shared_data ["force_covariances" ] = {"ua" : {}, "res" : [], "poly" : [MagicMock ()]}
179184 shared_data ["torque_covariances" ] = {"ua" : {}, "res" : [], "poly" : [MagicMock ()]}
185+ shared_data ["flexible_dihedrals" ] = {"ua" : [], "res" : []}
180186
181187 shared_data ["reduced_universe" ].atoms .fragments = [MagicMock (residues = [])]
182188
@@ -205,6 +211,7 @@ def test_run_skips_empty_mol_ids_group():
205211 "reduced_universe" : MagicMock (atoms = MagicMock (fragments = [])),
206212 "force_covariances" : {"ua" : {}, "res" : [], "poly" : []},
207213 "torque_covariances" : {"ua" : {}, "res" : [], "poly" : []},
214+ "flexible_dihedrals" : {"ua" : [], "res" : []},
208215 "n_frames" : 5 ,
209216 "reporter" : None ,
210217 }
@@ -235,6 +242,7 @@ def test_compute_united_atom_entropy_logs_residue_data_when_reporter_present():
235242 residues = residues ,
236243 force_ua = {},
237244 torque_ua = {},
245+ flexible_ua = {(7 , 0 ): 0 , (7 , 1 ): 0 },
238246 ua_frame_counts = {(7 , 0 ): 3 , (7 , 1 ): 4 },
239247 reporter = reporter ,
240248 n_frames_default = 10 ,
@@ -255,6 +263,7 @@ def test_compute_force_torque_entropy_success_calls_vibrational_engine():
255263 temp = 298.0 ,
256264 fmat = np .eye (3 ),
257265 tmat = np .eye (3 ),
266+ flexible = 0 ,
258267 highest = False ,
259268 )
260269
@@ -267,7 +276,7 @@ def test_compute_ft_entropy_success_calls_vibrational_engine_for_trans_and_rot()
267276 ve = MagicMock ()
268277 ve .vibrational_entropy_calculation .side_effect = [1.5 , 2.5 ]
269278
270- out = node ._compute_ft_entropy (ve = ve , temp = 298.0 , ftmat = np .eye (6 ))
279+ out = node ._compute_ft_entropy (ve = ve , temp = 298.0 , ftmat = np .eye (6 ), flexible = 0 )
271280
272281 assert out == EntropyPair (trans = 1.5 , rot = 2.5 )
273282 assert ve .vibrational_entropy_calculation .call_count == 2
@@ -312,7 +321,7 @@ def test_compute_force_torque_entropy_returns_zero_when_missing_matrix(shared_gr
312321 node = VibrationalEntropyNode ()
313322 ve = MagicMock ()
314323 pair = node ._compute_force_torque_entropy (
315- ve = ve , temp = 298.0 , fmat = None , tmat = np .eye (3 ), highest = True
324+ ve = ve , temp = 298.0 , fmat = None , tmat = np .eye (3 ), flexible = 0 , highest = True
316325 )
317326 assert pair == EntropyPair (trans = 0.0 , rot = 0.0 )
318327
@@ -326,17 +335,17 @@ def test_compute_force_torque_entropy_returns_zero_when_filter_removes_all(monke
326335 )
327336
328337 pair = node ._compute_force_torque_entropy (
329- ve = ve , temp = 298.0 , fmat = np .eye (3 ), tmat = np .eye (3 ), highest = True
338+ ve = ve , temp = 298.0 , fmat = np .eye (3 ), tmat = np .eye (3 ), flexible = 0 , highest = True
330339 )
331340 assert pair == EntropyPair (trans = 0.0 , rot = 0.0 )
332341
333342
334343def test_compute_ft_entropy_returns_zero_when_none ():
335344 node = VibrationalEntropyNode ()
336345 ve = MagicMock ()
337- assert node ._compute_ft_entropy (ve = ve , temp = 298.0 , ftmat = None ) == EntropyPair (
338- trans = 0 .0 , rot = 0. 0
339- )
346+ assert node ._compute_ft_entropy (
347+ ve = ve , temp = 298 .0 , ftmat = None , flexible = 0
348+ ) == EntropyPair ( trans = 0.0 , rot = 0.0 )
340349
341350
342351def test_log_molecule_level_results_ft_labels_branch ():
@@ -376,7 +385,7 @@ def test_compute_ft_entropy_returns_zeros_when_filtered_ft_matrix_is_empty(monke
376385 lambda _arr , atol : np .empty ((0 , 0 ), dtype = float ),
377386 )
378387
379- out = node ._compute_ft_entropy (ve = ve , temp = 298.0 , ftmat = np .eye (6 ))
388+ out = node ._compute_ft_entropy (ve = ve , temp = 298.0 , ftmat = np .eye (6 ), flexible = 0 )
380389
381390 assert out == EntropyPair (trans = 0.0 , rot = 0.0 )
382391 ve .vibrational_entropy_calculation .assert_not_called ()
0 commit comments