From 4368199822c7d76ce93302c11b8006adfd1dd36f Mon Sep 17 00:00:00 2001 From: ioanapapa Date: Sat, 15 Mar 2025 18:56:23 +0000 Subject: [PATCH 1/2] a heavy atoms universe is created for each residue and called by the get_dihedrals and conformational_entropy functions so that MDAnalysis gives dihedrals only containing heavy atoms. Values obtained for aliphatic residue match the old code now. Some further investigation for aromatic residues is still required to confirm results obtained using this implementation. --- CodeEntropy/main_mcc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CodeEntropy/main_mcc.py b/CodeEntropy/main_mcc.py index 234cefe..ea771d6 100644 --- a/CodeEntropy/main_mcc.py +++ b/CodeEntropy/main_mcc.py @@ -308,6 +308,7 @@ def main(): S_trans = 0 S_rot = 0 S_conf = 0 + for residue in range(num_residues): # molecule data container of MDAnalysis Universe type for internal # degrees of freedom getting indices of first and last atoms in the @@ -319,10 +320,14 @@ def main(): residue_container = MDAHelper.new_U_select_atom( molecule_container, selection_string ) + residue_heavy_atoms_container = MDAHelper.new_U_select_atom( + residue_container, "not name H*" + ) # only heavy atom dihedrals are relevant # Vibrational entropy at every level # Get the force and torque matrices for the beads at the relevant # level + force_matrix, torque_matrix = LF.get_matrices( residue_container, level, @@ -392,11 +397,11 @@ def main(): # Gives entropy of conformations within each residue # Get dihedral angle distribution - dihedrals = LF.get_dihedrals(residue_container, level) + dihedrals = LF.get_dihedrals(residue_heavy_atoms_container, level) # Calculate conformational entropy S_conf_residue = EF.conformational_entropy( - residue_container, + residue_heavy_atoms_container, dihedrals, bin_width, start, From 46c6f9dfe95565f31faf7b0cbff8be9da3170ee0 Mon Sep 17 00:00:00 2001 From: ioanapapa Date: Wed, 19 Mar 2025 22:21:50 +0000 Subject: [PATCH 2/2] get_dihedrals function calls a heavy atom-only universe so selecting for non-hydrogen atoms within the function is no longer necessary --- CodeEntropy/LevelFunctions.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CodeEntropy/LevelFunctions.py b/CodeEntropy/LevelFunctions.py index beb26f8..1f451f0 100644 --- a/CodeEntropy/LevelFunctions.py +++ b/CodeEntropy/LevelFunctions.py @@ -181,9 +181,7 @@ def get_dihedrals(data_container, level): # if united atom level, read dihedrals from MDAnalysis universe if level == "united_atom": - # only use dihedrals made of heavy atoms - heavy_atom_group = data_container.select_atoms("not name H*") - dihedrals = heavy_atom_group.dihedrals + dihedrals = data_container.dihedrals # if residue level, looking for dihedrals involving residues if level == "residue":