Unverified Commit 9d22f82b authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

update PyLAMMPS documentation/tutorial for CMake and the refactored installation process

parent 3867972a
Loading
Loading
Loading
Loading
+24 −7
Original line number Diff line number Diff line
@@ -57,6 +57,17 @@ library is then loaded by the Python interface. In this example we enable the
MOLECULE package and compile LAMMPS with C++ exceptions, PNG, JPEG and FFMPEG
output support enabled.

Step 1a: For the CMake based build system, the steps are:

mkdir $LAMMPS_DIR/build-shared
cd  $LAMMPS_DIR/build-shared :pre

# MPI, PNG, Jpeg, FFMPEG are auto-detected
cmake ../cmake -DPKG_MOLECULE=yes -DLAMMPS_EXCEPTIONS=yes -DBUILD_LIB=yes -DBUILD_SHARED_LIBS=yes
make :pre

Step 1b: For the legacy, make based build system, the steps are:

cd $LAMMPS_DIR/src :pre

# add packages if necessary
@@ -68,10 +79,9 @@ make mpi mode=shlib LMP_INC="-DLAMMPS_PNG -DLAMMPS_JPEG -DLAMMPS_FFMPEG -DLAMMPS
Step 2: Installing the LAMMPS Python package :h6

PyLammps is part of the lammps Python package. To install it simply install
that package into your current Python installation.
that package into your current Python installation with:

cd $LAMMPS_DIR/python
python install.py :pre
make install-python :pre

NOTE: Recompiling the shared library requires re-installing the Python package

@@ -94,14 +104,21 @@ apt-get install python-virtualenv :pre

Creating a virtualenv with lammps installed :h6

# create virtualenv name 'testing' :pre
# create virtualenv named 'testing'
virtualenv $HOME/python/testing :pre

# activate 'testing' environment
source testing/bin/activate :pre
source $HOME/python/testing/bin/activate :pre

Now configure and compile the LAMMPS shared library as outlined above.
When using CMake and the shared library has already been build, you
need to re-run CMake to update the location of the python executable
to the location in the virtual environment with:

cmake . -DPYTHON_EXECUTABLE=$(which python) :pre

# install LAMMPS package in virtualenv
(testing) cd $LAMMPS_DIR/python
(testing) python install.py :pre
(testing) make install-python :pre

# install other useful packages
(testing) pip install matplotlib jupyter mpi4py :pre