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
95c3206b
Unverified
Commit
95c3206b
authored
Apr 21, 2019
by
Gao, Xiang
Committed by
GitHub
Apr 21, 2019
Browse files
Fix ase interface on GPU (#212)
parent
cbfbab3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchani/ase.py
torchani/ase.py
+2
-2
No files found.
torchani/ase.py
View file @
95c3206b
...
...
@@ -58,7 +58,7 @@ class Calculator(ase.calculators.calculator.Calculator):
pbc
=
torch
.
tensor
(
self
.
atoms
.
get_pbc
().
astype
(
numpy
.
uint8
),
dtype
=
torch
.
uint8
,
device
=
self
.
device
)
# print(cell, pbc)
species
=
self
.
species_to_tensor
(
self
.
atoms
.
get_chemical_symbols
())
species
=
self
.
species_to_tensor
(
self
.
atoms
.
get_chemical_symbols
())
.
to
(
self
.
device
)
species
=
species
.
unsqueeze
(
0
)
coordinates
=
torch
.
tensor
(
self
.
atoms
.
get_positions
())
coordinates
=
coordinates
.
unsqueeze
(
0
).
to
(
self
.
device
).
to
(
self
.
dtype
)
\
...
...
@@ -68,4 +68,4 @@ class Calculator(ase.calculators.calculator.Calculator):
self
.
results
[
'energy'
]
=
energy
.
item
()
if
'forces'
in
properties
:
forces
=
-
torch
.
autograd
.
grad
(
energy
.
squeeze
(),
coordinates
)[
0
]
self
.
results
[
'forces'
]
=
forces
.
squeeze
().
numpy
()
self
.
results
[
'forces'
]
=
forces
.
squeeze
().
to
(
'cpu'
).
numpy
()
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