/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
// From IForceProvider
//! \copydoc IForceProvider::calculateForces()
- void calculateForces(const t_commrec *cr,
- const t_mdatoms *mdatoms,
- const matrix box,
- double t,
- const rvec *x,
- gmx::ForceWithVirial *forceWithVirial) override;
+ void calculateForces(const t_commrec *cr,
+ const t_mdatoms *mdatoms,
+ const matrix box,
+ double t,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ForceWithVirial *forceWithVirial) override;
private:
//! Return whether or not to apply a field
field(XX, t), field(YY, t), field(ZZ, t));
}
-void ElectricField::calculateForces(const t_commrec *cr,
- const t_mdatoms *mdatoms,
- const matrix /* box */,
- double t,
- const rvec * /* x */,
- gmx::ForceWithVirial *forceWithVirial)
+using gmx::ArrayRef;
+
+void ElectricField::calculateForces(const t_commrec *cr,
+ const t_mdatoms *mdatoms,
+ const matrix,
+ double t,
+ ArrayRef<const gmx::RVec>,
+ gmx::ForceWithVirial *forceWithVirial)
{
if (isActive())
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
md.chargeA[0] = 1;
t_commrec *cr = init_commrec();
- forceProviders.calculateForces(cr, &md, nullptr, 0, nullptr, &forceWithVirial);
+ forceProviders.calculateForces(cr, &md, nullptr, 0, gmx::EmptyArrayRef {}, &forceWithVirial);
done_commrec(cr);
EXPECT_REAL_EQ_TOL(f[0][dim], expectedValue, tolerance);
static void do_single_flood(
FILE *edo,
- rvec x[],
+ const rvec x[],
rvec force[],
t_edpar *edi,
gmx_int64_t step,
/* Main flooding routine, called from do_force */
extern void do_flood(const t_commrec *cr,
const t_inputrec *ir,
- rvec x[],
+ const rvec x[],
rvec force[],
- gmx_edsam_t ed,
+ const gmx_edsam *ed,
matrix box,
gmx_int64_t step,
gmx_bool bNS)
* \param ed The essential dynamics data.
*/
void do_edsam(const t_inputrec *ir, gmx_int64_t step,
- const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam_t ed);
+ const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam *ed);
/*! \brief Initializes the essential dynamics and flooding module.
* \param step Number of the time step.
* \param bNS Are we in a neighbor searching step?
*/
-void do_flood(const t_commrec *cr, const t_inputrec *ir, rvec x[], rvec force[], gmx_edsam_t ed,
- matrix box, gmx_int64_t step, gmx_bool bNS);
+void do_flood(const t_commrec *cr,
+ const t_inputrec *ir,
+ const rvec x[],
+ rvec force[],
+ const gmx_edsam *ed,
+ matrix box,
+ gmx_int64_t step,
+ gmx_bool bNS);
/*! \brief Clean up
*
}
//! Make tables for the structure factor parts
-static void tabulateStructureFactors(int natom, rvec x[], int kmax, cvec **eir, rvec lll)
+static void tabulateStructureFactors(int natom, const rvec x[], int kmax, cvec **eir, rvec lll)
{
int i, j, m;
}
}
-real do_ewald(t_inputrec *ir,
- rvec x[], rvec f[],
- real chargeA[], real chargeB[],
- matrix box,
- const t_commrec *cr, int natoms,
- matrix lrvir, real ewaldcoeff,
- real lambda, real *dvdlambda,
- struct gmx_ewald_tab_t *et)
+real do_ewald(const t_inputrec *ir,
+ const rvec x[],
+ rvec f[],
+ const real chargeA[],
+ const real chargeB[],
+ matrix box,
+ const t_commrec *cr,
+ int natoms,
+ matrix lrvir,
+ real ewaldcoeff,
+ real lambda,
+ real *dvdlambda,
+ gmx_ewald_tab_t *et)
{
- real factor = -1.0/(4*ewaldcoeff*ewaldcoeff);
- real *charge, energy_AB[2], energy;
- rvec lll;
- int lowiy, lowiz, ix, iy, iz, n, q;
- real tmp, cs, ss, ak, akv, mx, my, mz, m2, scale;
- gmx_bool bFreeEnergy;
+ real factor = -1.0/(4*ewaldcoeff*ewaldcoeff);
+ const real *charge;
+ real energy_AB[2], energy;
+ rvec lll;
+ int lowiy, lowiz, ix, iy, iz, n, q;
+ real tmp, cs, ss, ak, akv, mx, my, mz, m2, scale;
+ gmx_bool bFreeEnergy;
if (cr != nullptr)
{
/*! \brief Do the long-ranged part of an Ewald calculation */
real
-do_ewald(t_inputrec *ir,
- rvec x[], rvec f[],
- real chargeA[], real chargeB[],
- matrix box,
- const t_commrec *cr, int natoms,
- matrix lrvir, real ewaldcoeff,
- real lambda, real *dvdlambda,
- struct gmx_ewald_tab_t *et);
+do_ewald(const t_inputrec *ir,
+ const rvec x[],
+ rvec f[],
+ const real chargeA[],
+ const real chargeB[],
+ matrix box,
+ const t_commrec *cr,
+ int natoms,
+ matrix lrvir,
+ real ewaldcoeff,
+ real lambda,
+ real *dvdlambda,
+ gmx_ewald_tab_t *et);
/*! \brief Calculate the correction to the Ewald sum, due to a net system
* charge.
real *sigma3A, real *sigma3B,
gmx_bool bHaveChargeOrTypePerturbed,
gmx_bool calc_excl_corr,
- t_blocka *excl, rvec x[],
+ const t_blocka *excl,
+ const rvec x[],
matrix box, rvec mu_tot[],
int ewald_geometry, real epsilon_surface,
rvec *f, tensor vir_q, tensor vir_lj,
real *sigma3A, real *sigma3B,
gmx_bool bHaveChargeOrTypePerturbed,
gmx_bool calc_excl_corr,
- t_blocka *excl, rvec x[],
+ const t_blocka *excl,
+ const rvec x[],
matrix box, rvec mu_tot[],
int ewald_geometry, real epsilon_surface,
rvec *f, tensor vir_q, tensor vir_lj,
}
void put_charge_groups_in_box(FILE gmx_unused *fplog, int cg0, int cg1,
- int ePBC, matrix box, t_block *cgs,
+ int ePBC, matrix box, const t_block *cgs,
rvec pos[], rvec cg_cm[])
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2018, 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.
*/
void put_charge_groups_in_box (FILE *log, int cg0, int cg1,
- int ePBC, matrix box, t_block *cgs,
+ int ePBC, matrix box, const t_block *cgs,
rvec pos[],
rvec cg_cm[]);
/* This routine puts charge groups in the periodic box, keeping them
typedef struct
{
int flags;
- t_blocka * exclusions;
+ const t_blocka *exclusions;
real * lambda;
real * dvdl;
nb_kernel_t (t_nblist * nlist,
rvec * x,
rvec * f,
- struct t_forcerec * fr,
- t_mdatoms * mdatoms,
+ const struct t_forcerec * fr,
+ const t_mdatoms * mdatoms,
nb_kernel_data_t * kernel_data,
t_nrnb * nrnb);
static void
setup_exclusions_and_indices(gmx_allvsall_data_t * aadata,
- t_blocka * excl,
+ const t_blocka * excl,
int natoms)
{
int i, j, k, iexcl;
static void
setup_aadata(gmx_allvsall_data_t ** p_aadata,
- t_blocka * excl,
+ const t_blocka * excl,
int natoms,
int * type,
int ntype,
real vcoul, vctot;
real c6, c12, Vvdw6, Vvdw12, Vvdwtot;
real fscal;
- t_blocka * excl;
+ const t_blocka *excl;
real * f;
real * x;
real * Vvdw;
return;
}
-void do_nonbonded(t_forcerec *fr,
- rvec x[], rvec f_shortrange[], t_mdatoms *mdatoms, t_blocka *excl,
+void do_nonbonded(const t_forcerec *fr,
+ rvec x[],
+ rvec f_shortrange[],
+ const t_mdatoms *mdatoms,
+ const t_blocka *excl,
gmx_grppairener_t *grppener,
- t_nrnb *nrnb, real *lambda, real *dvdl,
- int nls, int eNL, int flags)
+ t_nrnb *nrnb,
+ real *lambda,
+ real *dvdl,
+ int nls,
+ int eNL,
+ int flags)
{
t_nblist * nlist;
int n, n0, n1, i, i0, i1;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018, 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.
#define GMX_NONBONDED_DO_SR (1<<5)
void
-do_nonbonded(t_forcerec *fr,
- rvec x[], rvec f_shortrange[], t_mdatoms *md, t_blocka *excl,
+do_nonbonded(const t_forcerec *fr,
+ rvec x[],
+ rvec f_shortrange[],
+ const t_mdatoms *md,
+ const t_blocka *excl,
gmx_grppairener_t *grppener,
- t_nrnb *nrnb, real *lambda, real dvdlambda[],
- int nls, int eNL, int flags);
+ t_nrnb *nrnb,
+ real *lambda,
+ real dvdlambda[],
+ int nls,
+ int eNL,
+ int flags);
#endif
bool constrain(FILE *fplog, bool bLog, bool bEner,
Constraints *constr,
- t_idef *idef, const t_inputrec *ir,
+ const t_idef *idef, const t_inputrec *ir,
const t_commrec *cr,
const gmx_multisim_t *ms,
gmx_int64_t step, int delta_step,
real step_scaling,
- t_mdatoms *md,
+ const t_mdatoms *md,
rvec *x, rvec *xprime, rvec *min_proj,
bool bMolPBC, matrix box,
real lambda, real *dvdlambda,
rvec *v, tensor *vir,
t_nrnb *nrnb, int econq)
{
- bool bOK, bDump;
- int start, homenr;
- tensor vir_r_m_dr;
- real scaled_delta_t;
- real invdt, vir_fac = 0, t;
- t_ilist *settle;
- int nsettle;
- t_pbc pbc, *pbc_null;
- char buf[22];
- int nth, th;
+ bool bOK, bDump;
+ int start, homenr;
+ tensor vir_r_m_dr;
+ real scaled_delta_t;
+ real invdt, vir_fac = 0, t;
+ const t_ilist *settle;
+ int nsettle;
+ t_pbc pbc, *pbc_null;
+ char buf[22];
+ int nth, th;
if (econq == econqForceDispl && !EI_ENERGY_MINIMIZATION(ir->eI))
{
*/
bool constrain(FILE *log, bool bLog, bool bEner,
Constraints *constr,
- t_idef *idef,
+ const t_idef *idef,
const t_inputrec *ir,
const t_commrec *cr,
const gmx_multisim_t *ms,
gmx_int64_t step, int delta_step,
real step_scaling,
- t_mdatoms *md,
+ const t_mdatoms *md,
rvec *x, rvec *xprime, rvec *min_proj,
bool bMolPBC, matrix box,
real lambda, real *dvdlambda,
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
-void ns(FILE *fp,
- t_forcerec *fr,
- matrix box,
- gmx_groups_t *groups,
- gmx_localtop_t *top,
- t_mdatoms *md,
- const t_commrec *cr,
- t_nrnb *nrnb,
- gmx_bool bFillGrid)
+void ns(FILE *fp,
+ t_forcerec *fr,
+ matrix box,
+ const gmx_groups_t *groups,
+ gmx_localtop_t *top,
+ const t_mdatoms *md,
+ const t_commrec *cr,
+ t_nrnb *nrnb,
+ gmx_bool bFillGrid)
{
int nsearch;
}
}
-void do_force_lowlevel(t_forcerec *fr, t_inputrec *ir,
- t_idef *idef, const t_commrec *cr,
+void do_force_lowlevel(t_forcerec *fr,
+ const t_inputrec *ir,
+ const t_idef *idef,
+ const t_commrec *cr,
const gmx_multisim_t *ms,
- t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- t_mdatoms *md,
- rvec x[], history_t *hist,
- rvec *forceForUseWithShiftForces,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ const t_mdatoms *md,
+ rvec x[],
+ history_t *hist,
+ rvec *forceForUseWithShiftForces,
gmx::ForceWithVirial *forceWithVirial,
- gmx_enerdata_t *enerd,
- t_fcdata *fcd,
- matrix box,
- t_lambda *fepvals,
- real *lambda,
- t_graph *graph,
- t_blocka *excl,
- rvec mu_tot[],
- int flags,
- float *cycles_pme)
+ gmx_enerdata_t *enerd,
+ t_fcdata *fcd,
+ matrix box,
+ t_lambda *fepvals,
+ real *lambda,
+ const t_graph *graph,
+ const t_blocka *excl,
+ rvec mu_tot[],
+ int flags,
+ float *cycles_pme)
{
int i, j;
int donb_flags;
t_graph *g, rvec shift_vec[]);
/* Calculate virial taking periodicity into account */
-real RF_excl_correction(const t_forcerec *fr, t_graph *g,
- const t_mdatoms *mdatoms, const t_blocka *excl,
- rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,
- real lambda, real *dvdlambda);
+real RF_excl_correction(const t_forcerec *fr,
+ const t_graph *g,
+ const t_mdatoms *mdatoms,
+ const t_blocka *excl,
+ rvec x[],
+ rvec f[],
+ rvec *fshift,
+ const t_pbc *pbc,
+ real lambda,
+ real *dvdlambda);
/* Calculate the reaction-field energy correction for this node:
* epsfac q_i q_j (k_rf r_ij^2 - c_rf)
* and force correction for all excluded pairs, including self pairs.
const gmx_groups_t *groups,
t_forcerec *fr);
-real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
- rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb);
+real do_walls(const t_inputrec *ir,
+ t_forcerec *fr,
+ matrix box,
+ const t_mdatoms *md,
+ const rvec x[],
+ rvec f[],
+ real lambda,
+ real Vlj[],
+ t_nrnb *nrnb);
gmx_bool can_use_allvsall(const t_inputrec *ir,
gmx_bool bPrintNote, const t_commrec *cr, FILE *fp);
void set_avcsixtwelve(FILE *fplog, t_forcerec *fr,
const gmx_mtop_t *mtop);
-void do_force(FILE *log, const t_commrec *cr,
- const gmx_multisim_t *ms,
- t_inputrec *inputrec,
- gmx_int64_t step, struct t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- gmx_localtop_t *top,
- gmx_groups_t *groups,
- matrix box, gmx::PaddedArrayRef<gmx::RVec> coordinates, history_t *hist,
- gmx::PaddedArrayRef<gmx::RVec> force,
- tensor vir_force,
- t_mdatoms *mdatoms,
- gmx_enerdata_t *enerd, t_fcdata *fcd,
- gmx::ArrayRef<real> lambda, t_graph *graph,
- t_forcerec *fr,
- gmx_vsite_t *vsite, rvec mu_tot,
- double t, struct gmx_edsam *ed,
- int flags,
+void do_force(FILE *log,
+ const t_commrec *cr,
+ const gmx_multisim_t *ms,
+ const t_inputrec *inputrec,
+ gmx_int64_t step,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ // TODO top can be const when the group scheme no longer
+ // builds exclusions during neighbor searching within
+ // do_force_cutsGROUP.
+ gmx_localtop_t *top,
+ const gmx_groups_t *groups,
+ matrix box,
+ gmx::PaddedArrayRef<gmx::RVec> coordinates,
+ history_t *hist,
+ gmx::PaddedArrayRef<gmx::RVec> force,
+ tensor vir_force,
+ const t_mdatoms *mdatoms,
+ gmx_enerdata_t *enerd,
+ t_fcdata *fcd,
+ gmx::ArrayRef<real> lambda,
+ t_graph *graph,
+ t_forcerec *fr,
+ const gmx_vsite_t *vsite,
+ rvec mu_tot,
+ double t,
+ const gmx_edsam *ed,
+ int flags,
DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion);
* f is always required.
*/
-void ns(FILE *fplog,
- t_forcerec *fr,
- matrix box,
- gmx_groups_t *groups,
- gmx_localtop_t *top,
- t_mdatoms *md,
- const t_commrec *cr,
- t_nrnb *nrnb,
- gmx_bool bFillGrid);
+void ns(FILE *fplog,
+ t_forcerec *fr,
+ matrix box,
+ const gmx_groups_t *groups,
+ gmx_localtop_t *top,
+ const t_mdatoms *md,
+ const t_commrec *cr,
+ t_nrnb *nrnb,
+ gmx_bool bFillGrid);
/* Call the neighborsearcher */
void do_force_lowlevel(t_forcerec *fr,
- t_inputrec *ir,
- t_idef *idef,
+ const t_inputrec *ir,
+ const t_idef *idef,
const t_commrec *cr,
const gmx_multisim_t *ms,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle,
- t_mdatoms *md,
+ const t_mdatoms *md,
rvec x[],
history_t *hist,
rvec f_shortrange[],
matrix box,
t_lambda *fepvals,
real *lambda,
- t_graph *graph,
- t_blocka *excl,
+ const t_graph *graph,
+ const t_blocka *excl,
rvec mu_tot[2],
int flags,
float *cycles_pme);
ivec *shifts, /* Collective array of shifts for xcoll (can be NULL) */
ivec *extra_shifts, /* (optional) Extra shifts since last time step */
const gmx_bool bNS, /* (optional) NS step, the shifts have changed */
- rvec *x_loc, /* Local positions on this node */
+ const rvec *x_loc, /* Local positions on this node */
const int nr, /* Total number of atoms in the group */
const int nr_loc, /* Local number of atoms in the group */
int *anrs_loc, /* Local atom numbers */
*/
extern void communicate_group_positions(const t_commrec *cr, rvec *xcoll, ivec *shifts,
ivec *extra_shifts, const gmx_bool bNS,
- rvec *x_loc, const int nr, const int nr_loc,
+ const rvec *x_loc, const int nr, const int nr_loc,
int *anrs_loc, int *coll_ind, rvec *xcoll_old,
matrix box);
bool constrain_lincs(FILE *fplog, bool bLog, bool bEner,
const t_inputrec *ir,
gmx_int64_t step,
- Lincs *lincsd, t_mdatoms *md,
+ Lincs *lincsd, const t_mdatoms *md,
const t_commrec *cr,
const gmx_multisim_t *ms,
rvec *x, rvec *xprime, rvec *min_proj,
constrain_lincs(FILE *log, bool bLog, bool bEner,
const t_inputrec *ir,
gmx_int64_t step,
- Lincs *lincsd, t_mdatoms *md,
+ Lincs *lincsd, const t_mdatoms *md,
const t_commrec *cr,
const gmx_multisim_t *ms,
rvec *x, rvec *xprime, rvec *min_proj,
typedef void
put_in_list_t (gmx_bool bHaveVdW[],
int ngid,
- t_mdatoms * md,
+ const t_mdatoms *md,
int icg,
int jgid,
int nj,
static void
put_in_list_at(gmx_bool bHaveVdW[],
int ngid,
- t_mdatoms * md,
+ const t_mdatoms *md,
int icg,
int jgid,
int nj,
static void
put_in_list_qmmm(gmx_bool gmx_unused bHaveVdW[],
int ngid,
- t_mdatoms gmx_unused * md,
+ const t_mdatoms * /* md */,
int icg,
int jgid,
int nj,
static void
put_in_list_cg(gmx_bool gmx_unused bHaveVdW[],
int ngid,
- t_mdatoms gmx_unused * md,
+ const t_mdatoms * /* md */,
int icg,
int jgid,
int nj,
return r2;
}
-static void add_simple(t_ns_buf * nsbuf, int nrj, int cg_j,
- gmx_bool bHaveVdW[], int ngid, t_mdatoms *md,
- int icg, int jgid, t_block *cgs, t_excl bexcl[],
- int shift, t_forcerec *fr, put_in_list_t *put_in_list)
+static void add_simple(t_ns_buf * nsbuf,
+ int nrj,
+ int cg_j,
+ gmx_bool bHaveVdW[],
+ int ngid,
+ const t_mdatoms *md,
+ int icg,
+ int jgid,
+ t_block *cgs,
+ t_excl bexcl[],
+ int shift,
+ t_forcerec *fr,
+ put_in_list_t *put_in_list)
{
if (nsbuf->nj + nrj > MAX_CG)
{
nsbuf->nj += nrj;
}
-static void ns_inner_tric(rvec x[], int icg, int *i_egp_flags,
- int njcg, int jcg[],
- matrix box, rvec b_inv, real rcut2,
- t_block *cgs, t_ns_buf **ns_buf,
- gmx_bool bHaveVdW[], int ngid, t_mdatoms *md,
- t_excl bexcl[], t_forcerec *fr,
- put_in_list_t *put_in_list)
+static void ns_inner_tric(rvec x[],
+ int icg,
+ int *i_egp_flags,
+ int njcg,
+ int jcg[],
+ matrix box,
+ rvec b_inv,
+ real rcut2,
+ t_block *cgs,
+ t_ns_buf **ns_buf,
+ gmx_bool bHaveVdW[],
+ int ngid,
+ const t_mdatoms *md,
+ t_excl bexcl[],
+ t_forcerec *fr,
+ put_in_list_t *put_in_list)
{
int shift;
int j, nrj, jgid;
}
}
-static void ns_inner_rect(rvec x[], int icg, int *i_egp_flags,
- int njcg, int jcg[],
- gmx_bool bBox, rvec box_size, rvec b_inv, real rcut2,
- t_block *cgs, t_ns_buf **ns_buf,
- gmx_bool bHaveVdW[], int ngid, t_mdatoms *md,
- t_excl bexcl[], t_forcerec *fr,
- put_in_list_t *put_in_list)
+static void ns_inner_rect(rvec x[],
+ int icg,
+ int *i_egp_flags,
+ int njcg,
+ int jcg[],
+ gmx_bool bBox,
+ rvec box_size,
+ rvec b_inv,
+ real rcut2,
+ t_block *cgs,
+ t_ns_buf **ns_buf,
+ gmx_bool bHaveVdW[],
+ int ngid,
+ const t_mdatoms *md,
+ t_excl bexcl[],
+ t_forcerec *fr,
+ put_in_list_t *put_in_list)
{
int shift;
int j, nrj, jgid;
/* ns_simple_core needs to be adapted for QMMM still 2005 */
-static int ns_simple_core(t_forcerec *fr,
- gmx_localtop_t *top,
- t_mdatoms *md,
- matrix box, rvec box_size,
- t_excl bexcl[], int *aaj,
- int ngid, t_ns_buf **ns_buf,
- put_in_list_t *put_in_list, gmx_bool bHaveVdW[])
+static int ns_simple_core(t_forcerec *fr,
+ gmx_localtop_t *top,
+ const t_mdatoms *md,
+ matrix box,
+ rvec box_size,
+ t_excl bexcl[],
+ int *aaj,
+ int ngid,
+ t_ns_buf **ns_buf,
+ put_in_list_t *put_in_list,
+ gmx_bool bHaveVdW[])
{
int naaj, k;
real rlist2;
}
}
-static int nsgrid_core(const t_commrec *cr, t_forcerec *fr,
- matrix box, int ngid,
- gmx_localtop_t *top,
- t_grid *grid,
- t_excl bexcl[], gmx_bool *bExcludeAlleg,
- t_mdatoms *md,
- put_in_list_t *put_in_list,
- gmx_bool bHaveVdW[],
- gmx_bool bMakeQMMMnblist)
+static int nsgrid_core(const t_commrec *cr,
+ t_forcerec *fr,
+ matrix box,
+ int ngid,
+ gmx_localtop_t *top,
+ t_grid *grid,
+ t_excl bexcl[],
+ gmx_bool *bExcludeAlleg,
+ const t_mdatoms *md,
+ put_in_list_t *put_in_list,
+ gmx_bool bHaveVdW[],
+ gmx_bool bMakeQMMMnblist)
{
- gmx_ns_t *ns;
- int **nl_sr;
- int *nsr;
- gmx_domdec_t *dd;
- t_block *cgs = &(top->cgs);
- int *cginfo = fr->cginfo;
+ gmx_ns_t *ns;
+ int **nl_sr;
+ int *nsr;
+ gmx_domdec_t *dd;
+ const t_block *cgs = &(top->cgs);
+ int *cginfo = fr->cginfo;
/* int *i_atoms,*cgsindex=cgs->index; */
- ivec sh0, sh1, shp;
- int cell_x, cell_y, cell_z;
- int d, tx, ty, tz, dx, dy, dz, cj;
+ ivec sh0, sh1, shp;
+ int cell_x, cell_y, cell_z;
+ int d, tx, ty, tz, dx, dy, dz, cj;
#ifdef ALLOW_OFFDIAG_LT_HALFDIAG
- int zsh_ty, zsh_tx, ysh_tx;
+ int zsh_ty, zsh_tx, ysh_tx;
#endif
- int dx0, dx1, dy0, dy1, dz0, dz1;
- int Nx, Ny, Nz, shift = -1, j, nrj, nns, nn = -1;
- real gridx, gridy, gridz, grid_x, grid_y;
- real *dcx2, *dcy2, *dcz2;
- int zgi, ygi, xgi;
- int cg0, cg1, icg = -1, cgsnr, i0, igid, naaj, max_jcg;
- int jcg0, jcg1, jjcg, cgj0, jgid;
- int *grida, *gridnra, *gridind;
- rvec *cgcm, grid_offset;
- real r2, rs2, XI, YI, ZI, tmp1, tmp2;
- int *i_egp_flags;
- gmx_bool bDomDec, bTriclinicX, bTriclinicY;
- ivec ncpddc;
+ int dx0, dx1, dy0, dy1, dz0, dz1;
+ int Nx, Ny, Nz, shift = -1, j, nrj, nns, nn = -1;
+ real gridx, gridy, gridz, grid_x, grid_y;
+ real *dcx2, *dcy2, *dcz2;
+ int zgi, ygi, xgi;
+ int cg0, cg1, icg = -1, cgsnr, i0, igid, naaj, max_jcg;
+ int jcg0, jcg1, jjcg, cgj0, jgid;
+ int *grida, *gridnra, *gridind;
+ rvec *cgcm, grid_offset;
+ real r2, rs2, XI, YI, ZI, tmp1, tmp2;
+ int *i_egp_flags;
+ gmx_bool bDomDec, bTriclinicX, bTriclinicY;
+ ivec ncpddc;
ns = fr->ns;
sfree(ns);
}
-int search_neighbours(FILE *log, t_forcerec *fr,
- matrix box,
- gmx_localtop_t *top,
- gmx_groups_t *groups,
- const t_commrec *cr,
- t_nrnb *nrnb, t_mdatoms *md,
- gmx_bool bFillGrid)
+int search_neighbours(FILE *log,
+ t_forcerec *fr,
+ matrix box,
+ gmx_localtop_t *top,
+ const gmx_groups_t *groups,
+ const t_commrec *cr,
+ t_nrnb *nrnb,
+ const t_mdatoms *md,
+ gmx_bool bFillGrid)
{
- t_block *cgs = &(top->cgs);
+ const t_block *cgs = &(top->cgs);
rvec box_size, grid_x0, grid_x1;
int m, ngid;
real min_size, grid_dens;
//! Destructor.
void done_ns(gmx_ns_t *ns, int numEnergyGroups);
-int search_neighbours(FILE *log, t_forcerec *fr, matrix box,
- gmx_localtop_t *top,
- gmx_groups_t *groups,
- const t_commrec *cr,
- t_nrnb *nrnb, t_mdatoms *md,
- gmx_bool bFillGrid);
+int search_neighbours(FILE *log,
+ t_forcerec *fr,
+ matrix box,
+ gmx_localtop_t *top,
+ const gmx_groups_t *groups,
+ const t_commrec *cr,
+ t_nrnb *nrnb,
+ const t_mdatoms *md,
+ gmx_bool bFillGrid);
/* Debugging routines from wnblist.c */
init_gamess(const t_commrec *cr, t_QMrec *qm, t_MMrec *mm);
real
-call_gamess(t_forcerec *fr,
+call_gamess(const t_forcerec *fr,
t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
#elif GMX_QMMM_MOPAC
init_gaussian(t_QMrec *qm);
real
-call_gaussian_SH(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
+call_gaussian_SH(const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
real
-call_gaussian(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
+call_gaussian(const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
#elif GMX_QMMM_ORCA
#include "gromacs/mdlib/qm_orca.h"
} /* struct_comp */
-static real call_QMroutine(const t_commrec gmx_unused *cr, t_forcerec gmx_unused *fr, t_QMrec gmx_unused *qm,
+static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_unused *fr, t_QMrec gmx_unused *qm,
t_MMrec gmx_unused *mm, rvec gmx_unused f[], rvec gmx_unused fshift[])
{
/* makes a call to the requested QM routine (qm->QMmethod)
}
} /* init_QMroutine */
-static void update_QMMM_coord(const rvec *x, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
+static void update_QMMM_coord(const rvec *x, const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
{
/* shifts the QM and MM particles into the central box and stores
* these shifted coordinates in the coordinate arrays of the
} /* mk_QMMMrec */
-void init_QMMMrec(const t_commrec *cr,
- gmx_mtop_t *mtop,
- t_inputrec *ir,
- t_forcerec *fr)
+void init_QMMMrec(const t_commrec *cr,
+ gmx_mtop_t *mtop,
+ t_inputrec *ir,
+ const t_forcerec *fr)
{
/* we put the atomsnumbers of atoms that belong to the QMMM group in
* an array that will be copied later to QMMMrec->indexQM[..]. Also
}
} /* init_QMMMrec */
-void update_QMMMrec(const t_commrec *cr,
- t_forcerec *fr,
- const rvec *x,
- const t_mdatoms *md,
- const matrix box)
+void update_QMMMrec(const t_commrec *cr,
+ const t_forcerec *fr,
+ const rvec *x,
+ const t_mdatoms *md,
+ const matrix box)
{
/* updates the coordinates of both QM atoms and MM atoms and stores
* them in the QMMMrec.
} /* update_QMMM_rec */
-real calculate_QMMM(const t_commrec *cr,
- rvec f[],
- t_forcerec *fr)
+real calculate_QMMM(const t_commrec *cr,
+ rvec f[],
+ const t_forcerec *fr)
{
real
QMener = 0.0;
t_QMMMrec *mk_QMMMrec(void);
/* allocates memory for QMMMrec */
-void init_QMMMrec(const t_commrec *cr,
- gmx_mtop_t *mtop,
- t_inputrec *ir,
- t_forcerec *fr);
+void init_QMMMrec(const t_commrec *cr,
+ gmx_mtop_t *mtop,
+ t_inputrec *ir,
+ const t_forcerec *fr);
/* init_QMMMrec initializes the QMMM record. From
* topology->atoms.atomname and topology->atoms.atomtype the atom
* and md->cQMMM gives numbers of the MM and QM atoms
*/
-void update_QMMMrec(const t_commrec *cr,
- t_forcerec *fr,
- const rvec *x,
- const t_mdatoms *md,
- const matrix box);
+void update_QMMMrec(const t_commrec *cr,
+ const t_forcerec *fr,
+ const rvec *x,
+ const t_mdatoms *md,
+ const matrix box);
/* update_QMMMrec fills the MM stuff in QMMMrec. The MM atoms are
* taken froom the neighbourlists of the QM atoms. In a QMMM run this
* elements of the t_QMMMrec struct.
*/
-real calculate_QMMM(const t_commrec *cr,
- rvec f[],
- t_forcerec *fr);
+real calculate_QMMM(const t_commrec *cr,
+ rvec f[],
+ const t_forcerec *fr);
/* QMMM computes the QM forces. This routine makes either function
* calls to gmx QM routines (derived from MOPAC7 (semi-emp.) and MPQC
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/pleasecite.h"
-real RF_excl_correction(const t_forcerec *fr, t_graph *g,
- const t_mdatoms *mdatoms, const t_blocka *excl,
- rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,
- real lambda, real *dvdlambda)
+real RF_excl_correction(const t_forcerec *fr,
+ const t_graph *g,
+ const t_mdatoms *mdatoms,
+ const t_blocka *excl,
+ rvec x[],
+ rvec f[],
+ rvec *fshift,
+ const t_pbc *pbc,
+ real lambda,
+ real *dvdlambda)
{
/* Calculate the reaction-field energy correction for this node:
* epsfac q_i q_j (k_rf r_ij^2 - c_rf)
return shfc;
}
-void make_local_shells(const t_commrec *cr, t_mdatoms *md,
- gmx_shellfc_t *shfc)
+void make_local_shells(const t_commrec *cr,
+ const t_mdatoms *md,
+ gmx_shellfc_t *shfc)
{
t_shell *shell;
int a0, a1, *ind, nshell, i;
}
}
-static void init_adir(FILE *log, gmx_shellfc_t *shfc,
- gmx::Constraints *constr, t_idef *idef, t_inputrec *ir,
- const t_commrec *cr,
- const gmx_multisim_t *ms,
- int dd_ac1,
- gmx_int64_t step, t_mdatoms *md, int end,
- rvec *x_old, rvec *x_init, rvec *x,
- rvec *f, rvec *acc_dir,
- gmx_bool bMolPBC, matrix box,
- gmx::ArrayRef<const real> lambda, real *dvdlambda,
- t_nrnb *nrnb)
+static void init_adir(FILE *log,
+ gmx_shellfc_t *shfc,
+ gmx::Constraints *constr,
+ const t_idef *idef,
+ const t_inputrec *ir,
+ const t_commrec *cr,
+ const gmx_multisim_t *ms,
+ int dd_ac1,
+ gmx_int64_t step,
+ const t_mdatoms *md,
+ int end,
+ rvec *x_old,
+ rvec *x_init,
+ rvec *x,
+ rvec *f,
+ rvec *acc_dir,
+ gmx_bool bMolPBC,
+ matrix box,
+ gmx::ArrayRef<const real> lambda,
+ real *dvdlambda,
+ t_nrnb *nrnb)
{
rvec *xnold, *xnew;
double dt, w_dt;
nullptr, nullptr, nrnb, gmx::econqDeriv_FlexCon);
}
-void relax_shell_flexcon(FILE *fplog, const t_commrec *cr,
- const gmx_multisim_t *ms,
- gmx_bool bVerbose,
- gmx_int64_t mdstep, t_inputrec *inputrec,
- gmx_bool bDoNS, int force_flags,
- gmx_localtop_t *top,
- gmx::Constraints *constr,
- gmx_enerdata_t *enerd, t_fcdata *fcd,
- t_state *state, PaddedRVecVector *f,
- tensor force_vir,
- t_mdatoms *md,
- t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- t_graph *graph,
- gmx_groups_t *groups,
- gmx_shellfc_t *shfc,
- t_forcerec *fr,
- double t, rvec mu_tot,
- gmx_vsite_t *vsite,
+void relax_shell_flexcon(FILE *fplog,
+ const t_commrec *cr,
+ const gmx_multisim_t *ms,
+ gmx_bool bVerbose,
+ gmx_int64_t mdstep,
+ const t_inputrec *inputrec,
+ gmx_bool bDoNS,
+ int force_flags,
+ gmx_localtop_t *top,
+ gmx::Constraints *constr,
+ gmx_enerdata_t *enerd,
+ t_fcdata *fcd,
+ t_state *state,
+ gmx::PaddedArrayRef<gmx::RVec> f,
+ tensor force_vir,
+ const t_mdatoms *md,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ t_graph *graph,
+ const gmx_groups_t *groups,
+ gmx_shellfc_t *shfc,
+ t_forcerec *fr,
+ double t,
+ rvec mu_tot,
+ const gmx_vsite_t *vsite,
DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
{
- int nshell;
- t_shell *shell;
- t_idef *idef;
- rvec *acc_dir = nullptr, *x_old = nullptr;
- real Epot[2], df[2];
- real sf_dir, invdt;
- real ftol, dum = 0;
- char sbuf[22];
- gmx_bool bCont, bInit, bConverged;
- int nat, dd_ac0, dd_ac1 = 0, i;
- int homenr = md->homenr, end = homenr, cg0, cg1;
- int nflexcon, number_steps, d, Min = 0, count = 0;
+ int nshell;
+ t_shell *shell;
+ const t_idef *idef;
+ rvec *acc_dir = nullptr, *x_old = nullptr;
+ real Epot[2], df[2];
+ real sf_dir, invdt;
+ real ftol, dum = 0;
+ char sbuf[22];
+ gmx_bool bCont, bInit, bConverged;
+ int nat, dd_ac0, dd_ac1 = 0, i;
+ int homenr = md->homenr, end = homenr, cg0, cg1;
+ int nflexcon, number_steps, d, Min = 0, count = 0;
#define Try (1-Min) /* At start Try = 1 */
bCont = (mdstep == inputrec->init_step) && inputrec->bContinuation;
/* Copy back the coordinates and the forces */
std::copy(pos[Min].begin(), pos[Min].end(), state->x.begin());
- std::copy(force[Min].begin(), force[Min].end(), f->begin());
+ std::copy(force[Min].begin(), force[Min].end(), f.begin());
}
void done_shellfc(FILE *fplog, gmx_shellfc_t *shfc, gmx_int64_t numSteps)
bool usingDomainDecomposition);
/* Get the local shell with domain decomposition */
-void make_local_shells(const t_commrec *cr, t_mdatoms *md,
- gmx_shellfc_t *shfc);
+void make_local_shells(const t_commrec *cr,
+ const t_mdatoms *md,
+ gmx_shellfc_t *shfc);
/* Optimize shell positions */
-void relax_shell_flexcon(FILE *log, const t_commrec *cr,
- const gmx_multisim_t *ms,
- gmx_bool bVerbose,
- gmx_int64_t mdstep, t_inputrec *inputrec,
- gmx_bool bDoNS, int force_flags,
- gmx_localtop_t *top,
- gmx::Constraints *constr,
- gmx_enerdata_t *enerd, t_fcdata *fcd,
- t_state *state, PaddedRVecVector *f,
- tensor force_vir,
- t_mdatoms *md,
- t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- t_graph *graph,
- gmx_groups_t *groups,
- gmx_shellfc_t *shfc,
- t_forcerec *fr,
- double t, rvec mu_tot,
- gmx_vsite_t *vsite,
+void relax_shell_flexcon(FILE *log,
+ const t_commrec *cr,
+ const gmx_multisim_t *ms,
+ gmx_bool bVerbose,
+ gmx_int64_t mdstep,
+ const t_inputrec *inputrec,
+ gmx_bool bDoNS,
+ int force_flags,
+ gmx_localtop_t *top,
+ gmx::Constraints *constr,
+ gmx_enerdata_t *enerd,
+ t_fcdata *fcd,
+ t_state *state,
+ gmx::PaddedArrayRef<gmx::RVec> f,
+ tensor force_vir,
+ const t_mdatoms *md,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ t_graph *graph,
+ const gmx_groups_t *groups,
+ gmx_shellfc_t *shfc,
+ t_forcerec *fr,
+ double t,
+ rvec mu_tot,
+ const gmx_vsite_t *vsite,
DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion);
}
static void pull_potential_wrapper(const t_commrec *cr,
- t_inputrec *ir,
- matrix box, rvec x[],
+ const t_inputrec *ir,
+ matrix box, ArrayRef<const RVec> x,
ForceWithVirial *force,
- t_mdatoms *mdatoms,
+ const t_mdatoms *mdatoms,
gmx_enerdata_t *enerd,
real *lambda,
double t,
dvdl = 0;
enerd->term[F_COM_PULL] +=
pull_potential(ir->pull_work, mdatoms, &pbc,
- cr, t, lambda[efptRESTRAINT], x, force, &dvdl);
+ cr, t, lambda[efptRESTRAINT], as_rvec_array(x.data()), force, &dvdl);
enerd->dvdl_lin[efptRESTRAINT] += dvdl;
wallcycle_stop(wcycle, ewcPULLPOT);
}
wallcycle_stop(wcycle, ewcPP_PMEWAITRECVF);
}
-static void print_large_forces(FILE *fp, t_mdatoms *md, const t_commrec *cr,
- gmx_int64_t step, real forceTolerance,
- const rvec *x, const rvec *f)
+static void print_large_forces(FILE *fp,
+ const t_mdatoms *md,
+ const t_commrec *cr,
+ gmx_int64_t step,
+ real forceTolerance,
+ const rvec *x,
+ const rvec *f)
{
real force2Tolerance = gmx::square(forceTolerance);
std::uintmax_t numNonFinite = 0;
}
}
-static void post_process_forces(const t_commrec *cr,
- gmx_int64_t step,
- t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- gmx_localtop_t *top,
- matrix box, rvec x[],
- rvec f[],
- ForceWithVirial *forceWithVirial,
- tensor vir_force,
- t_mdatoms *mdatoms,
- t_graph *graph,
- t_forcerec *fr, gmx_vsite_t *vsite,
- int flags)
+static void post_process_forces(const t_commrec *cr,
+ gmx_int64_t step,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ const gmx_localtop_t *top,
+ matrix box,
+ rvec x[],
+ rvec f[],
+ ForceWithVirial *forceWithVirial,
+ tensor vir_force,
+ const t_mdatoms *mdatoms,
+ t_graph *graph,
+ t_forcerec *fr,
+ const gmx_vsite_t *vsite,
+ int flags)
{
if (fr->haveDirectVirialContributions)
{
t_forcerec *fr,
rvec x[],
rvec f[],
- t_mdatoms *mdatoms,
+ const t_mdatoms *mdatoms,
t_lambda *fepvals,
real *lambda,
gmx_enerdata_t *enerd,
* \todo Convert all other algorithms called here to ForceProviders.
*/
static void
-computeSpecialForces(FILE *fplog,
- const t_commrec *cr,
- t_inputrec *inputrec,
- gmx_int64_t step,
- double t,
- gmx_wallcycle_t wcycle,
- ForceProviders *forceProviders,
- matrix box,
- rvec *x,
- t_mdatoms *mdatoms,
- real *lambda,
- int forceFlags,
- ForceWithVirial *forceWithVirial,
- gmx_enerdata_t *enerd,
- gmx_edsam_t ed,
- gmx_bool bNS)
+computeSpecialForces(FILE *fplog,
+ const t_commrec *cr,
+ const t_inputrec *inputrec,
+ gmx_int64_t step,
+ double t,
+ gmx_wallcycle_t wcycle,
+ ForceProviders *forceProviders,
+ matrix box,
+ ArrayRef<const RVec> x,
+ const t_mdatoms *mdatoms,
+ real *lambda,
+ int forceFlags,
+ ForceWithVirial *forceWithVirial,
+ gmx_enerdata_t *enerd,
+ const gmx_edsam *ed,
+ gmx_bool bNS)
{
const bool computeForces = (forceFlags & GMX_FORCE_FORCES);
* Thus if no other algorithm (e.g. PME) requires it, the forces
* here will contribute to the virial.
*/
- do_flood(cr, inputrec, x, f, ed, box, step, bNS);
+ do_flood(cr, inputrec, as_rvec_array(x.data()), f, ed, box, step, bNS);
}
/* Add forces from interactive molecular dynamics (IMD), if bIMD == TRUE. */
}
}
-static void do_force_cutsVERLET(FILE *fplog, const t_commrec *cr,
+static void do_force_cutsVERLET(FILE *fplog,
+ const t_commrec *cr,
const gmx_multisim_t *ms,
- t_inputrec *inputrec,
- gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- gmx_localtop_t *top,
- gmx_groups_t gmx_unused *groups,
- matrix box, gmx::PaddedArrayRef<gmx::RVec> x, history_t *hist,
+ const t_inputrec *inputrec,
+ gmx_int64_t step,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ const gmx_localtop_t *top,
+ const gmx_groups_t * /* groups */,
+ matrix box, gmx::PaddedArrayRef<gmx::RVec> x,
+ history_t *hist,
gmx::PaddedArrayRef<gmx::RVec> force,
tensor vir_force,
- t_mdatoms *mdatoms,
+ const t_mdatoms *mdatoms,
gmx_enerdata_t *enerd, t_fcdata *fcd,
- real *lambda, t_graph *graph,
- t_forcerec *fr, interaction_const_t *ic,
- gmx_vsite_t *vsite, rvec mu_tot,
- double t, gmx_edsam_t ed,
+ real *lambda,
+ t_graph *graph,
+ t_forcerec *fr,
+ interaction_const_t *ic,
+ const gmx_vsite_t *vsite,
+ rvec mu_tot,
+ double t,
+ const gmx_edsam *ed,
int flags,
DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
wallcycle_stop(wcycle, ewcFORCE);
computeSpecialForces(fplog, cr, inputrec, step, t, wcycle,
- fr->forceProviders, box, as_rvec_array(x.data()), mdatoms, lambda,
+ fr->forceProviders, box, x, mdatoms, lambda,
flags, &forceWithVirial, enerd,
ed, bNS);
}
}
-static void do_force_cutsGROUP(FILE *fplog, const t_commrec *cr,
+static void do_force_cutsGROUP(FILE *fplog,
+ const t_commrec *cr,
const gmx_multisim_t *ms,
- t_inputrec *inputrec,
- gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
+ const t_inputrec *inputrec,
+ gmx_int64_t step,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
- gmx_groups_t *groups,
- matrix box, gmx::PaddedArrayRef<gmx::RVec> x, history_t *hist,
+ const gmx_groups_t *groups,
+ matrix box, gmx::PaddedArrayRef<gmx::RVec> x,
+ history_t *hist,
gmx::PaddedArrayRef<gmx::RVec> force,
tensor vir_force,
- t_mdatoms *mdatoms,
- gmx_enerdata_t *enerd, t_fcdata *fcd,
- real *lambda, t_graph *graph,
- t_forcerec *fr, gmx_vsite_t *vsite, rvec mu_tot,
- double t, gmx_edsam_t ed,
+ const t_mdatoms *mdatoms,
+ gmx_enerdata_t *enerd,
+ t_fcdata *fcd,
+ real *lambda,
+ t_graph *graph,
+ t_forcerec *fr,
+ const gmx_vsite_t *vsite,
+ rvec mu_tot,
+ double t,
+ const gmx_edsam *ed,
int flags,
DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
}
computeSpecialForces(fplog, cr, inputrec, step, t, wcycle,
- fr->forceProviders, box, as_rvec_array(x.data()), mdatoms, lambda,
+ fr->forceProviders, box, x, mdatoms, lambda,
flags, &forceWithVirial, enerd,
ed, bNS);
}
-void do_force(FILE *fplog, const t_commrec *cr,
- const gmx_multisim_t *ms,
- t_inputrec *inputrec,
- gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- gmx_localtop_t *top,
- gmx_groups_t *groups,
- matrix box, gmx::PaddedArrayRef<gmx::RVec> x, history_t *hist,
- gmx::PaddedArrayRef<gmx::RVec> force,
- tensor vir_force,
- t_mdatoms *mdatoms,
- gmx_enerdata_t *enerd, t_fcdata *fcd,
- gmx::ArrayRef<real> lambda, t_graph *graph,
- t_forcerec *fr,
- gmx_vsite_t *vsite, rvec mu_tot,
- double t, gmx_edsam_t ed,
- int flags,
+void do_force(FILE *fplog,
+ const t_commrec *cr,
+ const gmx_multisim_t *ms,
+ const t_inputrec *inputrec,
+ gmx_int64_t step,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ gmx_localtop_t *top,
+ const gmx_groups_t *groups,
+ matrix box,
+ gmx::PaddedArrayRef<gmx::RVec> x,
+ history_t *hist,
+ gmx::PaddedArrayRef<gmx::RVec> force,
+ tensor vir_force,
+ const t_mdatoms *mdatoms,
+ gmx_enerdata_t *enerd,
+ t_fcdata *fcd,
+ gmx::ArrayRef<real> lambda,
+ t_graph *graph,
+ t_forcerec *fr,
+ const gmx_vsite_t *vsite,
+ rvec mu_tot,
+ double t,
+ const gmx_edsam *ed,
+ int flags,
DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
}
}
-static void wall_error(int a, rvec *x, real r)
+static void wall_error(int a, const rvec *x, real r)
{
gmx_fatal(FARGS,
"An atom is beyond the wall: coordinates %f %f %f, distance %f\n"
x[a][XX], x[a][YY], x[a][ZZ], r);
}
-real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
- rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb)
+real do_walls(const t_inputrec *ir, t_forcerec *fr, matrix box, const t_mdatoms *md,
+ const rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb)
{
int nwall;
int ntw[2], at, ntype, ngid, ggid, *egp_flags, *type;
relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose, step,
ir, bNS, force_flags, top,
constr, enerd, fcd,
- state, &f, force_vir, mdatoms,
+ state, f, force_vir, mdatoms,
nrnb, wcycle, graph, groups,
shellfc, fr, t, mu_tot,
vsite,
if (shellfc)
{
/* Now is the time to relax the shells */
- (void) relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose, step,
- inputrec, bNS, force_flags,
- top,
- constr, enerd, fcd,
- &state_work.s, &state_work.f, vir, mdatoms,
- nrnb, wcycle, graph, &top_global->groups,
- shellfc, fr, t, mu_tot,
- vsite,
- DdOpenBalanceRegionBeforeForceComputation::no,
- DdCloseBalanceRegionAfterForceComputation::no);
+ relax_shell_flexcon(fplog,
+ cr,
+ ms,
+ mdrunOptions.verbose,
+ step,
+ inputrec,
+ bNS,
+ force_flags,
+ top,
+ constr,
+ enerd,
+ fcd,
+ &state_work.s,
+ state_work.f,
+ vir,
+ mdatoms,
+ nrnb,
+ wcycle,
+ graph,
+ &top_global->groups,
+ shellfc,
+ fr,
+ t,
+ mu_tot,
+ vsite,
+ DdOpenBalanceRegionBeforeForceComputation::no,
+ DdCloseBalanceRegionAfterForceComputation::no);
bNS = false;
step++;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, 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.
return !impl_->providers_.empty();
}
-void ForceProviders::calculateForces(const t_commrec *cr,
- const t_mdatoms *mdatoms,
- const matrix box,
- double t,
- const rvec *x,
- gmx::ForceWithVirial *forceWithVirial) const
+void ForceProviders::calculateForces(const t_commrec *cr,
+ const t_mdatoms *mdatoms,
+ const matrix box,
+ double t,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ForceWithVirial *forceWithVirial) const
{
for (auto provider : impl_->providers_)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
#define GMX_MDTYPES_IFORCEPROVIDER_H
#include "gromacs/math/vectypes.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/classhelpers.h"
struct t_commrec;
* \param[in] x The coordinates
* \param[inout] forceWithVirial The forces and virial
*/
- virtual void calculateForces(const t_commrec *cr,
- const t_mdatoms *mdatoms,
- const matrix box,
- double t,
- const rvec *x,
- gmx::ForceWithVirial *forceWithVirial) = 0;
+ virtual void calculateForces(const t_commrec *cr,
+ const t_mdatoms *mdatoms,
+ const matrix box,
+ double t,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ForceWithVirial *forceWithVirial) = 0;
protected:
~IForceProvider() {}
bool hasForceProvider() const;
//! Computes forces.
- void calculateForces(const t_commrec *cr,
- const t_mdatoms *mdatoms,
- const matrix box,
- double t,
- const rvec *x,
- gmx::ForceWithVirial *forceWithVirial) const;
+ void calculateForces(const t_commrec *cr,
+ const t_mdatoms *mdatoms,
+ const matrix box,
+ double t,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ForceWithVirial *forceWithVirial) const;
private:
class Impl;
return pullCoordForces;
}
-real pull_potential(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc,
+real pull_potential(struct pull_t *pull, const t_mdatoms *md, t_pbc *pbc,
const t_commrec *cr, double t, real lambda,
- rvec *x, gmx::ForceWithVirial *force, real *dvdlambda)
+ const rvec *x, gmx::ForceWithVirial *force, real *dvdlambda)
{
real V = 0;
return (MASTER(cr) ? V : 0.0);
}
-void pull_constraint(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc,
+void pull_constraint(struct pull_t *pull, const t_mdatoms *md, t_pbc *pbc,
const t_commrec *cr, double dt, double t,
rvec *x, rvec *xp, rvec *v, tensor vir)
{
*
* \returns The pull potential energy.
*/
-real pull_potential(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
+real pull_potential(struct pull_t *pull, const t_mdatoms *md, struct t_pbc *pbc,
const t_commrec *cr, double t, real lambda,
- rvec *x, gmx::ForceWithVirial *force, real *dvdlambda);
+ const rvec *x, gmx::ForceWithVirial *force, real *dvdlambda);
/*! \brief Constrain the coordinates xp in the directions in x
* \param[in,out] v Velocities, which may get a pull correction.
* \param[in,out] vir The virial, which, if != NULL, gets a pull correction.
*/
-void pull_constraint(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
+void pull_constraint(struct pull_t *pull, const t_mdatoms *md, struct t_pbc *pbc,
const t_commrec *cr, double dt, double t,
rvec *x, rvec *xp, rvec *v, tensor vir);
* \param[in,out] xp Updated x, can be NULL.
*
*/
-void pull_calc_coms(const t_commrec *cr,
- struct pull_t *pull,
- t_mdatoms *md,
- struct t_pbc *pbc,
- double t,
- rvec x[],
- rvec *xp);
+void pull_calc_coms(const t_commrec *cr,
+ pull_t *pull,
+ const t_mdatoms *md,
+ t_pbc *pbc,
+ double t,
+ const rvec x[],
+ rvec *xp);
/*! \brief Returns if we have pull coordinates with potential pulling.
extern void do_rotation(
- const t_commrec *cr,
- t_inputrec *ir,
- matrix box,
- rvec x[],
- real t,
- gmx_int64_t step,
- gmx_bool bNS)
+ const t_commrec *cr,
+ const t_inputrec *ir,
+ matrix box,
+ rvec x[],
+ real t,
+ gmx_int64_t step,
+ gmx_bool bNS)
{
int g, i, ii;
t_rot *rot;
* \param bNS After domain decomposition / neighbor searching several
* local arrays have to be updated (masses, shifts)
*/
-extern void do_rotation(const t_commrec *cr, t_inputrec *ir, matrix box, rvec x[], real t,
- gmx_int64_t step, gmx_bool bNS);
+extern void do_rotation(const t_commrec *cr,
+ const t_inputrec *ir,
+ matrix box,
+ rvec x[],
+ real t,
+ gmx_int64_t step,
+ gmx_bool bNS);
/*! \brief Add the enforced rotation forces to the official force array.
}
static void pull_set_pbcatom(const t_commrec *cr, pull_group_work_t *pgrp,
- rvec *x,
+ const rvec *x,
rvec x_pbc)
{
int a;
}
static void pull_set_pbcatoms(const t_commrec *cr, struct pull_t *pull,
- rvec *x,
+ const rvec *x,
rvec *x_pbc)
{
int g, n;
}
}
-static void make_cyl_refgrps(const t_commrec *cr, struct pull_t *pull, t_mdatoms *md,
- t_pbc *pbc, double t, rvec *x)
+static void make_cyl_refgrps(const t_commrec *cr,
+ pull_t *pull,
+ const t_mdatoms *md,
+ t_pbc *pbc,
+ double t,
+ const rvec *x)
{
/* The size and stride per coord for the reduction buffer */
const int stride = 9;
/* calculates center of mass of selection index from all coordinates x */
void pull_calc_coms(const t_commrec *cr,
- struct pull_t *pull, t_mdatoms *md, t_pbc *pbc, double t,
- rvec x[], rvec *xp)
+ pull_t *pull,
+ const t_mdatoms *md,
+ t_pbc *pbc,
+ double t,
+ const rvec x[], rvec *xp)
{
int g;
real twopi_box = 0;