changed reading hint
[gromacs/adressmacs.git] / src / tools / readev.c
blob6dca12d6375d7425e52c36417d3d98d29f2e16fa
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_readev_c = "$Id$";
31 #include "readev.h"
32 #include "futil.h"
33 #include "smalloc.h"
35 rvec **read_ev(char *fn,int natoms)
37 FILE *in;
38 rvec **ev;
39 double xx,yy,zz;
40 int i,j,k,ei,ai;
42 snew(ev,DIM*natoms);
43 for(i=0; (i<DIM*natoms); i++)
44 snew(ev[i],natoms);
45 in=ffopen(fn,"r");
46 for(i=0; (i<DIM*natoms); i++) {
47 for(j=k=0; (j<natoms); j++) {
48 fscanf(in,"%d%d%lf%lf%lf",&ei,&ai,&xx,&yy,&zz);
49 ev[i][j][XX]=xx;
50 ev[i][j][YY]=yy;
51 ev[i][j][ZZ]=zz;
54 fclose(in);
56 return ev;
59 real **read_proj(int nev,int nframes,char *base)
61 FILE *in;
62 real **evprj;
63 char buf[256];
64 int i,j,d;
65 double x;
67 snew(evprj,nev);
68 for(i=0; (i<nev); i++) {
69 fprintf(stderr,"\rEV %d",i);
70 snew(evprj[i],nframes);
71 sprintf(buf,"%s%d",base,i+1);
72 in=ffopen(buf,"r");
73 for(j=0; (j<nframes); j++) {
74 fscanf(in,"%d%lf",&d,&x);
75 evprj[i][j]=x;
77 fclose(in);
79 fprintf(stderr,"\rSuccesfully read eigenvector projections\n");
81 return evprj;