Building ReaxFF support for LAMMPS is not difficult, but the build does not work out-of-the-box on Gordon. These instructions assume that we are using the compile flags found in my LAMMPS Makefile for SDSC Gordon, the LAMMPS source tree is located in a directory called ~/lammps, and we have already done module load intel mvapich2_ib.

1. Create a Makefile for the reax lib and ifort

In your ~/lammps/lib/reax directory, create a Makefile.ifort and fill it with these lines:

SHELL    = /bin/sh
 
SRC      = reax_connect.F reax_inout.F reax_lammps.F reax_poten.F reax_reac.F reax_charges.F
 
HEADERFILES = reax_defs.h *.blk
 
LIB      = libreax.a
OBJ      =   $(SRC:.F=.o)
 
F90      = ifort
F90FLAGS = -O3 -ipo -xHost -fp-model precise -ftz -prec-div -prec-sqrt -fma -fPIC
ARCHIVE  = xiar
ARCHFLAG = -rc
USRLIB   =
SYSLIB   =
 
lib: $(OBJ)
$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
 
%.o:%.F $(HEADERFILES)
$(F90) $(F90FLAGS) -c $<
 
clean:
-rm *.o $(LIB)

Remember that tab characters are important on the instructions for each build target, and they may not paste into your terminal properly.

2. Build libreax.a

Just do make -f Makefile.ifort from within ~/lammps/lib/reax

3. Replace Makefile.lammps

The Makefile.lammps generated during the previous step is likely to contain a bunch of garbage, so get rid of its contents and replace them with the following lines:

reax_SYSINC =
reax_SYSLIB = -lifcore -lsvml -liompstubs5 -limf
reax_SYSPATH =

4. Build LAMMPS

Now just

$ cd ../../src
$ make yes-reax gordon -j16

assuming you've dropped Makefile.gordon into your ~/lammps/src/MAKE/ directory. It should compile and pull in the Reax library you just built.