4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
34 * Green Red Orange Magenta Azure Cyan Skyblue
52 void calc_prj(int natoms
,rvec xav
[],rvec x
[],rvec ev
[],real eprj
)
56 for(i
=0; (i
<natoms
); i
++) {
57 for(m
=0; (m
<DIM
); m
++)
58 x
[i
][m
]=xav
[i
][m
]+ev
[i
][m
]*eprj
;
62 void mkptrj(char *prop
,int nSel
,
63 int natoms
,rvec xav
[],int nframes
,
64 int nev
,rvec
**EV
,real
**evprj
,
65 int nca
,atom_id ca_index
[],atom_id bb_index
[],
66 t_atom atom
[],matrix box
)
70 double propje
,*pav
,*pav2
;
78 sprintf(buf
,"%s.trj1",prop
);
80 fprintf(out
,"Projection of %s on EigenVectors\n",prop
);
81 for(j
=0; (j
<nframes
); j
++) {
83 fprintf(stderr
,"\rFrame %d",j
);
84 for(i
=0; (i
<nev
); i
++) {
85 calc_prj(natoms
,xav
,xxx
,EV
[i
],evprj
[i
][j
]);
88 propje
=radius(NULL
,nca
,ca_index
,xxx
);
91 propje
=ahx_len(nca
,ca_index
,xxx
,box
);
94 propje
=twist(NULL
,nca
,ca_index
,xxx
);
97 propje
=ca_phi(nca
,ca_index
,xxx
);
100 propje
=dip(natoms
,bb_index
,xxx
,atom
);
103 fatal_error(0,"Not implemented");
106 pav2
[i
]+=propje
*propje
;
107 fprintf(out
,"%8.3f",propje
);
112 fprintf(stderr
,"\n");
113 for(i
=0; (i
<nev
); i
++) {
114 printf("ev %2d, average: %8.3f rms: %8.3f\n",
115 i
+1,pav
[i
]/nframes
,sqrt(pav2
[i
]/nframes
-sqr(pav
[i
]/nframes
)));
122 void proptrj(char *fngro
,char *fndat
,t_topology
*top
,t_pinp
*p
)
124 static char *ppp
[efhNR
] = {
125 "RAD", "TWIST", "RISE", "LEN", "NHX", "DIP", "RMS", "CPHI",
126 "RMSA", "PHI", "PSI", "HB3", "HB4", "HB5"
132 int natoms
,nca
,nSel
,nframes
,nev
;
134 atom_id
*ca_index
,*bb_index
;
140 nframes
= p
->nframes
;
145 evprj
=read_proj(nev
,nframes
,p
->base
);
147 get_coordnum(fngro
,&natoms
);
150 read_conf(fngro
,buf
,&natoms
,xav
,vav
,box
);
151 fprintf(stderr
,"Succesfully read average positions (%s)\n",buf
);
153 EV
=read_ev(fndat
,natoms
);
155 fprintf(stderr
,"Succesfully read eigenvectors\n");
158 for(i
=0; (i
<nev
); i
++)
160 snew(bb_index
,natoms
);
161 for(i
=0; (i
<natoms
); i
++)
163 snew(ca_index
,natoms
);
164 for(i
=nca
=0; (i
<natoms
); i
++)
165 if ((strcmp("CA",*(top
->atoms
.atomname
[i
])) == 0))
172 optim_radius(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
175 optim_rise(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
182 recombine(p
->recomb
,p
->gamma
,p
->nskip
,nframes
,nev
,natoms
,
183 EV
,evprj
,xav
,bb_index
);
186 mkptrj(prop
,nSel
,natoms
,xav
,nframes
,
187 nev
,EV
,evprj
,nca
,ca_index
,bb_index
,
188 top
->atoms
.atom
,box
);
191 fatal_error(0,"I Don't Know What to Do");
195 int main(int argc
,char *argv
[])
197 static char *desc
[] = {
200 t_manual man
= { asize(desc
),desc
,0,NULL
,NULL
,0,NULL
};
203 { efGRO
, "-c", "aver",FALSE
},
204 { efDAT
, "-d", "eigenvec", FALSE
},
205 { efTPX
, NULL
, NULL
, FALSE
},
206 { efDAT
, "-pi","pinp", FALSE
},
207 { efDAT
, "-po","poutp", FALSE
}
209 #define NFILE asize(fnm)
213 CopyRight(stderr
,argv
[0]);
214 parse_common_args(&argc
,argv
,PCA_CAN_VIEW
| PCA_CAN_TIME
,
215 NFILE
,fnm
,TRUE
,&man
);
217 top
=read_top(ftp2fn(efTPX
,NFILE
,fnm
));
218 init_debug("proptim.dbg",0);
220 read_inp(opt2fn("-pi",NFILE
,fnm
),opt2fn("-po",NFILE
,fnm
),p
);
222 proptrj(ftp2fn(efGRO
,NFILE
,fnm
),ftp2fn(efDAT
,NFILE
,fnm
),top
,p
);