#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
-#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pulling/pull.h"
const t_inputrec& ir_p,
pull_t* pull_work,
FILE* log_p,
- const t_mdatoms& md_p,
const t_commrec* cr_p,
const gmx_multisim_t* ms,
t_nrnb* nrnb,
int numConstraints,
int numSettles);
~Impl();
- void setConstraints(gmx_localtop_t* top, const t_mdatoms& md);
+ void setConstraints(gmx_localtop_t* top,
+ int numAtoms,
+ int numHomeAtoms,
+ real* masses,
+ real* inverseMasses,
+ bool hasMassPerturbedAtoms,
+ real lambda,
+ unsigned short* cFREEZE);
bool apply(bool bLog,
bool bEner,
int64_t step,
const gmx_mtop_t& mtop;
//! Parameters for the interactions in this domain.
const InteractionDefinitions* idef = nullptr;
- //! Data about atoms in this domain.
- const t_mdatoms& md;
+ //! Total number of atoms.
+ int numAtoms_ = 0;
+ //! Number of local atoms.
+ int numHomeAtoms_ = 0;
+ //! Atoms masses.
+ real* masses_;
+ //! Inverse masses.
+ real* inverseMasses_;
+ //! If there are atoms with perturbed mass (for FEP).
+ bool hasMassPerturbedAtoms_;
+ //! FEP lambda value.
+ real lambda_;
+ //! Freeze groups data
+ unsigned short* cFREEZE_;
//! Whether we need to do pbc for handling bonds.
bool pbcHandlingRequired_ = false;
ConstraintVariable econq)
{
bool bOK, bDump;
- int start, homenr;
+ int start;
tensor vir_r_m_dr;
real scaled_delta_t;
real invdt, vir_fac = 0, t;
bOK = TRUE;
bDump = FALSE;
- start = 0;
- homenr = md.homenr;
+ start = 0;
scaled_delta_t = step_scaling * ir.delta_t;
if (lincsd != nullptr)
{
- bOK = constrain_lincs(bLog || bEner, ir, step, lincsd, md.invmass, cr, ms, x, xprime,
- min_proj, box, pbc_null, md.nMassPerturbed != 0, lambda, dvdlambda,
+ bOK = constrain_lincs(bLog || bEner, ir, step, lincsd, inverseMasses_, cr, ms, x, xprime,
+ min_proj, box, pbc_null, hasMassPerturbedAtoms_, lambda, dvdlambda,
invdt, v.unpaddedArrayRef(), vir != nullptr, vir_r_m_dr, econq, nrnb,
maxwarn, &warncount_lincs);
if (!bOK && maxwarn < INT_MAX)
if (shaked != nullptr)
{
- bOK = constrain_shake(log, shaked.get(), md.invmass, *idef, ir, x.unpaddedArrayRef(),
+ bOK = constrain_shake(log, shaked.get(), inverseMasses_, *idef, ir, x.unpaddedArrayRef(),
xprime.unpaddedArrayRef(), min_proj, pbc_null, nrnb, lambda,
dvdlambda, invdt, v.unpaddedArrayRef(), vir != nullptr, vir_r_m_dr,
maxwarn < INT_MAX, econq);
}
else
{
- calcvir_atom_end = md.homenr;
+ calcvir_atom_end = numHomeAtoms_;
}
if (th > 0)
if (bDump)
{
- dump_confs(log, step, mtop, start, homenr, cr, x.unpaddedArrayRef(),
+ dump_confs(log, step, mtop, start, numHomeAtoms_, cr, x.unpaddedArrayRef(),
xprime.unpaddedArrayRef(), box);
}
t = ir.init_t;
}
set_pbc(&pbc, ir.pbcType, box);
- pull_constraint(pull_work, md.massT, &pbc, cr, ir.delta_t, t,
+ pull_constraint(pull_work, masses_, &pbc, cr, ir.delta_t, t,
as_rvec_array(x.unpaddedArrayRef().data()),
as_rvec_array(xprime.unpaddedArrayRef().data()),
as_rvec_array(v.unpaddedArrayRef().data()), *vir);
}
wallcycle_stop(wcycle, ewcCONSTR);
- if (!v.empty() && md.cFREEZE)
+ if (!v.empty() && cFREEZE_)
{
/* Set the velocities of frozen dimensions to zero */
ArrayRef<RVec> vRef = v.unpaddedArrayRef();
int gmx_unused numThreads = gmx_omp_nthreads_get(emntUpdate);
#pragma omp parallel for num_threads(numThreads) schedule(static)
- for (int i = 0; i < md.homenr; i++)
+ for (int i = 0; i < numHomeAtoms_; i++)
{
- int freezeGroup = md.cFREEZE[i];
+ int freezeGroup = cFREEZE_[i];
for (int d = 0; d < DIM; d++)
{
return at2s;
}
-void Constraints::Impl::setConstraints(gmx_localtop_t* top, const t_mdatoms& md)
+void Constraints::Impl::setConstraints(gmx_localtop_t* top,
+ int numAtoms,
+ int numHomeAtoms,
+ real* masses,
+ real* inverseMasses,
+ const bool hasMassPerturbedAtoms,
+ const real lambda,
+ unsigned short* cFREEZE)
{
+ numAtoms_ = numAtoms;
+ numHomeAtoms_ = numHomeAtoms;
+ masses_ = masses;
+ inverseMasses_ = inverseMasses;
+ hasMassPerturbedAtoms_ = hasMassPerturbedAtoms;
+ lambda_ = lambda;
+ cFREEZE_ = cFREEZE;
+
idef = &top->idef;
if (ncon_tot > 0)
*/
if (ir.eConstrAlg == econtLINCS)
{
- set_lincs(*idef, md.nr, md.invmass, md.lambda, EI_DYNAMICS(ir.eI), cr, lincsd);
+ set_lincs(*idef, numAtoms_, inverseMasses_, lambda_, EI_DYNAMICS(ir.eI), cr, lincsd);
}
if (ir.eConstrAlg == econtSHAKE)
{
}
else
{
- make_shake_sblock_serial(shaked.get(), &top->idef, md.nr);
+ make_shake_sblock_serial(shaked.get(), &top->idef, numAtoms_);
}
}
}
if (settled)
{
- settle_set_constraints(settled, idef->il[F_SETTLE], md.homenr, md.massT, md.invmass);
+ settle_set_constraints(settled, idef->il[F_SETTLE], numHomeAtoms_, masses_, inverseMasses_);
}
/* Make a selection of the local atoms for essential dynamics */
}
}
-void Constraints::setConstraints(gmx_localtop_t* top, const t_mdatoms& md)
+void Constraints::setConstraints(gmx_localtop_t* top,
+ const int numAtoms,
+ const int numHomeAtoms,
+ real* masses,
+ real* inverseMasses,
+ const bool hasMassPerturbedAtoms,
+ const real lambda,
+ unsigned short* cFREEZE)
{
- impl_->setConstraints(top, md);
+ impl_->setConstraints(top, numAtoms, numHomeAtoms, masses, inverseMasses, hasMassPerturbedAtoms,
+ lambda, cFREEZE);
}
/*! \brief Makes a per-moleculetype container of mappings from atom
const t_inputrec& ir,
pull_t* pull_work,
FILE* log,
- const t_mdatoms& md,
const t_commrec* cr,
const gmx_multisim_t* ms,
t_nrnb* nrnb,
bool pbcHandlingRequired,
int numConstraints,
int numSettles) :
- impl_(new Impl(mtop, ir, pull_work, log, md, cr, ms, nrnb, wcycle, pbcHandlingRequired, numConstraints, numSettles))
+ impl_(new Impl(mtop, ir, pull_work, log, cr, ms, nrnb, wcycle, pbcHandlingRequired, numConstraints, numSettles))
{
}
const t_inputrec& ir_p,
pull_t* pull_work,
FILE* log_p,
- const t_mdatoms& md_p,
const t_commrec* cr_p,
const gmx_multisim_t* ms_p,
t_nrnb* nrnb_p,
int numSettles) :
ncon_tot(numConstraints),
mtop(mtop_p),
- md(md_p),
pbcHandlingRequired_(pbcHandlingRequired),
log(log_p),
cr(cr_p),
void do_constrain_first(FILE* fplog,
gmx::Constraints* constr,
const t_inputrec* ir,
- const t_mdatoms* md,
- int natoms,
+ int numAtoms,
+ int numHomeAtoms,
ArrayRefWithPadding<RVec> x,
ArrayRefWithPadding<RVec> v,
const matrix box,
real dt = ir->delta_t;
real dvdl_dum;
- PaddedVector<RVec> savex(natoms);
+ PaddedVector<RVec> savex(numAtoms);
start = 0;
- end = md->homenr;
+ end = numHomeAtoms;
if (debug)
{
- fprintf(debug, "vcm: start=%d, homenr=%d, end=%d\n", start, md->homenr, end);
+ fprintf(debug, "vcm: start=%d, homenr=%d, end=%d\n", start, numHomeAtoms, end);
}
/* Do a first constrain to reset particles... */
step = ir->init_step;