diff --git a/src/CG-DNA/atom_vec_oxdna.cpp b/src/CG-DNA/atom_vec_oxdna.cpp index f5d56eef31..2da35b37b3 100644 --- a/src/CG-DNA/atom_vec_oxdna.cpp +++ b/src/CG-DNA/atom_vec_oxdna.cpp @@ -49,7 +49,8 @@ AtomVecOxdna::AtomVecOxdna(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); - if(!force->newton_bond) error->warning(FLERR,"Write_data command requires newton on to preserve 3'->5' bond polarity"); + if (!force->newton_bond) + error->warning(FLERR, "Write_data command requires newton on to preserve 3'->5' bond polarity"); } /* ---------------------------------------------------------------------- */ diff --git a/src/CG-DNA/bond_oxdna_fene.cpp b/src/CG-DNA/bond_oxdna_fene.cpp index 5a332a0b8c..6b720f6a7f 100644 --- a/src/CG-DNA/bond_oxdna_fene.cpp +++ b/src/CG-DNA/bond_oxdna_fene.cpp @@ -17,12 +17,12 @@ #include "bond_oxdna_fene.h" #include "atom.h" -#include "neighbor.h" #include "comm.h" -#include "update.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "neighbor.h" +#include "update.h" #include "atom_vec_ellipsoid.h" #include "math_extra.h" @@ -43,54 +43,52 @@ BondOxdnaFene::~BondOxdnaFene() } } - /* ---------------------------------------------------------------------- compute vector COM-sugar-phosphate backbone interaction site in oxDNA ------------------------------------------------------------------------- */ -void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3], - double /*e3*/[3], double r[3]) const +void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3], double /*e3*/[3], + double r[3]) const { - constexpr double d_cs=-0.4; + constexpr double d_cs = -0.4; - r[0] = d_cs*e1[0]; - r[1] = d_cs*e1[1]; - r[2] = d_cs*e1[2]; + r[0] = d_cs * e1[0]; + r[1] = d_cs * e1[1]; + r[2] = d_cs * e1[2]; } /* ---------------------------------------------------------------------- tally energy and virial into global and per-atom accumulators ------------------------------------------------------------------------- */ -void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, - double ebond, - double fx, double fy, double fz, - double delx, double dely, double delz) +void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, double ebond, double fx, + double fy, double fz, double delx, double dely, double delz) { - double ebondhalf,v[6]; + double ebondhalf, v[6]; if (eflag_either) { if (eflag_global) { - if (newton_bond) energy += ebond; + if (newton_bond) + energy += ebond; else { - ebondhalf = 0.5*ebond; + ebondhalf = 0.5 * ebond; if (i < nlocal) energy += ebondhalf; if (j < nlocal) energy += ebondhalf; } } if (eflag_atom) { - ebondhalf = 0.5*ebond; + ebondhalf = 0.5 * ebond; if (newton_bond || i < nlocal) eatom[i] += ebondhalf; if (newton_bond || j < nlocal) eatom[j] += ebondhalf; } } if (vflag_either) { - v[0] = delx*fx; - v[1] = dely*fy; - v[2] = delz*fz; - v[3] = delx*fy; - v[4] = delx*fz; - v[5] = dely*fz; + v[0] = delx * fx; + v[1] = dely * fy; + v[2] = delz * fz; + v[3] = delx * fy; + v[4] = delx * fz; + v[5] = dely * fz; if (vflag_global) { if (newton_bond) { @@ -102,40 +100,40 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, virial[5] += v[5]; } else { if (i < nlocal) { - virial[0] += 0.5*v[0]; - virial[1] += 0.5*v[1]; - virial[2] += 0.5*v[2]; - virial[3] += 0.5*v[3]; - virial[4] += 0.5*v[4]; - virial[5] += 0.5*v[5]; + virial[0] += 0.5 * v[0]; + virial[1] += 0.5 * v[1]; + virial[2] += 0.5 * v[2]; + virial[3] += 0.5 * v[3]; + virial[4] += 0.5 * v[4]; + virial[5] += 0.5 * v[5]; } if (j < nlocal) { - virial[0] += 0.5*v[0]; - virial[1] += 0.5*v[1]; - virial[2] += 0.5*v[2]; - virial[3] += 0.5*v[3]; - virial[4] += 0.5*v[4]; - virial[5] += 0.5*v[5]; + virial[0] += 0.5 * v[0]; + virial[1] += 0.5 * v[1]; + virial[2] += 0.5 * v[2]; + virial[3] += 0.5 * v[3]; + virial[4] += 0.5 * v[4]; + virial[5] += 0.5 * v[5]; } } } if (vflag_atom) { if (newton_bond || i < nlocal) { - vatom[i][0] += 0.5*v[0]; - vatom[i][1] += 0.5*v[1]; - vatom[i][2] += 0.5*v[2]; - vatom[i][3] += 0.5*v[3]; - vatom[i][4] += 0.5*v[4]; - vatom[i][5] += 0.5*v[5]; + vatom[i][0] += 0.5 * v[0]; + vatom[i][1] += 0.5 * v[1]; + vatom[i][2] += 0.5 * v[2]; + vatom[i][3] += 0.5 * v[3]; + vatom[i][4] += 0.5 * v[4]; + vatom[i][5] += 0.5 * v[5]; } if (newton_bond || j < nlocal) { - vatom[j][0] += 0.5*v[0]; - vatom[j][1] += 0.5*v[1]; - vatom[j][2] += 0.5*v[2]; - vatom[j][3] += 0.5*v[3]; - vatom[j][4] += 0.5*v[4]; - vatom[j][5] += 0.5*v[5]; + vatom[j][0] += 0.5 * v[0]; + vatom[j][1] += 0.5 * v[1]; + vatom[j][2] += 0.5 * v[2]; + vatom[j][3] += 0.5 * v[3]; + vatom[j][4] += 0.5 * v[4]; + vatom[j][5] += 0.5 * v[5]; } } } @@ -147,16 +145,16 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, ------------------------------------------------------------------------- */ void BondOxdnaFene::compute(int eflag, int vflag) { - int a,b,in,type; - double delf[3],delta[3],deltb[3]; // force, torque increment;; - double delr[3],ebond,fbond; - double rsq,Deltasq,rlogarg; - double r,rr0,rr0sq; + int a, b, in, type; + double delf[3], delta[3], deltb[3]; // force, torque increment;; + double delr[3], ebond, fbond; + double rsq, Deltasq, rlogarg; + double r, rr0, rr0sq; // vectors COM-backbone site in lab frame - double ra_cs[3],rb_cs[3]; + double ra_cs[3], rb_cs[3]; - double *qa,ax[3],ay[3],az[3]; - double *qb,bx[3],by[3],bz[3]; + double *qa, ax[3], ay[3], az[3]; + double *qb, bx[3], by[3], bz[3]; double **x = atom->x; double **f = atom->f; @@ -172,7 +170,7 @@ void BondOxdnaFene::compute(int eflag, int vflag) int newton_bond = force->newton_bond; ebond = 0.0; - ev_init(eflag,vflag); + ev_init(eflag, vflag); // loop over FENE bonds @@ -182,47 +180,45 @@ void BondOxdnaFene::compute(int eflag, int vflag) b = bondlist[in][0]; type = bondlist[in][2]; - qa=bonus[ellipsoid[a]].quat; - MathExtra::q_to_exyz(qa,ax,ay,az); - qb=bonus[ellipsoid[b]].quat; - MathExtra::q_to_exyz(qb,bx,by,bz); + qa = bonus[ellipsoid[a]].quat; + MathExtra::q_to_exyz(qa, ax, ay, az); + qb = bonus[ellipsoid[b]].quat; + MathExtra::q_to_exyz(qb, bx, by, bz); // vector COM-backbone site a and b - compute_interaction_sites(ax,ay,az,ra_cs); - compute_interaction_sites(bx,by,bz,rb_cs); + compute_interaction_sites(ax, ay, az, ra_cs); + compute_interaction_sites(bx, by, bz, rb_cs); // vector backbone site b to a delr[0] = x[a][0] + ra_cs[0] - x[b][0] - rb_cs[0]; delr[1] = x[a][1] + ra_cs[1] - x[b][1] - rb_cs[1]; delr[2] = x[a][2] + ra_cs[2] - x[b][2] - rb_cs[2]; - rsq = delr[0]*delr[0] + delr[1]*delr[1] + delr[2]*delr[2]; + rsq = delr[0] * delr[0] + delr[1] * delr[1] + delr[2] * delr[2]; r = sqrt(rsq); rr0 = r - r0[type]; - rr0sq = rr0*rr0; + rr0sq = rr0 * rr0; Deltasq = Delta[type] * Delta[type]; - rlogarg = 1.0 - rr0sq/Deltasq; + rlogarg = 1.0 - rr0sq / Deltasq; // if r -> Delta, then rlogarg < 0.0 which is an error // issue a warning and reset rlogarg = epsilon // if r > 2*Delta something serious is wrong, abort if (rlogarg < 0.1) { - error->warning(FLERR,"FENE bond too long: {} {} {} {}", - update->ntimestep,atom->tag[a],atom->tag[b],r); + error->warning(FLERR, "FENE bond too long: {} {} {} {}", update->ntimestep, atom->tag[a], + atom->tag[b], r); rlogarg = 0.1; } - fbond = -k[type]*rr0/rlogarg/Deltasq/r; - delf[0] = delr[0]*fbond; - delf[1] = delr[1]*fbond; - delf[2] = delr[2]*fbond; + fbond = -k[type] * rr0 / rlogarg / Deltasq / r; + delf[0] = delr[0] * fbond; + delf[1] = delr[1] * fbond; + delf[2] = delr[2] * fbond; // energy - if (eflag) { - ebond = -0.5 * k[type]*log(rlogarg); - } + if (eflag) { ebond = -0.5 * k[type] * log(rlogarg); } // apply force and torque to each of 2 atoms @@ -232,12 +228,11 @@ void BondOxdnaFene::compute(int eflag, int vflag) f[a][1] += delf[1]; f[a][2] += delf[2]; - MathExtra::cross3(ra_cs,delf,delta); + MathExtra::cross3(ra_cs, delf, delta); torque[a][0] += delta[0]; torque[a][1] += delta[1]; torque[a][2] += delta[2]; - } if (newton_bond || b < nlocal) { @@ -246,23 +241,21 @@ void BondOxdnaFene::compute(int eflag, int vflag) f[b][1] -= delf[1]; f[b][2] -= delf[2]; - MathExtra::cross3(rb_cs,delf,deltb); + MathExtra::cross3(rb_cs, delf, deltb); torque[b][0] -= deltb[0]; torque[b][1] -= deltb[1]; torque[b][2] -= deltb[2]; - } // increment energy and virial // NOTE: The virial is calculated on the 'molecular' basis. // (see G. Ciccotti and J.P. Ryckaert, Comp. Phys. Rep. 4, 345-392 (1986)) - if (evflag) ev_tally_xyz(a,b,nlocal,newton_bond,ebond, - delf[0],delf[1],delf[2],x[a][0]-x[b][0],x[a][1]-x[b][1],x[a][2]-x[b][2]); - + if (evflag) + ev_tally_xyz(a, b, nlocal, newton_bond, ebond, delf[0], delf[1], delf[2], x[a][0] - x[b][0], + x[a][1] - x[b][1], x[a][2] - x[b][2]); } - } /* ---------------------------------------------------------------------- */ @@ -272,13 +265,12 @@ void BondOxdnaFene::allocate() allocated = 1; int n = atom->nbondtypes; - memory->create(k,n+1,"bond:k"); - memory->create(Delta,n+1,"bond:Delta"); - memory->create(r0,n+1,"bond:r0"); - memory->create(setflag,n+1,"bond:setflag"); + memory->create(k, n + 1, "bond:k"); + memory->create(Delta, n + 1, "bond:Delta"); + memory->create(r0, n + 1, "bond:r0"); + memory->create(setflag, n + 1, "bond:setflag"); for (int i = 1; i <= n; i++) setflag[i] = 0; - } /* ---------------------------------------------------------------------- @@ -287,15 +279,15 @@ void BondOxdnaFene::allocate() void BondOxdnaFene::coeff(int narg, char **arg) { - if (narg != 4) error->all(FLERR,"Incorrect args for bond coefficients in oxdna/fene"); + if (narg != 4) error->all(FLERR, "Incorrect args for bond coefficients in oxdna/fene"); if (!allocated) allocate(); - int ilo,ihi; - utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); + int ilo, ihi; + utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error); - double k_one = utils::numeric(FLERR,arg[1],false,lmp); - double Delta_one = utils::numeric(FLERR,arg[2],false,lmp); - double r0_one = utils::numeric(FLERR,arg[3],false,lmp); + double k_one = utils::numeric(FLERR, arg[1], false, lmp); + double Delta_one = utils::numeric(FLERR, arg[2], false, lmp); + double r0_one = utils::numeric(FLERR, arg[3], false, lmp); int count = 0; @@ -307,8 +299,7 @@ void BondOxdnaFene::coeff(int narg, char **arg) count++; } - if (count == 0) error->all(FLERR,"Incorrect args for bond coefficients in oxdna/fene"); - + if (count == 0) error->all(FLERR, "Incorrect args for bond coefficients in oxdna/fene"); } /* ---------------------------------------------------------------------- @@ -318,7 +309,9 @@ void BondOxdnaFene::coeff(int narg, char **arg) void BondOxdnaFene::init_style() { if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) - error->all(FLERR,"Must use 'special_bonds lj 0 1 1' with bond style oxdna/fene, oxdna2/fene or oxrna2/fene"); + error->all( + FLERR, + "Must use 'special_bonds lj 0 1 1' with bond style oxdna/fene, oxdna2/fene or oxrna2/fene"); } /* ---------------------------------------------------------------------- */ @@ -334,9 +327,9 @@ double BondOxdnaFene::equilibrium_distance(int i) void BondOxdnaFene::write_restart(FILE *fp) { - fwrite(&k[1],sizeof(double),atom->nbondtypes,fp); - fwrite(&Delta[1],sizeof(double),atom->nbondtypes,fp); - fwrite(&r0[1],sizeof(double),atom->nbondtypes,fp); + fwrite(&k[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Delta[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&r0[1], sizeof(double), atom->nbondtypes, fp); } /* ---------------------------------------------------------------------- @@ -348,13 +341,13 @@ void BondOxdnaFene::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); - utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR, &k[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Delta[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &r0[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); } - MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); - MPI_Bcast(&Delta[1],atom->nbondtypes,MPI_DOUBLE,0,world); - MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); + MPI_Bcast(&k[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Delta[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&r0[1], atom->nbondtypes, MPI_DOUBLE, 0, world); for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1; } @@ -366,32 +359,30 @@ void BondOxdnaFene::read_restart(FILE *fp) void BondOxdnaFene::write_data(FILE *fp) { for (int i = 1; i <= atom->nbondtypes; i++) - fprintf(fp,"%d %g %g %g\n",i,k[i],r0[i],Delta[i]); + fprintf(fp, "%d %g %g %g\n", i, k[i], r0[i], Delta[i]); } /* ---------------------------------------------------------------------- */ -double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/, - double &fforce) +double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/, double &fforce) { double r = sqrt(rsq); double rr0 = r - r0[type]; - double rr0sq = rr0*rr0; + double rr0sq = rr0 * rr0; double Deltasq = Delta[type] * Delta[type]; - double rlogarg = 1.0 - rr0sq/Deltasq; + double rlogarg = 1.0 - rr0sq / Deltasq; // if r -> Delta, then rlogarg < 0.0 which is an error // issue a warning and reset rlogarg = epsilon // if r > 2*Delta something serious is wrong, abort if (rlogarg < 0.1) { - error->warning(FLERR,"FENE bond too long: {} {:.8}", - update->ntimestep,sqrt(rsq)); + error->warning(FLERR, "FENE bond too long: {} {:.8}", update->ntimestep, sqrt(rsq)); rlogarg = 0.1; } - double eng = -0.5 * k[type]*log(rlogarg); - fforce = -k[type]*rr0/rlogarg/Deltasq/r; + double eng = -0.5 * k[type] * log(rlogarg); + fforce = -k[type] * rr0 / rlogarg / Deltasq / r; return eng; } diff --git a/src/COMPRESS/zstd_file_writer.h b/src/COMPRESS/zstd_file_writer.h index 3789d52122..3fde376b47 100644 --- a/src/COMPRESS/zstd_file_writer.h +++ b/src/COMPRESS/zstd_file_writer.h @@ -29,7 +29,6 @@ #error must have at least zstd version 1.4 to compile with -DLAMMPS_ZSTD #endif - namespace LAMMPS_NS { class ZstdFileWriter : public FileWriter { diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp index 667f0efc26..62febf13c2 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp @@ -431,7 +431,7 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r) // fill up h with zero - memset(h, 0, (size_t)(mr + 1) * mr * sizeof(double)); + memset(h, 0, (size_t) (mr + 1) * mr * sizeof(double)); // the inner loop k = 1..(n-1) // build up the k-th Krylov space, @@ -524,7 +524,7 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r) #ifdef _POLARIZE_DEBUG if (comm->me == 0) - error->warning(FLERR,"itr = {}: k = {}, norm(r) = {} norm(b) = {}", itr, k, rho, normb); + error->warning(FLERR, "itr = {}: k = {}, norm(r) = {} norm(b) = {}", itr, k, rho, normb); #endif if (rho <= rho_tol && rho <= tol_abs) break; } @@ -742,17 +742,17 @@ double FixPolarizeBEMGMRES::vec_dot(const double *a1, const double *a2, int n) double FixPolarizeBEMGMRES::memory_usage() { double bytes = 0; - bytes += mat_dim * sizeof(double); // induced_charges - bytes += mat_dim * sizeof(double); // buffer - bytes += mat_dim * sizeof(double); // rhs - bytes += atom->nmax * sizeof(double); // induced_charge_idx - bytes += atom->nmax * sizeof(double); // q_backup - bytes += mr * sizeof(double); // c - bytes += (mr + 1) * sizeof(double); // g + bytes += mat_dim * sizeof(double); // induced_charges + bytes += mat_dim * sizeof(double); // buffer + bytes += mat_dim * sizeof(double); // rhs + bytes += atom->nmax * sizeof(double); // induced_charge_idx + bytes += atom->nmax * sizeof(double); // q_backup + bytes += mr * sizeof(double); // c + bytes += (mr + 1) * sizeof(double); // g bytes += (double) (mr + 1) * mr * sizeof(double); // h - bytes += mat_dim * sizeof(double); // r + bytes += mat_dim * sizeof(double); // r bytes += (double) mr * (mr + 1) * sizeof(double); // s - bytes += mat_dim * sizeof(double); // v + bytes += mat_dim * sizeof(double); // v bytes += (double) (mr + 1) * mr * sizeof(double); // y return bytes; } @@ -868,7 +868,8 @@ void FixPolarizeBEMGMRES::set_arrays(int i) /* ---------------------------------------------------------------------- */ -int FixPolarizeBEMGMRES::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +int FixPolarizeBEMGMRES::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, + int * /*pbc*/) { int m; for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index 10f4c62958..da9b8eb055 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -396,7 +396,8 @@ int FixPolarizeBEMICC::modify_param(int narg, char **arg) /* ---------------------------------------------------------------------- */ -int FixPolarizeBEMICC::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +int FixPolarizeBEMICC::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, + int * /*pbc*/) { int m; for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index e082ba79ce..84f68e79b1 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -538,7 +538,8 @@ int FixPolarizeFunctional::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -int FixPolarizeFunctional::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +int FixPolarizeFunctional::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, + int * /*pbc*/) { int m; for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; @@ -591,21 +592,21 @@ void FixPolarizeFunctional::set_arrays(int i) double FixPolarizeFunctional::memory_usage() { double bytes = 0; - bytes += square(num_induced_charges) * sizeof(double); // inverse_matrix - bytes += square(num_induced_charges) * sizeof(double); // Rww - bytes += square(num_induced_charges) * sizeof(double); // G1ww - bytes += square(num_induced_charges) * sizeof(double); // ndotGww - bytes += square(num_induced_charges) * sizeof(double); // G2ww - bytes += square(num_induced_charges) * sizeof(double); // G3ww - bytes += num_induced_charges * sizeof(double); // qiRqwVector - bytes += num_induced_charges * sizeof(double); // sum2G2wq - bytes += num_induced_charges * sizeof(double); // sum1G2qw - bytes += num_induced_charges * sizeof(double); // sum1G1qw_epsilon - bytes += num_induced_charges * sizeof(double); // sum2ndotGwq_epsilon - bytes += (double)num_ions * num_induced_charges * sizeof(double); // G1qw_real - bytes += nmax * sizeof(int); // induced_charge_idx - bytes += nmax * sizeof(int); // ion_idx - bytes += num_induced_charges * sizeof(double); // induced_charges + bytes += square(num_induced_charges) * sizeof(double); // inverse_matrix + bytes += square(num_induced_charges) * sizeof(double); // Rww + bytes += square(num_induced_charges) * sizeof(double); // G1ww + bytes += square(num_induced_charges) * sizeof(double); // ndotGww + bytes += square(num_induced_charges) * sizeof(double); // G2ww + bytes += square(num_induced_charges) * sizeof(double); // G3ww + bytes += num_induced_charges * sizeof(double); // qiRqwVector + bytes += num_induced_charges * sizeof(double); // sum2G2wq + bytes += num_induced_charges * sizeof(double); // sum1G2qw + bytes += num_induced_charges * sizeof(double); // sum1G1qw_epsilon + bytes += num_induced_charges * sizeof(double); // sum2ndotGwq_epsilon + bytes += (double) num_ions * num_induced_charges * sizeof(double); // G1qw_real + bytes += nmax * sizeof(int); // induced_charge_idx + bytes += nmax * sizeof(int); // ion_idx + bytes += num_induced_charges * sizeof(double); // induced_charges return bytes; } diff --git a/src/DIELECTRIC/pair_coul_cut_dielectric.cpp b/src/DIELECTRIC/pair_coul_cut_dielectric.cpp index d5ead44512..9c3be2a80a 100644 --- a/src/DIELECTRIC/pair_coul_cut_dielectric.cpp +++ b/src/DIELECTRIC/pair_coul_cut_dielectric.cpp @@ -22,11 +22,11 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "neighbor.h" +#include "math_const.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "math_const.h" +#include "neighbor.h" #include #include @@ -55,28 +55,28 @@ PairCoulCutDielectric::~PairCoulCutDielectric() void PairCoulCutDielectric::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype; - double qtmp,etmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul; - double fpair_i,fpair_j; - double rsq,r2inv,rinv,forcecoul,factor_coul,efield_i; - int *ilist,*jlist,*numneigh,**firstneigh; + int i, j, ii, jj, inum, jnum, itype, jtype; + double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, ecoul; + double fpair_i, fpair_j; + double rsq, r2inv, rinv, forcecoul, factor_coul, efield_i; + int *ilist, *jlist, *numneigh, **firstneigh; if (atom->nmax > nmax) { memory->destroy(efield); nmax = atom->nmax; - memory->create(efield,nmax,3,"pair:efield"); + memory->create(efield, nmax, 3, "pair:efield"); } ecoul = 0.0; - ev_init(eflag,vflag); + ev_init(eflag, vflag); double **x = atom->x; double **f = atom->f; double *q = atom->q; - double* eps = atom->epsilon; - double** norm = atom->mu; - double* curvature = atom->curvature; - double* area = atom->area; + double *eps = atom->epsilon; + double **norm = atom->mu; + double *curvature = atom->curvature; + double *area = atom->area; int *type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; @@ -105,10 +105,10 @@ void PairCoulCutDielectric::compute(int eflag, int vflag) double curvature_threshold = sqrt(area[i]); if (curvature[i] < curvature_threshold) { - double sf = curvature[i]/(4.0*MY_PIS*curvature_threshold) * area[i]*q[i]; - efield[i][0] = sf*norm[i][0]; - efield[i][1] = sf*norm[i][1]; - efield[i][2] = sf*norm[i][2]; + double sf = curvature[i] / (4.0 * MY_PIS * curvature_threshold) * area[i] * q[i]; + efield[i][0] = sf * norm[i][0]; + efield[i][1] = sf * norm[i][1]; + efield[i][2] = sf * norm[i][2]; } else { efield[i][0] = efield[i][1] = efield[i][2] = 0; } @@ -121,37 +121,37 @@ void PairCoulCutDielectric::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; jtype = type[j]; if (rsq < cutsq[itype][jtype] && rsq > EPSILON) { - r2inv = 1.0/rsq; + r2inv = 1.0 / rsq; rinv = sqrt(r2inv); - efield_i = scale[itype][jtype] * q[j]*rinv; - forcecoul = qtmp*efield_i; + efield_i = scale[itype][jtype] * q[j] * rinv; + forcecoul = qtmp * efield_i; - fpair_i = factor_coul*etmp*forcecoul*r2inv; - f[i][0] += delx*fpair_i; - f[i][1] += dely*fpair_i; - f[i][2] += delz*fpair_i; + fpair_i = factor_coul * etmp * forcecoul * r2inv; + f[i][0] += delx * fpair_i; + f[i][1] += dely * fpair_i; + f[i][2] += delz * fpair_i; - efield_i *= (factor_coul*etmp*r2inv); - efield[i][0] += delx*efield_i; - efield[i][1] += dely*efield_i; - efield[i][2] += delz*efield_i; + efield_i *= (factor_coul * etmp * r2inv); + efield[i][0] += delx * efield_i; + efield[i][1] += dely * efield_i; + efield[i][2] += delz * efield_i; if (newton_pair && j >= nlocal) { - fpair_j = factor_coul*eps[j]*forcecoul*r2inv; - f[j][0] -= delx*fpair_j; - f[j][1] -= dely*fpair_j; - f[j][2] -= delz*fpair_j; + fpair_j = factor_coul * eps[j] * forcecoul * r2inv; + f[j][0] -= delx * fpair_j; + f[j][1] -= dely * fpair_j; + f[j][2] -= delz * fpair_j; } if (eflag) { - ecoul = factor_coul * qqrd2e * scale[itype][jtype] * qtmp*q[j]*(etmp+eps[j])*rinv; + ecoul = factor_coul * qqrd2e * scale[itype][jtype] * qtmp * q[j] * (etmp + eps[j]) * rinv; ecoul *= 0.5; } - if (evflag) ev_tally_full(i,0.0,ecoul,fpair_i,delx,dely,delz); + if (evflag) ev_tally_full(i, 0.0, ecoul, fpair_i, delx, dely, delz); } } } @@ -159,7 +159,6 @@ void PairCoulCutDielectric::compute(int eflag, int vflag) if (vflag_fdotr) virial_fdotr_compute(); } - /* ---------------------------------------------------------------------- init specific to this pair style ------------------------------------------------------------------------- */ @@ -167,34 +166,36 @@ void PairCoulCutDielectric::compute(int eflag, int vflag) void PairCoulCutDielectric::init_style() { avec = (AtomVecDielectric *) atom->style_match("dielectric"); - if (!avec) error->all(FLERR,"Pair coul/cut/dielectric requires atom style dielectric"); + if (!avec) error->all(FLERR, "Pair coul/cut/dielectric requires atom style dielectric"); - int irequest = neighbor->request(this,instance_me); + int irequest = neighbor->request(this, instance_me); neighbor->requests[irequest]->half = 0; neighbor->requests[irequest]->full = 1; } /* ---------------------------------------------------------------------- */ -double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/, - double rsq, - double factor_coul, double /*factor_lj*/, - double &fforce) +double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq, + double factor_coul, double /*factor_lj*/, double &fforce) { - double r2inv,phicoul,ei,ej; - double* eps = atom->epsilon; + double r2inv, phicoul, ei, ej; + double *eps = atom->epsilon; - r2inv = 1.0/rsq; - fforce = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv)*eps[i]; + r2inv = 1.0 / rsq; + fforce = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv) * eps[i]; double eng = 0.0; - if (eps[i] == 1) ei = 0; - else ei = eps[i]; - if (eps[j] == 1) ej = 0; - else ej = eps[j]; - phicoul = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv); - phicoul *= 0.5*(ei+ej); - eng += factor_coul*phicoul; + if (eps[i] == 1) + ei = 0; + else + ei = eps[i]; + if (eps[j] == 1) + ej = 0; + else + ej = eps[j]; + phicoul = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv); + phicoul *= 0.5 * (ei + ej); + eng += factor_coul * phicoul; return eng; } diff --git a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp index 0d0c7074bb..922e24f0ea 100644 --- a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp @@ -267,7 +267,8 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag) if (eflag) evdwl = f * (rn * (rn * lj3i[jtype] - lj4i[jtype]) - offseti[jtype]); } } - } else force_lj = evdwl = 0.0; + } else + force_lj = evdwl = 0.0; fpair_i = (force_coul * etmp + force_lj) * r2inv; f[i][0] += delx * fpair_i; diff --git a/src/DIPOLE/angle_dipole.cpp b/src/DIPOLE/angle_dipole.cpp index f7724e2b56..b3d269fdb7 100644 --- a/src/DIPOLE/angle_dipole.cpp +++ b/src/DIPOLE/angle_dipole.cpp @@ -184,7 +184,7 @@ void AngleDipole::coeff(int narg, char **arg) void AngleDipole::init_style() { if (!atom->mu_flag || !atom->torque_flag) - error->all(FLERR,"Angle style dipole requires atom attributes mu and torque"); + error->all(FLERR, "Angle style dipole requires atom attributes mu and torque"); } /* ---------------------------------------------------------------------- diff --git a/src/FEP/pair_morse_soft.cpp b/src/FEP/pair_morse_soft.cpp index db7c4eca6c..c7c10b249e 100644 --- a/src/FEP/pair_morse_soft.cpp +++ b/src/FEP/pair_morse_soft.cpp @@ -15,11 +15,11 @@ #include "atom.h" #include "comm.h" -#include "force.h" -#include "neigh_list.h" -#include "memory.h" -#include "math_special.h" #include "error.h" +#include "force.h" +#include "math_special.h" +#include "memory.h" +#include "neigh_list.h" #include #include @@ -35,25 +35,23 @@ using namespace MathSpecial; PairMorseSoft::~PairMorseSoft() { - if (allocated) { - memory->destroy(lambda); - } + if (allocated) { memory->destroy(lambda); } } /* ---------------------------------------------------------------------- */ void PairMorseSoft::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; - double rsq,r,dr,dexp,dexp2,dexp3,factor_lj; - double ea,phi,V0,iea2; + int i, j, ii, jj, inum, jnum, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair; + double rsq, r, dr, dexp, dexp2, dexp3, factor_lj; + double ea, phi, V0, iea2; double D, a, x0, l, B, s1, llf; - int *ilist,*jlist,*numneigh,**firstneigh; + int *ilist, *jlist, *numneigh, **firstneigh; evdwl = 0.0; - ev_init(eflag,vflag); + ev_init(eflag, vflag); double **x = atom->x; double **f = atom->f; @@ -86,68 +84,64 @@ void PairMorseSoft::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; jtype = type[j]; if (rsq < cutsq[itype][jtype]) { r = sqrt(rsq); dr = r - r0[itype][jtype]; - D = d0[itype][jtype]; - a = alpha[itype][jtype]; + D = d0[itype][jtype]; + a = alpha[itype][jtype]; x0 = r0[itype][jtype]; - dexp = exp( -a * dr ); - dexp2 = dexp*dexp; - dexp3 = dexp2*dexp; + dexp = exp(-a * dr); + dexp2 = dexp * dexp; + dexp3 = dexp2 * dexp; l = lambda[itype][jtype]; - ea = exp( a * x0 ); - iea2 = exp( -2.*a*x0 ); + ea = exp(a * x0); + iea2 = exp(-2. * a * x0); - V0 = D * dexp * ( dexp - 2.0 ); - B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0; + V0 = D * dexp * (dexp - 2.0); + B = -2.0 * D * iea2 * (ea - 1.0) / 3.0; if (l >= shift_range) { - s1 = (l - 1.0) / (shift_range - 1.0); - phi = V0 + B*dexp3 * s1; + s1 = (l - 1.0) / (shift_range - 1.0); + phi = V0 + B * dexp3 * s1; // Force computation: - fpair = 3.0*a*B*dexp3*s1 + 2.0*a*D*(dexp2 - dexp); + fpair = 3.0 * a * B * dexp3 * s1 + 2.0 * a * D * (dexp2 - dexp); fpair /= r; } else { - llf = MathSpecial::powint( l / shift_range, nlambda ); - phi = V0 + B*dexp3; + llf = MathSpecial::powint(l / shift_range, nlambda); + phi = V0 + B * dexp3; phi *= llf; // Force computation: if (r == 0.0) { fpair = 0.0; } else { - fpair = 3.0*a*B*dexp3 + 2.0*a*D*(dexp2 - dexp); + fpair = 3.0 * a * B * dexp3 + 2.0 * a * D * (dexp2 - dexp); fpair *= llf / r; } } fpair *= factor_lj; - - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; + f[i][0] += delx * fpair; + f[i][1] += dely * fpair; + f[i][2] += delz * fpair; if (newton_pair || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j][0] -= delx * fpair; + f[j][1] -= dely * fpair; + f[j][2] -= delz * fpair; } - if (eflag) { - evdwl = phi*factor_lj; - } + if (eflag) { evdwl = phi * factor_lj; } - if (evflag) ev_tally(i,j,nlocal,newton_pair, - evdwl,0.0,fpair,delx,dely,delz); + if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); } } } @@ -163,7 +157,7 @@ void PairMorseSoft::allocate() { PairMorse::allocate(); int n = atom->ntypes; - memory->create(lambda,n+1,n+1,"pair:lambda"); + memory->create(lambda, n + 1, n + 1, "pair:lambda"); } /* ---------------------------------------------------------------------- @@ -172,35 +166,35 @@ void PairMorseSoft::allocate() void PairMorseSoft::coeff(int narg, char **arg) { - if (narg < 6 || narg > 7) error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg < 6 || narg > 7) error->all(FLERR, "Incorrect args for pair coefficients"); if (!allocated) allocate(); - int ilo,ihi,jlo,jhi; - utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); - utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); - double d0_one = utils::numeric(FLERR,arg[2],false,lmp); - double alpha_one = utils::numeric(FLERR,arg[3],false,lmp); - double r0_one = utils::numeric(FLERR,arg[4],false,lmp); - double lambda_one = utils::numeric(FLERR,arg[5],false,lmp); + double d0_one = utils::numeric(FLERR, arg[2], false, lmp); + double alpha_one = utils::numeric(FLERR, arg[3], false, lmp); + double r0_one = utils::numeric(FLERR, arg[4], false, lmp); + double lambda_one = utils::numeric(FLERR, arg[5], false, lmp); double cut_one = cut_global; - if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); + if (narg == 7) cut_one = utils::numeric(FLERR, arg[6], false, lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo,i); j <= jhi; j++) { - d0[i][j] = d0_one; - alpha[i][j] = alpha_one; - r0[i][j] = r0_one; - lambda[i][j] = lambda_one; - cut[i][j] = cut_one; + for (int j = MAX(jlo, i); j <= jhi; j++) { + d0[i][j] = d0_one; + alpha[i][j] = alpha_one; + r0[i][j] = r0_one; + lambda[i][j] = lambda_one; + cut[i][j] = cut_one; setflag[i][j] = 1; count++; } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -209,65 +203,64 @@ void PairMorseSoft::coeff(int narg, char **arg) void PairMorseSoft::settings(int narg, char **arg) { - if (narg != 3) error->all(FLERR,"Illegal pair_style command"); + if (narg != 3) error->all(FLERR, "Illegal pair_style command"); - nlambda = utils::inumeric(FLERR,arg[0],false,lmp); - shift_range = utils::numeric(FLERR,arg[1],false,lmp); - cut_global = utils::numeric(FLERR,arg[2],false,lmp); + nlambda = utils::inumeric(FLERR, arg[0], false, lmp); + shift_range = utils::numeric(FLERR, arg[1], false, lmp); + cut_global = utils::numeric(FLERR, arg[2], false, lmp); // reset cutoffs that have been explicitly set if (allocated) { - int i,j; + int i, j; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) if (setflag[i][j]) cut[i][j] = cut_global; } } - /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ double PairMorseSoft::init_one(int i, int j) { - if (setflag[i][j] == 0) - error->all(FLERR,"All pair coeffs are not set"); + if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); - morse1[i][j] = 2.0*d0[i][j]*alpha[i][j]; + morse1[i][j] = 2.0 * d0[i][j] * alpha[i][j]; if (offset_flag) { double l, s1, V0, B, llf; double alpha_dr = -alpha[i][j] * (cut[i][j] - r0[i][j]); - double D = d0[i][j]; - double a = alpha[i][j]; + double D = d0[i][j]; + double a = alpha[i][j]; double x0 = r0[i][j]; - double dexp = exp( alpha_dr ); - double dexp2 = dexp*dexp; - double dexp3 = dexp2*dexp; + double dexp = exp(alpha_dr); + double dexp2 = dexp * dexp; + double dexp3 = dexp2 * dexp; l = lambda[i][j]; - double ea = exp( a*x0 ); - double iea2 = exp( -2.*a*x0 ); + double ea = exp(a * x0); + double iea2 = exp(-2. * a * x0); - V0 = D * dexp * ( dexp - 2.0 ); - B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0; + V0 = D * dexp * (dexp - 2.0); + B = -2.0 * D * iea2 * (ea - 1.0) / 3.0; if (l >= shift_range) { - s1 = (l - 1.0) / (shift_range - 1.0); - offset[i][j] = V0 + B*dexp3 * s1; + s1 = (l - 1.0) / (shift_range - 1.0); + offset[i][j] = V0 + B * dexp3 * s1; } else { - llf = MathSpecial::powint( l / shift_range, nlambda ); - offset[i][j] = V0 + B*dexp3; + llf = MathSpecial::powint(l / shift_range, nlambda); + offset[i][j] = V0 + B * dexp3; offset[i][j] *= llf; } - } else offset[i][j] = 0.0; + } else + offset[i][j] = 0.0; - d0[j][i] = d0[i][j]; - alpha[j][i] = alpha[i][j]; - r0[j][i] = r0[i][j]; + d0[j][i] = d0[i][j]; + alpha[j][i] = alpha[i][j]; + r0[j][i] = r0[i][j]; morse1[j][i] = morse1[i][j]; lambda[j][i] = lambda[i][j]; offset[j][i] = offset[i][j]; @@ -283,16 +276,16 @@ void PairMorseSoft::write_restart(FILE *fp) { write_restart_settings(fp); - int i,j; + int i, j; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - fwrite(&setflag[i][j],sizeof(int),1,fp); + fwrite(&setflag[i][j], sizeof(int), 1, fp); if (setflag[i][j]) { - fwrite(&d0[i][j],sizeof(double),1,fp); - fwrite(&alpha[i][j],sizeof(double),1,fp); - fwrite(&r0[i][j],sizeof(double),1,fp); - fwrite(&lambda[i][j],sizeof(double),1,fp); - fwrite(&cut[i][j],sizeof(double),1,fp); + fwrite(&d0[i][j], sizeof(double), 1, fp); + fwrite(&alpha[i][j], sizeof(double), 1, fp); + fwrite(&r0[i][j], sizeof(double), 1, fp); + fwrite(&lambda[i][j], sizeof(double), 1, fp); + fwrite(&cut[i][j], sizeof(double), 1, fp); } } } @@ -308,25 +301,25 @@ void PairMorseSoft::read_restart(FILE *fp) allocate(); - int i,j; + int i, j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &d0[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &alpha[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &r0[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &lambda[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); } - MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&d0[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&alpha[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&r0[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&lambda[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); } } } @@ -338,11 +331,11 @@ void PairMorseSoft::read_restart(FILE *fp) void PairMorseSoft::write_restart_settings(FILE *fp) { - fwrite(&nlambda,sizeof(double),1,fp); - fwrite(&shift_range,sizeof(double),1,fp); - fwrite(&cut_global,sizeof(double),1,fp); - fwrite(&offset_flag,sizeof(int),1,fp); - fwrite(&mix_flag,sizeof(int),1,fp); + fwrite(&nlambda, sizeof(double), 1, fp); + fwrite(&shift_range, sizeof(double), 1, fp); + fwrite(&cut_global, sizeof(double), 1, fp); + fwrite(&offset_flag, sizeof(int), 1, fp); + fwrite(&mix_flag, sizeof(int), 1, fp); } /* ---------------------------------------------------------------------- @@ -353,20 +346,19 @@ void PairMorseSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &nlambda, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &shift_range, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cut_global, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &offset_flag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &mix_flag, sizeof(int), 1, fp, nullptr, error); } - MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); - MPI_Bcast(&shift_range,1,MPI_DOUBLE,0,world); - MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); - MPI_Bcast(&offset_flag,1,MPI_INT,0,world); - MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + MPI_Bcast(&nlambda, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&shift_range, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&cut_global, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&offset_flag, 1, MPI_INT, 0, world); + MPI_Bcast(&mix_flag, 1, MPI_INT, 0, world); } - /* ---------------------------------------------------------------------- proc 0 writes to data file ------------------------------------------------------------------------- */ @@ -374,8 +366,7 @@ void PairMorseSoft::read_restart_settings(FILE *fp) void PairMorseSoft::write_data(FILE *fp) { for (int i = 1; i <= atom->ntypes; i++) - fprintf(fp,"%d %g %g %g %g\n",i,d0[i][i],alpha[i][i],r0[i][i], - lambda[i][i]); + fprintf(fp, "%d %g %g %g %g\n", i, d0[i][i], alpha[i][i], r0[i][i], lambda[i][i]); } /* ---------------------------------------------------------------------- @@ -386,61 +377,60 @@ void PairMorseSoft::write_data_all(FILE *fp) { for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) - fprintf(fp,"%d %d %g %g %g %g %g\n",i,j,d0[i][j],alpha[i][j],r0[i][j], - lambda[i][j],cut[i][j]); + fprintf(fp, "%d %d %g %g %g %g %g\n", i, j, d0[i][j], alpha[i][j], r0[i][j], lambda[i][j], + cut[i][j]); } /* ---------------------------------------------------------------------- */ double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, - double /*factor_coul*/, double factor_lj, - double &fforce) + double /*factor_coul*/, double factor_lj, double &fforce) { double r, dr, dexp, dexp2, dexp3, phi; double B, D, a, ea, iea2; double x0, V0, s1, l, llf; - D = d0[itype][jtype]; - a = alpha[itype][jtype]; + D = d0[itype][jtype]; + a = alpha[itype][jtype]; x0 = r0[itype][jtype]; r = sqrt(rsq); dr = r - r0[itype][jtype]; - dexp = exp( -a * dr ); - dexp2 = dexp*dexp; - dexp3 = dexp2*dexp; + dexp = exp(-a * dr); + dexp2 = dexp * dexp; + dexp3 = dexp2 * dexp; l = lambda[itype][jtype]; - ea = exp( a * x0 ); - iea2 = exp( -2.*a*x0 ); + ea = exp(a * x0); + iea2 = exp(-2. * a * x0); - V0 = D * dexp * ( dexp - 2.0 ); - B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0; + V0 = D * dexp * (dexp - 2.0); + B = -2.0 * D * iea2 * (ea - 1.0) / 3.0; if (l >= shift_range) { - s1 = (l - 1.0) / (shift_range - 1.0); - phi = V0 + B*dexp3 * s1; + s1 = (l - 1.0) / (shift_range - 1.0); + phi = V0 + B * dexp3 * s1; // Force computation: - fforce = 3.0*a*B*dexp3*s1 + 2.0*a*D*(dexp2 - dexp); + fforce = 3.0 * a * B * dexp3 * s1 + 2.0 * a * D * (dexp2 - dexp); fforce /= r; } else { - llf = MathSpecial::powint( l / shift_range, nlambda ); - phi = V0 + B*dexp3; + llf = MathSpecial::powint(l / shift_range, nlambda); + phi = V0 + B * dexp3; phi *= llf; // Force computation: if (r == 0.0) { fforce = 0.0; } else { - fforce = 3.0*a*B*dexp3 + 2.0*a*D*(dexp2 - dexp); + fforce = 3.0 * a * B * dexp3 + 2.0 * a * D * (dexp2 - dexp); fforce *= llf / r; } } fforce *= factor_lj; phi -= offset[itype][jtype]; - return factor_lj*phi; + return factor_lj * phi; } /* ---------------------------------------------------------------------- */ @@ -448,9 +438,9 @@ double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double void *PairMorseSoft::extract(const char *str, int &dim) { dim = 2; - if (strcmp(str,"d0") == 0) return (void *) d0; - if (strcmp(str,"r0") == 0) return (void *) r0; - if (strcmp(str,"alpha") == 0) return (void *) alpha; - if (strcmp(str,"lambda") == 0) return (void *) lambda; + if (strcmp(str, "d0") == 0) return (void *) d0; + if (strcmp(str, "r0") == 0) return (void *) r0; + if (strcmp(str, "alpha") == 0) return (void *) alpha; + if (strcmp(str, "lambda") == 0) return (void *) lambda; return nullptr; } diff --git a/src/GRANULAR/compute_fabric.cpp b/src/GRANULAR/compute_fabric.cpp index a09327e2d5..341e32b867 100644 --- a/src/GRANULAR/compute_fabric.cpp +++ b/src/GRANULAR/compute_fabric.cpp @@ -592,4 +592,3 @@ double ComputeFabric::compute_scalar() scalar = nc; return nc; } - diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index e6013b9940..9bf2ae12d2 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -67,8 +67,8 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) // this is so final order of Modify:fix will conform to input script fix_history = nullptr; - fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY" - + std::to_string(instance_me) + " all DUMMY"); + fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) + + " all DUMMY"); } /* ---------------------------------------------------------------------- */ @@ -77,19 +77,21 @@ PairGranHookeHistory::~PairGranHookeHistory() { if (copymode) return; - delete [] svector; + delete[] svector; - if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me)); - else modify->delete_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me)); + if (!fix_history) + modify->delete_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me)); + else + modify->delete_fix("NEIGH_HISTORY_HH" + std::to_string(instance_me)); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] onerad_dynamic; - delete [] onerad_frozen; - delete [] maxrad_dynamic; - delete [] maxrad_frozen; + delete[] onerad_dynamic; + delete[] onerad_frozen; + delete[] maxrad_dynamic; + delete[] maxrad_frozen; } memory->destroy(mass_rigid); @@ -99,20 +101,20 @@ PairGranHookeHistory::~PairGranHookeHistory() void PairGranHookeHistory::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum; - double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz; - double radi,radj,radsum,rsq,r,rinv,rsqinv; - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3; - double vtr1,vtr2,vtr3,vrel; - double mi,mj,meff,damp,ccel,tor1,tor2,tor3; - double fn,fs,fs1,fs2,fs3; - double shrmag,rsht; - int *ilist,*jlist,*numneigh,**firstneigh; - int *touch,**firsttouch; - double *shear,*allshear,**firstshear; + int i, j, ii, jj, inum, jnum; + double xtmp, ytmp, ztmp, delx, dely, delz, fx, fy, fz; + double radi, radj, radsum, rsq, r, rinv, rsqinv; + double vr1, vr2, vr3, vnnr, vn1, vn2, vn3, vt1, vt2, vt3; + double wr1, wr2, wr3; + double vtr1, vtr2, vtr3, vrel; + double mi, mj, meff, damp, ccel, tor1, tor2, tor3; + double fn, fs, fs1, fs2, fs3; + double shrmag, rsht; + int *ilist, *jlist, *numneigh, **firstneigh; + int *touch, **firsttouch; + double *shear, *allshear, **firstshear; - ev_init(eflag,vflag); + ev_init(eflag, vflag); int shearupdate = 1; if (update->setupflag) shearupdate = 0; @@ -123,17 +125,19 @@ void PairGranHookeHistory::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; - int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + int *body = (int *) fix_rigid->extract("body", tmp); + double *mass_body = (double *) fix_rigid->extract("masstotal", tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; - memory->create(mass_rigid,nmax,"pair:mass_rigid"); + memory->create(mass_rigid, nmax, "pair:mass_rigid"); } int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) - if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]]; - else mass_rigid[i] = 0.0; + if (body[i] >= 0) + mass_rigid[i] = mass_body[body[i]]; + else + mass_rigid[i] = 0.0; comm->forward_comm_pair(this); } @@ -175,24 +179,24 @@ void PairGranHookeHistory::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; radj = radius[j]; radsum = radi + radj; - if (rsq >= radsum*radsum) { + if (rsq >= radsum * radsum) { // unset non-touching neighbors touch[jj] = 0; - shear = &allshear[3*jj]; + shear = &allshear[3 * jj]; shear[0] = 0.0; shear[1] = 0.0; shear[2] = 0.0; } else { r = sqrt(rsq); - rinv = 1.0/r; - rsqinv = 1.0/rsq; + rinv = 1.0 / r; + rsqinv = 1.0 / rsq; // relative translational velocity @@ -202,10 +206,10 @@ void PairGranHookeHistory::compute(int eflag, int vflag) // normal component - vnnr = vr1*delx + vr2*dely + vr3*delz; - vn1 = delx*vnnr * rsqinv; - vn2 = dely*vnnr * rsqinv; - vn3 = delz*vnnr * rsqinv; + vnnr = vr1 * delx + vr2 * dely + vr3 * delz; + vn1 = delx * vnnr * rsqinv; + vn2 = dely * vnnr * rsqinv; + vn3 = delz * vnnr * rsqinv; // tangential component @@ -215,9 +219,9 @@ void PairGranHookeHistory::compute(int eflag, int vflag) // relative rotational velocity - wr1 = (radi*omega[i][0] + radj*omega[j][0]) * rinv; - wr2 = (radi*omega[i][1] + radj*omega[j][1]) * rinv; - wr3 = (radi*omega[i][2] + radj*omega[j][2]) * rinv; + wr1 = (radi * omega[i][0] + radj * omega[j][0]) * rinv; + wr2 = (radi * omega[i][1] + radj * omega[j][1]) * rinv; + wr3 = (radi * omega[i][2] + radj * omega[j][2]) * rinv; // meff = effective mass of pair of particles // if I or J part of rigid body, use body mass @@ -230,99 +234,98 @@ void PairGranHookeHistory::compute(int eflag, int vflag) if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; } - meff = mi*mj / (mi+mj); + meff = mi * mj / (mi + mj); if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; // normal forces = Hookian contact + normal velocity damping - damp = meff*gamman*vnnr*rsqinv; - ccel = kn*(radsum-r)*rinv - damp; + damp = meff * gamman * vnnr * rsqinv; + ccel = kn * (radsum - r) * rinv - damp; if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities - vtr1 = vt1 - (delz*wr2-dely*wr3); - vtr2 = vt2 - (delx*wr3-delz*wr1); - vtr3 = vt3 - (dely*wr1-delx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; + vtr1 = vt1 - (delz * wr2 - dely * wr3); + vtr2 = vt2 - (delx * wr3 - delz * wr1); + vtr3 = vt3 - (dely * wr1 - delx * wr2); + vrel = vtr1 * vtr1 + vtr2 * vtr2 + vtr3 * vtr3; vrel = sqrt(vrel); // shear history effects touch[jj] = 1; - shear = &allshear[3*jj]; + shear = &allshear[3 * jj]; if (shearupdate) { - shear[0] += vtr1*dt; - shear[1] += vtr2*dt; - shear[2] += vtr3*dt; + shear[0] += vtr1 * dt; + shear[1] += vtr2 * dt; + shear[2] += vtr3 * dt; } - shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + - shear[2]*shear[2]); + shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]); // rotate shear displacements - rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz; + rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz; rsht *= rsqinv; if (shearupdate) { - shear[0] -= rsht*delx; - shear[1] -= rsht*dely; - shear[2] -= rsht*delz; + shear[0] -= rsht * delx; + shear[1] -= rsht * dely; + shear[2] -= rsht * delz; } // tangential forces = shear + tangential velocity damping - fs1 = - (kt*shear[0] + meff*gammat*vtr1); - fs2 = - (kt*shear[1] + meff*gammat*vtr2); - fs3 = - (kt*shear[2] + meff*gammat*vtr3); + fs1 = -(kt * shear[0] + meff * gammat * vtr1); + fs2 = -(kt * shear[1] + meff * gammat * vtr2); + fs3 = -(kt * shear[2] + meff * gammat * vtr3); // rescale frictional displacements and forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - fn = xmu * fabs(ccel*r); + fs = sqrt(fs1 * fs1 + fs2 * fs2 + fs3 * fs3); + fn = xmu * fabs(ccel * r); if (fs > fn) { if (shrmag != 0.0) { - shear[0] = (fn/fs) * (shear[0] + meff*gammat*vtr1/kt) - - meff*gammat*vtr1/kt; - shear[1] = (fn/fs) * (shear[1] + meff*gammat*vtr2/kt) - - meff*gammat*vtr2/kt; - shear[2] = (fn/fs) * (shear[2] + meff*gammat*vtr3/kt) - - meff*gammat*vtr3/kt; - fs1 *= fn/fs; - fs2 *= fn/fs; - fs3 *= fn/fs; - } else fs1 = fs2 = fs3 = 0.0; + shear[0] = + (fn / fs) * (shear[0] + meff * gammat * vtr1 / kt) - meff * gammat * vtr1 / kt; + shear[1] = + (fn / fs) * (shear[1] + meff * gammat * vtr2 / kt) - meff * gammat * vtr2 / kt; + shear[2] = + (fn / fs) * (shear[2] + meff * gammat * vtr3 / kt) - meff * gammat * vtr3 / kt; + fs1 *= fn / fs; + fs2 *= fn / fs; + fs3 *= fn / fs; + } else + fs1 = fs2 = fs3 = 0.0; } // forces & torques - fx = delx*ccel + fs1; - fy = dely*ccel + fs2; - fz = delz*ccel + fs3; + fx = delx * ccel + fs1; + fy = dely * ccel + fs2; + fz = delz * ccel + fs3; f[i][0] += fx; f[i][1] += fy; f[i][2] += fz; - tor1 = rinv * (dely*fs3 - delz*fs2); - tor2 = rinv * (delz*fs1 - delx*fs3); - tor3 = rinv * (delx*fs2 - dely*fs1); - torque[i][0] -= radi*tor1; - torque[i][1] -= radi*tor2; - torque[i][2] -= radi*tor3; + tor1 = rinv * (dely * fs3 - delz * fs2); + tor2 = rinv * (delz * fs1 - delx * fs3); + tor3 = rinv * (delx * fs2 - dely * fs1); + torque[i][0] -= radi * tor1; + torque[i][1] -= radi * tor2; + torque[i][2] -= radi * tor3; if (newton_pair || j < nlocal) { f[j][0] -= fx; f[j][1] -= fy; f[j][2] -= fz; - torque[j][0] -= radj*tor1; - torque[j][1] -= radj*tor2; - torque[j][2] -= radj*tor3; + torque[j][0] -= radj * tor1; + torque[j][1] -= radj * tor2; + torque[j][2] -= radj * tor3; } - if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair, - 0.0,0.0,fx,fy,fz,delx,dely,delz); + if (evflag) ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, fx, fy, fz, delx, dely, delz); } } } @@ -339,17 +342,16 @@ void PairGranHookeHistory::allocate() allocated = 1; int n = atom->ntypes; - memory->create(setflag,n+1,n+1,"pair:setflag"); + memory->create(setflag, n + 1, n + 1, "pair:setflag"); for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; + for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); - onerad_dynamic = new double[n+1]; - onerad_frozen = new double[n+1]; - maxrad_dynamic = new double[n+1]; - maxrad_frozen = new double[n+1]; + onerad_dynamic = new double[n + 1]; + onerad_frozen = new double[n + 1]; + maxrad_dynamic = new double[n + 1]; + maxrad_frozen = new double[n + 1]; } /* ---------------------------------------------------------------------- @@ -358,29 +360,35 @@ void PairGranHookeHistory::allocate() void PairGranHookeHistory::settings(int narg, char **arg) { - if (narg != 6 && narg != 7) error->all(FLERR,"Illegal pair_style command"); + if (narg != 6 && narg != 7) error->all(FLERR, "Illegal pair_style command"); - kn = utils::numeric(FLERR,arg[0],false,lmp); - if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; - else kt = utils::numeric(FLERR,arg[1],false,lmp); + kn = utils::numeric(FLERR, arg[0], false, lmp); + if (strcmp(arg[1], "NULL") == 0) + kt = kn * 2.0 / 7.0; + else + kt = utils::numeric(FLERR, arg[1], false, lmp); - gamman = utils::numeric(FLERR,arg[2],false,lmp); - if (strcmp(arg[3],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = utils::numeric(FLERR,arg[3],false,lmp); + gamman = utils::numeric(FLERR, arg[2], false, lmp); + if (strcmp(arg[3], "NULL") == 0) + gammat = 0.5 * gamman; + else + gammat = utils::numeric(FLERR, arg[3], false, lmp); - xmu = utils::numeric(FLERR,arg[4],false,lmp); - dampflag = utils::inumeric(FLERR,arg[5],false,lmp); + xmu = utils::numeric(FLERR, arg[4], false, lmp); + dampflag = utils::inumeric(FLERR, arg[5], false, lmp); if (dampflag == 0) gammat = 0.0; limit_damping = 0; if (narg == 7) { - if (strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; - else error->all(FLERR,"Illegal pair_style command"); + if (strcmp(arg[6], "limit_damping") == 0) + limit_damping = 1; + else + error->all(FLERR, "Illegal pair_style command"); } - if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || - xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) - error->all(FLERR,"Illegal pair_style command"); + if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || xmu < 0.0 || xmu > 10000.0 || + dampflag < 0 || dampflag > 1) + error->all(FLERR, "Illegal pair_style command"); } /* ---------------------------------------------------------------------- @@ -389,22 +397,22 @@ void PairGranHookeHistory::settings(int narg, char **arg) void PairGranHookeHistory::coeff(int narg, char **arg) { - if (narg > 2) error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg > 2) error->all(FLERR, "Incorrect args for pair coefficients"); if (!allocated) allocate(); - int ilo,ihi,jlo,jhi; - utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); - utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); int count = 0; for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo,i); j <= jhi; j++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { setflag[i][j] = 1; count++; } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -418,13 +426,13 @@ void PairGranHookeHistory::init_style() // error and warning checks if (!atom->radius_flag || !atom->rmass_flag) - error->all(FLERR,"Pair granular requires atom attributes radius, rmass"); + error->all(FLERR, "Pair granular requires atom attributes radius, rmass"); if (comm->ghost_velocity == 0) - error->all(FLERR,"Pair granular requires ghost atoms store velocity"); + error->all(FLERR, "Pair granular requires ghost atoms store velocity"); // need a granular neigh list - int irequest = neighbor->request(this,instance_me); + int irequest = neighbor->request(this, instance_me); neighbor->requests[irequest]->size = 1; if (history) neighbor->requests[irequest]->history = 1; @@ -436,16 +444,18 @@ void PairGranHookeHistory::init_style() if (history && (fix_history == nullptr)) { auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history); - fix_history = (FixNeighHistory *) modify->replace_fix("NEIGH_HISTORY_HH_DUMMY" - + std::to_string(instance_me),cmd,1); + fix_history = (FixNeighHistory *) modify->replace_fix( + "NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1); fix_history->pair = this; } // check for FixFreeze and set freeze_group_bit int ifreeze = modify->find_fix_by_style("^freeze"); - if (ifreeze < 0) freeze_group_bit = 0; - else freeze_group_bit = modify->fix[ifreeze]->groupbit; + if (ifreeze < 0) + freeze_group_bit = 0; + else + freeze_group_bit = modify->fix[ifreeze]->groupbit; // check for FixRigid so can extract rigid body masses // FIXME: this only catches the first rigid fix, there may be multiple. @@ -458,7 +468,7 @@ void PairGranHookeHistory::init_style() // check for FixPour and FixDeposit so can extract particle radii int ipour = modify->find_fix_by_style("^pour"); - int idep = modify->find_fix_by_style("^deposit"); + int idep = modify->find_fix_by_style("^deposit"); // set maxrad_dynamic and maxrad_frozen for each type // include future FixPour and FixDeposit particles as dynamic @@ -468,13 +478,11 @@ void PairGranHookeHistory::init_style() onerad_dynamic[i] = onerad_frozen[i] = 0.0; if (ipour >= 0) { itype = i; - onerad_dynamic[i] = - *((double *) modify->fix[ipour]->extract("radius",itype)); + onerad_dynamic[i] = *((double *) modify->fix[ipour]->extract("radius", itype)); } if (idep >= 0) { itype = i; - onerad_dynamic[i] = - *((double *) modify->fix[idep]->extract("radius",itype)); + onerad_dynamic[i] = *((double *) modify->fix[idep]->extract("radius", itype)); } } @@ -485,18 +493,18 @@ void PairGranHookeHistory::init_style() for (i = 0; i < nlocal; i++) if (mask[i] & freeze_group_bit) - onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]],radius[i]); + onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]], radius[i]); else - onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]],radius[i]); + onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]], radius[i]); - MPI_Allreduce(&onerad_dynamic[1],&maxrad_dynamic[1],atom->ntypes,MPI_DOUBLE,MPI_MAX,world); - MPI_Allreduce(&onerad_frozen[1],&maxrad_frozen[1],atom->ntypes,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&onerad_dynamic[1], &maxrad_dynamic[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world); + MPI_Allreduce(&onerad_frozen[1], &maxrad_frozen[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world); // set fix which stores history info if (history) { - int ifix = modify->find_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me)); - if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID"); + int ifix = modify->find_fix("NEIGH_HISTORY_HH" + std::to_string(instance_me)); + if (ifix < 0) error->all(FLERR, "Could not find pair fix neigh history ID"); fix_history = (FixNeighHistory *) modify->fix[ifix]; } } @@ -512,9 +520,9 @@ double PairGranHookeHistory::init_one(int i, int j) // cutoff = sum of max I,J radii for // dynamic/dynamic & dynamic/frozen interactions, but not frozen/frozen - double cutoff = maxrad_dynamic[i]+maxrad_dynamic[j]; - cutoff = MAX(cutoff,maxrad_frozen[i]+maxrad_dynamic[j]); - cutoff = MAX(cutoff,maxrad_dynamic[i]+maxrad_frozen[j]); + double cutoff = maxrad_dynamic[i] + maxrad_dynamic[j]; + cutoff = MAX(cutoff, maxrad_frozen[i] + maxrad_dynamic[j]); + cutoff = MAX(cutoff, maxrad_dynamic[i] + maxrad_frozen[j]); return cutoff; } @@ -526,10 +534,9 @@ void PairGranHookeHistory::write_restart(FILE *fp) { write_restart_settings(fp); - int i,j; + int i, j; for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) - fwrite(&setflag[i][j],sizeof(int),1,fp); + for (j = i; j <= atom->ntypes; j++) fwrite(&setflag[i][j], sizeof(int), 1, fp); } /* ---------------------------------------------------------------------- @@ -541,12 +548,12 @@ void PairGranHookeHistory::read_restart(FILE *fp) read_restart_settings(fp); allocate(); - int i,j; + int i, j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); } } @@ -556,12 +563,12 @@ void PairGranHookeHistory::read_restart(FILE *fp) void PairGranHookeHistory::write_restart_settings(FILE *fp) { - fwrite(&kn,sizeof(double),1,fp); - fwrite(&kt,sizeof(double),1,fp); - fwrite(&gamman,sizeof(double),1,fp); - fwrite(&gammat,sizeof(double),1,fp); - fwrite(&xmu,sizeof(double),1,fp); - fwrite(&dampflag,sizeof(int),1,fp); + fwrite(&kn, sizeof(double), 1, fp); + fwrite(&kt, sizeof(double), 1, fp); + fwrite(&gamman, sizeof(double), 1, fp); + fwrite(&gammat, sizeof(double), 1, fp); + fwrite(&xmu, sizeof(double), 1, fp); + fwrite(&dampflag, sizeof(int), 1, fp); } /* ---------------------------------------------------------------------- @@ -571,19 +578,19 @@ void PairGranHookeHistory::write_restart_settings(FILE *fp) void PairGranHookeHistory::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kn,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&kt,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&gamman,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&gammat,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&xmu,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &kn, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &kt, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &gamman, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &gammat, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &xmu, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &dampflag, sizeof(int), 1, fp, nullptr, error); } - MPI_Bcast(&kn,1,MPI_DOUBLE,0,world); - MPI_Bcast(&kt,1,MPI_DOUBLE,0,world); - MPI_Bcast(&gamman,1,MPI_DOUBLE,0,world); - MPI_Bcast(&gammat,1,MPI_DOUBLE,0,world); - MPI_Bcast(&xmu,1,MPI_DOUBLE,0,world); - MPI_Bcast(&dampflag,1,MPI_INT,0,world); + MPI_Bcast(&kn, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&kt, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamman, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&gammat, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&xmu, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&dampflag, 1, MPI_INT, 0, world); } /* ---------------------------------------------------------------------- */ @@ -595,32 +602,30 @@ void PairGranHookeHistory::reset_dt() /* ---------------------------------------------------------------------- */ -double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, - double rsq, - double /*factor_coul*/, double /*factor_lj*/, - double &fforce) +double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq, + double /*factor_coul*/, double /*factor_lj*/, double &fforce) { - double radi,radj,radsum; - double r,rinv,rsqinv,delx,dely,delz; - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3,wr1,wr2,wr3; - double mi,mj,meff,damp,ccel; - double vtr1,vtr2,vtr3,vrel,shrmag,rsht; - double fs1,fs2,fs3,fs,fn; + double radi, radj, radsum; + double r, rinv, rsqinv, delx, dely, delz; + double vr1, vr2, vr3, vnnr, vn1, vn2, vn3, vt1, vt2, vt3, wr1, wr2, wr3; + double mi, mj, meff, damp, ccel; + double vtr1, vtr2, vtr3, vrel, shrmag, rsht; + double fs1, fs2, fs3, fs, fn; double *radius = atom->radius; radi = radius[i]; radj = radius[j]; radsum = radi + radj; - if (rsq >= radsum*radsum) { + if (rsq >= radsum * radsum) { fforce = 0.0; for (int m = 0; m < single_extra; m++) svector[m] = 0.0; return 0.0; } r = sqrt(rsq); - rinv = 1.0/r; - rsqinv = 1.0/rsq; + rinv = 1.0 / r; + rsqinv = 1.0 / rsq; // relative translational velocity @@ -636,10 +641,10 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, dely = x[i][1] - x[j][1]; delz = x[i][2] - x[j][2]; - vnnr = vr1*delx + vr2*dely + vr3*delz; - vn1 = delx*vnnr * rsqinv; - vn2 = dely*vnnr * rsqinv; - vn3 = delz*vnnr * rsqinv; + vnnr = vr1 * delx + vr2 * dely + vr3 * delz; + vn1 = delx * vnnr * rsqinv; + vn2 = dely * vnnr * rsqinv; + vn3 = delz * vnnr * rsqinv; // tangential component @@ -650,9 +655,9 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, // relative rotational velocity double **omega = atom->omega; - wr1 = (radi*omega[i][0] + radj*omega[j][0]) * rinv; - wr2 = (radi*omega[i][1] + radj*omega[j][1]) * rinv; - wr3 = (radi*omega[i][2] + radj*omega[j][2]) * rinv; + wr1 = (radi * omega[i][0] + radj * omega[j][0]) * rinv; + wr2 = (radi * omega[i][1] + radj * omega[j][1]) * rinv; + wr3 = (radi * omega[i][2] + radj * omega[j][2]) * rinv; // meff = effective mass of pair of particles // if I or J part of rigid body, use body mass @@ -669,22 +674,22 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; } - meff = mi*mj / (mi+mj); + meff = mi * mj / (mi + mj); if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; // normal forces = Hookian contact + normal velocity damping - damp = meff*gamman*vnnr*rsqinv; - ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping && (ccel < 0.0)) ccel = 0.0; + damp = meff * gamman * vnnr * rsqinv; + ccel = kn * (radsum - r) * rinv - damp; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities - vtr1 = vt1 - (delz*wr2-dely*wr3); - vtr2 = vt2 - (delx*wr3-delz*wr1); - vtr3 = vt3 - (dely*wr1-delx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; + vtr1 = vt1 - (delz * wr2 - dely * wr3); + vtr2 = vt2 - (delx * wr3 - delz * wr1); + vtr3 = vt3 - (dely * wr1 - delx * wr2); + vrel = vtr1 * vtr1 + vtr2 * vtr2 + vtr3 * vtr3; vrel = sqrt(vrel); // shear history effects @@ -703,33 +708,33 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, if (jlist[neighprev] == j) break; } - double *shear = &allshear[3*neighprev]; - shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + - shear[2]*shear[2]); + double *shear = &allshear[3 * neighprev]; + shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]); // rotate shear displacements - rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz; + rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz; rsht *= rsqinv; // tangential forces = shear + tangential velocity damping - fs1 = - (kt*shear[0] + meff*gammat*vtr1); - fs2 = - (kt*shear[1] + meff*gammat*vtr2); - fs3 = - (kt*shear[2] + meff*gammat*vtr3); + fs1 = -(kt * shear[0] + meff * gammat * vtr1); + fs2 = -(kt * shear[1] + meff * gammat * vtr2); + fs3 = -(kt * shear[2] + meff * gammat * vtr3); // rescale frictional displacements and forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - fn = xmu * fabs(ccel*r); + fs = sqrt(fs1 * fs1 + fs2 * fs2 + fs3 * fs3); + fn = xmu * fabs(ccel * r); if (fs > fn) { if (shrmag != 0.0) { - fs1 *= fn/fs; - fs2 *= fn/fs; - fs3 *= fn/fs; - fs *= fn/fs; - } else fs1 = fs2 = fs3 = fs = 0.0; + fs1 *= fn / fs; + fs2 *= fn / fs; + fs3 *= fn / fs; + fs *= fn / fs; + } else + fs1 = fs2 = fs3 = fs = 0.0; } // set force and return no energy @@ -754,10 +759,10 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, /* ---------------------------------------------------------------------- */ -int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) +int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, + int * /*pbc*/) { - int i,j,m; + int i, j, m; m = 0; for (i = 0; i < n; i++) { @@ -771,12 +776,11 @@ int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf) { - int i,m,last; + int i, m, last; m = 0; last = first + n; - for (i = first; i < last; i++) - mass_rigid[i] = buf[m++]; + for (i = first; i < last; i++) mass_rigid[i] = buf[m++]; } /* ---------------------------------------------------------------------- @@ -785,7 +789,7 @@ void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf) double PairGranHookeHistory::memory_usage() { - double bytes = (double)nmax * sizeof(double); + double bytes = (double) nmax * sizeof(double); return bytes; } @@ -795,7 +799,7 @@ double PairGranHookeHistory::memory_usage() double PairGranHookeHistory::atom2cut(int i) { - double cut = atom->radius[i]*2; + double cut = atom->radius[i] * 2; return cut; } @@ -805,6 +809,6 @@ double PairGranHookeHistory::atom2cut(int i) double PairGranHookeHistory::radii2cut(double r1, double r2) { - double cut = r1+r2; + double cut = r1 + r2; return cut; } diff --git a/src/INTEL/angle_charmm_intel.h b/src/INTEL/angle_charmm_intel.h index ede6b46609..942ac942a1 100644 --- a/src/INTEL/angle_charmm_intel.h +++ b/src/INTEL/angle_charmm_intel.h @@ -42,26 +42,25 @@ class AngleCharmmIntel : public AngleCharmm { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k, theta0, k_ub, r_ub; } fc_packed1; + typedef struct { + flt_t k, theta0, k_ub, r_ub; + } fc_packed1; fc_packed1 *fc; - ForceConst() : _nangletypes(0) {} + ForceConst() : _nangletypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); @@ -74,7 +73,7 @@ class AngleCharmmIntel : public AngleCharmm { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/angle_harmonic_intel.h b/src/INTEL/angle_harmonic_intel.h index 67983b2868..10bdcd9546 100644 --- a/src/INTEL/angle_harmonic_intel.h +++ b/src/INTEL/angle_harmonic_intel.h @@ -42,26 +42,25 @@ class AngleHarmonicIntel : public AngleHarmonic { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k, theta0; } fc_packed1; + typedef struct { + flt_t k, theta0; + } fc_packed1; fc_packed1 *fc; - ForceConst() : _nangletypes(0) {} + ForceConst() : _nangletypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); @@ -74,7 +73,7 @@ class AngleHarmonicIntel : public AngleHarmonic { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/bond_fene_intel.h b/src/INTEL/bond_fene_intel.h index 938bd1515f..0c71f1a9d0 100644 --- a/src/INTEL/bond_fene_intel.h +++ b/src/INTEL/bond_fene_intel.h @@ -42,26 +42,25 @@ class BondFENEIntel : public BondFENE { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k, ir0sq, sigma, epsilon; } fc_packed1; + typedef struct { + flt_t k, ir0sq, sigma, epsilon; + } fc_packed1; fc_packed1 *fc; - ForceConst() : _nbondtypes(0) {} + ForceConst() : _nbondtypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); @@ -74,7 +73,7 @@ class BondFENEIntel : public BondFENE { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/bond_harmonic_intel.h b/src/INTEL/bond_harmonic_intel.h index 1744153a77..612f4e7ca1 100644 --- a/src/INTEL/bond_harmonic_intel.h +++ b/src/INTEL/bond_harmonic_intel.h @@ -42,26 +42,25 @@ class BondHarmonicIntel : public BondHarmonic { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k, r0; } fc_packed1; + typedef struct { + flt_t k, r0; + } fc_packed1; fc_packed1 *fc; - ForceConst() : _nbondtypes(0) {} + ForceConst() : _nbondtypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); @@ -74,7 +73,7 @@ class BondHarmonicIntel : public BondHarmonic { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/dihedral_charmm_intel.h b/src/INTEL/dihedral_charmm_intel.h index 9e17f46dd9..ec213f5d75 100644 --- a/src/INTEL/dihedral_charmm_intel.h +++ b/src/INTEL/dihedral_charmm_intel.h @@ -42,31 +42,32 @@ class DihedralCharmmIntel : public DihedralCharmm { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t lj1, lj2, lj3, lj4; } fc_packed1; - typedef struct { flt_t cos_shift, sin_shift, k; - int multiplicity; } fc_packed3; + typedef struct { + flt_t lj1, lj2, lj3, lj4; + } fc_packed1; + typedef struct { + flt_t cos_shift, sin_shift, k; + int multiplicity; + } fc_packed3; fc_packed1 **ljp; fc_packed3 *bp; flt_t *weight; - ForceConst() : _npairtypes(0), _nbondtypes(0) {} + ForceConst() : _npairtypes(0), _nbondtypes(0) {} ~ForceConst() { set_ntypes(0, 0, nullptr); } void set_ntypes(const int npairtypes, const int nbondtypes, Memory *memory); @@ -79,7 +80,7 @@ class DihedralCharmmIntel : public DihedralCharmm { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/dihedral_fourier_intel.h b/src/INTEL/dihedral_fourier_intel.h index 5c480981c5..3b1f594c28 100644 --- a/src/INTEL/dihedral_fourier_intel.h +++ b/src/INTEL/dihedral_fourier_intel.h @@ -42,32 +42,30 @@ class DihedralFourierIntel : public DihedralFourier { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t cos_shift, sin_shift, k; - int multiplicity; } fc_packed1; + typedef struct { + flt_t cos_shift, sin_shift, k; + int multiplicity; + } fc_packed1; fc_packed1 **bp; - ForceConst() : _nbondtypes(0) {} + ForceConst() : _nbondtypes(0) {} ~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); } - void set_ntypes(const int nbondtypes, int *setflag, int *nterms, - Memory *memory); + void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory); private: int _nbondtypes, _maxnterms; @@ -77,7 +75,7 @@ class DihedralFourierIntel : public DihedralFourier { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/dihedral_harmonic_intel.h b/src/INTEL/dihedral_harmonic_intel.h index 7508edbec1..388df11e4f 100644 --- a/src/INTEL/dihedral_harmonic_intel.h +++ b/src/INTEL/dihedral_harmonic_intel.h @@ -42,28 +42,27 @@ class DihedralHarmonicIntel : public DihedralHarmonic { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t cos_shift, sin_shift, k; - int multiplicity; } fc_packed1; + typedef struct { + flt_t cos_shift, sin_shift, k; + int multiplicity; + } fc_packed1; fc_packed1 *bp; - ForceConst() : _nbondtypes(0) {} + ForceConst() : _nbondtypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); @@ -76,7 +75,7 @@ class DihedralHarmonicIntel : public DihedralHarmonic { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/dihedral_opls_intel.h b/src/INTEL/dihedral_opls_intel.h index 456a5af9b9..98206b184f 100644 --- a/src/INTEL/dihedral_opls_intel.h +++ b/src/INTEL/dihedral_opls_intel.h @@ -42,27 +42,26 @@ class DihedralOPLSIntel : public DihedralOPLS { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k1, k2, k3, k4; } fc_packed1; + typedef struct { + flt_t k1, k2, k3, k4; + } fc_packed1; fc_packed1 *bp; - ForceConst() : _nbondtypes(0) {} + ForceConst() : _nbondtypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); @@ -75,7 +74,7 @@ class DihedralOPLSIntel : public DihedralOPLS { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 8e5d2b524d..8e2ca5e7d1 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -25,11 +25,11 @@ FixStyle(INTEL,FixIntel); #ifndef LMP_FIX_INTEL_H #define LMP_FIX_INTEL_H -#include "fix.h" -#include "intel_buffers.h" -#include "force.h" -#include "pair.h" #include "error.h" +#include "fix.h" +#include "force.h" +#include "intel_buffers.h" +#include "pair.h" #include "update.h" namespace LAMMPS_NS { @@ -48,13 +48,12 @@ class FixIntel : public Fix { void setup_pre_reverse(int eflag = 0, int vflag = 0); bool pair_hybrid_check(); - void pair_init_check(const bool cdmessage=false); + void pair_init_check(const bool cdmessage = false); void bond_init_check(); void kspace_init_check(); void pre_reverse(int eflag = 0, int vflag = 0); - inline void min_pre_reverse(int eflag = 0, int vflag = 0) - { pre_reverse(eflag, vflag); } + inline void min_pre_reverse(int eflag = 0, int vflag = 0) { pre_reverse(eflag, vflag); } void post_run() { _print_pkg_info = 1; } @@ -63,45 +62,55 @@ class FixIntel : public Fix { double memory_usage(); - typedef struct { double x,y,z; } lmp_ft; + typedef struct { + double x, y, z; + } lmp_ft; - enum {PREC_MODE_SINGLE, PREC_MODE_MIXED, PREC_MODE_DOUBLE}; + enum { PREC_MODE_SINGLE, PREC_MODE_MIXED, PREC_MODE_DOUBLE }; inline int precision() { return _precision_mode; } - inline IntelBuffers * get_single_buffers() - { return _single_buffers; } - inline IntelBuffers * get_mixed_buffers() - { return _mixed_buffers; } - inline IntelBuffers * get_double_buffers() - { return _double_buffers; } + inline IntelBuffers *get_single_buffers() { return _single_buffers; } + inline IntelBuffers *get_mixed_buffers() { return _mixed_buffers; } + inline IntelBuffers *get_double_buffers() { return _double_buffers; } inline int nbor_pack_width() const { return _nbor_pack_width; } inline void nbor_pack_width(const int w) { _nbor_pack_width = w; } inline int three_body_neighbor() { return _three_body_neighbor; } inline void three_body_neighbor(const int i) { _three_body_neighbor = i; } - inline int need_zero(const int tid) { - if (_need_reduce == 0 && tid > 0) return 1; - else if (_zero_master && tid == 0) { _zero_master = 0; return 1; } - else return 0; + inline int need_zero(const int tid) + { + if (_need_reduce == 0 && tid > 0) + return 1; + else if (_zero_master && tid == 0) { + _zero_master = 0; + return 1; + } else + return 0; } - inline void set_reduce_flag() { if (_nthreads > 1) _need_reduce = 1; } - inline int lrt() { + inline void set_reduce_flag() + { + if (_nthreads > 1) _need_reduce = 1; + } + inline int lrt() + { if (force->kspace_match("^pppm/.*intel$", 0) && update->whichflag == 1) return _lrt; - else return 0; + else + return 0; } - inline int pppm_table() { + inline int pppm_table() + { if (force->kspace_match("^pppm/.*intel$", 0)) return INTEL_P3M_TABLE; - else return 0; + else + return 0; } - protected: - IntelBuffers *_single_buffers; - IntelBuffers *_mixed_buffers; - IntelBuffers *_double_buffers; + IntelBuffers *_single_buffers; + IntelBuffers *_mixed_buffers; + IntelBuffers *_double_buffers; int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor; int _pair_intel_count, _pair_hybrid_flag, _print_pkg_info; @@ -109,24 +118,20 @@ class FixIntel : public Fix { int _pair_hybrid_zero, _hybrid_nonpair, _zero_master; public: - inline int* get_overflow_flag() { return _overflow_flag; } - inline int* get_off_overflow_flag() { return _off_overflow_flag; } - inline void add_result_array(IntelBuffers::vec3_acc_t *f_in, - double *ev_in, const int offload, - const int eatom = 0, const int vatom = 0, + inline int *get_overflow_flag() { return _overflow_flag; } + inline int *get_off_overflow_flag() { return _off_overflow_flag; } + inline void add_result_array(IntelBuffers::vec3_acc_t *f_in, double *ev_in, + const int offload, const int eatom = 0, const int vatom = 0, const int rflag = 0); - inline void add_result_array(IntelBuffers::vec3_acc_t *f_in, - double *ev_in, const int offload, - const int eatom = 0, const int vatom = 0, + inline void add_result_array(IntelBuffers::vec3_acc_t *f_in, double *ev_in, + const int offload, const int eatom = 0, const int vatom = 0, const int rflag = 0); - inline void add_result_array(IntelBuffers::vec3_acc_t *f_in, - float *ev_in, const int offload, - const int eatom = 0, const int vatom = 0, + inline void add_result_array(IntelBuffers::vec3_acc_t *f_in, float *ev_in, + const int offload, const int eatom = 0, const int vatom = 0, const int rflag = 0); - inline void get_buffern(const int offload, int &nlocal, int &nall, - int &minlocal); + inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD void post_force(int vflag); inline int coprocessor_number() { return _cop; } inline int full_host_list() { return _full_host_list; } @@ -135,9 +140,19 @@ class FixIntel : public Fix { inline int offload_end_neighbor(); inline int offload_end_pair(); inline int host_start_neighbor() - { if (_offload_noghost) return 0; else return offload_end_neighbor(); } + { + if (_offload_noghost) + return 0; + else + return offload_end_neighbor(); + } inline int host_start_pair() - { if (_offload_noghost) return 0; else return offload_end_pair(); } + { + if (_offload_noghost) + return 0; + else + return offload_end_pair(); + } inline int offload_nlocal() { return _offload_nlocal; } inline int offload_nall() { return _offload_nall; } inline int offload_min_ghost() { return _offload_min_ghost; } @@ -149,18 +164,19 @@ class FixIntel : public Fix { inline int separate_buffers() { return _separate_buffers; } inline int offload_noghost() { return _offload_noghost; } inline void set_offload_noghost(const int v) - { if (_offload_ghost < 0) _offload_noghost = v; } + { + if (_offload_ghost < 0) _offload_noghost = v; + } inline void set_neighbor_host_sizes(); - inline void zero_timers() - { memset(_timers, 0, sizeof(double) * NUM_ITIMERS); } + inline void zero_timers() { memset(_timers, 0, sizeof(double) * NUM_ITIMERS); } inline void start_watch(const int which) { _stopwatch[which] = MPI_Wtime(); } inline double stop_watch(const int which); - inline double * off_watch_pair() { return _stopwatch_offload_pair; } - inline double * off_watch_neighbor() { return _stopwatch_offload_neighbor; } + inline double *off_watch_pair() { return _stopwatch_offload_pair; } + inline double *off_watch_neighbor() { return _stopwatch_offload_neighbor; } inline void balance_stamp(); inline void acc_timers(); - #else +#else inline int offload_end_neighbor() { return 0; } inline int offload_end_pair() { return 0; } inline int host_start_neighbor() { return 0; } @@ -168,27 +184,27 @@ class FixIntel : public Fix { inline void zero_timers() {} inline void start_watch(const int /*which*/) {} inline double stop_watch(const int /*which*/) { return 0.0; } - double * off_watch_pair() { return nullptr; } - double * off_watch_neighbor() { return nullptr; } + double *off_watch_pair() { return nullptr; } + double *off_watch_neighbor() { return nullptr; } inline void balance_stamp() {} inline void acc_timers() {} inline int separate_buffers() { return 0; } - #endif +#endif protected: int _overflow_flag[5]; - _alignvar(int _off_overflow_flag[5],64); + _alignvar(int _off_overflow_flag[5], 64); int _allow_separate_buffers, _offload_ghost, _lrt; - IntelBuffers::vec3_acc_t *_force_array_s; - IntelBuffers::vec3_acc_t *_force_array_m; - IntelBuffers::vec3_acc_t *_force_array_d; + IntelBuffers::vec3_acc_t *_force_array_s; + IntelBuffers::vec3_acc_t *_force_array_m; + IntelBuffers::vec3_acc_t *_force_array_d; float *_ev_array_s; double *_ev_array_d; int _results_eatom, _results_vatom; int _need_reduce; - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD double _balance_pair_time, _balance_other_time; int _offload_nlocal, _offload_nall, _offload_min_ghost, _offload_nghost; int _host_min_local, _host_min_ghost, _host_nall; @@ -198,9 +214,9 @@ class FixIntel : public Fix { void output_timing_data(); FILE *_tscreen; - IntelBuffers::vec3_acc_t *_off_force_array_s; - IntelBuffers::vec3_acc_t *_off_force_array_m; - IntelBuffers::vec3_acc_t *_off_force_array_d; + IntelBuffers::vec3_acc_t *_off_force_array_s; + IntelBuffers::vec3_acc_t *_off_force_array_m; + IntelBuffers::vec3_acc_t *_off_force_array_d; float *_off_ev_array_s; double *_off_ev_array_d; int _off_results_eatom, _off_results_vatom; @@ -208,48 +224,42 @@ class FixIntel : public Fix { int get_ppn(int &); int set_host_affinity(const int); - #endif +#endif void check_neighbor_intel(); double _offload_balance, _balance_neighbor, _balance_pair, _balance_fixed; double _timers[NUM_ITIMERS]; double _stopwatch[NUM_ITIMERS]; - _alignvar(double _stopwatch_offload_neighbor[1],64); - _alignvar(double _stopwatch_offload_pair[1],64); + _alignvar(double _stopwatch_offload_neighbor[1], 64); + _alignvar(double _stopwatch_offload_pair[1], 64); void _sync_main_arrays(const int prereverse); - template - void reduce_results(ft * _noalias const f_in); + template void reduce_results(ft *_noalias const f_in); template - inline void add_results(const ft * _noalias const f_in, - const acc_t * _noalias const ev_global, - const int eatom, const int vatom, - const int offload); + inline void add_results(const ft *_noalias const f_in, const acc_t *_noalias const ev_global, + const int eatom, const int vatom, const int offload); template - inline void add_oresults(const ft * _noalias const f_in, - const acc_t * _noalias const ev_global, - const int eatom, const int vatom, - const int out_offset, const int nall); + inline void add_oresults(const ft *_noalias const f_in, const acc_t *_noalias const ev_global, + const int eatom, const int vatom, const int out_offset, const int nall); int _offload_affinity_balanced, _offload_threads, _offload_tpc; - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _max_offload_threads, _offload_cores, _offload_affinity_set; int _im_real_space_task; MPI_Comm _real_space_comm; template - inline void add_off_results(const ft * _noalias const f_in, - const acc_t * _noalias const ev_global); - #endif + inline void add_off_results(const ft *_noalias const f_in, const acc_t *_noalias const ev_global); +#endif }; /* ---------------------------------------------------------------------- */ -void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, - int &minlocal) { - #ifdef _LMP_INTEL_OFFLOAD +void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, int &minlocal) +{ +#ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) { if (offload) { if (neighbor->ago != 0) { @@ -273,7 +283,7 @@ void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, if (_offload_noghost && offload) nall = atom->nlocal; else - #endif +#endif nall = atom->nlocal + atom->nghost; nlocal = atom->nlocal; minlocal = 0; @@ -281,102 +291,97 @@ void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, /* ---------------------------------------------------------------------- */ -void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, - double *ev_in, const int offload, - const int eatom, const int vatom, - const int rflag) { - #ifdef _LMP_INTEL_OFFLOAD +void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, double *ev_in, + const int offload, const int eatom, const int vatom, + const int rflag) +{ +#ifdef _LMP_INTEL_OFFLOAD if (offload) { _off_results_eatom = eatom; _off_results_vatom = vatom; _off_force_array_d = f_in; _off_ev_array_d = ev_in; - if (_pair_hybrid_flag && force->pair->fdotr_is_set()) - _sync_main_arrays(1); + if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1); return; } - #endif +#endif _force_array_d = f_in; _ev_array_d = ev_in; _results_eatom = eatom; _results_vatom = vatom; - #ifndef _LMP_INTEL_OFFLOAD +#ifndef _LMP_INTEL_OFFLOAD if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1; - #endif +#endif if (_overflow_flag[LMP_OVERFLOW]) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); - if (_pair_hybrid_flag > 1 || - (_pair_hybrid_flag && force->pair->fdotr_is_set())) _sync_main_arrays(0); -} - -/* ---------------------------------------------------------------------- */ - -void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, - double *ev_in, const int offload, - const int eatom, const int vatom, - const int rflag) { - #ifdef _LMP_INTEL_OFFLOAD - if (offload) { - _off_results_eatom = eatom; - _off_results_vatom = vatom; - _off_force_array_m = f_in; - _off_ev_array_d = ev_in; - if (_pair_hybrid_flag && force->pair->fdotr_is_set()) - _sync_main_arrays(1); - return; - } - #endif - - _force_array_m = f_in; - _ev_array_d = ev_in; - _results_eatom = eatom; - _results_vatom = vatom; - #ifndef _LMP_INTEL_OFFLOAD - if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1; - #endif - - if (_overflow_flag[LMP_OVERFLOW]) - error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); - - if (_pair_hybrid_flag > 1 || - (_pair_hybrid_flag && force->pair->fdotr_is_set())) + if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set())) _sync_main_arrays(0); } /* ---------------------------------------------------------------------- */ -void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, - float *ev_in, const int offload, - const int eatom, const int vatom, - const int rflag) { - #ifdef _LMP_INTEL_OFFLOAD +void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, double *ev_in, + const int offload, const int eatom, const int vatom, + const int rflag) +{ +#ifdef _LMP_INTEL_OFFLOAD + if (offload) { + _off_results_eatom = eatom; + _off_results_vatom = vatom; + _off_force_array_m = f_in; + _off_ev_array_d = ev_in; + if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1); + return; + } +#endif + + _force_array_m = f_in; + _ev_array_d = ev_in; + _results_eatom = eatom; + _results_vatom = vatom; +#ifndef _LMP_INTEL_OFFLOAD + if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1; +#endif + + if (_overflow_flag[LMP_OVERFLOW]) + error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); + + if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set())) + _sync_main_arrays(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, float *ev_in, + const int offload, const int eatom, const int vatom, + const int rflag) +{ +#ifdef _LMP_INTEL_OFFLOAD if (offload) { _off_results_eatom = eatom; _off_results_vatom = vatom; _off_force_array_s = f_in; _off_ev_array_s = ev_in; - if (_pair_hybrid_flag && force->pair->fdotr_is_set()) - _sync_main_arrays(1); + if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1); return; } - #endif +#endif _force_array_s = f_in; _ev_array_s = ev_in; _results_eatom = eatom; _results_vatom = vatom; - #ifndef _LMP_INTEL_OFFLOAD +#ifndef _LMP_INTEL_OFFLOAD if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1; - #endif +#endif if (_overflow_flag[LMP_OVERFLOW]) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); - if (_pair_hybrid_flag > 1 || - (_pair_hybrid_flag && force->pair->fdotr_is_set())) + if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set())) _sync_main_arrays(0); } @@ -386,10 +391,10 @@ void FixIntel::add_result_array(IntelBuffers::vec3_acc_t *f_in, /* ---------------------------------------------------------------------- */ -int FixIntel::offload_end_neighbor() { +int FixIntel::offload_end_neighbor() +{ if (_offload_balance < 0.0) { - if (atom->nlocal < 2) - error->one(FLERR,"Too few atoms for load balancing offload"); + if (atom->nlocal < 2) error->one(FLERR, "Too few atoms for load balancing offload"); double granularity = 1.0 / atom->nlocal; if (_balance_neighbor < granularity) _balance_neighbor = granularity + 1e-10; @@ -399,14 +404,18 @@ int FixIntel::offload_end_neighbor() { return _balance_neighbor * atom->nlocal; } -int FixIntel::offload_end_pair() { - if (neighbor->ago == 0) return _balance_neighbor * atom->nlocal; - else return _balance_pair * atom->nlocal; +int FixIntel::offload_end_pair() +{ + if (neighbor->ago == 0) + return _balance_neighbor * atom->nlocal; + else + return _balance_pair * atom->nlocal; } /* ---------------------------------------------------------------------- */ -double FixIntel::stop_watch(const int which) { +double FixIntel::stop_watch(const int which) +{ double elapsed = MPI_Wtime() - _stopwatch[which]; _timers[which] += elapsed; return elapsed; @@ -414,7 +423,8 @@ double FixIntel::stop_watch(const int which) { /* ---------------------------------------------------------------------- */ -void FixIntel::balance_stamp() { +void FixIntel::balance_stamp() +{ if (_offload_balance < 0.0) { double ct = MPI_Wtime(); _balance_other_time = ct; @@ -424,7 +434,8 @@ void FixIntel::balance_stamp() { /* ---------------------------------------------------------------------- */ -void FixIntel::acc_timers() { +void FixIntel::acc_timers() +{ _timers[TIME_OFFLOAD_PAIR] += *_stopwatch_offload_pair; if (neighbor->ago == 0) { _timers[TIME_OFFLOAD_NEIGHBOR] += *_stopwatch_offload_neighbor; @@ -437,7 +448,8 @@ void FixIntel::acc_timers() { /* ---------------------------------------------------------------------- */ -void FixIntel::set_neighbor_host_sizes() { +void FixIntel::set_neighbor_host_sizes() +{ _host_min_local = _overflow_flag[LMP_LOCAL_MIN]; _host_min_ghost = _overflow_flag[LMP_GHOST_MIN]; _host_used_local = atom->nlocal - _host_min_local; @@ -450,7 +462,7 @@ void FixIntel::set_neighbor_host_sizes() { #endif -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/fix_npt_intel.h b/src/INTEL/fix_npt_intel.h index 5bf0c6dbe6..17d3793a9b 100644 --- a/src/INTEL/fix_npt_intel.h +++ b/src/INTEL/fix_npt_intel.h @@ -35,7 +35,7 @@ class FixNPTIntel : public FixNHIntel { ~FixNPTIntel() {} }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/fix_nve_asphere_intel.h b/src/INTEL/fix_nve_asphere_intel.h index 39d87a2a73..2b09f99548 100644 --- a/src/INTEL/fix_nve_asphere_intel.h +++ b/src/INTEL/fix_nve_asphere_intel.h @@ -46,7 +46,7 @@ class FixNVEAsphereIntel : public FixNVE { class AtomVecEllipsoid *avec; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/fix_nve_intel.h b/src/INTEL/fix_nve_intel.h index 17ead378a9..b37b5eaf65 100644 --- a/src/INTEL/fix_nve_intel.h +++ b/src/INTEL/fix_nve_intel.h @@ -44,7 +44,7 @@ class FixNVEIntel : public FixNVE { int _nlocal3, _nlocal_max; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/fix_nvt_intel.h b/src/INTEL/fix_nvt_intel.h index 28cd3a4ebc..93834c189e 100644 --- a/src/INTEL/fix_nvt_intel.h +++ b/src/INTEL/fix_nvt_intel.h @@ -35,7 +35,7 @@ class FixNVTIntel : public FixNHIntel { ~FixNVTIntel() {} }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/fix_nvt_sllod_intel.h b/src/INTEL/fix_nvt_sllod_intel.h index a08893f85e..12f116dcba 100644 --- a/src/INTEL/fix_nvt_sllod_intel.h +++ b/src/INTEL/fix_nvt_sllod_intel.h @@ -41,7 +41,7 @@ class FixNVTSllodIntel : public FixNHIntel { void nh_v_temp(); }; -} +} // namespace LAMMPS_NS #endif #endif @@ -70,4 +70,3 @@ E: Using fix nvt/sllod with no fix deform defined Self-explanatory. */ - diff --git a/src/INTEL/improper_cvff_intel.h b/src/INTEL/improper_cvff_intel.h index 2c740ba90b..6ea95d0ff4 100644 --- a/src/INTEL/improper_cvff_intel.h +++ b/src/INTEL/improper_cvff_intel.h @@ -25,8 +25,8 @@ ImproperStyle(cvff/intel,ImproperCvffIntel); #ifndef LMP_IMPROPER_CVFF_INTEL_H #define LMP_IMPROPER_CVFF_INTEL_H -#include "improper_cvff.h" #include "fix_intel.h" +#include "improper_cvff.h" namespace LAMMPS_NS { @@ -42,27 +42,27 @@ class ImproperCvffIntel : public ImproperCvff { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k; int sign, multiplicity; } fc_packed1; + typedef struct { + flt_t k; + int sign, multiplicity; + } fc_packed1; fc_packed1 *fc; - ForceConst() : _nimpropertypes(0) {} + ForceConst() : _nimpropertypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); @@ -75,7 +75,7 @@ class ImproperCvffIntel : public ImproperCvff { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/improper_harmonic_intel.h b/src/INTEL/improper_harmonic_intel.h index 14ca7b12d6..3b9c5d2ec9 100644 --- a/src/INTEL/improper_harmonic_intel.h +++ b/src/INTEL/improper_harmonic_intel.h @@ -25,8 +25,8 @@ ImproperStyle(harmonic/intel,ImproperHarmonicIntel); #ifndef LMP_IMPROPER_HARMONIC_INTEL_H #define LMP_IMPROPER_HARMONIC_INTEL_H -#include "improper_harmonic.h" #include "fix_intel.h" +#include "improper_harmonic.h" namespace LAMMPS_NS { @@ -42,27 +42,26 @@ class ImproperHarmonicIntel : public ImproperHarmonic { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int vflag, IntelBuffers * buffers, - const ForceConst &fc); + void eval(const int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t k, chi; } fc_packed1; + typedef struct { + flt_t k, chi; + } fc_packed1; fc_packed1 *fc; - ForceConst() : _nimpropertypes(0) {} + ForceConst() : _nimpropertypes(0) {} ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); @@ -75,7 +74,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/nbin_intel.h b/src/INTEL/nbin_intel.h index 488e1ace6b..dbed37b347 100644 --- a/src/INTEL/nbin_intel.h +++ b/src/INTEL/nbin_intel.h @@ -23,9 +23,9 @@ NBinStyle(intel, #ifndef LMP_NBIN_INTEL_H #define LMP_NBIN_INTEL_H -#include "nbin_standard.h" #include "fix_intel.h" #include "memory.h" +#include "nbin_standard.h" namespace LAMMPS_NS { @@ -35,7 +35,7 @@ class NBinIntel : public NBinStandard { ~NBinIntel(); void bin_atoms_setup(int); void bin_atoms(); - int * get_binpacked() { return _binpacked; } + int *get_binpacked() { return _binpacked; } private: FixIntel *_fix; @@ -43,15 +43,14 @@ class NBinIntel : public NBinStandard { int _precision_mode; double memory_usage(); - template - void bin_atoms(IntelBuffers *); + template void bin_atoms(IntelBuffers *); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _cop, _offload_alloc; - #endif +#endif }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/npair_full_bin_ghost_intel.h b/src/INTEL/npair_full_bin_ghost_intel.h index b4a1176d17..3830b07e6d 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.h +++ b/src/INTEL/npair_full_bin_ghost_intel.h @@ -37,16 +37,16 @@ class NPairFullBinGhostIntel : public NPairIntel { NPairFullBinGhostIntel(class LAMMPS *); ~NPairFullBinGhostIntel() {} void build(class NeighList *); + private: - template - void fbi(NeighList * list, IntelBuffers * buffers); - template - void fbi(const int offload, NeighList * list, - IntelBuffers * buffers, + template + void fbi(NeighList *list, IntelBuffers *buffers); + template + void fbi(const int offload, NeighList *list, IntelBuffers *buffers, const int astart, const int aend); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/npair_full_bin_intel.h b/src/INTEL/npair_full_bin_intel.h index f77557d840..720780898c 100644 --- a/src/INTEL/npair_full_bin_intel.h +++ b/src/INTEL/npair_full_bin_intel.h @@ -24,8 +24,8 @@ NPairStyle(full/bin/intel, #ifndef LMP_NPAIR_FULL_BIN_INTEL_H #define LMP_NPAIR_FULL_BIN_INTEL_H -#include "npair_intel.h" #include "fix_intel.h" +#include "npair_intel.h" namespace LAMMPS_NS { @@ -36,11 +36,10 @@ class NPairFullBinIntel : public NPairIntel { void build(class NeighList *); private: - template - void fbi(NeighList *, IntelBuffers *); + template void fbi(NeighList *, IntelBuffers *); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/npair_half_bin_newton_intel.h b/src/INTEL/npair_half_bin_newton_intel.h index 18a6f0c103..9c9dcab703 100644 --- a/src/INTEL/npair_half_bin_newton_intel.h +++ b/src/INTEL/npair_half_bin_newton_intel.h @@ -23,8 +23,8 @@ NPairStyle(half/bin/newton/intel, #ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H #define LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H -#include "npair_intel.h" #include "fix_intel.h" +#include "npair_intel.h" namespace LAMMPS_NS { @@ -35,11 +35,10 @@ class NPairHalfBinNewtonIntel : public NPairIntel { void build(class NeighList *); private: - template - void hbni(NeighList *, IntelBuffers *); + template void hbni(NeighList *, IntelBuffers *); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/npair_half_bin_newton_tri_intel.h b/src/INTEL/npair_half_bin_newton_tri_intel.h index 4603913e49..0d6f577b3d 100644 --- a/src/INTEL/npair_half_bin_newton_tri_intel.h +++ b/src/INTEL/npair_half_bin_newton_tri_intel.h @@ -23,8 +23,8 @@ NPairStyle(half/bin/newton/tri/intel, #ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_TRI_H #define LMP_NPAIR_HALF_BIN_NEWTON_INTEL_TRI_H -#include "npair_intel.h" #include "fix_intel.h" +#include "npair_intel.h" namespace LAMMPS_NS { @@ -35,11 +35,10 @@ class NPairHalfBinNewtonTriIntel : public NPairIntel { void build(class NeighList *); private: - template - void hbnti(NeighList *, IntelBuffers *); + template void hbnti(NeighList *, IntelBuffers *); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/npair_halffull_newton_intel.h b/src/INTEL/npair_halffull_newton_intel.h index 614d975926..ea751c2421 100644 --- a/src/INTEL/npair_halffull_newton_intel.h +++ b/src/INTEL/npair_halffull_newton_intel.h @@ -33,14 +33,13 @@ NPairStyle(halffull/newton/skip/intel, #ifndef LMP_NPAIR_HALFFULL_NEWTON_INTEL_H #define LMP_NPAIR_HALFFULL_NEWTON_INTEL_H -#include "npair.h" #include "fix_intel.h" +#include "npair.h" #if defined(_OPENMP) #include #endif - namespace LAMMPS_NS { class NPairHalffullNewtonIntel : public NPair { @@ -52,14 +51,12 @@ class NPairHalffullNewtonIntel : public NPair { protected: FixIntel *_fix; - template - void build_t(NeighList *, IntelBuffers *); + template void build_t(NeighList *, IntelBuffers *); - template - void build_t3(NeighList *, int *); + template void build_t3(NeighList *, int *); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/npair_skip_intel.h b/src/INTEL/npair_skip_intel.h index e431a23e69..2c77b24cd5 100644 --- a/src/INTEL/npair_skip_intel.h +++ b/src/INTEL/npair_skip_intel.h @@ -31,14 +31,13 @@ NPairStyle(skip/ghost/intel, #ifndef LMP_NPAIR_SKIP_INTEL_H #define LMP_NPAIR_SKIP_INTEL_H -#include "npair.h" #include "fix_intel.h" +#include "npair.h" #if defined(_OPENMP) #include #endif - namespace LAMMPS_NS { class NPairSkipIntel : public NPair { @@ -52,11 +51,11 @@ class NPairSkipIntel : public NPair { FixIntel *_fix; int *_inum_starts, *_inum_counts, *_full_props; - template + template void build_t(NeighList *, int *numhalf, int *cnumneigh, int *numhalf_skip); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_airebo_intel.h b/src/INTEL/pair_airebo_intel.h index 47093f1c29..32ae3a6581 100644 --- a/src/INTEL/pair_airebo_intel.h +++ b/src/INTEL/pair_airebo_intel.h @@ -25,14 +25,13 @@ PairStyle(airebo/intel,PairAIREBOIntel); #ifndef LMP_PAIR_AIREBO_INTEL_H #define LMP_PAIR_AIREBO_INTEL_H -#include "pair.h" #include "fix_intel.h" +#include "pair.h" #include "pair_airebo.h" namespace LAMMPS_NS { -template -struct PairAIREBOIntelParam; +template struct PairAIREBOIntelParam; class PairAIREBOIntel : public PairAIREBO { public: @@ -40,32 +39,28 @@ class PairAIREBOIntel : public PairAIREBO { virtual ~PairAIREBOIntel(); virtual void compute(int, int); virtual void init_style(); - protected: + protected: template - void compute(int eflag, int vflag, IntelBuffers *buffers); + void compute(int eflag, int vflag, IntelBuffers *buffers); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const int astart, const int aend); - template - void pack_force_const(IntelBuffers * buffers); + template void pack_force_const(IntelBuffers *buffers); - template - PairAIREBOIntelParam get_param(); + template PairAIREBOIntelParam get_param(); - FixIntel * fix; + FixIntel *fix; int _cop; - int * REBO_cnumneigh; - int * REBO_num_skin; - int * REBO_list_data; - + int *REBO_cnumneigh; + int *REBO_num_skin; + int *REBO_list_data; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_airebo_morse_intel.h b/src/INTEL/pair_airebo_morse_intel.h index fb8e3dcf14..75d5808e85 100644 --- a/src/INTEL/pair_airebo_morse_intel.h +++ b/src/INTEL/pair_airebo_morse_intel.h @@ -35,7 +35,7 @@ class PairAIREBOMorseIntel : public PairAIREBOIntel { virtual void settings(int, char **); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_buck_coul_cut_intel.h b/src/INTEL/pair_buck_coul_cut_intel.h index 793446f05e..9fe35affe4 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.h +++ b/src/INTEL/pair_buck_coul_cut_intel.h @@ -26,8 +26,8 @@ PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel); #ifndef LMP_PAIR_BUCK_COUL_CUT_INTEL_H #define LMP_PAIR_BUCK_COUL_CUT_INTEL_H -#include "pair_buck_coul_cut.h" #include "fix_intel.h" +#include "pair_buck_coul_cut.h" namespace LAMMPS_NS { @@ -38,7 +38,10 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { virtual ~PairBuckCoulCutIntel(); virtual void compute(int, int); void init_style(); - typedef struct { float x, y, z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; private: FixIntel *fix; @@ -47,36 +50,38 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers * buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t buck1, buck2, rhoinv, pad; } c_force_t; - typedef struct { flt_t cutsq, cut_ljsq, cut_coulsq, pad; } c_cut_t; - typedef struct { flt_t a, c, offset, pad; } c_energy_t; - _alignvar(flt_t special_coul[4],64); - _alignvar(flt_t special_lj[4],64); + typedef struct { + flt_t buck1, buck2, rhoinv, pad; + } c_force_t; + typedef struct { + flt_t cutsq, cut_ljsq, cut_coulsq, pad; + } c_cut_t; + typedef struct { + flt_t a, c, offset, pad; + } c_energy_t; + _alignvar(flt_t special_coul[4], 64); + _alignvar(flt_t special_lj[4], 64); c_force_t **c_force; c_energy_t **c_energy; c_cut_t **c_cut; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int ntable, Memory *memory, - const int cop); + void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); private: int _ntypes, _ntable, _cop; @@ -86,7 +91,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS -#endif // LMP_PAIR_BUCK_COUL_CUT_INTEL_H +#endif // LMP_PAIR_BUCK_COUL_CUT_INTEL_H #endif diff --git a/src/INTEL/pair_buck_coul_long_intel.h b/src/INTEL/pair_buck_coul_long_intel.h index c9fc6d8f0f..01865afc56 100644 --- a/src/INTEL/pair_buck_coul_long_intel.h +++ b/src/INTEL/pair_buck_coul_long_intel.h @@ -25,8 +25,8 @@ PairStyle(buck/coul/long/intel,PairBuckCoulLongIntel); #ifndef LMP_PAIR_BUCK_COUL_LONG_INTEL_H #define LMP_PAIR_BUCK_COUL_LONG_INTEL_H -#include "pair_buck_coul_long.h" #include "fix_intel.h" +#include "pair_buck_coul_long.h" namespace LAMMPS_NS { @@ -37,7 +37,10 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { virtual ~PairBuckCoulLongIntel(); virtual void compute(int, int); void init_style(); - typedef struct { float x, y, z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; private: FixIntel *fix; @@ -46,26 +49,29 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers * buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t cutsq, cut_ljsq, buck1, buck2; } c_force_t; - typedef struct { flt_t a, c, offset, pad; } c_energy_t; - typedef struct { flt_t r, dr, f, df; } table_t; - _alignvar(flt_t special_coul[4],64); - _alignvar(flt_t special_lj[4],64); + typedef struct { + flt_t cutsq, cut_ljsq, buck1, buck2; + } c_force_t; + typedef struct { + flt_t a, c, offset, pad; + } c_energy_t; + typedef struct { + flt_t r, dr, f, df; + } table_t; + _alignvar(flt_t special_coul[4], 64); + _alignvar(flt_t special_lj[4], 64); flt_t g_ewald, tabinnersq; c_force_t **c_force; c_energy_t **c_energy; @@ -74,10 +80,9 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int ntable, Memory *memory, - const int cop); + void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); private: int _ntypes, _ntable, _cop; @@ -87,7 +92,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS -#endif // LMP_PAIR_BUCK_COUL_LONG_INTEL_H +#endif // LMP_PAIR_BUCK_COUL_LONG_INTEL_H #endif diff --git a/src/INTEL/pair_buck_intel.h b/src/INTEL/pair_buck_intel.h index 38615a86ec..307c8eb7b0 100644 --- a/src/INTEL/pair_buck_intel.h +++ b/src/INTEL/pair_buck_intel.h @@ -25,57 +25,60 @@ PairStyle(buck/intel,PairBuckIntel); #ifndef LMP_PAIR_BUCK_INTEL_H #define LMP_PAIR_BUCK_INTEL_H -#include "pair_buck.h" #include "fix_intel.h" +#include "pair_buck.h" namespace LAMMPS_NS { class PairBuckIntel : public PairBuck { -public: + public: PairBuckIntel(class LAMMPS *); virtual ~PairBuckIntel(); virtual void compute(int, int); void init_style(); - typedef struct { float x, y, z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; -private: + private: FixIntel *fix; int _cop; template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers * buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - template - class ForceConst { + template class ForceConst { - public: - typedef struct { flt_t buck1, buck2, rhoinv, cutsq; } c_force_t; - typedef struct { flt_t a, c, offset, pad; } c_energy_t; - _alignvar(flt_t special_lj[4],64); + public: + typedef struct { + flt_t buck1, buck2, rhoinv, cutsq; + } c_force_t; + typedef struct { + flt_t a, c, offset, pad; + } c_energy_t; + _alignvar(flt_t special_lj[4], 64); c_force_t **c_force; c_energy_t **c_energy; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } - void set_ntypes(const int ntypes, Memory *memory, - const int cop); + void set_ntypes(const int ntypes, Memory *memory, const int cop); - private: + private: int _ntypes, _cop; Memory *_memory; }; @@ -84,7 +87,7 @@ private: ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS -#endif // LMP_PAIR_BUCK_INTEL_H +#endif // LMP_PAIR_BUCK_INTEL_H #endif diff --git a/src/INTEL/pair_dpd_intel.h b/src/INTEL/pair_dpd_intel.h index 2553638947..3e5c9b7d69 100644 --- a/src/INTEL/pair_dpd_intel.h +++ b/src/INTEL/pair_dpd_intel.h @@ -26,8 +26,8 @@ PairStyle(dpd/intel,PairDPDIntel); #ifndef LMP_PAIR_DPD_INTEL_H #define LMP_PAIR_DPD_INTEL_H -#include "pair_dpd.h" #include "fix_intel.h" +#include "pair_dpd.h" #ifdef LMP_USE_MKL_RNG #include "mkl_vsl.h" @@ -52,42 +52,41 @@ class PairDPDIntel : public PairDPD { FixIntel *fix; int _cop, _onetype, _nrandom_thread; - #ifdef LMP_USE_MKL_RNG +#ifdef LMP_USE_MKL_RNG VSLStreamStatePtr *random_thread; - #else +#else RanMars **random_thread; - #endif +#endif template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); // ---------------------------------------------------------------------- - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t icut, a0, gamma, sigma; } fc_packed1; + typedef struct { + flt_t icut, a0, gamma, sigma; + } fc_packed1; - _alignvar(flt_t special_lj[4],64); + _alignvar(flt_t special_lj[4], 64); fc_packed1 **param; flt_t **rand_buffer_thread; int *rngi; - ForceConst() : _ntypes(0) {} + ForceConst() : _ntypes(0) {} ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, - Memory *memory, const int cop); + void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, Memory *memory, + const int cop); private: int _ntypes, _cop; @@ -97,7 +96,7 @@ class PairDPDIntel : public PairDPD { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_eam_alloy_intel.h b/src/INTEL/pair_eam_alloy_intel.h index d1805da2c5..07f7df11ca 100644 --- a/src/INTEL/pair_eam_alloy_intel.h +++ b/src/INTEL/pair_eam_alloy_intel.h @@ -38,7 +38,7 @@ class PairEAMAlloyIntel : virtual public PairEAMIntel { void file2array(); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_eam_fs_intel.h b/src/INTEL/pair_eam_fs_intel.h index 619d6b46e6..103e3a9c4b 100644 --- a/src/INTEL/pair_eam_fs_intel.h +++ b/src/INTEL/pair_eam_fs_intel.h @@ -38,7 +38,7 @@ class PairEAMFSIntel : virtual public PairEAMIntel { void file2array(); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_eam_intel.h b/src/INTEL/pair_eam_intel.h index 9817625f07..6ea6a6b06c 100644 --- a/src/INTEL/pair_eam_intel.h +++ b/src/INTEL/pair_eam_intel.h @@ -21,15 +21,14 @@ PairStyle(eam/intel,PairEAMIntel); #ifndef LMP_PAIR_EAM_INTEL_H #define LMP_PAIR_EAM_INTEL_H -#include "pair_eam.h" #include "fix_intel.h" +#include "pair_eam.h" namespace LAMMPS_NS { - class PairEAMIntel : public PairEAM { public: - friend class FixSemiGrandCanonicalMC; // Alex Stukowski option + friend class FixSemiGrandCanonicalMC; // Alex Stukowski option PairEAMIntel(class LAMMPS *); virtual ~PairEAMIntel(); @@ -39,53 +38,49 @@ class PairEAMIntel : public PairEAM { void unpack_forward_comm(int, int, double *); protected: - FixIntel *fix; int _cop, _onetype, _ccache_stride; float *fp_float; - template - int pack_forward_comm(int, int *, double *, flt_t *); - template - void unpack_forward_comm(int, int, double *, flt_t *); + template int pack_forward_comm(int, int *, double *, flt_t *); + template void unpack_forward_comm(int, int, double *, flt_t *); template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); - template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + template + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); // ---------------------------------------------------------------------- - template - class ForceConst { - public: - typedef struct { flt_t a, b, c, d; } fc_packed1; - typedef struct { flt_t a, b, c, d, e, f, g, h; } fc_packed2; + template class ForceConst { + public: + typedef struct { + flt_t a, b, c, d; + } fc_packed1; + typedef struct { + flt_t a, b, c, d, e, f, g, h; + } fc_packed2; flt_t **scale_f; fc_packed1 *rhor_spline_f, *rhor_spline_e; fc_packed1 *frho_spline_f, *frho_spline_e; fc_packed2 *z2r_spline_t; - ForceConst() : _ntypes(0), _nr(0) {} + ForceConst() : _ntypes(0), _nr(0) {} ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int nr, const int nrho, - Memory *memory, const int cop); + void set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop); inline int rhor_jstride() const { return _nr; } inline int rhor_istride() const { return _nr * _ntypes; } inline int frho_stride() const { return _nrho; } - private: + private: int _ntypes, _nr, _nrho, _cop; Memory *_memory; }; @@ -93,7 +88,7 @@ class PairEAMIntel : public PairEAM { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_gayberne_intel.h b/src/INTEL/pair_gayberne_intel.h index b726055c6b..67132770bf 100644 --- a/src/INTEL/pair_gayberne_intel.h +++ b/src/INTEL/pair_gayberne_intel.h @@ -25,8 +25,8 @@ PairStyle(gayberne/intel,PairGayBerneIntel); #ifndef LMP_PAIR_GAYBERNE_INTEL_H #define LMP_PAIR_GAYBERNE_INTEL_H -#include "pair_gayberne.h" #include "fix_intel.h" +#include "pair_gayberne.h" namespace LAMMPS_NS { @@ -42,31 +42,32 @@ class PairGayBerneIntel : public PairGayBerne { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); - template - class ForceConst { + template class ForceConst { public: typedef struct { flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape; int form; } fc_packed1; - typedef struct { flt_t lj3, lj4; } fc_packed2; - typedef struct { flt_t shape2[4], well[4]; } fc_packed3; + typedef struct { + flt_t lj3, lj4; + } fc_packed2; + typedef struct { + flt_t shape2[4], well[4]; + } fc_packed3; - _alignvar(flt_t special_lj[4],64); - _alignvar(flt_t gamma,64); - _alignvar(flt_t upsilon,64); - _alignvar(flt_t mu,64); + _alignvar(flt_t special_lj[4], 64); + _alignvar(flt_t gamma, 64); + _alignvar(flt_t upsilon, 64); + _alignvar(flt_t mu, 64); fc_packed1 **ijc; fc_packed2 **lj34; fc_packed3 *ic; @@ -74,11 +75,11 @@ class PairGayBerneIntel : public PairGayBerne { flt_t **rsq_form, **delx_form, **dely_form, **delz_form; int **jtype_form, **jlist_form; - ForceConst() : _ntypes(0) {} + ForceConst() : _ntypes(0) {} ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int one_length, - const int nthreads, Memory *memory, const int cop); + void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory, + const int cop); private: int _ntypes, _cop; @@ -89,15 +90,14 @@ class PairGayBerneIntel : public PairGayBerne { ForceConst force_const_double; int _max_nbors; - double gayberne_lj(const int i, const int j, double a1[3][3], - double b1[3][3], double g1[3][3], double *r12, - const double rsq, double *fforce, double *ttor); + double gayberne_lj(const int i, const int j, double a1[3][3], double b1[3][3], double g1[3][3], + double *r12, const double rsq, double *fforce, double *ttor); FixIntel *fix; int _cop; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.h b/src/INTEL/pair_lj_charmm_coul_charmm_intel.h index cf868787e6..69cf1bcf17 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.h +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.h @@ -25,8 +25,8 @@ PairStyle(lj/charmm/coul/charmm/intel,PairLJCharmmCoulCharmmIntel); #ifndef LMP_PAIR_LJ_CHARMM_COUL_CHARMM_INTEL_H #define LMP_PAIR_LJ_CHARMM_COUL_CHARMM_INTEL_H -#include "pair_lj_charmm_coul_charmm.h" #include "fix_intel.h" +#include "pair_lj_charmm_coul_charmm.h" namespace LAMMPS_NS { @@ -39,7 +39,10 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { virtual void compute(int, int); void init_style(); - typedef struct { float x,y,z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; private: FixIntel *fix; @@ -47,30 +50,27 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); // ---------------------------------------------------------------------- - template - class ForceConst { + template class ForceConst { public: - _alignvar(flt_t special_coul[4],64); - _alignvar(flt_t special_lj[4],64); + _alignvar(flt_t special_coul[4], 64); + _alignvar(flt_t special_lj[4], 64); flt_t **cutsq; flt_t cut_coulsq, cut_ljsq; flt_t cut_coul_innersq, cut_lj_innersq; - typename IntelBuffers::vec4_t **lj; + typename IntelBuffers::vec4_t **lj; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); @@ -82,7 +82,7 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.h b/src/INTEL/pair_lj_charmm_coul_long_intel.h index b860fda3e3..95366b6218 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.h +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.h @@ -25,8 +25,8 @@ PairStyle(lj/charmm/coul/long/intel,PairLJCharmmCoulLongIntel); #ifndef LMP_PAIR_LJ_CHARMM_COUL_LONG_INTEL_H #define LMP_PAIR_LJ_CHARMM_COUL_LONG_INTEL_H -#include "pair_lj_charmm_coul_long.h" #include "fix_intel.h" +#include "pair_lj_charmm_coul_long.h" namespace LAMMPS_NS { @@ -39,7 +39,10 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { virtual void compute(int, int); void init_style(); - typedef struct { float x,y,z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; private: FixIntel *fix; @@ -47,36 +50,34 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); // ---------------------------------------------------------------------- - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t r, dr, f, df; } table_t; - _alignvar(flt_t special_coul[4],64); - _alignvar(flt_t special_lj[4],64); + typedef struct { + flt_t r, dr, f, df; + } table_t; + _alignvar(flt_t special_coul[4], 64); + _alignvar(flt_t special_lj[4], 64); flt_t **cutsq, g_ewald, tabinnersq; flt_t cut_coulsq, cut_ljsq; flt_t cut_lj_innersq; table_t *table; flt_t *etable, *detable, *ctable, *dctable; - typename IntelBuffers::vec2_t **lj; + typename IntelBuffers::vec2_t **lj; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int ntable, Memory *memory, - const int cop); + void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); private: int _ntypes, _ntable, _cop; @@ -86,7 +87,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.h b/src/INTEL/pair_lj_cut_coul_long_intel.h index 4be9cbd1f5..c72c9a9ded 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.h +++ b/src/INTEL/pair_lj_cut_coul_long_intel.h @@ -25,8 +25,8 @@ PairStyle(lj/cut/coul/long/intel,PairLJCutCoulLongIntel); #ifndef LMP_PAIR_LJ_CUT_COUL_LONG_INTEL_H #define LMP_PAIR_LJ_CUT_COUL_LONG_INTEL_H -#include "pair_lj_cut_coul_long.h" #include "fix_intel.h" +#include "pair_lj_cut_coul_long.h" namespace LAMMPS_NS { @@ -39,7 +39,10 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { virtual void compute(int, int); void init_style(); - typedef struct { float x,y,z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; private: FixIntel *fix; @@ -47,26 +50,29 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); // ---------------------------------------------------------------------- - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t cutsq, cut_ljsq, lj1, lj2; } c_force_t; - typedef struct { flt_t lj3, lj4, offset, pad; } c_energy_t; - typedef struct { flt_t r, dr, f, df; } table_t; - _alignvar(flt_t special_coul[4],64); - _alignvar(flt_t special_lj[4],64); + typedef struct { + flt_t cutsq, cut_ljsq, lj1, lj2; + } c_force_t; + typedef struct { + flt_t lj3, lj4, offset, pad; + } c_energy_t; + typedef struct { + flt_t r, dr, f, df; + } table_t; + _alignvar(flt_t special_coul[4], 64); + _alignvar(flt_t special_lj[4], 64); flt_t g_ewald, tabinnersq; c_force_t **c_force; c_energy_t **c_energy; @@ -74,10 +80,9 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, 0, nullptr, _cop); } - void set_ntypes(const int ntypes, const int ntable, Memory *memory, - const int cop); + void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); private: int _ntypes, _ntable, _cop; @@ -87,7 +92,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_lj_cut_intel.h b/src/INTEL/pair_lj_cut_intel.h index a5a48148f2..6003a376a0 100644 --- a/src/INTEL/pair_lj_cut_intel.h +++ b/src/INTEL/pair_lj_cut_intel.h @@ -25,8 +25,8 @@ PairStyle(lj/cut/intel,PairLJCutIntel); #ifndef LMP_PAIR_LJ_CUT_INTEL_H #define LMP_PAIR_LJ_CUT_INTEL_H -#include "pair_lj_cut.h" #include "fix_intel.h" +#include "pair_lj_cut.h" namespace LAMMPS_NS { @@ -44,30 +44,31 @@ class PairLJCutIntel : public PairLJCut { template class ForceConst; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); // ---------------------------------------------------------------------- - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t cutsq, lj1, lj2, offset; } fc_packed1; - typedef struct { flt_t lj3, lj4; } fc_packed2; + typedef struct { + flt_t cutsq, lj1, lj2, offset; + } fc_packed1; + typedef struct { + flt_t lj3, lj4; + } fc_packed2; - _alignvar(flt_t special_lj[4],64); + _alignvar(flt_t special_lj[4], 64); fc_packed1 **ljc12o; fc_packed2 **lj34; - ForceConst() : _ntypes(0) {} + ForceConst() : _ntypes(0) {} ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); @@ -80,7 +81,7 @@ class PairLJCutIntel : public PairLJCut { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_lj_long_coul_long_intel.h b/src/INTEL/pair_lj_long_coul_long_intel.h index d1213dda62..6faa2519a3 100644 --- a/src/INTEL/pair_lj_long_coul_long_intel.h +++ b/src/INTEL/pair_lj_long_coul_long_intel.h @@ -25,16 +25,15 @@ PairStyle(lj/long/coul/long/intel,PairLJLongCoulLongIntel); #ifndef LMP_PAIR_LJ_LONG_COUL_LONG_INTEL_H #define LMP_PAIR_LJ_LONG_COUL_LONG_INTEL_H -#include "pair_lj_long_coul_long.h" #include "fix_intel.h" +#include "pair_lj_long_coul_long.h" namespace LAMMPS_NS { - class PairLJLongCoulLongIntel : public PairLJLongCoulLong { - public: - PairLJLongCoulLongIntel(class LAMMPS *); - virtual ~PairLJLongCoulLongIntel(); - - }; -} +class PairLJLongCoulLongIntel : public PairLJLongCoulLong { + public: + PairLJLongCoulLongIntel(class LAMMPS *); + virtual ~PairLJLongCoulLongIntel(); +}; +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_rebo_intel.h b/src/INTEL/pair_rebo_intel.h index 0946e297c4..76b915a1d8 100644 --- a/src/INTEL/pair_rebo_intel.h +++ b/src/INTEL/pair_rebo_intel.h @@ -35,7 +35,7 @@ class PairREBOIntel : public PairAIREBOIntel { virtual void settings(int, char **); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_sw_intel.h b/src/INTEL/pair_sw_intel.h index a60c2b0a0d..55da7eb261 100644 --- a/src/INTEL/pair_sw_intel.h +++ b/src/INTEL/pair_sw_intel.h @@ -25,8 +25,8 @@ PairStyle(sw/intel,PairSWIntel); #ifndef LMP_PAIR_SW_INTEL_H #define LMP_PAIR_SW_INTEL_H -#include "pair_sw.h" #include "fix_intel.h" +#include "pair_sw.h" namespace LAMMPS_NS { @@ -45,26 +45,23 @@ class PairSWIntel : public PairSW { virtual void allocate(); template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, const ForceConst &fc, - const int astart, const int aend); + void eval(const int offload, const int vflag, IntelBuffers *buffers, + const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); int _ccache_stride, _spq, _onetype, _onetype3; - #ifdef LMP_USE_AVXCD +#ifdef LMP_USE_AVXCD int _ccache_stride3; - #endif +#endif // ---------------------------------------------------------------------- - template - class ForceConst { + template class ForceConst { public: typedef struct { flt_t cutsq, cut, sigma_gamma, pad; @@ -88,7 +85,7 @@ class PairSWIntel : public PairSW { fc_packed2 **p2e; fc_packed3 ***p3; - ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {} + ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {} ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); @@ -101,7 +98,7 @@ class PairSWIntel : public PairSW { ForceConst force_const_double; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/pair_tersoff_intel.h b/src/INTEL/pair_tersoff_intel.h index b40ce19787..6748e4aa16 100644 --- a/src/INTEL/pair_tersoff_intel.h +++ b/src/INTEL/pair_tersoff_intel.h @@ -24,8 +24,8 @@ PairStyle(tersoff/intel,PairTersoffIntel); #ifndef LMP_PAIR_TERSOFF_INTEL_H #define LMP_PAIR_TERSOFF_INTEL_H -#include "pair.h" #include "fix_intel.h" +#include "pair.h" #include "pair_tersoff.h" #ifdef __INTEL_COMPILER @@ -39,38 +39,52 @@ class PairTersoffIntel : public PairTersoff { void init_style(); protected: - typedef struct { float x,y,z; int w; } sng4_t; + typedef struct { + float x, y, z; + int w; + } sng4_t; private: FixIntel *fix; int _cop; - public: // wo needs secrets? + public: // wo needs secrets? // ---------------------------------------------------------------------- // - template - class ForceConst { + template class ForceConst { public: - typedef struct { flt_t cutsq; } c_cutoff_t; - typedef struct { flt_t bigr, bigd, lam1, biga; } c_first_loop_t; - typedef struct { flt_t lam2, beta, bigb, powern, c1, c2, c3, c4; } c_second_loop_t; - typedef struct { flt_t lam3, bigr, bigd, c2, d2, h, gamma, powermint; } c_inner_loop_t; - typedef struct { flt_t cutsq, pad[3]; - flt_t bigr, bigd, lam1, biga; - flt_t lam2, beta, bigb, powern; - flt_t c1, c2, c3, c4; } c_outer_t; - typedef struct { flt_t cutsq, pad[7]; - flt_t lam3, powermint, bigr, bigd; - flt_t c2, d2, h, gamma; } c_inner_t; - c_cutoff_t * * c_cutoff_outer; - c_cutoff_t * * * c_cutoff_inner; - c_first_loop_t * * c_first_loop; - c_second_loop_t * * c_second_loop; - c_inner_loop_t * * * c_inner_loop; - c_outer_t * * c_outer; - c_inner_t * * * c_inner; + typedef struct { + flt_t cutsq; + } c_cutoff_t; + typedef struct { + flt_t bigr, bigd, lam1, biga; + } c_first_loop_t; + typedef struct { + flt_t lam2, beta, bigb, powern, c1, c2, c3, c4; + } c_second_loop_t; + typedef struct { + flt_t lam3, bigr, bigd, c2, d2, h, gamma, powermint; + } c_inner_loop_t; + typedef struct { + flt_t cutsq, pad[3]; + flt_t bigr, bigd, lam1, biga; + flt_t lam2, beta, bigb, powern; + flt_t c1, c2, c3, c4; + } c_outer_t; + typedef struct { + flt_t cutsq, pad[7]; + flt_t lam3, powermint, bigr, bigd; + flt_t c2, d2, h, gamma; + } c_inner_t; + c_cutoff_t **c_cutoff_outer; + c_cutoff_t ***c_cutoff_inner; + c_first_loop_t **c_first_loop; + c_second_loop_t **c_second_loop; + c_inner_loop_t ***c_inner_loop; + c_outer_t **c_outer; + c_inner_t ***c_inner; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,nullptr,_cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); @@ -82,20 +96,18 @@ class PairTersoffIntel : public PairTersoff { ForceConst force_const_double; template - void compute(int eflag, int vflag, IntelBuffers *buffers, + void compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc); template - void eval(const int offload, const int vflag, - IntelBuffers * buffers, + void eval(const int offload, const int vflag, IntelBuffers *buffers, const ForceConst &fc, const int astart, const int aend); template - void pack_force_const(ForceConst &fc, - IntelBuffers *buffers); + void pack_force_const(ForceConst &fc, IntelBuffers *buffers); }; -} -#endif // __INTEL_COMPILER +} // namespace LAMMPS_NS +#endif // __INTEL_COMPILER #endif #endif diff --git a/src/INTEL/pppm_disp_intel.h b/src/INTEL/pppm_disp_intel.h index bc6ed2f54f..2bac82ec9a 100644 --- a/src/INTEL/pppm_disp_intel.h +++ b/src/INTEL/pppm_disp_intel.h @@ -25,212 +25,204 @@ KSpaceStyle(pppm/disp/intel,PPPMDispIntel); #ifndef LMP_PPPMINTEL_DISP_H #define LMP_PPPMINTEL_DISP_H -#include "pppm_disp.h" #include "fix_intel.h" +#include "pppm_disp.h" namespace LAMMPS_NS { - class PPPMDispIntel : public PPPMDisp { - public: - PPPMDispIntel(class LAMMPS *); - virtual ~PPPMDispIntel(); - virtual void init(); - virtual void compute(int, int); +class PPPMDispIntel : public PPPMDisp { + public: + PPPMDispIntel(class LAMMPS *); + virtual ~PPPMDispIntel(); + virtual void init(); + virtual void compute(int, int); - #ifdef _LMP_INTEL_OFFLOAD - int use_base(); - #endif - - protected: - FixIntel *fix; - - int _use_lrt; - FFT_SCALAR **perthread_density; - FFT_SCALAR *particle_ekx; - FFT_SCALAR *particle_eky; - FFT_SCALAR *particle_ekz; - FFT_SCALAR *particle_ekx0; - FFT_SCALAR *particle_eky0; - FFT_SCALAR *particle_ekz0; - FFT_SCALAR *particle_ekx1; - FFT_SCALAR *particle_eky1; - FFT_SCALAR *particle_ekz1; - FFT_SCALAR *particle_ekx2; - FFT_SCALAR *particle_eky2; - FFT_SCALAR *particle_ekz2; - FFT_SCALAR *particle_ekx3; - FFT_SCALAR *particle_eky3; - FFT_SCALAR *particle_ekz3; - FFT_SCALAR *particle_ekx4; - FFT_SCALAR *particle_eky4; - FFT_SCALAR *particle_ekz4; - FFT_SCALAR *particle_ekx5; - FFT_SCALAR *particle_eky5; - FFT_SCALAR *particle_ekz5; - FFT_SCALAR *particle_ekx6; - FFT_SCALAR *particle_eky6; - FFT_SCALAR *particle_ekz6; - - int _use_table; - int rho_points; - FFT_SCALAR **rho_lookup; - FFT_SCALAR **rho6_lookup; - FFT_SCALAR **drho_lookup; - FFT_SCALAR **drho6_lookup; - FFT_SCALAR half_rho_scale, half_rho_scale_plus; - - int _use_packing; - - #ifdef _LMP_INTEL_OFFLOAD - int _use_base; - #endif - - template - void particle_map(double, double, double, - double, int **, int, int, - int, int, int, - int, int, int, - IntelBuffers *buffers); - - template - void make_rho_c(IntelBuffers *buffers); - template - void make_rho_c(IntelBuffers *buffers) { - if (_use_table == 1) { - make_rho_c(buffers); - } else { - make_rho_c(buffers); - } - } - - template - void make_rho_g(IntelBuffers *buffers); - template - void make_rho_g(IntelBuffers *buffers) { - if (_use_table == 1) { - make_rho_g(buffers); - } else { - make_rho_g(buffers); - } - } - - template - void make_rho_a(IntelBuffers *buffers); - template - void make_rho_a(IntelBuffers *buffers) { - if (_use_table == 1) { - make_rho_a(buffers); - } else { - make_rho_a(buffers); - } - } - - - template - void make_rho_none(IntelBuffers *buffers); - template - void make_rho_none(IntelBuffers *buffers) { - if (_use_table == 1) { - make_rho_none(buffers); - } else { - make_rho_none(buffers); - } - } - - - template - void fieldforce_c_ik(IntelBuffers *buffers); - template - void fieldforce_c_ik(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_c_ik(buffers); - } else { - fieldforce_c_ik(buffers); - } - } - - template - void fieldforce_c_ad(IntelBuffers *buffers); - template - void fieldforce_c_ad(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_c_ad(buffers); - } else { - fieldforce_c_ad(buffers); - } - } - - template - void fieldforce_g_ik(IntelBuffers *buffers); - template - void fieldforce_g_ik(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_g_ik(buffers); - } else { - fieldforce_g_ik(buffers); - } - } - - template - void fieldforce_g_ad(IntelBuffers *buffers); - template - void fieldforce_g_ad(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_g_ad(buffers); - } else { - fieldforce_g_ad(buffers); - } - } - - template - void fieldforce_a_ik(IntelBuffers *buffers); - template - void fieldforce_a_ik(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_a_ik(buffers); - } else { - fieldforce_a_ik(buffers); - } - } - - template - void fieldforce_a_ad(IntelBuffers *buffers); - template - void fieldforce_a_ad(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_a_ad(buffers); - } else { - fieldforce_a_ad(buffers); - } - } - template - void fieldforce_none_ik(IntelBuffers *buffers); - template - void fieldforce_none_ik(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_none_ik(buffers); - } else { - fieldforce_none_ik(buffers); - } - } - - template - void fieldforce_none_ad(IntelBuffers *buffers); - template - void fieldforce_none_ad(IntelBuffers *buffers) { - if (_use_table == 1) { - fieldforce_none_ad(buffers); - } else { - fieldforce_none_ad(buffers); - } - } - - void precompute_rho(); - - }; - -} -#endif +#ifdef _LMP_INTEL_OFFLOAD + int use_base(); #endif + protected: + FixIntel *fix; + int _use_lrt; + FFT_SCALAR **perthread_density; + FFT_SCALAR *particle_ekx; + FFT_SCALAR *particle_eky; + FFT_SCALAR *particle_ekz; + FFT_SCALAR *particle_ekx0; + FFT_SCALAR *particle_eky0; + FFT_SCALAR *particle_ekz0; + FFT_SCALAR *particle_ekx1; + FFT_SCALAR *particle_eky1; + FFT_SCALAR *particle_ekz1; + FFT_SCALAR *particle_ekx2; + FFT_SCALAR *particle_eky2; + FFT_SCALAR *particle_ekz2; + FFT_SCALAR *particle_ekx3; + FFT_SCALAR *particle_eky3; + FFT_SCALAR *particle_ekz3; + FFT_SCALAR *particle_ekx4; + FFT_SCALAR *particle_eky4; + FFT_SCALAR *particle_ekz4; + FFT_SCALAR *particle_ekx5; + FFT_SCALAR *particle_eky5; + FFT_SCALAR *particle_ekz5; + FFT_SCALAR *particle_ekx6; + FFT_SCALAR *particle_eky6; + FFT_SCALAR *particle_ekz6; + + int _use_table; + int rho_points; + FFT_SCALAR **rho_lookup; + FFT_SCALAR **rho6_lookup; + FFT_SCALAR **drho_lookup; + FFT_SCALAR **drho6_lookup; + FFT_SCALAR half_rho_scale, half_rho_scale_plus; + + int _use_packing; + +#ifdef _LMP_INTEL_OFFLOAD + int _use_base; +#endif + + template + void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int, int, + IntelBuffers *buffers); + + template + void make_rho_c(IntelBuffers *buffers); + template void make_rho_c(IntelBuffers *buffers) + { + if (_use_table == 1) { + make_rho_c(buffers); + } else { + make_rho_c(buffers); + } + } + + template + void make_rho_g(IntelBuffers *buffers); + template void make_rho_g(IntelBuffers *buffers) + { + if (_use_table == 1) { + make_rho_g(buffers); + } else { + make_rho_g(buffers); + } + } + + template + void make_rho_a(IntelBuffers *buffers); + template void make_rho_a(IntelBuffers *buffers) + { + if (_use_table == 1) { + make_rho_a(buffers); + } else { + make_rho_a(buffers); + } + } + + template + void make_rho_none(IntelBuffers *buffers); + template void make_rho_none(IntelBuffers *buffers) + { + if (_use_table == 1) { + make_rho_none(buffers); + } else { + make_rho_none(buffers); + } + } + + template + void fieldforce_c_ik(IntelBuffers *buffers); + template void fieldforce_c_ik(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_c_ik(buffers); + } else { + fieldforce_c_ik(buffers); + } + } + + template + void fieldforce_c_ad(IntelBuffers *buffers); + template void fieldforce_c_ad(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_c_ad(buffers); + } else { + fieldforce_c_ad(buffers); + } + } + + template + void fieldforce_g_ik(IntelBuffers *buffers); + template void fieldforce_g_ik(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_g_ik(buffers); + } else { + fieldforce_g_ik(buffers); + } + } + + template + void fieldforce_g_ad(IntelBuffers *buffers); + template void fieldforce_g_ad(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_g_ad(buffers); + } else { + fieldforce_g_ad(buffers); + } + } + + template + void fieldforce_a_ik(IntelBuffers *buffers); + template void fieldforce_a_ik(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_a_ik(buffers); + } else { + fieldforce_a_ik(buffers); + } + } + + template + void fieldforce_a_ad(IntelBuffers *buffers); + template void fieldforce_a_ad(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_a_ad(buffers); + } else { + fieldforce_a_ad(buffers); + } + } + template + void fieldforce_none_ik(IntelBuffers *buffers); + template void fieldforce_none_ik(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_none_ik(buffers); + } else { + fieldforce_none_ik(buffers); + } + } + + template + void fieldforce_none_ad(IntelBuffers *buffers); + template void fieldforce_none_ad(IntelBuffers *buffers) + { + if (_use_table == 1) { + fieldforce_none_ad(buffers); + } else { + fieldforce_none_ad(buffers); + } + } + + void precompute_rho(); +}; + +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/INTEL/pppm_intel.h b/src/INTEL/pppm_intel.h index c0e66996c1..c6b3d83aa5 100644 --- a/src/INTEL/pppm_intel.h +++ b/src/INTEL/pppm_intel.h @@ -28,8 +28,8 @@ KSpaceStyle(pppm/intel,PPPMIntel); #ifndef LMP_PPPMINTEL_H #define LMP_PPPMINTEL_H -#include "pppm.h" #include "fix_intel.h" +#include "pppm.h" namespace LAMMPS_NS { @@ -44,9 +44,9 @@ class PPPMIntel : public PPPM { void compute_second(int, int); void pack_buffers(); - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int use_base(); - #endif +#endif protected: FixIntel *fix; @@ -63,53 +63,50 @@ class PPPMIntel : public PPPM { FFT_SCALAR **drho_lookup; FFT_SCALAR half_rho_scale, half_rho_scale_plus; - #ifdef _LMP_INTEL_OFFLOAD +#ifdef _LMP_INTEL_OFFLOAD int _use_base; - #endif +#endif virtual void allocate(); - template - void test_function(IntelBuffers *buffers); + template void test_function(IntelBuffers *buffers); void precompute_rho(); - template - void particle_map(IntelBuffers *buffers); - template - void make_rho(IntelBuffers *buffers); - template - void make_rho(IntelBuffers *buffers) { + template void particle_map(IntelBuffers *buffers); + template + void make_rho(IntelBuffers *buffers); + template void make_rho(IntelBuffers *buffers) + { if (_use_table == 1) { - make_rho(buffers); + make_rho(buffers); } else { - make_rho(buffers); + make_rho(buffers); } } - template - void fieldforce_ik(IntelBuffers *buffers); - template - void fieldforce_ik(IntelBuffers *buffers) { + template + void fieldforce_ik(IntelBuffers *buffers); + template void fieldforce_ik(IntelBuffers *buffers) + { if (_use_table == 1) { fieldforce_ik(buffers); } else { fieldforce_ik(buffers); } } - template - void fieldforce_ad(IntelBuffers *buffers); - template - void fieldforce_ad(IntelBuffers *buffers) { + template + void fieldforce_ad(IntelBuffers *buffers); + template void fieldforce_ad(IntelBuffers *buffers) + { if (_use_table == 1) { - fieldforce_ad(buffers); + fieldforce_ad(buffers); } else { - fieldforce_ad(buffers); + fieldforce_ad(buffers); } } - FFT_SCALAR ***create3d_offset(FFT_SCALAR ***&, int, int, int, - int, int, int, const char *name); + FFT_SCALAR ***create3d_offset(FFT_SCALAR ***&, int, int, int, int, int, int, const char *name); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/INTEL/verlet_lrt_intel.h b/src/INTEL/verlet_lrt_intel.h index daa159e29a..e13d2b44f6 100644 --- a/src/INTEL/verlet_lrt_intel.h +++ b/src/INTEL/verlet_lrt_intel.h @@ -21,24 +21,24 @@ IntegrateStyle(verlet/lrt/intel,VerletLRTIntel); #ifndef LMP_VERLET_LRT_INTEL_H #define LMP_VERLET_LRT_INTEL_H -#include "verlet.h" #include "pppm_intel.h" +#include "verlet.h" #ifdef LMP_INTEL_USELRT - #if defined(LMP_INTEL_LRT11) || defined(__APPLE__) - #if __cplusplus > 199711L - #define _LMP_INTEL_LRT_11 - #include - #else - #undef LMP_INTEL_USELRT - #ifdef LMP_INTEL_LRT11 - #error C++11 support required for LMP_INTEL_LRT11 define - #endif - #endif - #else - #define _LMP_INTEL_LRT_PTHREAD - #include - #endif +#if defined(LMP_INTEL_LRT11) || defined(__APPLE__) +#if __cplusplus > 199711L +#define _LMP_INTEL_LRT_11 +#include +#else +#undef LMP_INTEL_USELRT +#ifdef LMP_INTEL_LRT11 +#error C++11 support required for LMP_INTEL_LRT11 define +#endif +#endif +#else +#define _LMP_INTEL_LRT_PTHREAD +#include +#endif #endif namespace LAMMPS_NS { @@ -54,17 +54,17 @@ class VerletLRTIntel : public Verlet { protected: PPPMIntel *_intel_kspace; - #if defined(_LMP_INTEL_LRT_PTHREAD) +#if defined(_LMP_INTEL_LRT_PTHREAD) static void *k_launch_loop(void *context); pthread_t _kspace_thread; pthread_attr_t _kspace_attr; pthread_mutex_t _kmutex; pthread_cond_t _kcond; int _kspace_ready, _kspace_done, _krun_n; - #endif +#endif }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/KOKKOS/atom_map_kokkos.cpp b/src/KOKKOS/atom_map_kokkos.cpp index 8d0d1243ac..a76941bd8f 100644 --- a/src/KOKKOS/atom_map_kokkos.cpp +++ b/src/KOKKOS/atom_map_kokkos.cpp @@ -111,7 +111,7 @@ void AtomKokkos::map_init(int check) // use "view" template method to avoid unnecessary deep_copy - auto h_map_hash = k_map_hash.view(); // get type + auto h_map_hash = k_map_hash.view(); // get type h_map_hash = decltype(h_map_hash)(map_nhash); k_map_hash.view() = h_map_hash; } @@ -261,7 +261,7 @@ void AtomKokkos::map_set() if (modify->fix[n]->execution_space == Device) device_hash_flag = 1; if (device_hash_flag) { - Kokkos::deep_copy(d_map_hash,h_map_hash); + Kokkos::deep_copy(d_map_hash, h_map_hash); k_map_hash.view() = d_map_hash; } } diff --git a/src/KOKKOS/fix_nvt_kokkos.h b/src/KOKKOS/fix_nvt_kokkos.h index 32e985537b..5da5fc309b 100644 --- a/src/KOKKOS/fix_nvt_kokkos.h +++ b/src/KOKKOS/fix_nvt_kokkos.h @@ -20,7 +20,6 @@ FixStyle(nvt/kk/host,FixNVTKokkos); // clang-format on #else - // clang-format off #ifndef LMP_FIX_NVT_KOKKOS_H #define LMP_FIX_NVT_KOKKOS_H diff --git a/src/MANYBODY/pair_edip.cpp b/src/MANYBODY/pair_edip.cpp index 5efc5b7980..837ec2a3c7 100644 --- a/src/MANYBODY/pair_edip.cpp +++ b/src/MANYBODY/pair_edip.cpp @@ -778,7 +778,7 @@ void PairEDIP::read_file(char *file) if (comm->me == 0) { fp = utils::open_potential(file, lmp, nullptr); if (fp == nullptr) - error->one(FLERR,"Cannot open EDIP potential file {}: {}", file,utils::getsyserror()); + error->one(FLERR, "Cannot open EDIP potential file {}: {}", file, utils::getsyserror()); } // read each set of params from potential file diff --git a/src/MC/fix_charge_regulation.h b/src/MC/fix_charge_regulation.h index 2b50c7be5b..9fde2d0563 100644 --- a/src/MC/fix_charge_regulation.h +++ b/src/MC/fix_charge_regulation.h @@ -61,9 +61,9 @@ class FixChargeRegulation : public Fix { double llength_unit_in_nm; // LAMMPS unit of length in nm, needed since chemical potentials are in units of mol/l double pH, pKa, pKb, pKs, pI_plus, - pI_minus; // chemical potentials and equilibrium constant in log10 base + pI_minus; // chemical potentials and equilibrium constant in log10 base double c10pH, c10pKa, c10pKb, c10pOH, c10pI_plus, - c10pI_minus; // 10 raised to chemical potential value, in units of concentration [mol/liter] + c10pI_minus; // 10 raised to chemical potential value, in units of concentration [mol/liter] double pmcmoves[3]; // mc move attempt probability: acid, base, ion pair exchange double pmcc; // mc move cumulative attempt probability int npart_xrd; // # of particles (ions) within xrd @@ -71,17 +71,17 @@ class FixChargeRegulation : public Fix { double vlocal_xrd; // # local volume within xrd bool only_salt_flag; // true if performing only salt insertion/deletion, no acid/base dissociation. - bool add_tags_flag; // true if each inserted atom gets its unique atom tag - int groupbitall; // group bitmask for inserted atoms - int ngroups; // number of group-ids for inserted atoms - char **groupstrings; // list of group-ids for inserted atoms + bool add_tags_flag; // true if each inserted atom gets its unique atom tag + int groupbitall; // group bitmask for inserted atoms + int ngroups; // number of group-ids for inserted atoms + char **groupstrings; // list of group-ids for inserted atoms // counters unsigned long int nacid_attempts, nacid_successes, nbase_attempts, nbase_successes, nsalt_attempts, nsalt_successes; int nacid_neutral, nacid_charged, nbase_neutral, nbase_charged, ncation, - nanion; // particle type counts - int cr_nmax; // max number of local particles + nanion; // particle type counts + int cr_nmax; // max number of local particles double reservoir_temperature; double beta, sigma, volume, volume_rx; // inverse temperature, speed, total volume, reacting volume diff --git a/src/MDI/fix_mdi_engine.cpp b/src/MDI/fix_mdi_engine.cpp index 81eb87a0f3..a898647563 100644 --- a/src/MDI/fix_mdi_engine.cpp +++ b/src/MDI/fix_mdi_engine.cpp @@ -886,7 +886,8 @@ void FixMDIEngine::receive_cell(Error *error) double small = std::numeric_limits::min(); if (fabs(celldata[1]) > small or fabs(celldata[2]) > small or fabs(celldata[3]) > small or fabs(celldata[5]) > small or fabs(celldata[6]) > small or fabs(celldata[7]) > small) { - error->all(FLERR, "MDI: LAMMPS currently only supports the >CELL command for orthogonal cell vectors"); + error->all(FLERR, + "MDI: LAMMPS currently only supports the >CELL command for orthogonal cell vectors"); } // set the new LAMMPS cell dimensions diff --git a/src/MDI/mdi_engine.cpp b/src/MDI/mdi_engine.cpp index a1159f7402..9bd9258dfc 100644 --- a/src/MDI/mdi_engine.cpp +++ b/src/MDI/mdi_engine.cpp @@ -340,6 +340,6 @@ char *MDIEngine::mdi_optg() if (strcmp(command, "@DEFAULT") == 0 || strcmp(command, "EXIT") == 0) return command; - error->all(FLERR,"MDI reached end of OPTG simulation with invalid command: {}", command); + error->all(FLERR, "MDI reached end of OPTG simulation with invalid command: {}", command); return nullptr; } diff --git a/src/MGPT/pair_mgpt.h b/src/MGPT/pair_mgpt.h index 227e5e9a50..e2ccda14da 100644 --- a/src/MGPT/pair_mgpt.h +++ b/src/MGPT/pair_mgpt.h @@ -1,4 +1,3 @@ -// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -28,6 +27,7 @@ PairStyle(mgpt,PairMGPT); // clang-format on #else +// clang-format off #ifndef LMP_PAIR_MGPT_H #define LMP_PAIR_MGPT_H diff --git a/src/MISC/pair_tracker.cpp b/src/MISC/pair_tracker.cpp index f2fdb71081..003f2f3dd0 100644 --- a/src/MISC/pair_tracker.cpp +++ b/src/MISC/pair_tracker.cpp @@ -435,7 +435,7 @@ void PairTracker::read_restart_settings(FILE *fp) /* ---------------------------------------------------------------------- */ double PairTracker::single(int /*i*/, int /*j*/, int /*itype*/, int /*jtype*/, double /*rsq*/, - double /*factor_coul*/, double /*factor_lj*/, double &/*fforce*/) + double /*factor_coul*/, double /*factor_lj*/, double & /*fforce*/) { return 0.0; } diff --git a/src/ML-HDNNP/pair_hdnnp.cpp b/src/ML-HDNNP/pair_hdnnp.cpp index 7aeacad588..eabc0bcfa0 100644 --- a/src/ML-HDNNP/pair_hdnnp.cpp +++ b/src/ML-HDNNP/pair_hdnnp.cpp @@ -25,28 +25,29 @@ #include "comm.h" #include "error.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" #include "update.h" -#include "InterfaceLammps.h" // n2p2 interface header +#include "InterfaceLammps.h" // n2p2 interface header using namespace LAMMPS_NS; static const char cite_user_hdnnp_package[] = - "ML-HDNNP package: 10.1021/acs.jctc.8b00770\n\n" - "@Article{Singraber19,\n" - " author = {Singraber, Andreas and Behler, J{\"o}rg and Dellago, Christoph},\n" - " title = {Library-{{Based LAMMPS Implementation}} of {{High}}-{{Dimensional Neural Network Potentials}}},\n" - " year = {2019},\n" - " month = mar,\n" - " volume = {15},\n" - " pages = {1827--1840},\n" - " doi = {10.1021/acs.jctc.8b00770},\n" - " journal = {J.~Chem.~Theory~Comput.},\n" - " number = {3}\n" - "}\n\n"; + "ML-HDNNP package: 10.1021/acs.jctc.8b00770\n\n" + "@Article{Singraber19,\n" + " author = {Singraber, Andreas and Behler, J{\"o}rg and Dellago, Christoph},\n" + " title = {Library-{{Based LAMMPS Implementation}} of {{High}}-{{Dimensional Neural Network " + "Potentials}}},\n" + " year = {2019},\n" + " month = mar,\n" + " volume = {15},\n" + " pages = {1827--1840},\n" + " doi = {10.1021/acs.jctc.8b00770},\n" + " journal = {J.~Chem.~Theory~Comput.},\n" + " number = {3}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -54,12 +55,13 @@ PairHDNNP::PairHDNNP(LAMMPS *lmp) : Pair(lmp) { if (lmp->citeme) lmp->citeme->add(cite_user_hdnnp_package); - single_enable = 0; // 1 if single() routine exists - restartinfo = 0; // 1 if pair style writes restart info - one_coeff = 1; // 1 if allows only one coeff * * call - manybody_flag = 1; // 1 if a manybody potential - unit_convert_flag = 0; // TODO: Check possible values. value != 0 indicates support for unit conversion. - reinitflag = 0; // 1 if compatible with fix adapt and alike + single_enable = 0; // 1 if single() routine exists + restartinfo = 0; // 1 if pair style writes restart info + one_coeff = 1; // 1 if allows only one coeff * * call + manybody_flag = 1; // 1 if a manybody potential + unit_convert_flag = + 0; // TODO: Check possible values. value != 0 indicates support for unit conversion. + reinitflag = 0; // 1 if compatible with fix adapt and alike interface = new nnp::InterfaceLammps(); } @@ -77,10 +79,10 @@ PairHDNNP::~PairHDNNP() void PairHDNNP::compute(int eflag, int vflag) { - ev_init(eflag,vflag); + ev_init(eflag, vflag); // Set number of local atoms and add element. - interface->setLocalAtoms(atom->nlocal,atom->type); + interface->setLocalAtoms(atom->nlocal, atom->type); // Transfer tags separately. Interface::setLocalTags is overloaded internally // to work with both -DLAMMPS_SMALLBIG (tagint = int) and -DLAMMPS_BIGBIG // (tagint = int64_t) @@ -93,21 +95,18 @@ void PairHDNNP::compute(int eflag, int vflag) interface->process(); // Do all stuff related to extrapolation warnings. - if(showew == true || showewsum > 0 || maxew >= 0) { - handleExtrapolationWarnings(); - } + if (showew == true || showewsum > 0 || maxew >= 0) { handleExtrapolationWarnings(); } // Calculate forces of local and ghost atoms. interface->getForces(atom->f); // Add energy contribution to total energy. if (eflag_global) - ev_tally(0,0,atom->nlocal,1,interface->getEnergy(),0.0,0.0,0.0,0.0,0.0); + ev_tally(0, 0, atom->nlocal, 1, interface->getEnergy(), 0.0, 0.0, 0.0, 0.0, 0.0); // Add atomic energy if requested (CAUTION: no physical meaning!). if (eflag_atom) - for (int i = 0; i < atom->nlocal; ++i) - eatom[i] = interface->getAtomicEnergy(i); + for (int i = 0; i < atom->nlocal; ++i) eatom[i] = interface->getAtomicEnergy(i); // If virial needed calculate via F dot r. if (vflag_fdotr) virial_fdotr_compute(); @@ -121,9 +120,9 @@ void PairHDNNP::settings(int narg, char **arg) { int iarg = 0; - if (narg < 1) error->all(FLERR,"Illegal pair_style command"); + if (narg < 1) error->all(FLERR, "Illegal pair_style command"); - maxCutoffRadius = utils::numeric(FLERR,arg[0],false,lmp); + maxCutoffRadius = utils::numeric(FLERR, arg[0], false, lmp); iarg++; // default settings @@ -137,61 +136,55 @@ void PairHDNNP::settings(int narg, char **arg) numExtrapolationWarningsTotal = 0; numExtrapolationWarningsSummary = 0; - while(iarg < narg) { + while (iarg < narg) { // set HDNNP directory - if (strcmp(arg[iarg],"dir") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); + if (strcmp(arg[iarg], "dir") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); delete[] directory; - directory = utils::strdup(arg[iarg+1]); + directory = utils::strdup(arg[iarg + 1]); iarg += 2; - // show extrapolation warnings - } else if (strcmp(arg[iarg],"showew") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); - if (strcmp(arg[iarg+1],"yes") == 0) + // show extrapolation warnings + } else if (strcmp(arg[iarg], "showew") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); + if (strcmp(arg[iarg + 1], "yes") == 0) showew = true; - else if (strcmp(arg[iarg+1],"no") == 0) + else if (strcmp(arg[iarg + 1], "no") == 0) showew = false; else - error->all(FLERR,"Illegal pair_style command"); + error->all(FLERR, "Illegal pair_style command"); iarg += 2; - // show extrapolation warning summary - } else if (strcmp(arg[iarg],"showewsum") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); - showewsum = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + // show extrapolation warning summary + } else if (strcmp(arg[iarg], "showewsum") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); + showewsum = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - // maximum allowed extrapolation warnings - } else if (strcmp(arg[iarg],"maxew") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); - maxew = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + // maximum allowed extrapolation warnings + } else if (strcmp(arg[iarg], "maxew") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); + maxew = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - // reset extrapolation warning counter - } else if (strcmp(arg[iarg],"resetew") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); - if (strcmp(arg[iarg+1],"yes") == 0) + // reset extrapolation warning counter + } else if (strcmp(arg[iarg], "resetew") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); + if (strcmp(arg[iarg + 1], "yes") == 0) resetew = true; - else if (strcmp(arg[iarg+1],"no") == 0) + else if (strcmp(arg[iarg + 1], "no") == 0) resetew = false; else - error->all(FLERR,"Illegal pair_style command"); + error->all(FLERR, "Illegal pair_style command"); iarg += 2; - // length unit conversion factor - } else if (strcmp(arg[iarg],"cflength") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); - cflength = utils::numeric(FLERR,arg[iarg+1],false,lmp); + // length unit conversion factor + } else if (strcmp(arg[iarg], "cflength") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); + cflength = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - // energy unit conversion factor - } else if (strcmp(arg[iarg],"cfenergy") == 0) { - if (iarg+2 > narg) - error->all(FLERR,"Illegal pair_style command"); - cfenergy = utils::numeric(FLERR,arg[iarg+1],false,lmp); + // energy unit conversion factor + } else if (strcmp(arg[iarg], "cfenergy") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command"); + cfenergy = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal pair_style command"); + } else + error->all(FLERR, "Illegal pair_style command"); } } @@ -205,21 +198,20 @@ void PairHDNNP::coeff(int narg, char **arg) if (!allocated) allocate(); - if (narg != 2 + n) - error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg != 2 + n) error->all(FLERR, "Incorrect args for pair coefficients"); - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); + if (strcmp(arg[0], "*") != 0 || strcmp(arg[1], "*") != 0) + error->all(FLERR, "Incorrect args for pair coefficients"); - int *map = new int[n+1]; + int *map = new int[n + 1]; for (int i = 0; i < n; i++) map[i] = 0; emap = ""; for (int i = 2; i < narg; i++) { - if (strcmp(arg[i],"NULL") != 0) { + if (strcmp(arg[i], "NULL") != 0) { if (i != 2) emap += ","; - emap += std::to_string(i-1) + ":" + arg[i]; - map[i-1] = 1; + emap += std::to_string(i - 1) + ":" + arg[i]; + map[i - 1] = 1; } } @@ -231,7 +223,7 @@ void PairHDNNP::coeff(int narg, char **arg) count++; } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); delete[] map; } @@ -251,29 +243,18 @@ void PairHDNNP::init_style() // Activate screen and logfile output only for rank 0. if (comm->me == 0) { - if (lmp->screen != nullptr) - interface->log.registerCFilePointer(&(lmp->screen)); - if (lmp->logfile != nullptr) - interface->log.registerCFilePointer(&(lmp->logfile)); + if (lmp->screen != nullptr) interface->log.registerCFilePointer(&(lmp->screen)); + if (lmp->logfile != nullptr) interface->log.registerCFilePointer(&(lmp->logfile)); } // Initialize interface on all processors. - interface->initialize(directory, - emap.c_str(), - showew, - resetew, - showewsum, - maxew, - cflength, - cfenergy, - maxCutoffRadius, - atom->ntypes, - comm->me); + interface->initialize(directory, emap.c_str(), showew, resetew, showewsum, maxew, cflength, + cfenergy, maxCutoffRadius, atom->ntypes, comm->me); // LAMMPS cutoff radius (given via pair_coeff) should not be smaller than // maximum symmetry function cutoff radius. if (maxCutoffRadius < interface->getMaxCutoffRadius()) - error->all(FLERR,"Inconsistent cutoff radius"); + error->all(FLERR, "Inconsistent cutoff radius"); } /* ---------------------------------------------------------------------- @@ -294,12 +275,11 @@ void PairHDNNP::allocate() allocated = 1; int n = atom->ntypes; - memory->create(setflag,n+1,n+1,"pair:setflag"); + memory->create(setflag, n + 1, n + 1, "pair:setflag"); for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; + for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cutsq,n+1,n+1,"pair:cutsq"); // TODO: Is this required? + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); // TODO: Is this required? } void PairHDNNP::transferNeighborList() @@ -315,9 +295,7 @@ void PairHDNNP::transferNeighborList() double dy = atom->x[i][1] - atom->x[j][1]; double dz = atom->x[i][2] - atom->x[j][2]; double d2 = dx * dx + dy * dy + dz * dz; - if (d2 <= rc2) { - interface->addNeighbor(i,j,atom->tag[j],atom->type[j],dx,dy,dz,d2); - } + if (d2 <= rc2) { interface->addNeighbor(i, j, atom->tag[j], atom->type[j], dx, dy, dz, d2); } } } } @@ -325,29 +303,29 @@ void PairHDNNP::transferNeighborList() void PairHDNNP::handleExtrapolationWarnings() { // Get number of extrapolation warnings for local atoms. - long numCurrentEW = (long)interface->getNumExtrapolationWarnings(); + long numCurrentEW = (long) interface->getNumExtrapolationWarnings(); // Update (or set, resetew == true) total warnings counter. - if (resetew) numExtrapolationWarningsTotal = numCurrentEW; - else numExtrapolationWarningsTotal += numCurrentEW; + if (resetew) + numExtrapolationWarningsTotal = numCurrentEW; + else + numExtrapolationWarningsTotal += numCurrentEW; // Update warnings summary counter. - if(showewsum > 0) { - numExtrapolationWarningsSummary += numCurrentEW; - } + if (showewsum > 0) { numExtrapolationWarningsSummary += numCurrentEW; } // If requested write extrapolation warnings. // Requires communication of all symmetry functions statistics entries to // rank 0. - if(showew > 0) { + if (showew > 0) { // First collect an overview of extrapolation warnings per process. long *numEWPerProc = nullptr; - if(comm->me == 0) numEWPerProc = new long[comm->nprocs]; + if (comm->me == 0) numEWPerProc = new long[comm->nprocs]; MPI_Gather(&numCurrentEW, 1, MPI_LONG, numEWPerProc, 1, MPI_LONG, 0, world); - if(comm->me == 0) { - for(int i=1;inprocs;i++) { - if(numEWPerProc[i] > 0) { + if (comm->me == 0) { + for (int i = 1; i < comm->nprocs; i++) { + if (numEWPerProc[i] > 0) { long bs = 0; MPI_Status ms; // Get buffer size. @@ -360,8 +338,7 @@ void PairHDNNP::handleExtrapolationWarnings() } } interface->writeExtrapolationWarnings(); - } - else if(numCurrentEW > 0) { + } else if (numCurrentEW > 0) { // Get desired buffer length for all extrapolation warning entries. long bs = interface->getEWBufferSize(); // Allocate and fill buffer. @@ -373,18 +350,17 @@ void PairHDNNP::handleExtrapolationWarnings() delete[] buf; } - if(comm->me == 0) delete[] numEWPerProc; + if (comm->me == 0) delete[] numEWPerProc; } // If requested gather number of warnings to display summary. - if(showewsum > 0 && update->ntimestep % showewsum == 0) { + if (showewsum > 0 && update->ntimestep % showewsum == 0) { long globalEW = 0; // Communicate the sum over all processors to proc 0. - MPI_Reduce(&numExtrapolationWarningsSummary, - &globalEW, 1, MPI_LONG, MPI_SUM, 0, world); + MPI_Reduce(&numExtrapolationWarningsSummary, &globalEW, 1, MPI_LONG, MPI_SUM, 0, world); // Write to screen or logfile. - if(comm->me == 0) - utils::logmesg(lmp,"### NNP EW SUMMARY ### TS: {:10d} EW {:10d} EWPERSTEP {:10.3e}\n", + if (comm->me == 0) + utils::logmesg(lmp, "### NNP EW SUMMARY ### TS: {:10d} EW {:10d} EWPERSTEP {:10.3e}\n", update->ntimestep, globalEW, double(globalEW) / showewsum); // Reset summary counter. numExtrapolationWarningsSummary = 0; @@ -392,7 +368,7 @@ void PairHDNNP::handleExtrapolationWarnings() // Stop if maximum number of extrapolation warnings is exceeded. if (numExtrapolationWarningsTotal > maxew) { - error->one(FLERR,"Too many extrapolation warnings"); + error->one(FLERR, "Too many extrapolation warnings"); } // Reset internal extrapolation warnings counters. diff --git a/src/ML-HDNNP/pair_hdnnp.h b/src/ML-HDNNP/pair_hdnnp.h index c7cbc8188a..3c42fa60be 100644 --- a/src/ML-HDNNP/pair_hdnnp.h +++ b/src/ML-HDNNP/pair_hdnnp.h @@ -30,7 +30,7 @@ PairStyle(hdnnp,PairHDNNP); #include "pair.h" namespace nnp { - class InterfaceLammps; +class InterfaceLammps; } namespace LAMMPS_NS { @@ -38,7 +38,6 @@ namespace LAMMPS_NS { class PairHDNNP : public Pair { public: - PairHDNNP(class LAMMPS *); virtual ~PairHDNNP(); virtual void compute(int, int); @@ -48,7 +47,6 @@ class PairHDNNP : public Pair { virtual double init_one(int, int); protected: - virtual void allocate(); void transferNeighborList(); void handleExtrapolationWarnings(); @@ -67,7 +65,7 @@ class PairHDNNP : public Pair { nnp::InterfaceLammps *interface; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/ML-IAP/mliap_descriptor.cpp b/src/ML-IAP/mliap_descriptor.cpp index 4d9b22a49e..ff8cfb43a9 100644 --- a/src/ML-IAP/mliap_descriptor.cpp +++ b/src/ML-IAP/mliap_descriptor.cpp @@ -47,9 +47,9 @@ MLIAPDescriptor::~MLIAPDescriptor() double MLIAPDescriptor::memory_usage() { - double bytes = (double)nelements*sizeof(double); // radelem - bytes += (double)nelements*sizeof(double); // welem - bytes += (double)nelements*nelements*sizeof(double); // cutsq + double bytes = (double) nelements * sizeof(double); // radelem + bytes += (double) nelements * sizeof(double); // welem + bytes += (double) nelements * nelements * sizeof(double); // cutsq return bytes; } diff --git a/src/ML-IAP/mliap_model.h b/src/ML-IAP/mliap_model.h index 187c1698b8..3a73065b04 100644 --- a/src/ML-IAP/mliap_model.h +++ b/src/ML-IAP/mliap_model.h @@ -31,10 +31,10 @@ class MLIAPModel : protected Pointers { virtual void compute_force_gradients(class MLIAPData *) = 0; virtual void init(); virtual double memory_usage() = 0; - int nelements; // # of unique elements - int nonlinearflag; // 1 if gradient() requires descriptors - int ndescriptors; // number of descriptors - int nparams; // number of parameters per element + int nelements; // # of unique elements + int nonlinearflag; // 1 if gradient() requires descriptors + int ndescriptors; // number of descriptors + int nparams; // number of parameters per element double **coeffelem; // element coefficients protected: diff --git a/src/ML-IAP/mliap_model_nn.h b/src/ML-IAP/mliap_model_nn.h index 34950a3c32..2795678c05 100644 --- a/src/ML-IAP/mliap_model_nn.h +++ b/src/ML-IAP/mliap_model_nn.h @@ -32,9 +32,9 @@ class MLIAPModelNN : public MLIAPModel { int nlayers; // number of layers per element protected: - int *activation; // activation functions - int *nnodes; // number of nodes per layer - double ***scale; // element scale values + int *activation; // activation functions + int *nnodes; // number of nodes per layer + double ***scale; // element scale values virtual void read_coeffs(char *); inline double sigm(double x, double &deriv) diff --git a/src/ML-RANN/pair_rann.h b/src/ML-RANN/pair_rann.h index 6c047775d4..adc3431ba7 100644 --- a/src/ML-RANN/pair_rann.h +++ b/src/ML-RANN/pair_rann.h @@ -39,128 +39,138 @@ PairStyle(rann,PairRANN); #include "pair.h" -#include #include +#include namespace LAMMPS_NS { - namespace RANN { - //forward declarations - class Activation; - class Fingerprint; - } +namespace RANN { + //forward declarations + class Activation; + class Fingerprint; +} // namespace RANN - class PairRANN : public Pair { - public: - //inherited functions - PairRANN(class LAMMPS *); - ~PairRANN(); - void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void init_style(); - double init_one(int, int); - void init_list(int , NeighList *); - void errorf(const char*,int,const char*); - int factorial(int); +class PairRANN : public Pair { + public: + //inherited functions + PairRANN(class LAMMPS *); + ~PairRANN(); + void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + void init_style(); + double init_one(int, int); + void init_list(int, NeighList *); + void errorf(const char *, int, const char *); + int factorial(int); - RANN::Fingerprint *create_fingerprint(const char *); - RANN::Activation *create_activation(const char *); + RANN::Fingerprint *create_fingerprint(const char *); + RANN::Activation *create_activation(const char *); - //global variables - int nelements; // # of elements (distinct from LAMMPS atom types since multiple atom types can be mapped to one element) - int nelementsp; // nelements+1 - char **elements; // names of elements - char **elementsp; // names of elements with "all" appended as the last "element" - double *mass; // mass of each element - double cutmax; // max radial distance for neighbor lists - int *map; // mapping from atom types to elements - int *fingerprintcount; // static variable used in initialization - int *fingerprintlength; // # of input neurons defined by fingerprints of each element. - int *fingerprintperelement; // # of fingerprints for each element - bool doscreen;//screening is calculated if any defined fingerprint uses it - bool allscreen;//all fingerprints use screening so screened neighbors can be completely ignored - bool dospin; - int res;//Resolution of function tables for cubic interpolation. - int memguess; - double *screening_min; - double *screening_max; - bool **weightdefined; - bool **biasdefined; - int nmax1; - int nmax2; - int fmax; - int fnmax; - //memory actively written to during each compute: - double *xn,*yn,*zn,*Sik,*dSikx,*dSiky,*dSikz,*dSijkx,*dSijky,*dSijkz,*sx,*sy,*sz,**dSijkxc,**dSijkyc,**dSijkzc,*dfeaturesx,*dfeaturesy,*dfeaturesz,*features; - double *layer,*sum,*sum1,**dlayerx,**dlayery,**dlayerz,**dlayersumx,**dlayersumy,**dlayersumz; - double **dsx,**dsy,**dsz,**dssumx,**dssumy,**dssumz; - int *tn,*jl; - bool *Bij; + //global variables + int nelements; // # of elements (distinct from LAMMPS atom types since multiple atom types can be mapped to one element) + int nelementsp; // nelements+1 + char **elements; // names of elements + char **elementsp; // names of elements with "all" appended as the last "element" + double *mass; // mass of each element + double cutmax; // max radial distance for neighbor lists + int *map; // mapping from atom types to elements + int *fingerprintcount; // static variable used in initialization + int *fingerprintlength; // # of input neurons defined by fingerprints of each element. + int *fingerprintperelement; // # of fingerprints for each element + bool doscreen; //screening is calculated if any defined fingerprint uses it + bool + allscreen; //all fingerprints use screening so screened neighbors can be completely ignored + bool dospin; + int res; //Resolution of function tables for cubic interpolation. + int memguess; + double *screening_min; + double *screening_max; + bool **weightdefined; + bool **biasdefined; + int nmax1; + int nmax2; + int fmax; + int fnmax; + //memory actively written to during each compute: + double *xn, *yn, *zn, *Sik, *dSikx, *dSiky, *dSikz, *dSijkx, *dSijky, *dSijkz, *sx, *sy, *sz, + **dSijkxc, **dSijkyc, **dSijkzc, *dfeaturesx, *dfeaturesy, *dfeaturesz, *features; + double *layer, *sum, *sum1, **dlayerx, **dlayery, **dlayerz, **dlayersumx, **dlayersumy, + **dlayersumz; + double **dsx, **dsy, **dsz, **dssumx, **dssumy, **dssumz; + int *tn, *jl; + bool *Bij; - struct Simulation{ - int *id; - bool forces; - bool spins; - double **x; - double **f; - double **s; - double box[3][3]; - double origin[3]; - double **features; - double **dfx; - double **dfy; - double **dfz; - double **dsx; - double **dsy; - double **dsz; - int *ilist,*numneigh,**firstneigh,*type,inum,gnum; - }; - - struct NNarchitecture{ - int layers; - int *dimensions;//vector of length layers with entries for neurons per layer - double **Weights; - double **Biases; - int *activations;//unused - int maxlayer;//longest layer (for memory allocation) - }; - - Simulation *sims; - NNarchitecture *net;//array of networks, 1 for each element. - - protected: - RANN::Activation ***activation; - RANN::Fingerprint ***fingerprints; - - private: - //new functions - void allocate(const std::vector &);//called after reading element list, but before reading the rest of the potential - void deallocate(); - void read_file(char *);//read potential file - void read_atom_types(std::vector,char*,int); - void read_fpe(std::vector,std::vector,char*,int);//fingerprints per element. Count total fingerprints defined for each 1st element in element combinations - void read_fingerprints(std::vector,std::vector,char*,int); - void read_fingerprint_constants(std::vector,std::vector,char*,int); - void read_network_layers(std::vector,std::vector,char*,int);//include input and output layer (hidden layers + 2) - void read_layer_size(std::vector,std::vector,char*,int); - void read_weight(std::vector,std::vector,FILE*,char*,int*);//weights should be formatted as properly shaped matrices - void read_bias(std::vector,std::vector,FILE*,char*,int*);//biases should be formatted as properly shaped vectors - void read_activation_functions(std::vector,std::vector,char*,int); - void read_screening(std::vector,std::vector,char*,int); - void read_mass(const std::vector &, const std::vector &,const char*,int); - bool check_potential();//after finishing reading potential file - void propagateforward(double *,double **,int,int);//called by compute to get force and energy - void propagateforwardspin(double *,double **,double**,int,int);//called by compute to get force and energy - void screening(int,int,int); - void cull_neighbor_list(int *,int,int); - void screen_neighbor_list(int *); + struct Simulation { + int *id; + bool forces; + bool spins; + double **x; + double **f; + double **s; + double box[3][3]; + double origin[3]; + double **features; + double **dfx; + double **dfy; + double **dfz; + double **dsx; + double **dsy; + double **dsz; + int *ilist, *numneigh, **firstneigh, *type, inum, gnum; }; -} + struct NNarchitecture { + int layers; + int *dimensions; //vector of length layers with entries for neurons per layer + double **Weights; + double **Biases; + int *activations; //unused + int maxlayer; //longest layer (for memory allocation) + }; + + Simulation *sims; + NNarchitecture *net; //array of networks, 1 for each element. + + protected: + RANN::Activation ***activation; + RANN::Fingerprint ***fingerprints; + + private: + //new functions + void allocate( + const std::vector + &); //called after reading element list, but before reading the rest of the potential + void deallocate(); + void read_file(char *); //read potential file + void read_atom_types(std::vector, char *, int); + void read_fpe( + std::vector, std::vector, char *, + int); //fingerprints per element. Count total fingerprints defined for each 1st element in element combinations + void read_fingerprints(std::vector, std::vector, char *, int); + void read_fingerprint_constants(std::vector, std::vector, char *, int); + void read_network_layers(std::vector, std::vector, char *, + int); //include input and output layer (hidden layers + 2) + void read_layer_size(std::vector, std::vector, char *, int); + void read_weight(std::vector, std::vector, FILE *, char *, + int *); //weights should be formatted as properly shaped matrices + void read_bias(std::vector, std::vector, FILE *, char *, + int *); //biases should be formatted as properly shaped vectors + void read_activation_functions(std::vector, std::vector, char *, int); + void read_screening(std::vector, std::vector, char *, int); + void read_mass(const std::vector &, const std::vector &, const char *, + int); + bool check_potential(); //after finishing reading potential file + void propagateforward(double *, double **, int, + int); //called by compute to get force and energy + void propagateforwardspin(double *, double **, double **, int, + int); //called by compute to get force and energy + void screening(int, int, int); + void cull_neighbor_list(int *, int, int); + void screen_neighbor_list(int *); +}; + +} // namespace LAMMPS_NS #endif #endif - - - diff --git a/src/ML-RANN/rann_activation.h b/src/ML-RANN/rann_activation.h index 045d37a273..ce2074acda 100644 --- a/src/ML-RANN/rann_activation.h +++ b/src/ML-RANN/rann_activation.h @@ -31,11 +31,10 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #ifndef LMP_RANN_ACTIVATION_H #define LMP_RANN_ACTIVATION_H - namespace LAMMPS_NS { - namespace RANN { - class Activation { - public: +namespace RANN { + class Activation { + public: Activation(class PairRANN *); virtual ~Activation(); virtual double activation_function(double); @@ -43,30 +42,23 @@ namespace LAMMPS_NS { virtual double ddactivation_function(double); bool empty; const char *style; - }; + }; - Activation::Activation(PairRANN *) { + Activation::Activation(PairRANN *) + { empty = true; style = "empty"; - } - - Activation::~Activation() { - } - - //default is linear activation (no change). - double Activation::activation_function(double A) { - return A; - } - - double Activation::dactivation_function(double) { - return 1.0; - } - - double Activation::ddactivation_function(double) { - return 0.0; - } } -} + Activation::~Activation() {} + + //default is linear activation (no change). + double Activation::activation_function(double A) { return A; } + + double Activation::dactivation_function(double) { return 1.0; } + + double Activation::ddactivation_function(double) { return 0.0; } +} // namespace RANN +} // namespace LAMMPS_NS #endif /* RANN_ACTIVATION_H_ */ diff --git a/src/ML-RANN/rann_activation_linear.h b/src/ML-RANN/rann_activation_linear.h index 4afc4bc61d..930ce70ee0 100644 --- a/src/ML-RANN/rann_activation_linear.h +++ b/src/ML-RANN/rann_activation_linear.h @@ -33,35 +33,28 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_activation.h" namespace LAMMPS_NS { - namespace RANN { +namespace RANN { - class Activation_linear : public Activation { - public: - Activation_linear(class PairRANN *); - double activation_function(double); - double dactivation_function(double); - double ddactivation_function(double); - }; + class Activation_linear : public Activation { + public: + Activation_linear(class PairRANN *); + double activation_function(double); + double dactivation_function(double); + double ddactivation_function(double); + }; - Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair) { - empty = false; - style = "linear"; - } - - double Activation_linear::activation_function(double A) - { - return A; - } - - double Activation_linear::dactivation_function(double) - { - return 1.0; - } - - double Activation_linear::ddactivation_function(double) { - return 0.0; - } + Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair) + { + empty = false; + style = "linear"; } -} + + double Activation_linear::activation_function(double A) { return A; } + + double Activation_linear::dactivation_function(double) { return 1.0; } + + double Activation_linear::ddactivation_function(double) { return 0.0; } +} // namespace RANN +} // namespace LAMMPS_NS #endif /* ACTIVATION_LINEAR_H_ */ diff --git a/src/ML-RANN/rann_activation_sig_i.h b/src/ML-RANN/rann_activation_sig_i.h index 9983862b31..fc82fe300d 100644 --- a/src/ML-RANN/rann_activation_sig_i.h +++ b/src/ML-RANN/rann_activation_sig_i.h @@ -34,37 +34,42 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_activation.h" namespace LAMMPS_NS { - namespace RANN { +namespace RANN { - class Activation_sigI : public Activation { - public: + class Activation_sigI : public Activation { + public: Activation_sigI(class PairRANN *); double activation_function(double); double dactivation_function(double); double ddactivation_function(double); - }; + }; - Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair) { + Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair) + { empty = false; style = "sigI"; - } - - double Activation_sigI::activation_function(double in) { - if (in>34)return in; - return 0.1*in + 0.9*log(exp(in) + 1); - } - - double Activation_sigI::dactivation_function(double in) { - if (in>34)return 1; - return 0.1 + 0.9/(exp(in)+1)*exp(in); - } - - double Activation_sigI::ddactivation_function(double in) { - if (in>34)return 0; - return 0.9*exp(in)/(exp(in)+1)/(exp(in)+1);; - } - } -} + + double Activation_sigI::activation_function(double in) + { + if (in > 34) return in; + return 0.1 * in + 0.9 * log(exp(in) + 1); + } + + double Activation_sigI::dactivation_function(double in) + { + if (in > 34) return 1; + return 0.1 + 0.9 / (exp(in) + 1) * exp(in); + } + + double Activation_sigI::ddactivation_function(double in) + { + if (in > 34) return 0; + return 0.9 * exp(in) / (exp(in) + 1) / (exp(in) + 1); + ; + } + +} // namespace RANN +} // namespace LAMMPS_NS #endif /* ACTIVATION_SIGI_H_ */ diff --git a/src/ML-RANN/rann_fingerprint.h b/src/ML-RANN/rann_fingerprint.h index 5a32a1c74d..628a4c025a 100644 --- a/src/ML-RANN/rann_fingerprint.h +++ b/src/ML-RANN/rann_fingerprint.h @@ -74,7 +74,7 @@ namespace RANN { { } - virtual int get_length(){return 0;}; + virtual int get_length() { return 0; }; virtual double cutofffunction(double, double, double); virtual void generate_rinvssqrttable(); bool spin; diff --git a/src/ML-RANN/rann_fingerprint_bond.h b/src/ML-RANN/rann_fingerprint_bond.h index 041c29a742..cc844993cc 100644 --- a/src/ML-RANN/rann_fingerprint_bond.h +++ b/src/ML-RANN/rann_fingerprint_bond.h @@ -34,39 +34,41 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { +namespace RANN { - class Fingerprint_bond : public Fingerprint { - public: - Fingerprint_bond(PairRANN *); - ~Fingerprint_bond(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - void compute_fingerprint(double*,double*,double*,double*,int,int,double *,double *,double *,int *,int,int *); - void do3bodyfeatureset_doubleneighborloop(double *,double *,double *,double *,int,int,double *,double *,double *,int *,int,int *); - void do3bodyfeatureset_singleneighborloop(double *,double *,double *,double *,int,int,double *,double *,double *,int *,int,int *); - void generate_exp_cut_table(); - void generate_coefficients(); - int get_length(); + class Fingerprint_bond : public Fingerprint { + public: + Fingerprint_bond(PairRANN *); + ~Fingerprint_bond(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *, + double *, int *, int, int *); + void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, int, int, + double *, double *, double *, int *, int, int *); + void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, int, int, + double *, double *, double *, int *, int, int *); + void generate_exp_cut_table(); + void generate_coefficients(); + int get_length(); - double *expcuttable; - double *dfctable; - double dr; - double *alpha_k; - double re; - int **coeff; - int **coeffx; - int **coeffy; - int **coeffz; - int kmax; - int mlength; - int **Mf; + double *expcuttable; + double *dfctable; + double dr; + double *alpha_k; + double re; + int **coeff; + int **coeffx; + int **coeffy; + int **coeffz; + int kmax; + int mlength; + int **Mf; + }; - }; - - } -} +} // namespace RANN +} // namespace LAMMPS_NS #endif /* FINGERPRINT_BOND_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_bondscreened.h b/src/ML-RANN/rann_fingerprint_bondscreened.h index 71083cc04f..17f2874f7b 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreened.h +++ b/src/ML-RANN/rann_fingerprint_bondscreened.h @@ -34,39 +34,46 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { +namespace RANN { - class Fingerprint_bondscreened : public Fingerprint { - public: - Fingerprint_bondscreened(PairRANN *); - ~Fingerprint_bondscreened(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); - void do3bodyfeatureset_doubleneighborloop(double *,double *,double *,double *,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); - void do3bodyfeatureset_singleneighborloop(double *,double *,double *,double *,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); - void generate_exp_cut_table(); - void generate_coefficients(); - int get_length(); + class Fingerprint_bondscreened : public Fingerprint { + public: + Fingerprint_bondscreened(PairRANN *); + ~Fingerprint_bondscreened(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, bool *, int, int, double *, + double *, double *, int *, int, int *); + void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, + double *, bool *, int, int, double *, double *, + double *, int *, int, int *); + void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, + double *, bool *, int, int, double *, double *, + double *, int *, int, int *); + void generate_exp_cut_table(); + void generate_coefficients(); + int get_length(); - double *expcuttable; - double *dfctable; - double dr; - double *alpha_k; - double re; - int **coeff; - int **coeffx; - int **coeffy; - int **coeffz; - int kmax; - int mlength; - int **Mf; + double *expcuttable; + double *dfctable; + double dr; + double *alpha_k; + double re; + int **coeff; + int **coeffx; + int **coeffy; + int **coeffz; + int kmax; + int mlength; + int **Mf; + }; +} // namespace RANN - }; - } - -} +} // namespace LAMMPS_NS #endif /* FINGERPRINT_BOND_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.h b/src/ML-RANN/rann_fingerprint_bondscreenedspin.h index 6a0df27f80..306fa9ae75 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.h +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.h @@ -34,39 +34,46 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { +namespace RANN { - class Fingerprint_bondscreenedspin : public Fingerprint { - public: - Fingerprint_bondscreenedspin(PairRANN *); - ~Fingerprint_bondscreenedspin(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); - void do3bodyfeatureset_doubleneighborloop(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int *); - void do3bodyfeatureset_singleneighborloop(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); - void generate_exp_cut_table(); - void generate_coefficients(); - int get_length(); + class Fingerprint_bondscreenedspin : public Fingerprint { + public: + Fingerprint_bondscreenedspin(PairRANN *); + ~Fingerprint_bondscreenedspin(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, + bool *, int, int, double *, double *, double *, int *, int, int *); + void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, + double *, double *, double *, double *, bool *, int, + int, double *, double *, double *, int *, int, int *); + void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, + double *, double *, double *, double *, bool *, int, + int, double *, double *, double *, int *, int, int *); + void generate_exp_cut_table(); + void generate_coefficients(); + int get_length(); - double *expcuttable; - double *dfctable; - double dr; - double *alpha_k; - double re; - int **coeff; - int **coeffx; - int **coeffy; - int **coeffz; - int kmax; - int mlength; - int **Mf; + double *expcuttable; + double *dfctable; + double dr; + double *alpha_k; + double re; + int **coeff; + int **coeffx; + int **coeffy; + int **coeffz; + int kmax; + int mlength; + int **Mf; + }; - }; - - } -} +} // namespace RANN +} // namespace LAMMPS_NS #endif /* FINGERPRINT_BOND_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_bondspin.h b/src/ML-RANN/rann_fingerprint_bondspin.h index 9ab8008189..e3577fdb3a 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.h +++ b/src/ML-RANN/rann_fingerprint_bondspin.h @@ -34,38 +34,43 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { - class Fingerprint_bondspin : public Fingerprint { - public: - Fingerprint_bondspin(PairRANN *); - ~Fingerprint_bondspin(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);//spin - void do3bodyfeatureset_doubleneighborloop(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); - void do3bodyfeatureset_singleneighborloop(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); - void generate_exp_cut_table(); - void generate_coefficients(); - int get_length(); +namespace RANN { + class Fingerprint_bondspin : public Fingerprint { + public: + Fingerprint_bondspin(PairRANN *); + ~Fingerprint_bondspin(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + double *, int, int, double *, double *, double *, int *, int, + int *); //spin + void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, + double *, double *, int, int, double *, double *, + double *, int *, int, int *); + void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, double *, + double *, double *, int, int, double *, double *, + double *, int *, int, int *); + void generate_exp_cut_table(); + void generate_coefficients(); + int get_length(); - double *expcuttable; - double *dfctable; - double dr; - double *alpha_k; - double re; - int **coeff; - int **coeffx; - int **coeffy; - int **coeffz; - int kmax; - int mlength; - int **Mf; + double *expcuttable; + double *dfctable; + double dr; + double *alpha_k; + double re; + int **coeff; + int **coeffx; + int **coeffy; + int **coeffz; + int kmax; + int mlength; + int **Mf; + }; - }; - - } -} +} // namespace RANN +} // namespace LAMMPS_NS #endif /* FINGERPRINT_BOND_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_radial.h b/src/ML-RANN/rann_fingerprint_radial.h index d5a73a486c..1b5e6bf479 100644 --- a/src/ML-RANN/rann_fingerprint_radial.h +++ b/src/ML-RANN/rann_fingerprint_radial.h @@ -34,30 +34,30 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { +namespace RANN { - class Fingerprint_radial : public Fingerprint { - public: - Fingerprint_radial(PairRANN *); - ~Fingerprint_radial(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - void compute_fingerprint(double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); - int get_length(); + class Fingerprint_radial : public Fingerprint { + public: + Fingerprint_radial(PairRANN *); + ~Fingerprint_radial(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *, + double *, int *, int, int *); + int get_length(); - double *radialtable; - double *dfctable; - double dr; - double *alpha; - double re; - int nmax;//highest term - int omin;//lowest term + double *radialtable; + double *dfctable; + double dr; + double *alpha; + double re; + int nmax; //highest term + int omin; //lowest term + }; - }; - - } -} +} // namespace RANN +} // namespace LAMMPS_NS #endif /* FINGERPRINT_RADIAL_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_radialscreened.h b/src/ML-RANN/rann_fingerprint_radialscreened.h index ef7d612902..180bc5823d 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreened.h +++ b/src/ML-RANN/rann_fingerprint_radialscreened.h @@ -34,29 +34,30 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { - class Fingerprint_radialscreened : public Fingerprint { - public: - Fingerprint_radialscreened(PairRANN *); - ~Fingerprint_radialscreened(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); - int get_length(); +namespace RANN { + class Fingerprint_radialscreened : public Fingerprint { + public: + Fingerprint_radialscreened(PairRANN *); + ~Fingerprint_radialscreened(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, bool *, int, int, double *, + double *, double *, int *, int, int *); + int get_length(); - double *radialtable; - double *dfctable; - double dr; - double *alpha; - double re; - int nmax;//highest term - int omin;//lowest term + double *radialtable; + double *dfctable; + double dr; + double *alpha; + double re; + int nmax; //highest term + int omin; //lowest term + }; +} // namespace RANN - }; -} - -} +} // namespace LAMMPS_NS #endif /* FINGERPRINT_RADIALSCREENED_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_radialscreenedspin.h b/src/ML-RANN/rann_fingerprint_radialscreenedspin.h index 646a0b93f1..5bf3cc07ef 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreenedspin.h +++ b/src/ML-RANN/rann_fingerprint_radialscreenedspin.h @@ -34,29 +34,31 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { - class Fingerprint_radialscreenedspin : public Fingerprint { - public: - Fingerprint_radialscreenedspin(PairRANN *); - ~Fingerprint_radialscreenedspin(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);//spin,screen - int get_length(); +namespace RANN { + class Fingerprint_radialscreenedspin : public Fingerprint { + public: + Fingerprint_radialscreenedspin(PairRANN *); + ~Fingerprint_radialscreenedspin(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, + double *, double *, bool *, int, int, double *, double *, + double *, int *, int, int *); //spin,screen + int get_length(); - double *radialtable; - double *dfctable; - double dr; - double *alpha; - double re; - int nmax;//highest term - int omin;//lowest term + double *radialtable; + double *dfctable; + double dr; + double *alpha; + double re; + int nmax; //highest term + int omin; //lowest term + }; +} // namespace RANN - }; - } - -} +} // namespace LAMMPS_NS #endif /* FINGERPRINT_RADIALSCREENED_H_ */ diff --git a/src/ML-RANN/rann_fingerprint_radialspin.h b/src/ML-RANN/rann_fingerprint_radialspin.h index 90c3ce1f22..3bab1a0e28 100644 --- a/src/ML-RANN/rann_fingerprint_radialspin.h +++ b/src/ML-RANN/rann_fingerprint_radialspin.h @@ -34,29 +34,29 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint.h" namespace LAMMPS_NS { - namespace RANN { - class Fingerprint_radialspin : public Fingerprint { - public: - Fingerprint_radialspin(PairRANN *); - ~Fingerprint_radialspin(); - bool parse_values(std::string,std::vector); - void write_values(FILE *); - void init(int*,int); - void allocate(); - void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); - int get_length(); +namespace RANN { + class Fingerprint_radialspin : public Fingerprint { + public: + Fingerprint_radialspin(PairRANN *); + ~Fingerprint_radialspin(); + bool parse_values(std::string, std::vector); + void write_values(FILE *); + void init(int *, int); + void allocate(); + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, + int, int, double *, double *, double *, int *, int, int *); + int get_length(); - double *radialtable; - double *dfctable; - double dr; - double *alpha; - double re; - int nmax;//highest term - int omin;//lowest term + double *radialtable; + double *dfctable; + double dr; + double *alpha; + double re; + int nmax; //highest term + int omin; //lowest term + }; +} // namespace RANN - }; - } - -} +} // namespace LAMMPS_NS #endif /* FINGERPRINT_RADIAL_H_ */ diff --git a/src/ML-SNAP/pair_snap.h b/src/ML-SNAP/pair_snap.h index afce4bf895..af24685ec1 100644 --- a/src/ML-SNAP/pair_snap.h +++ b/src/ML-SNAP/pair_snap.h @@ -56,7 +56,7 @@ class PairSNAP : public Pair { double **coeffelem; // element bispectrum coefficients double **beta; // betas for all atoms in list double **bispectrum; // bispectrum components for all atoms in list - double **scale; // for thermodynamic integration + double **scale; // for thermodynamic integration int twojmax, switchflag, bzeroflag, bnormflag; int chemflag, wselfallflag; int chunksize; diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index c5f8f8c165..dc3dffbf80 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -114,7 +114,7 @@ void DumpAtomMPIIO::openfile() mpifo = 0; - MPI_File_set_size(mpifh, (MPI_Offset)(headerSize + sumFileSize)); + MPI_File_set_size(mpifh, (MPI_Offset) (headerSize + sumFileSize)); currentFileSize = (headerSize + sumFileSize); } } diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index e17d54e76a..5e7ce7dbb7 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -129,7 +129,7 @@ void DumpCustomMPIIO::openfile() mpifo = 0; - MPI_File_set_size(mpifh, (MPI_Offset)(headerSize + sumFileSize)); + MPI_File_set_size(mpifh, (MPI_Offset) (headerSize + sumFileSize)); currentFileSize = (headerSize + sumFileSize); } } diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp index eacb774372..2bcc710d42 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp @@ -221,7 +221,8 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th } if (EVFLAG) - ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair_i, delx, dely, delz, thr); + ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair_i, delx, dely, delz, + thr); } } f[i].x += fxtmp; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h index f13313b511..093d0a8a42 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h @@ -33,10 +33,10 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public protected: template - void eval(int ifrom, int ito, ThrData * const thr); + void eval(int ifrom, int ito, ThrData *const thr); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h index ab4c6ebdae..0d13c4a92e 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h @@ -34,10 +34,10 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi protected: template - void eval(int ifrom, int ito, ThrData * const thr); + void eval(int ifrom, int ito, ThrData *const thr); }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/OPENMP/pair_reaxff_omp.h b/src/OPENMP/pair_reaxff_omp.h index cced5861be..3e8ebac284 100644 --- a/src/OPENMP/pair_reaxff_omp.h +++ b/src/OPENMP/pair_reaxff_omp.h @@ -48,31 +48,29 @@ class PairReaxFFOMP : public PairReaxFF, public ThrOMP { reduce_thr(styleparm, eflagparm, vflagparm, thrparm); } - inline void ev_tally_thr_proxy(const int iparm, const int jparm, - const int nlocalparm, const int newton_pairparm, - const double evdwlparm, const double ecoulparm, - const double fpairparm, const double delxparm, - const double delyparm, const double delzparm, - ThrData *const thrparm) + inline void ev_tally_thr_proxy(const int iparm, const int jparm, const int nlocalparm, + const int newton_pairparm, const double evdwlparm, + const double ecoulparm, const double fpairparm, + const double delxparm, const double delyparm, + const double delzparm, ThrData *const thrparm) { - ev_tally_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, - fpairparm, delxparm, delyparm, delzparm, thrparm); + ev_tally_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fpairparm, + delxparm, delyparm, delzparm, thrparm); } - inline void ev_tally_xyz_thr_proxy(const int iparm, const int jparm, - const int nlocalparm, const int newton_pairparm, - const double evdwlparm, const double ecoulparm, - const double fxparm, const double fyparm, const double fzparm, + inline void ev_tally_xyz_thr_proxy(const int iparm, const int jparm, const int nlocalparm, + const int newton_pairparm, const double evdwlparm, + const double ecoulparm, const double fxparm, + const double fyparm, const double fzparm, const double delxparm, const double delyparm, const double delzparm, ThrData *const thrparm) { - ev_tally_xyz_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, - fxparm, fyparm, fzparm, delxparm, delyparm, delzparm, thrparm); + ev_tally_xyz_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fxparm, + fyparm, fzparm, delxparm, delyparm, delzparm, thrparm); } - inline void ev_tally3_thr_proxy(int i, int j, int k, double evdwl, - double ecoul, double *fj, double *fk, double *drji, double *drki, - ThrData *const thrparm) + inline void ev_tally3_thr_proxy(int i, int j, int k, double evdwl, double ecoul, double *fj, + double *fk, double *drji, double *drki, ThrData *const thrparm) { ev_tally3_thr(this, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm); } diff --git a/src/OPENMP/reaxff_omp.h b/src/OPENMP/reaxff_omp.h index 252e5f0e9d..a8fda4d247 100644 --- a/src/OPENMP/reaxff_omp.h +++ b/src/OPENMP/reaxff_omp.h @@ -27,77 +27,73 @@ #include #endif -namespace ReaxFF +namespace ReaxFF { +// exported Functions + +// bond orders OpenMP + +extern void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **); +extern void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **); +extern int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *, + single_body_parameters *, single_body_parameters *, two_body_parameters *, int, + double, double, double, double, double, double, double); + +extern void BOOMP(reax_system *, storage *, reax_list **); + +// bonds OpenMP + +extern void BondsOMP(reax_system *, simulation_data *, storage *, reax_list **); + +// forces OpenMP + +extern void Compute_ForcesOMP(reax_system *, control_params *, simulation_data *, storage *, + reax_list **); + +// hydrogen bonds + +extern void Hydrogen_BondsOMP(reax_system *, control_params *, simulation_data *, storage *, + reax_list **); + +// init md OpenMP + +extern void InitializeOMP(reax_system *, control_params *, simulation_data *, storage *, + reax_list **, MPI_Comm); + +// multi body + +extern void Atom_EnergyOMP(reax_system *, simulation_data *, storage *, reax_list **); + +// nonbonded + +extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *, simulation_data *, storage *, + reax_list **); +extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); +extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *, int, int, double, + LR_data *); + +// torsion angles + +extern void Torsion_AnglesOMP(reax_system *, control_params *, simulation_data *, storage *, + reax_list **); + +// valence angles + +extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *); +extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double, rvec *, rvec *, rvec *); +extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *, storage *, + reax_list **); + +// OpenMP helpers + +inline int get_tid() { - // exported Functions - - // bond orders OpenMP - - extern void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **); - extern void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **); - extern int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *, - single_body_parameters *, single_body_parameters *, - two_body_parameters *, int, double, double, double, - double, double, double, double); - - extern void BOOMP(reax_system *, storage *, reax_list **); - - // bonds OpenMP - - extern void BondsOMP(reax_system *, simulation_data *, - storage *, reax_list **); - - // forces OpenMP - - extern void Compute_ForcesOMP(reax_system *, control_params *, - simulation_data *, storage *, reax_list **); - - // hydrogen bonds - - extern void Hydrogen_BondsOMP(reax_system *, control_params *, - simulation_data *, storage *, reax_list **); - - // init md OpenMP - - extern void InitializeOMP(reax_system *, control_params *, simulation_data *, - storage *, reax_list **,MPI_Comm); - - // multi body - - extern void Atom_EnergyOMP(reax_system *, simulation_data *, storage *, reax_list **); - - // nonbonded - - extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *, - simulation_data *, storage *, reax_list **); - extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *, - simulation_data *, storage *, - reax_list **); - extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *, - int, int, double, LR_data *); - - // torsion angles - - extern void Torsion_AnglesOMP(reax_system *, control_params *, - simulation_data *, storage *, reax_list **); - - // valence angles - - extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *); - extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double, - rvec *, rvec *, rvec *); - extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *, - storage *, reax_list **); - - // OpenMP helpers - - inline int get_tid() { #if defined(_OPENMP) - return omp_get_thread_num(); + return omp_get_thread_num(); #else - return 0; + return 0; #endif - } } +} // namespace ReaxFF #endif diff --git a/src/OPENMP/thr_omp.h b/src/OPENMP/thr_omp.h index 02fdbdf25b..c35ca9a056 100644 --- a/src/OPENMP/thr_omp.h +++ b/src/OPENMP/thr_omp.h @@ -135,8 +135,10 @@ class ThrOMP { void ev_tally_xyz_full_thr(Pair *const, const int, const double, const double, const double, const double, const double, const double, const double, const double, ThrData *const); - void v_tally2_thr(Pair *const, const int, const int, const double, const double *const, ThrData *const); - void v_tally2_newton_thr(Pair *const, const int, const double *const, const double *const, ThrData *const); + void v_tally2_thr(Pair *const, const int, const int, const double, const double *const, + ThrData *const); + void v_tally2_newton_thr(Pair *const, const int, const double *const, const double *const, + ThrData *const); void ev_tally3_thr(Pair *const, const int, const int, const int, const double, const double, const double *const, const double *const, const double *const, const double *const, ThrData *const); diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 04fb33eec4..22fade7bf3 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -1340,13 +1340,17 @@ void FixSRD::collisions_single() std::string mesg; if (type != WALL) mesg = fmt::format("SRD particle {} started inside big particle {} on step {} " - " bounce {}", tag[i], tag[j], update->ntimestep, ibounce + 1); + " bounce {}", + tag[i], tag[j], update->ntimestep, ibounce + 1); else mesg = fmt::format("SRD particle {} started inside wall {} on step {} " - "bounce {}", tag[i], j, update->ntimestep, ibounce + 1); + "bounce {}", + tag[i], j, update->ntimestep, ibounce + 1); - if (insideflag == INSIDE_ERROR) error->one(FLERR, mesg); - else error->warning(FLERR, mesg); + if (insideflag == INSIDE_ERROR) + error->one(FLERR, mesg); + else + error->warning(FLERR, mesg); } break; } @@ -1490,10 +1494,12 @@ void FixSRD::collisions_multi() std::string mesg; if (type != WALL) mesg = fmt::format("SRD particle {} started inside big particle {} on step {} " - "bounce {}", tag[i], tag[j], update->ntimestep, ibounce + 1); + "bounce {}", + tag[i], tag[j], update->ntimestep, ibounce + 1); else mesg = fmt::format("SRD particle {} started inside wall {} on step {} " - "bounce {}", tag[i], j, update->ntimestep, ibounce + 1); + "bounce {}", + tag[i], j, update->ntimestep, ibounce + 1); if (insideflag == INSIDE_ERROR) error->one(FLERR, mesg); error->warning(FLERR, mesg); diff --git a/src/TALLY/compute_force_tally.cpp b/src/TALLY/compute_force_tally.cpp index 8216269fe0..1a01d3f661 100644 --- a/src/TALLY/compute_force_tally.cpp +++ b/src/TALLY/compute_force_tally.cpp @@ -214,6 +214,6 @@ void ComputeForceTally::compute_peratom() double ComputeForceTally::memory_usage() { - double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double); + double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double); return bytes; } diff --git a/src/TALLY/compute_heat_flux_tally.cpp b/src/TALLY/compute_heat_flux_tally.cpp index 7bff99eeb7..c11cd61b12 100644 --- a/src/TALLY/compute_heat_flux_tally.cpp +++ b/src/TALLY/compute_heat_flux_tally.cpp @@ -281,6 +281,6 @@ void ComputeHeatFluxTally::compute_vector() double ComputeHeatFluxTally::memory_usage() { - double bytes = (nmax < 0) ? 0 : nmax * (double)comm_reverse * sizeof(double); + double bytes = (nmax < 0) ? 0 : nmax * (double) comm_reverse * sizeof(double); return bytes; } diff --git a/src/TALLY/compute_heat_flux_virial_tally.cpp b/src/TALLY/compute_heat_flux_virial_tally.cpp index 8605b9c546..ddf56cb4d8 100644 --- a/src/TALLY/compute_heat_flux_virial_tally.cpp +++ b/src/TALLY/compute_heat_flux_virial_tally.cpp @@ -233,6 +233,6 @@ void ComputeHeatFluxVirialTally::compute_peratom() double ComputeHeatFluxVirialTally::memory_usage() { - double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double); + double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double); return bytes; } diff --git a/src/TALLY/compute_pe_tally.cpp b/src/TALLY/compute_pe_tally.cpp index 07cb500e44..a455b3f7d6 100644 --- a/src/TALLY/compute_pe_tally.cpp +++ b/src/TALLY/compute_pe_tally.cpp @@ -203,6 +203,6 @@ void ComputePETally::compute_peratom() double ComputePETally::memory_usage() { - double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double); + double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double); return bytes; } diff --git a/src/TALLY/compute_stress_tally.cpp b/src/TALLY/compute_stress_tally.cpp index dea65ade26..05fc362e62 100644 --- a/src/TALLY/compute_stress_tally.cpp +++ b/src/TALLY/compute_stress_tally.cpp @@ -253,6 +253,6 @@ void ComputeStressTally::compute_peratom() double ComputeStressTally::memory_usage() { - double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double); + double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double); return bytes; }