git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7873 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2012-03-01 16:48:08 +00:00
parent c6dae6c514
commit 3fb19bcea6
8 changed files with 465 additions and 440 deletions

View File

@ -90,6 +90,7 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
double *special_lj = force->special_lj;
int newton_pair = force->newton_pair;
double qqrd2e = force->qqrd2e;
double cut_coulsqplus = (cut_coul+2.0*qdist) * (cut_coul+2.0*qdist);
inum = list->inum;
ilist = list->ilist;
@ -124,7 +125,7 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j];
// LJ interation based on true rsq
// LJ interaction based on true rsq
if (rsq < cut_ljsq[itype][jtype]) {
r2inv = 1.0/rsq;
@ -150,6 +151,9 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
}
// adjust rsq and delxyz for off-site O charge(s) if necessary
// but only if they are within reach
if (rsq < cut_coulsqplus) {
if (itype == typeO || jtype == typeO) {
if (jtype == typeO) {
@ -356,6 +360,7 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
}
}
}
}
}
/* ----------------------------------------------------------------------
@ -401,6 +406,7 @@ void PairLJCutCoulLongTIP4P::init_style()
error->all(FLERR,
"Pair style lj/cut/coul/long/tip4p requires atom attribute q");
if ( (strcmp(force->kspace_style,"pppm/tip4p") != 0) &&
(strcmp(force->kspace_style,"pppm/tip4p/omp") != 0) &&
(strcmp(force->kspace_style,"pppm/tip4p/proxy") != 0) )
error->all(FLERR,"Pair style is incompatible with KSpace style");
if (force->bond == NULL)

View File

@ -20,6 +20,8 @@ PACKAGE = asphere class2 colloid dipole fld gpu granular kim \
PACKUSER = user-misc user-atc user-awpmd user-cg-cmm \
user-cuda user-eff user-ewaldn user-omp user-reaxc user-sph
PACKLIB = gpu kim meam poems reax user-atc user-awpmd user-cuda
PACKALL = $(PACKAGE) $(PACKUSER)
PACKAGEUC = $(shell echo $(PACKAGE) | tr a-z A-Z)
@ -48,6 +50,7 @@ help:
@echo 'make no-standard remove all standard packages'
@echo 'make yes-user install all user packages'
@echo 'make no-user remove all user packages'
@echo 'make no-lib remove all packages with external libs'
@echo ''
@echo 'make package-update replace src files with package files'
@echo 'make package-overwrite replace package files with src files'
@ -132,6 +135,7 @@ package:
@echo 'make no-standard remove all standard packages'
@echo 'make yes-user install all user packages'
@echo 'make no-user remove all user packages'
@echo 'make no-lib remove all packages with external libs'
@echo ''
@echo 'make package-update replace src files with package files'
@echo 'make package-overwrite replace package files with src files'
@ -155,6 +159,9 @@ yes-user:
no-user:
@for p in $(PACKUSER); do $(MAKE) no-$$p; done
no-lib:
@for p in $(PACKLIB); do $(MAKE) no-$$p; done
yes-%:
@if [ ! -e Makefile.package ]; \
then cp Makefile.package.empty Makefile.package; fi

View File

@ -77,8 +77,8 @@ void PairLJCutCoulLongTIP4POpt::compute(int eflag, int vflag)
}
// cache corrected M positions in mpos[]
double **x = atom->x;
int *type = atom->type;
const double * const * const x = atom->x;
const int * const type = atom->type;
for (int i = 0; i < nlocal; i++) {
if (type[i] == typeO) {
find_M(i,h1idx[i],h2idx[i],mpos[i]);
@ -101,56 +101,30 @@ void PairLJCutCoulLongTIP4POpt::compute(int eflag, int vflag)
if (!ncoultablebits) {
if (evflag) {
if (eflag) {
if (vflag) {
if (force->newton_pair) return eval<1,1,1,1,0>();
else return eval<1,1,1,0,0>();
if (vflag) return eval<1,1,1,1>();
else return eval<1,1,1,0>();
} else {
if (force->newton_pair) return eval<1,1,0,1,0>();
else return eval<1,1,0,0,0>();
}
} else {
if (vflag) {
if (force->newton_pair) return eval<1,0,1,1,0>();
else return eval<1,0,1,0,0>();
} else {
if (force->newton_pair) return eval<1,0,0,1,0>();
else return eval<1,0,0,0,0>();
}
}
} else {
if (force->newton_pair) return eval<0,0,0,1,0>();
else return eval<0,0,0,0,0>();
if (vflag) return eval<1,1,0,1>();
else return eval<1,1,0,0>();
}
} else return eval<1,0,0,0>();
} else {
if (evflag) {
if (eflag) {
if (vflag) {
if (force->newton_pair) return eval<1,1,1,1,1>();
else return eval<1,1,1,0,1>();
if (vflag) return eval<0,1,1,1>();
else return eval<0,1,1,0>();
} else {
if (force->newton_pair) return eval<1,1,0,1,1>();
else return eval<1,1,0,0,1>();
}
} else {
if (vflag) {
if (force->newton_pair) return eval<1,0,1,1,1>();
else return eval<1,0,1,0,1>();
} else {
if (force->newton_pair) return eval<1,0,0,1,1>();
else return eval<1,0,0,0,1>();
}
}
} else {
if (force->newton_pair) return eval<0,0,0,1,1>();
else return eval<0,0,0,0,1>();
if (vflag) return eval<0,1,0,1>();
else return eval<0,1,0,0>();
}
} else return eval<0,0,0,0>();
}
}
/* ---------------------------------------------------------------------- */
template < const int EVFLAG, const int EFLAG, const int VFLAG,
const int NEWTON_PAIR, const int CTABLE >
template < const int CTABLE, const int EVFLAG,
const int EFLAG, const int VFLAG>
void PairLJCutCoulLongTIP4POpt::eval()
{
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
@ -158,27 +132,27 @@ void PairLJCutCoulLongTIP4POpt::eval()
int iH1,iH2,jH1,jH2;
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul;
double fraction,table;
double delxOM, delyOM, delzOM;
double r,r2inv,r6inv,forcecoul,forcelj,cforce;
double delxOM,delyOM,delzOM;
double r,rsq,r2inv,r6inv,forcecoul,forcelj,cforce;
double factor_coul,factor_lj;
double grij,expm2,prefactor,t,erfc,ddotf;
double v[6],xH1[3],xH2[3];
double fdx,fdy,fdz,f1x,f1y,f1z,fOx,fOy,fOz,fHx,fHy,fHz;
double *x1,*x2;
int *ilist,*jlist,*numneigh,**firstneigh;
double rsq;
evdwl = ecoul = 0.0;
double **f = atom->f;
double **x = atom->x;
double *q = atom->q;
int *type = atom->type;
int nlocal = atom->nlocal;
double *special_coul = force->special_coul;
double *special_lj = force->special_lj;
int newton_pair = force->newton_pair;
double qqrd2e = force->qqrd2e;
const double * const * const x = atom->x;
double * const * const f = atom->f;
const double * const q = atom->q;
const int * const type = atom->type;
const int nlocal = atom->nlocal;
const double * const special_coul = force->special_coul;
const double * const special_lj = force->special_lj;
const double qqrd2e = force->qqrd2e;
const double cut_coulsqplus = (cut_coul+2.0*qdist) * (cut_coul+2.0*qdist);
double fxtmp,fytmp,fztmp;
inum = list->inum;
@ -215,11 +189,10 @@ void PairLJCutCoulLongTIP4POpt::eval()
rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j];
if (rsq < cutsq[itype][jtype]) {
r2inv = 1.0/rsq;
// LJ interaction based on true rsq
if (rsq < cut_ljsq[itype][jtype]) {
r2inv = 1.0/rsq;
r6inv = r2inv*r2inv*r2inv;
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
forcelj *= factor_lj * r2inv;
@ -237,11 +210,14 @@ void PairLJCutCoulLongTIP4POpt::eval()
evdwl *= factor_lj;
} else evdwl = 0.0;
if (EVFLAG) ev_tally(i,j,nlocal,newton_pair,
if (EVFLAG) ev_tally(i,j,nlocal,/* newton_pair = */ 1,
evdwl,0.0,forcelj,delx,dely,delz);
}
// adjust rsq and delxyz for off-site O charge(s)
// adjust rsq and delxyz for off-site O charge(s),
// but only if they are within reach
if (rsq < cut_coulsqplus) {
if (itype == typeO || jtype == typeO) {
x2 = mpos[j];
@ -255,11 +231,11 @@ void PairLJCutCoulLongTIP4POpt::eval()
rsq = delx*delx + dely*dely + delz*delz;
}
// test current rsq against cutoff and compute Coulombic force
// Coulombic interaction based on modified rsq
if (rsq < cut_coulsq) {
r2inv = 1 / rsq;
if (!CTABLE || rsq <= tabinnersq) {
if (CTABLE || rsq <= tabinnersq) {
r = sqrt(rsq);
grij = g_ewald * r;
expm2 = exp(-grij*grij);
@ -436,7 +412,7 @@ void PairLJCutCoulLongTIP4POpt::eval()
}
if (EFLAG) {
if (!CTABLE || rsq <= tabinnersq)
if (CTABLE || rsq <= tabinnersq)
ecoul = prefactor*erfc;
else {
table = etable[itable] + fraction*detable[itable];

View File

@ -39,7 +39,7 @@ class PairLJCutCoulLongTIP4POpt : public PairLJCutCoulLongTIP4P {
double **mpos; // coordinates corrected for m-shift.
void find_M_permissive(int, int &, int &, double *);
template < const int, const int, const int, const int, const int >
template < const int, const int, const int, const int >
void eval();
};

View File

@ -42,6 +42,11 @@ PairLJCutCoulLongTIP4POMP::PairLJCutCoulLongTIP4POMP(LAMMPS *lmp) :
suffix_flag |= Suffix::OMP;
respa_enable = 0;
// TIP4P cannot compute virial as F dot r
// due to find_M() finding bonded H atoms which are not near O atom
no_virial_fdotr_compute = 1;
// for caching m-shift corrected positions
maxmpos = 0;
h1idx = h2idx = NULL;
@ -111,17 +116,28 @@ void PairLJCutCoulLongTIP4POMP::compute(int eflag, int vflag)
ThrData *thr = fix->get_thr(tid);
ev_setup_thr(eflag, vflag, nall, eatom, vatom, thr);
if (!ncoultablebits) {
if (evflag) {
if (eflag) {
if (vflag) eval<1,1,1>(ifrom, ito, thr);
else eval<1,1,0>(ifrom, ito, thr);
if (vflag) eval<1,1,1,1>(ifrom, ito, thr);
else eval<1,1,1,0>(ifrom, ito, thr);
} else {
if (vflag) eval<1,0,1>(ifrom, ito, thr);
else eval<1,0,0>(ifrom, ito, thr);
if (vflag) eval<1,1,0,1>(ifrom, ito, thr);
else eval<1,1,0,0>(ifrom, ito, thr);
}
} else eval<1,0,0,0>(ifrom, ito, thr);
} else {
eval<0,0,0>(ifrom, ito, thr);
if (evflag) {
if (eflag) {
if (vflag) eval<0,1,1,1>(ifrom, ito, thr);
else eval<0,1,1,0>(ifrom, ito, thr);
} else {
if (vflag) eval<0,1,0,1>(ifrom, ito, thr);
else eval<0,1,0,0>(ifrom, ito, thr);
}
} else eval<0,0,0,0>(ifrom, ito, thr);
}
reduce_thr(this, eflag, vflag, thr);
} // end of omp parallel region
@ -129,7 +145,7 @@ void PairLJCutCoulLongTIP4POMP::compute(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int VFLAG>
template <const int CTABLE, const int EVFLAG, const int EFLAG, const int VFLAG>
void PairLJCutCoulLongTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
{
int i,j,ii,jj,jnum,itype,jtype,itable;
@ -157,6 +173,8 @@ void PairLJCutCoulLongTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
const double * const special_coul = force->special_coul;
const double * const special_lj = force->special_lj;
const double qqrd2e = force->qqrd2e;
const double cut_coulsqplus = (cut_coul+2.0*qdist) * (cut_coul+2.0*qdist);
double fxtmp,fytmp,fztmp;
ilist = list->ilist;
@ -193,10 +211,10 @@ void PairLJCutCoulLongTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j];
if (rsq < cutsq[itype][jtype]) {
// LJ interaction based on true rsq
r2inv = 1.0/rsq;
if (rsq < cut_ljsq[itype][jtype]) {
r2inv = 1.0/rsq;
r6inv = r2inv*r2inv*r2inv;
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
forcelj *= factor_lj * r2inv;
@ -218,7 +236,10 @@ void PairLJCutCoulLongTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
evdwl,0.0,forcelj,delx,dely,delz,thr);
}
// adjust rsq and delxyz for off-site O charge(s)
// adjust rsq and delxyz for off-site O charge(s),
// but only if they are within reach
if (rsq < cut_coulsqplus) {
if (itype == typeO || jtype == typeO) {
x2 = mpos[j];
@ -235,11 +256,11 @@ void PairLJCutCoulLongTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
rsq = delx*delx + dely*dely + delz*delz;
}
// test current rsq against cutoff and compute Coulombic force
// Coulombic interaction based on modified rsq
if (rsq < cut_coulsq) {
r2inv = 1 / rsq;
if (!ncoultablebits || rsq <= tabinnersq) {
if (CTABLE || rsq <= tabinnersq) {
r = sqrt(rsq);
grij = g_ewald * r;
expm2 = exp(-grij*grij);
@ -416,7 +437,7 @@ void PairLJCutCoulLongTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
}
if (EFLAG) {
if (!ncoultablebits || rsq <= tabinnersq)
if (CTABLE || rsq <= tabinnersq)
ecoul = prefactor*erfc;
else {
table = etable[itable] + fraction*detable[itable];

View File

@ -46,7 +46,7 @@ class PairLJCutCoulLongTIP4POMP : public PairLJCutCoulLongTIP4P, public ThrOMP {
void find_M_permissive(int, int &, int &, double *);
private:
template <int EVFLAG, int EFLAG, int VFLAG>
template <int CFLAG, int EVFLAG, int EFLAG, int VFLAG>
void eval(int ifrom, int ito, ThrData * const thr);
};

View File

@ -14,7 +14,7 @@
#include "math.h"
#include "pair_lj_cut_coul_pppm_tip4p_omp.h"
#include "pppm_proxy.h"
#include "pppm_tip4p_proxy.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
@ -74,7 +74,7 @@ void PairLJCutCoulPPPMTIP4POMP::init_style()
if (strcmp(force->kspace_style,"pppm/tip4p/proxy") != 0)
error->all(FLERR,"kspace style pppm/tip4p/proxy is required with this pair style");
kspace = static_cast<PPPMProxy *>(force->kspace);
kspace = static_cast<PPPMTIP4PProxy *>(force->kspace);
PairLJCutCoulLongTIP4P::init_style();
}
@ -137,16 +137,26 @@ void PairLJCutCoulPPPMTIP4POMP::compute(int eflag, int vflag)
if (tid < nproxy) {
kspace->compute_proxy(eflag,vflag);
} else {
if (!ncoultablebits) {
if (evflag) {
if (eflag) {
if (vflag) eval<1,1,1>(ifrom, ito, thr);
else eval<1,1,0>(ifrom, ito, thr);
if (vflag) eval<1,1,1,1>(ifrom, ito, thr);
else eval<1,1,1,0>(ifrom, ito, thr);
} else {
if (vflag) eval<1,0,1>(ifrom, ito, thr);
else eval<1,0,0>(ifrom, ito, thr);
if (vflag) eval<1,1,0,1>(ifrom, ito, thr);
else eval<1,1,0,0>(ifrom, ito, thr);
}
} else eval<1,0,0,0>(ifrom, ito, thr);
} else {
eval<0,0,0>(ifrom, ito, thr);
if (evflag) {
if (eflag) {
if (vflag) eval<0,1,1,1>(ifrom, ito, thr);
else eval<0,1,1,0>(ifrom, ito, thr);
} else {
if (vflag) eval<0,1,0,1>(ifrom, ito, thr);
else eval<0,1,0,0>(ifrom, ito, thr);
}
} else eval<0,0,0,0>(ifrom, ito, thr);
}
}
@ -157,7 +167,7 @@ void PairLJCutCoulPPPMTIP4POMP::compute(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int VFLAG>
template <const int CTABLE, const int EVFLAG, const int EFLAG, const int VFLAG>
void PairLJCutCoulPPPMTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
{
int i,j,ii,jj,jnum,itype,jtype,itable;
@ -185,6 +195,8 @@ void PairLJCutCoulPPPMTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
const double * const special_coul = force->special_coul;
const double * const special_lj = force->special_lj;
const double qqrd2e = force->qqrd2e;
const double cut_coulsqplus = (cut_coul+2.0*qdist) * (cut_coul+2.0*qdist);
double fxtmp,fytmp,fztmp;
ilist = list->ilist;
@ -221,10 +233,10 @@ void PairLJCutCoulPPPMTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j];
if (rsq < cutsq[itype][jtype]) {
// LJ interaction based on true rsq
r2inv = 1.0/rsq;
if (rsq < cut_ljsq[itype][jtype]) {
r2inv = 1.0/rsq;
r6inv = r2inv*r2inv*r2inv;
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
forcelj *= factor_lj * r2inv;
@ -246,7 +258,10 @@ void PairLJCutCoulPPPMTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
evdwl,0.0,forcelj,delx,dely,delz,thr);
}
// adjust rsq and delxyz for off-site O charge(s)
// adjust rsq and delxyz for off-site O charge(s),
// but only if they are within reach
if (rsq < cut_coulsqplus) {
if (itype == typeO || jtype == typeO) {
x2 = mpos[j];
@ -263,11 +278,11 @@ void PairLJCutCoulPPPMTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
rsq = delx*delx + dely*dely + delz*delz;
}
// test current rsq against cutoff and compute Coulombic force
// Coulombic interaction based on modified rsq
if (rsq < cut_coulsq) {
r2inv = 1 / rsq;
if (!ncoultablebits || rsq <= tabinnersq) {
if (CTABLE || rsq <= tabinnersq) {
r = sqrt(rsq);
grij = g_ewald * r;
expm2 = exp(-grij*grij);
@ -444,7 +459,7 @@ void PairLJCutCoulPPPMTIP4POMP::eval(int iifrom, int iito, ThrData * const thr)
}
if (EFLAG) {
if (!ncoultablebits || rsq <= tabinnersq)
if (CTABLE || rsq <= tabinnersq)
ecoul = prefactor*erfc;
else {
table = etable[itable] + fraction*detable[itable];

View File

@ -48,10 +48,10 @@ class PairLJCutCoulPPPMTIP4POMP : public PairLJCutCoulLongTIP4P, public ThrOMP {
void find_M_permissive(int, int &, int &, double *);
private:
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
template <const int, const int, const int, const int>
void eval(int ifrom, int ito, ThrData * const thr);
class PPPMProxy *kspace;
class PPPMTIP4PProxy *kspace;
int nproxy;
};