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
1a341511
Commit
1a341511
authored
Oct 07, 2021
by
Gustaf Ahdritz
Browse files
Add DRMSD computation
parent
9f6b67f3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
openfold/utils/loss.py
openfold/utils/loss.py
+20
-0
No files found.
openfold/utils/loss.py
View file @
1a341511
...
...
@@ -1327,6 +1327,26 @@ def masked_msa_loss(logits, true_msa, bert_mask, eps=1e-8, **kwargs):
return
loss
def
compute_drmsd
(
structure_1
,
structure_2
):
d1
=
structure_1
[...,
:,
None
,
:]
-
structure_1
[...,
None
,
:,
:]
d2
=
structure_2
[...,
:,
None
,
:]
-
structure_2
[...,
None
,
:,
:]
d1
=
d1
**
2
d2
=
d2
**
2
d1
=
torch
.
sqrt
(
torch
.
sum
(
d1
,
dim
=-
1
))
d2
=
torch
.
sqrt
(
torch
.
sum
(
d2
,
dim
=-
1
))
drmsd
=
d1
-
d2
drmsd
=
drmsd
**
2
drmsd
=
torch
.
sum
(
drmsd
,
dim
=
(
-
1
,
-
2
))
n
=
structure_1
.
shape
[
-
1
]
drmsd
=
drmsd
*
(
1
/
(
n
*
(
n
-
1
)))
drmsd
=
torch
.
sqrt
(
drmsd
)
return
drmsd
class
AlphaFoldLoss
(
nn
.
Module
):
""" Aggregation of the various losses described in the supplement """
def
__init__
(
self
,
config
):
...
...
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