git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14349 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>11. Python interface to LAMMPS — LAMMPS 15 May 2015 version documentation</title>
|
||||
<title>11. Python interface to LAMMPS — LAMMPS 10 Dec 2015 version documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
|
||||
<link rel="top" title="LAMMPS 15 May 2015 version documentation" href="index.html"/>
|
||||
<link rel="top" title="LAMMPS 10 Dec 2015 version documentation" href="index.html"/>
|
||||
<link rel="next" title="12. Errors" href="Section_errors.html"/>
|
||||
<link rel="prev" title="10. Modifying & extending LAMMPS" href="Section_modify.html"/>
|
||||
|
||||
@ -238,12 +238,12 @@ check which version of Python you have installed, by simply typing
|
||||
</div>
|
||||
<div class="section" id="overview-of-using-python-from-a-lammps-script">
|
||||
<span id="py-2"></span><h2>11.2. Overview of using Python from a LAMMPS script<a class="headerlink" href="#overview-of-using-python-from-a-lammps-script" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="admonition warning">
|
||||
<p class="first admonition-title">Warning</p>
|
||||
<p class="last">It is not currently possible to use the
|
||||
<a class="reference internal" href="python.html"><em>python</em></a> command described in this section with Python 3,
|
||||
only with Python 2. The C API changed from Python 2 to 3 and the
|
||||
LAMMPS code is not compatible with both.</p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">It is not currently possible to use the <a class="reference internal" href="python.html"><em>python</em></a>
|
||||
command described in this section with Python 3, only with Python 2.
|
||||
The C API changed from Python 2 to 3 and the LAMMPS code is not
|
||||
compatible with both.</p>
|
||||
</div>
|
||||
<p>LAMMPS has a <a class="reference internal" href="python.html"><em>python</em></a> command which can be used in an
|
||||
input script to define and execute a Python function that you write
|
||||
@ -457,13 +457,13 @@ print "Proc %d out of %d procs" % (pypar.rank(),pypar.size())
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>and see one line of output for each processor you run on.</p>
|
||||
<div class="admonition warning">
|
||||
<p class="first admonition-title">Warning</p>
|
||||
<p class="last">To use Pypar and LAMMPS in parallel from Python, you
|
||||
must insure both are using the same version of MPI. If you only have
|
||||
one MPI installed on your system, this is not an issue, but it can be
|
||||
if you have multiple MPIs. Your LAMMPS build is explicit about which
|
||||
MPI it is using, since you specify the details in your lo-level
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">To use Pypar and LAMMPS in parallel from Python, you must insure
|
||||
both are using the same version of MPI. If you only have one MPI
|
||||
installed on your system, this is not an issue, but it can be if you
|
||||
have multiple MPIs. Your LAMMPS build is explicit about which MPI it
|
||||
is using, since you specify the details in your lo-level
|
||||
src/MAKE/Makefile.foo file. Pypar uses the “mpicc” command to find
|
||||
information about the MPI it uses to build against. And it tries to
|
||||
load “libmpi.so” from the LD_LIBRARY_PATH. This may or may not find
|
||||
@ -502,13 +502,13 @@ print "Proc %d out of %d procs" % (comm.Get_rank(),comm.Get_size())
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>and see one line of output for each processor you run on.</p>
|
||||
<div class="admonition warning">
|
||||
<p class="first admonition-title">Warning</p>
|
||||
<p class="last">To use mpi4py and LAMMPS in parallel from Python, you
|
||||
must insure both are using the same version of MPI. If you only have
|
||||
one MPI installed on your system, this is not an issue, but it can be
|
||||
if you have multiple MPIs. Your LAMMPS build is explicit about which
|
||||
MPI it is using, since you specify the details in your lo-level
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">To use mpi4py and LAMMPS in parallel from Python, you must
|
||||
insure both are using the same version of MPI. If you only have one
|
||||
MPI installed on your system, this is not an issue, but it can be if
|
||||
you have multiple MPIs. Your LAMMPS build is explicit about which MPI
|
||||
it is using, since you specify the details in your lo-level
|
||||
src/MAKE/Makefile.foo file. Mpi4py uses the “mpicc” command to find
|
||||
information about the MPI it uses to build against. And it tries to
|
||||
load “libmpi.so” from the LD_LIBRARY_PATH. This may or may not find
|
||||
@ -715,16 +715,16 @@ lmp = lammps(name="g++",cmdargs=list) # add LAMMPS command-line arg
|
||||
</pre></div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="admonition warning">
|
||||
<p class="first admonition-title">Warning</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 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>
|
||||
@ -995,7 +995,7 @@ different visualization package options. Click to see larger images:</p>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright .
|
||||
© Copyright 2013 Sandia Corporation.
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
@ -1016,7 +1016,7 @@ different visualization package options. Click to see larger images:</p>
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'15 May 2015 version',
|
||||
VERSION:'10 Dec 2015 version',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true
|
||||
|
||||
Reference in New Issue
Block a user