static void low_get_pull_coord_dr(const t_pull *pull, const t_pull_coord *pcrd, const t_pbc *pbc, double t, dvec xg, dvec xref, double max_dist2, dvec dr) { const t_pull_group *pgrp0, *pgrp1; int m; dvec xrefr, dref = {0, 0, 0}; double dr2; pgrp0 = &pull->group[pcrd->group[0]]; pgrp1 = &pull->group[pcrd->group[1]]; /* Only the first group can be an absolute reference, in that case nat=0 */ if (pgrp0->nat == 0) { for (m = 0; m < DIM; m++) { xref[m] = pcrd->origin[m]; } } copy_dvec(xref, xrefr); if (pull->eGeom == epullgDIRPBC) { for (m = 0; m < DIM; m++) { dref[m] = (pcrd->init + pcrd->rate*t)*pcrd->vec[m]; } /* Add the reference position, so we use the correct periodic image */ dvec_inc(xrefr, dref); } pbc_dx_d(pbc, xg, xrefr, dr); dr2 = 0; for (m = 0; m < DIM; m++) { dr[m] *= pull->dim[m]; dr2 += dr[m]*dr[m]; } if (max_dist2 >= 0 && dr2 > 0.98*0.98*max_dist2) { gmx_fatal(FARGS, "Distance between pull groups %d and %d (%f nm) is larger than 0.49 times the box size (%f)", pcrd->group[0], pcrd->group[1], sqrt(dr2), sqrt(max_dist2)); } if (pull->eGeom == epullgDIRPBC) { dvec_inc(dr, dref); } }
static void get_pullgrps_dr(const t_pull *pull,const t_pbc *pbc,int g,double t, dvec xg,dvec xref,double max_dist2, dvec dr) { t_pullgrp *pref,*pgrp; int m; dvec xrefr,dref={0,0,0}; double dr2; pgrp = &pull->grp[g]; copy_dvec(xref,xrefr); if (pull->eGeom == epullgDIRPBC) { for(m=0; m<DIM; m++) { dref[m] = (pgrp->init[0] + pgrp->rate*t)*pull->grp[g].vec[m]; } /* Add the reference position, so we use the correct periodic image */ dvec_inc(xrefr,dref); } pbc_dx_d(pbc, xg, xrefr, dr); dr2 = 0; for(m=0; m<DIM; m++) { dr[m] *= pull->dim[m]; dr2 += dr[m]*dr[m]; } if (max_dist2 >= 0 && dr2 > 0.98*0.98*max_dist2) { gmx_fatal(FARGS,"Distance of pull group %d (%f nm) is larger than 0.49 times the box size (%f)",g,sqrt(dr2),sqrt(max_dist2)); } if (pull->eGeom == epullgDIRPBC) { dvec_inc(dr,dref); } }