This is an old revision of the document!


Build from source: LAMMPS

Start by setting-up a properly-versioned directory hierarchy for LAMMPS builds. For example:

$ mkdir -p ~/sw/lammps
$ cd ~/sw/lammps
$ mkdir attic

The attic directory is used to hold downloaded source packages, etc. I can download the latest LAMMPS stable source by visiting the official downloads page and getting a “tarball” of the latest stable release. This usually downloads as lammps-stable.tar.gz which is slightly annoying because it doesn't cite the release date (so every release you download uses the same filename). When I upload the source to ~/sw/lammps/attic I rename it: at the time of writing, the stable release is 11 August 2017, so I rename the file lammps-20170811.tar.gz to make that clear:

$ cd ~/sw/lammps
$ ls -l attic
total 117944
-rw-r--r-- 1 frey cadmin 120774006 2018-02-14 13:42 lammps-20170811.tar.gz

Create a directory to hold the new version you are building. The name should include the release (version or date, etc.) and any special features worth mentioning. In this case, we'll be building against the Altix's standard mpt MPI library without any special options:

$ cd ~/sw/lammps
$ mkdir 20170811
$ ls -l .
total 0
drwxr-xr-x 2 frey cadmin  6 2018-02-14 13:45 20170811
drwxr-xr-x 2 frey cadmin 35 2018-02-14 13:42 attic

Next, unpack the source code inside the version directory just created:

$ cd 20170811
$ tar -zxf ../attic/lammps-20170811.tar.gz
$ ls -l
total 0
drwxr-xr-x 10 frey cadmin 132 2017-08-11 14:19 lammps-11Aug17

The directory structure we promote will have all the executables, libraries, etc. installed in the 20170811 directory; I typically rename the source code directory src rather than whatever name the program author(s) used:

$ mv lammps-11Aug17 src
$ cd src
$ ls -l .
total 100
drwxr-xr-x  5 frey cadmin  4096 2017-08-11 14:18 bench
drwxr-xr-x  5 frey cadmin   104 2017-08-11 14:23 doc
drwxr-xr-x 60 frey cadmin  4096 2017-08-11 14:18 examples
drwxr-xr-x 23 frey cadmin  4096 2017-08-11 14:18 lib
-rw-r--r--  1 frey cadmin 17775 2017-07-24 10:58 LICENSE
drwxr-xr-x  2 frey cadmin  4096 2017-08-11 14:18 potentials
drwxr-xr-x  3 frey cadmin    84 2017-08-11 14:18 python
-rw-r--r--  1 frey cadmin  1690 2011-09-23 19:48 README
drwxr-xr-x 66 frey cadmin 32768 2017-08-11 14:23 src
drwxr-xr-x 28 frey cadmin  4096 2017-08-11 14:19 tools
  • documentation/build/lammps.1518634113.txt.gz
  • Last modified: 2018/02/14 18:48
  • by frey