}
}
- if (la_max >= 0 && DOMAINDECOMP(cr))
+ if (la_max >= 0 && haveDDAtomOrdering(*cr))
{
a_max = cr->dd->globalAtomIndices[la_max];
}
top_global,
constr ? constr->numFlexibleConstraints() : 0,
ir->nstcalcenergy,
- DOMAINDECOMP(cr),
+ haveDDAtomOrdering(*cr),
thisRankHasDuty(cr, DUTY_PME));
}
else
}
}
- if (DOMAINDECOMP(cr))
+ if (haveDDAtomOrdering(*cr))
{
+ // Local state only becomes valid now.
dd_init_local_state(*cr->dd, state_global, &ems->s);
/* Distribute the charge groups over the nodes from the master node */
if (confout != nullptr)
{
- if (DOMAINDECOMP(cr))
+ if (haveDDAtomOrdering(*cr))
{
/* If bX=true, x was collected to state_global in the call above */
if (!bX)
if (MASTER(cr))
{
- if (ir->pbcType != PbcType::No && !ir->bPeriodicMols && DOMAINDECOMP(cr))
+ if (ir->pbcType != PbcType::No && !ir->bPeriodicMols && haveDDAtomOrdering(*cr))
{
/* Make molecules whole only for confout writing */
do_pbc_mtop(ir->pbcType, state->s.box, &top_global, state_global->x.rvec_array());
s1 = &ems1->s;
s2 = &ems2->s;
- if (DOMAINDECOMP(cr) && s1->ddp_count != cr->dd->ddp_count)
+ if (haveDDAtomOrdering(*cr) && s1->ddp_count != cr->dd->ddp_count)
{
gmx_incons("state mismatch in do_em_step");
}
state_change_natoms(s2, s1->natoms);
ems2->f.resize(s2->natoms);
}
- if (DOMAINDECOMP(cr) && s2->cg_gl.size() != s1->cg_gl.size())
+ if (haveDDAtomOrdering(*cr) && s2->cg_gl.size() != s1->cg_gl.size())
{
s2->cg_gl.resize(s1->cg_gl.size());
}
}
}
- if (DOMAINDECOMP(cr))
+ if (haveDDAtomOrdering(*cr))
{
/* OpenMP does not supported unsigned loop variables */
#pragma omp for schedule(static) nowait
}
}
- if (DOMAINDECOMP(cr))
+ if (haveDDAtomOrdering(*cr))
{
s2->ddp_count = s1->ddp_count;
s2->ddp_count_cg_gl = s1->ddp_count_cg_gl;
// Compute the buffer size of the pair list
const real bufferSize = inputrec->rlist - std::max(inputrec->rcoulomb, inputrec->rvdw);
- if (bFirst || bufferSize <= 0 || (DOMAINDECOMP(cr) && ems->s.ddp_count != ddpCountPairSearch))
+ if (bFirst || bufferSize <= 0 || (haveDDAtomOrdering(*cr) && ems->s.ddp_count != ddpCountPairSearch))
{
/* This is the first state or an old state used before the last ns */
bNS = TRUE;
> bufferSize;
}
- if (DOMAINDECOMP(cr) && bNS)
+ if (haveDDAtomOrdering(*cr) && bNS)
{
/* Repartition the domain decomposition */
em_dd_partition_system(
shake_vir,
*inputrec,
nullptr,
- gmx::ArrayRef<real>{},
nullptr,
std::vector<real>(1, terminate),
FALSE,
* and might have to sum it in parallel runs.
*/
- if (!DOMAINDECOMP(cr)
+ if (!haveDDAtomOrdering(*cr)
|| (s_min->s.ddp_count == cr->dd->ddp_count && s_b->s.ddp_count == cr->dd->ddp_count))
{
auto fm = s_min->f.view().force();
{
const char* CG = "Polak-Ribiere Conjugate Gradients";
- gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
double tmp, minstep;
real stepsize;
state_global,
top_global,
s_min,
- &top,
+ top,
nrnb,
fr,
mdAtoms,
cr,
ms,
top_global,
- &top,
+ top,
inputrec,
imdSession,
pull_work,
* We do not unshift, so molecules are always whole in congrad.c
*/
energyEvaluator.run(s_min, mu_tot, vir, pres, -1, TRUE, step);
+ observablesReducer.markAsReadyToReduce();
if (MASTER(cr))
{
mdatoms->tmass,
enerd,
nullptr,
- nullptr,
nullBox,
PTCouplingArrays(),
0,
a = 0.0;
c = a + stepsize; /* reference position along line is zero */
- if (DOMAINDECOMP(cr) && s_min->s.ddp_count < cr->dd->ddp_count)
+ if (haveDDAtomOrdering(*cr) && s_min->s.ddp_count < cr->dd->ddp_count)
{
em_dd_partition_system(fplog,
mdlog,
imdSession,
pull_work,
s_min,
- &top,
+ top,
mdAtoms,
fr,
vsite,
neval++;
/* Calculate energy for the trial step */
energyEvaluator.run(s_c, mu_tot, vir, pres, -1, FALSE, step);
+ observablesReducer.markAsReadyToReduce();
/* Calc derivative along line */
const rvec* pc = s_c->s.cg_p.rvec_array();
b = 0.5 * (a + c);
}
- if (DOMAINDECOMP(cr) && s_min->s.ddp_count != cr->dd->ddp_count)
+ if (haveDDAtomOrdering(*cr) && s_min->s.ddp_count != cr->dd->ddp_count)
{
/* Reload the old state */
em_dd_partition_system(fplog,
imdSession,
pull_work,
s_min,
- &top,
+ top,
mdAtoms,
fr,
vsite,
neval++;
/* Calculate energy for the trial step */
energyEvaluator.run(s_b, mu_tot, vir, pres, -1, FALSE, step);
+ observablesReducer.markAsReadyToReduce();
/* p does not change within a step, but since the domain decomposition
* might change, we have to use cg_p of s_b here.
mdatoms->tmass,
enerd,
nullptr,
- nullptr,
nullBox,
PTCouplingArrays(),
0,
* If we have reached machine precision, converged is already set to true.
*/
converged = converged || (s_min->fmax < inputrec->em_tol);
-
+ observablesReducer.markAsReadyToReduce();
} /* End of the loop */
if (converged)
{
static const char* LBFGS = "Low-Memory BFGS Minimizer";
em_state_t ems;
- gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
auto* mdatoms = mdAtoms->mdatoms();
"be available in a different form in a future version of GROMACS, "
"e.g. gmx minimize and an .mdp option.");
+ if (haveDDAtomOrdering(*cr))
+ {
+ gmx_fatal(FARGS, "L_BFGS is currently not supported");
+ }
if (PAR(cr))
{
gmx_fatal(FARGS, "L-BFGS minimization only supports a single rank");
state_global,
top_global,
&ems,
- &top,
+ top,
nrnb,
fr,
mdAtoms,
cr,
ms,
top_global,
- &top,
+ top,
inputrec,
imdSession,
pull_work,
mdatoms->tmass,
enerd,
nullptr,
- nullptr,
nullBox,
PTCouplingArrays(),
0,
mdatoms->tmass,
enerd,
nullptr,
- nullptr,
nullBox,
PTCouplingArrays(),
0,
* If we have reached machine precision, converged is already set to true.
*/
converged = converged || (ems.fmax < inputrec->em_tol);
-
+ observablesReducer.markAsReadyToReduce();
} /* End of the loop */
if (converged)
void LegacySimulator::do_steep()
{
const char* SD = "Steepest Descents";
- gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
real stepsize;
real ustep;
state_global,
top_global,
s_try,
- &top,
+ top,
nrnb,
fr,
mdAtoms,
cr,
ms,
top_global,
- &top,
+ top,
inputrec,
imdSession,
pull_work,
mdatoms->tmass,
enerd,
nullptr,
- nullptr,
nullBox,
PTCouplingArrays(),
0,
/* If energy is not smaller make the step smaller... */
ustep *= 0.5;
- if (DOMAINDECOMP(cr) && s_min->s.ddp_count != cr->dd->ddp_count)
+ if (haveDDAtomOrdering(*cr) && s_min->s.ddp_count != cr->dd->ddp_count)
{
/* Reload the old state */
em_dd_partition_system(fplog,
imdSession,
pull_work,
s_min,
- &top,
+ top,
mdAtoms,
fr,
vsite,
}
count++;
+ observablesReducer.markAsReadyToReduce();
} /* End of the loop */
/* Print some data... */
{
const char* NM = "Normal Mode Analysis";
int nnodes;
- gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
tensor vir, pres;
rvec mu_tot = { 0 };
state_global,
top_global,
&state_work,
- &top,
+ top,
nrnb,
fr,
mdAtoms,
cr,
ms,
top_global,
- &top,
+ top,
inputrec,
imdSession,
pull_work,
pull_work,
bNS,
force_flags,
- &top,
+ top,
constr,
enerd,
state_work.s.natoms,