}
}
-static std::vector<real> mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM)
+std::vector<real> makeNonBondedParameterLists(const gmx_ffparams_t& forceFieldParams, bool useBuckinghamPotential)
{
std::vector<real> nbfp;
int atnr;
- atnr = idef->atnr;
- if (bBHAM)
+ atnr = forceFieldParams.atnr;
+ if (useBuckinghamPotential)
{
nbfp.resize(3 * atnr * atnr);
int k = 0;
{
for (int j = 0; (j < atnr); j++, k++)
{
- BHAMA(nbfp, atnr, i, j) = idef->iparams[k].bham.a;
- BHAMB(nbfp, atnr, i, j) = idef->iparams[k].bham.b;
+ BHAMA(nbfp, atnr, i, j) = forceFieldParams.iparams[k].bham.a;
+ BHAMB(nbfp, atnr, i, j) = forceFieldParams.iparams[k].bham.b;
/* nbfp now includes the 6.0 derivative prefactor */
- BHAMC(nbfp, atnr, i, j) = idef->iparams[k].bham.c * 6.0;
+ BHAMC(nbfp, atnr, i, j) = forceFieldParams.iparams[k].bham.c * 6.0;
}
}
}
for (int j = 0; (j < atnr); j++, k++)
{
/* nbfp now includes the 6.0/12.0 derivative prefactors */
- C6(nbfp, atnr, i, j) = idef->iparams[k].lj.c6 * 6.0;
- C12(nbfp, atnr, i, j) = idef->iparams[k].lj.c12 * 12.0;
+ C6(nbfp, atnr, i, j) = forceFieldParams.iparams[k].lj.c6 * 6.0;
+ C12(nbfp, atnr, i, j) = forceFieldParams.iparams[k].lj.c12 * 12.0;
}
}
}
return nbfp;
}
-static std::vector<real> make_ljpme_c6grid(const gmx_ffparams_t* idef, t_forcerec* fr)
+std::vector<real> makeLJPmeC6GridCorrectionParameters(const gmx_ffparams_t& forceFieldParams,
+ const t_forcerec& forceRec)
{
int i, j, k, atnr;
real c6, c6i, c6j, c12i, c12j, epsi, epsj, sigmai, sigmaj;
* access to the C6-values used on the reciprocal grid in pme.c
*/
- atnr = idef->atnr;
+ atnr = forceFieldParams.atnr;
std::vector<real> grid(2 * atnr * atnr, 0.0);
for (i = k = 0; (i < atnr); i++)
{
for (j = 0; (j < atnr); j++, k++)
{
- c6i = idef->iparams[i * (atnr + 1)].lj.c6;
- c12i = idef->iparams[i * (atnr + 1)].lj.c12;
- c6j = idef->iparams[j * (atnr + 1)].lj.c6;
- c12j = idef->iparams[j * (atnr + 1)].lj.c12;
+ c6i = forceFieldParams.iparams[i * (atnr + 1)].lj.c6;
+ c12i = forceFieldParams.iparams[i * (atnr + 1)].lj.c12;
+ c6j = forceFieldParams.iparams[j * (atnr + 1)].lj.c6;
+ c12j = forceFieldParams.iparams[j * (atnr + 1)].lj.c12;
c6 = std::sqrt(c6i * c6j);
- if (fr->ljpme_combination_rule == eljpmeLB && !gmx_numzero(c6) && !gmx_numzero(c12i)
- && !gmx_numzero(c12j))
+ if (forceRec.ljpme_combination_rule == eljpmeLB && !gmx_numzero(c6)
+ && !gmx_numzero(c12i) && !gmx_numzero(c12j))
{
sigmai = gmx::sixthroot(c12i / c6i);
sigmaj = gmx::sixthroot(c12j / c6j);
if (fr->nbfp.empty())
{
fr->ntype = mtop->ffparams.atnr;
- fr->nbfp = mk_nbfp(&mtop->ffparams, fr->bBHAM);
+ fr->nbfp = makeNonBondedParameterLists(mtop->ffparams, fr->bBHAM);
if (EVDW_PME(ic->vdwtype))
{
- fr->ljpme_c6grid = make_ljpme_c6grid(&mtop->ffparams, fr);
+ fr->ljpme_c6grid = makeLJPmeC6GridCorrectionParameters(mtop->ffparams, *fr);
}
}
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
struct gmx_mtop_t;
struct gmx_wallcycle;
struct interaction_const_t;
+struct gmx_ffparams_t;
namespace gmx
{
class PhysicalNodeCommunicator;
} // namespace gmx
+/*! \brief Create nonbonded parameter lists
+ *
+ * \param[in] forceFieldParams The forcefield parameters
+ * \param[in] useBuckinghamPotential Use Buckingham potential
+ */
+std::vector<real> makeNonBondedParameterLists(const gmx_ffparams_t& forceFieldParams,
+ bool useBuckinghamPotential);
+
+/*! \brief Calculate c6 parameters for grid correction
+ *
+ * \param[in] forceFieldParams The forcefield parameters
+ * \param[in] forceRec The forcerec
+ */
+std::vector<real> makeLJPmeC6GridCorrectionParameters(const gmx_ffparams_t& forceFieldParams,
+ const t_forcerec& forceRec);
+
/*! \brief Print the contents of the forcerec to a file
*
* \param[in] fplog The log file to print to