LIGGGHTS Installation Guide for Ubuntu 12.04 LTS and 13.04

Submitted by rahulsoni on Mon, 09/09/2013 - 08:09


Fairly the whole credit goes to the writers of previously existing posts especially Paul.

  1. ##Installing Libraries g++ and git-core
  2. sudo apt-get install libvtk5-dev libeigen2-dev libopenmpi-dev g++ git-core

    Following two lines have helped me trobleshooting some errors in installing in ubuntu 14. (Instead of make ubuntuVTK, I tried make fedora for this case).
    sudo apt-get install build-essential git
    sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev

    ##Checking installations
    which mpirun
    /usr/bin/mpirun comes up?
    which mpic++
    /usr/bin/mpic++ comes up?
    mpic++ -v
    gcc-Version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) comes up at the last line?

    ##Installing cmake
    sudo apt-get install cmake
    sudo apt-get install cmake-curses-gui

  3. ##Installing VTK
  4. Download vtk-5.8.0.tar.gz from
    Note: If VTK-5.8 not found then download it from here
    Extract downloaded folder into home directory
    cd /home/"user"/VTK
    rm CMakeCache.txt [optional]
    sudo cmake .
    Note: (a) If encountered error such as In file included from /usr/include/GL/glx.h:333:0,
    from /home/rahul/VTK-5.8/Rendering/vtkXOpenGLRenderWindow.cxx:31:
    /usr/include/GL/glxext.h:480:143: error: ‘GLintptr’ has not been declared
    eadCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr re
    then either follow at or open VTK-directory/Rendering/vtkXOpenGLRenderWindow.cxx and then uncomments the line with text #define GLX_GLXENT_LEGACY and perform sudo make
    (b) If you find difficulty or error in configuring, it is recommended to change INSTALL_PREFIX. Do ccmake /home/"user"/VTK, and then change the CMAKE_INSTALL_PREFIX from /usr/local to /usr. Then, enter c to configure and g to generate.
    (c) If you find the error error: 'S_IFLNK' undeclared (first use in this function) then a small commit ( can fix the issue. Refer to

    sudo make
    sudo make install
    The last instructions will install .h, .a and .cmake files under /usr/local, such as /usr/local/include/vtk-5.8 and /usr/local/lib/vtk-5.8. For convenience of upgrading, it would be useful to create symbolic links (short cut) of /usr/local/include/vtk-5.8 and /usr/local/lib/vtk-5.8 in the global environment:
    cd /usr/local/include
    sudo ln -s vtk-5.8 vtk (It will create a symbolic link named vtk of vtk-5.8 inside /usr/local/include)
    cd /usr/local/lib/
    sudo ln -s vtk-5.8 vtk
    After installing VTK, go to the directory where cmake is installed, e.g. /usr/share/cmake-2.8. Then, go to the subdirectory Modules and open the file FindVTK.cmake and you will see the following lines:
    # The following cache entries must be set by the user to locate VTK:
    # VTK_DIR - The directory containing VTKconfig.cmake.
    At the end of the messages (it could be after (# License text for the above reference.)) add in a new line:
    SET (VTK_DIR "/usr/local/lib/vtk") (Note: This step is generally not required for cmake version 3.0 or more)

  5. ##Installing LIGGGHTS
  6. git clone $HOME/LIGGGHTS-PUBLIC

    ##Compiling LIGGGHTS with jpg, png support
    gedit /$HOME/LIGGGHTS-PUBLIC/src/MAKE/Makefile.ubuntuVTK
    In the line that defines LMP_INC switch: at the end add a tab followed by "-DLAMMPS_JPEG -DLAMMPS_PNG"
    In the line that defines JPG_INC switch add at the end "-I/usr/include"
    In the line that defines JPG_LIB switch add at the end "-ljpeg -lpng "
    In the line that defines VTK_INC switch replace vtk version 5.2 with installed version 5.8 (or if any other is installed, better to check the version inside directory /usr/include/)
    Note: Sometimes VTK might have been installed in a slightly different location, that depends on its configuration at the first stage. In such a case LIGGGHTS shall not be able to find it, and thus, it will throw error such as vtkSmartPointer... not found. Check the VTK location whether it /usr/include/ or /usr/local/include then make appropriate changes in the Makefile line. e.g. VTK_INC = -I/usr/local/include/vtk-5.8
    Similarly, for creating movie file add "-DLAMMPS_FFMPEG" after a tab in LMP_INC switch line. For this you will need FFMPEG package in Ubuntu. See and for installing FFMPEG in Ubuntu. Or else, you can enter following command:
    sudo add-apt-repository ppa:jon-severinsson/ffmpeg
    sudo apt-get update
    sudo apt-get install ffmpeg
    sudo apt-get install frei0r-plugins

    if [ $(cat /etc/*-release | grep "DISTRIB_CODENAME=" | cut -d "=" -f2) == 'trusty' ];
    then sudo add-apt-repository 'deb trusty main' && sudo add-apt-repository 'deb saucy main' && sudo apt-get update

    cd /home/"user"/LIGGGHTS-PUBLIC/src
    sudo make clean-all
    sudo make ubuntuVTK or make fedora
    For problem compiling liggghts 3.0 or more please refer to
    After successful compiling liggghts:
    sudo ln -s /$HOME/LIGGGHTS-PUBLIC/src/lmp_ubuntuVTK /usr/bin/liggghts
    sudo gedit ~/.bashrc
    Add following lines (with appropriate path) at the end of file and save it.
    alias "liggghts=/path to LIGGGHTS-PUBLIC/src/lmp_ubuntuVTK"

    Open new terminal and type
    Liggghts comes up, telling version, compiling date etc.

  7. ##Checking LIGGGHTS for a simulation
  8. cd /home/"user"/LIGGGHTS-PUBLIC/examples/LIGGGHTS/Tutorials_public/chute_wear
    liggghts < in.chute_wear
    Simulation will create dump files in the post folder.

  9. ## Install LPP for postprocessing
  10. sudo apt-get install python-numpy
    sudo git clone $HOME/LPP
    gedit ~/.bashrc
    add at the bottom alias lpp="python $HOME/LPP/src/"

  11. ##Checking the lpp installation
  12. Open new terminal
    cd /home/"user"/LIGGGHTS-PUBLIC/examples/LIGGGHTS/Tutorials_public/chute_wear/post
    lpp dump*.chute
    .vtk files will be created in the post folder which can be used later for visualization of simulation in paraview.

  13. ##Install Syntax Highlighting for gedit
  14. cd ~
    Extract the downloaded file or run tar -zxvf language-specs.tar.gz?...
    sudo mv $HOME/language-specs/liggghts.lang /usr/share/gtksourceview-3.0/language-specs

  15. ##Installing paraview
  16. Note: sudo apt-get install paraview install an older version of paraview, which in my case was crashing while opening a .stl file. .stl file represents geometry in LIGGGHTS simulation. I don't about others but in my case it was crashing. So, I decided to install paraview 4.

    Download the latest binary installer tar.gz file of paraview from
    Extract the tar.gz file in the same directory
    cd /home/"user"/Downloads {if the tar.gz is downloded in Downloads directory otherwise cd to appropriate directory}
    sudo cp -r ParaView-4.0.1-Linux-32bit /opt/ {Check the folder name for any corrections; make corrections according to 64 bit version}
    Check if it is installed by
    cd ~
    /opt/ParaView-4.0.1-Linux-32bit/bin/paraview {correct for 64 bit paraview, check the exact folder name in /opt/}
    Paraview should open up now
    Add the PATH to bashrc file, so that paraview opens only by entering paraview
    gedit ~/.bashrc
    Add the following line at bottom
    export PATH=/opt/ParaView-4.0.1-Linux-32bit/bin/:$PATH {correct for 64bit paraview}
    Check if paraview installed by entering paraview in new terminal. Check the version of paraview at the top.
    Note: (a) if received error like /opt/ParaView-4.4.0-Qt4-Linux-64bit/lib/paraview-4.4/paraview: error while loading shared libraries: cannot open shared object file: No such file or directory. It is caused by shared library issue especially in Paraview-4.4Qt4.
    Enter the following commands
    sudo chmod -R a+rx /opt/ParaView-4.4.0-Qt4-Linux-64bit/
    (b) if you have installed any other version of paraview earlier then opening paraview through Dash Home may open a different version.

  17. ##Checking the simulated results
    In paraview, open folder /home/"user"//LIGGGHTS-PUBLIC/examples/LIGGGHTS/Tutorials_public/chute_wear then select all .stl files. Again, in paraview open folder /home/"user"/LIGGGHTS-PUBLIC/examples/LIGGGHTS/Tutorials_public/chute_wear/post and open all .vtk files.
    Click on Apply they play simulation.
  18. ##Enabling parallel processing in LIGGGHTS
  19. see processors command in manual to add feature in in.script
    gedit ~/.bashrc
    add at the bottom export WM_NCOMPPROCS=2 (where is the number of processors in your pc)
    command to initiate simulation with parallel computing mpirun -np 2 liggghts -in in.script