From 400b55e6d54fa1a1e96d9e1f615e82510fceeb02 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 1 Jun 2021 17:51:06 -0400 Subject: [PATCH] Remove mentions of Pypar --- python/README | 25 +++++++++++++------------ python/examples/.gitignore | 1 + python/examples/matplotlib_plot.py | 17 +++++++---------- python/examples/simple.py | 10 +--------- 4 files changed, 22 insertions(+), 31 deletions(-) create mode 100644 python/examples/.gitignore diff --git a/python/README b/python/README index 204ca2c28d..0757a84cd6 100644 --- a/python/README +++ b/python/README @@ -38,13 +38,14 @@ Once you have successfully wrapped LAMMPS, you can run the Python scripts in the examples sub-directory: trivial.py read/run a LAMMPS input script thru Python -demo.py invoke various LAMMPS library interface routines -simple.py parallel example, mimicing examples/COUPLE/simple/simple.cpp +demo.py invoke various LAMMPS library interface routines +simple.py parallel example, mimicing examples/COUPLE/simple/simple.cpp split.py parallel example mc.py Monte Carlo energy relaxation wrapper on LAMMPS -gui.py GUI go/stop/temperature-slider to control LAMMPS -plot.py real-time temperature plot with GnuPlot via Pizza.py -viz_tool.py real-time viz via some viz package +gui.py GUI go/stop/temperature-slider to control LAMMPS +plot.py real-time temperature plot with GnuPlot via Pizza.py +matplotlib_plot.py real-time temperature plot with Matplotlib via Pizza.py +viz_tool.py real-time viz via some viz package vizplotgui_tool.py combination of viz.py and plot.py and gui.py For the viz_tool.py and vizplotgui_tool.py commands, replace "tool" @@ -100,24 +101,24 @@ split.py in.simple # can run in parallel (see below) gui.py in.gui 100 plot.py in.plot 10 1000 thermo_temp +matplotlib_plot.py in.plot 10 1000 thermo_temp viz_tool.py in.viz 100 5000 vizplotgui_tool.py in.viz 100 thermo_temp To run LAMMPS in parallel from Python, so something like this: -% mpirun -np 4 simple.py in.simple -% mpirun -np 4 python split.py in.simple +% mpirun -np P simple.py in.simple +% mpirun -np P python split.py in.simple If you run simple.py as-is, this will invoke P instances of a one-processor run, where both Python and LAMMPS will run on single processors. Each running job will read the same input file, and write to same log.lammps file, which isn't too useful. -However, if you have either the Pypar or mpi4py packages installed in -your Python, and uncomment the Pypar or mpi4py code in simple.py, then -the above commands will invoke 1 instance of a P-processor run. Both -Python and LAMMPS will run on P processors. The job will read the -input file and write a single log.lammps file. +However, if you have the mpi4py Python package installed and uncomment mpi4py +code in simple.py, then the above commands will invoke 1 instance of a +P-processor run. Both Python and LAMMPS will run on P processors. The job will +read the input file and write a single log.lammps file. The split.py script can also be run in parallel. It uses mpi4py version 2.0.0 (or later), which makes it possible to pass a diff --git a/python/examples/.gitignore b/python/examples/.gitignore new file mode 100644 index 0000000000..ee4173f0a4 --- /dev/null +++ b/python/examples/.gitignore @@ -0,0 +1 @@ +/tmp* diff --git a/python/examples/matplotlib_plot.py b/python/examples/matplotlib_plot.py index af0a452130..972a035b4f 100755 --- a/python/examples/matplotlib_plot.py +++ b/python/examples/matplotlib_plot.py @@ -28,10 +28,10 @@ nsteps = int(sys.argv[3]) compute = sys.argv[4] me = 0 -# uncomment 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() @@ -82,11 +82,8 @@ while ntimestep < nsteps: lmp.command("run 0 pre no post yes") -# uncomment if running in parallel via Pypar +# uncomment if running in parallel via mpi4py #print("Proc %d out of %d procs has" % (me,nprocs), lmp) -#pypar.finalize() -if sys.version_info[0] == 3: - input("Press Enter to exit...") -else: - raw_input("Press Enter to exit...") +if me == 0: + input("Press Enter to exit...") diff --git a/python/examples/simple.py b/python/examples/simple.py index 9f85d8b4df..861a208895 100755 --- a/python/examples/simple.py +++ b/python/examples/simple.py @@ -9,7 +9,7 @@ # Parallel syntax: mpirun -np 4 simple.py in.lammps # in.lammps = LAMMPS input script -# also need to uncomment either Pypar or mpi4py sections below +# also need to uncomment mpi4py sections below from __future__ import print_function import sys @@ -27,11 +27,6 @@ infile = sys.argv[1] me = 0 -# 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() @@ -133,8 +128,5 @@ lmp.reset_box([0,0,0],[10,10,8],0,0,0) boxlo,boxhi,xy,yz,xz,periodicity,box_change = lmp.extract_box() if me == 0: print("Box info",boxlo,boxhi,xy,yz,xz,periodicity,box_change) -# uncomment if running in parallel via Pypar -#print("Proc %d out of %d procs has" % (me,nprocs), lmp) - # uncomment if running in parallel via mpi4py #print("Proc %d out of %d procs has" % (me,nprocs), lmp)