Miscellaneous
^^^^^^^^^^^^^
+grompp discourages use of constraints=all-bonds
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+Common force fields, including AMBER, CHARMM and OPLS/aa, are parametrized
+with bonds involving hydrogen constrained. Constraining all bonds should
+be avoided, for correctness. grompp now issues a note when
+constraints=all-bonds is used with these force fields when time steps
+are smaller than 2.6 fs and hydrogens are not replaced by virtual sites.
+Using constraints=h-bonds will also improve performance.
+
return eCPP_OK;
}
+const std::string *cpp_find_define(const gmx_cpp_t *handlep,
+ const std::string &defineName)
+{
+ for (const t_define &define : *(*handlep)->defines)
+ {
+ if (define.name == defineName)
+ {
+ return &define.def;
+ }
+ }
+
+ return nullptr;
+}
+
void cpp_done(gmx_cpp_t handle)
{
int status = cpp_close_file(&handle);
#ifndef GMX_GMXPREPROCESS_GMXCPP_H
#define GMX_GMXPREPROCESS_GMXCPP_H
+#include <string>
+
typedef struct gmx_cpp *gmx_cpp_t;
/* The possible return codes for these functions */
*/
int cpp_close_file(gmx_cpp_t *handlep);
+/* Return a pointer to the value of defineName, when present, nullptr othwerwise.
+ */
+const std::string *cpp_find_define(const gmx_cpp_t *handlep,
+ const std::string &defineName);
+
/* Clean up normal and file static data structures
*/
void cpp_done(gmx_cpp_t handle);
t_molinfo *molinfo = nullptr;
std::vector<gmx_molblock_t> molblock;
int i, nrmols, nmismatch;
+ bool ffParametrizedWithHBondConstraints;
char buf[STRLEN];
char warn_buf[STRLEN];
atype, &nrmols, &molinfo, intermolecular_interactions,
ir,
&molblock,
+ &ffParametrizedWithHBondConstraints,
wi);
sys->molblock.clear();
gmx_mtop_finalize(sys);
+ /* Discourage using the, previously common, setup of applying constraints
+ * to all bonds with force fields that have been parametrized with H-bond
+ * constraints only. Do not print note with large timesteps or vsites.
+ */
+ if (opts->nshake == eshALLBONDS &&
+ ffParametrizedWithHBondConstraints &&
+ ir->delta_t < 0.0026 &&
+ gmx_mtop_ftype_count(sys, F_VSITE3FD) == 0)
+ {
+ set_warning_line(wi, "unknown", -1);
+ warning_note(wi, "You are using constraints on all bonds, whereas the forcefield "
+ "has been parametrized only with constraints involving hydrogen atoms. "
+ "We suggest using constraints = h-bonds instead, this will also improve performance.");
+ }
+
/* COORDINATE file processing */
if (bVerbose)
{
t_gromppopts *opts,
real *fudgeQQ,
std::vector<gmx_molblock_t> *molblock,
+ bool *ffParametrizedWithHBondConstraints,
bool bFEP,
bool bZero,
bool usingFullRangeElectrostatics,
}
while (!done);
sfree(cpp_opts_return);
- cpp_done(handle);
+
if (out)
{
gmx_fio_fclose(out);
}
+ /* List of GROMACS define names for force fields that have been
+ * parametrized using constraints involving hydrogens only.
+ *
+ * We should avoid hardcoded names, but this is hopefully only
+ * needed temparorily for discouraging use of constraints=all-bonds.
+ */
+ const std::array<std::string, 3> ffDefines = {
+ "_FF_AMBER",
+ "_FF_CHARMM",
+ "_FF_OPLSAA"
+ };
+ *ffParametrizedWithHBondConstraints = false;
+ for (const std::string &ffDefine : ffDefines)
+ {
+ if (cpp_find_define(&handle, ffDefine))
+ {
+ *ffParametrizedWithHBondConstraints = true;
+ }
+ }
+
+ cpp_done(handle);
+
if (opts->couple_moltype)
{
if (nmol_couple == 0)
t_molinfo **intermolecular_interactions,
const t_inputrec *ir,
std::vector<gmx_molblock_t> *molblock,
+ bool *ffParametrizedWithHBondConstraints,
warninp_t wi)
{
/* Tmpfile might contain a long path */
nrmols, molinfo, intermolecular_interactions,
plist, combination_rule, repulsion_power,
opts, fudgeQQ, molblock,
+ ffParametrizedWithHBondConstraints,
ir->efep != efepNO, bZero,
EEL_FULL(ir->coulombtype), wi);
t_molinfo **intermolecular_interactions,
const t_inputrec *ir,
std::vector<gmx_molblock_t> *molblock,
+ bool *ffParametrizedWithHBondConstraints,
warninp_t wi);
/* This routine expects sys->molt[m].ilist to be of size F_NRE and ordered. */