#include "gromacs/topology/forcefieldparameters.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/symtab.h"
+#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/unique_cptr.h"
-enum
+enum class SimulationAtomGroupType : int
{
- egcTC, egcENER, egcACC, egcFREEZE,
- egcUser1, egcUser2, egcVCM, egcCompressedX,
- egcORFIT, egcQMMM,
- egcNR
+ TemperatureCoupling,
+ EnergyOutput,
+ Acceleration,
+ Freeze,
+ User1,
+ User2,
+ MassCenterVelocityRemoval,
+ CompressedPositionOutput,
+ OrientationRestraintsFit,
+ QuantumMechanics,
+ Count
};
-/* Names corresponding to groups */
-extern const char *gtypes[egcNR+1];
+
+//! Short strings used for describing atom groups in log and energy files
+const char *shortName(SimulationAtomGroupType type);
+
+//const char *shortName(int type); // if necessary
/*! \brief Molecules type data: atoms, interactions and exclusions */
struct gmx_moltype_t
int moleculeIndexStart; /**< Global molecule indexing starts from this value */
};
-typedef struct gmx_groups_t
+/*! \brief Contains the simulation atom groups.
+ *
+ * Organized as containers for the different
+ * SimulationAtomGroupTypes
+ */
+struct SimulationGroups
{
- t_grps grps[egcNR]; /* Groups of things */
- int ngrpname; /* Number of groupnames */
- char ***grpname; /* Names of the groups */
- int ngrpnr[egcNR];
- unsigned char *grpnr[egcNR]; /* Group numbers or NULL */
-} gmx_groups_t;
+ SimulationGroups();
+
+ ~SimulationGroups();
+
+ //! Groups of particles
+ gmx::EnumerationArray<SimulationAtomGroupType, t_grps> groups;
+ //! Names of groups, stored as pointer to the entries in the symbol table.
+ std::vector<char **> groupNames;
+ //! Group numbers for the different SimulationAtomGroupType groups.
+ gmx::EnumerationArray < SimulationAtomGroupType, std::vector < unsigned char>> groupNumbers;
+
+ /*! \brief
+ * Number of group numbers for a single SimulationGroup.
+ *
+ * \param[in] group Integer value for the group type.
+ */
+ int numberOfGroupNumbers(SimulationAtomGroupType group) const { return groupNumbers[group].size(); }
+};
/*! \brief
* Returns group number of an input group for a given atom.
* \param[in] type Type of group to check.
* \param[in] atom Atom to check if it has an entry.
*/
-int getGroupType (const gmx_groups_t &group, int type, int atom);
+int getGroupType (const SimulationGroups &group, SimulationAtomGroupType type, int atom);
/* The global, complete system topology struct, based on molecule types.
* This structure should contain no data that is O(natoms) in memory.
* List of intermolecular interactions using system wide
* atom indices, either NULL or size F_NRE
*/
- std::unique_ptr<InteractionLists> intermolecular_ilist = nullptr;
+ std::unique_ptr<InteractionLists> intermolecular_ilist = nullptr;
//! Number of global atoms.
- int natoms = 0;
+ int natoms = 0;
//! Parameter for residue numbering.
- int maxres_renum = 0;
+ int maxres_renum = 0;
//! The maximum residue number in moltype
- int maxresnr = -1;
+ int maxresnr = -1;
//! Atomtype properties
- t_atomtypes atomtypes;
+ t_atomtypes atomtypes;
//! Groups of atoms for different purposes
- gmx_groups_t groups;
+ SimulationGroups groups;
//! The symbol table
- t_symtab symtab;
+ t_symtab symtab;
//! Tells whether we have valid molecule indices
- bool haveMoleculeIndices = false;
+ bool haveMoleculeIndices = false;
/*! \brief List of global atom indices of atoms between which
* non-bonded interactions must be excluded.
*/
std::vector<MoleculeBlockIndices> moleculeBlockIndices;
};
-/* \brief
+/*! \brief
* The fully written out topology for a domain over its lifetime
*
* Also used in some analysis code.
} t_topology;
void init_top(t_topology *top);
-void done_gmx_groups_t(gmx_groups_t *g);
void done_top(t_topology *top);
// Frees both t_topology and gmx_mtop_t when the former has been created from
// the latter.
* \param[in] natoms0 Number of atoms for first group.
* \param[in] natoms1 Number of atoms for second group.
*/
-void compareAtomGroups(FILE *fp, const gmx_groups_t &g0, const gmx_groups_t &g1,
+void compareAtomGroups(FILE *fp, const SimulationGroups &g0, const SimulationGroups &g1,
int natoms0, int natoms1);
//! Typedef for gmx_localtop in analysis tools.