git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14590 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -281,8 +281,10 @@ examples of Python code you can write for both pure Python operations
|
||||
and callbacks to LAMMPS.</p>
|
||||
<p>To run pure Python code from LAMMPS, you only need to build LAMMPS
|
||||
with the PYTHON package installed:</p>
|
||||
<p>make yes-python
|
||||
make machine</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>make yes-python
|
||||
make machine
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Note that this will link LAMMPS with the Python library on your
|
||||
system, which typically requires several auxiliary system libraries to
|
||||
also be linked. The list of these libraries and the paths to find
|
||||
@ -303,7 +305,7 @@ file and the shared library.</p>
|
||||
<a class="reference internal" href="Section_start.html#start-5"><span>Section_start 5</span></a>. A shared library is one
|
||||
that is dynamically loadable, which is what Python requires to wrap
|
||||
LAMMPS. On Linux this is a library file that ends in ”.so”, not ”.a”.</p>
|
||||
<p>>From the src directory, type</p>
|
||||
<p>From the src directory, type</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>make foo mode=shlib
|
||||
</pre></div>
|
||||
</div>
|
||||
@ -313,10 +315,14 @@ well as a soft link liblammps.so, which is what the Python wrapper will
|
||||
load by default. Note that if you are building multiple machine
|
||||
versions of the shared library, the soft link is always set to the
|
||||
most recently built version.</p>
|
||||
<p>If this fails, see <a class="reference internal" href="Section_start.html#start-5"><span>Section_start 5</span></a> for
|
||||
more details, especially if your LAMMPS build uses auxiliary libraries
|
||||
like MPI or FFTW which may not be built as shared libraries on your
|
||||
system.</p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">If you are building LAMMPS with an MPI or FFT library or other
|
||||
auxiliary libraries (used by various packages), then all of these
|
||||
extra libraries must also be shared libraries. If the LAMMPS
|
||||
shared-library build fails with an error complaining about this, see
|
||||
<a class="reference internal" href="Section_start.html#start-5"><span>Section_start 5</span></a> for more details.</p>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
</div>
|
||||
<div class="section" id="installing-the-python-wrapper-into-python">
|
||||
@ -715,17 +721,6 @@ lmp = lammps(name="g++",cmdargs=list) # add LAMMPS command-line arg
|
||||
</pre></div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">Currently, the creation of a LAMMPS object from within lammps.py
|
||||
does not take an MPI communicator as an argument. There should be a
|
||||
way to do this, so that the LAMMPS instance runs on a subset of
|
||||
processors if desired, but I don’t know how to do it from Pypar. So
|
||||
for now, it runs with MPI_COMM_WORLD, which is all the processors. If
|
||||
someone figures out how to do this with one or more of the Python
|
||||
wrappers for MPI, like Pypar, please let us know and we will amend
|
||||
these doc pages.</p>
|
||||
</div>
|
||||
<p>The lines</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">lammps</span> <span class="kn">import</span> <span class="n">lammps</span>
|
||||
<span class="n">lmp</span> <span class="o">=</span> <span class="n">lammps</span><span class="p">()</span>
|
||||
|
||||
Reference in New Issue
Block a user