/*! \brief Walks over the constraints out from the local atoms into the non-local atoms and adds them to a list */
static void walk_out(int con, int con_offset, int a, int offset, int nrec,
- int ncon1, const t_iatom *ia1, const t_iatom *ia2,
+ gmx::ArrayRef<const int> ia1,
+ gmx::ArrayRef<const int> ia2,
const t_blocka *at2con,
const gmx_ga2la_t &ga2la, gmx_bool bHomeConnect,
gmx_domdec_constraints_t *dc,
il_local->nalloc = over_alloc_dd(il_local->nr+3);
srenew(il_local->iatoms, il_local->nalloc);
}
- iap = constr_iatomptr(ncon1, ia1, ia2, con);
+ iap = constr_iatomptr(ia1, ia2, con);
il_local->iatoms[il_local->nr++] = iap[0];
a1_gl = offset + iap[1];
a2_gl = offset + iap[2];
if (coni != con)
{
/* Walk further */
- iap = constr_iatomptr(ncon1, ia1, ia2, coni);
+ iap = constr_iatomptr(ia1, ia2, coni);
if (a == iap[1])
{
b = iap[2];
if (!ga2la.findHome(offset + b))
{
walk_out(coni, con_offset, b, offset, nrec-1,
- ncon1, ia1, ia2, at2con,
+ ia1, ia2, at2con,
ga2la, FALSE, dc, dcc, il_local, ireq);
}
}
static void atoms_to_settles(gmx_domdec_t *dd,
const gmx_mtop_t *mtop,
const int *cginfo,
- const int *const*at2settle_mt,
+ gmx::ArrayRef < const std::vector < int>> at2settle_mt,
int cg_start, int cg_end,
t_ilist *ils_local,
std::vector<int> *ireq)
if (settle >= 0)
{
- int offset = a_gl - a_mol;
+ int offset = a_gl - a_mol;
- t_iatom *ia1 = mtop->moltype[molb->type].ilist[F_SETTLE].iatoms;
+ const int *ia1 = mtop->moltype[molb->type].ilist[F_SETTLE].iatoms.data();
- int a_gls[3];
- gmx_bool bAssign = FALSE;
- int nlocal = 0;
+ int a_gls[3];
+ gmx_bool bAssign = FALSE;
+ int nlocal = 0;
for (int sa = 0; sa < nral; sa++)
{
int a_glsa = offset + ia1[settle*(1+nral)+1+sa];
std::vector<int> *ireq)
{
const t_blocka *at2con;
- int ncon1;
- t_iatom *ia1, *ia2, *iap;
int b_lo, offset, b_mol, i, con, con_offset;
gmx_domdec_constraints_t *dc = dd->constraints;
int molnr, a_mol;
mtopGetMolblockIndex(mtop, a_gl, &mb, &molnr, &a_mol);
- const gmx_molblock_t *molb = &mtop->molblock[mb];
+ const gmx_molblock_t &molb = mtop->molblock[mb];
- ncon1 = mtop->moltype[molb->type].ilist[F_CONSTR].nr/NRAL(F_SETTLE);
-
- ia1 = mtop->moltype[molb->type].ilist[F_CONSTR].iatoms;
- ia2 = mtop->moltype[molb->type].ilist[F_CONSTRNC].iatoms;
+ gmx::ArrayRef<const int> ia1 = mtop->moltype[molb.type].ilist[F_CONSTR].iatoms;
+ gmx::ArrayRef<const int> ia2 = mtop->moltype[molb.type].ilist[F_CONSTRNC].iatoms;
/* Calculate the global constraint number offset for the molecule.
* This is only required for the global index to make sure
/* The global atom number offset for this molecule */
offset = a_gl - a_mol;
- at2con = &at2con_mt[molb->type];
+ at2con = &at2con_mt[molb.type];
for (i = at2con->index[a_mol]; i < at2con->index[a_mol+1]; i++)
{
- con = at2con->a[i];
- iap = constr_iatomptr(ncon1, ia1, ia2, con);
+ con = at2con->a[i];
+ const int *iap = constr_iatomptr(ia1, ia2, con);
if (a_mol == iap[1])
{
b_mol = iap[2];
* after this first call.
*/
walk_out(con, con_offset, b_mol, offset, nrec,
- ncon1, ia1, ia2, at2con,
+ ia1, ia2, at2con,
ga2la, TRUE, dc, dcc, ilc_local, ireq);
}
}
t_ilist *ilc_local, *ils_local;
std::vector<int> *ireq;
gmx::ArrayRef<const t_blocka> at2con_mt;
- const int *const*at2settle_mt;
gmx::HashedMap<int> *ga2la_specat;
int at_end, i, j;
t_iatom *iap;
ireq = nullptr;
}
+ gmx::ArrayRef < const std::vector < int>> at2settle_mt;
+ /* When settle works inside charge groups, we assigned them already */
if (dd->bInterCGsettles)
{
// TODO Perhaps gmx_domdec_constraints_t should keep a valid constr?
at2settle_mt = constr->atom2settle_moltype();
ils_local->nr = 0;
}
- else
- {
- /* Settle works inside charge groups, we assigned them already */
- at2settle_mt = nullptr;
- }
- if (at2settle_mt == nullptr)
+ if (at2settle_mt.empty())
{
atoms_to_constraints(dd, mtop, cginfo, at2con_mt, nrec,
ilc_local, ireq);
molb = &mtop->molblock[mb];
dc->molb_con_offset[mb] = ncon;
dc->molb_ncon_mol[mb] =
- mtop->moltype[molb->type].ilist[F_CONSTR].nr/3 +
- mtop->moltype[molb->type].ilist[F_CONSTRNC].nr/3;
+ mtop->moltype[molb->type].ilist[F_CONSTR].size()/3 +
+ mtop->moltype[molb->type].ilist[F_CONSTRNC].size()/3;
ncon += molb->nmol*dc->molb_ncon_mol[mb];
}