#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/rf_util.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/simulation_workload.h"
particleInfoAllVdw_.resize(numParticles);
for (size_t particleI = 0; particleI < numParticles; particleI++)
{
- SET_CGINFO_HAS_VDW(particleInfoAllVdw_[particleI]);
- SET_CGINFO_HAS_Q(particleInfoAllVdw_[particleI]);
+ particleInfoAllVdw_[particleI] |= gmx::sc_atomInfo_HasVdw;
+ particleInfoAllVdw_[particleI] |= gmx::sc_atomInfo_HasCharge;
}
}
#include "gromacs/mdrun/mdmodules.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forceoutput.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/real.h"
-struct AtomInfoWithinMoleculeBlock;
struct gmx_domdec_t;
struct gmx_ddbox_t;
struct gmx_domdec_zones_t;
namespace gmx
{
+struct AtomInfoWithinMoleculeBlock;
class DeviceStreamManager;
class ForceWithShiftForces;
class MDLogger;
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/commrec.h"
-#include "gromacs/mdtypes/forcerec.h" // only for GET_CGINFO_*
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/mtop_lookup.h"
int mb = 0;
for (int a = cg_start; a < cg_end; a++)
{
- if (GET_CGINFO_SETTLE(atomInfo[a]))
+ if (atomInfo[a] & gmx::sc_atomInfo_Settle)
{
int a_gl = dd->globalAtomIndices[a];
int a_mol = 0;
int nhome = 0;
for (int a = 0; a < dd->numHomeAtoms; a++)
{
- if (GET_CGINFO_CONSTR(atomInfo[a]))
+ if (atomInfo[a] & gmx::sc_atomInfo_Constraint)
{
int a_gl = dd->globalAtomIndices[a];
int molnr = 0;
#include "gromacs/domdec/options.h"
#include "gromacs/domdec/reversetopology.h"
#include "gromacs/math/vec.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
{
exclusionsForAtom.clear();
- if (GET_CGINFO_EXCL_INTER(atomInfo[at]))
+ if (atomInfo[at] & gmx::sc_atomInfo_Exclusion)
{
int mb = 0;
int mt = 0;
#include "gromacs/domdec/domdec_internal.h"
#include "gromacs/domdec/options.h"
#include "gromacs/domdec/reversetopology.h"
-#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/topology/block.h"
}
}
-void makeBondedLinks(gmx_domdec_t* dd,
- const gmx_mtop_t& mtop,
- gmx::ArrayRef<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock)
+void makeBondedLinks(gmx_domdec_t* dd,
+ const gmx_mtop_t& mtop,
+ gmx::ArrayRef<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock)
{
if (!dd->comm->systemInfo.filterBondedCommunication)
reverse_ilist_t ril;
make_reverse_ilist(molt.ilist, &molt.atoms, rtOptions, AtomLinkRule::AllAtomsInBondeds, &ril);
- AtomInfoWithinMoleculeBlock* atomInfoOfMoleculeBlock = &atomInfoForEachMoleculeBlock[mb];
+ gmx::AtomInfoWithinMoleculeBlock* atomInfoOfMoleculeBlock = &atomInfoForEachMoleculeBlock[mb];
int mol = 0;
for (mol = 0; mol < (mtop.bIntermolecularInteractions ? molb.nmol : 1); mol++)
}
if (link->index[atomIndex + 1] - link->index[atomIndex] > 0)
{
- SET_CGINFO_BOND_INTER(atomInfoOfMoleculeBlock->atomInfo[a]);
+ atomInfoOfMoleculeBlock->atomInfo[a] |= gmx::sc_atomInfo_BondCommunication;
numLinkedAtoms++;
}
}
&& atomIndex - atomInfoOfMoleculeBlock->indexOfFirstAtomInMoleculeBlock
< gmx::ssize(atomInfoOfMoleculeBlock->atomInfo))
{
- SET_CGINFO_BOND_INTER(
- atomInfoOfMoleculeBlock
- ->atomInfo[atomIndex - atomInfoOfMoleculeBlock->indexOfFirstAtomInMoleculeBlock]);
+ atomInfoOfMoleculeBlock->atomInfo[atomIndex - atomInfoOfMoleculeBlock->indexOfFirstAtomInMoleculeBlock] |=
+ gmx::sc_atomInfo_BondCommunication;
numLinkedAtoms++;
}
}
#ifndef GMX_DOMDEC_MAKEBONDEDLINKS_H
#define GMX_DOMDEC_MAKEBONDEDLINKS_H
-struct AtomInfoWithinMoleculeBlock;
struct gmx_domdec_t;
struct gmx_mtop_t;
{
template<typename>
class ArrayRef;
-}
+struct AtomInfoWithinMoleculeBlock;
+} // namespace gmx
/*! \brief Generate a list of links between atoms that are linked by bonded interactions
*
* Also stores whether atoms are linked in \p atomInfoForEachMoleculeBlock.
*/
-void makeBondedLinks(gmx_domdec_t* dd,
- const gmx_mtop_t& mtop,
- gmx::ArrayRef<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock);
+void makeBondedLinks(gmx_domdec_t* dd,
+ const gmx_mtop_t& mtop,
+ gmx::ArrayRef<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock);
#endif
{
if (fr != nullptr)
{
- gmx::ArrayRef<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock =
+ gmx::ArrayRef<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock =
fr->atomInfoForEachMoleculeBlock;
gmx::ArrayRef<int> atomInfo = fr->atomInfo;
}
//! Merge atom buffers.
-static void merge_cg_buffers(int ncell,
- gmx_domdec_comm_dim_t* cd,
- int pulse,
- int* ncg_cell,
- gmx::ArrayRef<int> index_gl,
- const int* recv_i,
- gmx::ArrayRef<gmx::RVec> x,
- gmx::ArrayRef<const gmx::RVec> recv_vr,
- gmx::ArrayRef<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock,
- gmx::ArrayRef<int> atomInfo)
+static void merge_cg_buffers(int ncell,
+ gmx_domdec_comm_dim_t* cd,
+ int pulse,
+ int* ncg_cell,
+ gmx::ArrayRef<int> index_gl,
+ const int* recv_i,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> recv_vr,
+ gmx::ArrayRef<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock,
+ gmx::ArrayRef<int> atomInfo)
{
gmx_domdec_ind_t *ind, *ind_p;
int p, cell, c, cg, cg0, cg1, cg_gl;
if (r2 < r_comm2
|| (bDistBonded && ((bDistMB && rb2 < r_bcomm2) || (bDist2B && r2 < r_bcomm2))
&& (!bBondComm
- || (GET_CGINFO_BOND_INTER(atomInfo[cg])
+ || ((atomInfo[cg] & gmx::sc_atomInfo_BondCommunication)
&& missing_link(*comm->bondedLinks, globalAtomGroupIndices[cg], *dd->ga2la)))))
{
/* Store the local and global atom group indices and position */
}
zone_cg_range = zones->cg_range.data();
- gmx::ArrayRef<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock =
+ gmx::ArrayRef<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock =
fr->atomInfoForEachMoleculeBlock;
zone_cg_range[0] = 0;
/* We reuse the intBuffer without reacquiring since we are in the same scope */
DDBufferAccess<int>& flagBuffer = moveBuffer;
- gmx::ArrayRef<const AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock =
+ gmx::ArrayRef<const gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock =
fr->atomInfoForEachMoleculeBlock;
/* Temporarily store atoms passed to our rank at the end of the range */
#include "utility.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
#define GMX_DOMDEC_DOMDEC_UTILITY_H
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "domdec_internal.h"
void check_screw_box(const matrix box);
/*! \brief Return the atom information flags for atom a */
-static inline int ddGetAtomInfo(gmx::ArrayRef<const AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock,
- int a)
+static inline int ddGetAtomInfo(gmx::ArrayRef<const gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock,
+ int a)
{
size_t index = 0;
while (a >= atomInfoForEachMoleculeBlock[index].indexOfLastAtomInMoleculeBlock)
{
index++;
}
- const AtomInfoWithinMoleculeBlock& atomInfoOfMoleculeBlock = atomInfoForEachMoleculeBlock[index];
+ const gmx::AtomInfoWithinMoleculeBlock& atomInfoOfMoleculeBlock = atomInfoForEachMoleculeBlock[index];
return atomInfoOfMoleculeBlock.atomInfo[(a - atomInfoOfMoleculeBlock.indexOfFirstAtomInMoleculeBlock)
% atomInfoOfMoleculeBlock.atomInfo.size()];
Settle, //! F_SETTLE active
};
-static std::vector<AtomInfoWithinMoleculeBlock> makeAtomInfoForEachMoleculeBlock(const gmx_mtop_t& mtop,
- const t_forcerec* fr)
+static std::vector<gmx::AtomInfoWithinMoleculeBlock>
+makeAtomInfoForEachMoleculeBlock(const gmx_mtop_t& mtop, const t_forcerec* fr)
{
std::vector<bool> atomUsesVdw(fr->ntype, false);
for (int ai = 0; ai < fr->ntype; ai++)
}
}
- std::vector<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock;
- int indexOfFirstAtomInMoleculeBlock = 0;
+ std::vector<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock;
+ int indexOfFirstAtomInMoleculeBlock = 0;
for (size_t mb = 0; mb < mtop.molblock.size(); mb++)
{
const gmx_molblock_t& molb = mtop.molblock[mb];
}
}
- AtomInfoWithinMoleculeBlock atomInfoOfMoleculeBlock;
+ gmx::AtomInfoWithinMoleculeBlock atomInfoOfMoleculeBlock;
atomInfoOfMoleculeBlock.indexOfFirstAtomInMoleculeBlock = indexOfFirstAtomInMoleculeBlock;
atomInfoOfMoleculeBlock.indexOfLastAtomInMoleculeBlock =
indexOfFirstAtomInMoleculeBlock + molb.nmol * molt.atoms.nr;
int& atomInfo = atomInfoOfMoleculeBlock.atomInfo[moleculeOffsetInBlock + a];
/* Store the energy group in atomInfo */
- int gid = getGroupType(mtop.groups,
+ int gid = getGroupType(mtop.groups,
SimulationAtomGroupType::EnergyOutput,
indexOfFirstAtomInMoleculeBlock + moleculeOffsetInBlock + a);
- SET_CGINFO_GID(atomInfo, gid);
+ atomInfo = (atomInfo & ~gmx::sc_atomInfo_EnergyGroupIdMask) | gid;
bool bHaveVDW = (atomUsesVdw[atom.type] || atomUsesVdw[atom.typeB]);
bool bHaveQ = (atom.q != 0 || atom.qB != 0);
switch (constraintTypeOfAtom[a])
{
- case ConstraintTypeForAtom::Constraint: SET_CGINFO_CONSTR(atomInfo); break;
- case ConstraintTypeForAtom::Settle: SET_CGINFO_SETTLE(atomInfo); break;
+ case ConstraintTypeForAtom::Constraint:
+ atomInfo |= gmx::sc_atomInfo_Constraint;
+ break;
+ case ConstraintTypeForAtom::Settle: atomInfo |= gmx::sc_atomInfo_Settle; break;
default: break;
}
if (haveExclusions)
{
- SET_CGINFO_EXCL_INTER(atomInfo);
+ atomInfo |= gmx::sc_atomInfo_Exclusion;
}
if (bHaveVDW)
{
- SET_CGINFO_HAS_VDW(atomInfo);
+ atomInfo |= gmx::sc_atomInfo_HasVdw;
}
if (bHaveQ)
{
- SET_CGINFO_HAS_Q(atomInfo);
+ atomInfo |= gmx::sc_atomInfo_HasCharge;
}
if (fr->efep != FreeEnergyPerturbationType::No && PERTURBED(atom))
{
- SET_CGINFO_FEP(atomInfo);
+ atomInfo |= gmx::sc_atomInfo_FreeEnergyPerturbation;
}
}
}
return atomInfoForEachMoleculeBlock;
}
-static std::vector<int> expandAtomInfo(const int nmb,
- gmx::ArrayRef<const AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock)
+static std::vector<int> expandAtomInfo(const int nmb,
+ gmx::ArrayRef<const gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock)
{
const int numAtoms = atomInfoForEachMoleculeBlock[nmb - 1].indexOfLastAtomInMoleculeBlock;
fr->nbv->changePairlistRadii(inputrec->rlist, inputrec->rlist);
ngid = groups->groups[SimulationAtomGroupType::EnergyOutput].size();
- gid_tp = GET_CGINFO_GID(fr->atomInfo[a_tp0]);
+ gid_tp = fr->atomInfo[a_tp0] & gmx::sc_atomInfo_EnergyGroupIdMask;
for (int a = a_tp0 + 1; a < a_tp1; a++)
{
- if (GET_CGINFO_GID(fr->atomInfo[a]) != gid_tp)
+ if ((fr->atomInfo[a] & gmx::sc_atomInfo_EnergyGroupIdMask) != gid_tp)
{
fprintf(fplog,
"NOTE: Atoms in the molecule to insert belong to different energy groups.\n"
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \libinternal \file
+ *
+ * \brief This file makes declarations used for storing bitfields
+ * describing each atom so that other modules can efficiently process
+ * them.
+ *
+ * \inlibraryapi
+ */
+
+#ifndef GMX_MDTYPES_ATOMINFO_H
+#define GMX_MDTYPES_ATOMINFO_H
+
+#include <vector>
+
+namespace gmx
+{
+
+/*! \brief Constants whose bit describes properties of atoms in
+ * AtomInfoWithinMoleculeBlock.atomInfo.
+ *
+ * No bit should exceed 1 << 63, so that it fits into a 64-bit
+ * integer.
+ *
+ * Since the tpx format support max 256 energy groups, we do the same
+ * here, reserving bits 0-7 for the energy-group ID.
+ */
+//! \{
+static constexpr int sc_atomInfo_FreeEnergyPerturbation = 1 << 15;
+static constexpr int sc_atomInfo_Exclusion = 1 << 17;
+static constexpr int sc_atomInfo_Constraint = 1 << 20;
+static constexpr int sc_atomInfo_Settle = 1 << 21;
+static constexpr int sc_atomInfo_BondCommunication = 1 << 22;
+static constexpr int sc_atomInfo_HasVdw = 1 << 23;
+static constexpr int sc_atomInfo_HasCharge = 1 << 24;
+//! \}
+//! The first 8 bits are reserved for energy-group ID
+static constexpr int sc_atomInfo_EnergyGroupIdMask = 0b11111111;
+
+/*! \brief Contains information about each atom in a molecule block of
+ * the global topology. */
+struct AtomInfoWithinMoleculeBlock
+{
+ //! Index within the system of the first atom in the molecule block
+ int indexOfFirstAtomInMoleculeBlock = 0;
+ //! Index within the system of the last atom in the molecule block
+ int indexOfLastAtomInMoleculeBlock = 0;
+ /*! \brief Atom info for each atom in the block.
+ *
+ * The typical case is that all atoms are identical for each
+ * molecule of the block, and if so this vector has size equal to
+ * the number of atoms in the molecule.
+ *
+ * An example of an atypical case is QM/MM, where multiple
+ * molecules might be present and different molecules have
+ * different atoms within any one QM group or region. Now there are
+ * multiple kinds of molecules with the same connectivity, so we simply
+ * write out the atom info for the entire molecule block. Then the
+ * size equals the product of the number of atoms in the
+ * molecule and the number of molecules.
+ *
+ * The vector needs to be indexed accordingly.
+ */
+ std::vector<int> atomInfo;
+};
+
+} // namespace gmx
+
+#endif
#include <vector>
#include "gromacs/math/vectypes.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
class WholeMoleculeTransform;
} // namespace gmx
-/* macros for the atom info data in forcerec
- *
- * Since the tpx format support max 256 energy groups, we do the same here.
- * Note that we thus have bits 8-14 still unused.
- */
-#define SET_CGINFO_GID(cgi, gid) (cgi) = (((cgi) & ~255) | (gid))
-#define GET_CGINFO_GID(cgi) ((cgi)&255)
-#define SET_CGINFO_FEP(cgi) (cgi) = ((cgi) | (1 << 15))
-#define GET_CGINFO_FEP(cgi) ((cgi) & (1 << 15))
-#define SET_CGINFO_EXCL_INTER(cgi) (cgi) = ((cgi) | (1 << 17))
-#define GET_CGINFO_EXCL_INTER(cgi) ((cgi) & (1 << 17))
-#define SET_CGINFO_CONSTR(cgi) (cgi) = ((cgi) | (1 << 20))
-#define GET_CGINFO_CONSTR(cgi) ((cgi) & (1 << 20))
-#define SET_CGINFO_SETTLE(cgi) (cgi) = ((cgi) | (1 << 21))
-#define GET_CGINFO_SETTLE(cgi) ((cgi) & (1 << 21))
-/* This bit is only used with bBondComm in the domain decomposition */
-#define SET_CGINFO_BOND_INTER(cgi) (cgi) = ((cgi) | (1 << 22))
-#define GET_CGINFO_BOND_INTER(cgi) ((cgi) & (1 << 22))
-#define SET_CGINFO_HAS_VDW(cgi) (cgi) = ((cgi) | (1 << 23))
-#define GET_CGINFO_HAS_VDW(cgi) ((cgi) & (1 << 23))
-#define SET_CGINFO_HAS_Q(cgi) (cgi) = ((cgi) | (1 << 24))
-#define GET_CGINFO_HAS_Q(cgi) ((cgi) & (1 << 24))
-
-
/* Value to be used in mdrun for an infinite cut-off.
* Since we need to compare with the cut-off squared,
* this value should be slighlty smaller than sqrt(GMX_FLOAT_MAX).
//! Check the cuttoff
real cutoff_inf(real cutoff);
-/*! \brief Contains information about each atom in a molecule block of
- * the global topology. */
-struct AtomInfoWithinMoleculeBlock
-{
- //! Index within the system of the first atom in the molecule block
- int indexOfFirstAtomInMoleculeBlock = 0;
- //! Index within the system of the last atom in the molecule block
- int indexOfLastAtomInMoleculeBlock = 0;
- /*! \brief Atom info for each atom in the block.
- *
- * The typical case is that all atoms are identical for each
- * molecule of the block, and if so this vector has size equal to
- * the number of atoms in the molecule.
- *
- * An example of an atypical case is QM/MM, where multiple
- * molecules might be present and different molecules have
- * different atoms within any one QM group or region. Now there are
- * multiple kinds of molecules with the same connectivity, so we simply
- * write out the atom info for the entire molecule block. Then the
- * size equals the product of the number of atoms in the
- * molecule and the number of molecules.
- *
- * The vector needs to be indexed accordingly. */
- std::vector<int> atomInfo;
-};
-
-
/* Forward declaration of type for managing Ewald tables */
struct gmx_ewald_tab_t;
FreeEnergyPerturbationType efep = FreeEnergyPerturbationType::No;
/* Information about atom properties for the molecule blocks in the global topology */
- std::vector<AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock;
+ std::vector<gmx::AtomInfoWithinMoleculeBlock> atomInfoForEachMoleculeBlock;
/* Information about atom properties for local and non-local atoms */
std::vector<int> atomInfo;
}
/* Copies the energy group indices to a reordered and packed array */
-static void
-copy_egp_to_nbat_egps(const int* a, int na, int na_round, int na_c, int bit_shift, const int* in, int* innb)
+static void copy_egp_to_nbat_egps(const int* a,
+ int na,
+ int na_round,
+ int na_c,
+ int bit_shift,
+ ArrayRef<const int> atomInfo,
+ int* atomInfoNb)
{
int i = 0, j = 0;
for (; i < na; i += na_c)
int at = a[i + sa];
if (at >= 0)
{
- comb |= (GET_CGINFO_GID(in[at]) << (sa * bit_shift));
+ comb |= (atomInfo[at] & sc_atomInfo_EnergyGroupIdMask) << (sa * bit_shift);
}
}
- innb[j++] = comb;
+ atomInfoNb[j++] = comb;
}
/* Complete the partially filled last cell with fill */
for (; i < na_round; i += na_c)
{
- innb[j++] = 0;
+ atomInfoNb[j++] = 0;
}
}
numAtoms,
c_nbnxnCpuIClusterSize,
params->neg_2log,
- atomInfo.data(),
+ atomInfo,
params->energrp.data() + grid.atomToCluster(atomOffset));
}
}
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/dispersioncorrection.h"
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/pbcutil/ishift.h"
// Oxgygen
atomTypes[a] = typeOxygen;
charges[a] = chargeOxygen;
- SET_CGINFO_HAS_VDW(atomInfoAllVdw[a]);
- SET_CGINFO_HAS_VDW(atomInfoOxygenVdw[a]);
+ atomInfoAllVdw[a] |= gmx::sc_atomInfo_HasVdw;
+ atomInfoOxygenVdw[a] |= gmx::sc_atomInfo_HasVdw;
}
else
{
// Hydrogen
atomTypes[a] = typeHydrogen;
charges[a] = chargeHydrogen;
- SET_CGINFO_HAS_VDW(atomInfoAllVdw[a]);
+ atomInfoAllVdw[a] |= gmx::sc_atomInfo_HasVdw;
}
- SET_CGINFO_HAS_Q(atomInfoAllVdw[a]);
- SET_CGINFO_HAS_Q(atomInfoOxygenVdw[a]);
+ atomInfoAllVdw[a] |= gmx::sc_atomInfo_HasCharge;
+ atomInfoOxygenVdw[a] |= gmx::sc_atomInfo_HasCharge;
excls.pushBackListOfSize(numAtomsInMolecule);
gmx::ArrayRef<int> exclusionsForAtom = excls.back();
/*
* 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.
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/updategroupscog.h"
-#include "gromacs/mdtypes/forcerec.h" // only for GET_CGINFO_*
+#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/simd/simd.h"
#include "gromacs/simd/vector_operations.h"
*
* Sorts atoms on LJ coefficients: !=0 first, ==0 at the end.
*/
-static void sort_cluster_on_flag(int numAtomsInCluster,
- int atomStart,
- int atomEnd,
- const int* atinfo,
- gmx::ArrayRef<int> order,
- int* flags)
+static void sort_cluster_on_flag(int numAtomsInCluster,
+ int atomStart,
+ int atomEnd,
+ gmx::ArrayRef<const int> atomInfo,
+ gmx::ArrayRef<int> order,
+ int* flags)
{
constexpr int c_maxNumAtomsInCluster = 8;
int sort1[c_maxNumAtomsInCluster];
for (int s = atomStart; s < atomEnd; s += numAtomsInCluster)
{
/* Make lists for this (sub-)cell on atoms with and without LJ */
- int n1 = 0;
- int n2 = 0;
- gmx_bool haveQ = FALSE;
- int a_lj_max = -1;
+ int n1 = 0;
+ int n2 = 0;
+ bool haveQ = false;
+ int a_lj_max = -1;
for (int a = s; a < std::min(s + numAtomsInCluster, atomEnd); a++)
{
- haveQ = haveQ || GET_CGINFO_HAS_Q(atinfo[order[a]]);
+ haveQ = haveQ || bool(atomInfo[order[a]] & gmx::sc_atomInfo_HasCharge);
- if (GET_CGINFO_HAS_VDW(atinfo[order[a]]))
+ if (atomInfo[order[a]] & (gmx::sc_atomInfo_HasVdw))
{
sort1[n1++] = order[a];
a_lj_max = a;
nbnxn_atomdata_t* nbat,
int atomStart,
int atomEnd,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
BoundingBox gmx_unused* bb_work_aligned)
{
sort_cluster_on_flag(geometry_.numAtomsICluster,
atomStart,
atomEnd,
- atinfo,
+ atomInfo,
atomIndices,
flags_.data() + atomToCluster(atomStart) - cellOffset_);
}
fep_[cell] = 0;
for (int at = atomStart; at < atomEnd; at++)
{
- if (atomIndices[at] >= 0 && GET_CGINFO_FEP(atinfo[atomIndices[at]]))
+ if (atomIndices[at] >= 0 && (atomInfo[atomIndices[at]] & gmx::sc_atomInfo_FreeEnergyPerturbation))
{
fep_[cell] |= (1 << (at - atomStart));
}
void Grid::sortColumnsCpuGeometry(GridSetData* gridSetData,
int dd_zone,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
nbnxn_atomdata_t* nbat,
const gmx::Range<int> columnRange,
const int numAtomsLeftInColumn = std::max(numAtoms - (atomOffsetCell - atomOffset), 0);
const int numAtomsCell = std::min(numAtomsPerCell, numAtomsLeftInColumn);
- fillCell(gridSetData, nbat, atomOffsetCell, atomOffsetCell + numAtomsCell, atinfo, x, nullptr);
+ fillCell(gridSetData, nbat, atomOffsetCell, atomOffsetCell + numAtomsCell, atomInfo, x, nullptr);
/* This copy to bbcz is not really necessary.
* But it allows to use the same grid search code
/* Spatially sort the atoms within one grid column */
void Grid::sortColumnsGpuGeometry(GridSetData* gridSetData,
int dd_zone,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
nbnxn_atomdata_t* nbat,
const gmx::Range<int> columnRange,
const int numAtomsX =
std::min(subdiv_x, numAtomsInColumn - (atomOffsetX - atomOffset));
- fillCell(gridSetData, nbat, atomOffsetX, atomOffsetX + numAtomsX, atinfo, x, bb_work_aligned);
+ fillCell(gridSetData, nbat, atomOffsetX, atomOffsetX + numAtomsX, atomInfo, x, bb_work_aligned);
}
}
}
GridSetData* gridSetData,
gmx::ArrayRef<GridWork> gridWork,
const gmx::Range<int> atomRange,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
const int numAtomsMoved,
nbnxn_atomdata_t* nbat)
if (geometry_.isSimple)
{
sortColumnsCpuGeometry(
- gridSetData, ddZone, atinfo, x, nbat, columnRange, gridWork[thread].sortBuffer);
+ gridSetData, ddZone, atomInfo, x, nbat, columnRange, gridWork[thread].sortBuffer);
}
else
{
sortColumnsGpuGeometry(
- gridSetData, ddZone, atinfo, x, nbat, columnRange, gridWork[thread].sortBuffer);
+ gridSetData, ddZone, atomInfo, x, nbat, columnRange, gridWork[thread].sortBuffer);
}
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
GridSetData* gridSetData,
gmx::ArrayRef<GridWork> gridWork,
gmx::Range<int> atomRange,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
int numAtomsMoved,
nbnxn_atomdata_t* nbat);
nbnxn_atomdata_t* nbat,
int atomStart,
int atomEnd,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
BoundingBox gmx_unused* bb_work_aligned);
//! Spatially sort the atoms within the given column range, for CPU geometry
void sortColumnsCpuGeometry(GridSetData* gridSetData,
int dd_zone,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
nbnxn_atomdata_t* nbat,
gmx::Range<int> columnRange,
//! Spatially sort the atoms within the given column range, for GPU geometry
void sortColumnsGpuGeometry(GridSetData* gridSetData,
int dd_zone,
- const int* atinfo,
+ gmx::ArrayRef<const int> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
nbnxn_atomdata_t* nbat,
gmx::Range<int> columnRange,
/* Copy the already computed cell indices to the grid and sort, when needed */
grid.setCellIndices(
- ddZone, cellOffset, &gridSetData_, gridWork_, atomRange, atomInfo.data(), x, numAtomsMoved, nbat);
+ ddZone, cellOffset, &gridSetData_, gridWork_, atomRange, atomInfo, x, numAtomsMoved, nbat);
if (gridIndex == 0)
{