Project

General

Profile

g_rmsf-correct-rmsdev_prev-feature.patch

Manuel Luitz, 03/08/2012 05:47 PM

View differences:

src/tools/gmx_rmsf.c
188 188
    "temperature factors are present in the [TT].pdb[tt] file.[PAR]",
189 189
    "With option [TT]-dir[tt] the average MSF (3x3) matrix is diagonalized.",
190 190
    "This shows the directions in which the atoms fluctuate the most and",
191
    "the least."
191
    "the least.[PAR]",
192
    "With option [TT]-prev[tt] the previous frame of a trajectory will be used",
193
    "as reference frame."
192 194
  };
193
  static gmx_bool bRes=FALSE,bAniso=FALSE,bdevX=FALSE,bFit=TRUE;
195
  static gmx_bool bRes=FALSE,bAniso=FALSE,bdevX=FALSE,bFit=TRUE,bPrev=FALSE;
194 196
  t_pargs pargs[] = { 
195 197
    { "-res", FALSE, etBOOL, {&bRes},
196 198
      "Calculate averages for each residue" },
197 199
    { "-aniso",FALSE, etBOOL, {&bAniso},
198 200
      "Compute anisotropic termperature factors" },
199 201
    { "-fit", FALSE, etBOOL, {&bFit},
200
      "Do a least squares superposition before computing RMSF. Without this you must make sure that the reference structure and the trajectory match." }
202
      "Do a least squares superposition before computing RMSF. Without this you must make sure that the reference structure and the trajectory match." },
203
    { "-prev",FALSE, etBOOL, {&bPrev},
204
      "Use previous frame as reference" }
201 205
  };
202 206
  int          natom;
203 207
  int          step,nre,natoms,i,g,m,teller=0;
......
217 221
  char         buf[256];
218 222
  const char   *label;
219 223
  char         title[STRLEN];
224
  t_pbc        pbc;
225
  rvec         dx;
220 226
  
221 227
  FILE         *fp;               /* the graphics file */
222 228
  const char   *devfn,*dirfn;
......
338 344
    
339 345
    if (devfn) {
340 346
      /* Calculate RMS Deviation */
347
      set_pbc(&pbc,ePBC,box);
341 348
      for(i=0;(i<isize);i++) {
342
	aid = index[i];
343
	for(d=0;(d<DIM);d++) {
344
	  rmsd_x[i][d] += sqr(x[aid][d]-xref[aid][d]);
345
	}
349
        aid = index[i];
350
        pbc_dx( &pbc, x[aid], xref[aid], dx);
351
        for(d=0;(d<DIM);d++) {
352
          rmsd_x[i][d] += sqr(dx[d]);
353
        }
346 354
      }
347
    } 
355
    }
356

  
357
    /* Copy coordinates to xref for next iteration */
358
    if (bPrev){
359
      for(i=0;i<natom;i++){
360
        for(d=0;(d<DIM);d++) {
361
          xref[i][d] = x[i][d];
362
        }
363
      }
364
    }
365

  
348 366
    count += 1.0;
349 367
    teller++;
350 368
  } while(read_next_x(oenv,status,&t,natom,x,box));