}
}
-real do_ewald(const t_inputrec& ir,
- gmx::ArrayRef<const gmx::RVec> x,
- gmx::ArrayRef<gmx::RVec> f,
+real do_ewald(bool havePbcXY2Walls,
+ real wallEwaldZfac,
+ real epsilonR,
+ FreeEnergyPerturbationType freeEnergyPerturbationType,
+ gmx::ArrayRef<const gmx::RVec> coords,
+ gmx::ArrayRef<gmx::RVec> forces,
gmx::ArrayRef<const real> chargeA,
gmx::ArrayRef<const real> chargeB,
const matrix box,
- const t_commrec* cr,
+ const t_commrec* commrec,
int natoms,
matrix lrvir,
real ewaldcoeff,
cvec** eir;
bool bFreeEnergy;
- if (cr != nullptr)
+ if (commrec != nullptr)
{
- if (PAR(cr))
+ if (PAR(commrec))
{
gmx_fatal(FARGS, "No parallel Ewald. Use PME instead.\n");
}
/* Scale box with Ewald wall factor */
matrix scaledBox;
- EwaldBoxZScaler boxScaler(inputrecPbcXY2Walls(&ir), ir.wall_ewald_zfac);
+ EwaldBoxZScaler boxScaler(havePbcXY2Walls, wallEwaldZfac);
boxScaler.scaleBox(box, scaledBox);
rvec boxDiag;
}
/* 1/(Vol*e0) */
- real scaleRecip =
- 4.0 * M_PI / (boxDiag[XX] * boxDiag[YY] * boxDiag[ZZ]) * gmx::c_one4PiEps0 / ir.epsilon_r;
+ real scaleRecip = 4.0 * M_PI / (boxDiag[XX] * boxDiag[YY] * boxDiag[ZZ]) * gmx::c_one4PiEps0 / epsilonR;
snew(eir, et->kmax);
for (n = 0; n < et->kmax; n++)
et->tab_xy.resize(natoms);
et->tab_qxyz.resize(natoms);
- bFreeEnergy = (ir.efep != FreeEnergyPerturbationType::No);
+ bFreeEnergy = (freeEnergyPerturbationType != FreeEnergyPerturbationType::No);
clear_mat(lrvir);
calc_lll(boxDiag, lll);
- tabulateStructureFactors(natoms, x, et->kmax, eir, lll);
+ tabulateStructureFactors(natoms, coords, et->kmax, eir, lll);
gmx::ArrayRef<const real> charge;
for (q = 0; q < (bFreeEnergy ? 2 : 1); q++)
{
/*tmp=scale*ak*(cs*tab_qxyz[n].im-ss*tab_qxyz[n].re);*/
tmp = scale * ak * (cs * et->tab_qxyz[n].im - ss * et->tab_qxyz[n].re);
- f[n][XX] += tmp * mx * 2 * scaleRecip;
- f[n][YY] += tmp * my * 2 * scaleRecip;
- f[n][ZZ] += tmp * mz * 2 * scaleRecip;
-#if 0
- f[n][XX] += tmp*mx;
- f[n][YY] += tmp*my;
- f[n][ZZ] += tmp*mz;
-#endif
+ forces[n][XX] += tmp * mx * 2 * scaleRecip;
+ forces[n][YY] += tmp * my * 2 * scaleRecip;
+ forces[n][ZZ] += tmp * mz * 2 * scaleRecip;
}
lowiz = 1 - et->nz;
}
struct t_forcerec;
struct t_inputrec;
struct t_complex;
+enum class FreeEnergyPerturbationType : int;
namespace gmx
{
};
/*! \brief Do the long-ranged part of an Ewald calculation */
-real do_ewald(const t_inputrec& ir,
- gmx::ArrayRef<const gmx::RVec> x,
- gmx::ArrayRef<gmx::RVec> f,
+real do_ewald(bool havePbcXY2Walls,
+ real wallEwaldZfac,
+ real epsilonR,
+ FreeEnergyPerturbationType freeEnergyPerturbationType,
+ gmx::ArrayRef<const gmx::RVec> coords,
+ gmx::ArrayRef<gmx::RVec> forces,
gmx::ArrayRef<const real> chargeA,
gmx::ArrayRef<const real> chargeB,
const matrix box,
- const t_commrec* cr,
+ const t_commrec* commrec,
int natoms,
matrix lrvir,
real ewaldcoeff,