silence compiler warnings, remove dead code and fix bugs

This commit is contained in:
Axel Kohlmeyer
2021-06-11 16:26:34 -04:00
parent 1e5e08fc1b
commit a23f56a4f0
9 changed files with 60 additions and 72 deletions

View File

@ -121,7 +121,6 @@ void ComputeEfieldAtom::setup()
void ComputeEfieldAtom::compute_peratom()
{
int i,j;
double onemass;
invoked_peratom = update->ntimestep;
if (update->vflag_atom != invoked_peratom)
@ -143,7 +142,6 @@ void ComputeEfieldAtom::compute_peratom()
// ntotal includes ghosts if either newton flag is set
// KSpace includes ghosts if tip4pflag is set
double** f = atom->f;
double* q = atom->q;
int nlocal = atom->nlocal;
int npair = nlocal;

View File

@ -246,7 +246,7 @@ void FixPolarizeBEMGMRES::init()
/* ---------------------------------------------------------------------- */
void FixPolarizeBEMGMRES::setup(int vflag)
void FixPolarizeBEMGMRES::setup(int /*vflag*/)
{
// check if the pair styles in use are compatible
@ -308,7 +308,6 @@ void FixPolarizeBEMGMRES::compute_induced_charges()
double *ed = atom->ed;
double *em = atom->em;
double *epsilon = atom->epsilon;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double epsilon0 = force->dielectric;
int eflag = 0;
@ -585,7 +584,7 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r)
matvec(A, v(k-1), v(k), n);
------------------------------------------------------------------------- */
void FixPolarizeBEMGMRES::apply_operator(double *w, double *Aw, int n)
void FixPolarizeBEMGMRES::apply_operator(double *w, double *Aw, int /*n*/)
{
int i;
double *q = atom->q;
@ -594,7 +593,6 @@ void FixPolarizeBEMGMRES::apply_operator(double *w, double *Aw, int n)
double *ed = atom->ed;
double *em = atom->em;
double *epsilon = atom->epsilon;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double epsilon0 = force->dielectric;
int eflag = 0;
@ -655,7 +653,7 @@ void FixPolarizeBEMGMRES::apply_operator(double *w, double *Aw, int n)
using Eq. (60) in Barros et al.
------------------------------------------------------------------------ */
void FixPolarizeBEMGMRES::update_residual(double *w, double *r, int n)
void FixPolarizeBEMGMRES::update_residual(double *w, double *r, int /*n*/)
{
int i;
double *q = atom->q;
@ -665,7 +663,6 @@ void FixPolarizeBEMGMRES::update_residual(double *w, double *r, int n)
double *ed = atom->ed;
double *em = atom->em;
double *epsilon = atom->epsilon;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double epsilon0 = force->dielectric;
int eflag = 0;
@ -862,7 +859,7 @@ void FixPolarizeBEMGMRES::grow_arrays(int n)
copy values within local atom-based arrays
------------------------------------------------------------------------- */
void FixPolarizeBEMGMRES::copy_arrays(int i, int j, int delflag)
void FixPolarizeBEMGMRES::copy_arrays(int i, int j, int /*delflag*/)
{
induced_charge_idx[j] = induced_charge_idx[i];
}
@ -878,7 +875,7 @@ void FixPolarizeBEMGMRES::set_arrays(int i)
/* ---------------------------------------------------------------------- */
int FixPolarizeBEMGMRES::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
int FixPolarizeBEMGMRES::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
{
int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -146,7 +146,7 @@ void FixPolarizeBEMICC::init()
/* ---------------------------------------------------------------------- */
void FixPolarizeBEMICC::setup(int vflag)
void FixPolarizeBEMICC::setup(int /*vflag*/)
{
// check if the pair styles in use are compatible
@ -236,7 +236,6 @@ void FixPolarizeBEMICC::compute_induced_charges()
if (kspaceflag) force->kspace->compute(eflag, vflag);
if (force->newton) comm->reverse_comm();
int i10 = 0;
for (int i = 0; i < nlocal; i++) {
if (!(mask[i] & groupbit)) continue;
@ -397,7 +396,7 @@ int FixPolarizeBEMICC::modify_param(int narg, char **arg)
/* ---------------------------------------------------------------------- */
int FixPolarizeBEMICC::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
int FixPolarizeBEMICC::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
{
int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -169,7 +169,6 @@ void FixPolarizeFunctional::init()
// mapping induced charge matrix/vector to atom tags and vice versa
int i, maxtag;
double *q = atom->q;
int *mask = atom->mask;
tagint *tag = atom->tag;
int nlocal = atom->nlocal;
@ -287,14 +286,14 @@ void FixPolarizeFunctional::init()
/* ---------------------------------------------------------------------- */
void FixPolarizeFunctional::init_list(int id, NeighList *ptr)
void FixPolarizeFunctional::init_list(int /*id*/, NeighList *ptr)
{
list = ptr;
}
/* ---------------------------------------------------------------------- */
void FixPolarizeFunctional::setup(int vflag)
void FixPolarizeFunctional::setup(int /*vflag*/)
{
// check if the pair styles in use are compatible
@ -338,7 +337,7 @@ void FixPolarizeFunctional::setup(int vflag)
/* ---------------------------------------------------------------------- */
void FixPolarizeFunctional::setup_pre_force(int vflag)
void FixPolarizeFunctional::setup_pre_force(int /*vflag*/)
{
// calculate Rww before the run (assuming that the interface is fixed for now)
// otherwise this should be done every time step in pre_force()
@ -537,7 +536,7 @@ int FixPolarizeFunctional::unpack_exchange(int nlocal, double *buf)
/* ---------------------------------------------------------------------- */
int FixPolarizeFunctional::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
int FixPolarizeFunctional::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
{
int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];
@ -567,7 +566,7 @@ void FixPolarizeFunctional::grow_arrays(int n)
copy values within local atom-based arrays
------------------------------------------------------------------------- */
void FixPolarizeFunctional::copy_arrays(int i, int j, int delflag)
void FixPolarizeFunctional::copy_arrays(int i, int j, int /*delflag*/)
{
induced_charge_idx[j] = induced_charge_idx[i];
ion_idx[j] = ion_idx[i];
@ -613,9 +612,7 @@ double FixPolarizeFunctional::memory_usage()
void FixPolarizeFunctional::calculate_Rww_cutoff()
{
int *mask = atom->mask;
int *type = atom->type;
tagint *tag = atom->tag;
int nlocal = atom->nlocal;
double **x = atom->x;
double *area = atom->area;
double *curvature = atom->curvature;
@ -838,9 +835,7 @@ void FixPolarizeFunctional::calculate_qiRqw_cutoff()
int ii, i, k, kk, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz, r;
int *mask = atom->mask;
int *type = atom->type;
tagint *tag = atom->tag;
int nlocal = atom->nlocal;
double **x = atom->x;
double *q = atom->q_unscaled;
double *epsilon = atom->epsilon;

View File

@ -56,7 +56,7 @@ PairCoulCutDielectric::~PairCoulCutDielectric()
void PairCoulCutDielectric::compute(int eflag, int vflag)
{
int i,j,ii,jj,inum,jnum,itype,jtype;
double qtmp,etmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair;
double qtmp,etmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul;
double fpair_i,fpair_j;
double rsq,r2inv,rinv,forcecoul,factor_coul,efield_i;
int *ilist,*jlist,*numneigh,**firstneigh;
@ -73,7 +73,6 @@ void PairCoulCutDielectric::compute(int eflag, int vflag)
double **x = atom->x;
double **f = atom->f;
double *q = atom->q;
double *q_real = atom->q_unscaled;
double* eps = atom->epsilon;
double** norm = atom->mu;
double* curvature = atom->curvature;
@ -177,16 +176,16 @@ void PairCoulCutDielectric::init_style()
/* ---------------------------------------------------------------------- */
double PairCoulCutDielectric::single(int i, int j, int itype, int jtype,
double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/,
double rsq,
double factor_coul, double factor_lj,
double factor_coul, double /*factor_lj*/,
double &fforce)
{
double r2inv,forcecoul,phicoul,ei,ej;
double r2inv,phicoul,ei,ej;
double* eps = atom->epsilon;
r2inv = 1.0/rsq;
forcecoul = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv)*eps[i];
fforce = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv)*eps[i];
double eng = 0.0;
if (eps[i] == 1) ei = 0;

View File

@ -57,7 +57,7 @@ PairLJCutCoulCutDielectric::~PairLJCutCoulCutDielectric()
void PairLJCutCoulCutDielectric::compute(int eflag, int vflag)
{
int i, j, ii, jj, inum, jnum, itype, jtype;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul;
double fpair_i, fpair_j;
double rsq, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj, efield_i, epot_i;
int *ilist, *jlist, *numneigh, **firstneigh;
@ -76,7 +76,6 @@ void PairLJCutCoulCutDielectric::compute(int eflag, int vflag)
double **x = atom->x;
double **f = atom->f;
double *q = atom->q;
double *q_real = atom->q_unscaled;
double *eps = atom->epsilon;
double **norm = atom->mu;
double *curvature = atom->curvature;

View File

@ -58,7 +58,7 @@ PairLJCutCoulDebyeDielectric::~PairLJCutCoulDebyeDielectric()
void PairLJCutCoulDebyeDielectric::compute(int eflag, int vflag)
{
int i, j, ii, jj, inum, jnum, itype, jtype;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul;
double fpair_i, fpair_j;
double rsq, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj, efield_i, epot_i;
double r, rinv, screening;

View File

@ -64,7 +64,7 @@ PairLJCutCoulMSMDielectric::~PairLJCutCoulMSMDielectric()
void PairLJCutCoulMSMDielectric::compute(int eflag, int vflag)
{
int i, ii, j, jj, inum, jnum, itype, jtype, itable;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair, fcoul;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair;
double fpair_i, fpair_j;
double fraction, table;
double r, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj;

View File

@ -75,7 +75,7 @@ PairLJLongCoulLongDielectric::~PairLJLongCoulLongDielectric()
void PairLJLongCoulLongDielectric::init_style()
{
PairLJLongCoulLongDielectric::init_style();
PairLJLongCoulLong::init_style();
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair lj/long/coul/long/dielectric requires atom style dielectric");
@ -91,7 +91,7 @@ void PairLJLongCoulLongDielectric::init_style()
void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
{
double evdwl, ecoul, fpair;
double evdwl, ecoul;
evdwl = ecoul = 0.0;
ev_init(eflag, vflag);
@ -117,10 +117,10 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
int newton_pair = force->newton_pair;
double qqrd2e = force->qqrd2e;
int i, ii, j, jj, inum, jnum, itype, jtype, itable;
int i, j, itype, jtype, itable;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz;
int order1 = ewald_order & (1 << 1), order6 = ewald_order & (1 << 6);
int *ineigh, *ineighn, *jneigh, *jneighn, typei, typej, ni;
int *ineigh, *ineighn, *jneigh, *jneighn, ni;
double qi = 0.0, qri = 0.0;
double fpair_i, fpair_j;
double fraction, table;
@ -128,7 +128,7 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
double grij, expm2, prefactor, t, erfc, prefactorE, efield_i, epot_i;
double r, rsq, r2inv, force_coul, force_lj, factor_coul, factor_lj;
double g2 = g_ewald_6 * g_ewald_6, g6 = g2 * g2 * g2, g8 = g6 * g2;
double xi[3], d[3];
double xi[3];
ineighn = (ineigh = list->ilist) + list->inum;
@ -136,15 +136,19 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
i = *ineigh;
fi = f0 + 3 * i;
qtmp = q[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
etmp = eps[i];
if (order1) qri = (qi = q[i]) * qqrd2e; // initialize constants
offseti = offset[typei = type[i]];
lj1i = lj1[typei];
lj2i = lj2[typei];
lj3i = lj3[typei];
lj4i = lj4[typei];
cutsqi = cutsq[typei];
cut_ljsqi = cut_ljsq[typei];
offseti = offset[itype = type[i]];
lj1i = lj1[itype];
lj2i = lj2[itype];
lj3i = lj3[itype];
lj4i = lj4[itype];
cutsqi = cutsq[itype];
cut_ljsqi = cut_ljsq[itype];
memcpy(xi, x0 + (i + (i << 1)), 3 * sizeof(double));
jneighn = (jneigh = list->firstneigh[i]) + list->numneigh[i];
@ -174,7 +178,7 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
rsq = delx * delx + dely * dely + delz * delz;
jtype = type[j];
if (rsq >= cutsq[typei][typej]) continue;
if (rsq >= cutsq[itype][jtype]) continue;
r2inv = 1.0 / rsq;
r = sqrt(rsq);
@ -216,22 +220,22 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
} else
epot_i = efield_i = force_coul = ecoul = 0.0;
if (rsq < cut_ljsqi[typej]) { // lj
if (rsq < cut_ljsqi[jtype]) { // lj
if (order6) { // long-range lj
if (!ndisptablebits || rsq <= tabinnerdispsq) { // series real space
double rn = r2inv * r2inv * r2inv;
double x2 = g2 * rsq, a2 = 1.0 / x2;
x2 = a2 * exp(-x2) * lj4i[typej];
x2 = a2 * exp(-x2) * lj4i[jtype];
if (ni == 0) {
force_lj = (rn *= rn) * lj1i[typej] -
force_lj = (rn *= rn) * lj1i[jtype] -
g8 * (((6.0 * a2 + 6.0) * a2 + 3.0) * a2 + 1.0) * x2 * rsq;
if (eflag) evdwl = rn * lj3i[typej] - g6 * ((a2 + 1.0) * a2 + 0.5) * x2;
if (eflag) evdwl = rn * lj3i[jtype] - g6 * ((a2 + 1.0) * a2 + 0.5) * x2;
} else { // special case
double f = special_lj[ni], t = rn * (1.0 - f);
force_lj = f * (rn *= rn) * lj1i[typej] -
g8 * (((6.0 * a2 + 6.0) * a2 + 3.0) * a2 + 1.0) * x2 * rsq + t * lj2i[typej];
force_lj = f * (rn *= rn) * lj1i[jtype] -
g8 * (((6.0 * a2 + 6.0) * a2 + 3.0) * a2 + 1.0) * x2 * rsq + t * lj2i[jtype];
if (eflag)
evdwl = f * rn * lj3i[typej] - g6 * ((a2 + 1.0) * a2 + 0.5) * x2 + t * lj4i[typej];
evdwl = f * rn * lj3i[jtype] - g6 * ((a2 + 1.0) * a2 + 0.5) * x2 + t * lj4i[jtype];
}
} else { // table real space
union_int_float_t disp_t;
@ -240,39 +244,36 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
double f_disp = (rsq - rdisptable[disp_k]) * drdisptable[disp_k];
double rn = r2inv * r2inv * r2inv;
if (ni == 0) {
force_lj = (rn *= rn) * lj1i[typej] -
(fdisptable[disp_k] + f_disp * dfdisptable[disp_k]) * lj4i[typej];
force_lj = (rn *= rn) * lj1i[jtype] -
(fdisptable[disp_k] + f_disp * dfdisptable[disp_k]) * lj4i[jtype];
if (eflag)
evdwl = rn * lj3i[typej] -
(edisptable[disp_k] + f_disp * dedisptable[disp_k]) * lj4i[typej];
evdwl = rn * lj3i[jtype] -
(edisptable[disp_k] + f_disp * dedisptable[disp_k]) * lj4i[jtype];
} else { // special case
double f = special_lj[ni], t = rn * (1.0 - f);
force_lj = f * (rn *= rn) * lj1i[typej] -
(fdisptable[disp_k] + f_disp * dfdisptable[disp_k]) * lj4i[typej] +
t * lj2i[typej];
force_lj = f * (rn *= rn) * lj1i[jtype] -
(fdisptable[disp_k] + f_disp * dfdisptable[disp_k]) * lj4i[jtype] +
t * lj2i[jtype];
if (eflag)
evdwl = f * rn * lj3i[typej] -
(edisptable[disp_k] + f_disp * dedisptable[disp_k]) * lj4i[typej] +
t * lj4i[typej];
evdwl = f * rn * lj3i[jtype] -
(edisptable[disp_k] + f_disp * dedisptable[disp_k]) * lj4i[jtype] +
t * lj4i[jtype];
}
}
} else { // cut lj
double rn = r2inv * r2inv * r2inv;
if (ni == 0) {
force_lj = rn * (rn * lj1i[typej] - lj2i[typej]);
if (eflag) evdwl = rn * (rn * lj3i[typej] - lj4i[typej]) - offseti[typej];
force_lj = rn * (rn * lj1i[jtype] - lj2i[jtype]);
if (eflag) evdwl = rn * (rn * lj3i[jtype] - lj4i[jtype]) - offseti[jtype];
} else { // special case
double f = special_lj[ni];
force_lj = f * rn * (rn * lj1i[typej] - lj2i[typej]);
if (eflag) evdwl = f * (rn * (rn * lj3i[typej] - lj4i[typej]) - offseti[typej]);
force_lj = f * rn * (rn * lj1i[jtype] - lj2i[jtype]);
if (eflag) evdwl = f * (rn * (rn * lj3i[jtype] - lj4i[jtype]) - offseti[jtype]);
}
}
}
} else force_lj = evdwl = 0.0;
else
force_lj = evdwl = 0.0;
fpair = (force_coul * etmp + force_lj) * r2inv;
fpair_i = (force_coul * etmp + force_lj) * r2inv;
f[i][0] += delx * fpair_i;
f[i][1] += dely * fpair_i;
f[i][2] += delz * fpair_i;