Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
OpenFold
Commits
023596d2
"git@developer.sourcefind.cn:OpenDAS/Uni-Core.git" did not exist on "97fd9948f163c0f81390fe80a14d660409013c75"
Commit
023596d2
authored
Aug 22, 2022
by
Nikita Smetanin
Browse files
Minor updates & optimizations to support ESMFold
parent
998ee79b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
+33
-7
openfold/utils/rigid_utils.py
openfold/utils/rigid_utils.py
+33
-7
No files found.
openfold/utils/rigid_utils.py
View file @
023596d2
...
...
@@ -35,8 +35,30 @@ def rot_matmul(
Returns:
The product ab
"""
with
torch
.
autocast
(
a
.
device
.
type
,
enabled
=
False
):
return
a
.
to
(
torch
.
float32
)
@
b
.
to
(
torch
.
float32
)
def
row_mul
(
i
):
return
torch
.
stack
(
[
a
[...,
i
,
0
]
*
b
[...,
0
,
0
]
+
a
[...,
i
,
1
]
*
b
[...,
1
,
0
]
+
a
[...,
i
,
2
]
*
b
[...,
2
,
0
],
a
[...,
i
,
0
]
*
b
[...,
0
,
1
]
+
a
[...,
i
,
1
]
*
b
[...,
1
,
1
]
+
a
[...,
i
,
2
]
*
b
[...,
2
,
1
],
a
[...,
i
,
0
]
*
b
[...,
0
,
2
]
+
a
[...,
i
,
1
]
*
b
[...,
1
,
2
]
+
a
[...,
i
,
2
]
*
b
[...,
2
,
2
],
],
dim
=-
1
,
)
return
torch
.
stack
(
[
row_mul
(
0
),
row_mul
(
1
),
row_mul
(
2
),
],
dim
=-
2
)
def
rot_vec_mul
(
...
...
@@ -53,11 +75,15 @@ def rot_vec_mul(
Returns:
[*, 3] rotated coordinates
"""
with
torch
.
autocast
(
r
.
device
.
type
,
enabled
=
False
):
r
=
r
.
to
(
torch
.
float32
)
t
=
t
.
to
(
torch
.
float32
)
return
(
r
@
t
.
unsqueeze
(
-
1
)).
squeeze
(
-
1
)
x
,
y
,
z
=
torch
.
unbind
(
t
,
dim
=-
1
)
return
torch
.
stack
(
[
r
[...,
0
,
0
]
*
x
+
r
[...,
0
,
1
]
*
y
+
r
[...,
0
,
2
]
*
z
,
r
[...,
1
,
0
]
*
x
+
r
[...,
1
,
1
]
*
y
+
r
[...,
1
,
2
]
*
z
,
r
[...,
2
,
0
]
*
x
+
r
[...,
2
,
1
]
*
y
+
r
[...,
2
,
2
]
*
z
,
],
dim
=-
1
,
)
@
lru_cache
(
maxsize
=
None
)
def
identity_rot_mats
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment