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
torchani
Commits
00dd8cba
Unverified
Commit
00dd8cba
authored
Feb 05, 2020
by
Farhad Ramezanghorbani
Committed by
GitHub
Feb 05, 2020
Browse files
Add retain_graph (force and stress) case in ASE (#417)
This PR resolves #415 Thanks @mhellstr for pointing it out
parent
79470486
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
torchani/ase.py
torchani/ase.py
+1
-1
No files found.
torchani/ase.py
View file @
00dd8cba
...
@@ -72,7 +72,7 @@ class Calculator(ase.calculators.calculator.Calculator):
...
@@ -72,7 +72,7 @@ class Calculator(ase.calculators.calculator.Calculator):
self
.
results
[
'free_energy'
]
=
energy
.
item
()
self
.
results
[
'free_energy'
]
=
energy
.
item
()
if
'forces'
in
properties
:
if
'forces'
in
properties
:
forces
=
-
torch
.
autograd
.
grad
(
energy
.
squeeze
(),
coordinates
)[
0
]
forces
=
-
torch
.
autograd
.
grad
(
energy
.
squeeze
(),
coordinates
,
retain_graph
=
'stress'
in
properties
)[
0
]
self
.
results
[
'forces'
]
=
forces
.
squeeze
(
0
).
to
(
'cpu'
).
numpy
()
self
.
results
[
'forces'
]
=
forces
.
squeeze
(
0
).
to
(
'cpu'
).
numpy
()
if
'stress'
in
properties
:
if
'stress'
in
properties
:
...
...
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