From acadc299a75bb8111ab81ea48bfa715db9ae56e3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 31 Jul 2022 18:35:04 -0400 Subject: [PATCH] apply powint() in a few more cases --- src/MANYBODY/pair_airebo.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 90e43b7a6d..dc2a89e48e 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -318,10 +318,10 @@ double PairAIREBO::init_one(int i, int j) } else { - lj1[ii][jj] = 48.0 * epsilon[ii][jj] * pow(sigma[ii][jj],12.0); - lj2[ii][jj] = 24.0 * epsilon[ii][jj] * pow(sigma[ii][jj],6.0); - lj3[ii][jj] = 4.0 * epsilon[ii][jj] * pow(sigma[ii][jj],12.0); - lj4[ii][jj] = 4.0 * epsilon[ii][jj] * pow(sigma[ii][jj],6.0); + lj1[ii][jj] = 48.0 * epsilon[ii][jj] * powint(sigma[ii][jj],12); + lj2[ii][jj] = 24.0 * epsilon[ii][jj] * powint(sigma[ii][jj],6); + lj3[ii][jj] = 4.0 * epsilon[ii][jj] * powint(sigma[ii][jj],12); + lj4[ii][jj] = 4.0 * epsilon[ii][jj] * powint(sigma[ii][jj],6); } cutghost[j][i] = cutghost[i][j]; @@ -4038,8 +4038,7 @@ def output_matrix(n, k, A): tricubic spline coefficient calculation ------------------------------------------------------------------------- */ -void PairAIREBO::Sptricubic_patch_adjust(double * dl, double wid, double lo, - char dir) { +void PairAIREBO::Sptricubic_patch_adjust(double *dl, double wid, double lo, char dir) { int rowOuterL = 16, rowInnerL = 1, colL = 4; if (dir == 'R') { rowOuterL = 4; @@ -4057,7 +4056,7 @@ void PairAIREBO::Sptricubic_patch_adjust(double * dl, double wid, double lo, double acc = 0; for (int k = col; k < 4; k++) { acc += dl[rowOuterL * rowOuter + rowInnerL * rowInner + colL * k] - * pow(wid, -k) * pow(-lo, k - col) * binomial[k] / binomial[col] + * powint(wid, -k) * powint(-lo, k - col) * binomial[k] / binomial[col] / binomial[k - col]; } dl[rowOuterL * rowOuter + rowInnerL * rowInner + colL * col] = acc; @@ -4162,8 +4161,7 @@ void PairAIREBO::Sptricubic_patch_coeffs( bicubic spline coefficient calculation ------------------------------------------------------------------------- */ -void PairAIREBO::Spbicubic_patch_adjust(double * dl, double wid, double lo, - char dir) { +void PairAIREBO::Spbicubic_patch_adjust(double *dl, double wid, double lo, char dir) { int rowL = dir == 'R' ? 1 : 4; int colL = dir == 'L' ? 1 : 4; double binomial[5] = {1, 1, 2, 6}; @@ -4171,7 +4169,7 @@ void PairAIREBO::Spbicubic_patch_adjust(double * dl, double wid, double lo, for (int col = 0; col < 4; col++) { double acc = 0; for (int k = col; k < 4; k++) { - acc += dl[rowL * row + colL * k] * pow(wid, -k) * pow(-lo, k - col) + acc += dl[rowL * row + colL * k] * powint(wid, -k) * powint(-lo, k - col) * binomial[k] / binomial[col] / binomial[k - col]; } dl[rowL * row + colL * col] = acc;