From: Sebastian Kehl Date: Mon, 15 Feb 2021 08:42:56 +0000 (+0100) Subject: Expose mk_nbfp and make_ljpme_c6grid. X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=b0c20df72099dd4521921a9be43434fe1a7ac8af;p=alexxy%2Fgromacs.git Expose mk_nbfp and make_ljpme_c6grid. Expose mk_nbfp and make_ljpme_c6grid from 'mdlib/forcerec.cpp' in 'mdlib/forcerec.h'. Thereby rename: mk_nbfp -> makeNonBondedParameterLists make_ljpme_c6grid -> makeLJPmeC6GridCorrectionParameters --- diff --git a/src/gromacs/mdlib/forcerec.cpp b/src/gromacs/mdlib/forcerec.cpp index e17946088e..780ecda83e 100644 --- a/src/gromacs/mdlib/forcerec.cpp +++ b/src/gromacs/mdlib/forcerec.cpp @@ -116,13 +116,13 @@ void ForceHelperBuffers::resize(int numAtoms) } } -static std::vector mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM) +std::vector makeNonBondedParameterLists(const gmx_ffparams_t& forceFieldParams, bool useBuckinghamPotential) { std::vector nbfp; int atnr; - atnr = idef->atnr; - if (bBHAM) + atnr = forceFieldParams.atnr; + if (useBuckinghamPotential) { nbfp.resize(3 * atnr * atnr); int k = 0; @@ -130,10 +130,10 @@ static std::vector mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM) { 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; } } } @@ -146,8 +146,8 @@ static std::vector mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM) 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; } } } @@ -155,7 +155,8 @@ static std::vector mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM) return nbfp; } -static std::vector make_ljpme_c6grid(const gmx_ffparams_t* idef, t_forcerec* fr) +std::vector 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; @@ -165,19 +166,19 @@ static std::vector make_ljpme_c6grid(const gmx_ffparams_t* idef, t_forcere * access to the C6-values used on the reciprocal grid in pme.c */ - atnr = idef->atnr; + atnr = forceFieldParams.atnr; std::vector 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); @@ -1195,10 +1196,10 @@ void init_forcerec(FILE* fp, 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); } } diff --git a/src/gromacs/mdlib/forcerec.h b/src/gromacs/mdlib/forcerec.h index 1a01ff1413..5455a0504a 100644 --- a/src/gromacs/mdlib/forcerec.h +++ b/src/gromacs/mdlib/forcerec.h @@ -4,7 +4,7 @@ * 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. @@ -51,6 +51,7 @@ struct gmx_localtop_t; struct gmx_mtop_t; struct gmx_wallcycle; struct interaction_const_t; +struct gmx_ffparams_t; namespace gmx { @@ -58,6 +59,22 @@ class MDLogger; class PhysicalNodeCommunicator; } // namespace gmx +/*! \brief Create nonbonded parameter lists + * + * \param[in] forceFieldParams The forcefield parameters + * \param[in] useBuckinghamPotential Use Buckingham potential + */ +std::vector 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 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