4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
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
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_proptim_c
= "$Id$";
47 void calc_prj(int natoms
,rvec xav
[],rvec x
[],rvec ev
[],real eprj
)
51 for(i
=0; (i
<natoms
); i
++) {
52 for(m
=0; (m
<DIM
); m
++)
53 x
[i
][m
]=xav
[i
][m
]+ev
[i
][m
]*eprj
;
57 void mkptrj(char *prop
,int nSel
,
58 int natoms
,rvec xav
[],int nframes
,
59 int nev
,rvec
**EV
,real
**evprj
,
60 int nca
,atom_id ca_index
[],atom_id bb_index
[],
61 t_atom atom
[],matrix box
)
65 double propje
,*pav
,*pav2
;
73 sprintf(buf
,"%s.trj1",prop
);
75 fprintf(out
,"Projection of %s on EigenVectors\n",prop
);
76 for(j
=0; (j
<nframes
); j
++) {
78 fprintf(stderr
,"\rFrame %d",j
);
79 for(i
=0; (i
<nev
); i
++) {
80 calc_prj(natoms
,xav
,xxx
,EV
[i
],evprj
[i
][j
]);
83 propje
=radius(NULL
,nca
,ca_index
,xxx
);
86 propje
=ahx_len(nca
,ca_index
,xxx
,box
);
89 propje
=twist(NULL
,nca
,ca_index
,xxx
);
92 propje
=ca_phi(nca
,ca_index
,xxx
);
95 propje
=dip(natoms
,bb_index
,xxx
,atom
);
98 fatal_error(0,"Not implemented");
101 pav2
[i
]+=propje
*propje
;
102 fprintf(out
,"%8.3f",propje
);
107 fprintf(stderr
,"\n");
108 for(i
=0; (i
<nev
); i
++) {
109 printf("ev %2d, average: %8.3f rms: %8.3f\n",
110 i
+1,pav
[i
]/nframes
,sqrt(pav2
[i
]/nframes
-sqr(pav
[i
]/nframes
)));
117 void proptrj(char *fngro
,char *fndat
,t_topology
*top
,t_pinp
*p
)
119 static char *ppp
[efhNR
] = {
120 "RAD", "TWIST", "RISE", "LEN", "NHX", "DIP", "RMS", "CPHI",
121 "RMSA", "PHI", "PSI", "HB3", "HB4", "HB5"
127 int natoms
,nca
,nSel
,nframes
,nev
;
129 atom_id
*ca_index
,*bb_index
;
135 nframes
= p
->nframes
;
140 evprj
=read_proj(nev
,nframes
,p
->base
);
142 get_coordnum(fngro
,&natoms
);
145 read_conf(fngro
,buf
,&natoms
,xav
,vav
,box
);
146 fprintf(stderr
,"Succesfully read average positions (%s)\n",buf
);
148 EV
=read_ev(fndat
,natoms
);
150 fprintf(stderr
,"Succesfully read eigenvectors\n");
153 for(i
=0; (i
<nev
); i
++)
155 snew(bb_index
,natoms
);
156 for(i
=0; (i
<natoms
); i
++)
158 snew(ca_index
,natoms
);
159 for(i
=nca
=0; (i
<natoms
); i
++)
160 if ((strcmp("CA",*(top
->atoms
.atomname
[i
])) == 0))
167 optim_radius(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
170 optim_rise(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
177 recombine(p
->recomb
,p
->gamma
,p
->nskip
,nframes
,nev
,natoms
,
178 EV
,evprj
,xav
,bb_index
);
181 mkptrj(prop
,nSel
,natoms
,xav
,nframes
,
182 nev
,EV
,evprj
,nca
,ca_index
,bb_index
,
183 top
->atoms
.atom
,box
);
186 fatal_error(0,"I Don't Know What to Do");
190 int main(int argc
,char *argv
[])
192 static char *desc
[] = {
195 t_manual man
= { asize(desc
),desc
,0,NULL
,NULL
,0,NULL
};
198 { efGRO
, "-c", "aver",FALSE
},
199 { efDAT
, "-d", "eigenvec", FALSE
},
200 { efTPX
, NULL
, NULL
, FALSE
},
201 { efDAT
, "-pi","pinp", FALSE
},
202 { efDAT
, "-po","poutp", FALSE
}
204 #define NFILE asize(fnm)
208 CopyRight(stderr
,argv
[0]);
209 parse_common_args(&argc
,argv
,PCA_CAN_VIEW
| PCA_CAN_TIME
,
210 NFILE
,fnm
,TRUE
,&man
);
212 top
=read_top(ftp2fn(efTPX
,NFILE
,fnm
));
213 init_debug("proptim.dbg",0);
215 read_inp(opt2fn("-pi",NFILE
,fnm
),opt2fn("-po",NFILE
,fnm
),p
);
217 proptrj(ftp2fn(efGRO
,NFILE
,fnm
),ftp2fn(efDAT
,NFILE
,fnm
),top
,p
);