3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Green Red Orange Magenta Azure Cyan Skyblue
43 #include "gmx_fatal.h"
55 void calc_prj(int natoms
,rvec xav
[],rvec x
[],rvec ev
[],real eprj
)
59 for(i
=0; (i
<natoms
); i
++) {
60 for(m
=0; (m
<DIM
); m
++)
61 x
[i
][m
]=xav
[i
][m
]+ev
[i
][m
]*eprj
;
65 void mkptrj(char *prop
,int nSel
,
66 int natoms
,rvec xav
[],int nframes
,
67 int nev
,rvec
**EV
,real
**evprj
,
68 int nca
,atom_id ca_index
[],atom_id bb_index
[],
69 t_atom atom
[],matrix box
)
73 double propje
,*pav
,*pav2
;
81 sprintf(buf
,"%s.trj1",prop
);
83 fprintf(out
,"Projection of %s on EigenVectors\n",prop
);
84 for(j
=0; (j
<nframes
); j
++) {
86 fprintf(stderr
,"\rFrame %d",j
);
87 for(i
=0; (i
<nev
); i
++) {
88 calc_prj(natoms
,xav
,xxx
,EV
[i
],evprj
[i
][j
]);
91 propje
=radius(NULL
,nca
,ca_index
,xxx
);
94 propje
=ahx_len(nca
,ca_index
,xxx
,box
);
97 propje
=twist(NULL
,nca
,ca_index
,xxx
);
100 propje
=ca_phi(nca
,ca_index
,xxx
);
103 propje
=dip(natoms
,bb_index
,xxx
,atom
);
106 gmx_fatal(FARGS
,"Not implemented");
109 pav2
[i
]+=propje
*propje
;
110 fprintf(out
,"%8.3f",propje
);
115 fprintf(stderr
,"\n");
116 for(i
=0; (i
<nev
); i
++) {
117 printf("ev %2d, average: %8.3f rms: %8.3f\n",
118 i
+1,pav
[i
]/nframes
,sqrt(pav2
[i
]/nframes
-sqr(pav
[i
]/nframes
)));
125 void proptrj(char *fngro
,char *fndat
,t_topology
*top
,t_pinp
*p
)
127 static char *ppp
[efhNR
] = {
128 "RAD", "TWIST", "RISE", "LEN", "NHX", "DIP", "RMS", "CPHI",
129 "RMSA", "PHI", "PSI", "HB3", "HB4", "HB5"
135 int natoms
,nca
,nSel
,nframes
,nev
;
137 atom_id
*ca_index
,*bb_index
;
143 nframes
= p
->nframes
;
148 evprj
=read_proj(nev
,nframes
,p
->base
);
150 get_coordnum(fngro
,&natoms
);
153 read_conf(fngro
,buf
,&natoms
,xav
,vav
,box
);
154 fprintf(stderr
,"Succesfully read average positions (%s)\n",buf
);
156 EV
=read_ev(fndat
,natoms
);
158 fprintf(stderr
,"Succesfully read eigenvectors\n");
161 for(i
=0; (i
<nev
); i
++)
163 snew(bb_index
,natoms
);
164 for(i
=0; (i
<natoms
); i
++)
166 snew(ca_index
,natoms
);
167 for(i
=nca
=0; (i
<natoms
); i
++)
168 if ((strcmp("CA",*(top
->atoms
.atomname
[i
])) == 0))
175 optim_radius(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
178 optim_rise(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
185 recombine(p
->recomb
,p
->gamma
,p
->nskip
,nframes
,nev
,natoms
,
186 EV
,evprj
,xav
,bb_index
);
189 mkptrj(prop
,nSel
,natoms
,xav
,nframes
,
190 nev
,EV
,evprj
,nca
,ca_index
,bb_index
,
191 top
->atoms
.atom
,box
);
194 gmx_fatal(FARGS
,"I Don't Know What to Do");
198 int main(int argc
,char *argv
[])
200 const char *desc
[] = {
203 t_manual man
= { asize(desc
),desc
,0,NULL
,NULL
,0,NULL
};
206 { efGRO
, "-c", "aver",FALSE
},
207 { efDAT
, "-d", "eigenvec", FALSE
},
208 { efTPX
, NULL
, NULL
, FALSE
},
209 { efDAT
, "-pi","pinp", FALSE
},
210 { efDAT
, "-po","poutp", FALSE
}
212 #define NFILE asize(fnm)
216 CopyRight(stderr
,argv
[0]);
217 parse_common_args(&argc
,argv
,PCA_CAN_VIEW
| PCA_CAN_TIME
,
218 NFILE
,fnm
,TRUE
,&man
);
220 top
=read_top(ftp2fn(efTPX
,NFILE
,fnm
));
221 init_debug("proptim.dbg",0);
223 read_inp(opt2fn("-pi",NFILE
,fnm
),opt2fn("-po",NFILE
,fnm
),p
);
225 proptrj(ftp2fn(efGRO
,NFILE
,fnm
),ftp2fn(efDAT
,NFILE
,fnm
),top
,p
);