51 (void)read_tpx((
char *)file.c_str(), &ir, gbox, &natoms,
nullptr,
nullptr,
54 size_t ifirstatom = 0;
56 size_t nmolblock = mtop.molblock.size();
58 for (
size_t iblock = 0; iblock < nmolblock; ++iblock) {
59 gmx_moltype_t *mol = &(mtop.moltype[mtop.molblock[iblock].type]);
61 std::string molname = *(mol->name);
65 t_atoms *atoms = &(mol->atoms);
67 for (
Index i = 0; i < atoms->nres; i++) {
71 for (
Index imol = 0; imol < mtop.molblock[iblock].nmol; ++imol) {
74 size_t natoms_mol = mtop.moltype[mtop.molblock[iblock].type].atoms.nr;
76 for (
size_t iatom = 0; iatom < natoms_mol; iatom++) {
77 t_atom *a = &(atoms->atom[iatom]);
79 std::string bead_type = *(atoms->atomtype[iatom]);
85 bead_type, a->resind + res_offset, a->m, a->q);
88 nm << bead->
getResnr() + 1 - res_offset <<
":"
95 for (
size_t iatom = 0; iatom < natoms_mol; iatom++) {
96 std::list<Bead *> excl_list;
97 gmx::ListOfLists<int> &excl = mol->excls;
98 for (
const Index k : excl[iatom]) {
99 excl_list.push_back(top.
getBead(k + ifirstatom));
111#if GMX_VERSION >= 20260000
112 std::array<int, 8> bond_ftypes = {
113 static_cast<int>(InteractionFunction::Bonds),
114 static_cast<int>(InteractionFunction::GROMOS96Bonds),
115 static_cast<int>(InteractionFunction::MorsePotential),
116 static_cast<int>(InteractionFunction::CubicBonds),
117 static_cast<int>(InteractionFunction::ConnectBonds),
118 static_cast<int>(InteractionFunction::FENEBonds),
119 static_cast<int>(InteractionFunction::TabulatedBonds),
120 static_cast<int>(InteractionFunction::Constraints)};
121 int settle_ftype =
static_cast<int>(InteractionFunction::SETTLE);
123 std::array<int, 8> bond_ftypes = {F_BONDS, F_G96BONDS, F_MORSE,
124 F_CUBICBONDS, F_CONNBONDS, F_FENEBONDS,
125 F_TABBONDS, F_CONSTR};
126 int settle_ftype = F_SETTLE;
132 auto add_bond = [&top, first](
Index a,
Index b) {
141 for (
int ftype : bond_ftypes) {
142 const InteractionList &ilist = mol->ilist[ftype];
143 Index stride = interaction_function[ftype].nratoms + 1;
144 for (
Index i = 0; i <
Index(ilist.size()); i += stride) {
145 add_bond(ilist.iatoms[i + 1], ilist.iatoms[i + 2]);
150 const InteractionList &ilist = mol->ilist[settle_ftype];
151 Index stride = interaction_function[settle_ftype].nratoms + 1;
152 for (
Index i = 0; i <
Index(ilist.size()); i += stride) {
153 add_bond(ilist.iatoms[i + 1], ilist.iatoms[i + 2]);
154 add_bond(ilist.iatoms[i + 1], ilist.iatoms[i + 3]);
158 ifirstatom += natoms_mol;
163 for (
Index i = 0; i < 3; i++) {
164 for (
Index j = 0; j < 3; j++) {
165 m(i, j) = gbox[j][i];