git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1193 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -50,19 +50,20 @@ PairCoulCut::~PairCoulCut()
|
||||
void PairCoulCut::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz;
|
||||
double rsq,r2inv,rinv,forcecoul,fforce,factor_coul,phicoul;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair;
|
||||
double rsq,r2inv,rinv,forcecoul,factor_coul;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
eng_coul = 0.0;
|
||||
if (vflag) for (i = 0; i < 6; i++) virial[i] = 0.0;
|
||||
ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int nall = nlocal + atom->nghost;
|
||||
double *special_coul = force->special_coul;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
@ -103,36 +104,26 @@ void PairCoulCut::compute(int eflag, int vflag)
|
||||
r2inv = 1.0/rsq;
|
||||
rinv = sqrt(r2inv);
|
||||
forcecoul = qqrd2e * qtmp*q[j]*rinv;
|
||||
fforce = factor_coul*forcecoul * r2inv;
|
||||
fpair = factor_coul*forcecoul * r2inv;
|
||||
|
||||
f[i][0] += delx*fforce;
|
||||
f[i][1] += dely*fforce;
|
||||
f[i][2] += delz*fforce;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fforce;
|
||||
f[j][1] -= dely*fforce;
|
||||
f[j][2] -= delz*fforce;
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
phicoul = qqrd2e * qtmp*q[j]*rinv;
|
||||
if (newton_pair || j < nlocal) eng_coul += factor_coul*phicoul;
|
||||
else eng_coul += 0.5*factor_coul*phicoul;
|
||||
}
|
||||
if (eflag) ecoul = factor_coul * qqrd2e * qtmp*q[j]*rinv;
|
||||
|
||||
if (vflag == 1) {
|
||||
if (newton_pair == 0 && j >= nlocal) fforce *= 0.5;
|
||||
virial[0] += delx*delx*fforce;
|
||||
virial[1] += dely*dely*fforce;
|
||||
virial[2] += delz*delz*fforce;
|
||||
virial[3] += delx*dely*fforce;
|
||||
virial[4] += delx*delz*fforce;
|
||||
virial[5] += dely*delz*fforce;
|
||||
}
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
0.0,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vflag == 2) virial_compute();
|
||||
|
||||
if (vflag_fdotr) virial_compute();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user