#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
-static void low_mspeed(real tempi, gmx_mtop_t* mtop, rvec v[], gmx::ThreeFry2x64<>* rng)
+static void low_mspeed(real tempi, gmx_mtop_t* mtop, rvec v[], gmx::ThreeFry2x64<>* rng, const gmx::MDLogger& logger)
{
int nrdf;
real boltz;
}
}
}
- fprintf(stderr, "Velocities were taken from a Maxwell distribution at %g K\n", tempi);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Velocities were taken from a Maxwell distribution at %g K", tempi);
if (debug)
{
fprintf(debug,
}
}
-void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[])
+void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[], const gmx::MDLogger& logger)
{
if (seed == 0)
{
seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Using random seed %u for generating velocities\n", seed);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Using random seed %u for generating velocities", seed);
}
gmx::ThreeFry2x64<> rng(seed, gmx::RandomDomain::MaxwellVelocities);
- low_mspeed(tempi, mtop, v, &rng);
+ low_mspeed(tempi, mtop, v, &rng, logger);
}
static real calc_cm(int natoms, const real mass[], rvec x[], rvec v[], rvec xcm, rvec vcm, rvec acm, matrix L)
return tm;
}
-void stop_cm(FILE gmx_unused* log, int natoms, real mass[], rvec x[], rvec v[])
+void stop_cm(const gmx::MDLogger gmx_unused& logger, int natoms, real mass[], rvec x[], rvec v[])
{
rvec xcm, vcm, acm;
tensor L;
int i, m;
#ifdef DEBUG
- fprintf(log, "stopping center of mass motion...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("stopping center of mass motion...");
#endif
(void)calc_cm(natoms, mass, x, v, xcm, vcm, acm, L);
v[i][m] -= vcm[m];
}
}
-
-#ifdef DEBUG
- (void)calc_cm(log, natoms, mass, x, v, xcm, vcm, acm, L);
-#endif
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, 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;
+namespace gmx
+{
+class MDLogger;
+}
+
/*! \brief
* Generate Maxwellian velocities.
*
* \param[in] seed Random number generator seed
* \param[in] mtop Molecular Topology
* \param[out] v Velocities
+ * \param[in] logger Handle to logging interface.
*/
-void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[]);
+void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[], const gmx::MDLogger& logger);
/*! \brief
* Remove the center of mass motion in a set of coordinates.
*
- * \param[out] log File for printing debug information
+ * \param[in] logger Handle to logging interface.
* \param[in] natoms Number of atoms
* \param[in] mass Atomic masses
* \param[in] x Coordinates
* \param[out] v Velocities
*/
-void stop_cm(FILE* log, int natoms, real mass[], rvec x[], rvec v[]);
+void stop_cm(const gmx::MDLogger& logger, int natoms, real mass[], rvec x[], rvec v[]);
#endif
/* TOPOLOGY processing */
sys->name = do_top(bVerbose, topfile, topppfile, opts, bZero, &(sys->symtab), interactions,
comb, reppow, fudgeQQ, atypes, mi, intermolecular_interactions, ir,
- &molblock, &ffParametrizedWithHBondConstraints, wi);
+ &molblock, &ffParametrizedWithHBondConstraints, wi, logger);
sys->molblock.clear();
GMX_LOG(logger.info).asParagraph().appendTextFormatted("Setting gen_seed to %d", opts->seed);
}
state->flags |= (1 << estV);
- maxwell_speed(opts->tempi, opts->seed, sys, state->v.rvec_array());
+ maxwell_speed(opts->tempi, opts->seed, sys, state->v.rvec_array(), logger);
- stop_cm(stdout, state->natoms, mass, state->x.rvec_array(), state->v.rvec_array());
+ stop_cm(logger, state->natoms, mass, state->x.rvec_array(), state->v.rvec_array());
sfree(mass);
}
}
/* set parameters for virtual site construction (not for vsiten) */
for (size_t mt = 0; mt < sys.moltype.size(); mt++)
{
- nvsite += set_vsites(bVerbose, &sys.moltype[mt].atoms, &atypes, mi[mt].interactions);
+ nvsite += set_vsites(bVerbose, &sys.moltype[mt].atoms, &atypes, mi[mt].interactions, logger);
}
/* now throw away all obsolete bonds, angles and dihedrals: */
/* note: constraints are ALWAYS removed */
{
for (size_t mt = 0; mt < sys.moltype.size(); mt++)
{
- clean_vsite_bondeds(mi[mt].interactions, sys.moltype[mt].atoms.nr, bRmVSBds);
+ clean_vsite_bondeds(mi[mt].interactions, sys.moltype[mt].atoms.nr, bRmVSBds, logger);
}
}
/* set ptype to VSite for virtual sites */
for (gmx_moltype_t& moltype : sys.moltype)
{
- set_vsites_ptype(FALSE, &moltype);
+ set_vsites_ptype(FALSE, &moltype, logger);
}
if (debug)
{
/* make exclusions between QM atoms and remove charges if needed */
if (ir->bQMMM)
{
- generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_ORIGINAL);
+ generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_ORIGINAL, logger);
if (ir->QMMMscheme != eQMMMschemeoniom)
{
std::vector<int> qmmmAtoms = qmmmAtomIndices(*ir, sys);
if (ir->eI == eiMimic)
{
- generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_MIMIC);
+ generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_MIMIC, logger);
}
if (ftp2bSet(efTRN, NFILE, fnm))
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/pleasecite.h"
#include "gromacs/utility/smalloc.h"
bool bFEP,
bool bZero,
bool usingFullRangeElectrostatics,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
FILE* out;
int sl, nb_funct;
generate_nbparams(*combination_rule, nb_funct,
&(interactions[nb_funct]), atypes, wi);
ncopy = copy_nbparams(nbparam, nb_funct, &(interactions[nb_funct]), ntype);
- fprintf(stderr,
- "Generated %d of the %d non-bonded parameter "
- "combinations\n",
- ncombs - ncopy, ncombs);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Generated %d of the %d non-bonded parameter "
+ "combinations",
+ ncombs - ncopy, ncombs);
free_nbparam(nbparam, ntype);
if (bGenPairs)
{
gen_pairs((interactions[nb_funct]), &(interactions[F_LJ14]),
fudgeLJ, *combination_rule);
ncopy = copy_nbparams(pair, nb_funct, &(interactions[F_LJ14]), ntype);
- fprintf(stderr,
- "Generated %d of the %d 1-4 parameter combinations\n",
- ncombs - ncopy, ncombs);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Generated %d of the %d 1-4 parameter "
+ "combinations",
+ ncombs - ncopy, ncombs);
free_nbparam(pair, ntype);
}
/* Copy GBSA parameters to atomtype array? */
{
gmx_fatal(FARGS, "Molecule type '%s' contains no atoms", *mi0->name);
}
- fprintf(stderr, "Excluding %d bonded neighbours molecule type '%s'\n",
- mi0->nrexcl, *mi0->name);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Excluding %d bonded neighbours molecule type '%s'",
+ mi0->nrexcl, *mi0->name);
sum_q(&mi0->atoms, nrcopies, &qt, &qBt);
if (!mi0->bProcessed)
{
generate_excl(mi0->nrexcl, mi0->atoms.nr, mi0->interactions, &(mi0->excls));
gmx::mergeExclusions(&(mi0->excls), exclusionBlocks[whichmol]);
- make_shake(mi0->interactions, &mi0->atoms, opts->nshake);
+ make_shake(mi0->interactions, &mi0->atoms, opts->nshake, logger);
if (bCouple)
{
break;
}
default:
- fprintf(stderr, "case: %d\n", static_cast<int>(d));
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("case: %d", static_cast<int>(d));
gmx_incons("unknown directive");
}
}
{
gmx_fatal(FARGS, "Did not find any molecules of type '%s' for coupling", opts->couple_moltype);
}
- fprintf(stderr, "Coupling %d copies of molecule type '%s'\n", nmol_couple, opts->couple_moltype);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Coupling %d copies of molecule type '%s'", nmol_couple,
+ opts->couple_moltype);
}
/* this is not very clean, but fixes core dump on empty system name */
const t_inputrec* ir,
std::vector<gmx_molblock_t>* molblock,
bool* ffParametrizedWithHBondConstraints,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
/* Tmpfile might contain a long path */
const char* tmpfile;
if (bVerbose)
{
- printf("processing topology...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("processing topology...");
}
title = read_topol(topfile, tmpfile, opts->define, opts->include, symtab, atypes, molinfo,
intermolecular_interactions, interactions, combination_rule, repulsion_power,
opts, fudgeQQ, molblock, ffParametrizedWithHBondConstraints,
- ir->efep != efepNO, bZero, EEL_FULL(ir->coulombtype), wi);
+ ir->efep != efepNO, bZero, EEL_FULL(ir->coulombtype), wi, logger);
if ((*combination_rule != eCOMB_GEOMETRIC) && (ir->vdwtype == evdwUSER))
{
* CONNBOND and, when MiMiC is not used, removes bonded interactions between QM and link atoms.
* Finally, in case if MiMiC QM/MM is used - charges of QM atoms are set to 0
*
- * @param molt molecule type with QM atoms
- * @param grpnr group informatio
- * @param ir input record
- * @param qmmmMode QM/MM mode switch: original/MiMiC
+ * \param[in,out] molt molecule type with QM atoms
+ * \param[in] grpnr group informatio
+ * \param[in,out] ir input record
+ * \param[in,out] qmmmMode QM/MM mode switch: original/MiMiC
+ * \param[in] logger Handle to logging interface.
*/
-static void generate_qmexcl_moltype(gmx_moltype_t* molt, const unsigned char* grpnr, t_inputrec* ir, GmxQmmmMode qmmmMode)
+static void generate_qmexcl_moltype(gmx_moltype_t* molt,
+ const unsigned char* grpnr,
+ t_inputrec* ir,
+ GmxQmmmMode qmmmMode,
+ const gmx::MDLogger& logger)
{
/* This routine expects molt->ilist to be of size F_NRE and ordered. */
int ind_connbond = 0;
if (molt->ilist[F_CONNBONDS].size() != 0)
{
- fprintf(stderr, "nr. of CONNBONDS present already: %d\n", molt->ilist[F_CONNBONDS].size() / 3);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("nr. of CONNBONDS present already: %d",
+ molt->ilist[F_CONNBONDS].size() / 3);
ftype_connbond = molt->ilist[F_CONNBONDS].iatoms[0];
ind_connbond = molt->ilist[F_CONNBONDS].size();
}
free(blink);
} /* generate_qmexcl */
-void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp* wi, GmxQmmmMode qmmmMode)
+void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp* wi, GmxQmmmMode qmmmMode, const gmx::MDLogger& logger)
{
/* This routine expects molt->molt[m].ilist to be of size F_NRE and ordered.
*/
/* Set the molecule type for the QMMM molblock */
molb->type = sys->moltype.size() - 1;
}
- generate_qmexcl_moltype(&sys->moltype[molb->type], grpnr, ir, qmmmMode);
+ generate_qmexcl_moltype(&sys->moltype[molb->type], grpnr, ir, qmmmMode, logger);
}
if (grpnr)
{
enum struct GmxQmmmMode;
typedef warninp* warninp_t;
+namespace gmx
+{
+class MDLogger;
+}
+
double check_mol(const gmx_mtop_t* mtop, warninp_t wi);
/* Check mass and charge */
const t_inputrec* ir,
std::vector<gmx_molblock_t>* molblock,
bool* ffParametrizedWithHBondConstraints,
- warninp_t wi);
+ warninp_t wi,
+ const gmx::MDLogger& logger);
/* This routine expects sys->molt[m].ilist to be of size F_NRE and ordered. */
-void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp_t wi, GmxQmmmMode qmmmMode);
+void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp_t wi, GmxQmmmMode qmmmMode, const gmx::MDLogger& logger);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, 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.
#include "gromacs/math/units.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
static int count_hydrogens(char*** atomname, int nra, gmx::ArrayRef<const int> a)
return nh;
}
-void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake)
+void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake, const gmx::MDLogger& logger)
{
char*** info = atoms->atomname;
real b_ij, b_jk;
{
switch (nshake)
{
- case eshHBONDS: printf("turning H bonds into constraints...\n"); break;
- case eshALLBONDS: printf("turning all bonds into constraints...\n"); break;
- case eshHANGLES: printf("turning all bonds and H angles into constraints...\n"); break;
- case eshALLANGLES: printf("turning all bonds and angles into constraints...\n"); break;
+ case eshHBONDS:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning H bonds into constraints...");
+ break;
+ case eshALLBONDS:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning all bonds into constraints...");
+ break;
+ case eshHANGLES:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning all bonds and H angles into constraints...");
+ break;
+ case eshALLANGLES:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning all bonds and angles into constraints...");
+ break;
default: gmx_fatal(FARGS, "Invalid option for make_shake (%d)", nshake);
}
{
const InteractionOfType* ang = &(*parm);
#ifdef DEBUG
- printf("Angle: %d-%d-%d\n", ang->ai(), ang->aj(), ang->ak());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Angle: %d-%d-%d", ang->ai(),
+ ang->aj(), ang->ak());
#endif
int numhydrogens = count_hydrogens(info, 3, ang->atoms());
if ((nshake == eshALLANGLES) || (numhydrogens > 1)
}
/* apply law of cosines */
#ifdef DEBUG
- printf("p: %d, q: %d, dist: %12.5e\n", atomNumbers[0],
- atomNumbers[1], forceParm[0]);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("p: %d, q: %d, dist: %12.5e",
+ atomNumbers[0], atomNumbers[1],
+ forceParm[0]);
#endif
add_param_to_list(&(plist[F_CONSTR]),
InteractionOfType(atomNumbers, forceParm));
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, 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 t_atoms;
struct InteractionsOfType;
-void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake);
+namespace gmx
+{
+class MDLogger;
+}
+
+void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake, const gmx::MDLogger& logger);
#endif
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/strconvert.h"
static bool calc_vsite4fd_param(InteractionOfType* vsite,
gmx::ArrayRef<const VsiteBondedInteraction> bonds,
- gmx::ArrayRef<const VsiteBondedInteraction> angles)
+ gmx::ArrayRef<const VsiteBondedInteraction> angles,
+ const gmx::MDLogger& logger)
{
/* i = virtual site | ,k
* j = 1st bonded heavy atom | i-j-m
cosakm = (std::cos(akjm) - std::cos(aijk) * std::cos(aijm)) / (std::sin(aijk) * std::sin(aijm));
if (cosakl < -1 || cosakl > 1 || cosakm < -1 || cosakm > 1)
{
- fprintf(stderr, "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f\n",
- vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f",
+ vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
gmx_fatal(FARGS,
"invalid construction in calc_vsite4fd for atom %d: "
"cosakl=%f, cosakm=%f\n",
static bool calc_vsite4fdn_param(InteractionOfType* vsite,
gmx::ArrayRef<const VsiteBondedInteraction> bonds,
- gmx::ArrayRef<const VsiteBondedInteraction> angles)
+ gmx::ArrayRef<const VsiteBondedInteraction> angles,
+ const gmx::MDLogger& logger)
{
/* i = virtual site | ,k
* j = 1st bonded heavy atom | i-j-m
if (fabs(pl) < 1000 * GMX_REAL_MIN || fabs(pm) < 1000 * GMX_REAL_MIN)
{
- fprintf(stderr, "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f\n",
- vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f",
+ vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
gmx_fatal(FARGS,
"invalid construction in calc_vsite4fdn for atom %d: "
"pl=%f, pm=%f\n",
}
-int set_vsites(bool bVerbose, t_atoms* atoms, PreprocessingAtomTypes* atypes, gmx::ArrayRef<InteractionsOfType> plist)
+int set_vsites(bool bVerbose,
+ t_atoms* atoms,
+ PreprocessingAtomTypes* atypes,
+ gmx::ArrayRef<InteractionsOfType> plist,
+ const gmx::MDLogger& logger)
{
int ftype;
int nvsite, nrset;
{
if (bVerbose && bFirst)
{
- fprintf(stderr, "Calculating parameters for virtual sites\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Calculating parameters for virtual sites");
bFirst = FALSE;
}
break;
case F_VSITE4FD:
bERROR = calc_vsite4fd_param(¶m, allVsiteBondeds.bonds,
- allVsiteBondeds.angles);
+ allVsiteBondeds.angles, logger);
break;
case F_VSITE4FDN:
bERROR = calc_vsite4fdn_param(¶m, allVsiteBondeds.bonds,
- allVsiteBondeds.angles);
+ allVsiteBondeds.angles, logger);
break;
default:
gmx_fatal(FARGS,
return nvsite;
}
-void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt)
+void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt, const gmx::MDLogger& logger)
{
int ftype, i;
if (bVerbose)
{
- fprintf(stderr, "Setting particle type to V for virtual sites\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Setting particle type to V for virtual sites");
}
for (ftype = 0; ftype < F_NRE; ftype++)
{
if (debug && nrd)
{
- fprintf(stderr, "doing %d %s virtual sites\n", (nrd / (nra + 1)),
- interaction_function[ftype].longname);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("doing %d %s virtual sites", (nrd / (nra + 1)),
+ interaction_function[ftype].longname);
}
for (i = 0; (i < nrd);)
int interactionIndex_;
};
-static void check_vsite_constraints(gmx::ArrayRef<InteractionsOfType> plist, int cftype, const int vsite_type[])
+static void check_vsite_constraints(gmx::ArrayRef<InteractionsOfType> plist,
+ int cftype,
+ const int vsite_type[],
+ const gmx::MDLogger& logger)
{
int n = 0;
for (const auto& param : plist[cftype].interactionTypes)
int atom = atoms[k];
if (vsite_type[atom] != NOTSET)
{
- fprintf(stderr, "ERROR: Cannot have constraint (%d-%d) with virtual site (%d)\n",
- param.ai() + 1, param.aj() + 1, atom + 1);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "ERROR: Cannot have constraint (%d-%d) with virtual site (%d)",
+ param.ai() + 1, param.aj() + 1, atom + 1);
n++;
}
}
static void clean_vsite_bonds(gmx::ArrayRef<InteractionsOfType> plist,
gmx::ArrayRef<const VsiteAtomMapping> pindex,
int cftype,
- const int vsite_type[])
+ const int vsite_type[],
+ const gmx::MDLogger& logger)
{
int ftype, nOut;
int nconverted, nremoved;
if (nremoved)
{
- fprintf(stderr, "Removed %4d %15ss with virtual sites, %zu left\n", nremoved,
- interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Removed %4d %15ss with virtual sites, %zu left", nremoved,
+ interaction_function[cftype].longname, ps->size());
}
if (nconverted)
{
- fprintf(stderr, "Converted %4d %15ss with virtual sites to connections, %zu left\n",
- nconverted, interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Converted %4d %15ss with virtual sites to connections, %zu left",
+ nconverted, interaction_function[cftype].longname, ps->size());
}
if (nOut)
{
- fprintf(stderr,
- "Warning: removed %d %ss with vsite with %s construction\n"
- " This vsite construction does not guarantee constant "
- "bond-length\n"
- " If the constructions were generated by pdb2gmx ignore "
- "this warning\n",
- nOut, interaction_function[cftype].longname, interaction_function[F_VSITE3OUT].longname);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Warning: removed %d %ss with vsite with %s construction\n"
+ " This vsite construction does not guarantee constant "
+ "bond-length\n"
+ " If the constructions were generated by pdb2gmx ignore "
+ "this warning",
+ nOut, interaction_function[cftype].longname,
+ interaction_function[F_VSITE3OUT].longname);
}
}
gmx::ArrayRef<VsiteAtomMapping> pindex,
int cftype,
const int vsite_type[],
- gmx::ArrayRef<const Atom2VsiteConnection> at2vc)
+ gmx::ArrayRef<const Atom2VsiteConnection> at2vc,
+ const gmx::MDLogger& logger)
{
int atom, at1, at2;
InteractionsOfType* ps;
if (oldSize != gmx::ssize(*ps))
{
- fprintf(stderr, "Removed %4zu %15ss with virtual sites, %zu left\n", oldSize - ps->size(),
- interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Removed %4zu %15ss with virtual sites, %zu left",
+ oldSize - ps->size(), interaction_function[cftype].longname,
+ ps->size());
}
}
static void clean_vsite_dihs(gmx::ArrayRef<InteractionsOfType> plist,
gmx::ArrayRef<const VsiteAtomMapping> pindex,
int cftype,
- const int vsite_type[])
+ const int vsite_type[],
+ const gmx::MDLogger& logger)
{
InteractionsOfType* ps;
if (oldSize != gmx::ssize(*ps))
{
- fprintf(stderr, "Removed %4zu %15ss with virtual sites, %zu left\n", oldSize - ps->size(),
- interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Removed %4zu %15ss with virtual sites, %zu left",
+ oldSize - ps->size(), interaction_function[cftype].longname,
+ ps->size());
}
}
// TODO use gmx::compat::optional for pindex.
-void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> plist, int natoms, bool bRmVSiteBds)
+void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> plist,
+ int natoms,
+ bool bRmVSiteBds,
+ const gmx::MDLogger& logger)
{
int nvsite, vsite;
int* vsite_type;
/* the rest only if we have virtual sites: */
if (nvsite)
{
- fprintf(stderr, "Cleaning up constraints %swith virtual sites\n",
- bRmVSiteBds ? "and constant bonded interactions " : "");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Cleaning up constraints %swith virtual sites",
+ bRmVSiteBds ? "and constant bonded interactions " : "");
/* Make a reverse list to avoid ninteractions^2 operations */
at2vc = make_at2vsitecon(natoms, plist);
{
if (interaction_function[ftype].flags & (IF_BTYPE | IF_CONSTRAINT))
{
- clean_vsite_bonds(plist, pindex, ftype, vsite_type);
+ clean_vsite_bonds(plist, pindex, ftype, vsite_type, logger);
}
else if (interaction_function[ftype].flags & IF_ATYPE)
{
- clean_vsite_angles(plist, pindex, ftype, vsite_type, at2vc);
+ clean_vsite_angles(plist, pindex, ftype, vsite_type, at2vc, logger);
}
else if ((ftype == F_PDIHS) || (ftype == F_IDIHS))
{
- clean_vsite_dihs(plist, pindex, ftype, vsite_type);
+ clean_vsite_dihs(plist, pindex, ftype, vsite_type, logger);
}
}
}
{
if (interaction_function[ftype].flags & IF_CONSTRAINT)
{
- check_vsite_constraints(plist, ftype, vsite_type);
+ check_vsite_constraints(plist, ftype, vsite_type, logger);
}
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, 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 t_atoms;
struct InteractionsOfType;
+namespace gmx
+{
+class MDLogger;
+}
+
int set_vsites(bool bVerbose,
t_atoms* atoms,
PreprocessingAtomTypes* atype,
- gmx::ArrayRef<InteractionsOfType> plist);
+ gmx::ArrayRef<InteractionsOfType> plist,
+ const gmx::MDLogger& logger);
/* set parameters for virtual sites, return number of virtual sites */
-void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt);
+void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt, const gmx::MDLogger& logger);
/* set ptype to VSite for virtual sites */
/*! \brief Clean up the bonded interactions
*
* Throw away all obsolete bonds, angles and dihedrals.
* Throw away all constraints. */
-void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> ps, int natoms, bool bRmVSiteBds);
+void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> ps,
+ int natoms,
+ bool bRmVSiteBds,
+ const gmx::MDLogger& logger);
#endif