forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5101 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
b7c21ad2ec
commit
738f9cb7aa
|
@ -467,8 +467,9 @@ double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype,
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJClass2CoulLong::extract(char *str)
|
||||
void *PairLJClass2CoulLong::extract(char *str, int &dim)
|
||||
{
|
||||
dim = 0;
|
||||
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class PairLJClass2CoulLong : public Pair {
|
|||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(char *);
|
||||
void *extract(char *, int &);
|
||||
|
||||
private:
|
||||
double cut_lj_global;
|
||||
|
|
|
@ -534,26 +534,11 @@ void PairLubricate::read_restart_settings(FILE *fp)
|
|||
random = new RanMars(lmp,seed + comm->me);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
check if name is recognized, return integer index for that name
|
||||
if name not recognized, return -1
|
||||
if type pair setting, return -2 if no type pairs are set
|
||||
------------------------------------------------------------------------- */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int PairLubricate::pre_adapt(char *name, int ilo, int ihi, int jlo, int jhi)
|
||||
void *PairLubricate::extract(char *str, int &dim)
|
||||
{
|
||||
if (strcmp(name,"mu") == 0) return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
adapt parameter indexed by which
|
||||
change all pair variables affected by the reset parameter
|
||||
if type pair setting, set I-J and J-I coeffs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLubricate::adapt(int which, int ilo, int ihi, int jlo, int jhi,
|
||||
double value)
|
||||
{
|
||||
mu = value;
|
||||
dim = 0;
|
||||
if (strcmp(str,"mu") == 0) return (void *) μ
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ class PairLubricate : public Pair {
|
|||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
int pre_adapt(char *, int, int, int, int);
|
||||
void adapt(int, int, int, int, int, double);
|
||||
void *extract(char *, int &);
|
||||
|
||||
protected:
|
||||
double cut_inner_global,cut_global;
|
||||
|
|
|
@ -446,10 +446,9 @@ double PairCGCMMCoulLong::single(int i, int j, int itype, int jtype, double rsq,
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairCGCMMCoulLong::extract(char *str)
|
||||
void *PairCGCMMCoulLong::extract(char *str, int &dim)
|
||||
{
|
||||
dim = 0;
|
||||
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul_global;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace LAMMPS_NS {
|
|||
double memory_usage();
|
||||
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(char *str);
|
||||
void *extract(char *str, int &);
|
||||
|
||||
protected:
|
||||
void allocate();
|
||||
|
|
|
@ -88,6 +88,7 @@ void EwaldN::init()
|
|||
}
|
||||
|
||||
qqrd2e = force->qqrd2e; // check pair_style
|
||||
scale = 1.0;
|
||||
//mumurd2e = force->mumurd2e;
|
||||
//dielectric = force->dielectric;
|
||||
mumurd2e = dielectric = 1.0;
|
||||
|
@ -366,8 +367,8 @@ void EwaldN::init_self()
|
|||
memset(energy_self, 0, EWALD_NFUNCS*sizeof(double)); // self energy
|
||||
memset(virial_self, 0, EWALD_NFUNCS*sizeof(double));
|
||||
if (function[0]) { // 1/r
|
||||
virial_self[0] = -0.5*M_PI*qqrd2e/(g2*volume)*sum[0].x*sum[0].x;
|
||||
energy_self[0] = sum[0].x2*qqrd2e*g1/sqrt(M_PI)-virial_self[0];
|
||||
virial_self[0] = -0.5*M_PI*qqrd2e*scale/(g2*volume)*sum[0].x*sum[0].x;
|
||||
energy_self[0] = sum[0].x2*qqrd2e*scale*g1/sqrt(M_PI)-virial_self[0];
|
||||
}
|
||||
if (function[1]) { // geometric 1/r^6
|
||||
virial_self[1] = M_PI*sqrt(M_PI)*g3/(6.0*volume)*sum[1].x*sum[1].x;
|
||||
|
@ -481,7 +482,7 @@ void EwaldN::compute_force()
|
|||
double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = NULL;
|
||||
double *dipole = atom->dipole, *mu = atom->mu ? atom->mu[0] : NULL;
|
||||
double *ke, c[EWALD_NFUNCS] = {
|
||||
8.0*M_PI*qqrd2e/volume, 2.0*M_PI*sqrt(M_PI)/(12.0*volume),
|
||||
8.0*M_PI*qqrd2e*scale/volume, 2.0*M_PI*sqrt(M_PI)/(12.0*volume),
|
||||
2.0*M_PI*sqrt(M_PI)/(192.0*volume), 8.0*M_PI*mumurd2e/volume};
|
||||
double kt = 4.0*pow(g_ewald, 3.0)/3.0/sqrt(M_PI)/c[3];
|
||||
int i, kx, ky, lbytes = (2*nbox+1)*sizeof(cvector), *type = atom->type;
|
||||
|
@ -585,7 +586,7 @@ void EwaldN::compute_energy(int eflag)
|
|||
complex *cek = cek_global;
|
||||
double *ke = kenergy;
|
||||
double c[EWALD_NFUNCS] = {
|
||||
4.0*M_PI*qqrd2e/volume, 2.0*M_PI*sqrt(M_PI)/(24.0*volume),
|
||||
4.0*M_PI*qqrd2e*scale/volume, 2.0*M_PI*sqrt(M_PI)/(24.0*volume),
|
||||
2.0*M_PI*sqrt(M_PI)/(192.0*volume), 4.0*M_PI*mumurd2e/volume};
|
||||
double sum[EWALD_NFUNCS];
|
||||
int func[EWALD_NFUNCS];
|
||||
|
@ -623,7 +624,7 @@ void EwaldN::compute_virial(int vflag)
|
|||
complex *cek = cek_global;
|
||||
double *kv = kvirial;
|
||||
double c[EWALD_NFUNCS] = {
|
||||
4.0*M_PI*qqrd2e/volume, 2.0*M_PI*sqrt(M_PI)/(24.0*volume),
|
||||
4.0*M_PI*qqrd2e*scale/volume, 2.0*M_PI*sqrt(M_PI)/(24.0*volume),
|
||||
2.0*M_PI*sqrt(M_PI)/(192.0*volume), 4.0*M_PI*mumurd2e/volume};
|
||||
shape sum[EWALD_NFUNCS];
|
||||
int func[EWALD_NFUNCS];
|
||||
|
@ -683,13 +684,13 @@ void EwaldN::compute_slabcorr(int eflag)
|
|||
while ((x+=3)<xn) dipole += *x * *(q++);
|
||||
MPI_Allreduce(&dipole, &dipole_all, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
|
||||
double ffact = -4.0*M_PI*qqrd2e*dipole_all/volume; // force correction
|
||||
double ffact = -4.0*M_PI*qqrd2e*scale*dipole_all/volume;
|
||||
double *f = atom->f[0]-1, *fn = f+3*atom->nlocal-3;
|
||||
|
||||
q = atom->q;
|
||||
while ((f+=3)<fn) *f += ffact* *(q++);
|
||||
|
||||
if (eflag) // energy correction
|
||||
energy += qqrd2e*(2.0*M_PI*dipole_all*dipole_all/volume);
|
||||
energy += qqrd2e*scale*(2.0*M_PI*dipole_all*dipole_all/volume);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,16 +171,17 @@ void PairBuckCoul::allocate()
|
|||
extract protected data from object
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void *PairBuckCoul::extract(char *id)
|
||||
void *PairBuckCoul::extract(char *id, int &dim)
|
||||
{
|
||||
char *ids[] = {
|
||||
"B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix",
|
||||
"cut_coul", NULL};
|
||||
"B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", NULL};
|
||||
void *ptrs[] = {
|
||||
buck_c, NULL, NULL, &ewald_order, &cut_coul, &mix_flag, &cut_coul, NULL};
|
||||
buck_c, &ewald_order, &cut_coul, &mix_flag, &cut_coul, NULL};
|
||||
int i;
|
||||
|
||||
for (i=0; ids[i]&&strcmp(ids[i], id); ++i);
|
||||
if (i == 0) dim = 2;
|
||||
else dim = 0;
|
||||
return ptrs[i];
|
||||
}
|
||||
|
||||
|
@ -1168,4 +1169,3 @@ double PairBuckCoul::single(int i, int j, int itype, int jtype,
|
|||
fforce = (force_coul+force_buck)*r2inv;
|
||||
return eng;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class PairBuckCoul : public Pair {
|
|||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(char *);
|
||||
void *extract(char *, int &);
|
||||
|
||||
void compute_inner();
|
||||
void compute_middle();
|
||||
|
|
|
@ -167,7 +167,7 @@ void PairLJCoul::allocate()
|
|||
extract protected data from object
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJCoul::extract(char *id)
|
||||
void *PairLJCoul::extract(char *id, int &dim)
|
||||
{
|
||||
char *ids[] = {
|
||||
"B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix",
|
||||
|
@ -177,6 +177,8 @@ void *PairLJCoul::extract(char *id)
|
|||
int i;
|
||||
|
||||
for (i=0; ids[i]&&strcmp(ids[i], id); ++i);
|
||||
if (i <= 2) dim = 2;
|
||||
else dim = 0;
|
||||
return ptrs[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class PairLJCoul : public Pair {
|
|||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(char *);
|
||||
void *extract(char *, int &);
|
||||
|
||||
void compute_inner();
|
||||
void compute_middle();
|
||||
|
|
Loading…
Reference in New Issue