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

This commit is contained in:
sjplimp 2012-10-02 20:11:58 +00:00
parent 9f8c6721d0
commit f47d2a82b6
6 changed files with 56 additions and 8 deletions

View File

@ -39,7 +39,10 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */
PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp) {}
PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp)
{
ewaldflag = pppmflag = 1;
}
/* ---------------------------------------------------------------------- */
@ -223,7 +226,8 @@ void PairLJClass2CoulLong::settings(int narg, char **arg)
void PairLJClass2CoulLong::coeff(int narg, char **arg)
{
if (narg < 4 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients");
if (narg < 4 || narg > 6)
error->all(FLERR,"Incorrect args for pair coefficients");
if (!allocated) allocate();
int ilo,ihi,jlo,jhi;
@ -257,7 +261,8 @@ void PairLJClass2CoulLong::coeff(int narg, char **arg)
void PairLJClass2CoulLong::init_style()
{
if (!atom->q_flag)
error->all(FLERR,"Pair style lj/class2/coul/long requires atom attribute q");
error->all(FLERR,
"Pair style lj/class2/coul/long requires atom attribute q");
neighbor->request(this);
@ -266,7 +271,7 @@ void PairLJClass2CoulLong::init_style()
// insure use of KSpace long-range solver, set g_ewald
if (force->kspace == NULL)
error->all(FLERR,"Pair style is incompatible with KSpace style");
error->all(FLERR,"Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald;
}

View File

@ -364,7 +364,7 @@ void PairLJSDKCoulLong::init_style()
// insure use of KSpace long-range solver, set g_ewald
if (force->kspace == NULL)
error->all(FLERR,"Pair style is incompatible with KSpace style");
error->all(FLERR,"Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald;
// setup force tables
@ -390,14 +390,17 @@ double PairLJSDKCoulLong::init_one(int i, int j)
double cut = MAX(cut_lj[i][j],cut_coul);
cut_ljsq[i][j] = cut_lj[i][j] * cut_lj[i][j];
lj1[i][j] = lj_prefact[ljt] * lj_pow1[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow1[ljt]);
lj2[i][j] = lj_prefact[ljt] * lj_pow2[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow2[ljt]);
lj1[i][j] = lj_prefact[ljt] * lj_pow1[ljt] * epsilon[i][j] *
pow(sigma[i][j],lj_pow1[ljt]);
lj2[i][j] = lj_prefact[ljt] * lj_pow2[ljt] * epsilon[i][j] *
pow(sigma[i][j],lj_pow2[ljt]);
lj3[i][j] = lj_prefact[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow1[ljt]);
lj4[i][j] = lj_prefact[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow2[ljt]);
if (offset_flag) {
double ratio = sigma[i][j] / cut_lj[i][j];
offset[i][j] = lj_prefact[ljt] * epsilon[i][j] * (pow(ratio,lj_pow1[ljt]) - pow(ratio,lj_pow2[ljt]));
offset[i][j] = lj_prefact[ljt] * epsilon[i][j] *
(pow(ratio,lj_pow1[ljt]) - pow(ratio,lj_pow2[ljt]));
} else offset[i][j] = 0.0;
cut_ljsq[j][i] = cut_ljsq[i][j];

View File

@ -32,6 +32,7 @@ KSpace::KSpace(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
energy = 0.0;
virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0;
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = proxyflag = 0;
compute_flag = 1;
group_group_enable = 0;
@ -131,6 +132,28 @@ void KSpace::compute_dummy(int eflag, int vflag)
eflag_atom = vflag_atom = 0;
}
/* ----------------------------------------------------------------------
check that pair style is compatible with long-range solver
------------------------------------------------------------------------- */
void KSpace::pair_check()
{
if (force->pair == NULL)
error->all(FLERR,"KSpace solver requires a pair style");
if (ewaldflag && force->pair->ewaldflag == 0)
error->all(FLERR,"KSpace style is incompatible with Pair style");
if (pppmflag && force->pair->pppmflag == 0)
error->all(FLERR,"KSpace style is incompatible with Pair style");
if (msmflag && force->pair->msmflag == 0)
error->all(FLERR,"KSpace style is incompatible with Pair style");
if (dispersionflag && force->pair->dispersionflag == 0)
error->all(FLERR,"KSpace style is incompatible with Pair style");
if (tip4pflag && force->pair->tip4pflag == 0)
error->all(FLERR,"KSpace style is incompatible with Pair style");
if (proxyflag && force->pair->proxyflag == 0)
error->all(FLERR,"KSpace style is incompatible with Pair style");
}
/* ----------------------------------------------------------------------
setup for energy, virial computation
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)

View File

@ -29,6 +29,13 @@ class KSpace : protected Pointers {
double e2group; // accumulated group-group energy
double f2group[3]; // accumulated group-group force
int ewaldflag; // 1 if a Ewald solver
int pppmflag; // 1 if a PPPM solver
int msmflag; // 1 if a MSM solver
int dispersionflag; // 1 if a LJ/dispersion solver
int tip4pflag; // 1 if a TIP4P solver
int proxyflag; // 1 if a proxy solver
double g_ewald,g_ewald_6;
int nx_pppm,ny_pppm,nz_pppm;
int nx_pppm_6,ny_pppm_6,nz_pppm_6;
@ -84,6 +91,7 @@ class KSpace : protected Pointers {
int vflag_either,vflag_global,vflag_atom;
int maxeatom,maxvatom;
void pair_check();
void ev_setup(int, int);
double estimate_table_accuracy(double, double);
};

View File

@ -62,6 +62,8 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
single_extra = 0;
svector = NULL;
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = proxyflag = 0;
// pair_modify settings
compute_flag = 1;

View File

@ -50,6 +50,13 @@ class Pair : protected Pointers {
int ghostneigh; // 1 if pair style needs neighbors of ghosts
double **cutghost; // cutoff for each ghost pair
int ewaldflag; // 1 if compatible with Ewald solver
int pppmflag; // 1 if compatible with PPPM solver
int msmflag; // 1 if compatible with MSM solver
int dispersionflag; // 1 if compatible with LJ/dispersion solver
int tip4pflag; // 1 if compatible with TIP4P solver
int proxyflag; // 1 if compatible with proxy solver
int tail_flag; // pair_modify flag for LJ tail correction
double etail,ptail; // energy/pressure tail corrections
double etail_ij,ptail_ij;