From 765fe3cdfe678d9f5e089386f7150ee5a2d0eeed Mon Sep 17 00:00:00 2001 From: Christian Negre Date: Mon, 14 Nov 2016 07:58:47 -0700 Subject: [PATCH] changes for lattelib --- lib/latte/Makefile.lammps.gfortran | 23 ++++++++++++++++++++--- src/LATTE/fix_latte.cpp | 17 ++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/latte/Makefile.lammps.gfortran b/lib/latte/Makefile.lammps.gfortran index 0ad5b1ad01..76913c6e5b 100644 --- a/lib/latte/Makefile.lammps.gfortran +++ b/lib/latte/Makefile.lammps.gfortran @@ -1,5 +1,22 @@ # Settings that the LAMMPS build will import when this package is installed +# Change all the flags and paths accordingly +# If using PROGRESS/BML set PROGRESS to ON +# For more information about these libraries see: +# BML: https://github.com/qmmd/bml +# PROGRESS: https://github.com/losalamos/qmd-progress +# METIS: + +latte_PATH = ${HOME}/exaalt/LATTE +progress_PATH = ${HOME}/qmd-progress +bml_PATH = ${HOME}/bml +metis_PATH = ${HOME}/Programs/metis-5.1.0 + +latte_SYSINC = -I${latte_PATH}/src -I${bml_PATH}/install/include -I${progress_PATH}/install/include +latte_SYSLIB = -fopenmp ${latte_PATH}/liblatte/latte_c_bind.o ${latte_PATH}/liblatte.a -lgfortran \ + -lm -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 + +# Uncomment the following line to use PROGRESS/BML +latte_SYSLIB += -L${progress_PATH}/install/lib -lprogress -L${bml_PATH}/install/lib -lbml -L${metis_PATH}/install -lmetis + -latte_SYSINC = -latte_SYSLIB = -lgfortran -latte_SYSPATH = diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 1ff45a869e..d15ee59872 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -28,6 +28,10 @@ using namespace LAMMPS_NS; using namespace FixConst; + extern "C" { + void latte(int*, double*, int*, double*); + } + #define INVOKED_PERATOM 8 /* ---------------------------------------------------------------------- */ @@ -35,7 +39,7 @@ using namespace FixConst; FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg != 4) error->all(FLERR,"Illegal fix latte command"); + if (narg != 5) error->all(FLERR,"Illegal fix latte command"); // store pe/atom ID used for input of Coulomb potential to LATTE // insure it is valid for these computations @@ -49,6 +53,8 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : if (modify->compute[ipe]->peatomflag == 0) error->all(FLERR,"Fix latte compute ID does not compute pe/atom"); +// latte(arg[4]); + // initialize LATTE with LAMMPS info about box, atoms, atom types, etc ? // may need to be done in init() ?? @@ -183,7 +189,7 @@ void FixLatte::post_force(int vflag) // what should cutoffs be for passing neighlist info to LATTE ?? // do cutoffs include many self image atoms for tiny periodic system ?? - int i,j,ii,jj,inum,jnum; +/* int i,j,ii,jj,inum,jnum; int *ilist,*jlist,*numneigh,**firstneigh; inum = list->inum; @@ -218,7 +224,11 @@ void FixLatte::post_force(int vflag) double *pe = c_pe->vector_atom; modify->addstep_compute(update->ntimestep+1); - +*/ + int natoms = (int) atom->natoms; + latte(&natoms,&atom->x[0][0],atom->type,&atom->f[0][0]); +// latte(&natoms,&atom->x[0][0],atom->type); + // construct H0,S,Z // setup full Hamiltonian H(R,n) // calculate density matrix D and charge q(n) @@ -281,3 +291,4 @@ double FixLatte::compute_scalar() return 0.0; } +