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

This commit is contained in:
sjplimp 2012-08-15 22:59:37 +00:00
parent 2e7bd3367f
commit 5c58881400
4 changed files with 26 additions and 24 deletions

View File

@ -58,12 +58,13 @@ operations within LAMMPS, such as running a simulation for a
reasonable number of timesteps, then the overhead cost of invoking
LAMMPS thru Python will be negligible.
</P>
<P>Before using LAMMPS from a Python script, you have to do two things.
You need to set two environment variables. And you need to build
LAMMPS as a dynamic shared library, so it can be loaded by Python.
Both these steps are discussed below. If you wish to run LAMMPS in
parallel from Python, you also need to extend your Python with MPI.
This is also discussed below.
<P>Before using LAMMPS from a Python script, you need to do two things.
You need to build LAMMPS as a dynamic shared library, so it can be
loaded by Python. And you need to tell Python how to find the library
and the Python wrapper file python/lammps.py. Both these steps are
discussed below. If you wish to run LAMMPS in parallel from Python,
you also need to extend your Python with MPI. This is also discussed
below.
</P>
<P>The Python wrapper for LAMMPS uses the amazing and magical (to me)
"ctypes" package in Python, which auto-generates the interface code
@ -131,7 +132,7 @@ python/lammps.py file.
</P>
<P>You can invoke install.py from the python directory as
</P>
<PRE>% python install.py <B>libdir</B> <B>pydir</B>
<PRE>% python install.py [libdir] [pydir]
</PRE>
<P>The optional libdir is where to copy the LAMMPS shared library to; the
default is /usr/local/lib. The optional pydir is where to copy the
@ -146,12 +147,12 @@ non-standard locations, such as within your own user space, you will
need to set your PYTHONPATH and LD_LIBRARY_PATH environment variables
accordingly, as above.
</P>
<P>If the instally.py script does not allow you to copy files into system
<P>If the install.py script does not allow you to copy files into system
directories, prefix the python command with "sudo". If you do this,
make sure that the Python that root runs is the same as the Python you
run. E.g. you may need to do something like
</P>
<PRE>% sudo /usr/local/bin/python install.py <B>libdir</B> <B>pydir</B>
<PRE>% sudo /usr/local/bin/python install.py [libdir] [pydir]
</PRE>
<P>You can also invoke install.py from the make command in the src
directory as
@ -275,8 +276,8 @@ If the load fails, the most common error to see is
<PRE>OSError: Could not load LAMMPS dynamic library
</PRE>
<P>which means Python was unable to load the LAMMPS shared library. This
typically occurs if the system can't find the LAMMMPS shared library
or one of the auxiliary shared libraries it depends on.
typically occurs if the system can't find the LAMMPS shared library or
one of the auxiliary shared libraries it depends on.
</P>
<P>Python (actually the operating system) isn't verbose about telling you
why the load failed, so carefully go through the steps above regarding

View File

@ -55,12 +55,13 @@ operations within LAMMPS, such as running a simulation for a
reasonable number of timesteps, then the overhead cost of invoking
LAMMPS thru Python will be negligible.
Before using LAMMPS from a Python script, you have to do two things.
You need to set two environment variables. And you need to build
LAMMPS as a dynamic shared library, so it can be loaded by Python.
Both these steps are discussed below. If you wish to run LAMMPS in
parallel from Python, you also need to extend your Python with MPI.
This is also discussed below.
Before using LAMMPS from a Python script, you need to do two things.
You need to build LAMMPS as a dynamic shared library, so it can be
loaded by Python. And you need to tell Python how to find the library
and the Python wrapper file python/lammps.py. Both these steps are
discussed below. If you wish to run LAMMPS in parallel from Python,
you also need to extend your Python with MPI. This is also discussed
below.
The Python wrapper for LAMMPS uses the amazing and magical (to me)
"ctypes" package in Python, which auto-generates the interface code
@ -127,7 +128,7 @@ python/lammps.py file.
You can invoke install.py from the python directory as
% python install.py [libdir] [pydir] :pre
% python install.py \[libdir\] \[pydir\] :pre
The optional libdir is where to copy the LAMMPS shared library to; the
default is /usr/local/lib. The optional pydir is where to copy the
@ -142,12 +143,12 @@ non-standard locations, such as within your own user space, you will
need to set your PYTHONPATH and LD_LIBRARY_PATH environment variables
accordingly, as above.
If the instally.py script does not allow you to copy files into system
If the install.py script does not allow you to copy files into system
directories, prefix the python command with "sudo". If you do this,
make sure that the Python that root runs is the same as the Python you
run. E.g. you may need to do something like
% sudo /usr/local/bin/python install.py [libdir] [pydir] :pre
% sudo /usr/local/bin/python install.py \[libdir\] \[pydir\] :pre
You can also invoke install.py from the make command in the src
directory as
@ -271,8 +272,8 @@ If the load fails, the most common error to see is
OSError: Could not load LAMMPS dynamic library :pre
which means Python was unable to load the LAMMPS shared library. This
typically occurs if the system can't find the LAMMMPS shared library
or one of the auxiliary shared libraries it depends on.
typically occurs if the system can't find the LAMMPS shared library or
one of the auxiliary shared libraries it depends on.
Python (actually the operating system) isn't verbose about telling you
why the load failed, so carefully go through the steps above regarding

View File

@ -850,7 +850,7 @@ should be the file /usr/local/lib/libmpich.so.
the environment variable LD_LIBRARY_PATH. So you may wish to copy the
file src/liblammps.so or src/liblammps_g++.so (for example) to a place
the system can find it by default, such as /usr/local/lib, or you may
wish to add the lammps src directory to LD_LIBRARY_PATH, so that the
wish to add the LAMMPS src directory to LD_LIBRARY_PATH, so that the
current version of the shared library is always available to programs
that use it.
</P>

View File

@ -844,7 +844,7 @@ The operating system finds shared libraries to load at run-time using
the environment variable LD_LIBRARY_PATH. So you may wish to copy the
file src/liblammps.so or src/liblammps_g++.so (for example) to a place
the system can find it by default, such as /usr/local/lib, or you may
wish to add the lammps src directory to LD_LIBRARY_PATH, so that the
wish to add the LAMMPS src directory to LD_LIBRARY_PATH, so that the
current version of the shared library is always available to programs
that use it.