acSETTLE
};
-static std::vector<cginfo_mb_t> init_cginfo_mb(const gmx_mtop_t* mtop, const t_forcerec* fr)
+static std::vector<cginfo_mb_t> init_cginfo_mb(const gmx_mtop_t& mtop, const t_forcerec* fr)
{
gmx_bool* type_VDW;
int* a_con;
std::vector<cginfo_mb_t> cginfoPerMolblock;
int 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 auto& excl = molt.excls;
/* Check if the cginfo is identical for all molecules in this block.
const int am = m * molt.atoms.nr;
for (int a = 0; a < molt.atoms.nr; a++)
{
- if (getGroupType(mtop->groups, SimulationAtomGroupType::QuantumMechanics, a_offset + am + a)
- != getGroupType(mtop->groups, SimulationAtomGroupType::QuantumMechanics, a_offset + a))
+ if (getGroupType(mtop.groups, SimulationAtomGroupType::QuantumMechanics, a_offset + am + a)
+ != getGroupType(mtop.groups, SimulationAtomGroupType::QuantumMechanics, a_offset + a))
{
bId = FALSE;
}
- if (!mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics].empty())
+ if (!mtop.groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics].empty())
{
- if (mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics][a_offset + am + a]
- != mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics][a_offset + a])
+ if (mtop.groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics][a_offset + am + a]
+ != mtop.groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics][a_offset + a])
{
bId = FALSE;
}
int& atomInfo = cginfo[molculeOffsetInBlock + a];
/* Store the energy group in cginfo */
- int gid = getGroupType(mtop->groups,
+ int gid = getGroupType(mtop.groups,
SimulationAtomGroupType::EnergyOutput,
a_offset + molculeOffsetInBlock + a);
SET_CGINFO_GID(atomInfo, gid);
/* Sets the sum of charges (squared) and C6 in the system in fr.
* Returns whether the system has a net charge.
*/
-static bool set_chargesum(FILE* log, t_forcerec* fr, const gmx_mtop_t* mtop)
+static bool set_chargesum(FILE* log, t_forcerec* fr, const gmx_mtop_t& mtop)
{
/*This now calculates sum for q and c6*/
double qsum, q2sum, q, c6sum, c6;
qsum = 0;
q2sum = 0;
c6sum = 0;
- for (const gmx_molblock_t& molb : mtop->molblock)
+ for (const gmx_molblock_t& molb : mtop.molblock)
{
int nmol = molb.nmol;
- 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++)
{
q = atoms->atom[i].q;
qsum += nmol * q;
q2sum += nmol * q * q;
- c6 = mtop->ffparams.iparams[atoms->atom[i].type * (mtop->ffparams.atnr + 1)].lj.c6;
+ c6 = mtop.ffparams.iparams[atoms->atom[i].type * (mtop.ffparams.atnr + 1)].lj.c6;
c6sum += nmol * c6;
}
}
qsum = 0;
q2sum = 0;
c6sum = 0;
- for (const gmx_molblock_t& molb : mtop->molblock)
+ for (const gmx_molblock_t& molb : mtop.molblock)
{
int nmol = molb.nmol;
- 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++)
{
q = atoms->atom[i].qB;
qsum += nmol * q;
q2sum += nmol * q * q;
- c6 = mtop->ffparams.iparams[atoms->atom[i].typeB * (mtop->ffparams.atnr + 1)].lj.c6;
+ c6 = mtop.ffparams.iparams[atoms->atom[i].typeB * (mtop.ffparams.atnr + 1)].lj.c6;
c6sum += nmol * c6;
}
fr->qsum[1] = qsum;
return (std::abs(fr->qsum[0]) > 1e-4 || std::abs(fr->qsum[1]) > 1e-4);
}
-static real calcBuckinghamBMax(FILE* fplog, const gmx_mtop_t* mtop)
+static real calcBuckinghamBMax(FILE* fplog, const gmx_mtop_t& mtop)
{
const t_atoms *at1, *at2;
int i, j, tpi, tpj, ntypes;
{
fprintf(fplog, "Determining largest Buckingham b parameter for table\n");
}
- ntypes = mtop->ffparams.atnr;
+ ntypes = mtop.ffparams.atnr;
bmin = -1;
real bham_b_max = 0;
- for (size_t mt1 = 0; mt1 < mtop->moltype.size(); mt1++)
+ for (size_t mt1 = 0; mt1 < mtop.moltype.size(); mt1++)
{
- at1 = &mtop->moltype[mt1].atoms;
+ at1 = &mtop.moltype[mt1].atoms;
for (i = 0; (i < at1->nr); i++)
{
tpi = at1->atom[i].type;
gmx_fatal(FARGS, "Atomtype[%d] = %d, maximum = %d", i, tpi, ntypes);
}
- for (size_t mt2 = mt1; mt2 < mtop->moltype.size(); mt2++)
+ for (size_t mt2 = mt1; mt2 < mtop.moltype.size(); mt2++)
{
- at2 = &mtop->moltype[mt2].atoms;
+ at2 = &mtop.moltype[mt2].atoms;
for (j = 0; (j < at2->nr); j++)
{
tpj = at2->atom[j].type;
{
gmx_fatal(FARGS, "Atomtype[%d] = %d, maximum = %d", j, tpj, ntypes);
}
- b = mtop->ffparams.iparams[tpi * ntypes + tpj].bham.b;
+ b = mtop.ffparams.iparams[tpi * ntypes + tpj].bham.b;
if (b > bham_b_max)
{
bham_b_max = b;
* \c ncount. It will contain zero for every bonded interaction index
* for which no interactions are present in the topology.
*/
-static void count_tables(int ftype1, int ftype2, const gmx_mtop_t* mtop, int* ncount, int** count)
+static void count_tables(int ftype1, int ftype2, const gmx_mtop_t& mtop, int* ncount, int** count)
{
int ftype, i, j, tabnr;
// Loop over all moleculetypes
- for (const gmx_moltype_t& molt : mtop->moltype)
+ for (const gmx_moltype_t& molt : mtop.moltype)
{
// Loop over all interaction types
for (ftype = 0; ftype < F_NRE; ftype++)
for (i = 0; i < il.size(); i += stride)
{
// Find out which table index the user wanted
- tabnr = mtop->ffparams.iparams[il.iatoms[i]].tab.table;
+ tabnr = mtop.ffparams.iparams[il.iatoms[i]].tab.table;
if (tabnr < 0)
{
gmx_fatal(FARGS, "A bonded table number is smaller than 0: %d\n", tabnr);
static std::vector<bondedtable_t> make_bonded_tables(FILE* fplog,
int ftype1,
int ftype2,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
gmx::ArrayRef<const std::string> tabbfnm,
const char* tabext)
{
static void init_interaction_const(FILE* fp,
interaction_const_t** interaction_const,
const t_inputrec& ir,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
bool systemHasNetCharge)
{
interaction_const_t* ic = new interaction_const_t;
/* Lennard-Jones */
ic->vdwtype = ir.vdwtype;
ic->vdw_modifier = ir.vdw_modifier;
- ic->reppow = mtop->ffparams.reppow;
+ ic->reppow = mtop.ffparams.reppow;
ic->rvdw = cutoff_inf(ir.rvdw);
ic->rvdw_switch = ir.rvdw_switch;
ic->ljpme_comb_rule = ir.ljpme_combination_rule;
- ic->useBuckingham = (mtop->ffparams.functype[0] == F_BHAM);
+ ic->useBuckingham = (mtop.ffparams.functype[0] == F_BHAM);
if (ic->useBuckingham)
{
ic->buckinghamBMax = calcBuckinghamBMax(fp, mtop);
const gmx::MDLogger& mdlog,
t_forcerec* fr,
const t_inputrec& ir,
- const gmx_mtop_t* mtop,
+ const gmx_mtop_t& mtop,
const t_commrec* cr,
matrix box,
const char* tabfn,
if (EI_TPI(ir.eI))
{
/* Set to the size of the molecule to be inserted (the last one) */
- gmx::RangePartitioning molecules = gmx_mtop_molecules(*mtop);
+ gmx::RangePartitioning molecules = gmx_mtop_molecules(mtop);
fr->n_tpi = molecules.block(molecules.numBlocks() - 1).size();
}
else
}
}
- fr->bBHAM = (mtop->ffparams.functype[0] == F_BHAM);
+ fr->bBHAM = (mtop.ffparams.functype[0] == F_BHAM);
/* Neighbour searching stuff */
fr->pbcType = ir.pbcType;
if (useEwaldSurfaceCorrection || haveOrientationRestraints)
{
fr->wholeMoleculeTransform =
- std::make_unique<gmx::WholeMoleculeTransform>(*mtop, ir.pbcType);
+ std::make_unique<gmx::WholeMoleculeTransform>(mtop, ir.pbcType);
}
}
else
fr->bcoultab = FALSE;
/* 1-4 interaction electrostatics */
- fr->fudgeQQ = mtop->ffparams.fudgeQQ;
+ fr->fudgeQQ = mtop.ffparams.fudgeQQ;
// Multiple time stepping
fr->useMts = ir.useMts;
if (fr->nbfp.empty())
{
- fr->ntype = mtop->ffparams.atnr;
- fr->nbfp = makeNonBondedParameterLists(mtop->ffparams, fr->bBHAM);
+ fr->ntype = mtop.ffparams.atnr;
+ fr->nbfp = makeNonBondedParameterLists(mtop.ffparams, fr->bBHAM);
if (EVDW_PME(ic->vdwtype))
{
- fr->ljpme_c6grid = makeLJPmeC6GridCorrectionParameters(mtop->ffparams, *fr);
+ fr->ljpme_c6grid = makeLJPmeC6GridCorrectionParameters(mtop.ffparams, *fr);
}
}
fr->nwall = ir.nwall;
if (ir.nwall && ir.wall_type == ewtTABLE)
{
- make_wall_tables(fp, ir, tabfn, &mtop->groups, fr);
+ make_wall_tables(fp, ir, tabfn, &mtop.groups, fr);
}
fr->fcdata = std::make_unique<t_fcdata>();
interactionSelection.set(static_cast<int>(ListedForces::InteractionGroup::Rest));
isFirstLevel = false;
}
- fr->listedForces.emplace_back(mtop->ffparams,
- mtop->groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
+ fr->listedForces.emplace_back(mtop.ffparams,
+ mtop.groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
gmx_omp_nthreads_get(emntBonded),
interactionSelection,
fp);
else
{
// Add one ListedForces object with all listed interactions
- fr->listedForces.emplace_back(mtop->ffparams,
- mtop->groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
+ fr->listedForces.emplace_back(mtop.ffparams,
+ mtop.groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
gmx_omp_nthreads_get(emntBonded),
ListedForces::interactionSelectionAll(),
fp);
fr->cginfo_mb = init_cginfo_mb(mtop, fr);
if (!DOMAINDECOMP(cr))
{
- fr->cginfo = cginfo_expand(mtop->molblock.size(), fr->cginfo_mb);
+ fr->cginfo = cginfo_expand(mtop.molblock.size(), fr->cginfo_mb);
}
if (!DOMAINDECOMP(cr))
{
- forcerec_set_ranges(fr, mtop->natoms, mtop->natoms, mtop->natoms);
+ forcerec_set_ranges(fr, mtop.natoms, mtop.natoms, mtop.natoms);
}
fr->print_force = print_force;
if (ir.eDispCorr != edispcNO)
{
fr->dispersionCorrection = std::make_unique<DispersionCorrection>(
- *mtop, ir, fr->bBHAM, fr->ntype, fr->nbfp, *fr->ic, tabfn);
+ mtop, ir, fr->bBHAM, fr->ntype, fr->nbfp, *fr->ic, tabfn);
fr->dispersionCorrection->print(mdlog);
}