# SuperMUC-NG arch file
# module swap devEnv/Intel/2019 devEnv/GCC/8-IntelMPI 
# module swap mpi.intel openmpi/4.0.2 
# module load mkl/2019_gcc 


CC       = mpicc -fopenmp
FC       = mpif90 -fopenmp
LD       = mpif90 -fopenmp
AR       = ar -r


DATA_DIR  = /hppfs/work/pn68ho/di67kis/CP2K/cp2k-8.1/data
CP2K_ROOT = /hppfs/work/pn68ho/di67kis/CP2K

MKL_LIB = ${MKLROOT}/lib/intel64

# Options

DFLAGS   = -D__FFTW3 -D__MKL -D__LIBXC \
           -D__LIBINT -D__LIBXSMM -D__ELPA=202005 -D__MAX_CONTR=4  \
           -D__parallel -D__SCALAPACK -D__MPI_VERSION=3 \
           -D__STATM_RESIDENT

CFLAGS   = -O3 -mavx -funroll-loops -ftree-vectorize \
           -ffree-form -march=native -fno-math-errno \
           -I$(CP2K_ROOT)/libs/libxsmm/include

FCFLAGS  = $(DFLAGS) $(CFLAGS) \
           -I$(CP2K_ROOT)/libs/libint/include \
           -I$(CP2K_ROOT)/libs/libxc/include \
           -I$(MKLROOT)/include -m64 \
           -I$(CP2K_ROOT)/libs/libxsmm/include \
           -I$(CP2K_ROOT)/libs/fftw/include \
           -I$(CP2K_ROOT)/libs/elpa-openmp/include/elpa_openmp-2020.05.001/modules \
           -I$(CP2K_ROOT)/libs/elpa-openmp/include/elpa_openmp-2020.05.001/elpa

LDFLAGS  = $(FCFLAGS)

LIBS     = -L$(CP2K_ROOT)/libs/libint/lib -lint2  \
           -L$(CP2K_ROOT)/libs/libxc/lib -lxcf90 -lxcf03 -lxc \
           -L$(CP2K_ROOT)/libs/libxsmm/lib -lxsmmf -lxsmm -lxsmmext \
           -L$(CP2K_ROOT)/libs/elpa-openmp/lib -lelpa_openmp \
           -L$(CP2K_ROOT)/libs/fftw/lib -lfftw3 -lfftw3_threads -lz -ldl -lstdc++ \
           $(MKL_LIB)/libmkl_scalapack_lp64.a -Wl,--start-group \
           $(MKL_LIB)/libmkl_gf_lp64.a $(MKL_LIB)/libmkl_sequential.a \
           $(MKL_LIB)/libmkl_core.a \
           $(MKL_LIB)/libmkl_blacs_openmpi_lp64.a -Wl,--end-group \
           -lpthread -lm
