# Irene ARCH file
# module load feature/openmpi/mpi_compiler/gcc
# module load  flavor/openmpi
# module load gnu/8.3.0
# module load  mkl

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

DATA_DIR   = /ccc/work/cont005/pa5489/judgehol/CP2K/cp2k-8.1/data
CP2K_ROOT  = /ccc/work/cont005/pa5489/judgehol/CP2K


MKL_LIB = ${MKLROOT}/lib/intel64

# Options

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

CFLAGS   = -O2 -g -funroll-loops -ftree-vectorize -std=f2008 \
           -ffree-form -mtune=native -fno-math-errno -ffree-line-length-none

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

LDFLAGS  = $(FCFLAGS)

LIBS     = -L$(CP2K_ROOT)/libs/libint/lib -lint2  \
           -L$(CP2K_ROOT)/libs/libxsmm/lib -lxsmmf -lxsmm -lxsmmext \
           -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

