small conding style updates

This commit is contained in:
Axel Kohlmeyer
2024-03-04 09:46:14 -05:00
parent 0a32cd6c7f
commit 393fd164db
2 changed files with 9 additions and 8 deletions

View File

@ -19,9 +19,10 @@
#define LMP_ELECTRODE_MATH_H
#include "ewald_const.h"
#include "math.h"
#include "math_const.h"
#include <cmath>
namespace LAMMPS_NS {
using namespace EwaldConst;
@ -30,7 +31,7 @@ namespace ElectrodeMath {
static double safe_erfc(double x)
{
if (x > ERFCMAX) return 0.;
if (x > ERFCMAX) return 0.0;
double expm2 = exp(-x * x);
double t = 1.0 / (1.0 + EWALD_P * x);
return t * (A1 + t * (A2 + t * (A3 + t * (A4 + t * A5)))) * expm2;
@ -39,14 +40,14 @@ namespace ElectrodeMath {
static double safe_derfcr(double x, double &erfc)
{
if (x > ERFCMAX) {
erfc = 0.;
return 0.;
erfc = 0.0;
return 0.0;
}
double x2 = x * x;
double expm2 = exp(-x2);
double t = 1.0 / (1.0 + EWALD_P * x);
erfc = t * (A1 + t * (A2 + t * (A3 + t * (A4 + t * A5)))) * expm2;
return -erfc - 2 * expm2 * x / MathConst::MY_PIS;
return -erfc - 2.0 * expm2 * x / MathConst::MY_PIS;
}
} // namespace ElectrodeMath

View File

@ -170,11 +170,11 @@ void ElectrodeVector::pair_contribution(double *vector)
if (rsq >= cutsq[itype][jtype]) continue;
double const eta_j = etaflag ? atom->dvector[eta_index][j] : eta;
double etaij;
if (i_in_sensor && j_in_sensor)
if (i_in_sensor && j_in_sensor) {
etaij = eta_i * eta_j / sqrt(eta_i * eta_i + eta_j * eta_j);
else if (i_in_sensor)
} else if (i_in_sensor) {
etaij = eta_i;
else {
} else {
assert(j_in_sensor);
etaij = eta_j;
}