newparam->qangle.c[i]=old[i+1];
break;
case F_LINEAR_ANGLES:
- newparam->linangle.klinA = old[0];
- newparam->linangle.aA = old[1];
- newparam->linangle.klinB = old[2];
- newparam->linangle.aB = old[3];
+ newparam->linangle.aA = old[0];
+ newparam->linangle.klinA = old[1];
+ newparam->linangle.aB = old[2];
+ newparam->linangle.klinB = old[3];
break;
case F_ANGLES:
case F_BONDS:
memcpy(bt->param[bt->nr].c, b->c,sizeof(b->c));
memcpy(bt->param[bt->nr].a, b->a,sizeof(b->a));
memcpy(bt->param[bt->nr+1].c,b->c,sizeof(b->c));
-
+
+ /* The definitions of linear angles depend on the order of atoms,
+ * that means that for atoms i-j-k, with certain parameter a, the
+ * corresponding k-j-i angle will have parameter 1-a.
+ */
+ if (ftype == F_LINEAR_ANGLES)
+ {
+ bt->param[bt->nr+1].c[0] = 1-bt->param[bt->nr+1].c[0];
+ bt->param[bt->nr+1].c[2] = 1-bt->param[bt->nr+1].c[2];
+ }
+
for (j=0; (j < nral); j++)
{
bt->param[bt->nr+1].a[j] = b->a[nral-1-j];
"With options [TT]-lt[tt] and [TT]-dist[tt] the number of contacts",
"of all atoms in group 2 that are closer than a certain distance",
"to the center of mass of group 1 are plotted as a function of the time",
- "that the contact was continuously present.[PAR]",
+ "that the contact was continuously present. The [TT]-intra[tt] switch enables",
+ "calculations of intramolecular distances avoiding distance calculation to its",
+ "periodic images. For a proper function, the molecule in the input trajectory",
+ "should be whole (e.g. by preprocessing with [TT]trjconv -pbc[tt]) or a matching",
+ "topology should be provided. The [TT]-intra[tt] switch will only give",
+ "meaningful results for intramolecular and not intermolecular distances.[PAR]",
"Other programs that calculate distances are [TT]g_mindist[tt]",
"and [TT]g_bond[tt]."
};
rvec *com;
real *mass;
FILE *fp=NULL,*fplt=NULL;
- gmx_bool bCutoff,bPrintDist,bLifeTime;
+ gmx_bool bCutoff,bPrintDist,bLifeTime,bIntra=FALSE;
t_pbc *pbc;
int *contact_time=NULL,*ccount=NULL,ccount_nalloc=0,sum;
char buf[STRLEN];
static real cut=0;
- static t_pargs pa[] = {
+ t_pargs pa[] = {
+ { "-intra", FALSE, etBOOL, {&bIntra},
+ "Calculate distances without considering periodic boundaries, e.g. intramolecular." },
{ "-dist", FALSE, etREAL, {&cut},
"Print all atoms in group 2 closer than dist to the center of mass of group 1" }
};
/* write to output */
fprintf(fp,"%12.7f ",t);
for(g=0;(g<ngrps/2);g++) {
- if (pbc)
+ if (pbc && (!bIntra))
pbc_dx(pbc,com[2*g],com[2*g+1],dx);
else
rvec_sub(com[2*g],com[2*g+1],dx);
} else {
for(i=0;(i<isize[1]);i++) {
j=index[1][i];
- if (pbc)
+ if (pbc && (!bIntra))
pbc_dx(pbc,x[j],com[0],dx);
else
rvec_sub(x[j],com[0],dx);