Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PuReMD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SParTA
PuReMD
Commits
57932522
Commit
57932522
authored
7 years ago
by
Kurt A. O'Hearn
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into sai.
parents
a531bdfe
f14d7ffd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/driver.py
+143
-1
143 additions, 1 deletion
tools/driver.py
tools/run_sim.py
+15
-7
15 additions, 7 deletions
tools/run_sim.py
with
158 additions
and
8 deletions
tools/driver.py
+
143
−
1
View file @
57932522
...
...
@@ -3,6 +3,123 @@
from
ctypes
import
*
class
BondOrderData
(
Structure
):
_fields_
=
[
(
"
BO
"
,
c_double
),
(
"
BO_s
"
,
c_double
),
(
"
BO_pi
"
,
c_double
),
(
"
BO_pi2
"
,
c_double
),
(
"
Cdbo
"
,
c_double
),
(
"
Cdbopi
"
,
c_double
),
(
"
Cdbopi2
"
,
c_double
),
(
"
C1dbo
"
,
c_double
),
(
"
C2dbo
"
,
c_double
),
(
"
C3dbo
"
,
c_double
),
(
"
C1dbopi
"
,
c_double
),
(
"
C2dbopi
"
,
c_double
),
(
"
C3dbopi
"
,
c_double
),
(
"
C4dbopi
"
,
c_double
),
(
"
C1dbopi2
"
,
c_double
),
(
"
C2dbopi2
"
,
c_double
),
(
"
C3dbopi2
"
,
c_double
),
(
"
C4dbopi2
"
,
c_double
),
(
"
dBOp
"
,
c_double
*
3
),
(
"
dln_BOp_s
"
,
c_double
*
3
),
(
"
dln_BOp_pi
"
,
c_double
*
3
),
(
"
dln_BOp_pi2
"
,
c_double
*
3
),
]
class
ThreeBodyData
(
Structure
):
_fields_
=
[
(
"
thb
"
,
c_int
),
(
"
pthb
"
,
c_int
),
(
"
theta
"
,
c_double
),
(
"
cos_theta
"
,
c_double
),
(
"
dcos_di
"
,
c_double
*
3
),
(
"
dcos_dj
"
,
c_double
*
3
),
(
"
dcos_dk
"
,
c_double
*
3
),
]
class
BondData
(
Structure
):
_fields_
=
[
(
"
nbr
"
,
c_int
),
(
"
sym_index
"
,
c_int
),
(
"
dbond_index
"
,
c_int
),
(
"
rel_box
"
,
c_int
*
3
),
(
"
d
"
,
c_double
),
(
"
dvec
"
,
c_double
*
3
),
(
"
bo_data
"
,
BondOrderData
),
]
class
DBondData
(
Structure
):
_fields_
=
[
(
"
wrt
"
,
c_int
),
(
"
dBO
"
,
c_double
*
3
),
(
"
dBOpi
"
,
c_double
*
3
),
(
"
dBOpi2
"
,
c_double
*
3
),
]
class
DDeltaData
(
Structure
):
_fields_
=
[
(
"
wrt
"
,
c_int
),
(
"
dVal
"
,
c_double
*
3
),
]
class
FarNbrData
(
Structure
):
_fields_
=
[
(
"
nbr
"
,
c_int
),
(
"
rel_box
"
,
c_int
*
3
),
(
"
d
"
,
c_double
),
(
"
dvec
"
,
c_double
*
3
),
]
class
NearNbrData
(
Structure
):
_fields_
=
[
(
"
nbr
"
,
c_int
),
(
"
rel_box
"
,
c_int
*
3
),
(
"
d
"
,
c_double
),
(
"
dvec
"
,
c_double
*
3
),
]
class
HBondData
(
Structure
):
_fields_
=
[
(
"
nbr
"
,
c_int
),
(
"
scl
"
,
c_int
),
(
"
ptr
"
,
POINTER
(
FarNbrData
)),
]
class
ReaxListSelector
(
Union
):
_fields_
=
[
(
"
v
"
,
c_void_p
),
(
"
three_body_interaction_data
"
,
POINTER
(
ThreeBodyData
)),
(
"
bond_data
"
,
POINTER
(
BondData
)),
(
"
dbond_data
"
,
POINTER
(
DBondData
)),
(
"
dDelta_data
"
,
POINTER
(
DDeltaData
)),
(
"
far_neighbor_data
"
,
POINTER
(
FarNbrData
)),
(
"
near_neighbor_data
"
,
POINTER
(
NearNbrData
)),
(
"
hbond_data
"
,
POINTER
(
HBondData
)),
]
class
ReaxList
(
Structure
):
_fields_
=
[
(
"
n
"
,
c_int
),
(
"
total_intrs
"
,
c_int
),
(
"
index
"
,
POINTER
(
c_int
)),
(
"
end_index
"
,
POINTER
(
c_int
)),
(
"
max_intrs
"
,
POINTER
(
c_int
)),
(
"
select
"
,
ReaxListSelector
),
]
class
Thermostat
(
Structure
):
_fields_
=
[
(
"
T
"
,
c_double
),
...
...
@@ -133,10 +250,35 @@ if __name__ == '__main__':
cleanup
.
argtypes
=
[
c_void_p
]
cleanup
.
restype
=
c_int
get_atoms
=
lib
.
get_atoms
get_atoms
.
argtypes
=
[
c_void_p
]
get_atoms
.
restype
=
POINTER
(
ReaxAtom
)
CALLBACKFUNC
=
CFUNCTYPE
(
None
,
POINTER
(
ReaxAtom
),
POINTER
(
SimulationData
),
POINTER
(
ReaxList
))
def
get_simulation_step_results
(
atoms
,
data
,
lists
):
print
(
"
{0:24.15f} {1:24.15f} {2:24.15f}
"
.
format
(
data
[
0
].
E_Tot
,
data
[
0
].
E_Kin
,
data
[
0
].
E_Pot
))
setup_callback
=
lib
.
setup_callback
setup_callback
.
restype
=
c_int
handle
=
setup
(
b
"
data/benchmarks/water/water_6540.pdb
"
,
b
"
data/benchmarks/water/ffield.water
"
,
b
"
environ/param.gpu.water
"
)
simulate
(
handle
)
ret
=
setup_callback
(
handle
,
CALLBACKFUNC
(
get_simulation_step_results
))
print
(
"
{0:24}|{1:24}|{2:24}
"
.
format
(
"
Total Energy
"
,
"
Kinetic Energy
"
,
"
Potential Energy
"
))
ret
=
simulate
(
handle
)
atoms
=
get_atoms
(
handle
)
print
()
print
(
"
{0:9}|{1:24}|{2:24}|{3:24}|{4:24}
"
.
format
(
"
Atom Num
"
,
"
x-Position
"
,
"
y-Position
"
,
"
z-Position
"
,
"
Charge
"
))
for
i
in
range
(
10
):
print
(
"
{0:9d} {1:24.15f} {2:24.15f} {3:24.15f} {4:24.15f}
"
.
format
(
i
+
1
,
atoms
[
i
].
x
[
0
],
atoms
[
i
].
x
[
1
],
atoms
[
i
].
x
[
2
],
atoms
[
i
].
q
))
cleanup
(
handle
)
This diff is collapsed.
Click to expand it.
tools/run_sim.py
+
15
−
7
View file @
57932522
...
...
@@ -79,9 +79,11 @@ class TestCase():
fp_temp
.
write
(
lines
)
fp_temp
.
close
()
def
run
(
self
,
bin_file
=
'
sPuReMD/bin/spuremd
'
,
process_results
=
False
):
base_dir
=
getcwd
()
bin_path
=
path
.
join
(
base_dir
,
bin_file
)
def
run
(
self
,
binary
,
process_results
=
False
):
args
=
binary
.
split
()
args
.
append
(
self
.
__geo_file
)
args
.
append
(
self
.
__ffield_file
)
args
.
append
(
""
)
env
=
dict
(
environ
)
write_header
=
True
...
...
@@ -111,14 +113,13 @@ class TestCase():
+
'
_paji
'
+
param_dict
[
'
cm_solver_pre_app_jacobi_iters
'
]
\
+
'
_t
'
+
param_dict
[
'
threads
'
]
if
not
process_results
:
self
.
_setup
(
param_dict
,
temp_file
)
env
[
'
OMP_NUM_THREADS
'
]
=
param_dict
[
'
threads
'
]
start
=
time
()
proc_handle
=
Popen
([
bin_path
,
self
.
__geo_file
,
self
.
__ffield_file
,
temp_file
],
stdout
=
PIPE
,
stderr
=
PIPE
,
env
=
env
,
universal_newlines
=
True
)
args
[
-
1
]
=
temp_file
proc_handle
=
Popen
(
args
,
stdout
=
PIPE
,
stderr
=
PIPE
,
env
=
env
,
universal_newlines
=
True
)
stdout
,
stderr
=
proc_handle
.
communicate
()
stop
=
time
()
if
proc_handle
.
returncode
<
0
:
...
...
@@ -202,6 +203,8 @@ if __name__ == '__main__':
]
parser
=
argparse
.
ArgumentParser
(
description
=
'
Run molecular dynamics simulations on specified data sets.
'
)
parser
.
add_argument
(
'
-b
'
,
'
--binary
'
,
metavar
=
'
binary
'
,
default
=
None
,
nargs
=
1
,
help
=
'
Binary file to run.
'
)
parser
.
add_argument
(
'
-f
'
,
'
--out_file
'
,
metavar
=
'
out_file
'
,
default
=
None
,
nargs
=
1
,
help
=
'
Output file to write results.
'
)
parser
.
add_argument
(
'
-r
'
,
'
--process_results
'
,
default
=
False
,
action
=
'
store_true
'
,
...
...
@@ -250,6 +253,11 @@ if __name__ == '__main__':
else
:
result_file
=
'
result.txt
'
if
args
.
binary
:
binary
=
args
.
binary
[
0
]
else
:
binary
=
path
.
join
(
base_dir
,
'
sPuReMD/bin/spuremd
'
)
# overwrite default params, if supplied via command line args
if
args
.
params
:
for
param
in
args
.
params
:
...
...
@@ -342,4 +350,4 @@ if __name__ == '__main__':
geo_format
=
[
'
1
'
],
result_file
=
result_file
))
for
test
in
test_cases
:
test
.
run
(
bin
_file
=
'
sPuReMD/bin/spuremd
'
,
process_results
=
args
.
process_results
)
test
.
run
(
bin
ary
,
process_results
=
args
.
process_results
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment