git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6809 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -20,11 +20,11 @@ either from a Python script or interactively from a Python prompt.
|
||||
<P><A HREF = "http://www.python.org">Python</A> is a powerful scripting and programming
|
||||
language which can be used to wrap software like LAMMPS and other
|
||||
packages. It can be used to glue multiple pieces of software
|
||||
together, e.g. to run a coupled or multiscale model. See <A HREF = "Section_howto.html#4_10">this
|
||||
together, e.g. to run a coupled or multiscale model. See <A HREF = "Section_howto.html#howto_10">this
|
||||
section</A> of the manual and the couple
|
||||
directory of the distribution for more ideas about coupling LAMMPS to
|
||||
other codes. See <A HREF = "Section_start.html#start_4">this section</A> about how
|
||||
to build LAMMPS as a library, and <A HREF = "Section_howto.html#4_19">this
|
||||
to build LAMMPS as a library, and <A HREF = "Section_howto.html#howto_19">this
|
||||
section</A> for a description of the library
|
||||
interface provided in src/library.cpp and src/library.h and how to
|
||||
extend it for your needs. As described below, that interface is what
|
||||
@ -89,13 +89,13 @@ setup discussion. The next to last sub-section describes the Python
|
||||
syntax used to invoke LAMMPS. The last sub-section describes example
|
||||
Python scripts included in the python directory.
|
||||
</P>
|
||||
<UL><LI>11.1 <A HREF = "#11_1">Extending Python with a serial version of LAMMPS</A>
|
||||
<LI>11.2 <A HREF = "#11_2">Creating a shared MPI library</A>
|
||||
<LI>11.3 <A HREF = "#11_3">Extending Python with a parallel version of LAMMPS</A>
|
||||
<LI>11.4 <A HREF = "#11_4">Extending Python with MPI</A>
|
||||
<LI>11.5 <A HREF = "#11_5">Testing the Python-LAMMPS interface</A>
|
||||
<LI>11.6 <A HREF = "#11_6">Using LAMMPS from Python</A>
|
||||
<LI>11.7 <A HREF = "#11_7">Example Python scripts that use LAMMPS</A>
|
||||
<UL><LI>11.1 <A HREF = "#py_1">Extending Python with a serial version of LAMMPS</A>
|
||||
<LI>11.2 <A HREF = "#py_2">Creating a shared MPI library</A>
|
||||
<LI>11.3 <A HREF = "#py_3">Extending Python with a parallel version of LAMMPS</A>
|
||||
<LI>11.4 <A HREF = "#py_4">Extending Python with MPI</A>
|
||||
<LI>11.5 <A HREF = "#py_5">Testing the Python-LAMMPS interface</A>
|
||||
<LI>11.6 <A HREF = "#py_6">Using LAMMPS from Python</A>
|
||||
<LI>11.7 <A HREF = "#py_7">Example Python scripts that use LAMMPS</A>
|
||||
</UL>
|
||||
<P>Before proceeding, there are 2 items to note.
|
||||
</P>
|
||||
@ -135,7 +135,7 @@ LAMMPS wrapper.
|
||||
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_1"></A><H4>11.1 Extending Python with a serial version of LAMMPS
|
||||
<A NAME = "py_1"></A><H4>11.1 Extending Python with a serial version of LAMMPS
|
||||
</H4>
|
||||
<P>From the python directory in the LAMMPS distribution, type
|
||||
</P>
|
||||
@ -165,7 +165,7 @@ this, where you should replace "foo" with your directory of choice.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_2"></A><H4>11.2 Creating a shared MPI library
|
||||
<A NAME = "py_2"></A><H4>11.2 Creating a shared MPI library
|
||||
</H4>
|
||||
<P>A shared library is one that is dynamically loadable, which is what
|
||||
Python requires. On Linux this is a library file that ends in ".so",
|
||||
@ -196,7 +196,7 @@ stand-alone code.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_3"></A><H4>11.3 Extending Python with a parallel version of LAMMPS
|
||||
<A NAME = "py_3"></A><H4>11.3 Extending Python with a parallel version of LAMMPS
|
||||
</H4>
|
||||
<P>From the python directory, type
|
||||
</P>
|
||||
@ -234,7 +234,7 @@ will be put in the appropriate directory.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_4"></A><H4>11.4 Extending Python with MPI
|
||||
<A NAME = "py_4"></A><H4>11.4 Extending Python with MPI
|
||||
</H4>
|
||||
<P>There are several Python packages available that purport to wrap MPI
|
||||
as a library and allow MPI functions to be called from Python.
|
||||
@ -309,7 +309,7 @@ print "Proc %d out of %d procs" % (pypar.rank(),pypar.size())
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_5"></A><H4>11.5 Testing the Python-LAMMPS interface
|
||||
<A NAME = "py_5"></A><H4>11.5 Testing the Python-LAMMPS interface
|
||||
</H4>
|
||||
<P>Before using LAMMPS in a Python program, one more step is needed. The
|
||||
interface to LAMMPS is via the Python ctypes package, which loads the
|
||||
@ -403,7 +403,7 @@ Python on a single processor, not in parallel.
|
||||
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_6"></A><H4>11.6 Using LAMMPS from Python
|
||||
<A NAME = "py_6"></A><H4>11.6 Using LAMMPS from Python
|
||||
</H4>
|
||||
<P>The Python interface to LAMMPS consists of a Python "lammps" module,
|
||||
the source code for which is in python/lammps.py, which creates a
|
||||
@ -499,7 +499,7 @@ subscripting. The one exception is that for a fix that calculates a
|
||||
global vector or array, a single double value from the vector or array
|
||||
is returned, indexed by I (vector) or I and J (array). I,J are
|
||||
zero-based indices. The I,J arguments can be left out if not needed.
|
||||
See <A HREF = "Section_howto.html#4_15">this section</A> of the manual for a
|
||||
See <A HREF = "Section_howto.html#howto_15">this section</A> of the manual for a
|
||||
discussion of global, per-atom, and local data, and of scalar, vector,
|
||||
and array data types. See the doc pages for individual
|
||||
<A HREF = "compute.html">computes</A> and <A HREF = "fix.html">fixes</A> for a description of what
|
||||
@ -595,7 +595,7 @@ Python script. Isn't ctypes amazing?
|
||||
|
||||
<HR>
|
||||
|
||||
<A NAME = "11_7"></A><H4>11.7 Example Python scripts that use LAMMPS
|
||||
<A NAME = "py_7"></A><H4>11.7 Example Python scripts that use LAMMPS
|
||||
</H4>
|
||||
<P>These are the Python scripts included as demos in the python/examples
|
||||
directory of the LAMMPS distribution, to illustrate the kinds of
|
||||
|
||||
Reference in New Issue
Block a user