apply clang-format to packages

This commit is contained in:
Axel Kohlmeyer
2021-08-23 21:05:48 -04:00
parent 686f41731f
commit 9a19a814e4
97 changed files with 2029 additions and 2038 deletions

View File

@ -49,7 +49,8 @@ AtomVecOxdna::AtomVecOxdna(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); 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");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -17,12 +17,12 @@
#include "bond_oxdna_fene.h" #include "bond_oxdna_fene.h"
#include "atom.h" #include "atom.h"
#include "neighbor.h"
#include "comm.h" #include "comm.h"
#include "update.h" #include "error.h"
#include "force.h" #include "force.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "neighbor.h"
#include "update.h"
#include "atom_vec_ellipsoid.h" #include "atom_vec_ellipsoid.h"
#include "math_extra.h" #include "math_extra.h"
@ -43,12 +43,11 @@ BondOxdnaFene::~BondOxdnaFene()
} }
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
compute vector COM-sugar-phosphate backbone interaction site in oxDNA compute vector COM-sugar-phosphate backbone interaction site in oxDNA
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3], void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3], double /*e3*/[3],
double /*e3*/[3], double r[3]) const double r[3]) const
{ {
constexpr double d_cs = -0.4; constexpr double d_cs = -0.4;
@ -61,16 +60,15 @@ void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3],
tally energy and virial into global and per-atom accumulators tally energy and virial into global and per-atom accumulators
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, double ebond, double fx,
double ebond, double fy, double fz, double delx, double dely, double delz)
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_either) {
if (eflag_global) { if (eflag_global) {
if (newton_bond) energy += ebond; if (newton_bond)
energy += ebond;
else { else {
ebondhalf = 0.5 * ebond; ebondhalf = 0.5 * ebond;
if (i < nlocal) energy += ebondhalf; if (i < nlocal) energy += ebondhalf;
@ -208,8 +206,8 @@ void BondOxdnaFene::compute(int eflag, int vflag)
// if r > 2*Delta something serious is wrong, abort // if r > 2*Delta something serious is wrong, abort
if (rlogarg < 0.1) { if (rlogarg < 0.1) {
error->warning(FLERR,"FENE bond too long: {} {} {} {}", error->warning(FLERR, "FENE bond too long: {} {} {} {}", update->ntimestep, atom->tag[a],
update->ntimestep,atom->tag[a],atom->tag[b],r); atom->tag[b], r);
rlogarg = 0.1; rlogarg = 0.1;
} }
@ -220,9 +218,7 @@ void BondOxdnaFene::compute(int eflag, int vflag)
// energy // energy
if (eflag) { if (eflag) { ebond = -0.5 * k[type] * log(rlogarg); }
ebond = -0.5 * k[type]*log(rlogarg);
}
// apply force and torque to each of 2 atoms // apply force and torque to each of 2 atoms
@ -237,7 +233,6 @@ void BondOxdnaFene::compute(int eflag, int vflag)
torque[a][0] += delta[0]; torque[a][0] += delta[0];
torque[a][1] += delta[1]; torque[a][1] += delta[1];
torque[a][2] += delta[2]; torque[a][2] += delta[2];
} }
if (newton_bond || b < nlocal) { if (newton_bond || b < nlocal) {
@ -251,18 +246,16 @@ void BondOxdnaFene::compute(int eflag, int vflag)
torque[b][0] -= deltb[0]; torque[b][0] -= deltb[0];
torque[b][1] -= deltb[1]; torque[b][1] -= deltb[1];
torque[b][2] -= deltb[2]; torque[b][2] -= deltb[2];
} }
// increment energy and virial // increment energy and virial
// NOTE: The virial is calculated on the 'molecular' basis. // NOTE: The virial is calculated on the 'molecular' basis.
// (see G. Ciccotti and J.P. Ryckaert, Comp. Phys. Rep. 4, 345-392 (1986)) // (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, if (evflag)
delf[0],delf[1],delf[2],x[a][0]-x[b][0],x[a][1]-x[b][1],x[a][2]-x[b][2]); 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]);
} }
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -278,7 +271,6 @@ void BondOxdnaFene::allocate()
memory->create(setflag, n + 1, "bond:setflag"); memory->create(setflag, n + 1, "bond:setflag");
for (int i = 1; i <= n; i++) setflag[i] = 0; for (int i = 1; i <= n; i++) setflag[i] = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -308,7 +300,6 @@ void BondOxdnaFene::coeff(int narg, char **arg)
} }
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() void BondOxdnaFene::init_style()
{ {
if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) 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");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -371,8 +364,7 @@ void BondOxdnaFene::write_data(FILE *fp)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/, double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/, double &fforce)
double &fforce)
{ {
double r = sqrt(rsq); double r = sqrt(rsq);
double rr0 = r - r0[type]; double rr0 = r - r0[type];
@ -385,8 +377,7 @@ double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/,
// if r > 2*Delta something serious is wrong, abort // if r > 2*Delta something serious is wrong, abort
if (rlogarg < 0.1) { if (rlogarg < 0.1) {
error->warning(FLERR,"FENE bond too long: {} {:.8}", error->warning(FLERR, "FENE bond too long: {} {:.8}", update->ntimestep, sqrt(rsq));
update->ntimestep,sqrt(rsq));
rlogarg = 0.1; rlogarg = 0.1;
} }

View File

@ -29,7 +29,6 @@
#error must have at least zstd version 1.4 to compile with -DLAMMPS_ZSTD #error must have at least zstd version 1.4 to compile with -DLAMMPS_ZSTD
#endif #endif
namespace LAMMPS_NS { namespace LAMMPS_NS {
class ZstdFileWriter : public FileWriter { class ZstdFileWriter : public FileWriter {

View File

@ -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; int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -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; int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -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; int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -22,11 +22,11 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "neighbor.h" #include "math_const.h"
#include "memory.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "neigh_request.h" #include "neigh_request.h"
#include "memory.h" #include "neighbor.h"
#include "math_const.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
@ -159,7 +159,6 @@ void PairCoulCutDielectric::compute(int eflag, int vflag)
if (vflag_fdotr) virial_fdotr_compute(); if (vflag_fdotr) virial_fdotr_compute();
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
init specific to this pair style init specific to this pair style
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -176,10 +175,8 @@ void PairCoulCutDielectric::init_style()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/, double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq,
double rsq, double factor_coul, double /*factor_lj*/, double &fforce)
double factor_coul, double /*factor_lj*/,
double &fforce)
{ {
double r2inv, phicoul, ei, ej; double r2inv, phicoul, ei, ej;
double *eps = atom->epsilon; double *eps = atom->epsilon;
@ -188,10 +185,14 @@ double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/,
fforce = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv) * eps[i]; fforce = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv) * eps[i];
double eng = 0.0; double eng = 0.0;
if (eps[i] == 1) ei = 0; if (eps[i] == 1)
else ei = eps[i]; ei = 0;
if (eps[j] == 1) ej = 0; else
else ej = eps[j]; 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 = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv);
phicoul *= 0.5 * (ei + ej); phicoul *= 0.5 * (ei + ej);
eng += factor_coul * phicoul; eng += factor_coul * phicoul;

View File

@ -267,7 +267,8 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
if (eflag) evdwl = f * (rn * (rn * lj3i[jtype] - lj4i[jtype]) - offseti[jtype]); 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; fpair_i = (force_coul * etmp + force_lj) * r2inv;
f[i][0] += delx * fpair_i; f[i][0] += delx * fpair_i;

View File

@ -15,11 +15,11 @@
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "force.h"
#include "neigh_list.h"
#include "memory.h"
#include "math_special.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "math_special.h"
#include "memory.h"
#include "neigh_list.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
@ -35,9 +35,7 @@ using namespace MathSpecial;
PairMorseSoft::~PairMorseSoft() PairMorseSoft::~PairMorseSoft()
{ {
if (allocated) { if (allocated) { memory->destroy(lambda); }
memory->destroy(lambda);
}
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -131,7 +129,6 @@ void PairMorseSoft::compute(int eflag, int vflag)
fpair *= factor_lj; fpair *= factor_lj;
f[i][0] += delx * fpair; f[i][0] += delx * fpair;
f[i][1] += dely * fpair; f[i][1] += dely * fpair;
f[i][2] += delz * fpair; f[i][2] += delz * fpair;
@ -142,12 +139,9 @@ void PairMorseSoft::compute(int eflag, int vflag)
f[j][2] -= delz * fpair; f[j][2] -= delz * fpair;
} }
if (eflag) { if (eflag) { evdwl = phi * factor_lj; }
evdwl = phi*factor_lj;
}
if (evflag) ev_tally(i,j,nlocal,newton_pair, if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz);
evdwl,0.0,fpair,delx,dely,delz);
} }
} }
} }
@ -225,15 +219,13 @@ void PairMorseSoft::settings(int narg, char **arg)
} }
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
init for one type pair i,j and corresponding j,i init for one type pair i,j and corresponding j,i
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double PairMorseSoft::init_one(int i, int j) double PairMorseSoft::init_one(int i, int j)
{ {
if (setflag[i][j] == 0) if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set");
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];
@ -263,7 +255,8 @@ double PairMorseSoft::init_one(int i, int j)
offset[i][j] = V0 + B * dexp3; offset[i][j] = V0 + B * dexp3;
offset[i][j] *= llf; offset[i][j] *= llf;
} }
} else offset[i][j] = 0.0; } else
offset[i][j] = 0.0;
d0[j][i] = d0[i][j]; d0[j][i] = d0[i][j];
alpha[j][i] = alpha[i][j]; alpha[j][i] = alpha[i][j];
@ -366,7 +359,6 @@ void PairMorseSoft::read_restart_settings(FILE *fp)
MPI_Bcast(&mix_flag, 1, MPI_INT, 0, world); MPI_Bcast(&mix_flag, 1, MPI_INT, 0, world);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
proc 0 writes to data file proc 0 writes to data file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -374,8 +366,7 @@ void PairMorseSoft::read_restart_settings(FILE *fp)
void PairMorseSoft::write_data(FILE *fp) void PairMorseSoft::write_data(FILE *fp)
{ {
for (int i = 1; i <= atom->ntypes; i++) 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], fprintf(fp, "%d %g %g %g %g\n", i, d0[i][i], alpha[i][i], r0[i][i], lambda[i][i]);
lambda[i][i]);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -386,15 +377,14 @@ void PairMorseSoft::write_data_all(FILE *fp)
{ {
for (int i = 1; i <= atom->ntypes; i++) for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++) 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], fprintf(fp, "%d %d %g %g %g %g %g\n", i, j, d0[i][j], alpha[i][j], r0[i][j], lambda[i][j],
lambda[i][j],cut[i][j]); cut[i][j]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
double /*factor_coul*/, double factor_lj, double /*factor_coul*/, double factor_lj, double &fforce)
double &fforce)
{ {
double r, dr, dexp, dexp2, dexp3, phi; double r, dr, dexp, dexp2, dexp3, phi;
double B, D, a, ea, iea2; double B, D, a, ea, iea2;

View File

@ -592,4 +592,3 @@ double ComputeFabric::compute_scalar()
scalar = nc; scalar = nc;
return nc; return nc;
} }

View File

@ -67,8 +67,8 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
// this is so final order of Modify:fix will conform to input script // this is so final order of Modify:fix will conform to input script
fix_history = nullptr; fix_history = nullptr;
fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY" fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) +
+ std::to_string(instance_me) + " all DUMMY"); " all DUMMY");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -79,8 +79,10 @@ PairGranHookeHistory::~PairGranHookeHistory()
delete[] svector; delete[] svector;
if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me)); if (!fix_history)
else modify->delete_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me)); 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) { if (allocated) {
memory->destroy(setflag); memory->destroy(setflag);
@ -132,8 +134,10 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
} }
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]]; if (body[i] >= 0)
else mass_rigid[i] = 0.0; mass_rigid[i] = mass_body[body[i]];
else
mass_rigid[i] = 0.0;
comm->forward_comm_pair(this); comm->forward_comm_pair(this);
} }
@ -258,8 +262,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
shear[1] += vtr2 * dt; shear[1] += vtr2 * dt;
shear[2] += vtr3 * dt; shear[2] += vtr3 * dt;
} }
shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]);
shear[2]*shear[2]);
// rotate shear displacements // rotate shear displacements
@ -284,16 +287,17 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
if (fs > fn) { if (fs > fn) {
if (shrmag != 0.0) { if (shrmag != 0.0) {
shear[0] = (fn/fs) * (shear[0] + meff*gammat*vtr1/kt) - shear[0] =
meff*gammat*vtr1/kt; (fn / fs) * (shear[0] + meff * gammat * vtr1 / kt) - meff * gammat * vtr1 / kt;
shear[1] = (fn/fs) * (shear[1] + meff*gammat*vtr2/kt) - shear[1] =
meff*gammat*vtr2/kt; (fn / fs) * (shear[1] + meff * gammat * vtr2 / kt) - meff * gammat * vtr2 / kt;
shear[2] = (fn/fs) * (shear[2] + meff*gammat*vtr3/kt) - shear[2] =
meff*gammat*vtr3/kt; (fn / fs) * (shear[2] + meff * gammat * vtr3 / kt) - meff * gammat * vtr3 / kt;
fs1 *= fn / fs; fs1 *= fn / fs;
fs2 *= fn / fs; fs2 *= fn / fs;
fs3 *= fn / fs; fs3 *= fn / fs;
} else fs1 = fs2 = fs3 = 0.0; } else
fs1 = fs2 = fs3 = 0.0;
} }
// forces & torques // forces & torques
@ -321,8 +325,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
torque[j][2] -= radj * tor3; torque[j][2] -= radj * tor3;
} }
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair, if (evflag) ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, fx, fy, fz, delx, dely, delz);
0.0,0.0,fx,fy,fz,delx,dely,delz);
} }
} }
} }
@ -341,8 +344,7 @@ void PairGranHookeHistory::allocate()
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 i = 1; i <= n; i++)
for (int j = i; j <= n; j++) for (int j = i; j <= n; j++) setflag[i][j] = 0;
setflag[i][j] = 0;
memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); memory->create(cutsq, n + 1, n + 1, "pair:cutsq");
@ -361,12 +363,16 @@ 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); kn = utils::numeric(FLERR, arg[0], false, lmp);
if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; if (strcmp(arg[1], "NULL") == 0)
else kt = utils::numeric(FLERR,arg[1],false,lmp); kt = kn * 2.0 / 7.0;
else
kt = utils::numeric(FLERR, arg[1], false, lmp);
gamman = utils::numeric(FLERR, arg[2], false, lmp); gamman = utils::numeric(FLERR, arg[2], false, lmp);
if (strcmp(arg[3],"NULL") == 0) gammat = 0.5 * gamman; if (strcmp(arg[3], "NULL") == 0)
else gammat = utils::numeric(FLERR,arg[3],false,lmp); gammat = 0.5 * gamman;
else
gammat = utils::numeric(FLERR, arg[3], false, lmp);
xmu = utils::numeric(FLERR, arg[4], false, lmp); xmu = utils::numeric(FLERR, arg[4], false, lmp);
dampflag = utils::inumeric(FLERR, arg[5], false, lmp); dampflag = utils::inumeric(FLERR, arg[5], false, lmp);
@ -374,12 +380,14 @@ void PairGranHookeHistory::settings(int narg, char **arg)
limit_damping = 0; limit_damping = 0;
if (narg == 7) { if (narg == 7) {
if (strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; if (strcmp(arg[6], "limit_damping") == 0)
else error->all(FLERR,"Illegal pair_style command"); limit_damping = 1;
else
error->all(FLERR, "Illegal pair_style command");
} }
if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || xmu < 0.0 || xmu > 10000.0 ||
xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) dampflag < 0 || dampflag > 1)
error->all(FLERR, "Illegal pair_style command"); error->all(FLERR, "Illegal pair_style command");
} }
@ -436,16 +444,18 @@ void PairGranHookeHistory::init_style()
if (history && (fix_history == nullptr)) { if (history && (fix_history == nullptr)) {
auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history); auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history);
fix_history = (FixNeighHistory *) modify->replace_fix("NEIGH_HISTORY_HH_DUMMY" fix_history = (FixNeighHistory *) modify->replace_fix(
+ std::to_string(instance_me),cmd,1); "NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1);
fix_history->pair = this; fix_history->pair = this;
} }
// check for FixFreeze and set freeze_group_bit // check for FixFreeze and set freeze_group_bit
int ifreeze = modify->find_fix_by_style("^freeze"); int ifreeze = modify->find_fix_by_style("^freeze");
if (ifreeze < 0) freeze_group_bit = 0; if (ifreeze < 0)
else freeze_group_bit = modify->fix[ifreeze]->groupbit; freeze_group_bit = 0;
else
freeze_group_bit = modify->fix[ifreeze]->groupbit;
// check for FixRigid so can extract rigid body masses // check for FixRigid so can extract rigid body masses
// FIXME: this only catches the first rigid fix, there may be multiple. // FIXME: this only catches the first rigid fix, there may be multiple.
@ -468,13 +478,11 @@ void PairGranHookeHistory::init_style()
onerad_dynamic[i] = onerad_frozen[i] = 0.0; onerad_dynamic[i] = onerad_frozen[i] = 0.0;
if (ipour >= 0) { if (ipour >= 0) {
itype = i; itype = i;
onerad_dynamic[i] = onerad_dynamic[i] = *((double *) modify->fix[ipour]->extract("radius", itype));
*((double *) modify->fix[ipour]->extract("radius",itype));
} }
if (idep >= 0) { if (idep >= 0) {
itype = i; itype = i;
onerad_dynamic[i] = onerad_dynamic[i] = *((double *) modify->fix[idep]->extract("radius", itype));
*((double *) modify->fix[idep]->extract("radius",itype));
} }
} }
@ -528,8 +536,7 @@ void PairGranHookeHistory::write_restart(FILE *fp)
int i, j; int i, j;
for (i = 1; i <= atom->ntypes; i++) for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) for (j = i; j <= atom->ntypes; j++) fwrite(&setflag[i][j], sizeof(int), 1, fp);
fwrite(&setflag[i][j],sizeof(int),1,fp);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -595,10 +602,8 @@ void PairGranHookeHistory::reset_dt()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq,
double rsq, double /*factor_coul*/, double /*factor_lj*/, double &fforce)
double /*factor_coul*/, double /*factor_lj*/,
double &fforce)
{ {
double radi, radj, radsum; double radi, radj, radsum;
double r, rinv, rsqinv, delx, dely, delz; double r, rinv, rsqinv, delx, dely, delz;
@ -704,8 +709,7 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
} }
double *shear = &allshear[3 * neighprev]; double *shear = &allshear[3 * neighprev];
shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]);
shear[2]*shear[2]);
// rotate shear displacements // rotate shear displacements
@ -729,7 +733,8 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
fs2 *= fn / fs; fs2 *= fn / fs;
fs3 *= fn / fs; fs3 *= fn / fs;
fs *= fn / fs; fs *= fn / fs;
} else fs1 = fs2 = fs3 = fs = 0.0; } else
fs1 = fs2 = fs3 = fs = 0.0;
} }
// set force and return no energy // set force and return no energy
@ -754,8 +759,8 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
int /*pbc_flag*/, int * /*pbc*/) int * /*pbc*/)
{ {
int i, j, m; int i, j, m;
@ -775,8 +780,7 @@ void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf)
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++) mass_rigid[i] = buf[m++];
mass_rigid[i] = buf[m++];
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -45,20 +45,19 @@ class AngleCharmmIntel : public AngleCharmm {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: 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; fc_packed1 *fc;
ForceConst() : _nangletypes(0) {} ForceConst() : _nangletypes(0) {}
@ -74,7 +73,7 @@ class AngleCharmmIntel : public AngleCharmm {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,20 +45,19 @@ class AngleHarmonicIntel : public AngleHarmonic {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t k, theta0; } fc_packed1; typedef struct {
flt_t k, theta0;
} fc_packed1;
fc_packed1 *fc; fc_packed1 *fc;
ForceConst() : _nangletypes(0) {} ForceConst() : _nangletypes(0) {}
@ -74,7 +73,7 @@ class AngleHarmonicIntel : public AngleHarmonic {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,20 +45,19 @@ class BondFENEIntel : public BondFENE {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t k, ir0sq, sigma, epsilon; } fc_packed1; typedef struct {
flt_t k, ir0sq, sigma, epsilon;
} fc_packed1;
fc_packed1 *fc; fc_packed1 *fc;
ForceConst() : _nbondtypes(0) {} ForceConst() : _nbondtypes(0) {}
@ -74,7 +73,7 @@ class BondFENEIntel : public BondFENE {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,20 +45,19 @@ class BondHarmonicIntel : public BondHarmonic {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t k, r0; } fc_packed1; typedef struct {
flt_t k, r0;
} fc_packed1;
fc_packed1 *fc; fc_packed1 *fc;
ForceConst() : _nbondtypes(0) {} ForceConst() : _nbondtypes(0) {}
@ -74,7 +73,7 @@ class BondHarmonicIntel : public BondHarmonic {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,22 +45,23 @@ class DihedralCharmmIntel : public DihedralCharmm {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t lj1, lj2, lj3, lj4; } fc_packed1; typedef struct {
typedef struct { flt_t cos_shift, sin_shift, k; flt_t lj1, lj2, lj3, lj4;
int multiplicity; } fc_packed3; } fc_packed1;
typedef struct {
flt_t cos_shift, sin_shift, k;
int multiplicity;
} fc_packed3;
fc_packed1 **ljp; fc_packed1 **ljp;
fc_packed3 *bp; fc_packed3 *bp;
@ -79,7 +80,7 @@ class DihedralCharmmIntel : public DihedralCharmm {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,29 +45,27 @@ class DihedralFourierIntel : public DihedralFourier {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t cos_shift, sin_shift, k; typedef struct {
int multiplicity; } fc_packed1; flt_t cos_shift, sin_shift, k;
int multiplicity;
} fc_packed1;
fc_packed1 **bp; fc_packed1 **bp;
ForceConst() : _nbondtypes(0) {} ForceConst() : _nbondtypes(0) {}
~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); } ~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); }
void set_ntypes(const int nbondtypes, int *setflag, int *nterms, void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory);
Memory *memory);
private: private:
int _nbondtypes, _maxnterms; int _nbondtypes, _maxnterms;
@ -77,7 +75,7 @@ class DihedralFourierIntel : public DihedralFourier {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,21 +45,20 @@ class DihedralHarmonicIntel : public DihedralHarmonic {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t cos_shift, sin_shift, k; typedef struct {
int multiplicity; } fc_packed1; flt_t cos_shift, sin_shift, k;
int multiplicity;
} fc_packed1;
fc_packed1 *bp; fc_packed1 *bp;
@ -76,7 +75,7 @@ class DihedralHarmonicIntel : public DihedralHarmonic {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -45,20 +45,19 @@ class DihedralOPLSIntel : public DihedralOPLS {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t k1, k2, k3, k4; } fc_packed1; typedef struct {
flt_t k1, k2, k3, k4;
} fc_packed1;
fc_packed1 *bp; fc_packed1 *bp;
@ -75,7 +74,7 @@ class DihedralOPLSIntel : public DihedralOPLS {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,11 +25,11 @@ FixStyle(INTEL,FixIntel);
#ifndef LMP_FIX_INTEL_H #ifndef LMP_FIX_INTEL_H
#define 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 "error.h"
#include "fix.h"
#include "force.h"
#include "intel_buffers.h"
#include "pair.h"
#include "update.h" #include "update.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -53,8 +53,7 @@ class FixIntel : public Fix {
void kspace_init_check(); void kspace_init_check();
void pre_reverse(int eflag = 0, int vflag = 0); void pre_reverse(int eflag = 0, int vflag = 0);
inline void min_pre_reverse(int eflag = 0, int vflag = 0) inline void min_pre_reverse(int eflag = 0, int vflag = 0) { pre_reverse(eflag, vflag); }
{ pre_reverse(eflag, vflag); }
void post_run() { _print_pkg_info = 1; } void post_run() { _print_pkg_info = 1; }
@ -63,41 +62,51 @@ class FixIntel : public Fix {
double memory_usage(); 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 int precision() { return _precision_mode; }
inline IntelBuffers<float,float> * get_single_buffers() inline IntelBuffers<float, float> *get_single_buffers() { return _single_buffers; }
{ return _single_buffers; } inline IntelBuffers<float, double> *get_mixed_buffers() { return _mixed_buffers; }
inline IntelBuffers<float,double> * get_mixed_buffers() inline IntelBuffers<double, double> *get_double_buffers() { return _double_buffers; }
{ return _mixed_buffers; }
inline IntelBuffers<double,double> * get_double_buffers()
{ return _double_buffers; }
inline int nbor_pack_width() const { return _nbor_pack_width; } inline int nbor_pack_width() const { return _nbor_pack_width; }
inline void nbor_pack_width(const int w) { _nbor_pack_width = w; } inline void nbor_pack_width(const int w) { _nbor_pack_width = w; }
inline int three_body_neighbor() { return _three_body_neighbor; } inline int three_body_neighbor() { return _three_body_neighbor; }
inline void three_body_neighbor(const int i) { _three_body_neighbor = i; } inline void three_body_neighbor(const int i) { _three_body_neighbor = i; }
inline int need_zero(const int tid) { 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; } if (_need_reduce == 0 && tid > 0)
else return 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 void set_reduce_flag()
inline int lrt() { {
if (_nthreads > 1) _need_reduce = 1;
}
inline int lrt()
{
if (force->kspace_match("^pppm/.*intel$", 0) && update->whichflag == 1) if (force->kspace_match("^pppm/.*intel$", 0) && update->whichflag == 1)
return _lrt; return _lrt;
else return 0; else
return 0;
} }
inline int pppm_table() { inline int pppm_table()
{
if (force->kspace_match("^pppm/.*intel$", 0)) if (force->kspace_match("^pppm/.*intel$", 0))
return INTEL_P3M_TABLE; return INTEL_P3M_TABLE;
else return 0; else
return 0;
} }
protected: protected:
IntelBuffers<float, float> *_single_buffers; IntelBuffers<float, float> *_single_buffers;
IntelBuffers<float, double> *_mixed_buffers; IntelBuffers<float, double> *_mixed_buffers;
@ -111,20 +120,16 @@ class FixIntel : public Fix {
public: public:
inline int *get_overflow_flag() { return _overflow_flag; } inline int *get_overflow_flag() { return _overflow_flag; }
inline int *get_off_overflow_flag() { return _off_overflow_flag; } inline int *get_off_overflow_flag() { return _off_overflow_flag; }
inline void add_result_array(IntelBuffers<double,double>::vec3_acc_t *f_in, inline void add_result_array(IntelBuffers<double, double>::vec3_acc_t *f_in, double *ev_in,
double *ev_in, const int offload, const int offload, const int eatom = 0, const int vatom = 0,
const int eatom = 0, const int vatom = 0,
const int rflag = 0); const int rflag = 0);
inline void add_result_array(IntelBuffers<float,double>::vec3_acc_t *f_in, inline void add_result_array(IntelBuffers<float, double>::vec3_acc_t *f_in, double *ev_in,
double *ev_in, const int offload, const int offload, const int eatom = 0, const int vatom = 0,
const int eatom = 0, const int vatom = 0,
const int rflag = 0); const int rflag = 0);
inline void add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in, inline void add_result_array(IntelBuffers<float, float>::vec3_acc_t *f_in, float *ev_in,
float *ev_in, const int offload, const int offload, const int eatom = 0, const int vatom = 0,
const int eatom = 0, const int vatom = 0,
const int rflag = 0); const int rflag = 0);
inline void get_buffern(const int offload, int &nlocal, int &nall, inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal);
int &minlocal);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
void post_force(int vflag); void post_force(int vflag);
@ -135,9 +140,19 @@ class FixIntel : public Fix {
inline int offload_end_neighbor(); inline int offload_end_neighbor();
inline int offload_end_pair(); inline int offload_end_pair();
inline int host_start_neighbor() 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() 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_nlocal() { return _offload_nlocal; }
inline int offload_nall() { return _offload_nall; } inline int offload_nall() { return _offload_nall; }
inline int offload_min_ghost() { return _offload_min_ghost; } inline int offload_min_ghost() { return _offload_min_ghost; }
@ -149,11 +164,12 @@ class FixIntel : public Fix {
inline int separate_buffers() { return _separate_buffers; } inline int separate_buffers() { return _separate_buffers; }
inline int offload_noghost() { return _offload_noghost; } inline int offload_noghost() { return _offload_noghost; }
inline void set_offload_noghost(const int v) 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 set_neighbor_host_sizes();
inline void zero_timers() inline void zero_timers() { memset(_timers, 0, sizeof(double) * NUM_ITIMERS); }
{ memset(_timers, 0, sizeof(double) * NUM_ITIMERS); }
inline void start_watch(const int which) { _stopwatch[which] = MPI_Wtime(); } inline void start_watch(const int which) { _stopwatch[which] = MPI_Wtime(); }
inline double stop_watch(const int which); inline double stop_watch(const int which);
inline double *off_watch_pair() { return _stopwatch_offload_pair; } inline double *off_watch_pair() { return _stopwatch_offload_pair; }
@ -219,20 +235,15 @@ class FixIntel : public Fix {
void _sync_main_arrays(const int prereverse); void _sync_main_arrays(const int prereverse);
template <class ft> template <class ft> void reduce_results(ft *_noalias const f_in);
void reduce_results(ft * _noalias const f_in);
template <class ft, class acc_t> template <class ft, class acc_t>
inline void add_results(const ft * _noalias const f_in, inline void add_results(const ft *_noalias const f_in, const acc_t *_noalias const ev_global,
const acc_t * _noalias const ev_global, const int eatom, const int vatom, const int offload);
const int eatom, const int vatom,
const int offload);
template <class ft, class acc_t> template <class ft, class acc_t>
inline void add_oresults(const ft * _noalias const f_in, inline void add_oresults(const ft *_noalias const f_in, const acc_t *_noalias const ev_global,
const acc_t * _noalias const ev_global, const int eatom, const int vatom, const int out_offset, const int nall);
const int eatom, const int vatom,
const int out_offset, const int nall);
int _offload_affinity_balanced, _offload_threads, _offload_tpc; int _offload_affinity_balanced, _offload_threads, _offload_tpc;
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
@ -240,15 +251,14 @@ class FixIntel : public Fix {
int _im_real_space_task; int _im_real_space_task;
MPI_Comm _real_space_comm; MPI_Comm _real_space_comm;
template <class ft, class acc_t> template <class ft, class acc_t>
inline void add_off_results(const ft * _noalias const f_in, inline void add_off_results(const ft *_noalias const f_in, const acc_t *_noalias const ev_global);
const acc_t * _noalias const ev_global);
#endif #endif
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, int &minlocal)
int &minlocal) { {
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
if (_separate_buffers) { if (_separate_buffers) {
if (offload) { if (offload) {
@ -281,18 +291,17 @@ void FixIntel::get_buffern(const int offload, int &nlocal, int &nall,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<double,double>::vec3_acc_t *f_in, void FixIntel::add_result_array(IntelBuffers<double, double>::vec3_acc_t *f_in, double *ev_in,
double *ev_in, const int offload, const int offload, const int eatom, const int vatom,
const int eatom, const int vatom, const int rflag)
const int rflag) { {
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
if (offload) { if (offload) {
_off_results_eatom = eatom; _off_results_eatom = eatom;
_off_results_vatom = vatom; _off_results_vatom = vatom;
_off_force_array_d = f_in; _off_force_array_d = f_in;
_off_ev_array_d = ev_in; _off_ev_array_d = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set()) if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1);
_sync_main_arrays(1);
return; return;
} }
#endif #endif
@ -308,24 +317,23 @@ void FixIntel::add_result_array(IntelBuffers<double,double>::vec3_acc_t *f_in,
if (_overflow_flag[LMP_OVERFLOW]) if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 || if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set()))
(_pair_hybrid_flag && force->pair->fdotr_is_set())) _sync_main_arrays(0); _sync_main_arrays(0);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<float,double>::vec3_acc_t *f_in, void FixIntel::add_result_array(IntelBuffers<float, double>::vec3_acc_t *f_in, double *ev_in,
double *ev_in, const int offload, const int offload, const int eatom, const int vatom,
const int eatom, const int vatom, const int rflag)
const int rflag) { {
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
if (offload) { if (offload) {
_off_results_eatom = eatom; _off_results_eatom = eatom;
_off_results_vatom = vatom; _off_results_vatom = vatom;
_off_force_array_m = f_in; _off_force_array_m = f_in;
_off_ev_array_d = ev_in; _off_ev_array_d = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set()) if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1);
_sync_main_arrays(1);
return; return;
} }
#endif #endif
@ -341,25 +349,23 @@ void FixIntel::add_result_array(IntelBuffers<float,double>::vec3_acc_t *f_in,
if (_overflow_flag[LMP_OVERFLOW]) if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 || if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set()))
(_pair_hybrid_flag && force->pair->fdotr_is_set()))
_sync_main_arrays(0); _sync_main_arrays(0);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in, void FixIntel::add_result_array(IntelBuffers<float, float>::vec3_acc_t *f_in, float *ev_in,
float *ev_in, const int offload, const int offload, const int eatom, const int vatom,
const int eatom, const int vatom, const int rflag)
const int rflag) { {
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
if (offload) { if (offload) {
_off_results_eatom = eatom; _off_results_eatom = eatom;
_off_results_vatom = vatom; _off_results_vatom = vatom;
_off_force_array_s = f_in; _off_force_array_s = f_in;
_off_ev_array_s = ev_in; _off_ev_array_s = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set()) if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1);
_sync_main_arrays(1);
return; return;
} }
#endif #endif
@ -375,8 +381,7 @@ void FixIntel::add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in,
if (_overflow_flag[LMP_OVERFLOW]) if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 || if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set()))
(_pair_hybrid_flag && force->pair->fdotr_is_set()))
_sync_main_arrays(0); _sync_main_arrays(0);
} }
@ -386,10 +391,10 @@ void FixIntel::add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int FixIntel::offload_end_neighbor() { int FixIntel::offload_end_neighbor()
{
if (_offload_balance < 0.0) { if (_offload_balance < 0.0) {
if (atom->nlocal < 2) if (atom->nlocal < 2) error->one(FLERR, "Too few atoms for load balancing offload");
error->one(FLERR,"Too few atoms for load balancing offload");
double granularity = 1.0 / atom->nlocal; double granularity = 1.0 / atom->nlocal;
if (_balance_neighbor < granularity) if (_balance_neighbor < granularity)
_balance_neighbor = granularity + 1e-10; _balance_neighbor = granularity + 1e-10;
@ -399,14 +404,18 @@ int FixIntel::offload_end_neighbor() {
return _balance_neighbor * atom->nlocal; return _balance_neighbor * atom->nlocal;
} }
int FixIntel::offload_end_pair() { int FixIntel::offload_end_pair()
if (neighbor->ago == 0) return _balance_neighbor * atom->nlocal; {
else return _balance_pair * atom->nlocal; 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]; double elapsed = MPI_Wtime() - _stopwatch[which];
_timers[which] += elapsed; _timers[which] += elapsed;
return 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) { if (_offload_balance < 0.0) {
double ct = MPI_Wtime(); double ct = MPI_Wtime();
_balance_other_time = ct; _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; _timers[TIME_OFFLOAD_PAIR] += *_stopwatch_offload_pair;
if (neighbor->ago == 0) { if (neighbor->ago == 0) {
_timers[TIME_OFFLOAD_NEIGHBOR] += *_stopwatch_offload_neighbor; _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_local = _overflow_flag[LMP_LOCAL_MIN];
_host_min_ghost = _overflow_flag[LMP_GHOST_MIN]; _host_min_ghost = _overflow_flag[LMP_GHOST_MIN];
_host_used_local = atom->nlocal - _host_min_local; _host_used_local = atom->nlocal - _host_min_local;
@ -450,7 +462,7 @@ void FixIntel::set_neighbor_host_sizes() {
#endif #endif
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -35,7 +35,7 @@ class FixNPTIntel : public FixNHIntel {
~FixNPTIntel() {} ~FixNPTIntel() {}
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -46,7 +46,7 @@ class FixNVEAsphereIntel : public FixNVE {
class AtomVecEllipsoid *avec; class AtomVecEllipsoid *avec;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -44,7 +44,7 @@ class FixNVEIntel : public FixNVE {
int _nlocal3, _nlocal_max; int _nlocal3, _nlocal_max;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -35,7 +35,7 @@ class FixNVTIntel : public FixNHIntel {
~FixNVTIntel() {} ~FixNVTIntel() {}
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -41,7 +41,7 @@ class FixNVTSllodIntel : public FixNHIntel {
void nh_v_temp(); void nh_v_temp();
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif
@ -70,4 +70,3 @@ E: Using fix nvt/sllod with no fix deform defined
Self-explanatory. Self-explanatory.
*/ */

View File

@ -25,8 +25,8 @@ ImproperStyle(cvff/intel,ImproperCvffIntel);
#ifndef LMP_IMPROPER_CVFF_INTEL_H #ifndef LMP_IMPROPER_CVFF_INTEL_H
#define LMP_IMPROPER_CVFF_INTEL_H #define LMP_IMPROPER_CVFF_INTEL_H
#include "improper_cvff.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "improper_cvff.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -45,20 +45,20 @@ class ImproperCvffIntel : public ImproperCvff {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t k; int sign, multiplicity; } fc_packed1; typedef struct {
flt_t k;
int sign, multiplicity;
} fc_packed1;
fc_packed1 *fc; fc_packed1 *fc;
@ -75,7 +75,7 @@ class ImproperCvffIntel : public ImproperCvff {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ ImproperStyle(harmonic/intel,ImproperHarmonicIntel);
#ifndef LMP_IMPROPER_HARMONIC_INTEL_H #ifndef LMP_IMPROPER_HARMONIC_INTEL_H
#define LMP_IMPROPER_HARMONIC_INTEL_H #define LMP_IMPROPER_HARMONIC_INTEL_H
#include "improper_harmonic.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "improper_harmonic.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -45,20 +45,19 @@ class ImproperHarmonicIntel : public ImproperHarmonic {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers, void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _use_base; int _use_base;
#endif #endif
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t k, chi; } fc_packed1; typedef struct {
flt_t k, chi;
} fc_packed1;
fc_packed1 *fc; fc_packed1 *fc;
@ -75,7 +74,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -23,9 +23,9 @@ NBinStyle(intel,
#ifndef LMP_NBIN_INTEL_H #ifndef LMP_NBIN_INTEL_H
#define LMP_NBIN_INTEL_H #define LMP_NBIN_INTEL_H
#include "nbin_standard.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "memory.h" #include "memory.h"
#include "nbin_standard.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -43,15 +43,14 @@ class NBinIntel : public NBinStandard {
int _precision_mode; int _precision_mode;
double memory_usage(); double memory_usage();
template <class flt_t, class acc_t> template <class flt_t, class acc_t> void bin_atoms(IntelBuffers<flt_t, acc_t> *);
void bin_atoms(IntelBuffers<flt_t,acc_t> *);
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
int _cop, _offload_alloc; int _cop, _offload_alloc;
#endif #endif
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -37,16 +37,16 @@ class NPairFullBinGhostIntel : public NPairIntel {
NPairFullBinGhostIntel(class LAMMPS *); NPairFullBinGhostIntel(class LAMMPS *);
~NPairFullBinGhostIntel() {} ~NPairFullBinGhostIntel() {}
void build(class NeighList *); void build(class NeighList *);
private: private:
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void fbi(NeighList *list, IntelBuffers<flt_t, acc_t> *buffers); void fbi(NeighList *list, IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t, int need_ic> template <class flt_t, class acc_t, int need_ic>
void fbi(const int offload, NeighList * list, void fbi(const int offload, NeighList *list, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const int astart, const int aend); const int astart, const int aend);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -24,8 +24,8 @@ NPairStyle(full/bin/intel,
#ifndef LMP_NPAIR_FULL_BIN_INTEL_H #ifndef LMP_NPAIR_FULL_BIN_INTEL_H
#define LMP_NPAIR_FULL_BIN_INTEL_H #define LMP_NPAIR_FULL_BIN_INTEL_H
#include "npair_intel.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "npair_intel.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -36,11 +36,10 @@ class NPairFullBinIntel : public NPairIntel {
void build(class NeighList *); void build(class NeighList *);
private: private:
template <class flt_t, class acc_t> template <class flt_t, class acc_t> void fbi(NeighList *, IntelBuffers<flt_t, acc_t> *);
void fbi(NeighList *, IntelBuffers<flt_t,acc_t> *);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -23,8 +23,8 @@ NPairStyle(half/bin/newton/intel,
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H #ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H
#define LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H #define LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H
#include "npair_intel.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "npair_intel.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -35,11 +35,10 @@ class NPairHalfBinNewtonIntel : public NPairIntel {
void build(class NeighList *); void build(class NeighList *);
private: private:
template <class flt_t, class acc_t> template <class flt_t, class acc_t> void hbni(NeighList *, IntelBuffers<flt_t, acc_t> *);
void hbni(NeighList *, IntelBuffers<flt_t,acc_t> *);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -23,8 +23,8 @@ NPairStyle(half/bin/newton/tri/intel,
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_TRI_H #ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_TRI_H
#define 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 "fix_intel.h"
#include "npair_intel.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -35,11 +35,10 @@ class NPairHalfBinNewtonTriIntel : public NPairIntel {
void build(class NeighList *); void build(class NeighList *);
private: private:
template <class flt_t, class acc_t> template <class flt_t, class acc_t> void hbnti(NeighList *, IntelBuffers<flt_t, acc_t> *);
void hbnti(NeighList *, IntelBuffers<flt_t,acc_t> *);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -33,14 +33,13 @@ NPairStyle(halffull/newton/skip/intel,
#ifndef LMP_NPAIR_HALFFULL_NEWTON_INTEL_H #ifndef LMP_NPAIR_HALFFULL_NEWTON_INTEL_H
#define LMP_NPAIR_HALFFULL_NEWTON_INTEL_H #define LMP_NPAIR_HALFFULL_NEWTON_INTEL_H
#include "npair.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "npair.h"
#if defined(_OPENMP) #if defined(_OPENMP)
#include <omp.h> #include <omp.h>
#endif #endif
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NPairHalffullNewtonIntel : public NPair { class NPairHalffullNewtonIntel : public NPair {
@ -52,14 +51,12 @@ class NPairHalffullNewtonIntel : public NPair {
protected: protected:
FixIntel *_fix; FixIntel *_fix;
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void build_t(NeighList *, IntelBuffers<flt_t, acc_t> *);
void build_t(NeighList *, IntelBuffers<flt_t,acc_t> *);
template<class flt_t> template <class flt_t> void build_t3(NeighList *, int *);
void build_t3(NeighList *, int *);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -31,14 +31,13 @@ NPairStyle(skip/ghost/intel,
#ifndef LMP_NPAIR_SKIP_INTEL_H #ifndef LMP_NPAIR_SKIP_INTEL_H
#define LMP_NPAIR_SKIP_INTEL_H #define LMP_NPAIR_SKIP_INTEL_H
#include "npair.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "npair.h"
#if defined(_OPENMP) #if defined(_OPENMP)
#include <omp.h> #include <omp.h>
#endif #endif
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NPairSkipIntel : public NPair { class NPairSkipIntel : public NPair {
@ -56,7 +55,7 @@ class NPairSkipIntel : public NPair {
void build_t(NeighList *, int *numhalf, int *cnumneigh, int *numhalf_skip); void build_t(NeighList *, int *numhalf, int *cnumneigh, int *numhalf_skip);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,14 +25,13 @@ PairStyle(airebo/intel,PairAIREBOIntel);
#ifndef LMP_PAIR_AIREBO_INTEL_H #ifndef LMP_PAIR_AIREBO_INTEL_H
#define LMP_PAIR_AIREBO_INTEL_H #define LMP_PAIR_AIREBO_INTEL_H
#include "pair.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair.h"
#include "pair_airebo.h" #include "pair_airebo.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
template<class flt_t, class acc_t> template <class flt_t, class acc_t> struct PairAIREBOIntelParam;
struct PairAIREBOIntelParam;
class PairAIREBOIntel : public PairAIREBO { class PairAIREBOIntel : public PairAIREBO {
public: public:
@ -40,21 +39,18 @@ class PairAIREBOIntel : public PairAIREBO {
virtual ~PairAIREBOIntel(); virtual ~PairAIREBOIntel();
virtual void compute(int, int); virtual void compute(int, int);
virtual void init_style(); virtual void init_style();
protected:
protected:
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers); void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers);
template <int EVFLAG, int EFLAG, class flt_t, class acc_t> template <int EVFLAG, int EFLAG, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const int astart, const int aend); const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t> void pack_force_const(IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(IntelBuffers<flt_t,acc_t> * buffers);
template <class flt_t, class acc_t> template <class flt_t, class acc_t> PairAIREBOIntelParam<flt_t, acc_t> get_param();
PairAIREBOIntelParam<flt_t,acc_t> get_param();
FixIntel *fix; FixIntel *fix;
int _cop; int _cop;
@ -62,10 +58,9 @@ class PairAIREBOIntel : public PairAIREBO {
int *REBO_cnumneigh; int *REBO_cnumneigh;
int *REBO_num_skin; int *REBO_num_skin;
int *REBO_list_data; int *REBO_list_data;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -35,7 +35,7 @@ class PairAIREBOMorseIntel : public PairAIREBOIntel {
virtual void settings(int, char **); virtual void settings(int, char **);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -26,8 +26,8 @@ PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel);
#ifndef LMP_PAIR_BUCK_COUL_CUT_INTEL_H #ifndef LMP_PAIR_BUCK_COUL_CUT_INTEL_H
#define 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 "fix_intel.h"
#include "pair_buck_coul_cut.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -38,7 +38,10 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
virtual ~PairBuckCoulCutIntel(); virtual ~PairBuckCoulCutIntel();
virtual void compute(int, int); virtual void compute(int, int);
void init_style(); 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; FixIntel *fix;
@ -51,20 +54,23 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t buck1, buck2, rhoinv, pad; } c_force_t; typedef struct {
typedef struct { flt_t cutsq, cut_ljsq, cut_coulsq, pad; } c_cut_t; flt_t buck1, buck2, rhoinv, pad;
typedef struct { flt_t a, c, offset, pad; } c_energy_t; } 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_coul[4], 64);
_alignvar(flt_t special_lj[4], 64); _alignvar(flt_t special_lj[4], 64);
@ -75,8 +81,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
ForceConst() : _ntypes(0), _ntable(0) {} 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, void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
const int cop);
private: private:
int _ntypes, _ntable, _cop; int _ntypes, _ntable, _cop;
@ -86,7 +91,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif // LMP_PAIR_BUCK_COUL_CUT_INTEL_H #endif // LMP_PAIR_BUCK_COUL_CUT_INTEL_H
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(buck/coul/long/intel,PairBuckCoulLongIntel);
#ifndef LMP_PAIR_BUCK_COUL_LONG_INTEL_H #ifndef LMP_PAIR_BUCK_COUL_LONG_INTEL_H
#define 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 "fix_intel.h"
#include "pair_buck_coul_long.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -37,7 +37,10 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
virtual ~PairBuckCoulLongIntel(); virtual ~PairBuckCoulLongIntel();
virtual void compute(int, int); virtual void compute(int, int);
void init_style(); 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; FixIntel *fix;
@ -50,20 +53,23 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t cutsq, cut_ljsq, buck1, buck2; } c_force_t; typedef struct {
typedef struct { flt_t a, c, offset, pad; } c_energy_t; flt_t cutsq, cut_ljsq, buck1, buck2;
typedef struct { flt_t r, dr, f, df; } table_t; } 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_coul[4], 64);
_alignvar(flt_t special_lj[4], 64); _alignvar(flt_t special_lj[4], 64);
flt_t g_ewald, tabinnersq; flt_t g_ewald, tabinnersq;
@ -76,8 +82,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
ForceConst() : _ntypes(0), _ntable(0) {} 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, void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
const int cop);
private: private:
int _ntypes, _ntable, _cop; int _ntypes, _ntable, _cop;
@ -87,7 +92,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif // LMP_PAIR_BUCK_COUL_LONG_INTEL_H #endif // LMP_PAIR_BUCK_COUL_LONG_INTEL_H
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(buck/intel,PairBuckIntel);
#ifndef LMP_PAIR_BUCK_INTEL_H #ifndef LMP_PAIR_BUCK_INTEL_H
#define LMP_PAIR_BUCK_INTEL_H #define LMP_PAIR_BUCK_INTEL_H
#include "pair_buck.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair_buck.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -37,7 +37,10 @@ public:
virtual ~PairBuckIntel(); virtual ~PairBuckIntel();
virtual void compute(int, int); virtual void compute(int, int);
void init_style(); 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; FixIntel *fix;
@ -50,20 +53,21 @@ private:
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t buck1, buck2, rhoinv, cutsq; } c_force_t; typedef struct {
typedef struct { flt_t a, c, offset, pad; } c_energy_t; 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); _alignvar(flt_t special_lj[4], 64);
c_force_t **c_force; c_force_t **c_force;
@ -72,8 +76,7 @@ private:
ForceConst() : _ntypes(0) {} ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0, nullptr, _cop); } ~ForceConst() { set_ntypes(0, nullptr, _cop); }
void set_ntypes(const int ntypes, Memory *memory, void set_ntypes(const int ntypes, Memory *memory, const int cop);
const int cop);
private: private:
int _ntypes, _cop; int _ntypes, _cop;
@ -84,7 +87,7 @@ private:
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif // LMP_PAIR_BUCK_INTEL_H #endif // LMP_PAIR_BUCK_INTEL_H
#endif #endif

View File

@ -26,8 +26,8 @@ PairStyle(dpd/intel,PairDPDIntel);
#ifndef LMP_PAIR_DPD_INTEL_H #ifndef LMP_PAIR_DPD_INTEL_H
#define LMP_PAIR_DPD_INTEL_H #define LMP_PAIR_DPD_INTEL_H
#include "pair_dpd.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair_dpd.h"
#ifdef LMP_USE_MKL_RNG #ifdef LMP_USE_MKL_RNG
#include "mkl_vsl.h" #include "mkl_vsl.h"
@ -63,20 +63,19 @@ class PairDPDIntel : public PairDPD {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: 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; fc_packed1 **param;
@ -86,8 +85,8 @@ class PairDPDIntel : public PairDPD {
ForceConst() : _ntypes(0) {} ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, Memory *memory,
Memory *memory, const int cop); const int cop);
private: private:
int _ntypes, _cop; int _ntypes, _cop;
@ -97,7 +96,7 @@ class PairDPDIntel : public PairDPD {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -38,7 +38,7 @@ class PairEAMAlloyIntel : virtual public PairEAMIntel {
void file2array(); void file2array();
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -38,7 +38,7 @@ class PairEAMFSIntel : virtual public PairEAMIntel {
void file2array(); void file2array();
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -21,12 +21,11 @@ PairStyle(eam/intel,PairEAMIntel);
#ifndef LMP_PAIR_EAM_INTEL_H #ifndef LMP_PAIR_EAM_INTEL_H
#define LMP_PAIR_EAM_INTEL_H #define LMP_PAIR_EAM_INTEL_H
#include "pair_eam.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair_eam.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class PairEAMIntel : public PairEAM { class PairEAMIntel : public PairEAM {
public: public:
friend class FixSemiGrandCanonicalMC; // Alex Stukowski option friend class FixSemiGrandCanonicalMC; // Alex Stukowski option
@ -39,37 +38,34 @@ class PairEAMIntel : public PairEAM {
void unpack_forward_comm(int, int, double *); void unpack_forward_comm(int, int, double *);
protected: protected:
FixIntel *fix; FixIntel *fix;
int _cop, _onetype, _ccache_stride; int _cop, _onetype, _ccache_stride;
float *fp_float; float *fp_float;
template <class flt_t> template <class flt_t> int pack_forward_comm(int, int *, double *, flt_t *);
int pack_forward_comm(int, int *, double *, flt_t *); template <class flt_t> void unpack_forward_comm(int, int, double *, flt_t *);
template <class flt_t>
void unpack_forward_comm(int, int, double *, flt_t *);
template <class flt_t> class ForceConst; template <class flt_t> class ForceConst;
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
class acc_t> void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t a, b, c, d; } fc_packed1; typedef struct {
typedef struct { flt_t a, b, c, d, e, f, g, h; } fc_packed2; 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; flt_t **scale_f;
fc_packed1 *rhor_spline_f, *rhor_spline_e; fc_packed1 *rhor_spline_f, *rhor_spline_e;
@ -79,8 +75,7 @@ class PairEAMIntel : public PairEAM {
ForceConst() : _ntypes(0), _nr(0) {} ForceConst() : _ntypes(0), _nr(0) {}
~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int nr, const int nrho, void set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop);
Memory *memory, const int cop);
inline int rhor_jstride() const { return _nr; } inline int rhor_jstride() const { return _nr; }
inline int rhor_istride() const { return _nr * _ntypes; } inline int rhor_istride() const { return _nr * _ntypes; }
inline int frho_stride() const { return _nrho; } inline int frho_stride() const { return _nrho; }
@ -93,7 +88,7 @@ class PairEAMIntel : public PairEAM {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(gayberne/intel,PairGayBerneIntel);
#ifndef LMP_PAIR_GAYBERNE_INTEL_H #ifndef LMP_PAIR_GAYBERNE_INTEL_H
#define LMP_PAIR_GAYBERNE_INTEL_H #define LMP_PAIR_GAYBERNE_INTEL_H
#include "pair_gayberne.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair_gayberne.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -45,23 +45,24 @@ class PairGayBerneIntel : public PairGayBerne {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { typedef struct {
flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape; flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape;
int form; int form;
} fc_packed1; } fc_packed1;
typedef struct { flt_t lj3, lj4; } fc_packed2; typedef struct {
typedef struct { flt_t shape2[4], well[4]; } fc_packed3; 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 special_lj[4], 64);
_alignvar(flt_t gamma, 64); _alignvar(flt_t gamma, 64);
@ -77,8 +78,8 @@ class PairGayBerneIntel : public PairGayBerne {
ForceConst() : _ntypes(0) {} ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int one_length, void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory,
const int nthreads, Memory *memory, const int cop); const int cop);
private: private:
int _ntypes, _cop; int _ntypes, _cop;
@ -89,15 +90,14 @@ class PairGayBerneIntel : public PairGayBerne {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
int _max_nbors; int _max_nbors;
double gayberne_lj(const int i, const int j, double a1[3][3], double gayberne_lj(const int i, const int j, double a1[3][3], double b1[3][3], double g1[3][3],
double b1[3][3], double g1[3][3], double *r12, double *r12, const double rsq, double *fforce, double *ttor);
const double rsq, double *fforce, double *ttor);
FixIntel *fix; FixIntel *fix;
int _cop; int _cop;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/charmm/coul/charmm/intel,PairLJCharmmCoulCharmmIntel);
#ifndef LMP_PAIR_LJ_CHARMM_COUL_CHARMM_INTEL_H #ifndef LMP_PAIR_LJ_CHARMM_COUL_CHARMM_INTEL_H
#define 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 "fix_intel.h"
#include "pair_lj_charmm_coul_charmm.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -39,7 +39,10 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
virtual void compute(int, int); virtual void compute(int, int);
void init_style(); 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; FixIntel *fix;
@ -50,17 +53,14 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
_alignvar(flt_t special_coul[4], 64); _alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64); _alignvar(flt_t special_lj[4], 64);
@ -82,7 +82,7 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/charmm/coul/long/intel,PairLJCharmmCoulLongIntel);
#ifndef LMP_PAIR_LJ_CHARMM_COUL_LONG_INTEL_H #ifndef LMP_PAIR_LJ_CHARMM_COUL_LONG_INTEL_H
#define 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 "fix_intel.h"
#include "pair_lj_charmm_coul_long.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -39,7 +39,10 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
virtual void compute(int, int); virtual void compute(int, int);
void init_style(); 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; FixIntel *fix;
@ -50,19 +53,18 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t r, dr, f, df; } table_t; typedef struct {
flt_t r, dr, f, df;
} table_t;
_alignvar(flt_t special_coul[4], 64); _alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64); _alignvar(flt_t special_lj[4], 64);
flt_t **cutsq, g_ewald, tabinnersq; flt_t **cutsq, g_ewald, tabinnersq;
@ -75,8 +77,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
ForceConst() : _ntypes(0), _ntable(0) {} 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, void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
const int cop);
private: private:
int _ntypes, _ntable, _cop; int _ntypes, _ntable, _cop;
@ -86,7 +87,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/cut/coul/long/intel,PairLJCutCoulLongIntel);
#ifndef LMP_PAIR_LJ_CUT_COUL_LONG_INTEL_H #ifndef LMP_PAIR_LJ_CUT_COUL_LONG_INTEL_H
#define 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 "fix_intel.h"
#include "pair_lj_cut_coul_long.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -39,7 +39,10 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
virtual void compute(int, int); virtual void compute(int, int);
void init_style(); 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; FixIntel *fix;
@ -50,21 +53,24 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t cutsq, cut_ljsq, lj1, lj2; } c_force_t; typedef struct {
typedef struct { flt_t lj3, lj4, offset, pad; } c_energy_t; flt_t cutsq, cut_ljsq, lj1, lj2;
typedef struct { flt_t r, dr, f, df; } table_t; } 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_coul[4], 64);
_alignvar(flt_t special_lj[4], 64); _alignvar(flt_t special_lj[4], 64);
flt_t g_ewald, tabinnersq; flt_t g_ewald, tabinnersq;
@ -76,8 +82,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
ForceConst() : _ntypes(0), _ntable(0) {} 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, void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
const int cop);
private: private:
int _ntypes, _ntable, _cop; int _ntypes, _ntable, _cop;
@ -87,7 +92,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/cut/intel,PairLJCutIntel);
#ifndef LMP_PAIR_LJ_CUT_INTEL_H #ifndef LMP_PAIR_LJ_CUT_INTEL_H
#define LMP_PAIR_LJ_CUT_INTEL_H #define LMP_PAIR_LJ_CUT_INTEL_H
#include "pair_lj_cut.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair_lj_cut.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -47,21 +47,22 @@ class PairLJCutIntel : public PairLJCut {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t cutsq, lj1, lj2, offset; } fc_packed1; typedef struct {
typedef struct { flt_t lj3, lj4; } fc_packed2; 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_packed1 **ljc12o;
@ -80,7 +81,7 @@ class PairLJCutIntel : public PairLJCut {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,16 +25,15 @@ PairStyle(lj/long/coul/long/intel,PairLJLongCoulLongIntel);
#ifndef LMP_PAIR_LJ_LONG_COUL_LONG_INTEL_H #ifndef LMP_PAIR_LJ_LONG_COUL_LONG_INTEL_H
#define 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 "fix_intel.h"
#include "pair_lj_long_coul_long.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class PairLJLongCoulLongIntel : public PairLJLongCoulLong { class PairLJLongCoulLongIntel : public PairLJLongCoulLong {
public: public:
PairLJLongCoulLongIntel(class LAMMPS *); PairLJLongCoulLongIntel(class LAMMPS *);
virtual ~PairLJLongCoulLongIntel(); virtual ~PairLJLongCoulLongIntel();
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -35,7 +35,7 @@ class PairREBOIntel : public PairAIREBOIntel {
virtual void settings(int, char **); virtual void settings(int, char **);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -25,8 +25,8 @@ PairStyle(sw/intel,PairSWIntel);
#ifndef LMP_PAIR_SW_INTEL_H #ifndef LMP_PAIR_SW_INTEL_H
#define LMP_PAIR_SW_INTEL_H #define LMP_PAIR_SW_INTEL_H
#include "pair_sw.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair_sw.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -48,13 +48,11 @@ class PairSWIntel : public PairSW {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int SPQ, int ONETYPE, int EFLAG, class flt_t, class acc_t> template <int SPQ, int ONETYPE, int EFLAG, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers, const ForceConst<flt_t> &fc, const ForceConst<flt_t> &fc, const int astart, const int aend);
const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
int _ccache_stride, _spq, _onetype, _onetype3; int _ccache_stride, _spq, _onetype, _onetype3;
#ifdef LMP_USE_AVXCD #ifdef LMP_USE_AVXCD
@ -63,8 +61,7 @@ class PairSWIntel : public PairSW {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { typedef struct {
flt_t cutsq, cut, sigma_gamma, pad; flt_t cutsq, cut, sigma_gamma, pad;
@ -101,7 +98,7 @@ class PairSWIntel : public PairSW {
ForceConst<double> force_const_double; ForceConst<double> force_const_double;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -24,8 +24,8 @@ PairStyle(tersoff/intel,PairTersoffIntel);
#ifndef LMP_PAIR_TERSOFF_INTEL_H #ifndef LMP_PAIR_TERSOFF_INTEL_H
#define LMP_PAIR_TERSOFF_INTEL_H #define LMP_PAIR_TERSOFF_INTEL_H
#include "pair.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pair.h"
#include "pair_tersoff.h" #include "pair_tersoff.h"
#ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER
@ -39,7 +39,10 @@ class PairTersoffIntel : public PairTersoff {
void init_style(); void init_style();
protected: protected:
typedef struct { float x,y,z; int w; } sng4_t; typedef struct {
float x, y, z;
int w;
} sng4_t;
private: private:
FixIntel *fix; FixIntel *fix;
@ -48,20 +51,31 @@ class PairTersoffIntel : public PairTersoff {
public: // wo needs secrets? public: // wo needs secrets?
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// //
template <class flt_t> template <class flt_t> class ForceConst {
class ForceConst {
public: public:
typedef struct { flt_t cutsq; } c_cutoff_t; typedef struct {
typedef struct { flt_t bigr, bigd, lam1, biga; } c_first_loop_t; flt_t cutsq;
typedef struct { flt_t lam2, beta, bigb, powern, c1, c2, c3, c4; } c_second_loop_t; } c_cutoff_t;
typedef struct { flt_t lam3, bigr, bigd, c2, d2, h, gamma, powermint; } c_inner_loop_t; typedef struct {
typedef struct { flt_t cutsq, pad[3]; 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 bigr, bigd, lam1, biga;
flt_t lam2, beta, bigb, powern; flt_t lam2, beta, bigb, powern;
flt_t c1, c2, c3, c4; } c_outer_t; flt_t c1, c2, c3, c4;
typedef struct { flt_t cutsq, pad[7]; } c_outer_t;
typedef struct {
flt_t cutsq, pad[7];
flt_t lam3, powermint, bigr, bigd; flt_t lam3, powermint, bigr, bigd;
flt_t c2, d2, h, gamma; } c_inner_t; flt_t c2, d2, h, gamma;
} c_inner_t;
c_cutoff_t **c_cutoff_outer; c_cutoff_t **c_cutoff_outer;
c_cutoff_t ***c_cutoff_inner; c_cutoff_t ***c_cutoff_inner;
c_first_loop_t **c_first_loop; c_first_loop_t **c_first_loop;
@ -85,16 +99,14 @@ class PairTersoffIntel : public PairTersoff {
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc); const ForceConst<flt_t> &fc);
template <int EFLAG, class flt_t, class acc_t> template <int EFLAG, class flt_t, class acc_t>
void eval(const int offload, const int vflag, void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend); const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc, void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
IntelBuffers<flt_t, acc_t> *buffers);
}; };
} } // namespace LAMMPS_NS
#endif // __INTEL_COMPILER #endif // __INTEL_COMPILER
#endif #endif

View File

@ -25,8 +25,8 @@ KSpaceStyle(pppm/disp/intel,PPPMDispIntel);
#ifndef LMP_PPPMINTEL_DISP_H #ifndef LMP_PPPMINTEL_DISP_H
#define LMP_PPPMINTEL_DISP_H #define LMP_PPPMINTEL_DISP_H
#include "pppm_disp.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pppm_disp.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -86,16 +86,13 @@ namespace LAMMPS_NS {
#endif #endif
template <class flt_t, class acc_t> template <class flt_t, class acc_t>
void particle_map(double, double, double, void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int, int,
double, int **, int, int,
int, int, int,
int, int, int,
IntelBuffers<flt_t, acc_t> *buffers); IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void make_rho_c(IntelBuffers<flt_t, acc_t> *buffers); void make_rho_c(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void make_rho_c(IntelBuffers<flt_t, acc_t> *buffers)
void make_rho_c(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
make_rho_c<flt_t, acc_t, 1>(buffers); make_rho_c<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -105,8 +102,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void make_rho_g(IntelBuffers<flt_t, acc_t> *buffers); void make_rho_g(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void make_rho_g(IntelBuffers<flt_t, acc_t> *buffers)
void make_rho_g(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
make_rho_g<flt_t, acc_t, 1>(buffers); make_rho_g<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -116,8 +113,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void make_rho_a(IntelBuffers<flt_t, acc_t> *buffers); void make_rho_a(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void make_rho_a(IntelBuffers<flt_t, acc_t> *buffers)
void make_rho_a(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
make_rho_a<flt_t, acc_t, 1>(buffers); make_rho_a<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -125,11 +122,10 @@ namespace LAMMPS_NS {
} }
} }
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void make_rho_none(IntelBuffers<flt_t, acc_t> *buffers); void make_rho_none(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void make_rho_none(IntelBuffers<flt_t, acc_t> *buffers)
void make_rho_none(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
make_rho_none<flt_t, acc_t, 1>(buffers); make_rho_none<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -137,11 +133,10 @@ namespace LAMMPS_NS {
} }
} }
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_c_ik(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_c_ik(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_c_ik(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_c_ik(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_c_ik<flt_t, acc_t, 1>(buffers); fieldforce_c_ik<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -151,8 +146,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_c_ad(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_c_ad(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_c_ad(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_c_ad(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_c_ad<flt_t, acc_t, 1>(buffers); fieldforce_c_ad<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -162,8 +157,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_g_ik(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_g_ik(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_g_ik(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_g_ik(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_g_ik<flt_t, acc_t, 1>(buffers); fieldforce_g_ik<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -173,8 +168,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_g_ad(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_g_ad(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_g_ad(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_g_ad(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_g_ad<flt_t, acc_t, 1>(buffers); fieldforce_g_ad<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -184,8 +179,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_a_ik(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_a_ik(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_a_ik(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_a_ik(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_a_ik<flt_t, acc_t, 1>(buffers); fieldforce_a_ik<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -195,8 +190,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_a_ad(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_a_ad(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_a_ad(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_a_ad(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_a_ad<flt_t, acc_t, 1>(buffers); fieldforce_a_ad<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -205,8 +200,8 @@ namespace LAMMPS_NS {
} }
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_none_ik(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_none_ik(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_none_ik(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_none_ik(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_none_ik<flt_t, acc_t, 1>(buffers); fieldforce_none_ik<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -216,8 +211,8 @@ namespace LAMMPS_NS {
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_none_ad(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_none_ad(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_none_ad(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_none_ad(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_none_ad<flt_t, acc_t, 1>(buffers); fieldforce_none_ad<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -226,11 +221,8 @@ namespace LAMMPS_NS {
} }
void precompute_rho(); void precompute_rho();
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -28,8 +28,8 @@ KSpaceStyle(pppm/intel,PPPMIntel);
#ifndef LMP_PPPMINTEL_H #ifndef LMP_PPPMINTEL_H
#define LMP_PPPMINTEL_H #define LMP_PPPMINTEL_H
#include "pppm.h"
#include "fix_intel.h" #include "fix_intel.h"
#include "pppm.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -69,16 +69,14 @@ class PPPMIntel : public PPPM {
virtual void allocate(); virtual void allocate();
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void test_function(IntelBuffers<flt_t, acc_t> *buffers);
void test_function(IntelBuffers<flt_t,acc_t> *buffers);
void precompute_rho(); void precompute_rho();
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void particle_map(IntelBuffers<flt_t, acc_t> *buffers);
void particle_map(IntelBuffers<flt_t,acc_t> *buffers);
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void make_rho(IntelBuffers<flt_t, acc_t> *buffers); void make_rho(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void make_rho(IntelBuffers<flt_t, acc_t> *buffers)
void make_rho(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
make_rho<flt_t, acc_t, 1>(buffers); make_rho<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -87,8 +85,8 @@ class PPPMIntel : public PPPM {
} }
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_ik(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_ik(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_ik(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_ik(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_ik<flt_t, acc_t, 1>(buffers); fieldforce_ik<flt_t, acc_t, 1>(buffers);
} else { } else {
@ -97,19 +95,18 @@ class PPPMIntel : public PPPM {
} }
template <class flt_t, class acc_t, int use_table> template <class flt_t, class acc_t, int use_table>
void fieldforce_ad(IntelBuffers<flt_t, acc_t> *buffers); void fieldforce_ad(IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t> template <class flt_t, class acc_t> void fieldforce_ad(IntelBuffers<flt_t, acc_t> *buffers)
void fieldforce_ad(IntelBuffers<flt_t,acc_t> *buffers) { {
if (_use_table == 1) { if (_use_table == 1) {
fieldforce_ad<flt_t, acc_t, 1>(buffers); fieldforce_ad<flt_t, acc_t, 1>(buffers);
} else { } else {
fieldforce_ad<flt_t, acc_t, 0>(buffers); fieldforce_ad<flt_t, acc_t, 0>(buffers);
} }
} }
FFT_SCALAR ***create3d_offset(FFT_SCALAR ***&, int, int, int, FFT_SCALAR ***create3d_offset(FFT_SCALAR ***&, int, int, int, int, int, int, const char *name);
int, int, int, const char *name);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -21,8 +21,8 @@ IntegrateStyle(verlet/lrt/intel,VerletLRTIntel);
#ifndef LMP_VERLET_LRT_INTEL_H #ifndef LMP_VERLET_LRT_INTEL_H
#define LMP_VERLET_LRT_INTEL_H #define LMP_VERLET_LRT_INTEL_H
#include "verlet.h"
#include "pppm_intel.h" #include "pppm_intel.h"
#include "verlet.h"
#ifdef LMP_INTEL_USELRT #ifdef LMP_INTEL_USELRT
#if defined(LMP_INTEL_LRT11) || defined(__APPLE__) #if defined(LMP_INTEL_LRT11) || defined(__APPLE__)
@ -64,7 +64,7 @@ class VerletLRTIntel : public Verlet {
#endif #endif
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -20,7 +20,6 @@ FixStyle(nvt/kk/host,FixNVTKokkos<LMPHostType>);
// clang-format on // clang-format on
#else #else
// clang-format off // clang-format off
#ifndef LMP_FIX_NVT_KOKKOS_H #ifndef LMP_FIX_NVT_KOKKOS_H
#define LMP_FIX_NVT_KOKKOS_H #define LMP_FIX_NVT_KOKKOS_H

View File

@ -886,7 +886,8 @@ void FixMDIEngine::receive_cell(Error *error)
double small = std::numeric_limits<double>::min(); double small = std::numeric_limits<double>::min();
if (fabs(celldata[1]) > small or fabs(celldata[2]) > small or fabs(celldata[3]) > small or 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) { 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 // set the new LAMMPS cell dimensions

View File

@ -1,4 +1,3 @@
// clang-format off
/* -*- c++ -*- ---------------------------------------------------------- /* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -28,6 +27,7 @@ PairStyle(mgpt,PairMGPT);
// clang-format on // clang-format on
#else #else
// clang-format off
#ifndef LMP_PAIR_MGPT_H #ifndef LMP_PAIR_MGPT_H
#define LMP_PAIR_MGPT_H #define LMP_PAIR_MGPT_H

View File

@ -25,9 +25,9 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "memory.h" #include "memory.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "neigh_request.h" #include "neigh_request.h"
#include "neighbor.h"
#include "update.h" #include "update.h"
#include "InterfaceLammps.h" // n2p2 interface header #include "InterfaceLammps.h" // n2p2 interface header
@ -38,7 +38,8 @@ static const char cite_user_hdnnp_package[] =
"ML-HDNNP package: 10.1021/acs.jctc.8b00770\n\n" "ML-HDNNP package: 10.1021/acs.jctc.8b00770\n\n"
"@Article{Singraber19,\n" "@Article{Singraber19,\n"
" author = {Singraber, Andreas and Behler, J{\"o}rg and Dellago, Christoph},\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" " title = {Library-{{Based LAMMPS Implementation}} of {{High}}-{{Dimensional Neural Network "
"Potentials}}},\n"
" year = {2019},\n" " year = {2019},\n"
" month = mar,\n" " month = mar,\n"
" volume = {15},\n" " volume = {15},\n"
@ -58,7 +59,8 @@ PairHDNNP::PairHDNNP(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0; // 1 if pair style writes restart info restartinfo = 0; // 1 if pair style writes restart info
one_coeff = 1; // 1 if allows only one coeff * * call one_coeff = 1; // 1 if allows only one coeff * * call
manybody_flag = 1; // 1 if a manybody potential manybody_flag = 1; // 1 if a manybody potential
unit_convert_flag = 0; // TODO: Check possible values. value != 0 indicates support for unit conversion. 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 reinitflag = 0; // 1 if compatible with fix adapt and alike
interface = new nnp::InterfaceLammps(); interface = new nnp::InterfaceLammps();
@ -93,9 +95,7 @@ void PairHDNNP::compute(int eflag, int vflag)
interface->process(); interface->process();
// Do all stuff related to extrapolation warnings. // Do all stuff related to extrapolation warnings.
if(showew == true || showewsum > 0 || maxew >= 0) { if (showew == true || showewsum > 0 || maxew >= 0) { handleExtrapolationWarnings(); }
handleExtrapolationWarnings();
}
// Calculate forces of local and ghost atoms. // Calculate forces of local and ghost atoms.
interface->getForces(atom->f); interface->getForces(atom->f);
@ -106,8 +106,7 @@ void PairHDNNP::compute(int eflag, int vflag)
// Add atomic energy if requested (CAUTION: no physical meaning!). // Add atomic energy if requested (CAUTION: no physical meaning!).
if (eflag_atom) if (eflag_atom)
for (int i = 0; i < atom->nlocal; ++i) for (int i = 0; i < atom->nlocal; ++i) eatom[i] = interface->getAtomicEnergy(i);
eatom[i] = interface->getAtomicEnergy(i);
// If virial needed calculate via F dot r. // If virial needed calculate via F dot r.
if (vflag_fdotr) virial_fdotr_compute(); if (vflag_fdotr) virial_fdotr_compute();
@ -140,15 +139,13 @@ void PairHDNNP::settings(int narg, char **arg)
while (iarg < narg) { while (iarg < narg) {
// set HDNNP directory // set HDNNP directory
if (strcmp(arg[iarg], "dir") == 0) { if (strcmp(arg[iarg], "dir") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
delete[] directory; delete[] directory;
directory = utils::strdup(arg[iarg + 1]); directory = utils::strdup(arg[iarg + 1]);
iarg += 2; iarg += 2;
// show extrapolation warnings // show extrapolation warnings
} else if (strcmp(arg[iarg], "showew") == 0) { } else if (strcmp(arg[iarg], "showew") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[iarg + 1], "yes") == 0) if (strcmp(arg[iarg + 1], "yes") == 0)
showew = true; showew = true;
else if (strcmp(arg[iarg + 1], "no") == 0) else if (strcmp(arg[iarg + 1], "no") == 0)
@ -158,20 +155,17 @@ void PairHDNNP::settings(int narg, char **arg)
iarg += 2; iarg += 2;
// show extrapolation warning summary // show extrapolation warning summary
} else if (strcmp(arg[iarg], "showewsum") == 0) { } else if (strcmp(arg[iarg], "showewsum") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
showewsum = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); showewsum = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
// maximum allowed extrapolation warnings // maximum allowed extrapolation warnings
} else if (strcmp(arg[iarg], "maxew") == 0) { } else if (strcmp(arg[iarg], "maxew") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
maxew = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); maxew = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
// reset extrapolation warning counter // reset extrapolation warning counter
} else if (strcmp(arg[iarg], "resetew") == 0) { } else if (strcmp(arg[iarg], "resetew") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[iarg + 1], "yes") == 0) if (strcmp(arg[iarg + 1], "yes") == 0)
resetew = true; resetew = true;
else if (strcmp(arg[iarg + 1], "no") == 0) else if (strcmp(arg[iarg + 1], "no") == 0)
@ -181,17 +175,16 @@ void PairHDNNP::settings(int narg, char **arg)
iarg += 2; iarg += 2;
// length unit conversion factor // length unit conversion factor
} else if (strcmp(arg[iarg], "cflength") == 0) { } else if (strcmp(arg[iarg], "cflength") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
cflength = utils::numeric(FLERR, arg[iarg + 1], false, lmp); cflength = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
// energy unit conversion factor // energy unit conversion factor
} else if (strcmp(arg[iarg], "cfenergy") == 0) { } else if (strcmp(arg[iarg], "cfenergy") == 0) {
if (iarg+2 > narg) if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR,"Illegal pair_style command");
cfenergy = utils::numeric(FLERR, arg[iarg + 1], false, lmp); cfenergy = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal pair_style command"); } else
error->all(FLERR, "Illegal pair_style command");
} }
} }
@ -205,8 +198,7 @@ void PairHDNNP::coeff(int narg, char **arg)
if (!allocated) allocate(); if (!allocated) allocate();
if (narg != 2 + n) if (narg != 2 + n) error->all(FLERR, "Incorrect args for pair coefficients");
error->all(FLERR,"Incorrect args for pair coefficients");
if (strcmp(arg[0], "*") != 0 || strcmp(arg[1], "*") != 0) if (strcmp(arg[0], "*") != 0 || strcmp(arg[1], "*") != 0)
error->all(FLERR, "Incorrect args for pair coefficients"); error->all(FLERR, "Incorrect args for pair coefficients");
@ -251,24 +243,13 @@ void PairHDNNP::init_style()
// Activate screen and logfile output only for rank 0. // Activate screen and logfile output only for rank 0.
if (comm->me == 0) { if (comm->me == 0) {
if (lmp->screen != nullptr) if (lmp->screen != nullptr) interface->log.registerCFilePointer(&(lmp->screen));
interface->log.registerCFilePointer(&(lmp->screen)); if (lmp->logfile != nullptr) interface->log.registerCFilePointer(&(lmp->logfile));
if (lmp->logfile != nullptr)
interface->log.registerCFilePointer(&(lmp->logfile));
} }
// Initialize interface on all processors. // Initialize interface on all processors.
interface->initialize(directory, interface->initialize(directory, emap.c_str(), showew, resetew, showewsum, maxew, cflength,
emap.c_str(), cfenergy, maxCutoffRadius, atom->ntypes, comm->me);
showew,
resetew,
showewsum,
maxew,
cflength,
cfenergy,
maxCutoffRadius,
atom->ntypes,
comm->me);
// LAMMPS cutoff radius (given via pair_coeff) should not be smaller than // LAMMPS cutoff radius (given via pair_coeff) should not be smaller than
// maximum symmetry function cutoff radius. // maximum symmetry function cutoff radius.
@ -296,8 +277,7 @@ void PairHDNNP::allocate()
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 i = 1; i <= n; i++)
for (int j = i; j <= n; j++) for (int j = i; j <= n; j++) setflag[i][j] = 0;
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?
} }
@ -315,9 +295,7 @@ void PairHDNNP::transferNeighborList()
double dy = atom->x[i][1] - atom->x[j][1]; double dy = atom->x[i][1] - atom->x[j][1];
double dz = atom->x[i][2] - atom->x[j][2]; double dz = atom->x[i][2] - atom->x[j][2];
double d2 = dx * dx + dy * dy + dz * dz; double d2 = dx * dx + dy * dy + dz * dz;
if (d2 <= rc2) { if (d2 <= rc2) { interface->addNeighbor(i, j, atom->tag[j], atom->type[j], dx, dy, dz, d2); }
interface->addNeighbor(i,j,atom->tag[j],atom->type[j],dx,dy,dz,d2);
}
} }
} }
} }
@ -328,13 +306,13 @@ void PairHDNNP::handleExtrapolationWarnings()
long numCurrentEW = (long) interface->getNumExtrapolationWarnings(); long numCurrentEW = (long) interface->getNumExtrapolationWarnings();
// Update (or set, resetew == true) total warnings counter. // Update (or set, resetew == true) total warnings counter.
if (resetew) numExtrapolationWarningsTotal = numCurrentEW; if (resetew)
else numExtrapolationWarningsTotal += numCurrentEW; numExtrapolationWarningsTotal = numCurrentEW;
else
numExtrapolationWarningsTotal += numCurrentEW;
// Update warnings summary counter. // Update warnings summary counter.
if(showewsum > 0) { if (showewsum > 0) { numExtrapolationWarningsSummary += numCurrentEW; }
numExtrapolationWarningsSummary += numCurrentEW;
}
// If requested write extrapolation warnings. // If requested write extrapolation warnings.
// Requires communication of all symmetry functions statistics entries to // Requires communication of all symmetry functions statistics entries to
@ -360,8 +338,7 @@ void PairHDNNP::handleExtrapolationWarnings()
} }
} }
interface->writeExtrapolationWarnings(); interface->writeExtrapolationWarnings();
} } else if (numCurrentEW > 0) {
else if(numCurrentEW > 0) {
// Get desired buffer length for all extrapolation warning entries. // Get desired buffer length for all extrapolation warning entries.
long bs = interface->getEWBufferSize(); long bs = interface->getEWBufferSize();
// Allocate and fill buffer. // Allocate and fill buffer.
@ -380,8 +357,7 @@ void PairHDNNP::handleExtrapolationWarnings()
if (showewsum > 0 && update->ntimestep % showewsum == 0) { if (showewsum > 0 && update->ntimestep % showewsum == 0) {
long globalEW = 0; long globalEW = 0;
// Communicate the sum over all processors to proc 0. // Communicate the sum over all processors to proc 0.
MPI_Reduce(&numExtrapolationWarningsSummary, MPI_Reduce(&numExtrapolationWarningsSummary, &globalEW, 1, MPI_LONG, MPI_SUM, 0, world);
&globalEW, 1, MPI_LONG, MPI_SUM, 0, world);
// Write to screen or logfile. // Write to screen or logfile.
if (comm->me == 0) if (comm->me == 0)
utils::logmesg(lmp, "### NNP EW SUMMARY ### TS: {:10d} EW {:10d} EWPERSTEP {:10.3e}\n", utils::logmesg(lmp, "### NNP EW SUMMARY ### TS: {:10d} EW {:10d} EWPERSTEP {:10.3e}\n",

View File

@ -38,7 +38,6 @@ namespace LAMMPS_NS {
class PairHDNNP : public Pair { class PairHDNNP : public Pair {
public: public:
PairHDNNP(class LAMMPS *); PairHDNNP(class LAMMPS *);
virtual ~PairHDNNP(); virtual ~PairHDNNP();
virtual void compute(int, int); virtual void compute(int, int);
@ -48,7 +47,6 @@ class PairHDNNP : public Pair {
virtual double init_one(int, int); virtual double init_one(int, int);
protected: protected:
virtual void allocate(); virtual void allocate();
void transferNeighborList(); void transferNeighborList();
void handleExtrapolationWarnings(); void handleExtrapolationWarnings();
@ -67,7 +65,7 @@ class PairHDNNP : public Pair {
nnp::InterfaceLammps *interface; nnp::InterfaceLammps *interface;
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -39,8 +39,8 @@ PairStyle(rann,PairRANN);
#include "pair.h" #include "pair.h"
#include <vector>
#include <string> #include <string>
#include <vector>
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -48,7 +48,7 @@ namespace LAMMPS_NS {
//forward declarations //forward declarations
class Activation; class Activation;
class Fingerprint; class Fingerprint;
} } // namespace RANN
class PairRANN : public Pair { class PairRANN : public Pair {
public: public:
@ -79,7 +79,8 @@ namespace LAMMPS_NS {
int *fingerprintlength; // # of input neurons defined by fingerprints of each element. int *fingerprintlength; // # of input neurons defined by fingerprints of each element.
int *fingerprintperelement; // # of fingerprints for each element int *fingerprintperelement; // # of fingerprints for each element
bool doscreen; //screening is calculated if any defined fingerprint uses it 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
allscreen; //all fingerprints use screening so screened neighbors can be completely ignored
bool dospin; bool dospin;
int res; //Resolution of function tables for cubic interpolation. int res; //Resolution of function tables for cubic interpolation.
int memguess; int memguess;
@ -92,8 +93,10 @@ namespace LAMMPS_NS {
int fmax; int fmax;
int fnmax; int fnmax;
//memory actively written to during each compute: //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 *xn, *yn, *zn, *Sik, *dSikx, *dSiky, *dSikz, *dSijkx, *dSijky, *dSijkz, *sx, *sy, *sz,
double *layer,*sum,*sum1,**dlayerx,**dlayery,**dlayerz,**dlayersumx,**dlayersumy,**dlayersumz; **dSijkxc, **dSijkyc, **dSijkzc, *dfeaturesx, *dfeaturesy, *dfeaturesz, *features;
double *layer, *sum, *sum1, **dlayerx, **dlayery, **dlayerz, **dlayersumx, **dlayersumy,
**dlayersumz;
double **dsx, **dsy, **dsz, **dssumx, **dssumy, **dssumz; double **dsx, **dsy, **dsz, **dssumx, **dssumy, **dssumz;
int *tn, *jl; int *tn, *jl;
bool *Bij; bool *Bij;
@ -135,32 +138,39 @@ namespace LAMMPS_NS {
private: private:
//new functions //new functions
void allocate(const std::vector<std::string> &);//called after reading element list, but before reading the rest of the potential void allocate(
const std::vector<std::string>
&); //called after reading element list, but before reading the rest of the potential
void deallocate(); void deallocate();
void read_file(char *); //read potential file void read_file(char *); //read potential file
void read_atom_types(std::vector<std::string>, char *, int); void read_atom_types(std::vector<std::string>, char *, int);
void read_fpe(std::vector<std::string>,std::vector<std::string>,char*,int);//fingerprints per element. Count total fingerprints defined for each 1st element in element combinations void read_fpe(
std::vector<std::string>, std::vector<std::string>, char *,
int); //fingerprints per element. Count total fingerprints defined for each 1st element in element combinations
void read_fingerprints(std::vector<std::string>, std::vector<std::string>, char *, int); void read_fingerprints(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_fingerprint_constants(std::vector<std::string>, std::vector<std::string>, char *, int); void read_fingerprint_constants(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_network_layers(std::vector<std::string>,std::vector<std::string>,char*,int);//include input and output layer (hidden layers + 2) void read_network_layers(std::vector<std::string>, std::vector<std::string>, char *,
int); //include input and output layer (hidden layers + 2)
void read_layer_size(std::vector<std::string>, std::vector<std::string>, char *, int); void read_layer_size(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_weight(std::vector<std::string>,std::vector<std::string>,FILE*,char*,int*);//weights should be formatted as properly shaped matrices void read_weight(std::vector<std::string>, std::vector<std::string>, FILE *, char *,
void read_bias(std::vector<std::string>,std::vector<std::string>,FILE*,char*,int*);//biases should be formatted as properly shaped vectors int *); //weights should be formatted as properly shaped matrices
void read_bias(std::vector<std::string>, std::vector<std::string>, FILE *, char *,
int *); //biases should be formatted as properly shaped vectors
void read_activation_functions(std::vector<std::string>, std::vector<std::string>, char *, int); void read_activation_functions(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_screening(std::vector<std::string>, std::vector<std::string>, char *, int); void read_screening(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_mass(const std::vector<std::string> &, const std::vector<std::string> &,const char*,int); void read_mass(const std::vector<std::string> &, const std::vector<std::string> &, const char *,
int);
bool check_potential(); //after finishing reading potential file bool check_potential(); //after finishing reading potential file
void propagateforward(double *,double **,int,int);//called by compute to get force and energy void propagateforward(double *, double **, int,
void propagateforwardspin(double *,double **,double**,int,int);//called by compute to get force and energy 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 screening(int, int, int);
void cull_neighbor_list(int *, int, int); void cull_neighbor_list(int *, int, int);
void screen_neighbor_list(int *); void screen_neighbor_list(int *);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -31,7 +31,6 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#ifndef LMP_RANN_ACTIVATION_H #ifndef LMP_RANN_ACTIVATION_H
#define LMP_RANN_ACTIVATION_H #define LMP_RANN_ACTIVATION_H
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace RANN { namespace RANN {
class Activation { class Activation {
@ -45,28 +44,21 @@ namespace LAMMPS_NS {
const char *style; const char *style;
}; };
Activation::Activation(PairRANN *) { Activation::Activation(PairRANN *)
{
empty = true; empty = true;
style = "empty"; style = "empty";
} }
Activation::~Activation() { Activation::~Activation() {}
}
//default is linear activation (no change). //default is linear activation (no change).
double Activation::activation_function(double A) { double Activation::activation_function(double A) { return A; }
return A;
}
double Activation::dactivation_function(double) { double Activation::dactivation_function(double) { return 1.0; }
return 1.0;
}
double Activation::ddactivation_function(double) {
return 0.0;
}
}
}
double Activation::ddactivation_function(double) { return 0.0; }
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* RANN_ACTIVATION_H_ */ #endif /* RANN_ACTIVATION_H_ */

View File

@ -43,25 +43,18 @@ namespace LAMMPS_NS {
double ddactivation_function(double); double ddactivation_function(double);
}; };
Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair) { Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair)
{
empty = false; empty = false;
style = "linear"; style = "linear";
} }
double Activation_linear::activation_function(double A) double Activation_linear::activation_function(double A) { return A; }
{
return A;
}
double Activation_linear::dactivation_function(double) double Activation_linear::dactivation_function(double) { return 1.0; }
{
return 1.0;
}
double Activation_linear::ddactivation_function(double) { double Activation_linear::ddactivation_function(double) { return 0.0; }
return 0.0; } // namespace RANN
} } // namespace LAMMPS_NS
}
}
#endif /* ACTIVATION_LINEAR_H_ */ #endif /* ACTIVATION_LINEAR_H_ */

View File

@ -44,27 +44,32 @@ namespace LAMMPS_NS {
double ddactivation_function(double); double ddactivation_function(double);
}; };
Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair) { Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair)
{
empty = false; empty = false;
style = "sigI"; style = "sigI";
} }
double Activation_sigI::activation_function(double in) { double Activation_sigI::activation_function(double in)
{
if (in > 34) return in; if (in > 34) return in;
return 0.1 * in + 0.9 * log(exp(in) + 1); return 0.1 * in + 0.9 * log(exp(in) + 1);
} }
double Activation_sigI::dactivation_function(double in) { double Activation_sigI::dactivation_function(double in)
{
if (in > 34) return 1; if (in > 34) return 1;
return 0.1 + 0.9 / (exp(in) + 1) * exp(in); return 0.1 + 0.9 / (exp(in) + 1) * exp(in);
} }
double Activation_sigI::ddactivation_function(double in) { double Activation_sigI::ddactivation_function(double in)
{
if (in > 34) return 0; if (in > 34) return 0;
return 0.9*exp(in)/(exp(in)+1)/(exp(in)+1);; return 0.9 * exp(in) / (exp(in) + 1) / (exp(in) + 1);
;
} }
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* ACTIVATION_SIGI_H_ */ #endif /* ACTIVATION_SIGI_H_ */

View File

@ -44,9 +44,12 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); void allocate();
void compute_fingerprint(double*,double*,double*,double*,int,int,double *,double *,double *,int *,int,int *); void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *,
void do3bodyfeatureset_doubleneighborloop(double *,double *,double *,double *,int,int,double *,double *,double *,int *,int,int *); double *, int *, int, int *);
void do3bodyfeatureset_singleneighborloop(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_exp_cut_table();
void generate_coefficients(); void generate_coefficients();
int get_length(); int get_length();
@ -63,10 +66,9 @@ namespace LAMMPS_NS {
int kmax; int kmax;
int mlength; int mlength;
int **Mf; int **Mf;
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */ #endif /* FINGERPRINT_BOND_H_ */

View File

@ -44,9 +44,17 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); 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 compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
void do3bodyfeatureset_doubleneighborloop(double *,double *,double *,double *,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); double *, double *, double *, double *, bool *, int, int, double *,
void do3bodyfeatureset_singleneighborloop(double *,double *,double *,double *,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*); 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_exp_cut_table();
void generate_coefficients(); void generate_coefficients();
int get_length(); int get_length();
@ -63,10 +71,9 @@ namespace LAMMPS_NS {
int kmax; int kmax;
int mlength; int mlength;
int **Mf; int **Mf;
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */ #endif /* FINGERPRINT_BOND_H_ */

View File

@ -44,9 +44,17 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); 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 compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
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 *); double *, double *, double *, double *, double *, double *, double *,
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*); 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_exp_cut_table();
void generate_coefficients(); void generate_coefficients();
int get_length(); int get_length();
@ -63,10 +71,9 @@ namespace LAMMPS_NS {
int kmax; int kmax;
int mlength; int mlength;
int **Mf; int **Mf;
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */ #endif /* FINGERPRINT_BOND_H_ */

View File

@ -43,9 +43,15 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); void allocate();
virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);//spin virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *,
void do3bodyfeatureset_doubleneighborloop(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); double *, int, int, double *, double *, double *, int *, int,
void do3bodyfeatureset_singleneighborloop(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,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_exp_cut_table();
void generate_coefficients(); void generate_coefficients();
int get_length(); int get_length();
@ -62,10 +68,9 @@ namespace LAMMPS_NS {
int kmax; int kmax;
int mlength; int mlength;
int **Mf; int **Mf;
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */ #endif /* FINGERPRINT_BOND_H_ */

View File

@ -44,7 +44,8 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); void allocate();
void compute_fingerprint(double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *,
double *, int *, int, int *);
int get_length(); int get_length();
double *radialtable; double *radialtable;
@ -54,10 +55,9 @@ namespace LAMMPS_NS {
double re; double re;
int nmax; //highest term int nmax; //highest term
int omin; //lowest term int omin; //lowest term
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIAL_H_ */ #endif /* FINGERPRINT_RADIAL_H_ */

View File

@ -43,7 +43,9 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); 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 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(); int get_length();
double *radialtable; double *radialtable;
@ -53,10 +55,9 @@ namespace LAMMPS_NS {
double re; double re;
int nmax; //highest term int nmax; //highest term
int omin; //lowest term int omin; //lowest term
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIALSCREENED_H_ */ #endif /* FINGERPRINT_RADIALSCREENED_H_ */

View File

@ -43,7 +43,10 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); 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 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(); int get_length();
double *radialtable; double *radialtable;
@ -53,10 +56,9 @@ namespace LAMMPS_NS {
double re; double re;
int nmax; //highest term int nmax; //highest term
int omin; //lowest term int omin; //lowest term
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIALSCREENED_H_ */ #endif /* FINGERPRINT_RADIALSCREENED_H_ */

View File

@ -43,7 +43,8 @@ namespace LAMMPS_NS {
void write_values(FILE *); void write_values(FILE *);
void init(int *, int); void init(int *, int);
void allocate(); void allocate();
void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*); void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
int, int, double *, double *, double *, int *, int, int *);
int get_length(); int get_length();
double *radialtable; double *radialtable;
@ -53,10 +54,9 @@ namespace LAMMPS_NS {
double re; double re;
int nmax; //highest term int nmax; //highest term
int omin; //lowest term int omin; //lowest term
}; };
} } // namespace RANN
} } // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIAL_H_ */ #endif /* FINGERPRINT_RADIAL_H_ */

View File

@ -221,7 +221,8 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th
} }
if (EVFLAG) 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; f[i].x += fxtmp;

View File

@ -36,7 +36,7 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public
void eval(int ifrom, int ito, ThrData *const thr); void eval(int ifrom, int ito, ThrData *const thr);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -37,7 +37,7 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi
void eval(int ifrom, int ito, ThrData *const thr); void eval(int ifrom, int ito, ThrData *const thr);
}; };
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif

View File

@ -48,31 +48,29 @@ class PairReaxFFOMP : public PairReaxFF, public ThrOMP {
reduce_thr(styleparm, eflagparm, vflagparm, thrparm); reduce_thr(styleparm, eflagparm, vflagparm, thrparm);
} }
inline void ev_tally_thr_proxy(const int iparm, const int jparm, inline void ev_tally_thr_proxy(const int iparm, const int jparm, const int nlocalparm,
const int nlocalparm, const int newton_pairparm, const int newton_pairparm, const double evdwlparm,
const double evdwlparm, const double ecoulparm, const double ecoulparm, const double fpairparm,
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);
}
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 delxparm, const double delyparm,
const double delzparm, ThrData *const thrparm) const double delzparm, ThrData *const thrparm)
{ {
ev_tally_xyz_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, ev_tally_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fpairparm,
fxparm, fyparm, fzparm, delxparm, delyparm, delzparm, thrparm); delxparm, delyparm, delzparm, thrparm);
} }
inline void ev_tally3_thr_proxy(int i, int j, int k, double evdwl, inline void ev_tally_xyz_thr_proxy(const int iparm, const int jparm, const int nlocalparm,
double ecoul, double *fj, double *fk, double *drji, double *drki, const int newton_pairparm, const double evdwlparm,
ThrData *const thrparm) 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);
}
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); ev_tally3_thr(this, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm);
} }

View File

@ -27,8 +27,7 @@
#include <omp.h> #include <omp.h>
#endif #endif
namespace ReaxFF namespace ReaxFF {
{
// exported Functions // exported Functions
// bond orders OpenMP // bond orders OpenMP
@ -36,31 +35,29 @@ namespace ReaxFF
extern void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **); 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 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 *, extern int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *,
single_body_parameters *, single_body_parameters *, single_body_parameters *, single_body_parameters *, two_body_parameters *, int,
two_body_parameters *, int, double, double, double, double, double, double, double, double, double, double);
double, double, double, double);
extern void BOOMP(reax_system *, storage *, reax_list **); extern void BOOMP(reax_system *, storage *, reax_list **);
// bonds OpenMP // bonds OpenMP
extern void BondsOMP(reax_system *, simulation_data *, extern void BondsOMP(reax_system *, simulation_data *, storage *, reax_list **);
storage *, reax_list **);
// forces OpenMP // forces OpenMP
extern void Compute_ForcesOMP(reax_system *, control_params *, extern void Compute_ForcesOMP(reax_system *, control_params *, simulation_data *, storage *,
simulation_data *, storage *, reax_list **); reax_list **);
// hydrogen bonds // hydrogen bonds
extern void Hydrogen_BondsOMP(reax_system *, control_params *, extern void Hydrogen_BondsOMP(reax_system *, control_params *, simulation_data *, storage *,
simulation_data *, storage *, reax_list **); reax_list **);
// init md OpenMP // init md OpenMP
extern void InitializeOMP(reax_system *, control_params *, simulation_data *, extern void InitializeOMP(reax_system *, control_params *, simulation_data *, storage *,
storage *, reax_list **,MPI_Comm); reax_list **, MPI_Comm);
// multi body // multi body
@ -68,36 +65,35 @@ namespace ReaxFF
// nonbonded // nonbonded
extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *, extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *, simulation_data *, storage *,
simulation_data *, storage *, reax_list **);
extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *,
simulation_data *, storage *,
reax_list **); reax_list **);
extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *, extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *, simulation_data *,
int, int, double, LR_data *); storage *, reax_list **);
extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *, int, int, double,
LR_data *);
// torsion angles // torsion angles
extern void Torsion_AnglesOMP(reax_system *, control_params *, extern void Torsion_AnglesOMP(reax_system *, control_params *, simulation_data *, storage *,
simulation_data *, storage *, reax_list **); reax_list **);
// valence angles // valence angles
extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *); extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *);
extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double, extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double, rvec *, rvec *, rvec *);
rvec *, rvec *, rvec *); extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *, storage *,
extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *, reax_list **);
storage *, reax_list **);
// OpenMP helpers // OpenMP helpers
inline int get_tid() { inline int get_tid()
{
#if defined(_OPENMP) #if defined(_OPENMP)
return omp_get_thread_num(); return omp_get_thread_num();
#else #else
return 0; return 0;
#endif #endif
} }
} } // namespace ReaxFF
#endif #endif

View File

@ -135,8 +135,10 @@ class ThrOMP {
void ev_tally_xyz_full_thr(Pair *const, const int, const double, const double, const double, 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, const double, const double, const double, const double, const double,
ThrData *const); ThrData *const);
void v_tally2_thr(Pair *const, const int, const int, const double, const double *const, ThrData *const); void v_tally2_thr(Pair *const, const int, const int, const double, const double *const,
void v_tally2_newton_thr(Pair *const, const int, const double *const, const double *const, ThrData *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, 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, const double *const, const double *const,
const double *const, ThrData *const); const double *const, ThrData *const);

View File

@ -1340,13 +1340,17 @@ void FixSRD::collisions_single()
std::string mesg; std::string mesg;
if (type != WALL) if (type != WALL)
mesg = fmt::format("SRD particle {} started inside big particle {} on step {} " 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 else
mesg = fmt::format("SRD particle {} started inside wall {} on step {} " 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); if (insideflag == INSIDE_ERROR)
else error->warning(FLERR, mesg); error->one(FLERR, mesg);
else
error->warning(FLERR, mesg);
} }
break; break;
} }
@ -1490,10 +1494,12 @@ void FixSRD::collisions_multi()
std::string mesg; std::string mesg;
if (type != WALL) if (type != WALL)
mesg = fmt::format("SRD particle {} started inside big particle {} on step {} " 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 else
mesg = fmt::format("SRD particle {} started inside wall {} on step {} " 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); if (insideflag == INSIDE_ERROR) error->one(FLERR, mesg);
error->warning(FLERR, mesg); error->warning(FLERR, mesg);