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

This commit is contained in:
sjplimp 2010-11-02 15:07:40 +00:00
parent b63b44e274
commit 453aba29e5
23 changed files with 5263 additions and 0 deletions

47
python/README Normal file
View File

@ -0,0 +1,47 @@
This directory contains Python code which wraps LAMMPS as a library
and allows the library interface to be invoked from a Python, either
from a script or interactively.
Details on how to build and use this Python interface are given in
doc/Section_python.html.
Basically you have to extend the Python on your box to include the
LAMMPS wrappers:
python setup_serial.py build # for serial LAMMPS and Python
sudo python setup_serial.py install
python setup.py build # for parallel LAMMPS and Python
sudo python setuppy install
but there are several issues to be aware of, as discussed in the doc
pages.
-------------------------------------------------------------------
Once you have successfully built and tested the wrappers, 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 mimic operation of couple/simple/simple.cpp in Python
gui.py GUI go/stop/temperature-slider to control LAMMPS
plot.py real-time temeperature plot with GnuPlot via Pizza.py
viz.py real-time viz from GL tool in Pizza.py
vizplotgui.py combination of viz.py and plot.py and gui.py
Run them with the following input scripts and arguments:
trivial.py in.trivial
demo.py
simple.py in.simple
gui.py in.gui 100
plot.py in.plot 10 1000 thermo_temp
viz.py in.viz 100 5000
vizplotgui.py in.viz 100 thermo_temp
You can un-comment the Pypar calls if you want to run these in
parallel.
Each script has more documentation at the top of the file that
explains how to use it.

66
python/examples/demo.py Executable file
View File

@ -0,0 +1,66 @@
#!/usr/local/bin/python -i
# preceeding line should have path for Python on your machine
# demo.py
# Purpose: illustrate use of many library interface commands
# Syntax: demo.py
# uses in.demo as LAMMPS input script
import sys
# parse command line
argv = sys.argv
if len(argv) != 1:
print "Syntax: demo.py"
sys.exit()
me = 0
# uncomment if running in parallel via Pypar
#import pypar
#me = pypar.rank()
#nprocs = pypar.size()
from lammps import lammps
from lammps import LMPINT as INT
from lammps import LMPDOUBLE as DOUBLE
from lammps import LMPIPTR as IPTR
from lammps import LMPDPTR as DPTR
from lammps import LMPDPTRPTR as DPTRPTR
lmp = lammps()
# test out various library functions after running in.demo
lmp.file("in.demo")
if me == 0: print "\nPython output:"
natoms = lmp.extract_global("natoms",DOUBLE)
mass = lmp.extract_atom("mass",DPTR)
x = lmp.extract_atom("x",DPTRPTR)
print "Natoms, mass, x[0][0] coord =",natoms,mass[1],x[0][0]
temp = lmp.extract_compute("thermo_temp",0,0)
print "Temperature from compute =",temp
eng = lmp.extract_variable("eng",None,0)
print "Energy from equal-style variable =",eng
vy = lmp.extract_variable("vy","all",1)
print "Velocity component from atom-style variable =",vy[1]
natoms = lmp.get_natoms()
print "Natoms from get_natoms =",natoms
xc = lmp.get_coords()
print "Global coords from get_coords =",xc[0],xc[1],xc[31]
xc[0] = xc[0] + 1.0
lmp.put_coords(xc)
print "Changed x[0][0] via put_coords =",x[0][0]
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()

109
python/examples/gui.py Executable file
View File

@ -0,0 +1,109 @@
#!/usr/local/bin/python -i
# preceeding line should have path for Python on your machine
# gui.py
# Purpose: control a continuously running LAMMPS simulation via a Tkinter GUI
# Syntax: gui.py in.lammps Nfreq
# in.lammps = LAMMPS input script
# Nfreq = query GUI every this many steps
import sys,time
# methods called by GUI
def go():
global runflag
runflag = 1
def stop():
global runflag
runflag = 0
def settemp(value):
global temptarget
temptarget = slider.get()
def quit():
global breakflag
breakflag = 1
# parse command line
argv = sys.argv
if len(argv) != 3:
print "Syntax: gui.py in.lammps Nfreq"
sys.exit()
infile = sys.argv[1]
nfreq = int(sys.argv[2])
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
# assumed to have no run command in it
lmp.file(infile)
lmp.command("thermo %d" % nfreq)
# display GUI with go/stop/quit buttons and slider for temperature
# just proc 0 handles GUI
breakflag = 0
runflag = 0
temptarget = 1.0
if me == 0:
from Tkinter import *
tkroot = Tk()
tkroot.withdraw()
root = Toplevel(tkroot)
root.title("LAMMPS GUI")
frame = Frame(root)
Button(frame,text="Go",command=go).pack(side=LEFT)
Button(frame,text="Stop",command=stop).pack(side=LEFT)
slider = Scale(frame,from_=0.0,to=5.0,resolution=0.1,
orient=HORIZONTAL,label="Temperature")
slider.bind('<ButtonRelease-1>',settemp)
slider.set(temptarget)
slider.pack(side=LEFT)
Button(frame,text="Quit",command=quit).pack(side=RIGHT)
frame.pack()
tkroot.update()
# endless loop, checking status of GUI settings every Nfreq steps
# run with pre yes/no and post yes/no depending on go/stop status
# re-invoke fix langevin with new seed when temperature slider changes
# after re-invoke of fix langevin, run with pre yes
running = 0
temp = temptarget
seed = 12345
lmp.command("fix 2 all langevin %g %g 0.1 %d" % (temp,temp,seed))
while 1:
if me == 0: tkroot.update()
if temp != temptarget:
temp = temptarget
seed += me+1
lmp.command("fix 2 all langevin %g %g 0.1 %d" % (temp,temp,seed))
running = 0
if runflag and running:
lmp.command("run %d pre no post no" % nfreq)
elif runflag and not running:
lmp.command("run %d pre yes post no" % nfreq)
elif not runflag and running:
lmp.command("run %d pre no post yes" % nfreq)
if breakflag: break
if runflag: running = 1
else: running = 0
time.sleep(0.01)
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()

26
python/examples/in.demo Normal file
View File

@ -0,0 +1,26 @@
# 3d Lennard-Jones melt
units lj
atom_style atomic
atom_modify map hash
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 20 check no
fix 1 all nve
variable eng equal pe
variable vy atom vy
run 100

24
python/examples/in.gui Normal file
View File

@ -0,0 +1,24 @@
# 3d Lennard-Jones melt
units lj
dimension 2
atom_style atomic
lattice sq2 0.8442
region box block 0 30 0 15 -0.5 0.5
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 1 check yes
timestep 0.003
fix 1 all nve
fix 3 all enforce2d

0
python/examples/in.lj Normal file
View File

24
python/examples/in.plot Normal file
View File

@ -0,0 +1,24 @@
# 3d Lennard-Jones melt
units lj
dimension 2
atom_style atomic
lattice sq2 0.8442
region box block 0 30 0 15 -0.5 0.5
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 1 check yes
timestep 0.003
fix 1 all nve
fix 3 all enforce2d

23
python/examples/in.simple Normal file
View File

@ -0,0 +1,23 @@
# 3d Lennard-Jones melt
units lj
atom_style atomic
atom_modify map array
lattice fcc 0.8442
region box block 0 4 0 4 0 4
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 20 check no
fix 1 all nve
run 10

View File

@ -0,0 +1,22 @@
# 3d Lennard-Jones melt
units lj
atom_style atomic
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 20 check no
fix 1 all nve
run 100

24
python/examples/in.viz Normal file
View File

@ -0,0 +1,24 @@
# 3d Lennard-Jones melt
units lj
dimension 2
atom_style atomic
lattice sq2 0.8442
region box block 0 30 0 15 -0.5 0.5
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 1 check yes
timestep 0.003
fix 1 all nve
fix 3 all enforce2d

906
python/examples/log.lammps Normal file
View File

@ -0,0 +1,906 @@
LAMMPS (31 Oct 2010)
# 3d Lennard-Jones melt
units lj
dimension 2
atom_style atomic
lattice sq2 0.8442
Lattice spacing in x,y,z = 1.53919 1.53919 1.53919
region box block 0 30 0 15 -0.5 0.5
create_box 1 box
Created orthogonal box = (0 0 -0.769595) to (46.1757 23.0879 0.769595)
1 by 1 by 1 processor grid
create_atoms 1 box
Created 900 atoms
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 1 check yes
timestep 0.003
fix 1 all nve
fix 3 all enforce2d
thermo 100
fix 2 all langevin 1 1 0.1 12345
run 100 pre yes post no
Memory usage per processor = 1.67412 Mbytes
Step Temp E_pair E_mol TotEng Press
0 1.44 -2.6248859 0 -1.1864859 2.0176244
100 0.99023288 -2.0005395 0 -1.0114069 5.9914427
Loop time of 0.04617 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
100 0.99023288 -2.0005395 0 -1.0114069 5.9914427
200 1.0641026 -2.126693 0 -1.0637727 5.3834133
Loop time of 0.045666 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
200 1.0641026 -2.126693 0 -1.0637727 5.3834133
300 1.0404544 -2.1182885 0 -1.0789901 5.4751694
Loop time of 0.0448651 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
300 1.0404544 -2.1182885 0 -1.0789901 5.4751694
400 0.9940782 -2.0913772 0 -1.0984035 5.7006406
Loop time of 0.044888 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
400 0.9940782 -2.0913772 0 -1.0984035 5.7006406
500 1.0533477 -2.1766862 0 -1.1245089 5.1818937
Loop time of 0.0443962 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
500 1.0533477 -2.1766862 0 -1.1245089 5.1818937
600 1.0371191 -2.1708671 0 -1.1349004 5.2128526
Loop time of 0.0447521 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
600 1.0371191 -2.1708671 0 -1.1349004 5.2128526
700 1.0178469 -2.1795112 0 -1.1627952 5.0714199
Loop time of 0.0448291 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
700 1.0178469 -2.1795112 0 -1.1627952 5.0714199
800 1.0220115 -2.1753909 0 -1.1545149 5.1482844
Loop time of 0.044615 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
800 1.0220115 -2.1753909 0 -1.1545149 5.1482844
900 1.0029029 -2.1674923 0 -1.1657037 5.1338534
Loop time of 0.0446992 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
900 1.0029029 -2.1674923 0 -1.1657037 5.1338534
1000 1.0400785 -2.1739867 0 -1.1350638 5.1279779
Loop time of 0.0448501 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1000 1.0400785 -2.1739867 0 -1.1350638 5.1279779
1100 1.0248051 -2.1763751 0 -1.1527087 5.125636
Loop time of 0.0447941 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1100 1.0248051 -2.1763751 0 -1.1527087 5.125636
1200 1.0129247 -2.1960205 0 -1.1842213 4.9280331
Loop time of 0.0442801 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1200 1.0129247 -2.1960205 0 -1.1842213 4.9280331
1300 1.0445891 -2.138322 0 -1.0948936 5.358069
Loop time of 0.044374 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1300 1.0445891 -2.138322 0 -1.0948936 5.358069
1400 1.0262085 -2.1210161 0 -1.0959478 5.5887816
Loop time of 0.044693 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1400 1.0262085 -2.1210161 0 -1.0959478 5.5887816
1500 0.9862776 -2.1287449 0 -1.1435631 5.4408715
Loop time of 0.0446811 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1500 0.9862776 -2.1287449 0 -1.1435631 5.4408715
1600 1.0008092 -2.1637199 0 -1.1640227 5.2714443
Loop time of 0.0442421 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1600 1.0008092 -2.1637199 0 -1.1640227 5.2714443
1700 1.0258515 -2.1288392 0 -1.1041276 5.4565262
Loop time of 0.0446551 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1700 1.0258515 -2.1288392 0 -1.1041276 5.4565262
1800 0.99606403 -2.1881474 0 -1.1931901 5.0145909
Loop time of 0.0446119 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1800 0.99606403 -2.1881474 0 -1.1931901 5.0145909
1900 0.98665733 -2.1993707 0 -1.2138096 4.9672864
Loop time of 0.044836 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
1900 0.98665733 -2.1993707 0 -1.2138096 4.9672864
2000 1.0155716 -2.1239518 0 -1.1095086 5.4592445
Loop time of 0.044791 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2000 1.0155716 -2.1239518 0 -1.1095086 5.4592445
2100 0.9688746 -2.1712503 0 -1.2034522 5.1417376
Loop time of 0.0446949 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2100 0.9688746 -2.1712503 0 -1.2034522 5.1417376
2200 1.0162371 -2.1732231 0 -1.1581152 5.1108471
Loop time of 0.0448599 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2200 1.0162371 -2.1732231 0 -1.1581152 5.1108471
2300 1.0245646 -2.1552369 0 -1.1318107 5.3316927
Loop time of 0.0446439 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2300 1.0245646 -2.1552369 0 -1.1318107 5.3316927
2400 1.0532627 -2.168732 0 -1.1166396 5.2318175
Loop time of 0.044234 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2400 1.0532627 -2.168732 0 -1.1166396 5.2318175
2500 1.0110981 -2.1283041 0 -1.1183294 5.470307
Loop time of 0.044275 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2500 1.0110981 -2.1283041 0 -1.1183294 5.470307
2600 0.99966902 -2.1728149 0 -1.1742566 5.1412453
Loop time of 0.044683 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2600 0.99966902 -2.1728149 0 -1.1742566 5.1412453
2700 0.99239191 -2.1637551 0 -1.1724659 5.2165707
Loop time of 0.0447261 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2700 0.99239191 -2.1637551 0 -1.1724659 5.2165707
2800 1.0301978 -2.1548308 0 -1.1257777 5.2638595
Loop time of 0.044596 on 1 procs for 100 steps with 900 atoms
fix 2 all langevin 5 5 0.1 12346
run 100 pre yes post no
Memory usage per processor = 1.67412 Mbytes
Step Temp E_pair E_mol TotEng Press
2800 1.0227564 -2.1548308 0 -1.1332108 5.2575845
2900 5.0485455 -0.28277455 0 4.7601615 20.746781
Loop time of 0.0470662 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
2900 5.0485455 -0.28277455 0 4.7601615 20.746781
3000 4.8862233 -0.017789501 0 4.8630047 22.592756
Loop time of 0.048033 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3000 4.8862233 -0.017789501 0 4.8630047 22.592756
3100 4.9044567 -0.47959211 0 4.4194152 19.583353
Loop time of 0.0480561 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3100 4.9044567 -0.47959211 0 4.4194152 19.583353
3200 5.0879915 -0.14346616 0 4.938872 21.75943
Loop time of 0.047853 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3200 5.0879915 -0.14346616 0 4.938872 21.75943
3300 4.8191113 -0.12521782 0 4.688539 21.66605
Loop time of 0.0484211 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3300 4.8191113 -0.12521782 0 4.688539 21.66605
3400 5.1800461 -0.14238575 0 5.0319048 21.79606
Loop time of 0.0481231 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3400 5.1800461 -0.14238575 0 5.0319048 21.79606
3500 5.0607641 -0.16081652 0 4.8943245 21.486658
Loop time of 0.0485091 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3500 5.0607641 -0.16081652 0 4.8943245 21.486658
3600 5.3373422 -0.41828575 0 4.9131261 20.14676
Loop time of 0.0482152 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3600 5.3373422 -0.41828575 0 4.9131261 20.14676
3700 5.3202661 -0.30023033 0 5.0141243 20.855754
Loop time of 0.0481288 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3700 5.3202661 -0.30023033 0 5.0141243 20.855754
3800 4.8588585 -0.10399834 0 4.7494614 21.771522
Loop time of 0.0481648 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3800 4.8588585 -0.10399834 0 4.7494614 21.771522
3900 4.9193657 0.060661037 0 4.9745608 22.688265
Loop time of 0.0485899 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
3900 4.9193657 0.060661037 0 4.9745608 22.688265
4000 4.9689317 -0.135649 0 4.8277616 21.630946
Loop time of 0.0486522 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4000 4.9689317 -0.135649 0 4.8277616 21.630946
4100 5.0796995 -0.42489129 0 4.6491641 19.912881
Loop time of 0.047446 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4100 5.0796995 -0.42489129 0 4.6491641 19.912881
4200 4.9121803 -0.26921478 0 4.6375075 20.682997
Loop time of 0.047961 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4200 4.9121803 -0.26921478 0 4.6375075 20.682997
4300 5.2480878 -0.25203366 0 4.9902229 21.055825
Loop time of 0.048105 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4300 5.2480878 -0.25203366 0 4.9902229 21.055825
4400 5.1754321 -0.1379211 0 5.0317606 21.721423
Loop time of 0.0476389 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4400 5.1754321 -0.1379211 0 5.0317606 21.721423
4500 4.8163772 -0.13665697 0 4.6743687 21.338168
Loop time of 0.048456 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4500 4.8163772 -0.13665697 0 4.6743687 21.338168
4600 5.1321419 -0.30134093 0 4.8250986 20.640859
Loop time of 0.048126 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4600 5.1321419 -0.30134093 0 4.8250986 20.640859
4700 5.054895 -0.11869342 0 4.930585 21.525844
Loop time of 0.0480442 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4700 5.054895 -0.11869342 0 4.930585 21.525844
4800 4.7735419 -0.28788546 0 4.4803525 20.241875
Loop time of 0.048465 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4800 4.7735419 -0.28788546 0 4.4803525 20.241875
4900 5.1590733 -0.36928517 0 4.7840559 19.906086
Loop time of 0.0482421 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
4900 5.1590733 -0.36928517 0 4.7840559 19.906086
5000 5.172434 -0.21783749 0 4.9488493 21.017977
Loop time of 0.0482352 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5000 5.172434 -0.21783749 0 4.9488493 21.017977
5100 5.3222066 -0.28431917 0 5.0319738 20.654341
Loop time of 0.0479338 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5100 5.3222066 -0.28431917 0 5.0319738 20.654341
5200 5.2269814 -0.24120657 0 4.9799671 20.863157
Loop time of 0.0479622 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5200 5.2269814 -0.24120657 0 4.9799671 20.863157
5300 4.9617285 -0.25596507 0 4.7002504 20.508874
Loop time of 0.047616 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5300 4.9617285 -0.25596507 0 4.7002504 20.508874
5400 5.1034361 -0.23375901 0 4.8640066 20.874041
Loop time of 0.048399 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5400 5.1034361 -0.23375901 0 4.8640066 20.874041
5500 5.1033392 -0.023852659 0 5.0738162 21.959054
Loop time of 0.0481031 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5500 5.1033392 -0.023852659 0 5.0738162 21.959054
5600 4.9693008 -0.3822577 0 4.5815217 19.745578
Loop time of 0.0481269 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5600 4.9693008 -0.3822577 0 4.5815217 19.745578
5700 4.9504059 -0.16971504 0 4.7751904 20.984851
Loop time of 0.047688 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5700 4.9504059 -0.16971504 0 4.7751904 20.984851
5800 5.4859652 -0.12581898 0 5.3540507 21.643131
Loop time of 0.0482688 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5800 5.4859652 -0.12581898 0 5.3540507 21.643131
5900 5.1041625 -0.24499773 0 4.8534935 20.550919
Loop time of 0.0485001 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
5900 5.1041625 -0.24499773 0 4.8534935 20.550919
6000 4.7912324 -0.23215106 0 4.5537577 20.385388
Loop time of 0.0481 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6000 4.7912324 -0.23215106 0 4.5537577 20.385388
6100 4.8687128 -0.36715522 0 4.4961479 19.616564
Loop time of 0.047904 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6100 4.8687128 -0.36715522 0 4.4961479 19.616564
6200 5.1633792 -0.42749917 0 4.7301429 19.411301
Loop time of 0.0479479 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6200 5.1633792 -0.42749917 0 4.7301429 19.411301
6300 5.0233319 0.019274316 0 5.0370247 22.144843
Loop time of 0.048382 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6300 5.0233319 0.019274316 0 5.0370247 22.144843
6400 4.9283818 -0.080911928 0 4.8419939 21.398618
Loop time of 0.048492 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6400 4.9283818 -0.080911928 0 4.8419939 21.398618
6500 5.0852451 -0.29922243 0 4.7803724 20.191962
Loop time of 0.0481842 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6500 5.0852451 -0.29922243 0 4.7803724 20.191962
6600 4.9084541 -0.25046783 0 4.6525324 20.294621
Loop time of 0.048028 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6600 4.9084541 -0.25046783 0 4.6525324 20.294621
6700 5.158646 -0.24156185 0 4.9113523 20.674148
Loop time of 0.048152 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6700 5.158646 -0.24156185 0 4.9113523 20.674148
6800 5.0800581 -0.26396878 0 4.8104448 20.254552
Loop time of 0.0481989 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6800 5.0800581 -0.26396878 0 4.8104448 20.254552
6900 5.0775502 -0.39390401 0 4.6780045 19.376358
Loop time of 0.0482252 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
6900 5.0775502 -0.39390401 0 4.6780045 19.376358
7000 4.9478484 -0.14828675 0 4.7940641 20.564728
Loop time of 0.0481858 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7000 4.9478484 -0.14828675 0 4.7940641 20.564728
7100 5.1059459 -0.097059214 0 5.0032134 21.193873
Loop time of 0.0478609 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7100 5.1059459 -0.097059214 0 5.0032134 21.193873
7200 5.1752568 -0.37658971 0 4.7929168 19.495134
Loop time of 0.04796 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7200 5.1752568 -0.37658971 0 4.7929168 19.495134
7300 5.0979223 -0.059859304 0 5.0323987 21.118636
Loop time of 0.0480049 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7300 5.0979223 -0.059859304 0 5.0323987 21.118636
7400 4.980172 -0.27439819 0 4.7002403 19.959942
Loop time of 0.047915 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7400 4.980172 -0.27439819 0 4.7002403 19.959942
7500 5.0625014 -0.1884279 0 4.8684485 20.652757
Loop time of 0.0479548 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7500 5.0625014 -0.1884279 0 4.8684485 20.652757
7600 4.950022 -0.38785668 0 4.5566653 19.255054
Loop time of 0.047981 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7600 4.950022 -0.38785668 0 4.5566653 19.255054
7700 5.038467 0.010501622 0 5.0433703 21.612637
Loop time of 0.0483868 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7700 5.038467 0.010501622 0 5.0433703 21.612637
7800 5.0722091 -0.23929391 0 4.8272794 20.163109
Loop time of 0.0484369 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7800 5.0722091 -0.23929391 0 4.8272794 20.163109
7900 4.8266996 -0.26738065 0 4.5539559 19.950113
Loop time of 0.0484252 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
7900 4.8266996 -0.26738065 0 4.5539559 19.950113
8000 5.228568 -0.22189741 0 5.0008611 20.340648
Loop time of 0.0480399 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8000 5.228568 -0.22189741 0 5.0008611 20.340648
8100 5.0226139 -0.32338281 0 4.6936504 19.597461
Loop time of 0.0477419 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8100 5.0226139 -0.32338281 0 4.6936504 19.597461
8200 4.9067102 -0.1492661 0 4.7519922 20.325845
Loop time of 0.0479119 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8200 4.9067102 -0.1492661 0 4.7519922 20.325845
8300 5.1266856 -0.22929386 0 4.8916954 20.201339
Loop time of 0.0479472 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8300 5.1266856 -0.22929386 0 4.8916954 20.201339
8400 5.0589881 -0.45921427 0 4.5941528 18.70978
Loop time of 0.048357 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8400 5.0589881 -0.45921427 0 4.5941528 18.70978
8500 4.8413482 -0.19493887 0 4.64103 19.954031
Loop time of 0.0475209 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8500 4.8413482 -0.19493887 0 4.64103 19.954031
8600 5.0908293 -0.54321499 0 4.5419579 18.109321
Loop time of 0.0483789 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8600 5.0908293 -0.54321499 0 4.5419579 18.109321
8700 5.1796752 -0.2916707 0 4.8822493 19.664654
Loop time of 0.048032 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8700 5.1796752 -0.2916707 0 4.8822493 19.664654
8800 5.2539084 -0.45997392 0 4.7880968 18.655485
Loop time of 0.0482469 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8800 5.2539084 -0.45997392 0 4.7880968 18.655485
8900 5.1024558 -0.23247495 0 4.8643114 19.86178
Loop time of 0.0481958 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
8900 5.1024558 -0.23247495 0 4.8643114 19.86178
9000 5.1823165 -0.39916589 0 4.7773924 18.971835
Loop time of 0.0481231 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9000 5.1823165 -0.39916589 0 4.7773924 18.971835
9100 4.8447578 -0.36539964 0 4.4739751 18.749222
Loop time of 0.0482869 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9100 4.8447578 -0.36539964 0 4.4739751 18.749222
9200 4.7762145 -0.41137254 0 4.3595351 18.283329
Loop time of 0.0483339 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9200 4.7762145 -0.41137254 0 4.3595351 18.283329
9300 5.0833877 -0.32352098 0 4.7542185 19.215267
Loop time of 0.0479991 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9300 5.0833877 -0.32352098 0 4.7542185 19.215267
9400 5.0177659 -0.28646064 0 4.72573 19.284236
Loop time of 0.048521 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9400 5.0177659 -0.28646064 0 4.72573 19.284236
9500 5.094124 -0.2545962 0 4.8338677 19.49513
Loop time of 0.0480311 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9500 5.094124 -0.2545962 0 4.8338677 19.49513
9600 5.0240503 -0.35703989 0 4.6614281 18.851793
Loop time of 0.048084 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9600 5.0240503 -0.35703989 0 4.6614281 18.851793
9700 4.7489492 -0.25367959 0 4.489993 19.113672
Loop time of 0.047981 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9700 4.7489492 -0.25367959 0 4.489993 19.113672
9800 4.9909149 -0.34688365 0 4.6384858 18.781061
Loop time of 0.0480509 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9800 4.9909149 -0.34688365 0 4.6384858 18.781061
9900 5.2358495 -0.20088636 0 5.0291455 19.968679
Loop time of 0.0480289 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
9900 5.2358495 -0.20088636 0 5.0291455 19.968679
10000 5.0336433 -0.30070619 0 4.7273442 19.288936
Loop time of 0.0481491 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10000 5.0336433 -0.30070619 0 4.7273442 19.288936
10100 4.7368529 -0.43300505 0 4.2985846 18.223831
Loop time of 0.047874 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10100 4.7368529 -0.43300505 0 4.2985846 18.223831
10200 5.1921737 -0.39013066 0 4.796274 18.671159
Loop time of 0.0475681 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10200 5.1921737 -0.39013066 0 4.796274 18.671159
10300 4.8489929 -0.26376235 0 4.5798428 19.1258
Loop time of 0.04794 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10300 4.8489929 -0.26376235 0 4.5798428 19.1258
10400 4.8344238 -0.39563076 0 4.4334214 18.406798
Loop time of 0.0483451 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10400 4.8344238 -0.39563076 0 4.4334214 18.406798
10500 4.7947329 -0.30412973 0 4.4852757 18.895224
Loop time of 0.047621 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10500 4.7947329 -0.30412973 0 4.4852757 18.895224
10600 5.1411793 -0.14227144 0 4.9931954 19.939056
Loop time of 0.048378 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10600 5.1411793 -0.14227144 0 4.9931954 19.939056
10700 4.6126242 -0.35662101 0 4.250878 18.178539
Loop time of 0.0480251 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10700 4.6126242 -0.35662101 0 4.250878 18.178539
10800 5.218192 -0.26093796 0 4.9514561 19.419601
Loop time of 0.0479641 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10800 5.218192 -0.26093796 0 4.9514561 19.419601
10900 4.9434504 -0.45628696 0 4.4816707 18.016015
Loop time of 0.048048 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
10900 4.9434504 -0.45628696 0 4.4816707 18.016015
11000 5.2502606 -0.29191121 0 4.9525157 19.228121
Loop time of 0.0480599 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11000 5.2502606 -0.29191121 0 4.9525157 19.228121
11100 4.7598343 -0.37412706 0 4.3804185 18.317182
Loop time of 0.048358 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11100 4.7598343 -0.37412706 0 4.3804185 18.317182
11200 5.323248 -0.21800357 0 5.0993297 19.810405
Loop time of 0.04793 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11200 5.323248 -0.21800357 0 5.0993297 19.810405
11300 4.7219543 -0.50822681 0 4.2084808 17.364301
Loop time of 0.0486059 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11300 4.7219543 -0.50822681 0 4.2084808 17.364301
11400 5.2261295 -0.41060675 0 4.8097159 18.184162
Loop time of 0.0475581 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11400 5.2261295 -0.41060675 0 4.8097159 18.184162
11500 5.4192661 -0.41967268 0 4.993572 18.44905
Loop time of 0.048496 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11500 5.4192661 -0.41967268 0 4.993572 18.44905
11600 4.9327793 -0.29827109 0 4.6290273 18.678345
Loop time of 0.0480838 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11600 4.9327793 -0.29827109 0 4.6290273 18.678345
11700 4.9061719 -0.40278149 0 4.4979391 18.015662
Loop time of 0.0484679 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11700 4.9061719 -0.40278149 0 4.4979391 18.015662
11800 5.1217904 -0.38967412 0 4.7264254 18.297707
Loop time of 0.047833 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11800 5.1217904 -0.38967412 0 4.7264254 18.297707
11900 4.898336 -0.52304599 0 4.3698475 17.482045
Loop time of 0.0480511 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
11900 4.898336 -0.52304599 0 4.3698475 17.482045
12000 5.0463402 -0.34458395 0 4.6961492 18.259663
Loop time of 0.048959 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12000 5.0463402 -0.34458395 0 4.6961492 18.259663
12100 5.2244507 -0.48448431 0 4.7341614 17.921372
Loop time of 0.0479109 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12100 5.2244507 -0.48448431 0 4.7341614 17.921372
12200 4.9182331 -0.38972269 0 4.5230457 18.065869
Loop time of 0.047838 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12200 4.9182331 -0.38972269 0 4.5230457 18.065869
12300 5.1236535 -0.50804995 0 4.6099106 17.491542
Loop time of 0.0480042 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12300 5.1236535 -0.50804995 0 4.6099106 17.491542
12400 4.9892711 -0.35640526 0 4.6273222 18.09428
Loop time of 0.04794 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12400 4.9892711 -0.35640526 0 4.6273222 18.09428
12500 4.9708898 -0.47291494 0 4.4924516 17.463457
Loop time of 0.0483761 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12500 4.9708898 -0.47291494 0 4.4924516 17.463457
12600 4.9060868 -0.42653866 0 4.4740969 17.831651
Loop time of 0.047663 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12600 4.9060868 -0.42653866 0 4.4740969 17.831651
12700 5.0407771 -0.44712314 0 4.5880531 17.595615
Loop time of 0.0484769 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12700 5.0407771 -0.44712314 0 4.5880531 17.595615
12800 5.0365185 -0.55979777 0 4.4711246 16.934523
Loop time of 0.048032 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12800 5.0365185 -0.55979777 0 4.4711246 16.934523
12900 5.2486399 -0.34366283 0 4.8991453 18.510825
Loop time of 0.0479882 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
12900 5.2486399 -0.34366283 0 4.8991453 18.510825
13000 5.1541271 -0.40831419 0 4.7400861 17.984905
Loop time of 0.0485048 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13000 5.1541271 -0.40831419 0 4.7400861 17.984905
13100 4.9252416 -0.37543615 0 4.544333 18.047342
Loop time of 0.0478559 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13100 4.9252416 -0.37543615 0 4.544333 18.047342
13200 4.7618949 -0.57797993 0 4.178624 16.678145
Loop time of 0.047977 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13200 4.7618949 -0.57797993 0 4.178624 16.678145
13300 5.0754762 -0.494503 0 4.5753338 17.274009
Loop time of 0.04761 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13300 5.0754762 -0.494503 0 4.5753338 17.274009
13400 4.7373562 -0.26050743 0 4.471585 18.244677
Loop time of 0.048439 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13400 4.7373562 -0.26050743 0 4.471585 18.244677
13500 5.2850198 -0.52753121 0 4.7516163 17.30467
Loop time of 0.0479879 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13500 5.2850198 -0.52753121 0 4.7516163 17.30467
13600 4.962689 -0.43162132 0 4.5255536 17.440072
Loop time of 0.048393 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13600 4.962689 -0.43162132 0 4.5255536 17.440072
13700 5.0155844 -0.51839355 0 4.491618 16.999978
Loop time of 0.048249 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13700 5.0155844 -0.51839355 0 4.491618 16.999978
13800 5.1030716 -0.54350825 0 4.5538933 17.135096
Loop time of 0.047961 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13800 5.1030716 -0.54350825 0 4.5538933 17.135096
13900 4.9484073 -0.32896034 0 4.6139487 17.994498
Loop time of 0.0479271 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
13900 4.9484073 -0.32896034 0 4.6139487 17.994498
14000 5.1556711 -0.39450883 0 4.7554337 18.024111
Loop time of 0.0485859 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14000 5.1556711 -0.39450883 0 4.7554337 18.024111
14100 5.3411027 -0.33237876 0 5.0027894 18.189551
Loop time of 0.047961 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14100 5.3411027 -0.33237876 0 5.0027894 18.189551
14200 5.2775385 -0.20079896 0 5.0708756 18.794478
Loop time of 0.0479829 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14200 5.2775385 -0.20079896 0 5.0708756 18.794478
14300 4.9698674 -0.54120662 0 4.4231387 16.769686
Loop time of 0.048353 on 1 procs for 100 steps with 900 atoms
fix 2 all langevin 3 3 0.1 12347
run 100 pre yes post no
Memory usage per processor = 1.67412 Mbytes
Step Temp E_pair E_mol TotEng Press
14300 4.9315283 -0.54120662 0 4.3848423 16.737356
14400 3.0737982 -1.157576 0 1.9128069 11.390762
Loop time of 0.0469351 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14400 3.0737982 -1.157576 0 1.9128069 11.390762
14500 3.0997503 -1.1613569 0 1.9349492 11.746787
Loop time of 0.046298 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14500 3.0997503 -1.1613569 0 1.9349492 11.746787
14600 3.0089981 -1.2950599 0 1.7105948 10.694304
Loop time of 0.0462 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14600 3.0089981 -1.2950599 0 1.7105948 10.694304
14700 3.0731576 -1.1944523 0 1.8752907 11.177629
Loop time of 0.0471361 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14700 3.0731576 -1.1944523 0 1.8752907 11.177629
14800 3.0790691 -1.2454277 0 1.8302202 11.050986
Loop time of 0.0467501 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14800 3.0790691 -1.2454277 0 1.8302202 11.050986
14900 2.9875216 -1.2120329 0 1.7721692 11.196195
Loop time of 0.046731 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
14900 2.9875216 -1.2120329 0 1.7721692 11.196195
15000 3.0023895 -1.1473321 0 1.8517215 11.450509
Loop time of 0.046834 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15000 3.0023895 -1.1473321 0 1.8517215 11.450509
15100 3.1095672 -1.186375 0 1.9197372 11.392239
Loop time of 0.046701 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15100 3.1095672 -1.186375 0 1.9197372 11.392239
15200 3.0788594 -1.1581741 0 1.9172643 11.434699
Loop time of 0.0466931 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15200 3.0788594 -1.1581741 0 1.9172643 11.434699
15300 3.097962 -1.2142726 0 1.8802473 11.060786
Loop time of 0.0467482 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15300 3.097962 -1.2142726 0 1.8802473 11.060786
15400 3.0085051 -1.2068705 0 1.7982919 11.125663
Loop time of 0.046351 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15400 3.0085051 -1.2068705 0 1.7982919 11.125663
15500 2.91789 -1.2471287 0 1.6675192 10.908068
Loop time of 0.0467601 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15500 2.91789 -1.2471287 0 1.6675192 10.908068
15600 3.1592422 -1.320622 0 1.83511 10.315596
Loop time of 0.0463359 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15600 3.1592422 -1.320622 0 1.83511 10.315596
15700 3.1361836 -1.16244 0 1.9702589 11.474858
Loop time of 0.0472879 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15700 3.1361836 -1.16244 0 1.9702589 11.474858
15800 3.0412387 -1.2445264 0 1.7933331 10.828289
Loop time of 0.0468159 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15800 3.0412387 -1.2445264 0 1.7933331 10.828289
15900 3.1318652 -1.1349315 0 1.9934539 11.506448
Loop time of 0.04685 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
15900 3.1318652 -1.1349315 0 1.9934539 11.506448
16000 3.1012109 -1.2285496 0 1.8692155 11.001584
Loop time of 0.0467439 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16000 3.1012109 -1.2285496 0 1.8692155 11.001584
16100 3.0508387 -1.2590515 0 1.7883974 10.774791
Loop time of 0.046726 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16100 3.0508387 -1.2590515 0 1.7883974 10.774791
16200 3.1900114 -1.3779639 0 1.8085031 10.051609
Loop time of 0.047003 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16200 3.1900114 -1.3779639 0 1.8085031 10.051609
16300 2.9418317 -1.2584583 0 1.6801047 10.537777
Loop time of 0.0466199 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16300 2.9418317 -1.2584583 0 1.6801047 10.537777
16400 2.9386319 -1.2427586 0 1.6926082 10.643756
Loop time of 0.0467391 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16400 2.9386319 -1.2427586 0 1.6926082 10.643756
16500 2.9129152 -1.0821846 0 1.8274941 11.598824
Loop time of 0.046731 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16500 2.9129152 -1.0821846 0 1.8274941 11.598824
16600 3.09857 -1.1510317 0 1.9440954 11.235013
Loop time of 0.046741 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16600 3.09857 -1.1510317 0 1.9440954 11.235013
16700 2.8592356 -1.2474647 0 1.6085939 10.595499
Loop time of 0.046757 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16700 2.8592356 -1.2474647 0 1.6085939 10.595499
16800 2.930352 -1.2310556 0 1.6960404 10.789207
Loop time of 0.04637 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16800 2.930352 -1.2310556 0 1.6960404 10.789207
16900 2.9631052 -1.2091634 0 1.7506495 10.861427
Loop time of 0.046385 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
16900 2.9631052 -1.2091634 0 1.7506495 10.861427
17000 2.9507403 -1.0775066 0 1.8699552 11.496194
Loop time of 0.0468409 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
17000 2.9507403 -1.0775066 0 1.8699552 11.496194
17100 3.1429056 -1.1518542 0 1.9875593 11.382163
Loop time of 0.0466008 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
17100 3.1429056 -1.1518542 0 1.9875593 11.382163
17200 3.0175223 -1.2168934 0 1.7972761 10.888517
Loop time of 0.0468168 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
17200 3.0175223 -1.2168934 0 1.7972761 10.888517
17300 3.0849889 -1.2641589 0 1.8174022 10.561238
Loop time of 0.0463462 on 1 procs for 100 steps with 900 atoms
run 100 pre no post no
Step Temp E_pair E_mol TotEng Press
17300 3.0849889 -1.2641589 0 1.8174022 10.561238
17400 2.9622086 -1.2777097 0 1.6812076 10.441674
Loop time of 0.0466161 on 1 procs for 100 steps with 900 atoms

File diff suppressed because it is too large Load Diff

1329
python/examples/pizza/gl.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,383 @@
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
# gnu tool
oneline = "Create plots via GnuPlot plotting program"
docstr = """
g = gnu() start up GnuPlot
g.stop() shut down GnuPlot process
g.plot(a) plot vector A against linear index
g.plot(a,b) plot B against A
g.plot(a,b,c,d,...) plot B against A, D against C, etc
g.mplot(M,N,S,"file",a,b,...) multiple plots saved to file0000.eps, etc
each plot argument can be a tuple, list, or Numeric/NumPy vector
mplot loops over range(M,N,S) and create one plot per iteration
last args are same as list of vectors for plot(), e.g. 1, 2, 4 vectors
each plot is made from a portion of the vectors, depending on loop index i
Ith plot is of b[0:i] vs a[0:i], etc
series of plots saved as file0000.eps, file0001.eps, etc
if use xrange(),yrange() then plot axes will be same for all plots
g("plot 'file.dat' using 2:3 with lines") execute string in GnuPlot
g.enter() enter GnuPlot shell
gnuplot> plot sin(x) with lines type commands directly to GnuPlot
gnuplot> exit, quit exit GnuPlot shell
g.export("data",range(100),a,...) create file with columns of numbers
all vectors must be of equal length
could plot from file with GnuPlot command: plot 'data' using 1:2 with lines
g.select(N) figure N becomes the current plot
subsequent commands apply to this plot
g.hide(N) delete window for figure N
g.save("file") save current plot as file.eps
Set attributes for current plot:
g.erase() reset all attributes to default values
g.aspect(1.3) aspect ratio
g.xtitle("Time") x axis text
g.ytitle("Energy") y axis text
g.title("My Plot") title text
g.title("title","x","y") title, x axis, y axis text
g.xrange(xmin,xmax) x axis range
g.xrange() default x axis range
g.yrange(ymin,ymax) y axis range
g.yrange() default y axis range
g.xlog() toggle x axis between linear and log
g.ylog() toggle y axis between linear and log
g.label(x,y,"text") place label at x,y coords
g.curve(N,'r') set color of curve N
colors: 'k' = black, 'r' = red, 'g' = green, 'b' = blue
'm' = magenta, 'c' = cyan, 'y' = yellow
"""
# History
# 8/05, Matt Jones (BYU): original version
# 9/05, Steve Plimpton: added mplot() method
# ToDo list
# allow choice of JPG or PNG or GIF when saving ?
# can this be done from GnuPlot or have to do via ImageMagick convert ?
# way to trim EPS plot that is created ?
# hide does not work on Mac aqua
# select does not pop window to front on Mac aqua
# Variables
# current = index of current figure (1-N)
# figures = list of figure objects with each plot's attributes
# so they aren't lost between replots
# Imports and external programs
import types, os
try: from DEFAULTS import PIZZA_GNUPLOT
except: PIZZA_GNUPLOT = "gnuplot"
try: from DEFAULTS import PIZZA_GNUTERM
except: PIZZA_GNUTERM = "x11"
# Class definition
class gnu:
# --------------------------------------------------------------------
def __init__(self):
self.GNUPLOT = os.popen(PIZZA_GNUPLOT,'w')
self.file = "tmp.gnu"
self.figures = []
self.select(1)
# --------------------------------------------------------------------
def stop(self):
self.__call__("quit")
del self.GNUPLOT
# --------------------------------------------------------------------
def __call__(self,command):
self.GNUPLOT.write(command + '\n')
self.GNUPLOT.flush()
# --------------------------------------------------------------------
def enter(self):
while 1:
command = raw_input("gnuplot> ")
if command == "quit" or command == "exit": return
self.__call__(command)
# --------------------------------------------------------------------
# write plot vectors to files and plot them
def plot(self,*vectors):
if len(vectors) == 1:
file = self.file + ".%d.1" % self.current
linear = range(len(vectors[0]))
self.export(file,linear,vectors[0])
self.figures[self.current-1].ncurves = 1
else:
if len(vectors) % 2: raise StandardError,"vectors must come in pairs"
for i in range(0,len(vectors),2):
file = self.file + ".%d.%d" % (self.current,i/2+1)
self.export(file,vectors[i],vectors[i+1])
self.figures[self.current-1].ncurves = len(vectors)/2
self.draw()
# --------------------------------------------------------------------
# create multiple plots from growing vectors, save to numbered files
# don't plot empty vector, create a [0] instead
def mplot(self,start,stop,skip,file,*vectors):
n = 0
for i in range(start,stop,skip):
partial_vecs = []
for vec in vectors:
if i: partial_vecs.append(vec[:i])
else: partial_vecs.append([0])
self.plot(*partial_vecs)
if n < 10: newfile = file + "000" + str(n)
elif n < 100: newfile = file + "00" + str(n)
elif n < 1000: newfile = file + "0" + str(n)
else: newfile = file + str(n)
self.save(newfile)
n += 1
# --------------------------------------------------------------------
# write list of equal-length vectors to filename
def export(self,filename,*vectors):
n = len(vectors[0])
for vector in vectors:
if len(vector) != n: raise StandardError,"vectors must be same length"
f = open(filename,'w')
nvec = len(vectors)
for i in xrange(n):
for j in xrange(nvec):
print >>f,vectors[j][i],
print >>f
f.close()
# --------------------------------------------------------------------
# select plot N as current plot
def select(self,n):
self.current = n
if len(self.figures) < n:
for i in range(n - len(self.figures)):
self.figures.append(figure())
cmd = "set term " + PIZZA_GNUTERM + ' ' + str(n)
self.__call__(cmd)
if self.figures[n-1].ncurves: self.draw()
# --------------------------------------------------------------------
# delete window for plot N
def hide(self,n):
cmd = "set term %s close %d" % (PIZZA_GNUTERM,n)
self.__call__(cmd)
# --------------------------------------------------------------------
# save plot to file.eps
# final re-select will reset terminal
# do not continue until plot file is written out
# else script could go forward and change data file
# use tmp.done as semaphore to indicate plot is finished
def save(self,file):
self.__call__("set terminal postscript enhanced solid lw 2 color portrait")
cmd = "set output '%s.eps'" % file
self.__call__(cmd)
if os.path.exists("tmp.done"): os.remove("tmp.done")
self.draw()
self.__call__("!touch tmp.done")
while not os.path.exists("tmp.done"): continue
self.__call__("set output")
self.select(self.current)
# --------------------------------------------------------------------
# restore default attributes by creating a new fig object
def erase(self):
fig = figure()
fig.ncurves = self.figures[self.current-1].ncurves
self.figures[self.current-1] = fig
self.draw()
# --------------------------------------------------------------------
def aspect(self,value):
self.figures[self.current-1].aspect = value
self.draw()
# --------------------------------------------------------------------
def xrange(self,*values):
if len(values) == 0:
self.figures[self.current-1].xlimit = 0
else:
self.figures[self.current-1].xlimit = (values[0],values[1])
self.draw()
# --------------------------------------------------------------------
def yrange(self,*values):
if len(values) == 0:
self.figures[self.current-1].ylimit = 0
else:
self.figures[self.current-1].ylimit = (values[0],values[1])
self.draw()
# --------------------------------------------------------------------
def label(self,x,y,text):
self.figures[self.current-1].labels.append((x,y,text))
self.figures[self.current-1].nlabels += 1
self.draw()
# --------------------------------------------------------------------
def nolabels(self):
self.figures[self.current-1].nlabel = 0
self.figures[self.current-1].labels = []
self.draw()
# --------------------------------------------------------------------
def title(self,*strings):
if len(strings) == 1:
self.figures[self.current-1].title = strings[0]
else:
self.figures[self.current-1].title = strings[0]
self.figures[self.current-1].xtitle = strings[1]
self.figures[self.current-1].ytitle = strings[2]
self.draw()
# --------------------------------------------------------------------
def xtitle(self,label):
self.figures[self.current-1].xtitle = label
self.draw()
# --------------------------------------------------------------------
def ytitle(self,label):
self.figures[self.current-1].ytitle = label
self.draw()
# --------------------------------------------------------------------
def xlog(self):
if self.figures[self.current-1].xlog:
self.figures[self.current-1].xlog = 0
else:
self.figures[self.current-1].xlog = 1
self.draw()
# --------------------------------------------------------------------
def ylog(self):
if self.figures[self.current-1].ylog:
self.figures[self.current-1].ylog = 0
else:
self.figures[self.current-1].ylog = 1
self.draw()
# --------------------------------------------------------------------
def curve(self,num,color):
fig = self.figures[self.current-1]
while len(fig.colors) < num: fig.colors.append(0)
fig.colors[num-1] = colormap[color]
self.draw()
# --------------------------------------------------------------------
# draw a plot with all its settings
# just return if no files of vectors defined yet
def draw(self):
fig = self.figures[self.current-1]
if not fig.ncurves: return
cmd = 'set size ratio ' + str(1.0/float(fig.aspect))
self.__call__(cmd)
cmd = 'set title ' + '"' + fig.title + '"'
self.__call__(cmd)
cmd = 'set xlabel ' + '"' + fig.xtitle + '"'
self.__call__(cmd)
cmd = 'set ylabel ' + '"' + fig.ytitle + '"'
self.__call__(cmd)
if fig.xlog: self.__call__("set logscale x")
else: self.__call__("unset logscale x")
if fig.ylog: self.__call__("set logscale y")
else: self.__call__("unset logscale y")
if fig.xlimit:
cmd = 'set xr [' + str(fig.xlimit[0]) + ':' + str(fig.xlimit[1]) + ']'
self.__call__(cmd)
else: self.__call__("set xr [*:*]")
if fig.ylimit:
cmd = 'set yr [' + str(fig.ylimit[0]) + ':' + str(fig.ylimit[1]) + ']'
self.__call__(cmd)
else: self.__call__("set yr [*:*]")
self.__call__("set nolabel")
for i in range(fig.nlabels):
x = fig.labels[i][0]
y = fig.labels[i][1]
text = fig.labels[i][2]
cmd = 'set label ' + '\"' + text + '\" at ' + str(x) + ',' + str(y)
self.__call__(cmd)
self.__call__("set key off")
cmd = 'plot '
for i in range(fig.ncurves):
file = self.file + ".%d.%d" % (self.current,i+1)
if len(fig.colors) > i and fig.colors[i]:
cmd += "'" + file + "' using 1:2 with line %d, " % fig.colors[i]
else:
cmd += "'" + file + "' using 1:2 with lines, "
self.__call__(cmd[:-2])
# --------------------------------------------------------------------
# class to store settings for a single plot
class figure:
def __init__(self):
self.ncurves = 0
self.colors = []
self.title = ""
self.xtitle = ""
self.ytitle = ""
self.aspect = 1.3
self.xlimit = 0
self.ylimit = 0
self.xlog = 0
self.ylog = 0
self.nlabels = 0
self.labels = []
# --------------------------------------------------------------------
# line color settings
colormap = {'k':-1, 'r':1, 'g':2, 'b':3, 'm':4, 'c':5, 'y':7}

View File

@ -0,0 +1,391 @@
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
# vizinfo class, not a top-level Pizza.py tool
# History
# 8/05, Matt Jones (BYU): original version
# 9/05, Steve Plimpton: added 140-color table
# ToDo list
# Variables
# Imports and external programs
import types
# Class definition
class vizinfo:
"""
Information holder for Pizza.py visualization tools
acolor,bcolor,tcolor,lcolor = RGB values for each atom/bond/tri/line type
arad = radius of each atom type
brad,lrad = thickness of each bond/line type
tfill = fill flag for each triangle type
all of these arrays are indexed by object type which runs 1-Ntype
nacolor,nbcolor,ntcolor,nlcolor,narad,nbrad,nlrad,ntfill
are # of types each array holds
actual length is nacolor+1 so that array can be indexed by 1-Ntype
setcolors() = set atom/bond/tri/line colors
setradii() = set atom/bond/line radii/thickness
setfill() = set triangle fill factor
extend() = grow an array
"""
# --------------------------------------------------------------------
def __init__(self):
self.acolor = []
self.arad = []
self.bcolor = []
self.brad = []
self.tcolor = []
self.tfill = []
self.lcolor = []
self.lrad = []
self.nacolor = self.narad = 0
self.nbcolor = self.nbrad = 0
self.ntcolor = self.ntfill = 0
self.nlcolor = self.nlrad = 0
# --------------------------------------------------------------------
# set color RGB for which = atoms, bonds, triangles
def setcolors(self,which,ids,rgbs):
# convert args into lists if single values
# if arg = 0, convert to full-range list
if type(ids) is types.IntType and ids == 0:
if which == "atom": ids = range(self.nacolor)
if which == "bond": ids = range(self.nbcolor)
if which == "tri": ids = range(self.ntcolor)
if which == "line": ids = range(self.nlcolor)
if type(ids) is not types.ListType and type(ids) is not types.TupleType:
ids = [ids]
if type(rgbs) is not types.ListType and type(rgbs) is not types.TupleType:
rgbs = [rgbs]
# if list of types has a 0, increment each type value
if 0 in ids:
for i in xrange(len(ids)): ids[i] += 1
# extend storage list if necessary
# extend other arrays for same "which" so that gl::make_atom_calllist
# has valid arrays to work with
if which == "atom":
if max(ids) > self.nacolor:
self.nacolor = self.extend(self.acolor,max(ids))
self.nacolor = self.extend(self.arad,max(ids))
if which == "bond":
if max(ids) > self.nbcolor:
self.nbcolor = self.extend(self.bcolor,max(ids))
self.nbcolor = self.extend(self.brad,max(ids))
if which == "tri":
if max(ids) > self.ntcolor:
self.ntcolor = self.extend(self.tcolor,max(ids))
self.ntcolor = self.extend(self.tfill,max(ids))
if which == "line":
if max(ids) > self.nlcolor:
self.nlcolor = self.extend(self.lcolor,max(ids))
self.nlcolor = self.extend(self.lrad,max(ids))
# set color for each type
# if list lengths match, set directly, else interpolate
# convert final color from 0-255 to 0.0-1.0
ntypes = len(ids)
nrgbs = len(rgbs)
for i in xrange(ntypes):
id = ids[i]
if rgbs[0] == "loop":
list = colors.keys()
red,green,blue = colors[list[i % len(colors)]]
elif ntypes == nrgbs:
red,green,blue = colors[rgbs[i]]
else:
r = i/float(ntypes-1) * float(nrgbs-1)
jlo = int(r)
jhi = jlo + 1
if jhi == nrgbs: jhi = nrgbs - 1
clo = colors[rgbs[jlo]]
chi = colors[rgbs[jhi]]
delta = r - jlo
red = clo[0] + delta*(chi[0]-clo[0])
green = clo[1] + delta*(chi[1]-clo[1])
blue = clo[2] + delta*(chi[2]-clo[2])
color = [red/255.0,green/255.0,blue/255.0]
if which == "atom": self.acolor[id] = color
if which == "bond": self.bcolor[id] = color
if which == "tri": self.tcolor[id] = color
if which == "line": self.lcolor[id] = color
# --------------------------------------------------------------------
# set radii for which = atoms, bonds, lines
def setradii(self,which,ids,radii):
# convert args into lists if single values
# if arg = 0, convert to full-range list
if type(ids) is types.IntType and ids == 0:
if which == "atom": ids = range(self.narad)
if which == "bond": ids = range(self.nbrad)
if which == "line": ids = range(self.nlrad)
if type(ids) is not types.ListType and type(ids) is not types.TupleType:
ids = [ids]
if type(radii) is not types.ListType and \
type(radii) is not types.TupleType:
radii = [radii]
# if list of types has a 0, increment each type value
if 0 in ids:
for i in xrange(len(ids)): ids[i] += 1
# extend storage list if necessary
# extend other arrays for same "which" so that gl::make_atom_calllist
# has valid arrays to work with
if which == "atom":
if max(ids) > self.narad:
self.narad = self.extend(self.arad,max(ids))
self.narad = self.extend(self.acolor,max(ids))
if which == "bond":
if max(ids) > self.nbrad:
self.nbrad = self.extend(self.brad,max(ids))
self.nbrad = self.extend(self.bcolor,max(ids))
if which == "line":
if max(ids) > self.nlrad:
self.nlrad = self.extend(self.lrad,max(ids))
self.nlrad = self.extend(self.lcolor,max(ids))
# set radius for each type
# if list lengths match, set directly, else interpolate
ntypes = len(ids)
nradii = len(radii)
for i in range(ntypes):
id = ids[i]
if ntypes == nradii: rad = radii[i]
else:
r = i/float(ntypes-1) * float(nradii-1)
jlo = int(r)
jhi = jlo + 1
if jhi == nradii: jhi = nradii - 1
rlo = radii[jlo]
rhi = radii[jhi]
delta = r - jlo
rad = rlo + delta*(rhi-rlo)
if which == "atom": self.arad[id] = rad
if which == "bond": self.brad[id] = rad
if which == "line": self.lrad[id] = rad
# --------------------------------------------------------------------
# set triangle fill style
# 0 = fill only, 1 = line only, 2 = fill and line
def setfills(self,which,ids,fills):
# convert args into lists if single values
# if arg = 0, convert to full-range list
if type(ids) is types.IntType and ids == 0:
ids = range(self.ntfill)
if type(ids) is not types.ListType and type(ids) is not types.TupleType:
ids = [ids]
if type(fills) is not types.ListType and \
type(fills) is not types.TupleType:
fills = [fills]
# if list of types has a 0, increment each type value
if 0 in ids:
for i in xrange(len(ids)): ids[i] += 1
# extend storage list if necessary
# extend other arrays for same "which" so that gl::make_atom_calllist
# has valid arrays to work with
if max(ids) > self.ntfill:
self.ntfill = self.extend(self.tfill,max(ids))
self.ntfill = self.extend(self.tcolor,max(ids))
# set fill flag for each type
# if list lengths match, set directly, else set types to 1st fill value
if len(fills) == len(ids):
for i in xrange(len(ids)): self.tfill[ids[i]] = int(fills[i])
else:
for id in ids: self.tfill[id] = int(fills[0])
# --------------------------------------------------------------------
def extend(self,array,n):
for i in range(n-len(array)+1): array.append(0)
return n
# --------------------------------------------------------------------
# dictionary of 140 color names and associated RGB values
colors = {}
colors["aliceblue"] = [240, 248, 255]
colors["antiquewhite"] = [250, 235, 215]
colors["aqua"] = [0, 255, 255]
colors["aquamarine"] = [127, 255, 212]
colors["azure"] = [240, 255, 255]
colors["beige"] = [245, 245, 220]
colors["bisque"] = [255, 228, 196]
colors["black"] = [0, 0, 0]
colors["blanchedalmond"] = [255, 255, 205]
colors["blue"] = [0, 0, 255]
colors["blueviolet"] = [138, 43, 226]
colors["brown"] = [165, 42, 42]
colors["burlywood"] = [222, 184, 135]
colors["cadetblue"] = [95, 158, 160]
colors["chartreuse"] = [127, 255, 0]
colors["chocolate"] = [210, 105, 30]
colors["coral"] = [255, 127, 80]
colors["cornflowerblue"] = [100, 149, 237]
colors["cornsilk"] = [255, 248, 220]
colors["crimson"] = [220, 20, 60]
colors["cyan"] = [0, 255, 255]
colors["darkblue"] = [0, 0, 139]
colors["darkcyan"] = [0, 139, 139]
colors["darkgoldenrod"] = [184, 134, 11]
colors["darkgray"] = [169, 169, 169]
colors["darkgreen"] = [0, 100, 0]
colors["darkkhaki"] = [189, 183, 107]
colors["darkmagenta"] = [139, 0, 139]
colors["darkolivegreen"] = [85, 107, 47]
colors["darkorange"] = [255, 140, 0]
colors["darkorchid"] = [153, 50, 204]
colors["darkred"] = [139, 0, 0]
colors["darksalmon"] = [233, 150, 122]
colors["darkseagreen"] = [143, 188, 143]
colors["darkslateblue"] = [72, 61, 139]
colors["darkslategray"] = [47, 79, 79]
colors["darkturquoise"] = [0, 206, 209]
colors["darkviolet"] = [148, 0, 211]
colors["deeppink"] = [255, 20, 147]
colors["deepskyblue"] = [0, 191, 255]
colors["dimgray"] = [105, 105, 105]
colors["dodgerblue"] = [30, 144, 255]
colors["firebrick"] = [178, 34, 34]
colors["floralwhite"] = [255, 250, 240]
colors["forestgreen"] = [34, 139, 34]
colors["fuchsia"] = [255, 0, 255]
colors["gainsboro"] = [220, 220, 220]
colors["ghostwhite"] = [248, 248, 255]
colors["gold"] = [255, 215, 0]
colors["goldenrod"] = [218, 165, 32]
colors["gray"] = [128, 128, 128]
colors["green"] = [0, 128, 0]
colors["greenyellow"] = [173, 255, 47]
colors["honeydew"] = [240, 255, 240]
colors["hotpink"] = [255, 105, 180]
colors["indianred"] = [205, 92, 92]
colors["indigo"] = [75, 0, 130]
colors["ivory"] = [255, 240, 240]
colors["khaki"] = [240, 230, 140]
colors["lavender"] = [230, 230, 250]
colors["lavenderblush"] = [255, 240, 245]
colors["lawngreen"] = [124, 252, 0]
colors["lemonchiffon"] = [255, 250, 205]
colors["lightblue"] = [173, 216, 230]
colors["lightcoral"] = [240, 128, 128]
colors["lightcyan"] = [224, 255, 255]
colors["lightgoldenrodyellow"] = [250, 250, 210]
colors["lightgreen"] = [144, 238, 144]
colors["lightgrey"] = [211, 211, 211]
colors["lightpink"] = [255, 182, 193]
colors["lightsalmon"] = [255, 160, 122]
colors["lightseagreen"] = [32, 178, 170]
colors["lightskyblue"] = [135, 206, 250]
colors["lightslategray"] = [119, 136, 153]
colors["lightsteelblue"] = [176, 196, 222]
colors["lightyellow"] = [255, 255, 224]
colors["lime"] = [0, 255, 0]
colors["limegreen"] = [50, 205, 50]
colors["linen"] = [250, 240, 230]
colors["magenta"] = [255, 0, 255]
colors["maroon"] = [128, 0, 0]
colors["mediumaquamarine"] = [102, 205, 170]
colors["mediumblue"] = [0, 0, 205]
colors["mediumorchid"] = [186, 85, 211]
colors["mediumpurple"] = [147, 112, 219]
colors["mediumseagreen"] = [60, 179, 113]
colors["mediumslateblue"] = [123, 104, 238]
colors["mediumspringgreen"] = [0, 250, 154]
colors["mediumturquoise"] = [72, 209, 204]
colors["mediumvioletred"] = [199, 21, 133]
colors["midnightblue"] = [25, 25, 112]
colors["mintcream"] = [245, 255, 250]
colors["mistyrose"] = [255, 228, 225]
colors["moccasin"] = [255, 228, 181]
colors["navajowhite"] = [255, 222, 173]
colors["navy"] = [0, 0, 128]
colors["oldlace"] = [253, 245, 230]
colors["olive"] = [128, 128, 0]
colors["olivedrab"] = [107, 142, 35]
colors["orange"] = [255, 165, 0]
colors["orangered"] = [255, 69, 0]
colors["orchid"] = [218, 112, 214]
colors["palegoldenrod"] = [238, 232, 170]
colors["palegreen"] = [152, 251, 152]
colors["paleturquoise"] = [175, 238, 238]
colors["palevioletred"] = [219, 112, 147]
colors["papayawhip"] = [255, 239, 213]
colors["peachpuff"] = [255, 239, 213]
colors["peru"] = [205, 133, 63]
colors["pink"] = [255, 192, 203]
colors["plum"] = [221, 160, 221]
colors["powderblue"] = [176, 224, 230]
colors["purple"] = [128, 0, 128]
colors["red"] = [255, 0, 0]
colors["rosybrown"] = [188, 143, 143]
colors["royalblue"] = [65, 105, 225]
colors["saddlebrown"] = [139, 69, 19]
colors["salmon"] = [250, 128, 114]
colors["sandybrown"] = [244, 164, 96]
colors["seagreen"] = [46, 139, 87]
colors["seashell"] = [255, 245, 238]
colors["sienna"] = [160, 82, 45]
colors["silver"] = [192, 192, 192]
colors["skyblue"] = [135, 206, 235]
colors["slateblue"] = [106, 90, 205]
colors["slategray"] = [112, 128, 144]
colors["snow"] = [255, 250, 250]
colors["springgreen"] = [0, 255, 127]
colors["steelblue"] = [70, 130, 180]
colors["tan"] = [210, 180, 140]
colors["teal"] = [0, 128, 128]
colors["thistle"] = [216, 191, 216]
colors["tomato"] = [253, 99, 71]
colors["turquoise"] = [64, 224, 208]
colors["violet"] = [238, 130, 238]
colors["wheat"] = [245, 222, 179]
colors["white"] = [255, 255, 255]
colors["whitesmoke"] = [245, 245, 245]
colors["yellow"] = [255, 255, 0]
colors["yellowgreen"] = [154, 205, 50]

75
python/examples/plot.py Executable file
View File

@ -0,0 +1,75 @@
#!/usr/local/bin/python -i
# preceeding line should have path for Python on your machine
# plot.py
# Purpose: plot Temp of running LAMMPS simulation via GnuPlot in Pizza.py
# Syntax: plot.py in.lammps Nfreq Nsteps compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point every this many steps
# Nsteps = run for this many steps
# compute-ID = ID of compute that calculates temperature
# (or any other scalar quantity)
import sys
sys.path.append("./pizza")
from gnu import gnu
# parse command line
argv = sys.argv
if len(argv) != 5:
print "Syntax: plot.py in.lammps Nfreq Nsteps compute-ID"
sys.exit()
infile = sys.argv[1]
nfreq = int(sys.argv[2])
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()
from lammps import lammps
lmp = lammps()
# run infile all at once
# assumed to have no run command in it
lmp.file(infile)
lmp.command("thermo %d" % nfreq)
# initial 0-step run to generate initial 1-point plot
lmp.command("run 0 pre yes post no")
value = lmp.extract_compute(compute,0,0)
ntimestep = 0
xaxis = [ntimestep]
yaxis = [value]
# wrapper on GnuPlot via Pizza.py gnu tool
# just proc 0 handles plotting
if me == 0:
gn = gnu()
gn.plot(xaxis,yaxis)
gn.xrange(0,nsteps)
gn.title(compute,"Timestep","Temperature")
# run nfreq steps at a time w/out pre/post, query compute, refresh plot
while ntimestep < nsteps:
lmp.command("run %d pre no post no" % nfreq)
ntimestep += nfreq
value = lmp.extract_compute(compute,0,0)
xaxis.append(ntimestep)
yaxis.append(value)
if me == 0: gn.plot(xaxis,yaxis)
lmp.command("run 0 pre no post yes")
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()

50
python/examples/simple.py Executable file
View File

@ -0,0 +1,50 @@
#!/usr/local/bin/python -i
# 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
import sys
# parse command line
argv = sys.argv
if len(argv) != 2:
print "Syntax: simple.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 one line at a time
lines = open(infile,'r').readlines()
for line in lines: lmp.command(line)
# run 10 more steps
# get coords from LAMMPS
# change coords of 1st atom
# put coords back into LAMMPS
# run a single step with changed coords
lmp.command("run 10")
x = lmp.get_coords()
epsilon = 0.1
x[0] += epsilon
lmp.put_coords(x)
lmp.command("run 1");
lmp.command("run 1")
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()

40
python/examples/trivial.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/local/bin/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()

82
python/examples/viz.py Executable file
View File

@ -0,0 +1,82 @@
#!/usr/local/bin/python -i
# preceeding line should have path for Python on your machine
# viz.py
# Purpose: viz running LAMMPS simulation via GL tool in Pizza.py
# Syntax: viz.py in.lammps Nfreq Nsteps
# in.lammps = LAMMPS input script
# Nfreq = dump and viz shapshot every this many steps
# Nsteps = run for this many steps
import sys
sys.path.append("./pizza")
# parse command line
argv = sys.argv
if len(argv) != 4:
print "Syntax: viz.py in.lammps Nfreq Nsteps"
sys.exit()
infile = sys.argv[1]
nfreq = int(sys.argv[2])
nsteps = int(sys.argv[3])
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
# assumed to have no run command in it
lmp.file(infile)
lmp.command("thermo %d" % nfreq)
lmp.command("dump python all atom %d tmp.dump" % nfreq)
# initial 0-step run to generate dump file and image
lmp.command("run 0 pre yes post no")
ntimestep = 0
# wrapper on GL window via Pizza.py gl tool
# just proc 0 handles reading of dump file and viz
if me == 0:
import Tkinter
tkroot = Tkinter.Tk()
tkroot.withdraw()
from dump import dump
from gl import gl
d = dump("tmp.dump",0)
g = gl(d)
d.next()
d.unscale()
g.zoom(1)
g.shift(0,0)
g.rotate(0,270)
g.q(10)
g.box(1)
g.show(ntimestep)
# run nfreq steps at a time w/out pre/post, read dump snapshot, display it
while ntimestep < nsteps:
lmp.command("run %d pre no post no" % nfreq)
ntimestep += nfreq
if me == 0:
d.next()
d.unscale()
g.show(ntimestep)
lmp.command("run 0 pre no post yes")
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()

171
python/examples/vizplotgui.py Executable file
View File

@ -0,0 +1,171 @@
#!/usr/local/bin/python -i
# preceeding line should have path for Python on your machine
# vizplotgui.py
# Purpose: viz running LAMMPS simulation with plot and GUI
# Syntax: vizplotgui.py in.lammps Nfreq compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point and viz shapshot every this many steps
# compute-ID = ID of compute that calculates temperature
# (or any other scalar quantity)
import sys,time
sys.path.append("./pizza")
# methods called by GUI
def run():
global runflag
runflag = 1
def stop():
global runflag
runflag = 0
def settemp(value):
global temptarget
temptarget = slider.get()
def quit():
global breakflag
breakflag = 1
# method called by timestep loop every Nfreq steps
# read dump snapshot and viz it, update plot with compute value
def update(ntimestep):
d.next()
d.unscale()
g.show(ntimestep)
value = lmp.extract_compute(compute,0,0)
xaxis.append(ntimestep)
yaxis.append(value)
gn.plot(xaxis,yaxis)
# parse command line
argv = sys.argv
if len(argv) != 4:
print "Syntax: vizplotgui.py in.lammps Nfreq compute-ID"
sys.exit()
infile = sys.argv[1]
nfreq = int(sys.argv[2])
compute = sys.argv[3]
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
# assumed to have no run command in it
lmp.file(infile)
lmp.command("thermo %d" % nfreq)
lmp.command("dump python all atom %d tmp.dump" % nfreq)
# initial 0-step run to generate initial 1-point plot, dump file, and image
lmp.command("run 0 pre yes post no")
value = lmp.extract_compute(compute,0,0)
ntimestep = 0
xaxis = [ntimestep]
yaxis = [value]
# wrapper on GL window via Pizza.py gl tool
# just proc 0 handles reading of dump file and viz
breakflag = 0
runflag = 0
temptarget = 1.0
if me == 0:
from Tkinter import *
tkroot = Tk()
tkroot.withdraw()
from dump import dump
from gl import gl
d = dump("tmp.dump",0)
g = gl(d)
d.next()
d.unscale()
g.zoom(1)
g.shift(0,0)
g.rotate(0,270)
g.q(10)
g.box(1)
g.show(ntimestep)
# display GUI with run/stop buttons and slider for temperature
if me == 0:
from Tkinter import *
tkroot = Tk()
tkroot.withdraw()
root = Toplevel(tkroot)
root.title("LAMMPS GUI")
frame = Frame(root)
Button(frame,text="Run",command=run).pack(side=LEFT)
Button(frame,text="Stop",command=stop).pack(side=LEFT)
slider = Scale(frame,from_=0.0,to=5.0,resolution=0.1,
orient=HORIZONTAL,label="Temperature")
slider.bind('<ButtonRelease-1>',settemp)
slider.set(temptarget)
slider.pack(side=LEFT)
Button(frame,text="Quit",command=quit).pack(side=RIGHT)
frame.pack()
tkroot.update()
# wrapper on GnuPlot via Pizza.py gnu tool
if me == 0:
from gnu import gnu
gn = gnu()
gn.plot(xaxis,yaxis)
gn.title(compute,"Timestep","Temperature")
# endless loop, checking status of GUI settings every Nfreq steps
# run with pre yes/no and post yes/no depending on go/stop status
# re-invoke fix langevin with new seed when temperature slider changes
# after re-invoke of fix langevin, run with pre yes
running = 0
temp = temptarget
seed = 12345
lmp.command("fix 2 all langevin %g %g 0.1 %d" % (temp,temp,seed))
while 1:
if me == 0: tkroot.update()
if temp != temptarget:
temp = temptarget
seed += me+1
lmp.command("fix 2 all langevin %g %g 0.1 12345" % (temp,temp))
running = 0
if runflag and running:
lmp.command("run %d pre no post no" % nfreq)
ntimestep += nfreq
if me == 0: update(ntimestep)
elif runflag and not running:
lmp.command("run %d pre yes post no" % nfreq)
ntimestep += nfreq
if me == 0: update(ntimestep)
elif not runflag and running:
lmp.command("run %d pre no post yes" % nfreq)
ntimestep += nfreq
if me == 0: update(ntimestep)
if breakflag: break
if runflag: running = 1
else: running = 0
time.sleep(0.01)
lmp.command("run 0 pre no post yes")
# uncomment if running in parallel via Pypar
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
#pypar.finalize()

169
python/lammps.py Normal file
View File

@ -0,0 +1,169 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
# Python wrapper on LAMMPS library via ctypes
import types
from ctypes import *
LMPINT = 0
LMPDOUBLE = 1
LMPIPTR = 2
LMPDPTR = 3
LMPDPTRPTR = 4
class lammps:
def __init__(self,args=None):
# attempt to load parallel library first, serial library next
# could provide caller a flag to choose which library to load
try:
self.lib = CDLL("_lammps.so")
except:
try:
self.lib = CDLL("_lammps_serial.so")
except:
raise StandardError,"Could not load LAMMPS dynamic library"
# create an instance of LAMMPS
# don't know how to pass an MPI communicator from PyPar
# no_mpi call lets LAMMPS use MPI_COMM_WORLD
# cargs = array of C strings from args
if args:
args.insert(0,"lammps.py")
narg = len(args)
cargs = (c_char_p*narg)(*args)
self.lmp = c_void_p()
self.lib.lammps_open_no_mpi(narg,cargs,byref(self.lmp))
else:
self.lmp = c_void_p()
self.lib.lammps_open_no_mpi(0,None,byref(self.lmp))
# could use just this if LAMMPS lib interface supported it
# self.lmp = self.lib.lammps_open_no_mpi(0,None)
def __del__(self):
if self.lmp: self.lib.lammps_close(self.lmp)
def close(self):
self.lib.lammps_close(self.lmp)
self.lmp = None
def file(self,file):
self.lib.lammps_file(self.lmp,file)
def command(self,cmd):
self.lib.lammps_command(self.lmp,cmd)
def extract_global(self,name,type):
if type == LMPDOUBLE:
self.lib.lammps_extract_global.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_global(self.lmp,name)
return ptr[0]
if type == LMPINT:
self.lib.lammps_extract_global.restype = POINTER(c_int)
ptr = self.lib.lammps_extract_global(self.lmp,name)
return ptr[0]
return None
def extract_atom(self,name,type):
if type == LMPDPTRPTR:
self.lib.lammps_extract_atom.restype = POINTER(POINTER(c_double))
ptr = self.lib.lammps_extract_atom(self.lmp,name)
return ptr
if type == LMPDPTR:
self.lib.lammps_extract_atom.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_atom(self.lmp,name)
return ptr
if type == LMPIPTR:
self.lib.lammps_extract_atom.restype = POINTER(c_int)
ptr = self.lib.lammps_extract_atom(self.lmp,name)
return ptr
return None
def extract_compute(self,id,style,type):
if type == 0:
if style > 0: return None
self.lib.lammps_extract_compute.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr[0]
elif type == 1:
self.lib.lammps_extract_compute.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr
elif type == 2:
self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double))
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr
return None
# in case of global datum, free memory for 1 double via lammps_free()
# double was allocated by library interface function
def extract_fix(self,id,style,type,i=0,j=0):
if type == 0:
if style > 0: return None
self.lib.lammps_extract_fix.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_bix(self.lmp,id,style,type,i,j)
result = ptr[0]
self.lib.lammps_free(ptr)
return result
elif type == 1:
self.lib.lammps_extract_fix.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
return ptr
elif type == 2:
self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double))
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
return ptr
return None
# free memory for 1 double or 1 vector of doubles via lammps_free()
# for vector, must copy nlocal returned values to local c_double vector
# memory was allocated by library interface function
def extract_variable(self,name,group,type):
if type == 0:
self.lib.lammps_extract_variable.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_variable(self.lmp,name,group)
result = ptr[0]
self.lib.lammps_free(ptr)
return result
if type == 1:
self.lib.lammps_extract_global.restype = POINTER(c_int)
nlocalptr = self.lib.lammps_extract_global(self.lmp,"nlocal")
nlocal = nlocalptr[0]
result = (c_double*nlocal)()
self.lib.lammps_extract_variable.restype = POINTER(c_double)
ptr = self.lib.lammps_extract_variable(self.lmp,name,group)
for i in xrange(nlocal): result[i] = ptr[i]
self.lib.lammps_free(ptr)
return result
return None
def get_natoms(self):
return self.lib.lammps_get_natoms(self.lmp)
def get_coords(self):
nlen = 3 * self.lib.lammps_get_natoms(self.lmp)
coords = (c_double*nlen)()
self.lib.lammps_get_coords(self.lmp,coords)
return coords
# assume coords is an array of c_double, as created by get_coords()
# could check if it is some other Python object and create c_double array?
# constructor for c_double array can take an arg to use to fill it?
def put_coords(self,coords):
self.lib.lammps_put_coords(self.lmp,coords)

39
python/setup.py Executable file
View File

@ -0,0 +1,39 @@
#!/usr/local/bin/python
"""
setup.py file for LAMMPS with system MPI library
"""
from distutils.core import setup, Extension
import os, glob
path = os.path.dirname(os.getcwd())
# list of src files for LAMMPS
libfiles = glob.glob("%s/src/*.cpp" % path)
lammps_library = Extension("_lammps",
sources = libfiles,
define_macros = [("MPICH_IGNORE_CXX_SEEK",1),
("LAMMPS_GZIP",1),
("FFT_NONE",1),],
# src files for LAMMPS
include_dirs = ["../src"],
# additional libs for MPICH on Linux
libraries = ["mpich","rt"],
# where to find the MPICH lib on Linux
library_dirs = ["/usr/local/lib"],
# additional libs for MPI on Mac
# libraries = ["mpi"],
)
setup(name = "lammps",
version = "26Oct10",
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "http://lammps.sandia.gov",
description = """LAMMPS molecular dynamics library - parallel""",
py_modules = ["lammps"],
ext_modules = [lammps_library]
)

34
python/setup_serial.py Executable file
View File

@ -0,0 +1,34 @@
#!/usr/local/bin/python
"""
setup_serial.py file for LAMMPS with dummy serial MPI library
"""
from distutils.core import setup, Extension
import os, glob
path = os.path.dirname(os.getcwd())
# list of src files for LAMMPS and MPI STUBS
libfiles = glob.glob("%s/src/*.cpp" % path) + \
glob.glob("%s/src/STUBS/*.cpp" % path)
lammps_library = Extension("_lammps_serial",
sources = libfiles,
define_macros = [("MPICH_IGNORE_CXX_SEEK",1),
("LAMMPS_GZIP",1),
("FFT_NONE",1),],
# src files for LAMMPS and MPI STUBS
include_dirs = ["../src", "../src/STUBS"]
)
setup(name = "lammps_serial",
version = "26Oct10",
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "http://lammps.sandia.gov",
description = """LAMMPS molecular dynamics library - serial""",
py_modules = ["lammps"],
ext_modules = [lammps_library]
)