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
4cec6442
Unverified
Commit
4cec6442
authored
May 10, 2019
by
Gao, Xiang
Committed by
GitHub
May 10, 2019
Browse files
Fix order of wrapping and strain (#221)
parent
14d2ef70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
torchani/ase.py
torchani/ase.py
+6
-3
No files found.
torchani/ase.py
View file @
4cec6442
...
@@ -77,6 +77,12 @@ class Calculator(ase.calculators.calculator.Calculator):
...
@@ -77,6 +77,12 @@ class Calculator(ase.calculators.calculator.Calculator):
coordinates
=
torch
.
tensor
(
self
.
atoms
.
get_positions
())
coordinates
=
torch
.
tensor
(
self
.
atoms
.
get_positions
())
coordinates
=
coordinates
.
unsqueeze
(
0
).
to
(
self
.
device
).
to
(
self
.
dtype
)
\
coordinates
=
coordinates
.
unsqueeze
(
0
).
to
(
self
.
device
).
to
(
self
.
dtype
)
\
.
requires_grad_
(
'forces'
in
properties
)
.
requires_grad_
(
'forces'
in
properties
)
if
pbc_enabled
:
coordinates
=
utils
.
map2central
(
cell
,
coordinates
,
pbc
)
if
self
.
overwrite
and
atoms
is
not
None
:
atoms
.
set_positions
(
coordinates
.
detach
().
cpu
().
reshape
(
-
1
,
3
).
numpy
())
if
'stress'
in
properties
:
if
'stress'
in
properties
:
displacements
=
torch
.
zeros
(
3
,
3
,
requires_grad
=
True
,
displacements
=
torch
.
zeros
(
3
,
3
,
requires_grad
=
True
,
dtype
=
self
.
dtype
,
device
=
self
.
device
)
dtype
=
self
.
dtype
,
device
=
self
.
device
)
...
@@ -87,9 +93,6 @@ class Calculator(ase.calculators.calculator.Calculator):
...
@@ -87,9 +93,6 @@ class Calculator(ase.calculators.calculator.Calculator):
coordinates
=
coordinates
+
strain_x
+
strain_y
+
strain_z
coordinates
=
coordinates
+
strain_x
+
strain_y
+
strain_z
if
pbc_enabled
:
if
pbc_enabled
:
coordinates
=
utils
.
map2central
(
cell
,
coordinates
,
pbc
)
if
self
.
overwrite
and
atoms
is
not
None
:
atoms
.
set_positions
(
coordinates
.
detach
().
cpu
().
reshape
(
-
1
,
3
).
numpy
())
if
'stress'
in
properties
:
if
'stress'
in
properties
:
strain_x
=
self
.
strain
(
cell
,
displacement_x
,
0
)
strain_x
=
self
.
strain
(
cell
,
displacement_x
,
0
)
strain_y
=
self
.
strain
(
cell
,
displacement_y
,
1
)
strain_y
=
self
.
strain
(
cell
,
displacement_y
,
1
)
...
...
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