Skip to content

Commit 7611b3f

Browse files
committed
Revert "fixing united atom translational axes to match residue rotational axes"
This reverts commit e25063d.
1 parent 8df2486 commit 7611b3f

2 files changed

Lines changed: 10 additions & 35 deletions

File tree

CodeEntropy/GeometricFunctions.py

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_beads(data_container, level):
3939
def get_axes(data_container, level, index=0):
4040
"""
4141
Function to set the translational and rotational axes.
42-
The translational axes are based on the rotational axes of the unit one level larger than
42+
The translational axes are based on the principal axes of the unit one level larger than
4343
the level we are interested in (except for the polymer level where there is no larger unit).
4444
The rotational axes use the covalent links between residues or atoms where possible to
4545
define the axes, or if the unit is not bonded to others of the same level the prinicpal
@@ -93,46 +93,22 @@ def get_axes(data_container, level, index=0):
9393

9494
if level == "united_atom":
9595
## Translation
96-
# The translational axes for the united atom level should be the same as the rotational axes of the residue level.
97-
index_prev = index - 1
98-
index_next = index + 1
99-
atom_set = data_container.select_atoms(f"(resindex {index_prev} or resindex {index_next}) and bonded resid {index}")
100-
residue = data_container.select_atoms(f"resindex {index}")
101-
102-
if len(atom_set) == 0:
103-
# if no bonds to other residues use pricipal axes of residue
104-
trans_axes = residue.atoms.principal_axes()
105-
106-
else:
107-
# set center of rotation to center of mass of the residue
108-
center = residue.atoms.center_of_mass()
109-
110-
# get vector for average position of bonded atoms
111-
vector = get_avg_pos(atom_set, center)
112-
113-
# use spherical coordinates function to get rotational axes
114-
trans_axes = get_sphCoord_axes(vector)
96+
# for united atoms use principal axes of residue for translation
97+
trans_axes = data_container.residues.principal_axes()
11598

11699
## Rotation
117100
# for united atoms use heavy atoms bonded to the heavy atom
118101
atom_set = data_container.select_atoms(f"not name H* and bonded index {index}")
119102

120-
if len(atom_set) == 0:
121-
# if no bonds to other heavy atoms use pricipal axes of residue
122-
# this is the case where there is only one united atom in the residue, so the principal axes of the residue are the same as the principal axes of the united atom
123-
# NOTE if you have argon or helium that is spherically symmetric you use random axes, but we should check that the prinicipal_axes function does that and doesn't cause an error when the residue/united atom has only one atom.
124-
trans_axes = residue.atoms.principal_axes()
125-
126-
else:
127-
# center at position of heavy atom
128-
atom_group = data_container.select_atoms(f"index {index}")
129-
center = atom_group.positions[0]
103+
# center at position of heavy atom
104+
atom_group = data_container.select_atoms(f"index {index}")
105+
center = atom_group.positions[0]
130106

131-
# get vector for average position of hydrogens
132-
vector = get_avg_pos(atom_set, center)
107+
# get vector for average position of hydrogens
108+
vector = get_avg_pos(atom_set, center)
133109

134-
# use spherical coordinates function to get rotational axes
135-
rot_axes = get_sphCoord_axes(vector)
110+
# use spherical coordinates function to get rotational axes
111+
rot_axes = get_sphCoord_axes(vector)
136112

137113
return trans_axes, rot_axes
138114
# END

CodeEntropy/LevelFunctions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def get_matrices(data_container, level, verbose, start, end, step, number_frames
9191
# list of pairs of indices
9292
pair_list = [(i,j) for i in range(number_beads) for j in range(number_beads)]
9393

94-
# initialize force and torque submatrices
9594
force_submatrix = [[0 for x in range(number_beads)] for y in range(number_beads)]
9695
torque_submatrix = [[0 for x in range(number_beads)] for y in range(number_beads)]
9796

0 commit comments

Comments
 (0)