void dd_clear_f_vsites(struct gmx_domdec_t *dd, rvec *f);
/*! \brief Move x0 and also x1 if x1!=NULL. bX1IsCoord tells if to do PBC on x1 */
-void dd_move_x_constraints(struct gmx_domdec_t *dd, matrix box,
+void dd_move_x_constraints(struct gmx_domdec_t *dd, const matrix box,
rvec *x0, rvec *x1, gmx_bool bX1IsCoord);
/*! \brief Communicates the coordinates involved in virtual sites */
//! @endcond
};
-void dd_move_x_constraints(gmx_domdec_t *dd, matrix box,
+void dd_move_x_constraints(gmx_domdec_t *dd, const matrix box,
rvec *x0, rvec *x1, gmx_bool bX1IsCoord)
{
if (dd->constraint_comm)
}
-static inline void ed_unshift_single_coord(matrix box, const rvec x, const ivec is, rvec xu)
+static inline void ed_unshift_single_coord(const matrix box, const rvec x, const ivec is, rvec xu)
{
int tx, ty, tz;
const t_commrec *cr,
rvec xs[],
rvec v[],
- matrix box,
+ const matrix box,
gmx_edsam *ed)
{
int i, edinr, iupdate = 500;
* \param ed The essential dynamics data.
*/
void do_edsam(const t_inputrec *ir, int64_t step,
- const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam *ed);
+ const t_commrec *cr, rvec xs[], rvec v[], const matrix box, gmx_edsam *ed);
/*! \brief Initializes the essential dynamics and flooding module.
rvec *x,
rvec *xprime,
rvec *min_proj,
- matrix box,
+ const matrix box,
real lambda,
real *dvdlambda,
rvec *v,
static void write_constr_pdb(const char *fn, const char *title,
const gmx_mtop_t &mtop,
int start, int homenr, const t_commrec *cr,
- const rvec x[], matrix box)
+ const rvec x[], const matrix box)
{
char fname[STRLEN];
FILE *out;
//! Writes out domain contents to help diagnose crashes.
static void dump_confs(FILE *log, int64_t step, const gmx_mtop_t &mtop,
int start, int homenr, const t_commrec *cr,
- const rvec x[], rvec xprime[], matrix box)
+ const rvec x[], rvec xprime[], const matrix box)
{
char buf[STRLEN], buf2[22];
rvec *x,
rvec *xprime,
rvec *min_proj,
- matrix box,
+ const matrix box,
real lambda,
real *dvdlambda,
rvec *v,
rvec *x,
rvec *xprime,
rvec *min_proj,
- matrix box,
+ const matrix box,
real lambda,
real *dvdlambda,
rvec *v,
void do_constrain_first(FILE *fplog, gmx::Constraints *constr,
const t_inputrec *ir, const t_mdatoms *md,
- t_state *state)
+ int natoms,
+ ArrayRefWithPadding<RVec> x,
+ ArrayRefWithPadding<RVec> v,
+ const matrix box,
+ real lambda)
{
int i, m, start, end;
int64_t step;
real dvdl_dum;
rvec *savex;
+ auto xRvec = as_rvec_array(x.paddedArrayRef().data());
+ auto vRvec = as_rvec_array(v.paddedArrayRef().data());
+
/* We need to allocate one element extra, since we might use
* (unaligned) 4-wide SIMD loads to access rvec entries.
*/
- snew(savex, state->natoms + 1);
+ snew(savex, natoms + 1);
start = 0;
end = md->homenr;
/* constrain the current position */
constr->apply(TRUE, FALSE,
step, 0, 1.0,
- state->x.rvec_array(), state->x.rvec_array(), nullptr,
- state->box,
- state->lambda[efptBONDED], &dvdl_dum,
+ xRvec, xRvec, nullptr,
+ box,
+ lambda, &dvdl_dum,
nullptr, nullptr, gmx::ConstraintVariable::Positions);
if (EI_VV(ir->eI))
{
/* also may be useful if we need the ekin from the halfstep for velocity verlet */
constr->apply(TRUE, FALSE,
step, 0, 1.0,
- state->x.rvec_array(), state->v.rvec_array(), state->v.rvec_array(),
- state->box,
- state->lambda[efptBONDED], &dvdl_dum,
+ xRvec, vRvec, vRvec,
+ box,
+ lambda, &dvdl_dum,
nullptr, nullptr, gmx::ConstraintVariable::Velocities);
}
/* constrain the inital velocities at t-dt/2 */
if (EI_STATE_VELOCITY(ir->eI) && ir->eI != eiVV)
{
- auto x = makeArrayRef(state->x).subArray(start, end);
- auto v = makeArrayRef(state->v).subArray(start, end);
+ auto subX = x.paddedArrayRef().subArray(start, end);
+ auto subV = v.paddedArrayRef().subArray(start, end);
for (i = start; (i < end); i++)
{
for (m = 0; (m < DIM); m++)
{
/* Reverse the velocity */
- v[i][m] = -v[i][m];
+ subV[i][m] = -subV[i][m];
/* Store the position at t-dt in buf */
- savex[i][m] = x[i][m] + dt*v[i][m];
+ savex[i][m] = subX[i][m] + dt*subV[i][m];
}
}
/* Shake the positions at t=-dt with the positions at t=0
dvdl_dum = 0;
constr->apply(TRUE, FALSE,
step, -1, 1.0,
- state->x.rvec_array(), savex, nullptr,
- state->box,
- state->lambda[efptBONDED], &dvdl_dum,
- state->v.rvec_array(), nullptr, gmx::ConstraintVariable::Positions);
+ xRvec, savex, nullptr,
+ box,
+ lambda, &dvdl_dum,
+ vRvec, nullptr, gmx::ConstraintVariable::Positions);
for (i = start; i < end; i++)
{
for (m = 0; m < DIM; m++)
{
/* Re-reverse the velocities */
- v[i][m] = -v[i][m];
+ subV[i][m] = -subV[i][m];
}
}
}
namespace gmx
{
+template <typename T> class ArrayRefWithPadding;
//! Describes supported flavours of constrained updates.
enum class ConstraintVariable : int
rvec *x,
rvec *xprime,
rvec *min_proj,
- matrix box,
+ const matrix box,
real lambda,
real *dvdlambda,
rvec *v,
/*! \brief Constrain the initial coordinates and velocities */
void do_constrain_first(FILE *log, gmx::Constraints *constr,
const t_inputrec *inputrec, const t_mdatoms *md,
- t_state *state);
+ int natoms,
+ ArrayRefWithPadding<RVec> x,
+ ArrayRefWithPadding<RVec> v,
+ const matrix box,
+ real lambda);
} // namespace gmx
#endif // GMX_SIMD_HAVE_REAL
//! Implements LINCS constraining.
-static void do_lincs(const rvec *x, rvec *xp, matrix box, t_pbc *pbc,
+static void do_lincs(const rvec *x, rvec *xp, const matrix box, t_pbc *pbc,
Lincs *lincsd, int th,
const real *invmass,
const t_commrec *cr,
const t_commrec *cr,
const gmx_multisim_t *ms,
const rvec *x, rvec *xprime, rvec *min_proj,
- matrix box, t_pbc *pbc,
+ const matrix box, t_pbc *pbc,
real lambda, real *dvdlambda,
real invdt, rvec *v,
bool bCalcVir, tensor vir_r_m_dr,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const t_commrec *cr,
const gmx_multisim_t *ms,
const rvec *x, rvec *xprime, rvec *min_proj,
- matrix box, t_pbc *pbc,
+ const matrix box, t_pbc *pbc,
real lambda, real *dvdlambda,
real invdt, rvec *v,
bool bCalcVir, tensor vir_r_m_dr,
if (constr)
{
/* Constrain the initial coordinates and velocities */
- do_constrain_first(fplog, constr, ir, mdatoms, state);
+ do_constrain_first(fplog, constr, ir, mdatoms,
+ state->natoms,
+ state->x.arrayRefWithPadding(),
+ state->v.arrayRefWithPadding(),
+ state->box, state->lambda[efptBONDED]);
}
if (vsite)
{