Skip to content

Commit 1f58414

Browse files
committed
frames may already be invalid for ligand or metal ions depending on number of atoms
1 parent 9dce0a1 commit 1f58414

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

alphafold3_pytorch/inputs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ def get_frames_from_atom_pos(
270270
if not filter_colinear_pos:
271271
return frames
272272

273+
is_invalid = (frames == -1).any(dim = -1)
274+
273275
# get the edges and derive angles
274276

275277
three_atom_pos = einx.get_at('... [m] c, ... three -> ... three c', atom_pos, frames)
@@ -284,12 +286,12 @@ def get_frames_from_atom_pos(
284286

285287
is_colinear = (
286288
(degree.abs() < is_colinear_angle_thres) |
287-
((180. - degree.abs()) < is_colinear_angle_thres)
289+
((180. - degree.abs()).abs() < is_colinear_angle_thres)
288290
)
289291

290292
# set any three atoms that are colinear to -1 indices
291293

292-
three_atom_indices = einx.where('..., ... three, -> ... three', ~is_colinear, frames, -1)
294+
three_atom_indices = einx.where('..., ... three, -> ... three', ~(is_colinear | is_invalid), frames, -1)
293295
return three_atom_indices
294296

295297
# atom level, what Alphafold3 accepts

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "alphafold3-pytorch"
3-
version = "0.4.15"
3+
version = "0.4.16"
44
description = "Alphafold 3 - Pytorch"
55
authors = [
66
{ name = "Phil Wang", email = "[email protected]" },

0 commit comments

Comments
 (0)