Skip to content

Commit c6cba70

Browse files
committed
fix centre for 2 heavy atoms situation
1 parent 3681d69 commit c6cba70

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎CodeEntropy/levels/axes.py‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ def get_residue_axes(
187187
[edge_atom.position, average_other_atoms], average_bonded_atom
188188
)
189189
else:
190-
rot_center, rot_axes = self.get_custom_axes(
190+
rot_center = edge_atom.position
191+
rot_axes = self.get_custom_axes(
191192
a=edge_atom.position, b=[average_bonded_atom], c=np.zeros(3)
192193
)
193194

@@ -203,8 +204,9 @@ def get_residue_axes(
203204
edges, backbone_center
204205
)
205206
else:
206-
rot_center, rot_axes = self.get_custom_axes(
207-
a=edges[0], b=[edges[1]], c=np.zeros(3)
207+
rot_center = (edges[0] + edges[1]) / 2
208+
rot_axes = self.get_custom_axes(
209+
a=rot_center, b=[edges[1]], c=np.zeros(3)
208210
)
209211

210212
moment_of_inertia = self.get_custom_residue_moment_of_inertia(
@@ -391,7 +393,8 @@ def get_UA_axes(self, data_container, index: int, res_position):
391393
average_bonded_atom,
392394
)
393395
else:
394-
trans_center, trans_axes = self.get_custom_axes(
396+
trans_center = edge_atom.position
397+
trans_axes = self.get_custom_axes(
395398
a=edge_atom.position, b=[average_bonded_atom], c=np.zeros(3)
396399
)
397400
else:
@@ -417,8 +420,9 @@ def get_UA_axes(self, data_container, index: int, res_position):
417420
edges, backbone_center
418421
)
419422
else:
420-
trans_center, trans_axes = self.get_custom_axes(
421-
a=edges[0], b=[edges[1]], c=np.zeros(3)
423+
trans_center = (edges[0] + edges[1]) / 2
424+
trans_axes = self.get_custom_axes(
425+
a=trans_center, b=[edges[1]], c=np.zeros(3)
422426
)
423427

424428
# look for heavy atoms in residue of interest

0 commit comments

Comments
 (0)