Tuesday, July 20, 2010

Install lammps on Ubuntu

1. http://ubuntuforums.org/showthread.php?t=1390490
2. http://lammps.sandia.gov/doc/Section_start.html#2_2 (Including/excluding optional packages to lammps)

(1) Install required packages to build LAMMPS
You will need superuser privileges to successfully issue:
Code:
sudo apt-get install build-essential fftw-dev tcsh mpich2 gfortran
  • build-essential is non-negotiable, and you may already have it installed.
  • fftw-dev installs developer files for FFTW2 (not FFTW3, which won't work!) at standard locations that ubuntu knows about. It's possible to configure a LAMMPS compilation without any FFT tables, but I won't cover that here.
  • tcsh is required so the LAMMPS Makefile system works. Substituting this with the "csh" package probably won't make any difference. (EDIT: As of the 30 Jan 2010 patch, this package is no longer needed).
  • mpich2 will install MPICH-2, which can perform compilation of MPI programs linking to native MPI libraries. If only want a serial binary, you may safely leave this package off the list. While there are many other MPI implementations, I am not going to cover them here, though the idea is still the same. MPICH is kind of odd in that it requires a little bit more configuration to make it work, see below for the additional instructions.
  • gfortran is required to compile and link against the Fortran libraries MEAM and REAX. If you use a different Fortran compiler, or will not be linking these libraries, it is safe to leave this item off the package list.
(2) Get LAMMPS
You can do this by going to the LAMMPS WWW site (link) or by issuing the following command in terminal
Code:
  1. wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz
(3) Unpack LAMMPS
Code:
tar xvzf lammps.tar.gz


(5) Copy Makefile to lammps-24Jan10/src/MAKE/Makefile.ubuntu (see: http://ubuntuforums.org/showthread.php?t=1390490 )

Have attached two files, one for serial and parallel builds. Due to the restrictions of the ubuntuforums.org, I had to give these with a ".txt" extension. When copying the makefile, I highly recommend removing everything from the underscore to the end off the filename (especially including the .txt!).

(6)Compile LAMMPS

Make sure you are sitting in lammps-24Jan10/src (not the MAKE directory!). You'll need the STUBS library if you're making a serial binary

  1. Code:
    # for parallel binaries
    make ubuntu
    # for serial, make STUBS, then LAMMPS
    cd STUBS ; make ; cd ..
    make ubuntu
  2. Try an example to verify it works
    While sitting in the src directory, the first command should run the "crack" example in serial mode. If your computer supports it, the second command should utilize 2 cores and run faster. Remember, even if you compile using the parallel makefile, the first invocation will still work, and is the reason you don't need a separate binary for serial runs.
    Code:
    # change to the examples/crack directory
    cd ../examples/crack
    # for serial or parallel builds
    ../../lmp_ubuntu <>

Finally, note that if you want to build lammps again after a new release or when patches of merged with the trunk, You can simply begin at step 3 and follow to the end. That "wget" command should always give you the latest package as long as the LAMMPS people keep their website they way they have it now.

2 comments:

  1. i have successfully installed lammps ubuntu serial. i want to include MEAM package to lammps. can you help me.
    -Karthik

    ReplyDelete
  2. Hi,
    First, in the current version of Lammps there is no make ubuntu.
    Second, when I try to make in src, in middle of compilation it exits the folder and re-enter and it remains in a loop and tries to compile files again and again:
    make[1]: Leaving directory `/home/work/lammps-20Sep12/src/Obj_serial'
    make[1]: Entering directory `/home/work/lammps-20Sep12/src/Obj_serial'

    Any thoughts?
    Thanks

    ReplyDelete