1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
--- /lammps/python/examples/simple.py 2019-09-20 09:51:15.000000000 -0600
+++ /lammps/python/examples/simple.py 2019-09-23 16:58:28.950720810 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/env python -i
+#!/usr/bin/python3
# preceding line should have path for Python on your machine
# simple.py
@@ -28,12 +28,12 @@
me = 0
# 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 mpi4py import MPI
+me = MPI.COMM_WORLD.Get_rank()
+nprocs = MPI.COMM_WORLD.Get_size()
from lammps import lammps
-lmp = lammps()
+lmp = lammps("mpi")
# run infile one line at a time
@@ -85,7 +85,7 @@
# test of new gather/scatter and box extract/reset methods
# can try this in parallel and with/without atom_modify sort enabled
-lmp.command("write_dump all custom tmp.simple id type x y z fx fy fz");
+#lmp.command("write_dump all custom tmp.simple id type x y z fx fy fz");
x = lmp.gather_atoms("x",1,3)
f = lmp.gather_atoms("f",1,3)
@@ -123,10 +123,10 @@
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)
-lmp.reset_box([0,0,0],[10,10,8],0,0,0)
+#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)
+#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 mpi4py
-#print("Proc %d out of %d procs has" % (me,nprocs), lmp)
+print("Proc %d out of %d procs has" % (me,nprocs), lmp)
--- /lammps/python/examples/in.simple 2019-10-02 16:09:55.198770328 -0600
+++ /lammps/python/examples/in.simple 2019-10-02 16:10:21.263332834 -0600
@@ -5,7 +5,7 @@ atom_style atomic
atom_modify map array
lattice fcc 0.8442
-region box block 0 4 0 4 0 4
+region box block 0 120 0 120 0 120
create_box 1 box
create_atoms 1 box
mass 1 1.0
|