@@ -160,11 +160,30 @@ def execute(self):
160160 force_matrix_poly [molecule_id ] = force_matrix
161161 torque_matrix_poly [molecule_id ] = torque_matrix
162162
163- # Get states for conformational entropy calculation
164163 bin_width = self ._args .bin_width
164+
165+ force_matrix_ua = {k : v / number_frames for k , v in force_matrix_ua .items ()}
166+ torque_matrix_ua = {k : v / number_frames for k , v in torque_matrix_ua .items ()}
167+
168+ force_matrix_res = [
169+ f / number_frames if f is not None else None for f in force_matrix_res
170+ ]
171+ torque_matrix_res = [
172+ t / number_frames if t is not None else None for t in torque_matrix_res
173+ ]
174+ force_matrix_poly = [
175+ f / number_frames if f is not None else None for f in force_matrix_poly
176+ ]
177+ torque_matrix_poly = [
178+ t / number_frames if t is not None else None for t in torque_matrix_poly
179+ ]
180+
181+ # Do the entropy calculations
165182 for molecule_id in range (number_molecules ):
166183 mol_container = self ._get_molecule_container (reduced_atom , molecule_id )
167184 for level in levels [molecule_id ]:
185+ highest_level = level == levels [molecule_id ][- 1 ]
186+
168187 if level == "united_atom" :
169188 for res_id , residue in enumerate (mol_container .residues ):
170189 key = (molecule_id , res_id )
@@ -192,42 +211,6 @@ def execute(self):
192211 step ,
193212 )
194213
195- elif level == "residue" :
196- dihedrals = self ._level_manager .get_dihedrals (mol_container , level )
197- for dihedral in dihedrals :
198- states_res [molecule_id ] = ce .assign_conformation (
199- mol_container ,
200- dihedral ,
201- number_frames ,
202- bin_width ,
203- start ,
204- end ,
205- step ,
206- )
207-
208- force_matrix_ua = {k : v / number_frames for k , v in force_matrix_ua .items ()}
209- torque_matrix_ua = {k : v / number_frames for k , v in torque_matrix_ua .items ()}
210-
211- force_matrix_res = [
212- f / number_frames if f is not None else None for f in force_matrix_res
213- ]
214- torque_matrix_res = [
215- t / number_frames if t is not None else None for t in torque_matrix_res
216- ]
217- force_matrix_poly = [
218- f / number_frames if f is not None else None for f in force_matrix_poly
219- ]
220- torque_matrix_poly = [
221- t / number_frames if t is not None else None for t in torque_matrix_poly
222- ]
223-
224- # Do the entropy calculations
225- for molecule_id in range (number_molecules ):
226- mol_container = self ._get_molecule_container (reduced_atom , molecule_id )
227- for level in levels [molecule_id ]:
228- highest_level = level == levels [molecule_id ][- 1 ]
229-
230- if level == "united_atom" :
231214 for res_id , residue in enumerate (mol_container .residues ):
232215 key = (molecule_id , res_id )
233216 self ._process_united_atom_entropy (
@@ -245,6 +228,19 @@ def execute(self):
245228 )
246229
247230 elif level == "residue" :
231+
232+ dihedrals = self ._level_manager .get_dihedrals (mol_container , level )
233+ for dihedral in dihedrals :
234+ states_res [molecule_id ] = ce .assign_conformation (
235+ mol_container ,
236+ dihedral ,
237+ number_frames ,
238+ bin_width ,
239+ start ,
240+ end ,
241+ step ,
242+ )
243+
248244 self ._process_vibrational_entropy (
249245 molecule_id ,
250246 mol_container ,
0 commit comments