Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
torchani
Commits
cf192be4
Unverified
Commit
cf192be4
authored
Oct 30, 2018
by
Gao, Xiang
Committed by
GitHub
Oct 30, 2018
Browse files
Test non-rectangular PBC (#139)
parent
d8168e7e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
tests/test_ase.py
tests/test_ase.py
+19
-0
No files found.
tests/test_ase.py
View file @
cf192be4
...
...
@@ -7,6 +7,7 @@ import torchani
import
unittest
import
numpy
import
itertools
import
math
def
get_numeric_force
(
atoms
,
eps
):
...
...
@@ -158,6 +159,24 @@ class TestASE(unittest.TestCase):
self
.
assertTensorEqual
(
neighbor_coordinate
,
xyz2
)
def
testNonRectangularPBCConnersSeeEachOther
(
self
):
species
=
torch
.
tensor
([[
0
,
0
]])
neighborlist
=
torchani
.
ase
.
NeighborList
(
cell
=
[
10
,
10
,
10
*
math
.
sqrt
(
2
),
90
,
45
,
90
],
pbc
=
True
)
xyz1
=
torch
.
tensor
([
0.1
,
0.1
,
0.05
])
xyz2
=
torch
.
tensor
([
10.0
,
0.1
,
0.1
])
mirror
=
torch
.
tensor
([
0.0
,
0.1
,
0.1
])
coordinates
=
torch
.
stack
([
xyz1
,
xyz2
]).
unsqueeze
(
0
)
s
,
_
,
D
=
neighborlist
(
species
,
coordinates
,
1
)
self
.
assertListEqual
(
list
(
s
.
shape
),
[
1
,
2
,
1
])
neighbor_coordinate
=
D
[
0
][
0
].
squeeze
()
+
xyz1
for
i
in
range
(
3
):
if
mirror
[
i
]
>
5
:
mirror
[
i
]
-=
10
self
.
assertTensorEqual
(
neighbor_coordinate
,
mirror
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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