Compiling USER-GFMD to LAMMPS-10Mar21 with OpenMPI and GNU

Prerequisites

  • openmpi-3.1.4
  • gnu-6.5
  • m4-1.4.18
  • gmp-6.1.0
  • mpfr-3.1.4
  • mpc-1.0.3
  • isl-0.18
  • gsl-2.1
  • python-3.6.9
  • fftw-3.3.8

Download the lammps.10Mar2021.tar.gz from https://download.lammps.org/tars/

Step 1: Untar LAMMPS

% tar -zxvf lammps-10Mar2021.tar.gz

Step 2: Go to $LAMMPS_HOME/src. Make Packages. I will only need kspace and USER-GFMD.

% make yes-kspace
% make pi
% make ps

Step 3: Preparing Green’s function molecular dynamics (GFMD) code on LAMMPS. For more information on the website, https://github.com/Atomistica/user-gfmd

% cd $LAMMPS_HOME
% git clone https://github.com/Atomistica/user-gfmd.git

You should see a directory called user-gfmd in your $LAMMPS_HOME. Rename it to uppercase

% mv user-gfmd USER-GFMD

Copy the USER-GDMD to the $LAMMPS_HOME/src and
Make the package

% cp USER-GFMD to src
% make yes-user-gfmd

Step 4: Edit the Makefile.g++_openmpi

% vim $LAMMPS_HOME/src/MAKE/OPTIONS/Makefile.g++_openmpi
FFT_INC =       -DFFT_FFTW3 -I/usr/local/fftw-3.3.8-gcc6/include
FFT_PATH =      -L/usr/local/fftw-3.3.8-gcc6/lib
FFT_LIB =        -lfftw3

The -DFFT_FFTW3 was important or I will get error like

mpicxx -std=c++11 -g -O3 -DLAMMPS_GZIP -DGFMD_FFTW3 -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I/usr/local/fftw-3.3.8-gcc6/include -c ../nonperiodic_stiffness.cpp
../nonperiodic_stiffness.cpp:199:4: error: #error NonperiodicStiffnessKernel requires FFTW3
#error NonperiodicStiffnessKernel requires FFTW3
^~~~~
make[1]: *** [nonperiodic_stiffness.o] Error 1

Step 5: Compile LAMMPS

% make clean-all
% make g++_openmpi

You should have binary called lmp_g++_openmpi. Do a softlink

% ln -s lmp_g++_openmpi lammps

Make and Run USER-GFMD Units Tests

% cd src/USER-GFMD/
% make unittests
% ./unittests
[==========] Running 23 tests from 5 test cases.
[----------] Global test environment set-up.
[----------] 5 tests from CrystalSurfaceTest
[ RUN      ] CrystalSurfaceTest.fcc100
[       OK ] CrystalSurfaceTest.fcc100 (0 ms)
[ RUN      ] CrystalSurfaceTest.fcc100_supercell
[       OK ] CrystalSurfaceTest.fcc100_supercell (11 ms)
[ RUN      ] CrystalSurfaceTest.reverse_indices
[       OK ] CrystalSurfaceTest.reverse_indices (0 ms)
[ RUN      ] CrystalSurfaceTest.fcc100_3nn
[       OK ] CrystalSurfaceTest.fcc100_3nn (0 ms)
[ RUN      ] CrystalSurfaceTest.fcc100_neighbor_shells
[       OK ] CrystalSurfaceTest.fcc100_neighbor_shells (0 ms)
[----------] 5 tests from CrystalSurfaceTest (12 ms total)
.....
.....
.....

Run Tests

% cd src/USER-GFMD/tests
% sh run_tests.sh ../../lmp_g++_openmpi

I had some errors, but it did not look critical. Tests were run without failures

.....
.....
TEST_Hertz_sc100_128x128_a0_1.3
eval.py:83: RuntimeWarning: invalid value encountered in sqrt
  pa_xy = np.where(r_xy<a, p0*np.sqrt(1-(r_xy/a)**2), np.zeros_like(r_xy))
.ok.
TEST_restart
.ok.
Ran 20 tests; 0 failures, 20 successes.
Advertisement

Error: Too many elements extracted from the MEAM Library on LAMMPS

If you encounter an errors similar

ERROR: Too many elements extracted from MEAM library (current limit:5 ). Increase 'maxelt' in meam.h and recompile. 
Last command: pair_coeff     * * library.alloy2.meam .............................

Move to /usr/local/lammps-29Oct20/src/USER-MEAMC/meam.h and /usr/local/lammps-29Oct20/src/meam.h. Edit line 22. The default value is #define maxelt 5

#definte maxelt 6

Recompile the lammps. Go to /usr/local/lammps-29Oct20/src

% make clean-all
% make g++_openmpi -j 16

References

  1. Compiling LAMMPS-15Jun20 with GNU 6 and OpenMPI 3

No MEAM parameter file in pair coefficients Errors in LAMMPS

If you are encountering errors like, you may want to check

ERROR: No MEAM parameter file in pair coefficients (../pair_meamc.cpp:243)

When a pair_coeff command using a potential file is specified, LAMMPS looks for the potential file in 2 places. First it looks in the location specified. E.g. if the file is specified as “niu3.eam”, it is looked for in the current working directory. If it is specified as “../potentials/niu3.eam”, then it is looked for in the potentials directory, assuming it is a sister directory of the current working directory. If the file is not found, it is then looked for in one of the directories specified by the LAMMPS_POTENTIALS environment variable. Thus if this is set to the potentials directory in the LAMMPS distribution, then you can use those files from anywhere on your system, without copying them into your working directory. Environment variables are set in different ways for different shells. Here are example settings for

 export LAMMPS_POTENTIALS=/path/to/lammps/potentials

For more information, do read LAMMPS Documentation https://docs.lammps.org/stable/pair_coeff.html

KIM_SimulatorHeaders.h: No such file or directory during compilation of lammps

If you encounter an error such as the one below during compilation for lammps such as written in Compiling LAMMPS-15Jun20 with GNU 6 and OpenMPI 3

After running the command,

% make g++_openmpi -j 16

you may encounter

In file included from ../style_pair.h:112:0,
                 from ../force.cpp:20:
../pair_kim.h:70:34: fatal error: KIM_SimulatorHeaders.h: No such file or directory
 #include "KIM_SimulatorHeaders.h"

This is due to one of the a header file not found at /usr/local/lammps-29Oct20/src/pair_kim.h. At line 70, modify the actual location of KIM_SimulatorHeaders.h

/* #include "KIM_SimulatorHeaders.h" */
#include "/usr/local/lammps-29Oct20/lib/kim/kim-api-2.1.3/build/installed-kim-api-2.1.3/include/kim-api/KIM_SimulatorHeaders.h"

Again, after running the command,

% make g++_openmpi -j 16

you may encounter

mpicxx -g -O3  -DLAMMPS_GZIP -I../../lib/colvars -DLMP_USER_OMP -I../../lib/voronoi/includelink -DLMP_PYTHON -I../../lib/poems -DLMP_MPIIO -I../../lib/message/cslib/src -I../../lib/latte/includelink -DLMP_KOKKOS  -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1     -I/usr/include/python2.7 -I/usr/include/python2.7   -I./ -I../../lib/kokkos/core/src -I../../lib/kokkos/containers/src -I../../lib/kokkos/algorithms/src --std=c++11 -fopenmp -I./ -I../../lib/kokkos/core/src -I../../lib/kokkos/containers/src -I../../lib/kokkos/algorithms/src   -DLMP_KIM_CURL   -c ../kim_param.cpp
../kim_param.cpp:73:34: fatal error: KIM_SimulatorHeaders.h: No such file or directory
 #include "KIM_SimulatorHeaders.h"

This is due to one of the a header file not found at /usr/local/lammps-29Oct20/src/kim_param.cpp. At line 73, modify the actual location of KIM_SimulatorHeaders.h

/* #include "KIM_SimulatorHeaders.h" */
#include "/usr/local/lammps-29Oct20/lib/kim/kim-api-2.1.3/build/installed-kim-api-2.1.3/include/kim-api/KIM_SimulatorHeaders.h"

There might be the same issue for kim_init.cpp, fix_store_kim.cpp, pair.kim.h etc

voro++.hh: No such file or directory during compilation of lammps with voronoi

If you encounter an error such as the one below during compilation for lammps such as written in Compiling LAMMPS-15Jun20 with GNU 6 and OpenMPI 3

../compute_voronoi_atom.h:24:21: fatal error: voro++.hh: No such file or directory

This is due to one of the a header file not found at /usr/local/lammps-29Oct20/src/compute_voronoi_atom.cpp. To resolve the issue, do take a look at Line 23 or 24 and edit to the path where you place voro++.hh

/* #include <voro++.hh> */
#include "/usr/local/lammps-29Oct20/lib/voronoi/voro++-0.4.6/src/voro++.hh"

References:

  1. https://sourceforge.net/p/lammps/mailman/message/31832584/

Compiling LAMMPS-15Jun20 with GNU 6 and OpenMPI 3

Prerequisites

openmpi-3.1.4
gnu-6.5
m4-1.4.18
gmp-6.1.0
mpfr-3.1.4
mpc-1.0.3
isl-0.18
gsl-2.1
lammps-15Jun20

Download the latest tar.gz from https://lammps.sandia.gov/

Step 1: Untar LAMMPS

% tar -zxvf lammps-stable.tar.gz

Step 2: Go to $LAMMPS_HOME/src. Make Standard Packages

% cd src
% make yes-standard
% make no-gpu
% make no-mscg

Step 3: Compile message libraries

% cd lammps-15Jun20/lib/message/cslib/src
% make lib_parallel zmq=no

Copy and rename the produced cslib/src/libcsmpi.a or libscnompi.a file to cslib/src/libmessage.a

% cp cslib/src/libcsmpi.a cslib/src/libmessage.a

Copy either lammps-15Jun20/lib/message/Makefile.lammps.zmq or Makefile.lammps.nozmq to lib/message/Makefile.lammps

% cp Makefile.lammps.nozmq Makefile.lammps

Step 4: Compile poems

% cd lammps-15Jun20/lib/poems
% make -f Makefile.g++

Step 5: Compile latte
Download LATTE code and unpack the tarball either in this /lib/latte directory

% git clone https://github.com/lanl/LATTE

Inside lammps-15Jun20/lib/latte/LATTE
Modify the makefile.CHOICES according to your system architecture and compilers

% cd lammps-15Jun20/lib/latte/LATTE
% cp makefile.CHOICES makefile.CHOICES.gfort
% make
% cd lammps-15Jun20/lib/latte
% ln -s ./LATTE/src includelink
% ln -s ./LATTE liblink
% ln -s ./LATTE/src/latte_c_bind.o filelink.o
% cp Makefile.lammps.gfortran Makefile.lammps

Step 6. Compile Voronoi

Download voro++-0.4.6.tar.gz from http://math.lbl.gov/voro++/download/
Untar the voro++-0.4.6.tar.gz inside lammps-15Jun20/lib/voronoi/

% tar -zxvf voro++-0.4.6.tar.gz
% cd lammps-15Jun20/lib/voronoi/voro++-0.4.6
% make

Step 7: Compile kim

Download kim from https://openkim.org/doc/usage/obtaining-models . The current version is  kim-api-2.1.3.txz

Download at /lammps-15Jun20/lib/kim

% cd lammps-15Jun20/lib/kim
% tar Jxvf kim-api-2.1.3.txz
% cd kim-api-2.1.3
% mkdir build
% cd build
% cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}/../../installed-kim-api-2.1.3
% make -j2
% make install
% cd /lammps-15Jun20/lib/kim/installed-kim-api-2.1.3/
% source ${PWD}/kim-api-X2.1.3/bin/kim-api-activate
% kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_324507536345_002

Step 8: Compile USER-COLVARS

% cd lammps-15Jun/lib/colvars
% make -f Makefile.g++

Step 9: Check Packages Status

% make package-status
[root@hpc-gekko1 src]# make package-status
Installed YES: package ASPHERE
Installed YES: package BODY
Installed YES: package CLASS2
Installed YES: package COLLOID
Installed YES: package COMPRESS
Installed YES: package CORESHELL
Installed YES: package DIPOLE
Installed  NO: package GPU
Installed YES: package GRANULAR
Installed YES: package KIM
.....
.....

Step 9a: To Activate Standard Package

% make yes-standard

Step 9b: To activate USER-COLVARS, USER-OMP

% make yes-user-colvars
% make yes-user-omp

Step 9c: To deactivate GPGPU

% make no-gpu

Step 10: Finally Compile LAMMPS

% cd lammps-15Jun20/src
% make g++_openmpi -j 16

You should have binary called lmp_g++_openmpi
Do a softlink

ln -s lmp_g++_openmpi lammps

Compile LATTE package for LAMMPS using Intel Compilers

Step 1: Download LATTE Source Code from Project

Download or clone the LATTE source code from https://github.com/lanl/LATTE. If you download a zipfile or tarball, unpack the tarball either in this /lib/latte directory or somewhere else on your system.

Step 2: Modify makefile.CHOICES

Modify the makefile.CHOICES according to your system architecture and compilers. Check that the MAKELIB flag is ON in makefile.CHOICES and finally, build the code via the make command

#
# Compilation and link flags for LATTE
#

# Precision - double or single
PRECISION = DOUBLE
#PRECISION = SINGLE

# Make the latte library
# AR and RUNLIB executable default path to compile
# latte as a library (change accordingly)
MAKELIB = ON
AR = /usr/bin/ar cq
RANLIB = /usr/bin/ranlib

# Use PROGRESS and BML libraries
PROGRESS = OFF
PROGRESS_PATH= $(HOME)/qmd-progress/install/lib
BML_PATH= $(HOME)/bml/install/lib

# Use METIS library for graph partitioning
METIS = OFF
METIS_PATH= $(HOME)/metis/metis-5.1.0/install

# GPU available - OFF or ON
GPUOPT = OFF

# Using DBCSR library from cp2k? OFF or ON
DBCSR_OPT = OFF

# Parallelizing over k-points?
MPIOPT = OFF

#
# CPU Fortran options
#

#For GNU compiler:
#FC = mpif90
FC = gfortran
FCL = $(FC)
FFLAGS = -O3 -fopenmp -cpp
#FFLAGS =  -fast -Mpreprocess -mp
LINKFLAG = -fopenmp

#For intel compiler:
FC = ifort
FCL = $(FC)
FFLAGS =  -O3 -fpp -qopenmp
LINKFLAG = -qopenmp
LIB = -mkl=parallel

#GNU BLAS/LAPACK libraries:
#LIB = -L/usr/local/lapack-3.8.0 -llapack -L/usr/local/blas-3.8.0/lib -lblas

#Intel MKL BLAS/LAPACK libraries:
LIB = -Wl,--no-as-needed -L${MKLROOT}/lib/intel64 \
 -lmkl_lapack95_lp64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core \
 -lmkl_gnu_thread -lmkl_core -ldl -lpthread -lm

#Alternative flags for MKL:
#LIB += -mkl=parallel

#Other BLAS/LAPACK vendors:
#LIB = -framework Accelerate
#LIB = -L/usr/projects/hpcsoft/toss2/common/acml/5.3.1/gfortran64/lib -lacml

# Uncomment for coverage
#CVR = OFF
ifeq ($(CVR), ON)
        FFLAGS += -fprofile-arcs -ftest-coverage
        LINKFLAG += -fprofile-arcs -ftest-coverage
endif

ifeq ($(PROGRESS), ON)
        LIB += -L$(PROGRESS_PATH) -lprogress -L$(BML_PATH) -lbml_fortran -lbml
        FFLAGS += -I$(BML_PATH)/../include -I$(PROGRESS_PATH)/../include
endif

ifeq ($(GRAPH), ON)
        LIB += -L$(METIS_PATH)/lib -lmetis
        FFLAGS += -I$(METIS_PATH)/include
endif

#DBCSR_LIB = -L/home/cawkwell/cp2k/lib/cawkwell/popt -lcp2k_dbcsr_lib
#DBCSR_MOD = -I/home/cawkwell/cp2k/obj/cawkwell/popt

#
# GPU options
#

GPU_CUDA_LIB = -L/usr/local/cuda-9.1/lib64 -lcublas -lcudart
GPU_ARCH = sm_20
# make

You should see liblatte.a file.

 

LAMMPS Tools and Packmol with Intel Fortran

PACKMOL information can be obtained from http://www.ime.unicamp.br/~martinez/packmol/userguide.shtml#conv

Installing can be found at http://www.ime.unicamp.br/~martinez/packmol/userguide.shtml#comp

1. Compile Packmol with Intel Fortran

# tar -zxvf packmol.tar.gz
# cd packmol
# ./configure ifort
# make

2. LAMMPS Tools

# git clone https://github.com/jdevemy/lammps-tools.git
# cd lammps-tools
# python setup.py build
# sudo python setup.py install

3. Make sure the Python has the following libraries in create_conf (sys, os, logging, argparse, math random)

4. Make sure the Python (if you install lammps-tool)

# export PYTHONPATH=/home/user1/Downloads/lammps-tools-master/lib
# ./create_conf

Compiling LAMMPS-14May16 with Intel-15.0.6 and Intel-MPI-5.0.3

Step 1: Remember to initialise Intel Environment. In your .bashrc

source /usr/local/intel/impi/5.0.3.049/bin64/mpivars.sh intel64
source /usr/local/intel/composerxe/bin/compilervars.sh intel64
source /usr/local/intel/mkl/bin/mklvars.sh intel64

Step 2: Untar LAMMPS

# tar -zxvf lammps-stable.tar.gz

Step 3: Prepare selected libraries for lammps

3a. lib/reax

# make -f Makefile.gfortran

3b. lib/meam

# make -f Makefile.ifort

3c. lib/poems

# make -f Makefile.icc

3d. lib/colvars

# make -f Makefile.g++

Step 4: Compile required the packages. Go to src directory

# cd src

4a. Check which packages are included

# make package-status
Installed YES: package ASPHERE
Installed YES: package BODY
Installed YES: package CLASS2
Installed YES: package COLLOID
Installed YES: package COMPRESS
Installed YES: package CORESHELL
Installed YES: package DIPOLE
Installed YES: package FLD
Installed  NO: package GPU
Installed YES: package GRANULAR
Installed  NO: package KIM
Installed YES: package KOKKOS
  src/pair_lj_sdk_kokkos.cpp does not exist
  src/pair_lj_sdk_kokkos.h does not exist
Installed YES: package KSPACE
Installed YES: package MANYBODY
Installed YES: package MC
Installed YES: package MEAM
Installed YES: package MISC
Installed YES: package MOLECULE
Installed YES: package MPIIO
Installed YES: package OPT
Installed YES: package PERI
Installed YES: package POEMS
Installed YES: package PYTHON
Installed YES: package QEQ
Installed YES: package REAX
Installed YES: package REPLICA
Installed YES: package RIGID
Installed YES: package SHOCK
Installed YES: package SNAP
Installed YES: package SRD
Installed  NO: package VORONOI
Installed YES: package XTC
.........

4b. Choose all the standard

# make yes-standard

4c. Exclude packages that are not required

# make no-voronoi
# make no-kim
# make no-gpu
# make no-kokkos

Step 5: Install User-Contributed Intel Optimised Package (user-intel) and User-Contributed OpenMP Packages (user-omp)

# make yes-user-intel
# make yes-user-omp

Step 6: Compile LAMMPS

Check make options. Go to src

# make intel_cpu_intelmpi -j 16

Step 6a:

If in the midst of compilation you land yourself in this error ld: unable to to locate -lompstub. This is due to Intel 2015 using depreciating ompstub to ompistub5. Just go to the Intel Directory

# cd /usr/local/intel_2015/composerxe/lib/intel64
# ln -s  libiompstubs5.so libompstub.so

Step 7: Create a /usr/local/lammps-7Dec15 and copy libraries. Go to lammps root directory

# cp -Rv bench /usr/local/lammps-14May16
# cp -Rv doc /usr/local/lammps-14May16
# cp -Rv examples /usr/local/lammps-14May16
# cp -Rv potentials /usr/local/lammps-14May16
# cp README /usr/local/lammps-14May16
# cp -Rv tools /usr/local/lammps-14May16
# cp -Rv lib /usr/local/lammps-14May16
# cp src/lmp_intel_cpu_intelmpi /usr/local/lammps-14May16/bin

7a. Create a softlinks

# ln -s /usr/local/lammps-7Dec15/bin/lmp_intel_cpu_intelmpi lammps

References:

  1. Quick install guide for LAMMPS on Linux cluster
  2. LAMMPS Optimized for Intel on Quad Socket Xeon

 

Compiling LAMMPS-7Dec2015 with OpenMPI and GNU

From what I know for LAMMPS-7Dec2015, you should be able to e FFTW3. The current version at this point in writing is FFTW-3.3.4 (http://www.fftw.org/download.html)

Step 1: Compiling FFTW-3.3.4

# tar -zxvf fftw-3.3.4.tar.gz
# cd fftw-3.3.4
# ./configure --prefix=/usr/local/fftw-3.3.4 CC=mpicc F77=mpif90
# make -j 16
# make install

Step 1a. Compile OpenMPI and GNU (Not covered here)

Step 2: Untar LAMMPS

# tar -zxvf lammps-stable.tar.gz

Step 3: Prepare libraries for lammps

3a. lib/reax

# make -f Makefile.gfortran

3b. lib/meam

# make -f Makefile.gfortran

3c. lib/poems

# make -f Makefile.g++

Step 4: Compile required the packages. Go to src directory

# cd src

4a. Check which packages are included

# make package-status
Installed YES: package ASPHERE
Installed YES: package BODY
Installed YES: package CLASS2
Installed YES: package COLLOID
Installed YES: package COMPRESS
Installed YES: package CORESHELL
Installed YES: package DIPOLE
Installed YES: package FLD
Installed  NO: package GPU
Installed YES: package GRANULAR
Installed  NO: package KIM
Installed YES: package KOKKOS
  src/pair_lj_sdk_kokkos.cpp does not exist
  src/pair_lj_sdk_kokkos.h does not exist
Installed YES: package KSPACE
Installed YES: package MANYBODY
Installed YES: package MC
Installed YES: package MEAM
Installed YES: package MISC
Installed YES: package MOLECULE
Installed YES: package MPIIO
Installed YES: package OPT
Installed YES: package PERI
Installed YES: package POEMS
Installed YES: package PYTHON
Installed YES: package QEQ
Installed YES: package REAX
Installed YES: package REPLICA
Installed YES: package RIGID
Installed YES: package SHOCK
Installed YES: package SNAP
Installed YES: package SRD
Installed  NO: package VORONOI
Installed YES: package XTC
.........

4b. Choose all the standard

# make yes-standard

4c. Exclude packages that are not required

# make no-voronoi
# make no-kim
# make no-gpu

Step 5: Edit src/MAKE/Makefile.mpi

Around Line 43, 44
Leave MPI_PATH and MPI_LIB empty.

MPI_PATH =
MPI_LIB =

Around Line 53,54,55

FFT_INC =  -I/usr/local/fftw-3.3.3-single/include -DFFT_FFTW
FFT_PATH = -L/usr/local/fftw-3.3.3-single/lib
FFT_LIB = -lfftw

Step 6: Compile LAMMPS

Check make options. Go to src

# make
# make ompi_g++

Step 7: Create a /usr/local/lammps-7Dec15 and copy libraries. Go to lammps root directory

# cp -Rv bench /usr/local/lammps-7Dec15
# cp -Rv doc /usr/local/lammps-7Dec15
# cp -Rv examples /usr/local/lammps-7Dec15
# cp -Rv potentials /usr/local/lammps-7Dec15
# cp README /usr/local/lammps-7Dec15
# cp -Rv tools /usr/local/lammps-7Dec15
# cp -Rv lib /usr/local/lammps-7Dec15/lib
# cp lmp_ompi_g++ /usr/local/lammps-7Dec15/bin

7a. Create a softlinks

# lns -s /usr/local/lammps-7Dec15/bin/lmp_ompi_g++ lammps

References:

  1. Quick install guide for LAMMPS on Linux cluster