Fixes #1579.
Change-Id: I42d234f4ad6a94e8f7b6b8236ea119860dd9f7ab
*/
void split_vsites_over_threads(const t_ilist *ilist,
*/
void split_vsites_over_threads(const t_ilist *ilist,
const t_mdatoms *mdatoms,
gmx_bool bLimitRange,
gmx_vsite_t *vsite);
const t_mdatoms *mdatoms,
gmx_bool bLimitRange,
gmx_vsite_t *vsite);
if (vsite != NULL)
{
/* Now we have updated mdatoms, we can do the last vsite bookkeeping */
if (vsite != NULL)
{
/* Now we have updated mdatoms, we can do the last vsite bookkeeping */
- split_vsites_over_threads(top_local->idef.il, mdatoms, FALSE, vsite);
+ split_vsites_over_threads(top_local->idef.il, top_local->idef.iparams,
+ mdatoms, FALSE, vsite);
}
void split_vsites_over_threads(const t_ilist *ilist,
}
void split_vsites_over_threads(const t_ilist *ilist,
const t_mdatoms *mdatoms,
gmx_bool bLimitRange,
gmx_vsite_t *vsite)
const t_mdatoms *mdatoms,
gmx_bool bLimitRange,
gmx_vsite_t *vsite)
vsite_atom_range = -1;
for (ftype = 0; ftype < F_NRE; ftype++)
{
vsite_atom_range = -1;
for (ftype = 0; ftype < F_NRE; ftype++)
{
- if ((interaction_function[ftype].flags & IF_VSITE) &&
- ftype != F_VSITEN)
+ if (interaction_function[ftype].flags & IF_VSITE)
- nral1 = 1 + NRAL(ftype);
- iat = ilist[ftype].iatoms;
- for (i = 0; i < ilist[ftype].nr; i += nral1)
- for (j = i+1; j < i+nral1; j++)
+ nral1 = 1 + NRAL(ftype);
+ iat = ilist[ftype].iatoms;
+ for (i = 0; i < ilist[ftype].nr; i += nral1)
- vsite_atom_range = max(vsite_atom_range, iat[j]);
+ for (j = i + 1; j < i + nral1; j++)
+ {
+ vsite_atom_range = max(vsite_atom_range, iat[j]);
+ }
+ }
+ }
+ else
+ {
+ int vs_ind_end;
+
+ iat = ilist[ftype].iatoms;
+
+ i = 0;
+ while (i < ilist[ftype].nr)
+ {
+ /* The 3 below is from 1+NRAL(ftype)=3 */
+ vs_ind_end = i + ip[iat[i]].vsiten.n*3;
+
+ vsite_atom_range = max(vsite_atom_range, iat[i+1]);
+ while (i < vs_ind_end)
+ {
+ vsite_atom_range = max(vsite_atom_range, iat[i+2]);
+ i += 3;
+ }
for (ftype = 0; ftype < F_NRE; ftype++)
{
for (ftype = 0; ftype < F_NRE; ftype++)
{
- if ((interaction_function[ftype].flags & IF_VSITE) &&
- ftype != F_VSITEN)
+ if (interaction_function[ftype].flags & IF_VSITE)
{
nral1 = 1 + NRAL(ftype);
inc = nral1;
{
nral1 = 1 + NRAL(ftype);
inc = nral1;
*/
if (ftype != F_VSITEN)
{
*/
if (ftype != F_VSITEN)
{
- for (j = i+2; j < i+nral1; j++)
+ for (j = i + 2; j < i + nral1; j++)
{
if (th_ind[iat[j]] != th)
{
{
if (th_ind[iat[j]] != th)
{
- inc = iat[i];
- for (j = i+2; j < i+inc; j += 3)
+ /* The 3 below is from 1+NRAL(ftype)=3 */
+ inc = ip[iat[i]].vsiten.n*3;
+ for (j = i + 2; j < i + inc; j += 3)
{
if (th_ind[iat[j]] != th)
{
{
if (th_ind[iat[j]] != th)
{
}
/* Copy this vsite to the thread data struct of thread th */
il_th = &vsite->tdata[th].ilist[ftype];
}
/* Copy this vsite to the thread data struct of thread th */
il_th = &vsite->tdata[th].ilist[ftype];
- for (j = i; j < i+inc; j++)
+ for (j = i; j < i + inc; j++)
{
il_th->iatoms[il_th->nr++] = iat[j];
}
{
il_th->iatoms[il_th->nr++] = iat[j];
}
gmx_incons("Can not use threads virtual sites combined with charge groups or particle decomposition");
}
gmx_incons("Can not use threads virtual sites combined with charge groups or particle decomposition");
}
- split_vsites_over_threads(top->idef.il, md, !DOMAINDECOMP(cr), vsite);
+ split_vsites_over_threads(top->idef.il, top->idef.iparams,
+ md, !DOMAINDECOMP(cr), vsite);