1This directory contains Python code which wraps LIGGGHTS as a library 2and allows the LIGGGHTS library interface to be invoked from Python, 3either from a script or interactively. 4 5Details on the Python interface to LIGGGHTS and how to build LIGGGHTS as a 6shared library, for use with Python, are given in 7doc/Section_python.html and in doc/Section_start.html#start_5. 8 9Basically you need to follow these steps in the src directory: 10 11% make makeshlib # creates Makefile.shlib 12% make -f Makefile.shlib g++ # build for whatever machine target you wish 13% make install-python # may need to do this via sudo 14 15You can replace the last step with running the python/install.py 16script directly to give you more control over where two relevant files 17are installed, or by setting environment variables in your shell 18script. See doc/Section_python.html for details. 19 20You can then launch Python and instantiate an instance of LIGGGHTS: 21 22% python 23>>> from liggghts import liggghts 24>>> lmp = liggghts() 25 26If that gives no errors, you have succesfully wrapped LIGGGHTS with 27Python. See doc/Section_python.html#py_5 for tests you can then use 28to run LIGGGHTS both in serial or parallel thru Python. 29 30------------------------------------------------------------------- 31 32Once you have successfully wrapped LIGGGHTS, you can run the Python 33scripts in the examples sub-directory: 34 35trivial.py read/run a LIGGGHTS input script thru Python 36demo.py invoke various LIGGGHTS library interface routines 37simple.py mimic operation of couple/simple/simple.cpp in Python 38gui.py GUI go/stop/temperature-slider to control LIGGGHTS 39plot.py real-time temeperature plot with GnuPlot via Pizza.py 40viz_tool.py real-time viz via some viz package 41vizplotgui_tool.py combination of viz.py and plot.py and gui.py 42 43For the viz_tool.py and vizplotgui_tool.py commands, replace "tool" 44with "gl" or "atomeye" or "pymol", depending on what visualization 45package you have installed. We hope to add a VMD option soon. 46 47Note that for GL, you need to be able to run the Pizza.py GL tool, 48which is included in the pizza sub-directory. See the Pizza.py doc 49pages for more info: 50 51http://www.sandia.gov/~sjplimp/pizza.html 52 53Note that for AtomEye, you need version 3, and their is a line in the 54scripts that specifies the path and name of the executable. See 55the AtomEye WWW pages for more details: 56 57http://mt.seas.upenn.edu/Archive/Graphics/A 58http://mt.seas.upenn.edu/Archive/Graphics/A3/A3.html 59 60The latter link is to AtomEye 3 which has the scriping 61capability needed by these Python scripts. 62 63Note that for PyMol, you need to have built and installed the 64open-source version of PyMol in your Python, so that you can import it 65from a Python script. See the PyMol WWW pages for more details: 66 67http://www.pymol.org 68http://sourceforge.net/scm/?type=svn&group_id=4546 69 70The latter link is to the open-source version. 71 72------------------------------------------------------------------- 73 74You can run a particular script in either of the following ways: 75 76% trivial.py in.trivial 77% python -i trivial.py in.trivial 78 79The former assumes that you have changed the first line of the script 80to point to the Python installed on your box. 81 82Run the Python scripts with the following LIGGGHTS input scripts and 83arguments: 84 85trivial.py in.trivial 86demo.py 87simple.py in.simple 88gui.py in.gui 100 89plot.py in.plot 10 1000 thermo_temp 90viz_tool.py in.viz 100 5000 91vizplotgui_tool.py in.viz 100 thermo_temp 92 93You can un-comment the Pypar calls if you want to run these in 94parallel. Then, for example, you can type: 95 96% mpirun -np 4 trivial.py in.trivial 97% mpirun -np 4 python trivial.py in.trivial 98 99Each script has more documentation in the file that explains how to 100use it and what it is doing. 101