Skip to content

Commit 3214289

Browse files
committed
Fix indentation and matrix key usage in _process_united_atom_entropy
- Ensured correct indentation to prevent excessive looping - Passed appropriate `force_matrix`, `torque_matrix`, and `states` within the loop of `_process_united_atom_entropy` - Used correct keys for accessing matrices to maintain consistency and accuracy
1 parent a267f47 commit 3214289

1 file changed

Lines changed: 22 additions & 19 deletions

File tree

CodeEntropy/entropy.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,19 @@ def execute(self):
211211
step,
212212
)
213213

214-
for res_id, residue in enumerate(mol_container.residues):
215-
key = (molecule_id, res_id)
216-
self._process_united_atom_entropy(
217-
molecule_id,
218-
mol_container,
219-
res_id,
220-
ve,
221-
ce,
222-
level,
223-
force_matrix_ua[key],
224-
torque_matrix_ua[key],
225-
states_ua[key],
226-
highest_level,
227-
number_frames,
228-
)
214+
self._process_united_atom_entropy(
215+
molecule_id,
216+
mol_container,
217+
res_id,
218+
ve,
219+
ce,
220+
level,
221+
force_matrix_ua,
222+
torque_matrix_ua,
223+
states_ua,
224+
highest_level,
225+
number_frames,
226+
)
229227

230228
elif level == "residue":
231229

@@ -378,14 +376,19 @@ def _process_united_atom_entropy(
378376
S_trans, S_rot, S_conf = 0, 0, 0
379377

380378
for residue_id, residue in enumerate(mol_container.residues):
379+
380+
key = (mol_id, residue_id)
381+
381382
S_trans_res = ve.vibrational_entropy_calculation(
382-
force_matrix, "force", self._args.temperature, highest
383+
force_matrix[key], "force", self._args.temperature, highest
383384
)
384385
S_rot_res = ve.vibrational_entropy_calculation(
385-
torque_matrix, "torque", self._args.temperature, highest
386+
torque_matrix[key], "torque", self._args.temperature, highest
386387
)
387388

388-
S_conf_res = ce.conformational_entropy_calculation(states, number_frames)
389+
S_conf_res = ce.conformational_entropy_calculation(
390+
states[key], number_frames
391+
)
389392

390393
S_trans += S_trans_res
391394
S_rot += S_rot_res
@@ -457,7 +460,7 @@ def _process_conformational_entropy(
457460
start, end, step (int): Frame bounds.
458461
n_frames (int): Number of frames used.
459462
"""
460-
S_conf = ce.conformational_entropy_calculation(states, number_frames)
463+
S_conf = ce.conformational_entropy_calculation(states[mol_id], number_frames)
461464
residue = mol_container.residues[mol_id]
462465
self._data_logger.add_results_data(
463466
residue.resname, level, "Conformational", S_conf

0 commit comments

Comments
 (0)