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
cbfbab3f
Unverified
Commit
cbfbab3f
authored
Apr 21, 2019
by
Gao, Xiang
Committed by
GitHub
Apr 21, 2019
Browse files
Change comp6 script a bit (#211)
parent
077c12b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
tools/comp6.py
tools/comp6.py
+2
-3
No files found.
tools/comp6.py
View file @
cbfbab3f
...
...
@@ -13,7 +13,7 @@ dtype = torch.float32
# parse command line arguments
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'dir'
,
help
=
'Path to the COMP6 directory'
)
parser
.
add_argument
(
'-b'
,
'--batchatoms'
,
type
=
int
,
default
=
512
,
parser
.
add_argument
(
'-b'
,
'--batchatoms'
,
type
=
int
,
default
=
4096
,
help
=
'Maximum number of ATOMs in each batch'
)
parser
.
add_argument
(
'-d'
,
'--device'
,
help
=
'Device of modules and tensors'
,
...
...
@@ -42,8 +42,7 @@ def by_batch(species, coordinates, model):
coordinates
=
torch
.
split
(
coordinates
,
batchsize
)
energies
=
[]
forces
=
[]
for
s
,
c
in
tqdm
.
tqdm
(
zip
(
species
,
coordinates
),
total
=
len
(
species
),
position
=
1
,
desc
=
"batch of {}x{}"
.
format
(
*
shape
)):
for
s
,
c
in
zip
(
species
,
coordinates
):
_
,
e
=
model
((
s
,
c
))
f
,
=
torch
.
autograd
.
grad
(
e
.
sum
(),
c
)
energies
.
append
(
e
)
...
...
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