/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,2012,2013,2014,2015, 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.
}
iloop->mblock++;
- if (iloop->mblock == iloop->mtop->nmolblock)
+ if (iloop->mblock >= iloop->mtop->nmolblock)
{
+ if (iloop->mblock == iloop->mtop->nmolblock &&
+ iloop->mtop->bIntermolecularInteractions)
+ {
+ *ilist_mol = iloop->mtop->intermolecular_ilist;
+ *nmol = 1;
+ return TRUE;
+ }
+
gmx_mtop_ilistloop_destroy(iloop);
return FALSE;
}
iloop->mol++;
- if (iloop->mol >= iloop->mtop->molblock[iloop->mblock].nmol)
+ /* Inter-molecular interactions, if present, are indexed with
+ * iloop->mblock == iloop->mtop->nmolblock, thus we should separately
+ * check for this value in this conditional.
+ */
+ if (iloop->mblock == iloop->mtop->nmolblock ||
+ iloop->mol >= iloop->mtop->molblock[iloop->mblock].nmol)
{
iloop->mblock++;
iloop->mol = 0;
- if (iloop->mblock == iloop->mtop->nmolblock)
+ if (iloop->mblock >= iloop->mtop->nmolblock)
{
+ if (iloop->mblock == iloop->mtop->nmolblock &&
+ iloop->mtop->bIntermolecularInteractions)
+ {
+ *ilist_mol = iloop->mtop->intermolecular_ilist;
+ *atnr_offset = 0;
+ return TRUE;
+ }
+
gmx_mtop_ilistloop_all_destroy(iloop);
return FALSE;
}
n += nmol*il[ftype].nr/(1+NRAL(ftype));
}
+ if (mtop->bIntermolecularInteractions)
+ {
+ n += mtop->intermolecular_ilist[ftype].nr/(1+NRAL(ftype));
+ }
+
return n;
}
natoms += molb->nmol*srcnr;
}
+ if (mtop->bIntermolecularInteractions)
+ {
+ for (ftype = 0; ftype < F_NRE; ftype++)
+ {
+ ilistcat(ftype, &idef->il[ftype], &mtop->intermolecular_ilist[ftype],
+ 1, 0, mtop->natoms);
+ }
+ }
+
if (ir == NULL)
{
top->idef.ilsort = ilsortUNKNOWN;
gen_local_top(mtop, NULL, FALSE, <op);
- top.name = mtop->name;
- top.idef = ltop.idef;
- top.atomtypes = ltop.atomtypes;
- top.cgs = ltop.cgs;
- top.excls = ltop.excls;
- top.atoms = gmx_mtop_global_atoms(mtop);
- top.mols = mtop->mols;
- top.symtab = mtop->symtab;
+ top.name = mtop->name;
+ top.idef = ltop.idef;
+ top.atomtypes = ltop.atomtypes;
+ top.cgs = ltop.cgs;
+ top.excls = ltop.excls;
+ top.atoms = gmx_mtop_global_atoms(mtop);
+ top.mols = mtop->mols;
+ top.bIntermolecularInteractions = mtop->bIntermolecularInteractions;
+ top.symtab = mtop->symtab;
/* We only need to free the moltype and molblock data,
* all other pointers have been copied to top.