Templated functions calling math libraries should use type-aware calls
This commit is contained in:
committed by
Axel Kohlmeyer
parent
06f4099566
commit
933457acbe
@ -1968,7 +1968,7 @@ void ref_frebo_single_interaction(KernelArgsAIREBOT<flt_t,acc_t> * ka, int i,
|
|||||||
flt_t Aij = ka->params.A[itype][jtype];
|
flt_t Aij = ka->params.A[itype][jtype];
|
||||||
flt_t alphaij = ka->params.alpha[itype][jtype];
|
flt_t alphaij = ka->params.alpha[itype][jtype];
|
||||||
|
|
||||||
flt_t exp_alphar = exp(-alphaij * rij);
|
flt_t exp_alphar = overloaded::exp(-alphaij * rij);
|
||||||
flt_t VR_by_wij = (1.0 + (Qij / rij)) * Aij * exp_alphar;
|
flt_t VR_by_wij = (1.0 + (Qij / rij)) * Aij * exp_alphar;
|
||||||
flt_t VR = wij * VR_by_wij;
|
flt_t VR = wij * VR_by_wij;
|
||||||
flt_t pre = wij * Aij * exp_alphar;
|
flt_t pre = wij * Aij * exp_alphar;
|
||||||
@ -2108,7 +2108,7 @@ void ref_lennard_jones_single_interaction(KernelArgsAIREBOT<flt_t,acc_t> * ka,
|
|||||||
|
|
||||||
flt_t vdw, dvdw;
|
flt_t vdw, dvdw;
|
||||||
if (morseflag) {
|
if (morseflag) {
|
||||||
const flt_t exr = exp(-rij * ka->params.lj4[itype][jtype]);
|
const flt_t exr = overloaded::exp(-rij * ka->params.lj4[itype][jtype]);
|
||||||
vdw = ka->params.lj1[itype][jtype] * exr *
|
vdw = ka->params.lj1[itype][jtype] * exr *
|
||||||
(ka->params.lj2[itype][jtype]*exr - 2);
|
(ka->params.lj2[itype][jtype]*exr - 2);
|
||||||
dvdw = ka->params.lj3[itype][jtype] * exr *
|
dvdw = ka->params.lj3[itype][jtype] * exr *
|
||||||
|
|||||||
@ -294,7 +294,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag,
|
|||||||
if (rsq < c_cuti[jtype].cut_ljsq) {
|
if (rsq < c_cuti[jtype].cut_ljsq) {
|
||||||
#endif
|
#endif
|
||||||
flt_t r6inv = r2inv * r2inv * r2inv;
|
flt_t r6inv = r2inv * r2inv * r2inv;
|
||||||
flt_t rexp = exp(-r * c_forcei[jtype].rhoinv);
|
flt_t rexp = std::exp(-r * c_forcei[jtype].rhoinv);
|
||||||
forcebuck = r * rexp * c_forcei[jtype].buck1 -
|
forcebuck = r * rexp * c_forcei[jtype].buck1 -
|
||||||
r6inv * c_forcei[jtype].buck2;
|
r6inv * c_forcei[jtype].buck2;
|
||||||
if (EFLAG)
|
if (EFLAG)
|
||||||
|
|||||||
@ -336,7 +336,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag,
|
|||||||
const flt_t INV_EWALD_P = 1.0 / 0.3275911;
|
const flt_t INV_EWALD_P = 1.0 / 0.3275911;
|
||||||
|
|
||||||
const flt_t grij = g_ewald * r;
|
const flt_t grij = g_ewald * r;
|
||||||
const flt_t expm2 = exp(-grij * grij);
|
const flt_t expm2 = std::exp(-grij * grij);
|
||||||
const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij);
|
const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij);
|
||||||
const flt_t erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
const flt_t erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||||
const flt_t prefactor = qqrd2e * qtmp * q[j] / r;
|
const flt_t prefactor = qqrd2e * qtmp * q[j] / r;
|
||||||
@ -377,7 +377,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag,
|
|||||||
if (rsq < c_forcei[jtype].cut_ljsq) {
|
if (rsq < c_forcei[jtype].cut_ljsq) {
|
||||||
#endif
|
#endif
|
||||||
flt_t r6inv = r2inv * r2inv * r2inv;
|
flt_t r6inv = r2inv * r2inv * r2inv;
|
||||||
flt_t rexp = exp(-r * rho_invi[jtype]);
|
flt_t rexp = std::exp(-r * rho_invi[jtype]);
|
||||||
forcebuck = r * rexp * c_forcei[jtype].buck1 -
|
forcebuck = r * rexp * c_forcei[jtype].buck1 -
|
||||||
r6inv * c_forcei[jtype].buck2;
|
r6inv * c_forcei[jtype].buck2;
|
||||||
if (EFLAG) evdwl = rexp * c_energyi[jtype].a -
|
if (EFLAG) evdwl = rexp * c_energyi[jtype].a -
|
||||||
|
|||||||
@ -262,7 +262,7 @@ void PairBuckIntel::eval(const int offload, const int vflag,
|
|||||||
if (rsq < c_forcei[jtype].cutsq) {
|
if (rsq < c_forcei[jtype].cutsq) {
|
||||||
#endif
|
#endif
|
||||||
const flt_t r6inv = r2inv * r2inv * r2inv;
|
const flt_t r6inv = r2inv * r2inv * r2inv;
|
||||||
const flt_t rexp = exp(-r * c_forcei[jtype].rhoinv);
|
const flt_t rexp = std::exp(-r * c_forcei[jtype].rhoinv);
|
||||||
forcebuck = r * rexp * c_forcei[jtype].buck1 -
|
forcebuck = r * rexp * c_forcei[jtype].buck1 -
|
||||||
r6inv * c_forcei[jtype].buck2;
|
r6inv * c_forcei[jtype].buck2;
|
||||||
|
|
||||||
|
|||||||
@ -341,7 +341,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag,
|
|||||||
|
|
||||||
const flt_t r = (flt_t)1.0 / sqrt(r2inv);
|
const flt_t r = (flt_t)1.0 / sqrt(r2inv);
|
||||||
const flt_t grij = g_ewald * r;
|
const flt_t grij = g_ewald * r;
|
||||||
const flt_t expm2 = exp(-grij * grij);
|
const flt_t expm2 = std::exp(-grij * grij);
|
||||||
const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij);
|
const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij);
|
||||||
const flt_t erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
const flt_t erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||||
const flt_t prefactor = qqrd2e * qtmp * q[j] / r;
|
const flt_t prefactor = qqrd2e * qtmp * q[j] / r;
|
||||||
|
|||||||
@ -334,7 +334,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag,
|
|||||||
|
|
||||||
const flt_t r = (flt_t)1.0 / sqrt(r2inv);
|
const flt_t r = (flt_t)1.0 / sqrt(r2inv);
|
||||||
const flt_t grij = g_ewald * r;
|
const flt_t grij = g_ewald * r;
|
||||||
const flt_t expm2 = exp(-grij * grij);
|
const flt_t expm2 = std::exp(-grij * grij);
|
||||||
const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij);
|
const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij);
|
||||||
const flt_t erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
const flt_t erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||||
const flt_t prefactor = qqrd2e * qtmp * q[j] / r;
|
const flt_t prefactor = qqrd2e * qtmp * q[j] / r;
|
||||||
|
|||||||
@ -411,7 +411,7 @@ void PairSWIntel::eval(const int offload, const int vflag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const flt_t rainvsq = rainv1 * rainv1 * r1;
|
const flt_t rainvsq = rainv1 * rainv1 * r1;
|
||||||
flt_t expsrainv = exp(sigma * rainv1);
|
flt_t expsrainv = std::exp(sigma * rainv1);
|
||||||
if (jj >= ejnumhalf) expsrainv = (flt_t)0.0;
|
if (jj >= ejnumhalf) expsrainv = (flt_t)0.0;
|
||||||
const flt_t fpair = (c1 * rp - c2 * rq + (c3 * rp - c4 * rq) *
|
const flt_t fpair = (c1 * rp - c2 * rq + (c3 * rp - c4 * rq) *
|
||||||
rainvsq) * expsrainv * rinvsq1;
|
rainvsq) * expsrainv * rinvsq1;
|
||||||
@ -453,7 +453,7 @@ void PairSWIntel::eval(const int offload, const int vflag,
|
|||||||
|
|
||||||
flt_t gsrainv1 = sigma_gamma * rainv1;
|
flt_t gsrainv1 = sigma_gamma * rainv1;
|
||||||
flt_t gsrainvsq1 = gsrainv1 * rainv1 / r1;
|
flt_t gsrainvsq1 = gsrainv1 * rainv1 / r1;
|
||||||
flt_t expgsrainv1 = exp(gsrainv1);
|
flt_t expgsrainv1 = std::exp(gsrainv1);
|
||||||
|
|
||||||
for (int kk = 0; kk < ejnum; kk++) {
|
for (int kk = 0; kk < ejnum; kk++) {
|
||||||
int iktype, ijktype;
|
int iktype, ijktype;
|
||||||
@ -479,7 +479,7 @@ void PairSWIntel::eval(const int offload, const int vflag,
|
|||||||
const flt_t rainv2 = (flt_t)1.0 / (r2 - cut);
|
const flt_t rainv2 = (flt_t)1.0 / (r2 - cut);
|
||||||
const flt_t gsrainv2 = sigma_gamma * rainv2;
|
const flt_t gsrainv2 = sigma_gamma * rainv2;
|
||||||
const flt_t gsrainvsq2 = gsrainv2 * rainv2 / r2;
|
const flt_t gsrainvsq2 = gsrainv2 * rainv2 / r2;
|
||||||
const flt_t expgsrainv2 = exp(gsrainv2);
|
const flt_t expgsrainv2 = std::exp(gsrainv2);
|
||||||
|
|
||||||
const flt_t rinv12 = (flt_t)1.0 / (r1 * r2);
|
const flt_t rinv12 = (flt_t)1.0 / (r1 * r2);
|
||||||
const flt_t cs = (delx * delr2[0] + dely * delr2[1] +
|
const flt_t cs = (delx * delr2[0] + dely * delr2[1] +
|
||||||
|
|||||||
Reference in New Issue
Block a user