mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@929 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
6644463908
commit
54a88a9bc7
|
@ -21,11 +21,12 @@
|
|||
#include "pair_dpd.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "random_mars.h"
|
||||
#include "memory.h"
|
||||
#include "neighbor.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -63,19 +64,17 @@ PairDPD::~PairDPD()
|
|||
|
||||
void PairDPD::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,k,numneigh,itype,jtype;
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,vxtmp,vytmp,vztmp,delvx,delvy,delvz;
|
||||
double rsq,r,rinv,dot,wd,randnum,fforce,factor_dpd,phi;
|
||||
int *neighs;
|
||||
double **f;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
eng_vdwl = 0.0;
|
||||
if (vflag) for (i = 0; i < 6; i++) virial[i] = 0.0;
|
||||
|
||||
if (vflag == 2) f = update->f_pair;
|
||||
else f = atom->f;
|
||||
double **x = atom->x;
|
||||
double **v = atom->v;
|
||||
double **f = atom->f;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
|
@ -83,9 +82,15 @@ void PairDPD::compute(int eflag, int vflag)
|
|||
int newton_pair = force->newton_pair;
|
||||
double dtinvsqrt = 1.0/sqrt(update->dt);
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
|
@ -93,11 +98,11 @@ void PairDPD::compute(int eflag, int vflag)
|
|||
vytmp = v[i][1];
|
||||
vztmp = v[i][2];
|
||||
itype = type[i];
|
||||
neighs = neighbor->firstneigh[i];
|
||||
numneigh = neighbor->numneigh[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (k = 0; k < numneigh; k++) {
|
||||
j = neighs[k];
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
|
||||
if (j < nall) factor_dpd = 1.0;
|
||||
else {
|
||||
|
@ -245,24 +250,6 @@ void PairDPD::coeff(int narg, char **arg)
|
|||
if (count == 0) error->all("Incorrect args for pair coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairDPD::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) error->all("All pair coeffs are not set");
|
||||
|
||||
sigma[i][j] = sqrt(2.0*temperature*gamma[i][j]);
|
||||
|
||||
cut[j][i] = cut[i][j];
|
||||
a0[j][i] = a0[i][j];
|
||||
gamma[j][i] = gamma[i][j];
|
||||
sigma[j][i] = sigma[i][j];
|
||||
|
||||
return cut[i][j];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
@ -280,6 +267,26 @@ void PairDPD::init_style()
|
|||
|
||||
if (force->newton_pair == 0 && comm->me == 0) error->warning(
|
||||
"DPD potential needs newton pair on for momentum conservation");
|
||||
|
||||
int irequest = neighbor->request(this);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairDPD::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) error->all("All pair coeffs are not set");
|
||||
|
||||
sigma[i][j] = sqrt(2.0*temperature*gamma[i][j]);
|
||||
|
||||
cut[j][i] = cut[i][j];
|
||||
a0[j][i] = a0[i][j];
|
||||
gamma[j][i] = gamma[i][j];
|
||||
sigma[j][i] = sigma[i][j];
|
||||
|
||||
return cut[i][j];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -25,8 +25,8 @@ class PairDPD : public Pair {
|
|||
void compute(int, int);
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
double init_one(int, int);
|
||||
void init_style();
|
||||
double init_one(int, int);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
|
|
Loading…
Reference in New Issue