Installing PICI-LIGGGHTS
A step-by-step guide with video, instructions and commands for installing PICI-LIGGGHTS with high level Python interface CoExSiST on Ubuntu 20.04. Note: This doesn’t work on Ubuntu 22.04 so make sure to use Ubuntu 20.04. If you don’t have a computer running Ubuntu I would recommend using a VM software such as VirtualBox to set up an Ubuntu VM.
-
Firstly, download a clone of the PICI-LIGGGHTS zip from GitHub found here.
-
Extract the zip file and move to your location of choice.
-
Install build-essential to install everything required for compiling basic C and C++ software.
sudo apt install build-essential
-
Install libboost-dev for additional C++ source libraries (Prevents some errors when compiling PICI-LIGGGHTS).
sudo apt install libboost-dev
-
Install CMake that can be used to automatically build PICI-LIGGGHTS for us later.
sudo snap install cmake --classic
-
Install Open MPI, an open source MPI to allow PICI-LIGGGHTS to make use of parallelisation.
sudo apt install openmpi-bin
-
Go to the extracted PICI-LIGGGHTS master folder and make build folder inside.
mkdir build && cd build
-
Once inside the build folder run the CMake command to make the CMake files.
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -march=native -fPIC" ../src/
-
Once CMake is finished, run the ‘make’ command to start building PICI-LIGGGHTS. (This may take some time)
make -j4
-
Copy ‘libliggghts.so’ to a standard location.
sudo cp libliggghts.so /usr/local/lib
-
Copy liggghts.py to the Python packages location.
cd .. cd python sudo cp liggghts.py /usr/local/lib/python3.8/dist-packages/
-
Add /usr/local/lib to library path in the .bashrc file.
nano ~/.bashrc LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- A simple Python interface of PICI-LIGGGHTS should now be able to be run from Python. It is a good idea to test at this point if it works.
-
Optional: Test PICI-LIGGGHTS works in Python: Install idle (Or your text editor/IDE of choice)
sudo apt install idle
-
Run idle
idle
-
Type Python lines to import PICI-LIGGGHTS and start liggghts object.
from liggghts import liggghts liggghts()
-
-
To use the high level Python interface we need to install the Python package CoExSiST. To do this we need the Python package manager pip.
sudo apt install pip
-
Install CoExSiST Python package.
pip install coexist
-
All done! PICI-LIGGGHTS and CoExSiST are installed. Check CoExSiST works by opening your text editor/IDE of choice and importing coexist to make sure no errors occur.
import coexist