Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65548444
trivial.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 4, 14:37
Size
793 B
Mime Type
text/x-python
Expires
Thu, Jun 6, 14:37 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18092289
Attached To
rLAMMPS lammps
trivial.py
View Options
#!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# trivial.py
# Purpose: run a LAMMPS input script via Python
# Syntax: trivial.py in.lammps
# in.lammps = LAMMPS input script
import
sys
# parse command line
argv
=
sys
.
argv
if
len
(
argv
)
!=
2
:
print
"Syntax: trivial.py in.lammps"
sys
.
exit
()
infile
=
sys
.
argv
[
1
]
me
=
0
# uncomment if running in parallel via Pypar
#import pypar
#me = pypar.rank()
#nprocs = pypar.size()
from
lammps
import
lammps
lmp
=
lammps
()
# run infile all at once
lmp
.
file
(
infile
)
# run infile one line at a time
#lines = open(infile,'r').readlines()
#for line in lines: lmp.command(line)
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()
Event Timeline
Log In to Comment