Skip to content

Commit 1847d31

Browse files
committed
adding statement for case when there is no dihedral angle
1 parent 6140253 commit 1847d31

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

CodeEntropy/dihedral_tools.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,35 @@ def build_conformational_states(
123123
if level == "united_atom":
124124
for res_id in range(num_residues):
125125
key = (group_id, res_id)
126-
states_ua[key] = self._assign_states(
126+
if len(dihedrals_ua[res_id]) == 0:
127+
# No conformational states
128+
states_ua[key] = []
129+
else:
130+
states_ua[key] = self._assign_states(
131+
data_container,
132+
molecules,
133+
dihedrals_ua[res_id],
134+
peaks_ua[res_id],
135+
start,
136+
end,
137+
step,
138+
)
139+
140+
elif level == "residue":
141+
if len(dihedrals_res) == 0:
142+
# No conformational states
143+
states_res[group_id] = []
144+
else:
145+
states_res[group_id] = self._assign_states(
127146
data_container,
128147
molecules,
129-
dihedrals_ua[res_id],
130-
peaks_ua[res_id],
148+
dihedrals_res,
149+
peaks_res,
131150
start,
132151
end,
133152
step,
134153
)
135154

136-
elif level == "residue":
137-
states_res[group_id] = self._assign_states(
138-
data_container,
139-
molecules,
140-
dihedrals_res,
141-
peaks_res,
142-
start,
143-
end,
144-
step,
145-
)
146-
147155
progress.advance(task)
148156

149157
return states_ua, states_res

0 commit comments

Comments
 (0)