2014-04-05 04:08:01 +08:00
|
|
|
# -*- Makefile -*- for coupling LAMMPS to PWscf for QM/MM molecular dynamics
|
|
|
|
|
|
|
|
# this file will be copied to Makefile.lammps
|
|
|
|
EXTRAMAKE = Makefile.lammps.empty
|
|
|
|
|
2016-07-16 06:38:42 +08:00
|
|
|
# top level directory of Quantum ESPRESSO 5.4.1 or later
|
2014-04-05 04:08:01 +08:00
|
|
|
QETOPDIR=$(HOME)/compile/espresso
|
|
|
|
|
|
|
|
# import compiler settings from Quantum ESPRESSO
|
|
|
|
sinclude $(QETOPDIR)/make.sys
|
|
|
|
|
2016-07-16 06:38:42 +08:00
|
|
|
# FLAGS for c++ OpenMPI 1.8.8 or later when QE was compiled with GNU Fortran 4.x
|
2014-04-05 04:08:01 +08:00
|
|
|
MPICXX=mpicxx
|
2016-03-02 04:47:13 +08:00
|
|
|
MPICXXFLAGS=-DOMPI_SKIP_MPICXX=1 -O2 -Wall -g -fPIC\
|
2014-04-05 04:08:01 +08:00
|
|
|
-I../../src -I$(QETOPDIR)/COUPLE/include
|
2016-03-02 04:47:13 +08:00
|
|
|
MPILIBS=-fopenmp -lgfortran -ldl -ljpeg -lpng -lz -lmpi_mpifh -lmpi
|
2014-04-05 04:08:01 +08:00
|
|
|
|
|
|
|
# location of required libraries
|
|
|
|
# part 1: hi-level libraries for building pw.x
|
|
|
|
PWOBJS = \
|
|
|
|
$(QETOPDIR)/COUPLE/src/libqecouple.a \
|
|
|
|
$(QETOPDIR)/PW/src/libpw.a \
|
|
|
|
$(QETOPDIR)/Modules/libqemod.a
|
|
|
|
# part 2: lo-level libraries for all of Q-E
|
|
|
|
LIBOBJS = \
|
2016-07-16 06:38:42 +08:00
|
|
|
$(QETOPDIR)/FFTXlib/libqefft.a \
|
|
|
|
$(QETOPDIR)/LAXlib/libqela.a \
|
2014-04-05 04:08:01 +08:00
|
|
|
$(QETOPDIR)/clib/clib.a \
|
|
|
|
$(QETOPDIR)/iotk/src/libiotk.a
|
|
|
|
|
|
|
|
# part 3: add-on libraries and main library for LAMMPS
|
|
|
|
sinclude ../../src/Makefile.package
|
|
|
|
LAMMPSCFG = openmpi-omp
|
|
|
|
LAMMPSLIB = ../../src/liblammps_$(LAMMPSCFG).a
|
|
|
|
|
|
|
|
# part 4: local QM/MM library and progams
|
|
|
|
SRC=pwqmmm.c libqmmm.c
|
|
|
|
OBJ=$(SRC:%.c=%.o)
|
|
|
|
|
|
|
|
|
|
|
|
default: libqmmm.a
|
|
|
|
|
|
|
|
all : tldeps libqmmm.a pwqmmm.x
|
|
|
|
|
|
|
|
pwqmmm.x : pwqmmm.o $(OBJ) $(PWOBJS) $(LIBOBJS) $(LAMMPSLIB)
|
|
|
|
$(MPICXX) $(LDFLAGS) -o $@ $^ $(PKG_PATH) $(PKG_LIB) $(MPILIBS) $(LIBS)
|
|
|
|
|
|
|
|
libqmmm.a: libqmmm.o
|
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
@cp $(EXTRAMAKE) Makefile.lammps
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(MPICXX) -c $(LAMMPSFLAGS) $(MPICXXFLAGS) $< -o $@
|
|
|
|
|
|
|
|
tldeps:
|
|
|
|
( cd $(QETOPDIR) ; $(MAKE) $(MFLAGS) couple || exit 1)
|
|
|
|
$(MAKE) -C ../../src $(MFLAGS) $(LAMMPSCFG)
|
2016-03-02 04:47:13 +08:00
|
|
|
$(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG)
|
2014-04-05 04:08:01 +08:00
|
|
|
|
|
|
|
clean :
|
2016-09-09 04:20:32 +08:00
|
|
|
-rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L
|
2014-04-05 04:08:01 +08:00
|
|
|
|
|
|
|
# explicit dependencies
|
|
|
|
|
|
|
|
pwqmmm.o: pwqmmm.c libqmmm.h
|
|
|
|
libqmmm.o: libqmmm.c libqmmm.h
|