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
1a27b07f
Unverified
Commit
1a27b07f
authored
Apr 09, 2020
by
Gao, Xiang
Committed by
GitHub
Apr 09, 2020
Browse files
Take advantage of torch.where broadcasting (#447)
parent
5da2adbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
torchani/aev.py
torchani/aev.py
+1
-1
No files found.
torchani/aev.py
View file @
1a27b07f
...
...
@@ -94,7 +94,7 @@ def compute_shifts(cell: Tensor, pbc: Tensor, cutoff: float) -> Tensor:
reciprocal_cell
=
cell
.
inverse
().
t
()
inv_distances
=
reciprocal_cell
.
norm
(
2
,
-
1
)
num_repeats
=
torch
.
ceil
(
cutoff
*
inv_distances
).
to
(
torch
.
long
)
num_repeats
=
torch
.
where
(
pbc
,
num_repeats
,
torch
.
zeros_like
(
num_repeats
))
num_repeats
=
torch
.
where
(
pbc
,
num_repeats
,
num_repeats
.
new_zeros
(()
))
r1
=
torch
.
arange
(
1
,
num_repeats
[
0
]
+
1
,
device
=
cell
.
device
)
r2
=
torch
.
arange
(
1
,
num_repeats
[
1
]
+
1
,
device
=
cell
.
device
)
r3
=
torch
.
arange
(
1
,
num_repeats
[
2
]
+
1
,
device
=
cell
.
device
)
...
...
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