git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14326 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-12-09 21:09:50 +00:00
parent 582ba55e4a
commit e000e4a04f
5 changed files with 16277 additions and 27 deletions

View File

@ -2,9 +2,24 @@
# preceeding line should have path for Python on your machine
# simple.py
# Purpose: mimic operation of couple/simple/simple.cpp via Python
# Syntax: simple.py in.lammps
# in.lammps = LAMMPS input script
# Purpose: mimic operation of examples/COUPLE/simple/simple.cpp via Python
# Serial syntax: simple.py in.lammps
# in.lammps = LAMMPS input script
# Parallel syntax: mpirun -np 4 simple.py in.lammps
# in.lammps = LAMMPS input script
# if run in parallel with script as-is:
# will invoke P instances of a one-processor run
# both Python and LAMMPS will run on single processors
# each will read same input file, write to same log.lammps file (bad)
# if run in parallel after uncommening either Pypar or mpi4py sections below:
# will invoke 1 instance of a P-processor run
# both Python and LAMMPS will run in parallel
# see the split.py example for how to use multiple procs
# to run multiple LAMMPS jobs, each on a subset of procs
import sys
@ -19,11 +34,16 @@ infile = sys.argv[1]
me = 0
# uncomment if running in parallel via Pypar
# uncomment this if running in parallel via Pypar
#import pypar
#me = pypar.rank()
#nprocs = pypar.size()
# uncomment this if running in parallel via mpi4py
#from mpi4py import MPI
#me = MPI.COMM_WORLD.Get_rank()
#nprocs = MPI.COMM_WORLD.Get_size()
from lammps import lammps
lmp = lammps()
@ -54,3 +74,7 @@ print "Force on 1 atom via extract_variable:",fx[0]
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()
# uncomment if running in parallel via mpi4py
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#MPI.Finalize()