/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
const auto& inputRecord = tprFile->inputRecord();
const auto& writeState = tprFile->state();
const auto& writeTopology = tprFile->molecularTopology();
- write_tpx_state(filename.c_str(), &inputRecord, &writeState, &writeTopology);
+ write_tpx_state(filename.c_str(), &inputRecord, &writeState, writeTopology);
}
TprReadHandle::TprReadHandle(TprContents&& tprFile) :
irInstance.nsteps = lround((endTime - run_t) / irInstance.delta_t);
- write_tpx_state(outFile.c_str(), &irInstance, &state, &mtop);
+ write_tpx_state(outFile.c_str(), &irInstance, &state, mtop);
success = true;
return success;
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
void write_sto_conf_mtop(const char* outfile,
const char* title,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const rvec x[],
const rvec* v,
PbcType pbcType,
*/
TpxFileHeader readTpxHeader(const char* fileName, bool canReadTopologyOnly);
-void write_tpx_state(const char* fn, const t_inputrec* ir, const t_state* state, const gmx_mtop_t* mtop);
+void write_tpx_state(const char* fn, const t_inputrec* ir, const t_state* state, const gmx_mtop_t& mtop);
/* Write a file, and close it again.
*/
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
t_trxstatus* in,
const char* infile,
int natoms,
- const struct gmx_mtop_t* mtop,
+ const gmx_mtop_t* mtop,
gmx::ArrayRef<const int> index,
const char* index_group_name);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
nullptr,
mtop->natoms,
mtop,
- get_atom_index(mtop),
+ get_atom_index(*mtop),
"System");
}
}
{
int a_gl = dd->globalAtomIndices[a];
int a_mol = 0;
- mtopGetMolblockIndex(&mtop, a_gl, &mb, nullptr, &a_mol);
+ mtopGetMolblockIndex(mtop, a_gl, &mb, nullptr, &a_mol);
const gmx_molblock_t* molb = &mtop.molblock[mb];
int settle = at2settle_mt[molb->type][a_mol];
int a_gl = dd->globalAtomIndices[a];
int molnr = 0;
int a_mol = 0;
- mtopGetMolblockIndex(&mtop, a_gl, &mb, &molnr, &a_mol);
+ mtopGetMolblockIndex(mtop, a_gl, &mb, &molnr, &a_mol);
const gmx_molblock_t& molb = mtop.molblock[mb];
{
if (edi->fitmas)
{
- edi->sref.m[i] = mtopGetAtomMass(&mtop, edi->sref.anrs[i], &molb);
+ edi->sref.m[i] = mtopGetAtomMass(mtop, edi->sref.anrs[i], &molb);
}
else
{
snew(edi->sav.m, edi->sav.nr);
for (i = 0; i < edi->sav.nr; i++)
{
- edi->sav.m[i] = mtopGetAtomMass(&mtop, edi->sav.anrs[i], &molb);
+ edi->sav.m[i] = mtopGetAtomMass(mtop, edi->sav.anrs[i], &molb);
if (edi->pcamas)
{
edi->sav.sqrtm[i] = sqrt(edi->sav.m[i]);
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
void write_sto_conf_mtop(const char* outfile,
const char* title,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const rvec x[],
const rvec* v,
PbcType pbcType,
readConfAndTopology(infile, &haveTopology, &mtop, pbcType, x, v, box);
*symtab = mtop.symtab;
*name = gmx_strdup(*mtop.name);
- *atoms = gmx_mtop_global_atoms(&mtop);
+ *atoms = gmx_mtop_global_atoms(mtop);
gmx::RangePartitioning molecules = gmx_mtop_molecules(mtop);
makeChainIdentifiersAfterTprReading(atoms, molecules);
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
fflush(out);
}
-void write_hconf_mtop(FILE* out, const char* title, const gmx_mtop_t* mtop, const rvec* x, const rvec* v, const matrix box)
+void write_hconf_mtop(FILE* out, const char* title, const gmx_mtop_t& mtop, const rvec* x, const rvec* v, const matrix box)
{
fprintf(out, "%s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
- fprintf(out, "%5d\n", mtop->natoms);
+ fprintf(out, "%5d\n", mtop.natoms);
const char* format = get_hconf_format(v != nullptr);
- for (const AtomProxy atomP : AtomRange(*mtop))
+ for (const AtomProxy atomP : AtomRange(mtop))
{
int i = atomP.globalAtomNumber();
int residueNumber = atomP.residueNumber();
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
const rvec* v,
const matrix box);
-void write_hconf_mtop(FILE* out, const char* title, const gmx_mtop_t* mtop, const rvec* x, const rvec* v, const matrix box);
+void write_hconf_mtop(FILE* out, const char* title, const gmx_mtop_t& mtop, const rvec* x, const rvec* v, const matrix box);
void write_hconf_p(FILE* out, const char* title, const t_atoms* atoms, const rvec* x, const rvec* v, const matrix box);
/* Write a Gromos file with precision ndec: number of decimal places in x,
gmx::ArrayRef<t_iparams> ip = mtop->ffparams.iparams;
- iloop = gmx_mtop_ilistloop_init(mtop);
+ iloop = gmx_mtop_ilistloop_init(*mtop);
while (const InteractionLists* ilist = gmx_mtop_ilistloop_next(iloop, &nmol))
{
const InteractionList& il = (*ilist)[F_DISRES];
return tpx;
}
-void write_tpx_state(const char* fn, const t_inputrec* ir, const t_state* state, const gmx_mtop_t* mtop)
+void write_tpx_state(const char* fn, const t_inputrec* ir, const t_state* state, const gmx_mtop_t& mtop)
{
/* To write a state, we first need to write the state information to a buffer before
* we append the raw bytes to the file. For this, the header information needs to be
t_fileio* fio;
- TpxFileHeader tpx = populateTpxHeader(*state, ir, mtop);
+ TpxFileHeader tpx = populateTpxHeader(*state, ir, &mtop);
// Long-term we should move to use little endian in files to avoid extra byte swapping,
// but since we just used the default XDR format (which is big endian) for the TPR
// header it would cause third-party libraries reading our raw data to tear their hair
const_cast<t_state*>(state),
nullptr,
nullptr,
- const_cast<gmx_mtop_t*>(mtop));
+ const_cast<gmx_mtop_t*>(&mtop));
std::vector<char> tprBody = tprBodySerializer.finishAndGetBuffer();
tpx.sizeOfTprBody = tprBody.size();
/* Topology stuff */
t_trxframe fr;
TpxFileHeader tpxh;
- gmx_mtop_t* mtop = nullptr;
+ gmx_mtop_t mtop;
PbcType pbcType = PbcType::Unset;
int ii, jj;
real temp, tfac;
if (tpr)
{
- mtop = new gmx_mtop_t;
tpxh = readTpxHeader(tpr, true);
if (tpxh.natoms != natoms)
{
gmx_fatal(FARGS, "tpr (%d atoms) and trajectory (%d atoms) do not match!", tpxh.natoms, natoms);
}
- pbcType = read_tpx(tpr, nullptr, nullptr, &natoms, nullptr, nullptr, mtop);
+ pbcType = read_tpx(tpr, nullptr, nullptr, &natoms, nullptr, nullptr, &mtop);
}
if (ndf <= -1)
{
{
printf("Using molecules rather than atoms. Not reading index file %s\n", ndx);
}
- GMX_RELEASE_ASSERT(mtop != nullptr, "Trying to access mtop->mols from NULL mtop pointer");
- mols = gmx_mtop_molecules(*mtop);
+ GMX_RELEASE_ASSERT(tpr, "Cannot access topology without having read it from TPR");
+ mols = gmx_mtop_molecules(mtop);
/* Make dummy index */
nindex = mols.numBlocks();
rhi,
&nlevels);
gmx_ffclose(fp);
- delete mtop;
sfree(t_x);
sfree(t_y);
for (i = 0; (i < n_x); i++)
ir->dr_tau = 0.0;
t_disresdata disresdata;
init_disres(fplog,
- topInfo.mtop(),
+ *topInfo.mtop(),
ir,
DisResRunMode::AnalysisTool,
DDRole::Master,
{
nharm = get_nharm(&mtop);
}
- std::vector<int> atom_index = get_atom_index(&mtop);
+ std::vector<int> atom_index = get_atom_index(mtop);
top = gmx_mtop_t_to_t_topology(&mtop, true);
snew(pairleg[i], 30);
j = fa[3 * i + 1];
k = fa[3 * i + 2];
- mtopGetAtomAndResidueName(topInfo.mtop(), j, &molb, &anm_j, &resnr_j, &resnm_j, nullptr);
- mtopGetAtomAndResidueName(topInfo.mtop(), k, &molb, &anm_k, &resnr_k, &resnm_k, nullptr);
+ GMX_ASSERT(topInfo.hasTopology(), "Need to have a valid topology");
+ mtopGetAtomAndResidueName(*topInfo.mtop(), j, &molb, &anm_j, &resnr_j, &resnm_j, nullptr);
+ mtopGetAtomAndResidueName(*topInfo.mtop(), k, &molb, &anm_k, &resnr_k, &resnm_k, nullptr);
sprintf(pairleg[i],
"%d %s %d %s (%d)",
resnr_j,
gmx_mtop_t mtop;
bool haveTop = false;
readConfAndTopology(opt2fn("-f", NFILE, fnm), &haveTop, &mtop, &pbcType, &x, &v, box);
- t_atoms atoms = gmx_mtop_global_atoms(&mtop);
+ t_atoms atoms = gmx_mtop_global_atoms(mtop);
natoms = atoms.nr;
nres = atoms.nres; /* nr of residues in one element? */
/* make space for all the atoms */
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
fprintf(stderr, "\nReading structure file\n");
readConfAndTopology(xfn, &haveTopology, &mtop, nullptr, &x, &v, box);
title = *mtop.name;
- atoms = gmx_mtop_global_atoms(&mtop);
+ atoms = gmx_mtop_global_atoms(mtop);
if (atoms.pdbinfo == nullptr)
{
snew(atoms.pdbinfo, atoms.nr);
* 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)
+ && gmx_mtop_ftype_count(*sys, F_VSITE3FD) == 0)
{
set_warning_line(wi, "unknown", -1);
warning_note(wi,
if (ir->bPull)
{
pull = set_pull_init(ir,
- &sys,
+ sys,
state.x.rvec_array(),
state.box,
state.lambda[FreeEnergyPerturbationCouplingType::Mass],
}
done_warning(wi, FARGS);
- write_tpx_state(ftp2fn(efTPR, NFILE, fnm), ir, &state, &sys);
+ write_tpx_state(ftp2fn(efTPR, NFILE, fnm), ir, &state, sys);
/* Output IMD group, if bIMD is TRUE */
- gmx::write_IMDgroup_to_file(ir->bIMD, ir, &state, &sys, NFILE, fnm);
+ gmx::write_IMDgroup_to_file(ir->bIMD, ir, &state, sys, NFILE, fnm);
sfree(opts->define);
sfree(opts->wall_atomtype[0]);
insertConfFile_.c_str(), &bTprFileWasRead, &topInserted, &pbcType_dummy, &temporaryX, nullptr, box_dummy);
xInserted.assign(temporaryX, temporaryX + topInserted.natoms);
sfree(temporaryX);
- atomsInserted = gmx_mtop_global_atoms(&topInserted);
+ atomsInserted = gmx_mtop_global_atoms(topInserted);
if (atomsInserted.nr == 0)
{
gmx_fatal(FARGS, "No molecule in %s, please check your input", insertConfFile_.c_str());
}
}
- t_atoms atoms = gmx_mtop_global_atoms(&top_);
+ t_atoms atoms = gmx_mtop_global_atoms(top_);
/* add nmol_ins molecules of atoms_ins
in random orientation at random place */
snew(defaultIndexGroups, 1);
snew(defaultIndexGroups->index, 1);
snew(gnames, 1);
- atoms_all = gmx_mtop_global_atoms(mtop);
+ atoms_all = gmx_mtop_global_atoms(*mtop);
analyse(&atoms_all, defaultIndexGroups, &gnames, FALSE, TRUE);
done_atom(&atoms_all);
}
}
-static void check_disre(const gmx_mtop_t* mtop)
+static void check_disre(const gmx_mtop_t& mtop)
{
if (gmx_mtop_ftype_count(mtop, F_DISRES) > 0)
{
- const gmx_ffparams_t& ffparams = mtop->ffparams;
+ const gmx_ffparams_t& ffparams = mtop.ffparams;
int ndouble = 0;
int old_label = -1;
for (int i = 0; i < ffparams.numTypes(); i++)
}
}
-static bool absolute_reference(const t_inputrec* ir, const gmx_mtop_t* sys, const bool posres_only, ivec AbsRef)
+static bool absolute_reference(const t_inputrec* ir, const gmx_mtop_t& sys, const bool posres_only, ivec AbsRef)
{
int d, g, i;
gmx_mtop_ilistloop_t iloop;
{
for (i = 0; i < (*ilist)[F_POSRES].size(); i += 2)
{
- pr = &sys->ffparams.iparams[(*ilist)[F_POSRES].iatoms[i]];
+ pr = &sys.ffparams.iparams[(*ilist)[F_POSRES].iatoms[i]];
for (d = 0; d < DIM; d++)
{
if (pr->posres.fcA[d] != 0)
for (i = 0; i < (*ilist)[F_FBPOSRES].size(); i += 2)
{
/* Check for flat-bottom posres */
- pr = &sys->ffparams.iparams[(*ilist)[F_FBPOSRES].iatoms[i]];
+ pr = &sys.ffparams.iparams[(*ilist)[F_FBPOSRES].iatoms[i]];
if (pr->fbposres.k != 0)
{
switch (pr->fbposres.geom)
return (AbsRef[XX] != 0 && AbsRef[YY] != 0 && AbsRef[ZZ] != 0);
}
-static void check_combination_rule_differences(const gmx_mtop_t* mtop,
+static void check_combination_rule_differences(const gmx_mtop_t& mtop,
int state,
bool* bC6ParametersWorkWithGeometricRules,
bool* bC6ParametersWorkWithLBRules,
*bC6ParametersWorkWithLBRules = TRUE;
*bC6ParametersWorkWithGeometricRules = TRUE;
bCanDoLBRules = TRUE;
- ntypes = mtop->ffparams.atnr;
+ ntypes = mtop.ffparams.atnr;
snew(typecount, ntypes);
gmx_mtop_count_atomtypes(mtop, state, typecount);
*bLBRulesPossible = TRUE;
for (tpi = 0; tpi < ntypes; ++tpi)
{
- c6i = mtop->ffparams.iparams[(ntypes + 1) * tpi].lj.c6;
- c12i = mtop->ffparams.iparams[(ntypes + 1) * tpi].lj.c12;
+ c6i = mtop.ffparams.iparams[(ntypes + 1) * tpi].lj.c6;
+ c12i = mtop.ffparams.iparams[(ntypes + 1) * tpi].lj.c12;
for (tpj = tpi; tpj < ntypes; ++tpj)
{
- c6j = mtop->ffparams.iparams[(ntypes + 1) * tpj].lj.c6;
- c12j = mtop->ffparams.iparams[(ntypes + 1) * tpj].lj.c12;
- c6 = mtop->ffparams.iparams[ntypes * tpi + tpj].lj.c6;
+ c6j = mtop.ffparams.iparams[(ntypes + 1) * tpj].lj.c6;
+ c12j = mtop.ffparams.iparams[(ntypes + 1) * tpj].lj.c12;
+ c6 = mtop.ffparams.iparams[ntypes * tpi + tpj].lj.c6;
c6_geometric = std::sqrt(c6i * c6j);
if (!gmx_numzero(c6_geometric))
{
sfree(typecount);
}
-static void check_combination_rules(const t_inputrec* ir, const gmx_mtop_t* mtop, warninp_t wi)
+static void check_combination_rules(const t_inputrec* ir, const gmx_mtop_t& mtop, warninp_t wi)
{
bool bLBRulesPossible, bC6ParametersWorkWithGeometricRules, bC6ParametersWorkWithLBRules;
set_warning_line(wi, mdparin, -1);
- if (absolute_reference(ir, sys, false, AbsRef))
+ if (absolute_reference(ir, *sys, false, AbsRef))
{
warning_note(wi,
"Removing center of mass motion in the presence of position restraints might "
if (EI_DYNAMICS(ir->eI) && !EI_SD(ir->eI) && ir->eI != IntegrationAlgorithm::BD
&& ir->comm_mode == ComRemovalAlgorithm::No
- && !(absolute_reference(ir, sys, FALSE, AbsRef) || ir->nsteps <= 10) && !ETC_ANDERSEN(ir->etc))
+ && !(absolute_reference(ir, *sys, FALSE, AbsRef) || ir->nsteps <= 10) && !ETC_ANDERSEN(ir->etc))
{
warning(wi,
"You are not using center of mass motion removal (mdp option comm-mode), numerical "
/* Check for pressure coupling with absolute position restraints */
if (ir->epc != PressureCoupling::No && ir->refcoord_scaling == RefCoordScaling::No)
{
- absolute_reference(ir, sys, TRUE, AbsRef);
+ absolute_reference(ir, *sys, TRUE, AbsRef);
{
for (m = 0; m < DIM; m++)
{
}
bCharge = FALSE;
- aloopb = gmx_mtop_atomloop_block_init(sys);
+ aloopb = gmx_mtop_atomloop_block_init(*sys);
const t_atom* atom;
while (gmx_mtop_atomloop_block_next(aloopb, &atom, &nmol))
{
/* Check if combination rules used in LJ-PME are the same as in the force field */
if (EVDW_PME(ir->vdwtype))
{
- check_combination_rules(ir, sys, wi);
+ check_combination_rules(ir, *sys, wi);
}
/* Generalized reaction field */
{
if (ir->pull->coord[i].group[0] == 0 || ir->pull->coord[i].group[1] == 0)
{
- absolute_reference(ir, sys, FALSE, AbsRef);
+ absolute_reference(ir, *sys, FALSE, AbsRef);
for (m = 0; m < DIM; m++)
{
if (ir->pull->coord[i].dim[m] && !AbsRef[m])
}
}
- check_disre(sys);
+ check_disre(*sys);
}
void double_check(t_inputrec* ir, matrix box, bool bHasNormalConstraints, bool bHasAnyConstraints, warninp_t wi)
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
gmx::ArrayRef<const t_pull_coord> pullCoords);
/* Process the pull coordinates after reading the pull groups */
-pull_t* set_pull_init(t_inputrec* ir, const gmx_mtop_t* mtop, rvec* x, matrix box, real lambda, warninp_t wi);
+pull_t* set_pull_init(t_inputrec* ir, const gmx_mtop_t& mtop, rvec* x, matrix box, real lambda, warninp_t wi);
/* Prints the initial pull group distances in x.
* If requested, adds the current distance to the initial reference location.
* Returns the pull_t pull work struct. This should be passed to finish_pull()
}
}
-pull_t* set_pull_init(t_inputrec* ir, const gmx_mtop_t* mtop, rvec* x, matrix box, real lambda, warninp_t wi)
+pull_t* set_pull_init(t_inputrec* ir, const gmx_mtop_t& mtop, rvec* x, matrix box, real lambda, warninp_t wi)
{
pull_t* pull_work;
t_pbc pbc;
pull_params_t* pull = ir->pull.get();
gmx::LocalAtomSetManager atomSets;
pull_work = init_pull(nullptr, pull, ir, mtop, nullptr, &atomSets, lambda);
- auto mdAtoms = gmx::makeMDAtoms(nullptr, *mtop, *ir, false);
+ auto mdAtoms = gmx::makeMDAtoms(nullptr, mtop, *ir, false);
auto md = mdAtoms->mdatoms();
- atoms2md(*mtop, *ir, -1, {}, mtop->natoms, mdAtoms.get());
+ atoms2md(mtop, *ir, -1, {}, mtop.natoms, mdAtoms.get());
if (ir->efep != FreeEnergyPerturbationType::No)
{
update_mdatoms(md, lambda);
{
bool groupObeysPbc = pullCheckPbcWithinGroup(
*pull_work,
- gmx::arrayRefFromArray(reinterpret_cast<gmx::RVec*>(x), mtop->natoms),
+ gmx::arrayRefFromArray(reinterpret_cast<gmx::RVec*>(x), mtop.natoms),
pbc,
g,
c_pullGroupSmallGroupThreshold);
{
groupObeysPbc = pullCheckPbcWithinGroup(
*pull_work,
- gmx::arrayRefFromArray(reinterpret_cast<gmx::RVec*>(x), mtop->natoms),
+ gmx::arrayRefFromArray(reinterpret_cast<gmx::RVec*>(x), mtop.natoms),
pbc,
g,
c_pullGroupPbcMargin);
boxSolvent);
t_atoms* atomsSolvent;
snew(atomsSolvent, 1);
- *atomsSolvent = gmx_mtop_global_atoms(&topSolvent);
+ *atomsSolvent = gmx_mtop_global_atoms(topSolvent);
xSolvent.assign(temporaryX, temporaryX + topSolvent.natoms);
sfree(temporaryX);
vSolvent.assign(temporaryV, temporaryV + topSolvent.natoms);
rvec *temporaryX = nullptr, *temporaryV = nullptr;
readConfAndTopology(
conf_prot, &bTprFileWasRead, &top, &pbcType, &temporaryX, bReadV ? &temporaryV : nullptr, box);
- *atoms = gmx_mtop_global_atoms(&top);
+ *atoms = gmx_mtop_global_atoms(top);
x.assign(temporaryX, temporaryX + top.natoms);
sfree(temporaryX);
if (temporaryV)
*/
void openOutputFile(const char* fn, int nat_total, const gmx_output_env_t* oenv, StartingBehavior startingBehavior);
/*! \brief Creates the molecule start-end position array of molecules in the IMD group. */
- void prepareMoleculesInImdGroup(const gmx_mtop_t* top_global);
+ void prepareMoleculesInImdGroup(const gmx_mtop_t& top_global);
/*! \brief Removes shifts of molecules diffused outside of the box. */
void removeMolecularShifts(const matrix box);
/*! \brief Initialize arrays used to assemble the positions from the other nodes. */
void write_IMDgroup_to_file(bool bIMD,
t_inputrec* ir,
const t_state* state,
- const gmx_mtop_t* sys,
+ const gmx_mtop_t& sys,
int nfile,
const t_filenm fnm[])
{
}
-void ImdSession::Impl::prepareMoleculesInImdGroup(const gmx_mtop_t* top_global)
+void ImdSession::Impl::prepareMoleculesInImdGroup(const gmx_mtop_t& top_global)
{
/* check whether index is sorted */
for (int i = 0; i < nat - 1; i++)
}
}
- RangePartitioning gmols = gmx_mtop_molecules(*top_global);
+ RangePartitioning gmols = gmx_mtop_molecules(top_global);
t_block lmols;
lmols.nr = 0;
snew(lmols.index, gmols.numBlocks() + 1);
gmx_wallcycle* wcycle,
gmx_enerdata_t* enerd,
const gmx_multisim_t* ms,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const MDLogger& mdlog,
const rvec x[],
int nfile,
*****************************************************
*/
- int nat_total = top_global->natoms;
+ int nat_total = top_global.natoms;
/* Initialize IMD session. If we read in a pre-IMD .tpr file, ir->imd->nat
* will be zero. For those cases we transfer _all_ atomic positions */
void write_IMDgroup_to_file(bool bIMD,
t_inputrec* ir,
const t_state* state,
- const gmx_mtop_t* sys,
+ const gmx_mtop_t& sys,
int nfile,
const t_filenm fnm[]);
gmx_wallcycle* wcycle,
gmx_enerdata_t* enerd,
const gmx_multisim_t* ms,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const MDLogger& mdlog,
const rvec x[],
int nfile,
gmx_wallcycle* wcycle,
gmx_enerdata_t* enerd,
const gmx_multisim_t* ms,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const MDLogger& mdlog,
const rvec x[],
int nfile,
#include "gromacs/utility/smalloc.h"
void init_disres(FILE* fplog,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
t_inputrec* ir,
DisResRunMode disResRunMode,
DDRole ddRole,
type = (*il)[F_DISRES].iatoms[fa];
np++;
- npair = mtop->ffparams.iparams[type].disres.npair;
+ npair = mtop.ffparams.iparams[type].disres.npair;
if (np == npair)
{
dd->nres += (ir->eDisre == DistanceRestraintRefinement::Ensemble ? 1 : nmol);
* must differ according to whether REMD is active.
*/
void init_disres(FILE* fplog,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
t_inputrec* ir,
DisResRunMode disResRunMode,
DDRole ddRole,
// a user can't just do multi-sim with single-sim orientation restraints.
void init_orires(FILE* fplog,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_inputrec* ir,
const t_commrec* cr,
const gmx_multisim_t* ms,
for (int i = 0; i < numOrires; i += 3)
{
int type = (*il)[F_ORIRES].iatoms[i];
- int ex = mtop->ffparams.iparams[type].orires.ex;
+ int ex = mtop.ffparams.iparams[type].orires.ex;
if (ex >= od->nex)
{
srenew(nr_ex, ex + 1);
snew(od->tmpEq, od->nex);
od->nref = 0;
- for (int i = 0; i < mtop->natoms; i++)
+ for (int i = 0; i < mtop.natoms; i++)
{
- if (getGroupType(mtop->groups, SimulationAtomGroupType::OrientationRestraintsFit, i) == 0)
+ if (getGroupType(mtop.groups, SimulationAtomGroupType::OrientationRestraintsFit, i) == 0)
{
od->nref++;
}
rvec com = { 0, 0, 0 };
double mtot = 0.0;
int j = 0;
- for (const AtomProxy atomP : AtomRange(*mtop))
+ for (const AtomProxy atomP : AtomRange(mtop))
{
const t_atom& local = atomP.atom();
int i = atomP.globalAtomNumber();
- if (mtop->groups.groupNumbers[SimulationAtomGroupType::OrientationRestraintsFit].empty()
- || mtop->groups.groupNumbers[SimulationAtomGroupType::OrientationRestraintsFit][i] == 0)
+ if (mtop.groups.groupNumbers[SimulationAtomGroupType::OrientationRestraintsFit].empty()
+ || mtop.groups.groupNumbers[SimulationAtomGroupType::OrientationRestraintsFit][i] == 0)
{
/* Not correct for free-energy with changing masses */
od->mref[j] = local.m;
* restraints can not run in parallel).
*/
void init_orires(FILE* fplog,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_inputrec* ir,
const t_commrec* cr,
const gmx_multisim_t* ms,
/* Count the types so we avoid natoms^2 operations */
std::vector<int> typecount(ntp);
- gmx_mtop_count_atomtypes(&mtop, q, typecount.data());
+ gmx_mtop_count_atomtypes(mtop, q, typecount.data());
for (int tpi = 0; tpi < ntp; tpi++)
{
double totalMassB = 0.0;
md->haveVsites = FALSE;
- gmx_mtop_atomloop_block_t aloop = gmx_mtop_atomloop_block_init(&mtop);
+ gmx_mtop_atomloop_block_t aloop = gmx_mtop_atomloop_block_init(mtop);
const t_atom* atom;
int nmol;
while (gmx_mtop_atomloop_block_next(aloop, &atom, &nmol))
}
}
- md->bOrires = (gmx_mtop_ftype_count(&mtop, F_ORIRES) != 0);
+ md->bOrires = (gmx_mtop_ftype_count(mtop, F_ORIRES) != 0);
return mdAtoms;
}
{
ag = index[i];
}
- const t_atom& atom = mtopGetAtomParameters(&mtop, ag, &molb);
+ const t_atom& atom = mtopGetAtomParameters(mtop, ag, &molb);
if (md->cFREEZE)
{
gmx::IMDOutputProvider* outputProvider,
const gmx::MdModulesNotifier& mdModulesNotifier,
const t_inputrec* ir,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const gmx_output_env_t* oenv,
gmx_wallcycle_t wcycle,
const gmx::StartingBehavior startingBehavior,
gmx_tng_open(filename, filemode[0], &of->tng_low_prec);
if (filemode[0] == 'w')
{
- gmx_tng_prepare_low_prec_writing(of->tng_low_prec, top_global, ir);
+ gmx_tng_prepare_low_prec_writing(of->tng_low_prec, &top_global, ir);
}
bCiteTng = TRUE;
break;
gmx_tng_open(filename, filemode[0], &of->tng);
if (filemode[0] == 'w')
{
- gmx_tng_prepare_md_writing(of->tng, top_global, ir);
+ gmx_tng_prepare_md_writing(of->tng, &top_global, ir);
}
bCiteTng = TRUE;
break;
trajectory-writing routines later. Also, XTC writing needs
to know what (and how many) atoms might be in the XTC
groups, and how to look up later which ones they are. */
- of->natoms_global = top_global->natoms;
- of->groups = &top_global->groups;
+ of->natoms_global = top_global.natoms;
+ of->groups = &top_global.groups;
of->natoms_x_compressed = 0;
- for (i = 0; (i < top_global->natoms); i++)
+ for (i = 0; (i < top_global.natoms); i++)
{
if (getGroupType(*of->groups, SimulationAtomGroupType::CompressedPositionOutput, i) == 0)
{
if (ir->nstfout && DOMAINDECOMP(cr))
{
- snew(of->f_global, top_global->natoms);
+ snew(of->f_global, top_global.natoms);
}
}
* This file is part of the GROMACS molecular simulation package.
*
* 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.
gmx::IMDOutputProvider* outputProvider,
const gmx::MdModulesNotifier& mdModulesNotifier,
const t_inputrec* ir,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const gmx_output_env_t* oenv,
gmx_wallcycle_t wcycle,
gmx::StartingBehavior startingBehavior,
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Get the global molecule id, and the corresponding molecule type and id of the *
* molblock from the global atom nr. */
-static int get_mol_id(int at, gmx_mtop_t* mtop, int* type, int* block)
+static int get_mol_id(int at, const gmx_mtop_t& mtop, int* type, int* block)
{
int mol_id = 0;
int i;
mtopGetMolblockIndex(mtop, at, block, &mol_id, &atnr_mol);
for (i = 0; i < *block; i++)
{
- mol_id += mtop->molblock[i].nmol;
+ mol_id += mtop.molblock[i].nmol;
}
- *type = mtop->molblock[*block].type;
+ *type = mtop.molblock[*block].type;
return mol_id;
}
* level, if the same molecule type is found in another part of the system, these *
* would also be affected. Therefore we have to check if the embedded and rest group *
* share common molecule types. If so, membed will stop with an error. */
-static int get_mtype_list(t_block* at, gmx_mtop_t* mtop, t_block* tlist)
+static int get_mtype_list(t_block* at, const gmx_mtop_t& mtop, t_block* tlist)
{
int i, j, nr;
int type = 0, block = 0;
}
/* Do the actual check of the molecule types between embedded and rest group */
-static void check_types(t_block* ins_at, t_block* rest_at, gmx_mtop_t* mtop)
+static void check_types(t_block* ins_at, t_block* rest_at, const gmx_mtop_t& mtop)
{
t_block *ins_mtype, *rest_mtype;
int i, j;
"moleculetype of the molecules %s in the inserted group. Do not forget to "
"provide\n"
"an appropriate *.itp file",
- *(mtop->moltype[rest_mtype->index[j]].name),
- *(mtop->moltype[rest_mtype->index[j]].name),
- *(mtop->moltype[rest_mtype->index[j]].name));
+ *(mtop.moltype[rest_mtype->index[j]].name),
+ *(mtop.moltype[rest_mtype->index[j]].name),
+ *(mtop.moltype[rest_mtype->index[j]].name));
}
}
}
return area;
}
-static int init_mem_at(mem_t* mem_p, gmx_mtop_t* mtop, rvec* r, matrix box, pos_ins_t* pos_ins)
+static int init_mem_at(mem_t* mem_p, const gmx_mtop_t& mtop, rvec* r, matrix box, pos_ins_t* pos_ins)
{
int i, j, at, mol, nmol, nmolbox, count;
t_block* mem_a;
mem_p->zmed = (zmax - zmin) / 2 + zmin;
/*number of membrane molecules in protein box*/
- nmolbox = count / mtop->moltype[mtop->molblock[block].type].atoms.nr;
+ nmolbox = count / mtop.moltype[mtop.molblock[block].type].atoms.nr;
/*membrane area within the box defined by the min and max coordinates of the embedded molecule*/
mem_area = (pos_ins->xmax[XX] - pos_ins->xmin[XX]) * (pos_ins->xmax[YY] - pos_ins->xmin[YY]);
/*rough estimate of area per lipid, assuming there is only one type of lipid in the membrane*/
/* generate the list of membrane molecules that overlap with the molecule to be embedded. *
* The molecule to be embedded is already reduced in size. */
-static int gen_rm_list(rm_t* rm_p,
- t_block* ins_at,
- t_block* rest_at,
- t_pbc* pbc,
- gmx_mtop_t* mtop,
- rvec* r,
- mem_t* mem_p,
- pos_ins_t* pos_ins,
- real probe_rad,
- int low_up_rm,
- gmx_bool bALLOW_ASYMMETRY)
+static int gen_rm_list(rm_t* rm_p,
+ t_block* ins_at,
+ t_block* rest_at,
+ t_pbc* pbc,
+ const gmx_mtop_t& mtop,
+ rvec* r,
+ mem_t* mem_p,
+ pos_ins_t* pos_ins,
+ real probe_rad,
+ int low_up_rm,
+ gmx_bool bALLOW_ASYMMETRY)
{
int i, j, k, l, at, at2, mol_id;
int type = 0, block = 0;
int* order;
r_min_rad = probe_rad * probe_rad;
- gmx::RangePartitioning molecules = gmx_mtop_molecules(*mtop);
+ gmx::RangePartitioning molecules = gmx_mtop_molecules(mtop);
snew(rm_p->block, molecules.numBlocks());
snew(rm_p->mol, molecules.numBlocks());
nrm = nupper = 0;
while (nupper != nlower)
{
mol_id = mem_p->mol_id[order[i]];
- block = get_molblock(mol_id, mtop->molblock);
+ block = get_molblock(mol_id, mtop.molblock);
bRM = TRUE;
for (l = 0; l < nrm; l++)
{
gnames.emplace_back(*groupName);
}
- atoms = gmx_mtop_global_atoms(mtop);
+ atoms = gmx_mtop_global_atoms(*mtop);
snew(mem_p, 1);
fprintf(stderr, "\nSelect a group to embed in the membrane:\n");
get_index(&atoms, opt2fn_null("-mn", nfile, fnm), 1, &(ins_at->nr), &(ins_at->index), &ins);
snew(rest_at, 1);
init_ins_at(ins_at, rest_at, state, pos_ins, groups, ins_grp_id, xy_max);
/* Check that moleculetypes in insertion group are not part of the rest of the system */
- check_types(ins_at, rest_at, mtop);
+ check_types(ins_at, rest_at, *mtop);
- init_mem_at(mem_p, mtop, state->x.rvec_array(), state->box, pos_ins);
+ init_mem_at(mem_p, *mtop, state->x.rvec_array(), state->box, pos_ins);
prot_area = est_prot_area(pos_ins, state->x.rvec_array(), ins_at, mem_p);
if ((prot_area > prot_vs_box)
snew(rm_p, 1);
lip_rm = gen_rm_list(
- rm_p, ins_at, rest_at, pbc, mtop, state->x.rvec_array(), mem_p, pos_ins, probe_rad, low_up_rm, bALLOW_ASYMMETRY);
+ rm_p, ins_at, rest_at, pbc, *mtop, state->x.rvec_array(), mem_p, pos_ins, probe_rad, low_up_rm, bALLOW_ASYMMETRY);
lip_rm -= low_up_rm;
if (fplog)
t_state* state,
t_state* state_global,
ObservablesHistory* observablesHistory,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
t_forcerec* fr,
gmx_mdoutf_t outf,
const gmx::EnergyOutput& energyOutput,
// This duplication is needed while both legacy and modular code paths are in use.
// TODO: Remove duplication asap, make sure to keep in sync in the meantime.
mdoutf_write_to_trajectory_files(
- fplog, cr, outf, mdof_flags, top_global->natoms, step, t, state, state_global, observablesHistory, f, &checkpointDataHolder);
+ fplog, cr, outf, mdof_flags, top_global.natoms, step, t, state, state_global, observablesHistory, f, &checkpointDataHolder);
if (bLastStep && step_rel == ir->nsteps && bDoConfOut && MASTER(cr) && !bRerunMD)
{
if (fr->bMolPBC && state == state_global)
if (fr->bMolPBC && !ir->bPeriodicMols)
{
/* Make molecules whole only for confout writing */
- do_pbc_mtop(ir->pbcType, state->box, top_global, x_for_confout);
+ do_pbc_mtop(ir->pbcType, state->box, &top_global, x_for_confout);
}
write_sto_conf_mtop(ftp2fn(efSTO, nfile, fnm),
- *top_global->name,
+ *top_global.name,
top_global,
x_for_confout,
state_global->v.rvec_array(),
t_state* state,
t_state* state_global,
ObservablesHistory* observablesHistory,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
t_forcerec* fr,
gmx_mdoutf_t outf,
const gmx::EnergyOutput& energyOutput,
const t_fcdata& fcdata,
t_extmass* MassQ,
t_vcm* vcm,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const gmx_localtop_t& top,
gmx_enerdata_t* enerd,
gmx_ekindata_t* ekind,
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
const t_fcdata& fcdata,
t_extmass* MassQ,
t_vcm* vcm,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const gmx_localtop_t& top,
gmx_enerdata_t* enerd,
gmx_ekindata_t* ekind,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,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.
const int globalAtom = globalAtomIndices[localAtom];
int moleculeIndex;
int atomIndexInMolecule;
- mtopGetMolblockIndex(&mtop_, globalAtom, &moleculeBlock, &moleculeIndex, &atomIndexInMolecule);
+ mtopGetMolblockIndex(mtop_, globalAtom, &moleculeBlock, &moleculeIndex, &atomIndexInMolecule);
const auto& indicesForBlock = indicesPerMoleculeblock_[moleculeBlock];
int globalUpdateGroupIndex = indicesForBlock.groupStart_
+ moleculeIndex * indicesForBlock.numGroupsPerMolecule_
GMX_ASSERT(ftype >= c_ftypeVsiteStart && ftype < c_ftypeVsiteEnd,
"c_ftypeVsiteStart and/or c_ftypeVsiteEnd do not have correct values");
- nvsite += gmx_mtop_ftype_count(&mtop, ftype);
+ nvsite += gmx_mtop_ftype_count(mtop, ftype);
}
else
{
ImdSession* imdSession,
pull_t* pull_work,
t_swap* swap,
- gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
t_state* state_global,
ObservablesHistory* observablesHistory,
MDAtoms* mdAtoms,
//! The coordinate-swapping session.
t_swap* swap;
//! Full system topology.
- const gmx_mtop_t* top_global;
+ const gmx_mtop_t& top_global;
//! Full simulation state (only non-nullptr on master rank).
t_state* state_global;
//! History of simulation observables.
int nstglobalcomm = computeGlobalCommunicationPeriod(mdlog, ir, cr);
bGStatEveryStep = (nstglobalcomm == 1);
- const SimulationGroups* groups = &top_global->groups;
+ const SimulationGroups* groups = &top_global.groups;
std::unique_ptr<EssentialDynamics> ed = nullptr;
if (opt2bSet("-ei", nfile, fnm))
ed = init_edsam(mdlog,
opt2fn_null("-ei", nfile, fnm),
opt2fn("-eo", nfile, fnm),
- *top_global,
+ top_global,
*ir,
cr,
constr,
simulationsShareState,
ms);
gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
- *top_global,
+ top_global,
*ir,
pull_work,
mdoutf_get_fp_dhdl(outf),
useGpuForPme);
{
- double io = compute_io(ir, top_global->natoms, *groups, energyOutput.numEnergyTerms(), 1);
+ double io = compute_io(ir, top_global.natoms, *groups, energyOutput.numEnergyTerms(), 1);
if ((io > 2000) && MASTER(cr))
{
fprintf(stderr, "\nWARNING: This run will generate roughly %.0f Mb of data\n\n", io);
std::unique_ptr<t_state> stateInstance;
t_state* state;
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
auto mdatoms = mdAtoms->mdatoms();
TRUE,
1,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
state = state_global;
/* Generate and initialize new topology */
- mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+ mdAlgorithmsSetupAtomData(cr, *ir, top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
upd.setNumAtoms(state->natoms);
}
"Orientation restraints are not supported with the GPU update.\n");
GMX_RELEASE_ASSERT(
ir->efep == FreeEnergyPerturbationType::No
- || (!haveFepPerturbedMasses(*top_global) && !havePerturbedConstraints(*top_global)),
+ || (!haveFepPerturbedMasses(top_global) && !havePerturbedConstraints(top_global)),
"Free energy perturbation of masses and constraints are not supported with the GPU "
"update.");
"update-constraints.");
integrator = std::make_unique<UpdateConstrainGpu>(
*ir,
- *top_global,
+ top_global,
ekind->ngtc,
fr->deviceStreamManager->context(),
fr->deviceStreamManager->stream(gmx::DeviceStreamType::UpdateAndConstraints),
if (useReplicaExchange && MASTER(cr))
{
- repl_ex = init_replica_exchange(fplog, ms, top_global->natoms, ir, replExParams);
+ repl_ex = init_replica_exchange(fplog, ms, top_global.natoms, ir, replExParams);
}
/* PME tuning is only supported in the Verlet scheme, with PME for
* Coulomb. It is not supported with only LJ PME. */
bSumEkinhOld = FALSE;
- t_vcm vcm(top_global->groups, *ir);
+ t_vcm vcm(top_global.groups, *ir);
reportComRemovalInfo(fplog, vcm);
/* To minimize communication, compute_globals computes the COM velocity
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
}
char tbuf[20];
- fprintf(stderr, "starting mdrun '%s'\n", *(top_global->name));
+ fprintf(stderr, "starting mdrun '%s'\n", *(top_global.name));
if (ir->nsteps >= 0)
{
sprintf(tbuf, "%8.1f", (ir->init_step + ir->nsteps) * ir->delta_t);
bMasterState,
nstglobalcomm,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
TRUE,
1,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
if (MASTER(cr))
{
MimicCommunicator::init();
- auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(top_global);
+ auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(&top_global);
MimicCommunicator::sendInitData(nonConstGlobalTopology, state_global->x);
// TODO: Avoid changing inputrec (#3854)
auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
gmx_bcast(sizeof(ir->nsteps), &nonConstInputrec->nsteps, cr->mpi_comm_mygroup);
}
- const SimulationGroups* groups = &top_global->groups;
+ const SimulationGroups* groups = &top_global.groups;
{
- auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(top_global);
- nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(*top_global);
+ auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(&top_global);
+ nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(top_global);
}
initialize_lambdas(fplog, *ir, MASTER(cr), &state_global->fep_state, state_global->lambda);
simulationsShareState,
ms);
gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
- *top_global,
+ top_global,
*ir,
pull_work,
mdoutf_get_fp_dhdl(outf),
runScheduleWork->simulationWork.useGpuPme);
{
- double io = compute_io(ir, top_global->natoms, *groups, energyOutput.numEnergyTerms(), 1);
+ double io = compute_io(ir, top_global.natoms, *groups, energyOutput.numEnergyTerms(), 1);
if ((io > 2000) && MASTER(cr))
{
fprintf(stderr, "\nWARNING: This run will generate roughly %.0f Mb of data\n\n", io);
std::unique_ptr<t_state> stateInstance;
t_state* state;
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
if (DOMAINDECOMP(cr))
{
TRUE,
1,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
/* Copy the pointer to the global state */
state = state_global;
- mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+ mdAlgorithmsSetupAtomData(cr, *ir, top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
}
auto mdatoms = mdAtoms->mdatoms();
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
if (MASTER(cr))
{
- fprintf(stderr, "starting MiMiC MD run '%s'\n\n", *(top_global->name));
+ fprintf(stderr, "starting MiMiC MD run '%s'\n\n", *(top_global.name));
if (mdrunOptions.verbose)
{
fprintf(stderr,
bMasterState,
nstglobalcomm,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
}
{
- gmx::HostVector<gmx::RVec> fglobal(top_global->natoms);
+ gmx::HostVector<gmx::RVec> fglobal(top_global.natoms);
gmx::ArrayRef<gmx::RVec> ftemp;
gmx::ArrayRef<const gmx::RVec> flocal = f.view().force();
if (DOMAINDECOMP(cr))
gmx::ImdSession* imdSession,
pull_t* pull_work,
t_state* state_global,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
em_state_t* ems,
gmx_localtop_t* top,
t_nrnb* nrnb,
TRUE,
1,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
state_change_natoms(&ems->s, ems->s.natoms);
mdAlgorithmsSetupAtomData(
- cr, *ir, *top_global, top, fr, &ems->f, mdAtoms, constr, vsite, shellfc ? *shellfc : nullptr);
+ cr, *ir, top_global, top, fr, &ems->f, mdAtoms, constr, vsite, shellfc ? *shellfc : nullptr);
}
update_mdatoms(mdAtoms->mdatoms(), ems->s.lambda[FreeEnergyPerturbationCouplingType::Mass]);
gmx_bool bX,
gmx_bool bF,
const char* confout,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const t_inputrec* ir,
int64_t step,
em_state_t* state,
cr,
outf,
mdof_flags,
- top_global->natoms,
+ top_global.natoms,
step,
static_cast<double>(step),
&state->s,
if (ir->pbcType != PbcType::No && !ir->bPeriodicMols && DOMAINDECOMP(cr))
{
/* Make molecules whole only for confout writing */
- do_pbc_mtop(ir->pbcType, state->s.box, top_global, state_global->x.rvec_array());
+ do_pbc_mtop(ir->pbcType, state->s.box, &top_global, state_global->x.rvec_array());
}
write_sto_conf_mtop(confout,
- *top_global->name,
+ *top_global.name,
top_global,
state_global->x.rvec_array(),
nullptr,
const gmx::MDLogger& mdlog,
int step,
const t_commrec* cr,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const t_inputrec* ir,
gmx::ImdSession* imdSession,
pull_t* pull_work,
FALSE,
1,
nullptr,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
//! Coordinates multi-simulations.
const gmx_multisim_t* ms;
//! Holds the simulation topology.
- const gmx_mtop_t* top_global;
+ const gmx_mtop_t& top_global;
//! Holds the domain topology.
gmx_localtop_t* top;
//! User input options.
//! Parallel utility summing energies and forces
static double reorder_partsum(const t_commrec* cr,
const t_grpopts* opts,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const em_state_t* s_min,
const em_state_t* s_b)
{
* This conflicts with the spirit of domain decomposition,
* but to fully optimize this a much more complicated algorithm is required.
*/
- const int natoms = top_global->natoms;
+ const int natoms = top_global.natoms;
rvec* fmg;
snew(fmg, natoms);
copy_rvec(fm[i], fmg[a]);
i++;
}
- gmx_sum(top_global->natoms * 3, fmg[0], cr);
+ gmx_sum(top_global.natoms * 3, fmg[0], cr);
/* Now we will determine the part of the sum for the cgs in state s_b */
gmx::ArrayRef<const int> indicesB = s_b->s.cg_gl;
i = 0;
int gf = 0;
gmx::ArrayRef<const unsigned char> grpnrFREEZE =
- top_global->groups.groupNumbers[SimulationAtomGroupType::Freeze];
+ top_global.groups.groupNumbers[SimulationAtomGroupType::Freeze];
for (int a : indicesB)
{
if (!grpnrFREEZE.empty())
static real pr_beta(const t_commrec* cr,
const t_grpopts* opts,
t_mdatoms* mdatoms,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const em_state_t* s_min,
const em_state_t* s_b)
{
{
const char* CG = "Polak-Ribiere Conjugate Gradients";
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
double tmp, minstep;
real stepsize;
simulationsShareState,
ms);
gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
- *top_global,
+ top_global,
*inputrec,
pull_work,
nullptr,
gmx_sumd(1, &minstep, cr);
}
- minstep = GMX_REAL_EPS / sqrt(minstep / (3 * top_global->natoms));
+ minstep = GMX_REAL_EPS / sqrt(minstep / (3 * top_global.natoms));
if (stepsize < minstep)
{
{
static const char* LBFGS = "Low-Memory BFGS Minimizer";
em_state_t ems;
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
int ncorr, nmaxcorr, point, cp, neval, nminstep;
double stepsize, step_taken, gpa, gpb, gpc, tmp, minstep;
simulationsShareState,
ms);
gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
- *top_global,
+ top_global,
*inputrec,
pull_work,
nullptr,
cr,
outf,
mdof_flags,
- top_global->natoms,
+ top_global.natoms,
step,
static_cast<real>(step),
&ems.s,
void LegacySimulator::do_steep()
{
const char* SD = "Steepest Descents";
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
real stepsize;
real ustep;
simulationsShareState,
ms);
gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
- *top_global,
+ top_global,
*inputrec,
pull_work,
nullptr,
{
const char* NM = "Normal Mode Analysis";
int nnodes;
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
gmx_global_stat_t gstat;
tensor vir, pres;
rvec mu_tot = { 0 };
{
fprintf(stderr,
"starting normal mode calculation '%s'\n%" PRId64 " steps.\n\n",
- *(top_global->name),
+ *(top_global.name),
inputrec->nsteps);
}
t_trxstatus* status = nullptr;
rvec mu_tot;
t_trxframe rerun_fr;
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
ForceBuffers f;
gmx_global_stat_t gstat;
gmx_shellfc_t* shellfc;
int nstglobalcomm = 1;
const bool bNS = true;
- const SimulationGroups* groups = &top_global->groups;
+ const SimulationGroups* groups = &top_global.groups;
if (ir->eI == IntegrationAlgorithm::Mimic)
{
- auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(top_global);
- nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(*top_global);
+ auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(&top_global);
+ nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(top_global);
}
int* fep_state = MASTER(cr) ? &state_global->fep_state : nullptr;
gmx::ArrayRef<real> lambda = MASTER(cr) ? state_global->lambda : gmx::ArrayRef<real>();
simulationsShareState,
ms);
gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
- *top_global,
+ top_global,
*ir,
pull_work,
mdoutf_get_fp_dhdl(outf),
runScheduleWork->simulationWork.useGpuPme);
{
- double io = compute_io(ir, top_global->natoms, *groups, energyOutput.numEnergyTerms(), 1);
+ double io = compute_io(ir, top_global.natoms, *groups, energyOutput.numEnergyTerms(), 1);
if ((io > 2000) && MASTER(cr))
{
fprintf(stderr, "\nWARNING: This run will generate roughly %.0f Mb of data\n\n", io);
TRUE,
1,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
/* Copy the pointer to the global state */
state = state_global;
- mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+ mdAlgorithmsSetupAtomData(cr, *ir, top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
}
auto mdatoms = mdAtoms->mdatoms();
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
fprintf(stderr,
"starting md rerun '%s', reading coordinates from"
" input trajectory '%s'\n\n",
- *(top_global->name),
+ *(top_global.name),
opt2fn("-rerun", nfile, fnm));
if (mdrunOptions.verbose)
{
if (MASTER(cr))
{
isLastStep = !read_first_frame(oenv, &status, opt2fn("-rerun", nfile, fnm), &rerun_fr, TRX_NEED_X);
- if (rerun_fr.natoms != top_global->natoms)
+ if (rerun_fr.natoms != top_global.natoms)
{
gmx_fatal(FARGS,
"Number of atoms in trajectory (%d) does not match the "
"run input file (%d)\n",
rerun_fr.natoms,
- top_global->natoms);
+ top_global.natoms);
}
if (ir->pbcType != PbcType::No)
bMasterState,
nstglobalcomm,
state_global,
- *top_global,
+ top_global,
*ir,
imdSession,
pull_work,
checkNumberOfBondedInteractions(mdlog,
cr,
totalNumberOfBondedInteractions,
- *top_global,
+ top_global,
&top,
makeConstArrayRef(state->x),
state->box,
t_commrec* cr,
t_inputrec* ir,
int nstlist_cmdline,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const matrix box,
bool makeGpuPairList,
const gmx::CpuInfo& cpuinfo)
VerletbufListSetup listSetup = verletbufGetSafeListSetup(listType);
const real rlist_new =
- calcVerletBufferSize(*mtop, det(box), *ir, ir->nstlist, ir->nstlist - 1, -1, listSetup);
+ calcVerletBufferSize(mtop, det(box), *ir, ir->nstlist, ir->nstlist - 1, -1, listSetup);
if (rlist_new != ir->rlist)
{
if (EI_DYNAMICS(ir->eI))
{
/* Set or try nstlist values */
- increaseNstlist(fplog, cr, ir, nstlist_cmdline, mtop, box, makeGpuPairList, cpuinfo);
+ increaseNstlist(fplog, cr, ir, nstlist_cmdline, &mtop, box, makeGpuPairList, cpuinfo);
}
}
useGpuForNonbonded,
useGpuForPme,
inputrec.get(),
- &mtop,
+ mtop,
mdlog,
membedHolder.doMembed());
t_disresdata* disresdata;
snew(disresdata, 1);
init_disres(fplog,
- &mtop,
+ mtop,
inputrec.get(),
DisResRunMode::MDRun,
MASTER(cr) ? DDRole::Master : DDRole::Agent,
t_oriresdata* oriresdata;
snew(oriresdata, 1);
- init_orires(fplog, &mtop, inputrec.get(), cr, ms, globalState.get(), oriresdata);
+ init_orires(fplog, mtop, inputrec.get(), cr, ms, globalState.get(), oriresdata);
auto deform = prepareBoxDeformation(globalState != nullptr ? globalState->box : box,
MASTER(cr) ? DDRole::Master : DDRole::Agent,
cr,
inputrec.get(),
nstlist_cmdline,
- &mtop,
+ mtop,
box,
useGpuForNonbonded || (emulateGpuNonbonded == EmulateGpuNonbonded::Yes),
*hwinfo_->cpuInfo);
pull_work = init_pull(fplog,
inputrec->pull.get(),
inputrec.get(),
- &mtop,
+ mtop,
cr,
&atomSets,
inputrec->fepvals->init_lambda);
cr,
&atomSets,
globalState.get(),
- &mtop,
+ mtop,
oenv,
mdrunOptions,
startingBehavior);
swap = init_swapcoords(fplog,
inputrec.get(),
opt2fn_master("-swap", filenames.size(), filenames.data(), cr),
- &mtop,
+ mtop,
globalState.get(),
&observablesHistory,
cr,
wcycle,
&enerd,
ms,
- &mtop,
+ mtop,
mdlog,
MASTER(cr) ? globalState->x.rvec_array() : nullptr,
filenames.size(),
simulatorBuilder.add(CenterOfMassPulling(pull_work));
// Todo move to an MDModule
simulatorBuilder.add(IonSwapping(swap));
- simulatorBuilder.add(TopologyData(&mtop, mdAtoms.get()));
+ simulatorBuilder.add(TopologyData(mtop, mdAtoms.get()));
simulatorBuilder.add(BoxDeformationHandle(deform.get()));
simulatorBuilder.add(std::move(modularSimulatorCheckpointData));
* started, but even when called, the prediction was always
* over-written by a subsequent call in the MD loop, so has been
* removed. */
-static void predict_shells(FILE* fplog,
- ArrayRef<RVec> x,
- ArrayRef<RVec> v,
- real dt,
- ArrayRef<const t_shell> shells,
- const real mass[],
- gmx_mtop_t* mtop,
- gmx_bool bInit)
+static void predict_shells(FILE* fplog,
+ ArrayRef<RVec> x,
+ ArrayRef<RVec> v,
+ real dt,
+ ArrayRef<const t_shell> shells,
+ gmx::ArrayRef<const real> mass,
+ gmx_bool bInit)
{
int m, n1, n2, n3;
real dt_1, fudge, tm, m1, m2, m3;
- GMX_RELEASE_ASSERT(mass || mtop, "Must have masses or a way to look them up");
-
/* We introduce a fudge factor for performance reasons: with this choice
* the initial force on the shells is about a factor of two lower than
* without
dt_1 = fudge * dt;
}
- int molb = 0;
for (const t_shell& shell : shells)
{
const int s1 = shell.shellIndex;
case 2:
n1 = shell.nucl1;
n2 = shell.nucl2;
- if (mass)
- {
- m1 = mass[n1];
- m2 = mass[n2];
- }
- else
- {
- /* Not the correct masses with FE, but it is just a prediction... */
- m1 = mtopGetAtomMass(mtop, n1, &molb);
- m2 = mtopGetAtomMass(mtop, n2, &molb);
- }
+ m1 = mass[n1];
+ m2 = mass[n2];
tm = dt_1 / (m1 + m2);
for (m = 0; (m < DIM); m++)
{
n1 = shell.nucl1;
n2 = shell.nucl2;
n3 = shell.nucl3;
- if (mass)
- {
- m1 = mass[n1];
- m2 = mass[n2];
- m3 = mass[n3];
- }
- else
- {
- /* Not the correct masses with FE, but it is just a prediction... */
- m1 = mtopGetAtomMass(mtop, n1, &molb);
- m2 = mtopGetAtomMass(mtop, n2, &molb);
- m3 = mtopGetAtomMass(mtop, n3, &molb);
- }
+ m1 = mass[n1];
+ m2 = mass[n2];
+ m3 = mass[n3];
tm = dt_1 / (m1 + m2 + m3);
for (m = 0; (m < DIM); m++)
{
}
gmx_shellfc_t* init_shell_flexcon(FILE* fplog,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
int nflexcon,
int nstcalcenergy,
bool usingDomainDecomposition,
#define NBT asize(bondtypes)
const gmx_ffparams_t* ffparams;
- const gmx::EnumerationArray<ParticleType, int> numParticles = gmx_mtop_particletype_count(*mtop);
+ const gmx::EnumerationArray<ParticleType, int> numParticles = gmx_mtop_particletype_count(mtop);
if (fplog)
{
/* Print the number of each particle type */
/* We have shells: fill the shell data structure */
/* Global system sized array, this should be avoided */
- std::vector<int> shell_index(mtop->natoms);
+ std::vector<int> shell_index(mtop.natoms);
nshell = 0;
- for (const AtomProxy atomP : AtomRange(*mtop))
+ for (const AtomProxy atomP : AtomRange(mtop))
{
const t_atom& local = atomP.atom();
int i = atomP.globalAtomNumber();
std::vector<t_shell> shell(nshell);
- ffparams = &mtop->ffparams;
+ ffparams = &mtop.ffparams;
/* Now fill the structures */
/* TODO: See if we can use update groups that cover shell constructions */
shfc->bInterCG = FALSE;
ns = 0;
a_offset = 0;
- for (size_t mb = 0; mb < mtop->molblock.size(); mb++)
+ for (size_t mb = 0; mb < mtop.molblock.size(); mb++)
{
- const gmx_molblock_t* molb = &mtop->molblock[mb];
- const gmx_moltype_t* molt = &mtop->moltype[molb->type];
+ const gmx_molblock_t& molb = mtop.molblock[mb];
+ const gmx_moltype_t& molt = mtop.moltype[molb.type];
- const t_atom* atom = molt->atoms.atom;
- for (mol = 0; mol < molb->nmol; mol++)
+ const t_atom* atom = molt.atoms.atom;
+ for (mol = 0; mol < molb.nmol; mol++)
{
for (j = 0; (j < NBT); j++)
{
- const int* ia = molt->ilist[bondtypes[j]].iatoms.data();
- for (i = 0; (i < molt->ilist[bondtypes[j]].size());)
+ const int* ia = molt.ilist[bondtypes[j]].iatoms.data();
+ for (i = 0; (i < molt.ilist[bondtypes[j]].size());)
{
type = ia[0];
ftype = ffparams->functype[type];
i += nra + 1;
}
}
- a_offset += molt->atoms.nr;
+ a_offset += molt.atoms.nr;
}
/* Done with this molecule type */
}
*/
if (shfc->predictShells && !bCont && (EI_STATE_VELOCITY(inputrec->eI) || bInit))
{
- predict_shells(fplog, x, v, inputrec->delta_t, shells, md->massT, nullptr, bInit);
+ predict_shells(
+ fplog, x, v, inputrec->delta_t, shells, gmx::arrayRefFromArray(md->massT, md->homenr), bInit);
}
/* Calculate the forces first time around */
* \returns a pointer to an initialized \c shellfc object.
*/
gmx_shellfc_t* init_shell_flexcon(FILE* fplog,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
int nflexcon,
int nstcalcenergy,
bool usingDomainDecomposition,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019-2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
public:
//! Build collection from simulation data.
- TopologyData(gmx_mtop_t* globalTopology, MDAtoms* mdAtoms) :
+ TopologyData(const gmx_mtop_t& globalTopology, MDAtoms* mdAtoms) :
top_global(globalTopology),
mdAtoms(mdAtoms)
{
}
//! Handle to global simulation topology.
- gmx_mtop_t* top_global;
+ const gmx_mtop_t& top_global;
//! Handle to information about MDAtoms.
MDAtoms* mdAtoms;
};
{
GMX_RELEASE_ASSERT(gmx_omp_nthreads_get(emntDefault) == 1, "TPI does not support OpenMP");
- gmx_localtop_t top(top_global->ffparams);
+ gmx_localtop_t top(top_global.ffparams);
gmx::ForceBuffers f;
real lambda, t, temp, beta, drmax, epot;
double embU, sum_embU, *sum_UgembU, V, V_all, VembU_all;
nnodes = cr->nnodes;
- gmx_mtop_generate_local_top(*top_global, &top, inputrec->efep != FreeEnergyPerturbationType::No);
+ gmx_mtop_generate_local_top(top_global, &top, inputrec->efep != FreeEnergyPerturbationType::No);
- const SimulationGroups* groups = &top_global->groups;
+ const SimulationGroups* groups = &top_global.groups;
bCavity = (inputrec->eI == IntegrationAlgorithm::TPIC);
if (bCavity)
sscanf(dump_pdb, "%20lf", &dump_ener);
}
- atoms2md(*top_global, *inputrec, -1, {}, top_global->natoms, mdAtoms);
+ atoms2md(top_global, *inputrec, -1, {}, top_global.natoms, mdAtoms);
update_mdatoms(mdatoms, inputrec->fepvals->init_lambda);
- f.resize(top_global->natoms);
+ f.resize(top_global.natoms);
/* Print to log file */
walltime_accounting_start_time(walltime_accounting);
print_start(fplog, cr, walltime_accounting, "Test Particle Insertion");
/* The last charge group is the group to be inserted */
- const t_atoms& atomsToInsert = top_global->moltype[top_global->molblock.back().type].atoms;
- a_tp0 = top_global->natoms - atomsToInsert.nr;
- a_tp1 = top_global->natoms;
+ const t_atoms& atomsToInsert = top_global.moltype[top_global.molblock.back().type].atoms;
+ a_tp0 = top_global.natoms - atomsToInsert.nr;
+ a_tp1 = top_global.natoms;
if (debug)
{
fprintf(debug, "TPI atoms %d-%d\n", a_tp0, a_tp1);
t_nrnb* nrnb,
gmx_wallcycle* wcycle,
t_forcerec* fr,
- const gmx_mtop_t* global_top,
+ const gmx_mtop_t& global_top,
Constraints* constr) :
energyReductionStep_(-1),
virialReductionStep_(-1),
energyData_(energyData),
localTopology_(nullptr),
freeEnergyPerturbationData_(freeEnergyPerturbationData),
- vcm_(global_top->groups, *inputrec),
+ vcm_(global_top.groups, *inputrec),
signals_(signals),
fplog_(fplog),
mdlog_(mdlog),
energyData_->needToSumEkinhOld(),
flags | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
checkNumberOfBondedInteractions(
- mdlog_, cr_, totalNumberOfBondedInteractions_, *top_global_, localTopology_, x, box, &shouldCheckNumberOfBondedInteractions_);
+ mdlog_, cr_, totalNumberOfBondedInteractions_, top_global_, localTopology_, x, box, &shouldCheckNumberOfBondedInteractions_);
if (flags & CGLO_STOPCM && !isInit)
{
process_and_stopcm_grp(fplog_, &vcm_, *mdAtoms_->mdatoms(), x, v);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_nrnb* nrnb,
gmx_wallcycle* wcycle,
t_forcerec* fr,
- const gmx_mtop_t* global_top,
+ const gmx_mtop_t& global_top,
Constraints* constr);
//! Destructor
//! Contains user input mdp options.
const t_inputrec* inputrec_;
//! Full system topology - only needed for checkNumberOfBondedInteractions.
- const gmx_mtop_t* top_global_;
+ const gmx_mtop_t& top_global_;
//! Atom parameters for this domain.
const MDAtoms* mdAtoms_;
//! Handles constraints.
EnergyData::EnergyData(StatePropagatorData* statePropagatorData,
FreeEnergyPerturbationData* freeEnergyPerturbationData,
- const gmx_mtop_t* globalTopology,
+ const gmx_mtop_t& globalTopology,
const t_inputrec* inputrec,
const MDAtoms* mdAtoms,
gmx_enerdata_t* enerd,
fplog_(fplog),
fcd_(fcd),
mdModulesNotifier_(mdModulesNotifier),
- groups_(&globalTopology->groups),
+ groups_(&globalTopology.groups),
observablesHistory_(observablesHistory),
simulationsShareState_(simulationsShareState)
{
{
pull_t* pull_work = nullptr;
energyOutput_ = std::make_unique<EnergyOutput>(mdoutf_get_fp_ene(outf),
- *top_global_,
+ top_global_,
*inputrec_,
pull_work,
mdoutf_get_fp_dhdl(outf),
// TODO: This probably doesn't really belong here...
// but we have all we need in this element,
// so we'll leave it here for now!
- double io = compute_io(inputrec_, top_global_->natoms, *groups_, energyOutput_->numEnergyTerms(), 1);
+ double io = compute_io(inputrec_, top_global_.natoms, *groups_, energyOutput_->numEnergyTerms(), 1);
if ((io > 2000) && isMasterRank_)
{
fprintf(stderr, "\nWARNING: This run will generate roughly %.0f Mb of data\n\n", io);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
//! Constructor
EnergyData(StatePropagatorData* statePropagatorData,
FreeEnergyPerturbationData* freeEnergyPerturbationData,
- const gmx_mtop_t* globalTopology,
+ const gmx_mtop_t& globalTopology,
const t_inputrec* inputrec,
const MDAtoms* mdAtoms,
gmx_enerdata_t* enerd,
//! Contains user input mdp options.
const t_inputrec* inputrec_;
//! Full system topology.
- const gmx_mtop_t* top_global_;
+ const gmx_mtop_t& top_global_;
//! Atom parameters for this domain.
const MDAtoms* mdAtoms_;
//! Energy data structure
ImdSession* imdSession,
pull_t* pull_work,
Constraints* constr,
- const gmx_mtop_t* globalTopology,
+ const gmx_mtop_t& globalTopology,
gmx_enfrot* enforcedRotation) :
shellfc_(init_shell_flexcon(fplog,
globalTopology,
ImdSession* imdSession,
pull_t* pull_work,
Constraints* constr,
- const gmx_mtop_t* globalTopology,
+ const gmx_mtop_t& globalTopology,
gmx_enfrot* enforcedRotation);
/*! \brief Register force calculation for step / time
isInputCompatible(true,
legacySimulatorData_->inputrec,
legacySimulatorData_->mdrunOptions.rerun,
- *legacySimulatorData_->top_global,
+ legacySimulatorData_->top_global,
legacySimulatorData_->ms,
legacySimulatorData_->replExParams,
legacySimulatorData_->fr->fcdata.get(),
}
statePropagatorData_ = std::make_unique<StatePropagatorData>(
- legacySimulatorData->top_global->natoms,
+ legacySimulatorData->top_global.natoms,
legacySimulatorData->fplog,
legacySimulatorData->cr,
legacySimulatorData->state_global,
}
}
- ModularSimulatorAlgorithm algorithm(*(legacySimulatorData_->top_global->name),
+ ModularSimulatorAlgorithm algorithm(*(legacySimulatorData_->top_global.name),
legacySimulatorData_->fplog,
legacySimulatorData_->cr,
legacySimulatorData_->mdlog,
legacySimulatorData_->walltime_accounting);
// Build topology holder
- algorithm.topologyHolder_ = topologyHolderBuilder_.build(*legacySimulatorData_->top_global,
+ algorithm.topologyHolder_ = topologyHolderBuilder_.build(legacySimulatorData_->top_global,
legacySimulatorData_->cr,
legacySimulatorData_->inputrec,
legacySimulatorData_->fr,
const std::string& finalConfigurationFilename,
const t_inputrec* inputrec,
const t_mdatoms* mdatoms,
- const gmx_mtop_t* globalTop) :
+ const gmx_mtop_t& globalTop) :
totalNumAtoms_(numAtoms),
localNAtoms_(0),
box_{ { 0 } },
// Make molecules whole only for confout writing
do_pbc_mtop(pbcType_,
localStateBackup_->box,
- top_global_,
+ &top_global_,
statePropagatorData_->globalState_->x.rvec_array());
}
write_sto_conf_mtop(finalConfigurationFilename_.c_str(),
- *top_global_->name,
+ *top_global_.name,
top_global_,
statePropagatorData_->globalState_->x.rvec_array(),
statePropagatorData_->globalState_->v.rvec_array(),
bool writeFinalConfiguration,
std::string finalConfigurationFilename,
const t_inputrec* inputrec,
- const gmx_mtop_t* globalTop) :
+ const gmx_mtop_t& globalTop) :
statePropagatorData_(statePropagatorData),
nstxout_(nstxout),
nstvout_(nstvout),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
const std::string& finalConfigurationFilename,
const t_inputrec* inputrec,
const t_mdatoms* mdatoms,
- const gmx_mtop_t* globalTop);
+ const gmx_mtop_t& globalTop);
// Allow access to state
//! Get write access to position vector
bool writeFinalConfiguration,
std::string finalConfigurationFilename,
const t_inputrec* inputrec,
- const gmx_mtop_t* globalTop);
+ const gmx_mtop_t& globalTop);
/*! \brief Register run function for step / time
*
//! Handles communication.
const t_commrec* cr_;
//! Full system topology.
- const gmx_mtop_t* top_global_;
+ const gmx_mtop_t& top_global_;
};
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx::IMDOutputProvider* outputProvider,
const MdModulesNotifier& mdModulesNotifier,
const t_inputrec* inputrec,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const gmx_output_env_t* oenv,
gmx_wallcycle* wcycle,
StartingBehavior startingBehavior,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
IMDOutputProvider* outputProvider,
const MdModulesNotifier& mdModulesNotifier,
const t_inputrec* inputrec,
- const gmx_mtop_t* top_global,
+ const gmx_mtop_t& top_global,
const gmx_output_env_t* oenv,
gmx_wallcycle* wcycle,
StartingBehavior startingBehavior,
pull_group_work_t* pg,
gmx_bool bConstraint,
const ivec pulldim_con,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_inputrec* ir,
real lambda)
{
/* In parallel, store we need to extract localWeights from weights at DD time */
std::vector<real>& weights = ((cr && PAR(cr)) ? pg->globalWeights : pg->localWeights);
- const SimulationGroups& groups = mtop->groups;
+ const SimulationGroups& groups = mtop.groups;
/* Count frozen dimensions and (weighted) mass */
int nfrozen = 0;
struct pull_t* init_pull(FILE* fplog,
const pull_params_t* pull_params,
const t_inputrec* ir,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_commrec* cr,
gmx::LocalAtomSetManager* atomSets,
real lambda)
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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 pull_t* init_pull(FILE* fplog,
const pull_params_t* pull_params,
const t_inputrec* ir,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_commrec* cr,
gmx::LocalAtomSetManager* atomSets,
real lambda);
}
-static void init_rot_group(FILE* fplog,
- const t_commrec* cr,
- gmx_enfrotgrp* erg,
- rvec* x,
- gmx_mtop_t* mtop,
- gmx_bool bVerbose,
- FILE* out_slabs,
- const matrix box,
- t_inputrec* ir,
- gmx_bool bOutputCenters)
+static void init_rot_group(FILE* fplog,
+ const t_commrec* cr,
+ gmx_enfrotgrp* erg,
+ rvec* x,
+ const gmx_mtop_t& mtop,
+ gmx_bool bVerbose,
+ FILE* out_slabs,
+ const matrix box,
+ t_inputrec* ir,
+ gmx_bool bOutputCenters)
{
rvec coord, xref, *xdum;
gmx_bool bFlex, bColl;
const t_commrec* cr,
gmx::LocalAtomSetManager* atomSets,
const t_state* globalState,
- gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const gmx_output_env_t* oenv,
const gmx::MdrunOptions& mdrunOptions,
const gmx::StartingBehavior startingBehavior)
{
/* Remove pbc, make molecule whole.
* When ir->bContinuation=TRUE this has already been done, but ok. */
- snew(x_pbc, mtop->natoms);
- copy_rvecn(globalState->x.rvec_array(), x_pbc, 0, mtop->natoms);
- do_pbc_first_mtop(nullptr, ir->pbcType, globalState->box, mtop, x_pbc);
+ snew(x_pbc, mtop.natoms);
+ copy_rvecn(globalState->x.rvec_array(), x_pbc, 0, mtop.natoms);
+ do_pbc_first_mtop(nullptr, ir->pbcType, globalState->box, &mtop, x_pbc);
/* All molecules will be whole now, but not necessarily in the home box.
* Additionally, if a rotation group consists of more than one molecule
* (e.g. two strands of DNA), each one of them can end up in a different
const t_commrec* cr,
gmx::LocalAtomSetManager* atomSets,
const t_state* globalState,
- gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const gmx_output_env_t* oenv,
const gmx::MdrunOptions& mdrunOptions,
gmx::StartingBehavior startingBehavior);
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2009-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,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.
for (int m = 0; m < nrefat; ++m)
{
const int ai = index[m];
- const real mass = mtopGetAtomMass(top, ai, &molb);
+ const real mass = mtopGetAtomMass(*top, ai, &molb);
for (int j = 0; j < DIM; ++j)
{
xout[j] += mass * x[ai][j];
for (int m = 0; m < nrefat; ++m)
{
const int ai = index[m];
- const real mass = mtopGetAtomMass(top, ai, &molb);
+ const real mass = mtopGetAtomMass(*top, ai, &molb);
for (int j = 0; j < DIM; ++j)
{
fout[j] += f[ai][j] / mass;
for (int m = 0; m < nrefat; ++m)
{
const int ai = index[m];
- const real mass = mtopGetAtomMass(top, ai, &molb);
+ const real mass = mtopGetAtomMass(*top, ai, &molb);
for (int j = 0; j < DIM; ++j)
{
xout[j] += mass * x[ai][j];
{
rvec dx, xtest;
const int ai = index[m];
- const real mass = mtopGetAtomMass(top, ai, &molb) / mtot;
+ const real mass = mtopGetAtomMass(*top, ai, &molb) / mtot;
pbc_dx(pbc, x[ai], xout, dx);
rvec_add(xout, dx, xtest);
for (int j = 0; j < DIM; ++j)
for (int i = block->index[b]; i < block->index[b + 1]; ++i)
{
const int ai = index[i];
- const real mass = mtopGetAtomMass(top, ai, &molb);
+ const real mass = mtopGetAtomMass(*top, ai, &molb);
for (int d = 0; d < DIM; ++d)
{
xb[d] += mass * x[ai][d];
for (int i = block->index[b]; i < block->index[b + 1]; ++i)
{
const int ai = index[i];
- const real mass = mtopGetAtomMass(top, ai, &molb);
+ const real mass = mtopGetAtomMass(*top, ai, &molb);
for (int d = 0; d < DIM; ++d)
{
fb[d] += f[ai][d] / mass;
*
* Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
* Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
block = new_blocka();
// TODO: Propagate mtop further.
- t_atoms atoms = gmx_mtop_global_atoms(top);
+ t_atoms atoms = gmx_mtop_global_atoms(*top);
analyse(&atoms, block, &names, FALSE, FALSE);
done_atom(&atoms);
}
case INDEX_RES:
{
int resind, molb = 0;
- mtopGetAtomAndResidueName(top, atomIndex, &molb, nullptr, nullptr, nullptr, &resind);
+ mtopGetAtomAndResidueName(*top, atomIndex, &molb, nullptr, nullptr, nullptr, &resind);
*id = resind;
break;
}
case INDEX_MOL:
{
int molb = 0;
- *id = mtopGetMoleculeIndex(top, atomIndex, &molb);
+ *id = mtopGetMoleculeIndex(*top, atomIndex, &molb);
break;
}
case INDEX_UNKNOWN:
case INDEX_RES:
{
int molnr, atnr_mol;
- mtopGetMolblockIndex(top, ai, &molb, &molnr, &atnr_mol);
+ mtopGetMolblockIndex(*top, ai, &molb, &molnr, &atnr_mol);
const t_atoms& mol_atoms = top->moltype[top->molblock[molb].type].atoms;
int last_atom = atnr_mol + 1;
const int currentResid = mol_atoms.atom[atnr_mol].resind;
case INDEX_MOL:
{
int molnr, atnr_mol;
- mtopGetMolblockIndex(top, ai, &molb, &molnr, &atnr_mol);
+ mtopGetMolblockIndex(*top, ai, &molb, &molnr, &atnr_mol);
const MoleculeBlockIndices& blockIndices = top->moleculeBlockIndices[molb];
const int atomStart = blockIndices.globalAtomStart
+ (id - blockIndices.moleculeIndexStart)
* \param[in,out] molb The molecule block of atom a
* \returns true if atoms \p a and \p a + 1 are in different residues, false otherwise.
*/
-static bool is_at_residue_boundary(const gmx_mtop_t* top, int a, int* molb)
+static bool is_at_residue_boundary(const gmx_mtop_t& top, int a, int* molb)
{
- if (a == -1 || a + 1 == top->natoms)
+ if (a == -1 || a + 1 == top.natoms)
{
return true;
}
// Check if a is consecutive or on a residue boundary
if (a != aPrev + 1)
{
- if (!is_at_residue_boundary(top, aPrev, &molb))
+ if (!is_at_residue_boundary(*top, aPrev, &molb))
{
return false;
}
- if (!is_at_residue_boundary(top, a - 1, &molb))
+ if (!is_at_residue_boundary(*top, a - 1, &molb))
{
return false;
}
}
GMX_ASSERT(g->isize > 0, "We return above when isize=0");
const int a = g->index[g->isize - 1];
- if (!is_at_residue_boundary(top, a, &molb))
+ if (!is_at_residue_boundary(*top, a, &molb))
{
return false;
}
*
* Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
* Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
for (int i = pos.m.mapb.index[b]; i < pos.m.mapb.index[b + 1]; ++i)
{
const int index = pos.m.mapb.a[i];
- const t_atom& atom = mtopGetAtomParameters(top, index, &molb);
+ const t_atom& atom = mtopGetAtomParameters(*top, index, &molb);
mass += atom.m;
charge += atom.q;
}
*
* Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
* Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- mtopGetAtomAndResidueName(context.top, g->index[i], &molb, nullptr, &out->u.i[i], nullptr, nullptr);
+ mtopGetAtomAndResidueName(*context.top, g->index[i], &molb, nullptr, &out->u.i[i], nullptr, nullptr);
}
}
for (int i = 0; i < g->isize; ++i)
{
int resind;
- mtopGetAtomAndResidueName(context.top, g->index[i], &molb, nullptr, nullptr, nullptr, &resind);
+ mtopGetAtomAndResidueName(*context.top, g->index[i], &molb, nullptr, nullptr, nullptr, &resind);
out->u.i[i] = resind + 1;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.i[i] = mtopGetMoleculeIndex(context.top, g->index[i], &molb) + 1;
+ out->u.i[i] = mtopGetMoleculeIndex(*context.top, g->index[i], &molb) + 1;
}
}
for (int i = 0; i < g->isize; ++i)
{
const char* atom_name;
- mtopGetAtomAndResidueName(context.top, g->index[i], &molb, &atom_name, nullptr, nullptr, nullptr);
+ mtopGetAtomAndResidueName(*context.top, g->index[i], &molb, &atom_name, nullptr, nullptr, nullptr);
out->u.s[i] = const_cast<char*>(atom_name);
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- const char* s = mtopGetAtomPdbInfo(context.top, g->index[i], &molb).atomnm;
+ const char* s = mtopGetAtomPdbInfo(*context.top, g->index[i], &molb).atomnm;
while (std::isspace(*s))
{
++s;
for (int i = 0; i < g->isize; ++i)
{
int atomIndexInMolecule;
- mtopGetMolblockIndex(context.top, g->index[i], &molb, nullptr, &atomIndexInMolecule);
+ mtopGetMolblockIndex(*context.top, g->index[i], &molb, nullptr, &atomIndexInMolecule);
const gmx_moltype_t& moltype = context.top->moltype[context.top->molblock[molb].type];
out->u.s[i] = *moltype.atoms.atomtype[atomIndexInMolecule];
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.s[i] = *mtopGetResidueInfo(context.top, g->index[i], &molb).name;
+ out->u.s[i] = *mtopGetResidueInfo(*context.top, g->index[i], &molb).name;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.s[i][0] = mtopGetResidueInfo(context.top, g->index[i], &molb).ic;
+ out->u.s[i][0] = mtopGetResidueInfo(*context.top, g->index[i], &molb).ic;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.s[i][0] = mtopGetResidueInfo(context.top, g->index[i], &molb).chainid;
+ out->u.s[i][0] = mtopGetResidueInfo(*context.top, g->index[i], &molb).chainid;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.r[i] = mtopGetAtomMass(context.top, g->index[i], &molb);
+ out->u.r[i] = mtopGetAtomMass(*context.top, g->index[i], &molb);
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.r[i] = mtopGetAtomParameters(context.top, g->index[i], &molb).q;
+ out->u.r[i] = mtopGetAtomParameters(*context.top, g->index[i], &molb).q;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.s[i][0] = mtopGetAtomPdbInfo(context.top, g->index[i], &molb).altloc;
+ out->u.s[i][0] = mtopGetAtomPdbInfo(*context.top, g->index[i], &molb).altloc;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.r[i] = mtopGetAtomPdbInfo(context.top, g->index[i], &molb).occup;
+ out->u.r[i] = mtopGetAtomPdbInfo(*context.top, g->index[i], &molb).occup;
}
}
int molb = 0;
for (int i = 0; i < g->isize; ++i)
{
- out->u.r[i] = mtopGetAtomPdbInfo(context.top, g->index[i], &molb).bfac;
+ out->u.r[i] = mtopGetAtomPdbInfo(*context.top, g->index[i], &molb).bfac;
}
}
*
* Also ensure that all the molecules in this group have this number of atoms.
*/
-static int get_group_apm_check(int igroup, t_swap* s, gmx_bool bVerbose, gmx_mtop_t* mtop)
+static int get_group_apm_check(int igroup, t_swap* s, gmx_bool bVerbose, const gmx_mtop_t& mtop)
{
t_swapgrp* g = &s->group[igroup];
const int* ind = s->group[igroup].atomset.globalIndex().data();
* first solvent atom: */
int molb = 0;
mtopGetMolblockIndex(mtop, ind[0], &molb, nullptr, nullptr);
- int apm = mtop->moleculeBlockIndices[molb].numAtomsPerMolecule;
+ int apm = mtop.moleculeBlockIndices[molb].numAtomsPerMolecule;
if (bVerbose)
{
for (int i = 1; i < nat; i++)
{
mtopGetMolblockIndex(mtop, ind[i], &molb, nullptr, nullptr);
- if (apm != mtop->moleculeBlockIndices[molb].numAtomsPerMolecule)
+ if (apm != mtop.moleculeBlockIndices[molb].numAtomsPerMolecule)
{
gmx_fatal(FARGS, "Not all molecules of swap group %d consist of %d atoms.", igroup, apm);
}
* If this is not correct, the ion counts per channel will be very likely
* wrong.
*/
-static void outputStartStructureIfWanted(gmx_mtop_t* mtop, rvec* x, PbcType pbcType, const matrix box)
+static void outputStartStructureIfWanted(const gmx_mtop_t& mtop, rvec* x, PbcType pbcType, const matrix box)
{
char* env = getenv("GMX_COMPELDUMP");
SwSEmpty);
write_sto_conf_mtop(
- "CompELAssumedWholeConfiguration.pdb", *mtop->name, mtop, x, nullptr, pbcType, box);
+ "CompELAssumedWholeConfiguration.pdb", *mtop.name, mtop, x, nullptr, pbcType, box);
}
}
static void init_swapstate(swaphistory_t* swapstate,
t_swapcoords* sc,
t_swap* s,
- gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const rvec* x, /* the initial positions */
const matrix box,
const t_inputrec* ir)
/* Extract the initial split group positions. */
/* Remove pbc, make molecule whole. */
- snew(x_pbc, mtop->natoms);
- copy_rvecn(x, x_pbc, 0, mtop->natoms);
+ snew(x_pbc, mtop.natoms);
+ copy_rvecn(x, x_pbc, 0, mtop.natoms);
/* This can only make individual molecules whole, not multimers */
- do_pbc_mtop(ir->pbcType, box, mtop, x_pbc);
+ do_pbc_mtop(ir->pbcType, box, &mtop, x_pbc);
/* Output the starting structure? */
outputStartStructureIfWanted(mtop, x_pbc, ir->pbcType, box);
* #4 cations - empty before conversion
*
*/
-static void convertOldToNewGroupFormat(t_swapcoords* sc, gmx_mtop_t* mtop, gmx_bool bVerbose, t_commrec* cr)
+static void convertOldToNewGroupFormat(t_swapcoords* sc, const gmx_mtop_t& mtop, gmx_bool bVerbose, t_commrec* cr)
{
t_swapGroup* g = &sc->grp[3];
t_swap* init_swapcoords(FILE* fplog,
const t_inputrec* ir,
const char* fn,
- gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_state* globalState,
ObservablesHistory* oh,
t_commrec* cr,
}
/* Check for overlapping atoms */
- check_swap_groups(s, mtop->natoms, bVerbose && MASTER(cr));
+ check_swap_groups(s, mtop.natoms, bVerbose && MASTER(cr));
/* Allocate space for the collective arrays for all groups */
/* For the collective position array */
t_swap* init_swapcoords(FILE* fplog,
const t_inputrec* ir,
const char* fn,
- gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_state* globalState,
ObservablesHistory* oh,
t_commrec* cr,
bool nonbondedOnGpu,
bool pmeOnGpu,
const t_inputrec* inputrec,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const gmx::MDLogger& mdlog,
bool doMembed)
{
}
}
- if (mtop->natoms / nrank < min_atoms_per_mpi_rank)
+ if (mtop.natoms / nrank < min_atoms_per_mpi_rank)
{
int nrank_new;
/* the rank number was chosen automatically, but there are too few
atoms per rank, so we need to reduce the rank count */
- nrank_new = std::max(1, mtop->natoms / min_atoms_per_mpi_rank);
+ nrank_new = std::max(1, mtop.natoms / min_atoms_per_mpi_rank);
/* Avoid partial use of Hyper-Threading */
if (gmxSmtIsEnabled(hwTop) && nrank_new > nthreads_hw / 2 && nrank_new < nthreads_hw)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,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.
bool nonbondedOnGpu,
bool pmeOnGpu,
const t_inputrec* inputrec,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const gmx::MDLogger& mdlog,
bool doMembed);
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by 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.
{
gmx_localtop_t top(mtop->ffparams);
gmx_mtop_generate_local_top(*mtop, &top, false);
- t_atoms atoms = gmx_mtop_global_atoms(mtop);
+ t_atoms atoms = gmx_mtop_global_atoms(*mtop);
const std::vector<bool> bKeep = bKeepIt(gnx, atoms.nr, index);
const std::vector<int> invindex = invind(gnx, atoms.nr, index);
if (haveReadIndexFile_ || !(maxStepsIsSet_ || extendTimeIsSet_ || runToMaxTimeIsSet_))
{
- atoms = gmx_mtop_global_atoms(&mtop);
+ atoms = gmx_mtop_global_atoms(mtop);
int gnx = 0;
int* index = nullptr;
char* grpname = nullptr;
" time %10.3f and length %10.3f ps\n",
stateTime,
ir->nsteps * ir->delta_t);
- write_tpx_state(outputTprFileName_.c_str(), ir, &state, &mtop);
+ write_tpx_state(outputTprFileName_.c_str(), ir, &state, mtop);
}
else
{
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
- * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2017,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.
bool haveFullTopology = false;
fprintf(stderr, "\nReading structure file\n");
readConfAndTopology(stxfile, &haveFullTopology, &mtop, &pbcType, &x, &v, box);
- atoms = gmx_mtop_global_atoms(&mtop);
+ atoms = gmx_mtop_global_atoms(mtop);
if (atoms.pdbinfo == nullptr)
{
snew(atoms.pdbinfo, atoms.nr);
if (opt2bSet("-so", NFILE, fnm) || bTUNE)
{
ir.ewald_rtol = info.ewald_rtol[0];
- write_tpx_state(opt2fn("-so", NFILE, fnm), &ir, &state, &mtop);
+ write_tpx_state(opt2fn("-so", NFILE, fnm), &ir, &state, mtop);
}
please_cite(fp, "Wang2010");
fclose(fp);
const t_atom* atom;
writeHeader(writer, "Simulation system", "subsection", writeFormattedText);
- aloop = gmx_mtop_atomloop_block_init(&top);
+ aloop = gmx_mtop_atomloop_block_init(top);
while (gmx_mtop_atomloop_block_next(aloop, &atom, &nmol))
{
if (atom->ptype == ParticleType::VSite)
sprintf(buf, "Writing optimized simulation file %s with nsteps=%s.\n", fn_sim_tpr, "%" PRId64);
fprintf(stdout, buf, ir->nsteps);
fflush(stdout);
- write_tpx_state(fn_sim_tpr, ir, &state, &mtop);
+ write_tpx_state(fn_sim_tpr, ir, &state, mtop);
}
static gmx_bool can_scale_rvdw(VanDerWaalsType vdwtype)
fprintf(stdout, ", unmodified settings\n");
}
- write_tpx_state(fn_bench_tprs[j], ir, &state, &mtop);
+ write_tpx_state(fn_bench_tprs[j], ir, &state, mtop);
/* Write information about modified tpr settings to log file */
fprintf(fp, "%4d%10f%10f", j, fac, ir->rcoulomb);
* \param[out] moleculeIndex The index of the molecule in the block, can be NULL
* \param[out] atomIndexInMolecule The atom index in the molecule, can be NULL
*/
-static inline void mtopGetMolblockIndex(const gmx_mtop_t* mtop,
+static inline void mtopGetMolblockIndex(const gmx_mtop_t& mtop,
int globalAtomIndex,
int* moleculeBlock,
int* moleculeIndex,
int* atomIndexInMolecule)
{
GMX_ASSERT(globalAtomIndex >= 0, "The atom index to look up should not be negative");
- GMX_ASSERT(globalAtomIndex < mtop->natoms, "The atom index to look up should be within range");
+ GMX_ASSERT(globalAtomIndex < mtop.natoms, "The atom index to look up should be within range");
GMX_ASSERT(moleculeBlock != nullptr, "molBlock can not be NULL");
- GMX_ASSERT(!mtop->moleculeBlockIndices.empty(), "The moleculeBlockIndices should not be empty");
+ GMX_ASSERT(!mtop.moleculeBlockIndices.empty(), "The moleculeBlockIndices should not be empty");
GMX_ASSERT(*moleculeBlock >= 0,
"The starting molecule block index for the search should not be negative");
- GMX_ASSERT(*moleculeBlock < gmx::ssize(mtop->moleculeBlockIndices),
+ GMX_ASSERT(*moleculeBlock < gmx::ssize(mtop.moleculeBlockIndices),
"The starting molecule block index for the search should be within range");
/* Search the molecule block index using bisection */
int molBlock0 = -1;
- int molBlock1 = mtop->molblock.size();
+ int molBlock1 = mtop.molblock.size();
int globalAtomStart = 0;
while (TRUE)
{
- globalAtomStart = mtop->moleculeBlockIndices[*moleculeBlock].globalAtomStart;
+ globalAtomStart = mtop.moleculeBlockIndices[*moleculeBlock].globalAtomStart;
if (globalAtomIndex < globalAtomStart)
{
molBlock1 = *moleculeBlock;
}
- else if (globalAtomIndex >= mtop->moleculeBlockIndices[*moleculeBlock].globalAtomEnd)
+ else if (globalAtomIndex >= mtop.moleculeBlockIndices[*moleculeBlock].globalAtomEnd)
{
molBlock0 = *moleculeBlock;
}
}
int molIndex = (globalAtomIndex - globalAtomStart)
- / mtop->moleculeBlockIndices[*moleculeBlock].numAtomsPerMolecule;
+ / mtop.moleculeBlockIndices[*moleculeBlock].numAtomsPerMolecule;
if (moleculeIndex != nullptr)
{
*moleculeIndex = molIndex;
if (atomIndexInMolecule != nullptr)
{
*atomIndexInMolecule = globalAtomIndex - globalAtomStart
- - molIndex * mtop->moleculeBlockIndices[*moleculeBlock].numAtomsPerMolecule;
+ - molIndex * mtop.moleculeBlockIndices[*moleculeBlock].numAtomsPerMolecule;
}
}
* \param[in] globalAtomIndex The global atom index to look up
* \param[in,out] moleculeBlock The molecule block index in \p mtop
*/
-static inline int mtopGetMoleculeIndex(const gmx_mtop_t* mtop, int globalAtomIndex, int* moleculeBlock)
+static inline int mtopGetMoleculeIndex(const gmx_mtop_t& mtop, int globalAtomIndex, int* moleculeBlock)
{
int localMoleculeIndex = 0;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, &localMoleculeIndex, nullptr);
- return mtop->moleculeBlockIndices[*moleculeBlock].moleculeIndexStart + localMoleculeIndex;
+ return mtop.moleculeBlockIndices[*moleculeBlock].moleculeIndexStart + localMoleculeIndex;
}
/*! \brief Returns the atom data for an atom based on global atom index
* \param[in] globalAtomIndex The global atom index to look up
* \param[in,out] moleculeBlock The molecule block index in \p mtop
*/
-static inline const t_atom& mtopGetAtomParameters(const gmx_mtop_t* mtop, int globalAtomIndex, int* moleculeBlock)
+static inline const t_atom& mtopGetAtomParameters(const gmx_mtop_t& mtop, int globalAtomIndex, int* moleculeBlock)
{
int atomIndexInMolecule = 0;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, nullptr, &atomIndexInMolecule);
- const gmx_moltype_t& moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type];
+ const gmx_moltype_t& moltype = mtop.moltype[mtop.molblock[*moleculeBlock].type];
return moltype.atoms.atom[atomIndexInMolecule];
}
* \param[in] globalAtomIndex The global atom index to look up
* \param[in,out] moleculeBlock The molecule block index in \p mtop
*/
-static inline real mtopGetAtomMass(const gmx_mtop_t* mtop, int globalAtomIndex, int* moleculeBlock)
+static inline real mtopGetAtomMass(const gmx_mtop_t& mtop, int globalAtomIndex, int* moleculeBlock)
{
const t_atom& atom = mtopGetAtomParameters(mtop, globalAtomIndex, moleculeBlock);
return atom.m;
* \param[out] residueName The residue name, input can be NULL
* \param[out] globalResidueIndex The gobal residue index, input can be NULL
*/
-static inline void mtopGetAtomAndResidueName(const gmx_mtop_t* mtop,
+static inline void mtopGetAtomAndResidueName(const gmx_mtop_t& mtop,
int globalAtomIndex,
int* moleculeBlock,
const char** atomName,
int atomIndexInMolecule = 0;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, &moleculeIndex, &atomIndexInMolecule);
- const gmx_molblock_t& molb = mtop->molblock[*moleculeBlock];
- const t_atoms& atoms = mtop->moltype[molb.type].atoms;
- const MoleculeBlockIndices& indices = mtop->moleculeBlockIndices[*moleculeBlock];
+ const gmx_molblock_t& molb = mtop.molblock[*moleculeBlock];
+ const t_atoms& atoms = mtop.moltype[molb.type].atoms;
+ const MoleculeBlockIndices& indices = mtop.moleculeBlockIndices[*moleculeBlock];
if (atomName != nullptr)
{
*atomName = *(atoms.atomname[atomIndexInMolecule]);
}
if (residueNumber != nullptr)
{
- if (atoms.nres > mtop->maxResiduesPerMoleculeToTriggerRenumber())
+ if (atoms.nres > mtop.maxResiduesPerMoleculeToTriggerRenumber())
{
*residueNumber = atoms.resinfo[atoms.atom[atomIndexInMolecule].resind].nr;
}
}
}
-//! \copydoc mtopGetAtomAndResidueName()
-static inline void mtopGetAtomAndResidueName(const gmx_mtop_t& mtop,
- int globalAtomIndex,
- int* moleculeBlock,
- const char** atomName,
- int* residueNumber,
- const char** residueName,
- int* globalResidueIndex)
-{
- mtopGetAtomAndResidueName(
- &mtop, globalAtomIndex, moleculeBlock, atomName, residueNumber, residueName, globalResidueIndex);
-}
-
/*! \brief Returns residue information for an atom based on global atom index
*
* The atom index has to be in range: 0 <= \p globalAtomIndex < \p mtop->natoms.
* \param[in] globalAtomIndex The global atom index to look up
* \param[in,out] moleculeBlock The molecule block index in \p mtop
*/
-static inline const t_resinfo& mtopGetResidueInfo(const gmx_mtop_t* mtop, int globalAtomIndex, int* moleculeBlock)
+static inline const t_resinfo& mtopGetResidueInfo(const gmx_mtop_t& mtop, int globalAtomIndex, int* moleculeBlock)
{
int atomIndexInMolecule = 0;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, nullptr, &atomIndexInMolecule);
- const gmx_moltype_t& moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type];
+ const gmx_moltype_t& moltype = mtop.moltype[mtop.molblock[*moleculeBlock].type];
const int resind = moltype.atoms.atom[atomIndexInMolecule].resind;
return moltype.atoms.resinfo[resind];
}
* \param[in] globalAtomIndex The global atom index to look up
* \param[in,out] moleculeBlock The molecule block index in \p mtop
*/
-static inline const t_pdbinfo& mtopGetAtomPdbInfo(const gmx_mtop_t* mtop, int globalAtomIndex, int* moleculeBlock)
+static inline const t_pdbinfo& mtopGetAtomPdbInfo(const gmx_mtop_t& mtop, int globalAtomIndex, int* moleculeBlock)
{
int atomIndexInMolecule = 0;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, nullptr, &atomIndexInMolecule);
- const gmx_moltype_t& moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type];
+ const gmx_moltype_t& moltype = mtop.moltype[mtop.molblock[*moleculeBlock].type];
GMX_ASSERT(moltype.atoms.havePdbInfo, "PDB information not present when requested");
return moltype.atoms.pdbinfo[atomIndexInMolecule];
}
#include "gromacs/utility/real.h"
#include "gromacs/utility/smalloc.h"
-void gmx_mtop_count_atomtypes(const gmx_mtop_t* mtop, int state, int typecount[])
+void gmx_mtop_count_atomtypes(const gmx_mtop_t& mtop, int state, int typecount[])
{
- for (int i = 0; i < mtop->ffparams.atnr; ++i)
+ for (int i = 0; i < mtop.ffparams.atnr; ++i)
{
typecount[i] = 0;
}
- for (const gmx_molblock_t& molb : mtop->molblock)
+ for (const gmx_molblock_t& molb : mtop.molblock)
{
- const t_atoms& atoms = mtop->moltype[molb.type].atoms;
+ const t_atoms& atoms = mtop.moltype[molb.type].atoms;
for (int i = 0; i < atoms.nr; ++i)
{
const int tpi = (state == 0) ? atoms.atom[i].type : atoms.atom[i].typeB;
return numMolecules;
}
-int gmx_mtop_nres(const gmx_mtop_t* mtop)
+int gmx_mtop_nres(const gmx_mtop_t& mtop)
{
int nres = 0;
- for (const gmx_molblock_t& molb : mtop->molblock)
+ for (const gmx_molblock_t& molb : mtop.molblock)
{
- nres += molb.nmol * mtop->moltype[molb.type].atoms.nres;
+ nres += molb.nmol * mtop.moltype[molb.type].atoms.nres;
}
return nres;
}
return it_->localAtomNumber_;
}
-typedef struct gmx_mtop_atomloop_block
+struct gmx_mtop_atomloop_block
{
const gmx_mtop_t* mtop;
size_t mblock;
const t_atoms* atoms;
int at_local;
-} t_gmx_mtop_atomloop_block;
+};
-gmx_mtop_atomloop_block_t gmx_mtop_atomloop_block_init(const gmx_mtop_t* mtop)
+gmx_mtop_atomloop_block_t gmx_mtop_atomloop_block_init(const gmx_mtop_t& mtop)
{
struct gmx_mtop_atomloop_block* aloop = nullptr;
snew(aloop, 1);
- aloop->mtop = mtop;
+ aloop->mtop = &mtop;
aloop->mblock = 0;
- aloop->atoms = &mtop->moltype[mtop->molblock[aloop->mblock].type].atoms;
+ aloop->atoms = &mtop.moltype[mtop.molblock[aloop->mblock].type].atoms;
aloop->at_local = -1;
return aloop;
int mblock;
} t_gmx_mtop_ilist;
-gmx_mtop_ilistloop_t gmx_mtop_ilistloop_init(const gmx_mtop_t* mtop)
+gmx_mtop_ilistloop_t gmx_mtop_ilistloop_init(const gmx_mtop_t& mtop)
{
struct gmx_mtop_ilistloop* iloop = nullptr;
snew(iloop, 1);
- iloop->mtop = mtop;
+ iloop->mtop = &mtop;
iloop->mblock = -1;
return iloop;
}
-gmx_mtop_ilistloop_t gmx_mtop_ilistloop_init(const gmx_mtop_t& mtop)
-{
- return gmx_mtop_ilistloop_init(&mtop);
-}
-
static void gmx_mtop_ilistloop_destroy(gmx_mtop_ilistloop_t iloop)
{
sfree(iloop);
int a_offset;
} t_gmx_mtop_ilist_all;
-int gmx_mtop_ftype_count(const gmx_mtop_t* mtop, int ftype)
+int gmx_mtop_ftype_count(const gmx_mtop_t& mtop, int ftype)
{
int nmol = 0;
int n = 0;
n += nmol * (*il)[ftype].size() / (1 + NRAL(ftype));
}
- if (mtop->bIntermolecularInteractions)
+ if (mtop.bIntermolecularInteractions)
{
- n += (*mtop->intermolecular_ilist)[ftype].size() / (1 + NRAL(ftype));
+ n += (*mtop.intermolecular_ilist)[ftype].size() / (1 + NRAL(ftype));
}
return n;
}
-int gmx_mtop_ftype_count(const gmx_mtop_t& mtop, int ftype)
-{
- return gmx_mtop_ftype_count(&mtop, ftype);
-}
-
int gmx_mtop_interaction_count(const gmx_mtop_t& mtop, const int unsigned if_flags)
{
int n = 0;
dest->nr += copies * src->nr;
}
-t_atoms gmx_mtop_global_atoms(const gmx_mtop_t* mtop)
+t_atoms gmx_mtop_global_atoms(const gmx_mtop_t& mtop)
{
t_atoms atoms;
init_t_atoms(&atoms, 0, FALSE);
- int maxresnr = mtop->maxResNumberNotRenumbered();
- for (const gmx_molblock_t& molb : mtop->molblock)
+ int maxresnr = mtop.maxResNumberNotRenumbered();
+ for (const gmx_molblock_t& molb : mtop.molblock)
{
atomcat(&atoms,
- &mtop->moltype[molb.type].atoms,
+ &mtop.moltype[molb.type].atoms,
molb.nmol,
- mtop->maxResiduesPerMoleculeToTriggerRenumber(),
+ mtop.maxResiduesPerMoleculeToTriggerRenumber(),
&maxresnr);
}
copyIListsFromMtop(mtop, &top->idef, bMergeConstr);
top->name = mtop.name;
- top->atoms = gmx_mtop_global_atoms(&mtop);
+ top->atoms = gmx_mtop_global_atoms(mtop);
top->mols = gmx_mtop_molecules_t_block(mtop);
top->bIntermolecularInteractions = mtop.bIntermolecularInteractions;
top->symtab = mtop.symtab;
return top;
}
-std::vector<int> get_atom_index(const gmx_mtop_t* mtop)
+std::vector<int> get_atom_index(const gmx_mtop_t& mtop)
{
std::vector<int> atom_index;
- for (const AtomProxy atomP : AtomRange(*mtop))
+ for (const AtomProxy atomP : AtomRange(mtop))
{
const t_atom& local = atomP.atom();
int index = atomP.globalAtomNumber();
* state A and 1 for state B types. typecount should have at
* least mtop->ffparams.atnr elements.
*/
-void gmx_mtop_count_atomtypes(const gmx_mtop_t* mtop, int state, int typecount[]);
+void gmx_mtop_count_atomtypes(const gmx_mtop_t& mtop, int state, int typecount[]);
/*!\brief Returns the total number of molecules in mtop
*
int gmx_mtop_num_molecules(const gmx_mtop_t& mtop);
/* Returns the total number of residues in mtop. */
-int gmx_mtop_nres(const gmx_mtop_t* mtop);
+int gmx_mtop_nres(const gmx_mtop_t& mtop);
class AtomIterator;
/* Initialize an atom loop over atoms in all molecule blocks the system.
*/
-gmx_mtop_atomloop_block_t gmx_mtop_atomloop_block_init(const gmx_mtop_t* mtop);
+gmx_mtop_atomloop_block_t gmx_mtop_atomloop_block_init(const gmx_mtop_t& mtop);
/* Loop to the next atom.
* When not at the end:
/* Abstract type for ilist loop over all ilists */
typedef struct gmx_mtop_ilistloop* gmx_mtop_ilistloop_t;
-/* Initialize an ilist loop over all molecule types in the system. */
-gmx_mtop_ilistloop_t gmx_mtop_ilistloop_init(const gmx_mtop_t* mtop);
-
/* Initialize an ilist loop over all molecule types in the system. */
gmx_mtop_ilistloop_t gmx_mtop_ilistloop_init(const gmx_mtop_t& mtop);
*/
const InteractionLists* gmx_mtop_ilistloop_next(gmx_mtop_ilistloop_t iloop, int* nmol);
-/* Returns the total number of interactions in the system of type ftype */
-int gmx_mtop_ftype_count(const gmx_mtop_t* mtop, int ftype);
-
/* Returns the total number of interactions in the system of type ftype */
int gmx_mtop_ftype_count(const gmx_mtop_t& mtop, int ftype);
gmx::EnumerationArray<ParticleType, int> gmx_mtop_particletype_count(const gmx_mtop_t& mtop);
/* Returns a single t_atoms struct for the whole system */
-t_atoms gmx_mtop_global_atoms(const gmx_mtop_t* mtop);
+t_atoms gmx_mtop_global_atoms(const gmx_mtop_t& mtop);
/*! \brief
* \param[in] mtop Molecular topology
* \returns Vector that will be filled with the atom indices
*/
-std::vector<int> get_atom_index(const gmx_mtop_t* mtop);
+std::vector<int> get_atom_index(const gmx_mtop_t& mtop);
/*! \brief Converts a t_atoms struct to an mtop struct
*
AtomsDataPtr atoms(new t_atoms);
if (top_.hasTopology())
{
- *atoms = gmx_mtop_global_atoms(top_.mtop());
+ *atoms = gmx_mtop_global_atoms(*top_.mtop());
}
else
{