4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
30 * Green Red Orange Magenta Azure Cyan Skyblue
49 void calc_prj(int natoms
,rvec xav
[],rvec x
[],rvec ev
[],real eprj
)
53 for(i
=0; (i
<natoms
); i
++) {
54 for(m
=0; (m
<DIM
); m
++)
55 x
[i
][m
]=xav
[i
][m
]+ev
[i
][m
]*eprj
;
59 void mkptrj(char *prop
,int nSel
,
60 int natoms
,rvec xav
[],int nframes
,
61 int nev
,rvec
**EV
,real
**evprj
,
62 int nca
,atom_id ca_index
[],atom_id bb_index
[],
63 t_atom atom
[],matrix box
)
67 double propje
,*pav
,*pav2
;
75 sprintf(buf
,"%s.trj1",prop
);
77 fprintf(out
,"Projection of %s on EigenVectors\n",prop
);
78 for(j
=0; (j
<nframes
); j
++) {
80 fprintf(stderr
,"\rFrame %d",j
);
81 for(i
=0; (i
<nev
); i
++) {
82 calc_prj(natoms
,xav
,xxx
,EV
[i
],evprj
[i
][j
]);
85 propje
=radius(NULL
,nca
,ca_index
,xxx
);
88 propje
=ahx_len(nca
,ca_index
,xxx
,box
);
91 propje
=twist(NULL
,nca
,ca_index
,xxx
);
94 propje
=ca_phi(nca
,ca_index
,xxx
);
97 propje
=dip(natoms
,bb_index
,xxx
,atom
);
100 fatal_error(0,"Not implemented");
103 pav2
[i
]+=propje
*propje
;
104 fprintf(out
,"%8.3f",propje
);
109 fprintf(stderr
,"\n");
110 for(i
=0; (i
<nev
); i
++) {
111 printf("ev %2d, average: %8.3f rms: %8.3f\n",
112 i
+1,pav
[i
]/nframes
,sqrt(pav2
[i
]/nframes
-sqr(pav
[i
]/nframes
)));
119 void proptrj(char *fngro
,char *fndat
,t_topology
*top
,t_pinp
*p
)
121 static char *ppp
[efhNR
] = {
122 "RAD", "TWIST", "RISE", "LEN", "NHX", "DIP", "RMS", "CPHI",
123 "RMSA", "PHI", "PSI", "HB3", "HB4", "HB5"
129 int natoms
,nca
,nSel
,nframes
,nev
;
131 atom_id
*ca_index
,*bb_index
;
137 nframes
= p
->nframes
;
142 evprj
=read_proj(nev
,nframes
,p
->base
);
144 get_coordnum(fngro
,&natoms
);
147 read_conf(fngro
,buf
,&natoms
,xav
,vav
,box
);
148 fprintf(stderr
,"Succesfully read average positions (%s)\n",buf
);
150 EV
=read_ev(fndat
,natoms
);
152 fprintf(stderr
,"Succesfully read eigenvectors\n");
155 for(i
=0; (i
<nev
); i
++)
157 snew(bb_index
,natoms
);
158 for(i
=0; (i
<natoms
); i
++)
160 snew(ca_index
,natoms
);
161 for(i
=nca
=0; (i
<natoms
); i
++)
162 if ((strcmp("CA",*(top
->atoms
.atomname
[i
])) == 0))
169 optim_radius(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
172 optim_rise(nev
,xav
,EV
,evprj
,natoms
,nca
,ca_index
,p
);
179 recombine(p
->recomb
,p
->gamma
,p
->nskip
,nframes
,nev
,natoms
,
180 EV
,evprj
,xav
,bb_index
);
183 mkptrj(prop
,nSel
,natoms
,xav
,nframes
,
184 nev
,EV
,evprj
,nca
,ca_index
,bb_index
,
185 top
->atoms
.atom
,box
);
188 fatal_error(0,"I Don't Know What to Do");
192 int main(int argc
,char *argv
[])
194 static char *desc
[] = {
197 t_manual man
= { asize(desc
),desc
,0,NULL
,NULL
,0,NULL
};
200 { efGRO
, "-c", "aver",FALSE
},
201 { efDAT
, "-d", "eigenvec", FALSE
},
202 { efTPX
, NULL
, NULL
, FALSE
},
203 { efDAT
, "-pi","pinp", FALSE
},
204 { efDAT
, "-po","poutp", FALSE
}
206 #define NFILE asize(fnm)
210 CopyRight(stderr
,argv
[0]);
211 parse_common_args(&argc
,argv
,PCA_CAN_VIEW
| PCA_CAN_TIME
,
212 NFILE
,fnm
,TRUE
,&man
);
214 top
=read_top(ftp2fn(efTPX
,NFILE
,fnm
));
215 init_debug("proptim.dbg",0);
217 read_inp(opt2fn("-pi",NFILE
,fnm
),opt2fn("-po",NFILE
,fnm
),p
);
219 proptrj(ftp2fn(efGRO
,NFILE
,fnm
),ftp2fn(efDAT
,NFILE
,fnm
),top
,p
);