should not use pow() for computing cube, use multiplication.

This commit is contained in:
Axel Kohlmeyer
2023-07-14 10:08:09 -04:00
parent d6412dc97b
commit 620c60122a
2 changed files with 3 additions and 2 deletions

View File

@ -992,7 +992,8 @@ __kernel void k_amoeba_umutual2b(const __global numtyp4 *restrict x_,
numtyp damp = pdi * coeff[jtype].x; // pdamp[jtype]
if (damp != (numtyp)0.0) {
numtyp pgamma = MIN(pti,coeff[jtype].y); // thole[jtype]
damp = pgamma * ucl_powr(r/damp,(numtyp)3.0);
numtyp rdamp = r/damp;
damp = pgamma * rdamp*rdamp*rdamp;
if (damp < (numtyp)50.0) {
numtyp expdamp = ucl_exp(-damp);
scale3 = (numtyp)1.0 - expdamp;

View File

@ -845,7 +845,7 @@ __kernel void k_hippo_dispersion(const __global numtyp4 *restrict x_,
numtyp scale = factor_disp * damp*damp;
scale = scale - (numtyp)1.0;
numtyp e = -ci * ck * (expa+scale) / r6;
numtyp rterm = -ucl_powr(ralpha2,(numtyp)3.0) * expterm / r;
numtyp rterm = -ralpha2*ralpha2*ralpha2 * expterm / r;
numtyp de = (numtyp)-6.0*e/r2 - ci*ck*rterm/r7 - (numtyp)2.0*ci*ck*factor_disp*damp*ddamp/r7;
energy+= e;