starting on interface to NWChem

This commit is contained in:
Steve Plimpton
2021-12-21 12:10:20 -07:00
parent e1e5d38480
commit 182457c559
2 changed files with 33 additions and 30 deletions

View File

@ -35,12 +35,13 @@
using namespace LAMMPS_NS;
using namespace FixConst;
extern "C" {
void latte(int *, int *, double *, int *, int *,
double *, double *, double *, double *,
double *, double *, double *, int *,
double *, double *, double *, double *, int * , bool *);
int latte_abiversion();
namespace pwdft {
using namespace pwdft;
extern char *util_date();
extern void seconds(double *);
extern int pspw_geovib(MPI_Comm, std::string&);
extern int pspw_minimizer(MPI_Comm, std::string&);
extern int nwchem_abiversion();
}
// the ABIVERSION number here must be kept consistent
@ -96,9 +97,9 @@ FixNWChem::FixNWChem(LAMMPS *lmp, int narg, char **arg) :
nmax = 0;
qpotential = nullptr;
flatte = nullptr;
nwchem_force = nullptr;
nchem_energy = 0.0;
nwchem_energy = 0.0;
}
/* ---------------------------------------------------------------------- */
@ -107,7 +108,7 @@ FixNWChem::~FixNWChem()
{
delete [] id_pe;
memory->destroy(qpotential);
memory->destroy(fnwchem);
memory->destroy(nwchem_force);
}
/* ---------------------------------------------------------------------- */
@ -291,22 +292,24 @@ void FixNWChem::post_force(int vflag)
else forces = &atom->f[0][0];
int maxiter = -1;
latte(flags,&natoms,coords,type,&ntypes,mass,boxlo,boxhi,&domain->xy,
&domain->xz,&domain->yz,forces,&maxiter,&latte_energy,
&atom->v[0][0],&update->dt,virial,&newsystem,&latteerror);
int nwerr = pwdft::pspw_minimizer(MPI_COMM_WORLD,nwinput);
if (latteerror) error->all(FLERR,"Internal LATTE problem");
//latte(flags,&natoms,coords,type,&ntypes,mass,boxlo,boxhi,&domain->xy,
// &domain->xz,&domain->yz,forces,&maxiter,&latte_energy,
// &atom->v[0][0],&update->dt,virial,&newsystem,&latteerror);
// sum LATTE forces to LAMMPS forces
if (nwerr) error->all(FLERR,"Internal NWChem problem");
// sum NWChem forces to LAMMPS forces
// e.g. LAMMPS may compute Coulombics at some point
if (coulomb) {
double **f = atom->f;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
f[i][0] += flatte[i][0];
f[i][1] += flatte[i][1];
f[i][2] += flatte[i][2];
f[i][0] += nwchem_force[i][0];
f[i][1] += nwchem_force[i][1];
f[i][2] += nwchem_force[i][2];
}
}
}

View File

@ -50,8 +50,8 @@ class FixNWChem : public Fix {
int nmax, newsystem;
double *qpotential;
double **flatte;
double latte_energy;
double **nwchem_force;
double nwchem_energy;
class NeighList *list;
class Compute *c_pe;
@ -64,15 +64,15 @@ class FixNWChem : public Fix {
/* ERROR/WARNING messages:
E: Must use units metal with fix latte command
E: Must use units metal with fix nwchem command
UNDOCUMENTED
E: Fix latte currently runs only in serial
E: Fix nwchem currently runs only in serial
UNDOCUMENTED
E: LAMMPS is linked against incompatible LATTE library
E: LAMMPS is linked against incompatible NWChem library
UNDOCUMENTED
@ -82,35 +82,35 @@ Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Fix latte does not yet support a LAMMPS calculation of a Coulomb potential
E: Fix nwchem does not yet support a LAMMPS calculation of a Coulomb potential
UNDOCUMENTED
E: Could not find fix latte compute ID
E: Could not find fix nwchem compute ID
UNDOCUMENTED
E: Fix latte compute ID does not compute pe/atom
E: Fix nwchem compute ID does not compute pe/atom
UNDOCUMENTED
E: Fix latte requires 3d problem
E: Fix nwchem requires 3d problem
UNDOCUMENTED
E: Fix latte cannot compute Coulomb potential
E: Fix nwchem cannot compute Coulomb potential
UNDOCUMENTED
E: Fix latte requires 3d simulation
E: Fix nwchem requires 3d simulation
UNDOCUMENTED
W: Fix latte should come after all other integration fixes
W: Fix nwchem should come after all other integration fixes
UNDOCUMENTED
E: Internal LATTE problem
E: Internal NWChem problem
UNDOCUMENTED