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_orise_c
= "$Id$";
46 void optimize(FILE *fp
,int nx
,t_propfunc
*f
,t_pinp
*p
)
53 for(i
=0; (i
<nx
); i
++) {
60 do_mc(fp
,nx
,fact
,p
->step
,p
->v0
,p
->tol
,p
->nsteps
,f
);
62 fprintf(fp
,"MC Done\n");
63 fprintf(fp
,"Components are:\n");
65 for(i
=0; (i
<nx
); i
++) {
66 fprintf(fp
,"EV %5d: Fac: %8.3f\n",i
,fact
[i
]);
69 fprintf(fp
,"Norm of vector: %8.3f\n",sqrt(sf
));
75 static int nca
,natoms
,nframes
;
76 static atom_id
*ca_index
;
78 real
risefunc(int nx
,real x
[])
80 static rvec
*xxx
=NULL
;
90 for(j
=0; (j
<nframes
); j
++) {
91 /* Make a structure, we only have to do Z */
92 for(i
=0; (i
<nca
); i
++) {
97 for(n
=0; (n
<nx
); n
++) {
98 /*cx+=EV[n][ai][XX]*x[n]*evprj[n][j];
99 cy+=EV[n][ai][YY]*x[n]*evprj[n][j];*/
100 cz
+=EV
[n
][ai
][ZZ
]*x
[n
]*evprj
[n
][j
];
106 rrr
= rise(nca
,ca_index
,xxx
);
111 rrr
=sqrt(rav2
/nframes
-rav
*rav
);
116 real
radfunc(int nx
,real x
[])
118 static rvec
*xxx
=NULL
;
128 for(j
=0; (j
<nframes
); j
++) {
129 /* Make a structure, we only have to do X & Y */
130 for(i
=0; (i
<nca
); i
++) {
135 for(n
=0; (n
<nx
); n
++) {
136 cx
+=EV
[n
][ai
][XX
]*x
[n
]*evprj
[n
][j
];
137 cy
+=EV
[n
][ai
][YY
]*x
[n
]*evprj
[n
][j
];
138 cz
+=EV
[n
][ai
][ZZ
]*x
[n
]*evprj
[n
][j
];
144 rrr
= radius(NULL
,nca
,ca_index
,xxx
);
149 rrr
=sqrt(rav2
/nframes
-rav
*rav
);
154 void init_optim(int nx
,rvec
*xxav
,rvec
**EEV
,
155 real
**eevprj
,int nnatoms
,
156 int nnca
,atom_id
*cca_index
,
163 nframes
= p
->nframes
;
165 ca_index
= cca_index
;
168 void optim_rise(int nx
,rvec
*xxav
,rvec
**EEV
,
169 real
**eevprj
,int nnatoms
,
170 int nnca
,atom_id
*cca_index
,
175 fp
= ffopen("rise.log","w");
176 init_optim(nx
,xxav
,EEV
,eevprj
,nnatoms
,nnca
,cca_index
,p
);
177 optimize(fp
,nx
,risefunc
,p
);
181 void optim_radius(int nx
,rvec
*xxav
,rvec
**EEV
,
182 real
**eevprj
,int nnatoms
,
183 int nnca
,atom_id
*cca_index
,
188 fp
= ffopen("radius.log","w");
190 init_optim(nx
,xxav
,EEV
,eevprj
,nnatoms
,nnca
,cca_index
,p
);
191 optimize(fp
,nx
,radfunc
,p
);