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
0efaa1fa
Commit
0efaa1fa
authored
4 years ago
by
Kurt A. O'Hearn
Browse files
Options
Downloads
Patches
Plain Diff
Tools: update example Python driver.
parent
1dd63505
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/driver.py
+28
-42
28 additions, 42 deletions
tools/driver.py
with
28 additions
and
42 deletions
tools/driver.py
+
28
−
42
View file @
0efaa1fa
...
@@ -99,37 +99,6 @@ class HBondData(Structure):
...
@@ -99,37 +99,6 @@ class HBondData(Structure):
]
]
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
)),
(
"
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
Thermostat
(
Structure
):
class
Thermostat
(
Structure
):
_fields_
=
[
_fields_
=
[
(
"
T
"
,
c_double
),
(
"
T
"
,
c_double
),
...
@@ -405,12 +374,17 @@ if __name__ == '__main__':
...
@@ -405,12 +374,17 @@ if __name__ == '__main__':
reset
.
argtypes
=
[
c_void_p
,
c_char_p
,
c_char_p
,
c_char_p
]
reset
.
argtypes
=
[
c_void_p
,
c_char_p
,
c_char_p
,
c_char_p
]
reset
.
restype
=
c_int
reset
.
restype
=
c_int
get_atoms
=
lib
.
get_atoms
get_atom_positions
=
lib
.
get_atom_positions
get_atoms
.
argtypes
=
[
c_void_p
]
get_atom_positions
.
argtypes
=
[
c_void_p
,
POINTER
(
c_double
),
get_atoms
.
restype
=
POINTER
(
ReaxAtom
)
POINTER
(
c_double
),
POINTER
(
c_double
)]
get_atom_positions
.
restype
=
c_int
get_atom_charges
=
lib
.
get_atom_charges
get_atom_charges
.
argtypes
=
[
c_void_p
,
POINTER
(
c_double
)]
get_atom_charges
.
restype
=
c_int
CALLBACKFUNC
=
CFUNCTYPE
(
None
,
POINTER
(
ReaxAtom
),
CALLBACKFUNC
=
CFUNCTYPE
(
None
,
c_int
,
POINTER
(
ReaxAtom
),
POINTER
(
SimulationData
)
,
POINTER
(
POINTER
(
ReaxList
))
)
POINTER
(
SimulationData
))
setup_callback
=
lib
.
setup_callback
setup_callback
=
lib
.
setup_callback
setup_callback
.
argtypes
=
[
c_void_p
,
CALLBACKFUNC
]
setup_callback
.
argtypes
=
[
c_void_p
,
CALLBACKFUNC
]
...
@@ -430,7 +404,7 @@ if __name__ == '__main__':
...
@@ -430,7 +404,7 @@ if __name__ == '__main__':
record_trajectory
=
False
record_trajectory
=
False
record_performance
=
True
record_performance
=
True
def
get_simulation_step_results
(
atoms
,
data
,
lists
):
def
get_simulation_step_results
(
num_atoms
,
atoms
,
data
):
print
(
"
{0:24.15f} {1:24.15f} {2:24.15f}
"
.
format
(
print
(
"
{0:24.15f} {1:24.15f} {2:24.15f}
"
.
format
(
data
[
0
].
E_Tot
,
data
[
0
].
E_Kin
,
data
[
0
].
E_Pot
))
data
[
0
].
E_Tot
,
data
[
0
].
E_Kin
,
data
[
0
].
E_Pot
))
...
@@ -454,7 +428,7 @@ if __name__ == '__main__':
...
@@ -454,7 +428,7 @@ if __name__ == '__main__':
if
record_trajectory
:
if
record_trajectory
:
with
conn
:
with
conn
:
for
i
in
range
(
6540
):
for
i
in
range
(
num_atoms
):
conn
.
execute
(
"
INSERT INTO trajectory VALUES (?,?,?,?,?,?,?)
"
,
conn
.
execute
(
"
INSERT INTO trajectory VALUES (?,?,?,?,?,?,?)
"
,
(
data
[
0
].
sim_id
,
data
[
0
].
step
,
i
,
atoms
[
i
].
x
[
0
],
atoms
[
i
].
x
[
1
],
(
data
[
0
].
sim_id
,
data
[
0
].
step
,
i
,
atoms
[
i
].
x
[
0
],
atoms
[
i
].
x
[
1
],
atoms
[
i
].
x
[
2
],
atoms
[
i
].
q
))
atoms
[
i
].
x
[
2
],
atoms
[
i
].
q
))
...
@@ -482,13 +456,19 @@ if __name__ == '__main__':
...
@@ -482,13 +456,19 @@ if __name__ == '__main__':
print
(
"
{0:24}|{1:24}|{2:24}
"
.
format
(
"
Total Energy
"
,
"
Kinetic Energy
"
,
"
Potential Energy
"
))
print
(
"
{0:24}|{1:24}|{2:24}
"
.
format
(
"
Total Energy
"
,
"
Kinetic Energy
"
,
"
Potential Energy
"
))
ret
=
simulate
(
handle
)
ret
=
simulate
(
handle
)
atoms
=
get_atoms
(
handle
)
x
=
(
c_double
*
6540
)()
y
=
(
c_double
*
6540
)()
z
=
(
c_double
*
6540
)()
atoms
=
get_atom_positions
(
handle
,
x
,
y
,
z
)
q
=
(
c_double
*
6540
)()
atoms
=
get_atom_charges
(
handle
,
q
)
print
()
print
()
print
(
"
{0:9}|{1:24}|{2:24}|{3:24}|{4:24}
"
.
format
(
"
Atom Num
"
,
"
x-Position
"
,
"
y-Position
"
,
"
z-Position
"
,
"
Charge
"
))
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
):
for
i
in
range
(
10
):
print
(
"
{0:9d} {1:24.15f} {2:24.15f} {3:24.15f} {4:24.15f}
"
.
format
(
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
))
i
+
1
,
x
[
i
],
y
[
i
],
z
[
i
],
q
[
i
]))
ret
=
reset
(
handle
,
b
"
data/benchmarks/silica/silica_6000.pdb
"
,
ret
=
reset
(
handle
,
b
"
data/benchmarks/silica/silica_6000.pdb
"
,
b
"
data/benchmarks/silica/ffield-bio
"
,
b
"
data/benchmarks/silica/ffield-bio
"
,
...
@@ -498,13 +478,19 @@ if __name__ == '__main__':
...
@@ -498,13 +478,19 @@ if __name__ == '__main__':
print
(
"
{0:24}|{1:24}|{2:24}
"
.
format
(
"
Total Energy
"
,
"
Kinetic Energy
"
,
"
Potential Energy
"
))
print
(
"
{0:24}|{1:24}|{2:24}
"
.
format
(
"
Total Energy
"
,
"
Kinetic Energy
"
,
"
Potential Energy
"
))
ret
=
simulate
(
handle
)
ret
=
simulate
(
handle
)
atoms
=
get_atoms
(
handle
)
x
=
(
c_double
*
6000
)()
y
=
(
c_double
*
6000
)()
z
=
(
c_double
*
6000
)()
atoms
=
get_atom_positions
(
handle
,
x
,
y
,
z
)
q
=
(
c_double
*
6000
)()
atoms
=
get_atom_charges
(
handle
,
q
)
print
()
print
()
print
(
"
{0:9}|{1:24}|{2:24}|{3:24}|{4:24}
"
.
format
(
"
Atom Num
"
,
"
x-Position
"
,
"
y-Position
"
,
"
z-Position
"
,
"
Charge
"
))
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
):
for
i
in
range
(
10
):
print
(
"
{0:9d} {1:24.15f} {2:24.15f} {3:24.15f} {4:24.15f}
"
.
format
(
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
))
i
+
1
,
x
[
i
],
y
[
i
],
z
[
i
],
q
[
i
]))
conn
.
close
()
conn
.
close
()
cleanup
(
handle
)
cleanup
(
handle
)
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