Skip to content

Commit 2cc933f

Browse files
author
Meg Osato
committed
add in E. Dybeck colinearity changes
1 parent 446a358 commit 2cc933f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

boresch_restraints.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,15 @@ def protein_list(traj, l1, residues2exclude=None):
195195
ex = []
196196
start_helix = False
197197
helix = []
198+
199+
# Probably should make these fx params or hyper-params
198200
# How many residues of the protein to discard at the beginning and the end since ends can be floppy
199201
skip_start = 20
200202
skip_end = 10
201203
# number of residues Helix/beta sheet has to consist of to be considered stable
202204
stable_helix = 8
203205

204-
#Check if more helices, more beta sheets in structure, choose predominant one
206+
# Check if more helices, more beta sheets in structure, choose predominant one
205207
# (if more beta sheets use both helices and sheets)
206208
res_in_helix = structure.count('H')
207209
res_in_sheet = structure.count('E')
@@ -288,15 +290,15 @@ def _is_collinear(positions, atoms, threshold=0.9):
288290
-------
289291
result : bool
290292
Returns True if any sequential pair of vectors is collinear; False otherwise.
293+
294+
Modification proposed by Eric Dybeck
291295
"""
292296
result = False
293297
for i in range(len(atoms) - 2):
294298
v1 = positions[atoms[i + 1], :] - positions[atoms[i], :]
295299
v2 = positions[atoms[i + 2], :] - positions[atoms[i + 1], :]
296300
normalized_inner_product = np.dot(v1, v2) / np.sqrt(np.dot(v1, v1) * np.dot(v2, v2))
297-
298-
result = result or (normalized_inner_product > threshold)
299-
301+
result = result or (np.abs(normalized_inner_product) > threshold) #INDENT AND ABSOLUTE VALUE ADDED HERE
300302
return result
301303

302304
def check_angle(angle):

0 commit comments

Comments
 (0)