move precomputation for factor_sqrt to individual Pair::compute() functions

the special_lj values may be changed for individual hybrid sub-styles
with pair_modify pair special. thus the factor_sqrt[] array may have
incorrect values when computed during Pair::init_style().
This commit is contained in:
Axel Kohlmeyer
2025-02-24 08:19:28 -05:00
parent 9f6f957f7c
commit d79be293f5
9 changed files with 36 additions and 13 deletions

View File

@ -74,6 +74,10 @@ void PairDPD::compute(int eflag, int vflag)
evdwl = 0.0;
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -266,10 +270,6 @@ void PairDPD::init_style()
error->warning(FLERR, "Pair dpd needs newton pair on for momentum conservation");
neighbor->add_request(this);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
}
/* ----------------------------------------------------------------------

View File

@ -90,6 +90,10 @@ void PairDPDCoulSlaterLong::compute(int eflag, int vflag)
evdwl = ecoul = 0.0;
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -334,11 +338,6 @@ void PairDPDCoulSlaterLong::init_style()
neighbor->add_request(this);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
// ensure use of KSpace long-range solver, set g_ewald
if (force->kspace == nullptr)

View File

@ -81,6 +81,10 @@ void PairDPDExt::compute(int eflag, int vflag)
evdwl = 0.0;
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -325,10 +329,6 @@ void PairDPDExt::init_style()
error->warning(FLERR, "Pair dpd needs newton pair on for momentum conservation");
neighbor->add_request(this);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
}
/* ----------------------------------------------------------------------

View File

@ -54,6 +54,10 @@ void PairDPDExtTstat::compute(int eflag, int vflag)
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
// adjust sigma if target T is changing
if (t_start != t_stop) {

View File

@ -48,6 +48,10 @@ void PairDPDTstat::compute(int eflag, int vflag)
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
// adjust sigma if target T is changing
if (t_start != t_stop) {

View File

@ -60,6 +60,10 @@ void PairDPDExtOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -60,6 +60,10 @@ void PairDPDExtTstatOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -59,6 +59,10 @@ void PairDPDOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -60,6 +60,10 @@ void PairDPDTstatOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;