Skip to content

Commit d23ec92

Browse files
committed
Ensuring if the united atom isn't bonded, the axis are reproduceable within expected range
1 parent 0ac02af commit d23ec92

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

CodeEntropy/levels.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,19 @@ def get_axes(self, data_container, level, index=0):
375375
f"not name H* and bonded index {index}"
376376
)
377377

378-
# center at position of heavy atom
379-
atom_group = data_container.select_atoms(f"index {index}")
380-
center = atom_group.positions[0]
378+
if len(atom_set) == 0:
379+
# if no bonds to other residues use pricipal axes of residue
380+
rot_axes = data_container.residues.principal_axes()
381+
else:
382+
# center at position of heavy atom
383+
atom_group = data_container.select_atoms(f"index {index}")
384+
center = atom_group.positions[0]
381385

382-
# get vector for average position of hydrogens
383-
vector = self.get_avg_pos(atom_set, center)
386+
# get vector for average position of hydrogens
387+
vector = self.get_avg_pos(atom_set, center)
384388

385-
# use spherical coordinates function to get rotational axes
386-
rot_axes = self.get_sphCoord_axes(vector)
389+
# use spherical coordinates function to get rotational axes
390+
rot_axes = self.get_sphCoord_axes(vector)
387391

388392
logger.debug(f"Translational Axes: {trans_axes}")
389393
logger.debug(f"Rotational Axes: {rot_axes}")

0 commit comments

Comments
 (0)