changed reading hint
[gromacs/adressmacs.git] / src / tools / residues.c
blobbbf025ae6ff4a6a73104454c4b6e6bd835065578
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
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
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_residues_c = "$Id$";
31 /**********************************************************
33 * A R G A N I N E
35 **********************************************************/
36 /* Notice for both 15-routines: */
37 /* CD-HHX1 corresponds to lb and CD-HHX2 corresponds to ub */
39 static void arg_15_CDHH1(int ai,int aj,int ak,int al,int am,
40 t_ilist ilist[],t_iparams iparams[],
41 real *lb,real *ub,t_atoms *atoms)
43 /* Returns the length corresponding to a 1-5 distance */
44 real rij,rjk,rkl,rlm,rik,rkm,rim;
45 real th1,th2,th3,thikj,thmkl;
46 real half_pi = M_PI*0.5;
48 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
49 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
50 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
51 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
52 th1 = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
53 th2 = lookup_angle(aj,ak,al,ilist,iparams,atoms);
54 th3 = lookup_angle(ak,al,am,ilist,iparams,atoms);
56 /* Compute distance from i to k using law of cosines */
57 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(th1));
59 /* Compute distance from k to m using law of cosines */
60 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(th3));
62 /* Compute angle th21 using law of sines */
63 thikj = asin(rij*sin(th1)/rik);
65 /* Compute th99 using law of sines */
66 thmkl = asin(rlm*sin(th3)/rkm);
68 /* Compute cis length using law of cosines */
69 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(th2-thikj-thmkl));
71 /* Compute trans length using law of cosines */
72 *ub = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(th2-thikj+thmkl));
75 static void arg_15_CDHH2(int ai,int aj,int ak,int al,int am,
76 t_ilist ilist[],t_iparams iparams[],
77 real *lb,real *ub,t_atoms *atoms)
79 /* Returns the length corresponding to a 1-5 distance */
80 real rij,rjk,rkl,rlm,rik,rkm,rim;
81 real th1,th2,th3,thikj,thmkl;
82 real half_pi = M_PI*0.5;
84 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
85 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
86 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
87 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
88 th1 = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
89 th2 = lookup_angle(aj,ak,al,ilist,iparams,atoms);
90 th3 = lookup_angle(ak,al,am,ilist,iparams,atoms);
92 /* Compute distance from i to k using law of cosines */
93 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(th1));
95 /* Compute distance from k to m using law of cosines */
96 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(th3));
98 /* Compute angle th99 using law of sines */
99 thikj = asin(rij*sin(th1)/rik);
101 /* Compute th21 using law of sines */
102 thmkl = asin(rlm*sin(th3)/rkm);
104 /* Compute cis length using law of cosines */
105 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(th2+thikj-thmkl));
107 /* Compute trans length using law of cosines */
108 *ub = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(th2+thikj+thmkl));
112 void arg (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
113 real arg_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
115 int natoms,ndist,i,j,q,logg[12],residnr,oldresidnr,n12dist,n13dist,n14dist,
116 n15dist,nVdist;
117 real blen,lb,ub,angle;
119 natoms= atoms->nr;
120 ndist = 0;
121 n12dist = 0;
122 n13dist = 0;
123 n14dist = 0;
124 n15dist = 0;
125 nVdist = 0;
126 residnr = -1;
127 oldresidnr=-1;
129 for (i=0; (i<natoms); i++) {
130 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"ARG") == 0) {
131 oldresidnr=residnr;
132 residnr=atoms->atom[i].resnr;
133 logg[11]=0;
134 if ( oldresidnr == residnr ) {
135 continue;
137 j=i;
138 while ((atoms->atom[j].resnr) == residnr ) {
139 if ( strcmp((*atoms->atomname[j]),"NE") == 0) {
140 logg[11]++;
141 logg[0]=j;
143 else if ( strcmp((*atoms->atomname[j]),"HE") == 0) {
144 logg[11]++;
145 logg[1]=j;
147 else if ( strcmp((*atoms->atomname[j]),"CZ") == 0) {
148 logg[11]++;
149 logg[2]=j;
151 else if ( strcmp((*atoms->atomname[j]),"NH1") == 0) {
152 logg[11]++;
153 logg[3]=j;
155 else if ( strcmp((*atoms->atomname[j]),"HH11") == 0) {
156 logg[11]++;
157 logg[4]=j;
159 else if ( strcmp((*atoms->atomname[j]),"HH12") == 0) {
160 logg[11]++;
161 logg[5]=j;
163 else if ( strcmp((*atoms->atomname[j]),"NH2") == 0) {
164 logg[11]++;
165 logg[6]=j;
167 else if ( strcmp((*atoms->atomname[j]),"HH21") == 0) {
168 logg[11]++;
169 logg[7]=j;
171 else if ( strcmp((*atoms->atomname[j]),"HH22") == 0) {
172 logg[11]++;
173 logg[8]=j;
175 else if ( strcmp((*atoms->atomname[j]),"CD") == 0) {
176 logg[11]++;
177 logg[9]=j;
179 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
180 logg[11]++;
181 logg[10]=j;
183 if ( ((logg[11] == 10) && !bVir) || ((logg[11] == 11) && bVir) ) {
184 break;
186 j++;
188 if ( ((logg[11] == 10) && !bVir) || ((logg[11] == 11) && bVir) ) {
190 if ((logg[11] == 10) && !bVir) {
191 fprintf(log,"logg (arg) = %d %d %d %d %d %d %d %d %d %d\n",logg[0],
192 logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],logg[7],logg[8],
193 logg[9]);
195 else if ((logg[11] == 11) && bVir) {
196 fprintf(log,"logg (arg) = %d %d %d %d %d %d %d %d %d %d %d\n",logg[0],
197 logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],logg[7],logg[8],
198 logg[9],logg[10]);
201 /*SETDISTANCE for NE and HH12 (logg[0]&logg[5]) (transdihedral)*/
202 pdih_lengths(logg[0],logg[2],logg[3],logg[5],ilist,iparams,&lb,&blen,
203 atoms);
204 lb=(1.0-arg_margin)*blen;
205 ub=(1.0+arg_margin)*blen;
206 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
207 (!dist_set(d,natoms,logg[0],logg[5]))) {
208 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
209 ndist++;
210 n14dist++;
212 /*SETDISTANCE for NE and HH22 (logg[0]&logg[8]) (transdihedral)*/
213 pdih_lengths(logg[0],logg[2],logg[6],logg[8],ilist,iparams,&lb,&blen,
214 atoms);
215 lb=(1.0-arg_margin)*blen;
216 ub=(1.0+arg_margin)*blen;
217 if (((weight[logg[0]] != 0.0) || (weight[logg[8]] != 0.0)) &&
218 (!dist_set(d,natoms,logg[0],logg[8]))) {
219 set_dist(d,natoms,logg[0],logg[8],lb,ub,blen);
220 ndist++;
221 n14dist++;
223 /*SETDISTANCE for HE and NH1 (logg[1]&logg[3]) (transdihedral)*/
224 pdih_lengths(logg[1],logg[0],logg[2],logg[3],ilist,iparams,&lb,&blen,
225 atoms);
226 lb=(1.0-arg_margin)*blen;
227 ub=(1.0+arg_margin)*blen;
228 if (((weight[logg[1]] != 0.0) || (weight[logg[3]] != 0.0)) &&
229 (!dist_set(d,natoms,logg[1],logg[3]))) {
230 set_dist(d,natoms,logg[1],logg[3],lb,ub,blen);
231 ndist++;
232 n14dist++;
234 /*SETDISTANCE for HH21 and NH1 (logg[7]&logg[3]) (transdihedral)*/
235 pdih_lengths(logg[7],logg[6],logg[2],logg[3],ilist,iparams,&lb,&blen,
236 atoms);
237 lb=(1.0-arg_margin)*blen;
238 ub=(1.0+arg_margin)*blen;
239 if (((weight[logg[7]] != 0.0) || (weight[logg[3]] != 0.0)) &&
240 (!dist_set(d,natoms,logg[7],logg[3]))) {
241 set_dist(d,natoms,logg[7],logg[3],lb,ub,blen);
242 ndist++;
243 n14dist++;
245 /*SETDISTANCE for HH11 and NH2 (logg[4]&logg[6]) (transdihedral)*/
246 pdih_lengths(logg[4],logg[3],logg[2],logg[6],ilist,iparams,&lb,&blen,
247 atoms);
248 lb=(1.0-arg_margin)*blen;
249 ub=(1.0+arg_margin)*blen;
250 if (((weight[logg[4]] != 0.0) || (weight[logg[6]] != 0.0)) &&
251 (!dist_set(d,natoms,logg[4],logg[6]))) {
252 set_dist(d,natoms,logg[4],logg[6],lb,ub,blen);
253 ndist++;
254 n14dist++;
256 /*SETDISTANCE for CD and NH2 (logg[9]&logg[6]) (transdihedral)*/
257 pdih_lengths(logg[9],logg[0],logg[2],logg[6],ilist,iparams,&lb,&blen,
258 atoms);
259 lb=(1.0-arg_margin)*blen;
260 ub=(1.0+arg_margin)*blen;
261 if (((weight[logg[9]] != 0.0) || (weight[logg[6]] != 0.0)) &&
262 (!dist_set(d,natoms,logg[9],logg[6]))) {
263 set_dist(d,natoms,logg[9],logg[6],lb,ub,blen);
264 ndist++;
265 n14dist++;
267 /*SETDISTANCE for CD and NH1 (logg[9]&logg[3]) (cisdihedral)*/
268 pdih_lengths(logg[9],logg[0],logg[2],logg[3],ilist,iparams,&blen,&ub,
269 atoms);
270 lb=(1.0-arg_margin)*blen;
271 ub=(1.0+arg_margin)*blen;
272 if (((weight[logg[9]] != 0.0) || (weight[logg[3]] != 0.0)) &&
273 (!dist_set(d,natoms,logg[9],logg[3]))) {
274 set_dist(d,natoms,logg[9],logg[3],lb,ub,blen);
275 ndist++;
276 n14dist++;
278 /*SETDISTANCE for HH12 and NH2 (logg[5]&logg[6]) (cisdihedral)*/
279 pdih_lengths(logg[5],logg[3],logg[2],logg[6],ilist,iparams,&blen,&ub,
280 atoms);
281 lb=(1.0-arg_margin)*blen;
282 ub=(1.0+arg_margin)*blen;
283 if (((weight[logg[5]] != 0.0) || (weight[logg[6]] != 0.0)) &&
284 (!dist_set(d,natoms,logg[5],logg[6]))) {
285 set_dist(d,natoms,logg[5],logg[6],lb,ub,blen);
286 ndist++;
287 n14dist++;
289 /*SETDISTANCE for HH22 and NH1 (logg[8]&logg[3]) (cisdihedral)*/
290 pdih_lengths(logg[8],logg[6],logg[2],logg[3],ilist,iparams,&blen,&ub,
291 atoms);
292 lb=(1.0-arg_margin)*blen;
293 ub=(1.0+arg_margin)*blen;
294 if (((weight[logg[8]] != 0.0) || (weight[logg[3]] != 0.0)) &&
295 (!dist_set(d,natoms,logg[8],logg[3]))) {
296 set_dist(d,natoms,logg[8],logg[3],lb,ub,blen);
297 ndist++;
298 n14dist++;
300 /*SETDISTANCE for HE and NH2 (logg[1]&logg[6]) (cisdihedral)*/
301 pdih_lengths(logg[1],logg[0],logg[2],logg[6],ilist,iparams,&blen,&ub,
302 atoms);
303 lb=(1.0-arg_margin)*blen;
304 ub=(1.0+arg_margin)*blen;
305 if (((weight[logg[1]] != 0.0) || (weight[logg[6]] != 0.0)) &&
306 (!dist_set(d,natoms,logg[1],logg[6]))) {
307 set_dist(d,natoms,logg[1],logg[6],lb,ub,blen);
308 ndist++;
309 n14dist++;
311 /*SETDISTANCE for NE and HH21 (logg[0]&logg[7]) (cisdihedral)*/
312 pdih_lengths(logg[0],logg[2],logg[6],logg[7],ilist,iparams,&blen,&ub,
313 atoms);
314 lb=(1.0-arg_margin)*blen;
315 ub=(1.0+arg_margin)*blen;
316 if (((weight[logg[0]] != 0.0) || (weight[logg[7]] != 0.0)) &&
317 (!dist_set(d,natoms,logg[0],logg[7]))) {
318 set_dist(d,natoms,logg[0],logg[7],lb,ub,blen);
319 ndist++;
320 n14dist++;
322 /*SETDISTANCE for NE and HH11 (logg[0]&logg[4]) (cisdihedral)*/
323 pdih_lengths(logg[0],logg[2],logg[3],logg[4],ilist,iparams,&blen,&ub,
324 atoms);
325 lb=(1.0-arg_margin)*blen;
326 ub=(1.0+arg_margin)*blen;
327 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
328 (!dist_set(d,natoms,logg[0],logg[4]))) {
329 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
330 ndist++;
331 n14dist++;
333 /*SETDISTANCE for CD and NE (1-2) */
334 blen=lookup_bondlength(logg[9],logg[0],ilist,iparams,TRUE,atoms);
335 lb=(1.0-arg_margin)*blen;
336 ub=(1.0+arg_margin)*blen;
337 if (((weight[logg[9]] != 0.0) || (weight[logg[0]] != 0.0)) &&
338 (!dist_set(d,natoms,logg[9],logg[0]))) {
339 set_dist(d,natoms,logg[9],logg[0],lb,ub,blen);
340 ndist++;
341 n12dist++;
343 /*SETDISTANCE for NE and HE (1-2) */
344 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
345 lb=(1.0-arg_margin)*blen;
346 ub=(1.0+arg_margin)*blen;
347 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
348 (!dist_set(d,natoms,logg[0],logg[1]))) {
349 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
350 ndist++;
351 n12dist++;
353 /*SETDISTANCE for NE and CZ (1-2) */
354 blen=lookup_bondlength(logg[0],logg[2],ilist,iparams,TRUE,atoms);
355 lb=(1.0-arg_margin)*blen;
356 ub=(1.0+arg_margin)*blen;
357 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
358 (!dist_set(d,natoms,logg[0],logg[2]))) {
359 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
360 ndist++;
361 n12dist++;
363 /*SETDISTANCE for CZ and NH1 (1-2) */
364 blen=lookup_bondlength(logg[2],logg[3],ilist,iparams,TRUE,atoms);
365 lb=(1.0-arg_margin)*blen;
366 ub=(1.0+arg_margin)*blen;
367 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
368 (!dist_set(d,natoms,logg[2],logg[3]))) {
369 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
370 ndist++;
371 n12dist++;
373 /*SETDISTANCE for CZ and NH2 (1-2) */
374 blen=lookup_bondlength(logg[2],logg[6],ilist,iparams,TRUE,atoms);
375 lb=(1.0-arg_margin)*blen;
376 ub=(1.0+arg_margin)*blen;
377 if (((weight[logg[2]] != 0.0) || (weight[logg[6]] != 0.0)) &&
378 (!dist_set(d,natoms,logg[2],logg[6]))) {
379 set_dist(d,natoms,logg[2],logg[6],lb,ub,blen);
380 ndist++;
381 n12dist++;
383 /*SETDISTANCE for NH1 and HH11 (1-2) */
384 blen=lookup_bondlength(logg[3],logg[4],ilist,iparams,TRUE,atoms);
385 lb=(1.0-arg_margin)*blen;
386 ub=(1.0+arg_margin)*blen;
387 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
388 (!dist_set(d,natoms,logg[3],logg[4]))) {
389 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
390 ndist++;
391 n12dist++;
393 /*SETDISTANCE for NH1 and HH12 (1-2) */
394 blen=lookup_bondlength(logg[3],logg[5],ilist,iparams,TRUE,atoms);
395 lb=(1.0-arg_margin)*blen;
396 ub=(1.0+arg_margin)*blen;
397 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
398 (!dist_set(d,natoms,logg[3],logg[5]))) {
399 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
400 ndist++;
401 n12dist++;
403 /*SETDISTANCE for NH2 and HH21 (1-2) */
404 blen=lookup_bondlength(logg[6],logg[7],ilist,iparams,TRUE,atoms);
405 lb=(1.0-arg_margin)*blen;
406 ub=(1.0+arg_margin)*blen;
407 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
408 (!dist_set(d,natoms,logg[6],logg[7]))) {
409 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
410 ndist++;
411 n12dist++;
413 /*SETDISTANCE for NH2 and HH22 (1-2) */
414 blen=lookup_bondlength(logg[6],logg[8],ilist,iparams,TRUE,atoms);
415 lb=(1.0-arg_margin)*blen;
416 ub=(1.0+arg_margin)*blen;
417 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
418 (!dist_set(d,natoms,logg[6],logg[8]))) {
419 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
420 ndist++;
421 n12dist++;
424 /* new 1-3 distances added 981126 */
425 /*SETDISTANCE for NH1 and NH2 (1-3) */
426 angle=lookup_angle(logg[3],logg[2],logg[6],ilist,iparams,atoms);
427 blen=angle_length(logg[3],logg[2],logg[6],RAD2DEG*angle,ilist,iparams,
428 atoms);
429 lb=(1.0-arg_margin)*blen;
430 ub=(1.0+arg_margin)*blen;
431 if (((weight[logg[3]] != 0.0) || (weight[logg[6]] != 0.0)) &&
432 (!dist_set(d,natoms,logg[3],logg[6]))) {
433 set_dist(d,natoms,logg[3],logg[6],lb,ub,blen);
434 ndist++;
435 n13dist++;
437 /*SETDISTANCE for HH11 and HH12 (1-3) */
438 angle=lookup_angle(logg[5],logg[3],logg[4],ilist,iparams,atoms);
439 blen=angle_length(logg[5],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
440 atoms);
441 lb=(1.0-arg_margin)*blen;
442 ub=(1.0+arg_margin)*blen;
443 if (((weight[logg[5]] != 0.0) || (weight[logg[4]] != 0.0)) &&
444 (!dist_set(d,natoms,logg[5],logg[4]))) {
445 set_dist(d,natoms,logg[5],logg[4],lb,ub,blen);
446 ndist++;
447 n13dist++;
449 /*SETDISTANCE for HH21 and HH22 (1-3) */
450 angle=lookup_angle(logg[8],logg[6],logg[7],ilist,iparams,atoms);
451 blen=angle_length(logg[8],logg[6],logg[7],RAD2DEG*angle,ilist,iparams,
452 atoms);
453 lb=(1.0-arg_margin)*blen;
454 ub=(1.0+arg_margin)*blen;
455 if (((weight[logg[8]] != 0.0) || (weight[logg[7]] != 0.0)) &&
456 (!dist_set(d,natoms,logg[8],logg[7]))) {
457 set_dist(d,natoms,logg[8],logg[7],lb,ub,blen);
458 ndist++;
459 n13dist++;
461 /* end of new 1-3 distances */
463 /*SETDISTANCE for CD and HE (1-3) */
464 angle=lookup_angle(logg[9],logg[0],logg[1],ilist,iparams,atoms);
465 blen=angle_length(logg[9],logg[0],logg[1],RAD2DEG*angle,ilist,iparams,
466 atoms);
467 lb=(1.0-arg_margin)*blen;
468 ub=(1.0+arg_margin)*blen;
469 if (((weight[logg[9]] != 0.0) || (weight[logg[1]] != 0.0)) &&
470 (!dist_set(d,natoms,logg[9],logg[1]))) {
471 set_dist(d,natoms,logg[9],logg[1],lb,ub,blen);
472 ndist++;
473 n13dist++;
475 /*SETDISTANCE for CD and CZ (1-3) */
476 angle=lookup_angle(logg[9],logg[0],logg[2],ilist,iparams,atoms);
477 blen=angle_length(logg[9],logg[0],logg[2],RAD2DEG*angle,ilist,iparams,
478 atoms);
479 lb=(1.0-arg_margin)*blen;
480 ub=(1.0+arg_margin)*blen;
481 if (((weight[logg[9]] != 0.0) || (weight[logg[2]] != 0.0)) &&
482 (!dist_set(d,natoms,logg[9],logg[2]))) {
483 set_dist(d,natoms,logg[9],logg[2],lb,ub,blen);
484 ndist++;
485 n13dist++;
487 /*SETDISTANCE for HE and CZ (1-3) */
488 angle=lookup_angle(logg[1],logg[0],logg[2],ilist,iparams,atoms);
489 blen=angle_length(logg[1],logg[0],logg[2],RAD2DEG*angle,ilist,iparams,
490 atoms);
491 lb=(1.0-arg_margin)*blen;
492 ub=(1.0+arg_margin)*blen;
493 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
494 (!dist_set(d,natoms,logg[1],logg[2]))) {
495 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
496 ndist++;
497 n13dist++;
499 /*SETDISTANCE for NE and NH1 (1-3) */
500 angle=lookup_angle(logg[0],logg[2],logg[3],ilist,iparams,atoms);
501 blen=angle_length(logg[0],logg[2],logg[3],RAD2DEG*angle,ilist,iparams,
502 atoms);
503 lb=(1.0-arg_margin)*blen;
504 ub=(1.0+arg_margin)*blen;
505 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
506 (!dist_set(d,natoms,logg[0],logg[3]))) {
507 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
508 ndist++;
509 n13dist++;
511 /*SETDISTANCE for NE and NH2 (1-3) */
512 angle=lookup_angle(logg[0],logg[2],logg[6],ilist,iparams,atoms);
513 blen=angle_length(logg[0],logg[2],logg[6],RAD2DEG*angle,ilist,iparams,
514 atoms);
515 lb=(1.0-arg_margin)*blen;
516 ub=(1.0+arg_margin)*blen;
517 if (((weight[logg[0]] != 0.0) || (weight[logg[6]] != 0.0)) &&
518 (!dist_set(d,natoms,logg[0],logg[6]))) {
519 set_dist(d,natoms,logg[0],logg[6],lb,ub,blen);
520 ndist++;
521 n13dist++;
523 /*SETDISTANCE for CZ and HH11 (1-3) */
524 angle=lookup_angle(logg[2],logg[3],logg[4],ilist,iparams,atoms);
525 blen=angle_length(logg[2],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
526 atoms);
527 lb=(1.0-arg_margin)*blen;
528 ub=(1.0+arg_margin)*blen;
529 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
530 (!dist_set(d,natoms,logg[2],logg[4]))) {
531 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
532 ndist++;
533 n13dist++;
535 /*SETDISTANCE for CZ and HH12 (1-3) */
536 angle=lookup_angle(logg[2],logg[3],logg[5],ilist,iparams,atoms);
537 blen=angle_length(logg[2],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
538 atoms);
539 lb=(1.0-arg_margin)*blen;
540 ub=(1.0+arg_margin)*blen;
541 if (((weight[logg[2]] != 0.0) || (weight[logg[5]] != 0.0)) &&
542 (!dist_set(d,natoms,logg[2],logg[5]))) {
543 set_dist(d,natoms,logg[2],logg[5],lb,ub,blen);
544 ndist++;
545 n13dist++;
547 /*SETDISTANCE for CZ and HH21 (1-3) */
548 angle=lookup_angle(logg[2],logg[6],logg[7],ilist,iparams,atoms);
549 blen=angle_length(logg[2],logg[6],logg[7],RAD2DEG*angle,ilist,iparams,
550 atoms);
551 lb=(1.0-arg_margin)*blen;
552 ub=(1.0+arg_margin)*blen;
553 if (((weight[logg[2]] != 0.0) || (weight[logg[7]] != 0.0)) &&
554 (!dist_set(d,natoms,logg[2],logg[7]))) {
555 set_dist(d,natoms,logg[2],logg[7],lb,ub,blen);
556 ndist++;
557 n13dist++;
559 /*SETDISTANCE for CZ and HH22 (1-3) */
560 angle=lookup_angle(logg[2],logg[6],logg[8],ilist,iparams,atoms);
561 blen=angle_length(logg[2],logg[6],logg[8],RAD2DEG*angle,ilist,iparams,
562 atoms);
563 lb=(1.0-arg_margin)*blen;
564 ub=(1.0+arg_margin)*blen;
565 if (((weight[logg[2]] != 0.0) || (weight[logg[8]] != 0.0)) &&
566 (!dist_set(d,natoms,logg[2],logg[8]))) {
567 set_dist(d,natoms,logg[2],logg[8],lb,ub,blen);
568 ndist++;
569 n13dist++;
572 /* new 1-5 distances added 981126 */
573 /*SETDISTANCE for HE and HH12 (1-5) (trans) */
574 arg_15_CDHH2(logg[1],logg[0],logg[2],logg[3],logg[5],ilist,
575 iparams,&lb,&blen,atoms);
576 lb=(1.0-arg_margin)*blen;
577 ub=(1.0+arg_margin)*blen;
578 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
579 (!dist_set(d,natoms,logg[1],logg[5]))) {
580 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
581 ndist++;
582 n15dist++;
584 /*SETDISTANCE for HE and HH11 (1-5) (trans) */
585 arg_15_CDHH2(logg[1],logg[0],logg[2],logg[3],logg[4],ilist,
586 iparams,&blen,&ub,atoms);
587 lb=(1.0-arg_margin)*blen;
588 ub=(1.0+arg_margin)*blen;
589 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
590 (!dist_set(d,natoms,logg[1],logg[4]))) {
591 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
592 ndist++;
593 n15dist++;
595 /*SETDISTANCE for HE and HH22 (1-5) (trans) */
596 arg_15_CDHH1(logg[1],logg[0],logg[2],logg[6],logg[8],ilist,
597 iparams,&lb,&blen,atoms);
598 lb=(1.0-arg_margin)*blen;
599 ub=(1.0+arg_margin)*blen;
600 if (((weight[logg[1]] != 0.0) || (weight[logg[8]] != 0.0)) &&
601 (!dist_set(d,natoms,logg[1],logg[8]))) {
602 set_dist(d,natoms,logg[1],logg[8],lb,ub,blen);
603 ndist++;
604 n15dist++;
606 /*SETDISTANCE for HE and HH21 (1-5) (trans) */
607 arg_15_CDHH1(logg[1],logg[0],logg[2],logg[6],logg[7],ilist,
608 iparams,&blen,&ub,atoms);
609 lb=(1.0-arg_margin)*blen;
610 ub=(1.0+arg_margin)*blen;
611 if (((weight[logg[1]] != 0.0) || (weight[logg[7]] != 0.0)) &&
612 (!dist_set(d,natoms,logg[1],logg[7]))) {
613 set_dist(d,natoms,logg[1],logg[7],lb,ub,blen);
614 ndist++;
615 n15dist++;
617 /*SETDISTANCE for HH11 and HH21 (1-5) (trans) */
618 arg_15_CDHH2(logg[4],logg[3],logg[2],logg[6],logg[7],ilist,
619 iparams,&lb,&blen,atoms);
620 lb=(1.0-arg_margin)*blen;
621 ub=(1.0+arg_margin)*blen;
622 if (((weight[logg[4]] != 0.0) || (weight[logg[7]] != 0.0)) &&
623 (!dist_set(d,natoms,logg[4],logg[7]))) {
624 set_dist(d,natoms,logg[4],logg[7],lb,ub,blen);
625 ndist++;
626 n15dist++;
628 /*SETDISTANCE for HH11 and HH22 (1-5) (trans) */
629 arg_15_CDHH2(logg[4],logg[3],logg[2],logg[6],logg[8],ilist,
630 iparams,&blen,&ub,atoms);
631 lb=(1.0-arg_margin)*blen;
632 ub=(1.0+arg_margin)*blen;
633 if (((weight[logg[4]] != 0.0) || (weight[logg[8]] != 0.0)) &&
634 (!dist_set(d,natoms,logg[4],logg[8]))) {
635 set_dist(d,natoms,logg[4],logg[8],lb,ub,blen);
636 ndist++;
637 n15dist++;
639 /*SETDISTANCE for HH12 and HH21 (1-5) (trans) */
640 arg_15_CDHH1(logg[5],logg[3],logg[2],logg[6],logg[7],ilist,
641 iparams,&lb,&blen,atoms);
642 lb=(1.0-arg_margin)*blen;
643 ub=(1.0+arg_margin)*blen;
644 if (((weight[logg[5]] != 0.0) || (weight[logg[7]] != 0.0)) &&
645 (!dist_set(d,natoms,logg[5],logg[7]))) {
646 set_dist(d,natoms,logg[5],logg[7],lb,ub,blen);
647 ndist++;
648 n15dist++;
650 /*SETDISTANCE for HH12 and HH22 (1-5) (trans) */
651 arg_15_CDHH1(logg[5],logg[3],logg[2],logg[6],logg[8],ilist,
652 iparams,&blen,&ub,atoms);
653 lb=(1.0-arg_margin)*blen;
654 ub=(1.0+arg_margin)*blen;
655 if (((weight[logg[5]] != 0.0) || (weight[logg[8]] != 0.0)) &&
656 (!dist_set(d,natoms,logg[5],logg[8]))) {
657 set_dist(d,natoms,logg[5],logg[8],lb,ub,blen);
658 ndist++;
659 n15dist++;
661 /* end of new 1-5 distances */
663 /*SETDISTANCE for CD and HH12 (1-5) (trans) */
664 arg_15_CDHH1(logg[9],logg[0],logg[2],logg[3],logg[5],ilist,
665 iparams,&lb,&blen,atoms);
666 lb=(1.0-arg_margin)*blen;
667 ub=(1.0+arg_margin)*blen;
668 if (((weight[logg[9]] != 0.0) || (weight[logg[5]] != 0.0)) &&
669 (!dist_set(d,natoms,logg[9],logg[5]))) {
670 set_dist(d,natoms,logg[9],logg[5],lb,ub,blen);
671 ndist++;
672 n15dist++;
674 /*SETDISTANCE for CD and HH11 (1-5) (cis) */
675 arg_15_CDHH1(logg[9],logg[0],logg[2],logg[3],logg[4],ilist,
676 iparams,&blen,&ub,atoms);
677 lb=(1.0-arg_margin)*blen;
678 ub=(1.0+arg_margin)*blen;
679 if (((weight[logg[9]] != 0.0) || (weight[logg[4]] != 0.0)) &&
680 (!dist_set(d,natoms,logg[9],logg[4]))) {
681 set_dist(d,natoms,logg[9],logg[4],lb,ub,blen);
682 ndist++;
683 n15dist++;
685 /*SETDISTANCE for CD and HH21 (1-5) (cis) */
686 arg_15_CDHH2(logg[9],logg[0],logg[2],logg[6],logg[7],ilist,
687 iparams,&blen,&ub,atoms);
688 lb=(1.0-arg_margin)*blen;
689 ub=(1.0+arg_margin)*blen;
690 if (((weight[logg[9]] != 0.0) || (weight[logg[7]] != 0.0)) &&
691 (!dist_set(d,natoms,logg[9],logg[7]))) {
692 set_dist(d,natoms,logg[9],logg[7],lb,ub,blen);
693 ndist++;
694 n15dist++;
696 /*SETDISTANCE for CD and HH22 (1-5) (trans) */
697 arg_15_CDHH2(logg[9],logg[0],logg[2],logg[6],logg[8],ilist,
698 iparams,&lb,&blen,atoms);
699 lb=(1.0-arg_margin)*blen;
700 ub=(1.0+arg_margin)*blen;
701 if (((weight[logg[9]] != 0.0) || (weight[logg[8]] != 0.0)) &&
702 (!dist_set(d,natoms,logg[9],logg[8]))) {
703 set_dist(d,natoms,logg[9],logg[8],lb,ub,blen);
704 ndist++;
705 n15dist++;
708 if (bVir) {
709 /* VIRTUAL DISTANCES */
710 nVdist += set_virtual (logg,10,arg_margin,d,natoms);
711 ndist += nVdist;
714 logg[11]=0;
718 fprintf(log,"There are %d new arginine distances\n",ndist);
719 if (ndist > 0 ) {
720 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4, %d 1-5, %d virtual)\n",
721 n12dist,n13dist,n14dist,n15dist,nVdist);
725 /**********************************************************
727 * A S P A R A G I N E
729 **********************************************************/
730 void asn (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
731 real end_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
733 int natoms,ndist,i,j,q,logg[8],residnr,oldresidnr,n12dist,n13dist,n14dist,nVdist;
734 real blen,lb,ub,angle;
736 natoms= atoms->nr;
737 ndist = 0;
738 n12dist = 0;
739 n13dist = 0;
740 n14dist = 0;
741 nVdist = 0;
742 residnr = -1;
743 oldresidnr=-1;
745 for (i=0; (i<natoms); i++) {
746 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"ASN") == 0) {
747 oldresidnr=residnr;
748 residnr=atoms->atom[i].resnr;
749 logg[7]=0;
750 if ( oldresidnr == residnr ) {
751 continue;
753 j=i;
754 while ((atoms->atom[j].resnr) == residnr ) {
755 if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
756 logg[7]++;
757 logg[0]=j;
759 else if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
760 logg[7]++;
761 logg[1]=j;
763 else if ( strcmp((*atoms->atomname[j]),"OD1") == 0) {
764 logg[7]++;
765 logg[2]=j;
767 else if ( strcmp((*atoms->atomname[j]),"ND2") == 0) {
768 logg[7]++;
769 logg[3]=j;
771 else if ( strcmp((*atoms->atomname[j]),"HD21") == 0) {
772 logg[7]++;
773 logg[4]=j;
775 else if ( strcmp((*atoms->atomname[j]),"HD22") == 0) {
776 logg[7]++;
777 logg[5]=j;
779 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
780 logg[7]++;
781 logg[6]=j;
783 if ( ((logg[7] == 6) && !bVir) || ((logg[7] == 7) && bVir) ) {
784 break;
786 j++;
788 if ( ((logg[7] == 6) && !bVir) || ((logg[7] == 7) && bVir) ) {
790 if ((logg[7] == 6) && !bVir) {
791 fprintf(log,"logg (asn) = %d %d %d %d %d %d\n",logg[0],
792 logg[1],logg[2],logg[3],logg[4],logg[5]);
794 else if ((logg[7] == 7) && bVir) {
795 fprintf(log,"logg (asn) = %d %d %d %d %d %d %d\n",logg[0],
796 logg[1],logg[2],logg[3],logg[4],logg[5],logg[6]);
799 /*SETDISTANCE for CB and CG (1-2) */
800 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
801 lb=(1.0-end_margin)*blen;
802 ub=(1.0+end_margin)*blen;
803 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
804 (!dist_set(d,natoms,logg[0],logg[1]))) {
805 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
806 ndist++;
807 n12dist++;
809 /*SETDISTANCE for CG and OD1 (1-2) */
810 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
811 lb=(1.0-end_margin)*blen;
812 ub=(1.0+end_margin)*blen;
813 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
814 (!dist_set(d,natoms,logg[1],logg[2]))) {
815 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
816 ndist++;
817 n12dist++;
819 /*SETDISTANCE for CG and ND2 (1-2) */
820 blen=lookup_bondlength(logg[1],logg[3],ilist,iparams,TRUE,atoms);
821 lb=(1.0-end_margin)*blen;
822 ub=(1.0+end_margin)*blen;
823 if (((weight[logg[1]] != 0.0) || (weight[logg[3]] != 0.0)) &&
824 (!dist_set(d,natoms,logg[1],logg[3]))) {
825 set_dist(d,natoms,logg[1],logg[3],lb,ub,blen);
826 ndist++;
827 n12dist++;
829 /*SETDISTANCE for ND2 and HD21 (1-2) */
830 blen=lookup_bondlength(logg[3],logg[4],ilist,iparams,TRUE,atoms);
831 lb=(1.0-end_margin)*blen;
832 ub=(1.0+end_margin)*blen;
833 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
834 (!dist_set(d,natoms,logg[3],logg[4]))) {
835 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
836 ndist++;
837 n12dist++;
839 /*SETDISTANCE for ND2 and HD22 (1-2) */
840 blen=lookup_bondlength(logg[3],logg[5],ilist,iparams,TRUE,atoms);
841 lb=(1.0-end_margin)*blen;
842 ub=(1.0+end_margin)*blen;
843 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
844 (!dist_set(d,natoms,logg[3],logg[5]))) {
845 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
846 ndist++;
847 n12dist++;
850 /* new 1-3 distances added 981126 */
851 /*SETDISTANCE for HD21 and HD22 (1-3) */
852 angle=lookup_angle(logg[4],logg[3],logg[5],ilist,iparams,atoms);
853 blen=angle_length(logg[4],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
854 atoms);
855 lb=(1.0-end_margin)*blen;
856 ub=(1.0+end_margin)*blen;
857 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
858 (!dist_set(d,natoms,logg[4],logg[5]))) {
859 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
860 ndist++;
861 n13dist++;
863 /* end of new 1-3 distances */
865 /*SETDISTANCE for CB and OD1 (1-3) */
866 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
867 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
868 atoms);
869 lb=(1.0-end_margin)*blen;
870 ub=(1.0+end_margin)*blen;
871 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
872 (!dist_set(d,natoms,logg[0],logg[2]))) {
873 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
874 ndist++;
875 n13dist++;
877 /*SETDISTANCE for CB and ND2 (1-3) */
878 angle=lookup_angle(logg[0],logg[1],logg[3],ilist,iparams,atoms);
879 blen=angle_length(logg[0],logg[1],logg[3],RAD2DEG*angle,ilist,iparams,
880 atoms);
881 lb=(1.0-end_margin)*blen;
882 ub=(1.0+end_margin)*blen;
883 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
884 (!dist_set(d,natoms,logg[0],logg[3]))) {
885 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
886 ndist++;
887 n13dist++;
889 /*SETDISTANCE for OD1 and ND2 (1-3) */
890 angle=lookup_angle(logg[2],logg[1],logg[3],ilist,iparams,atoms);
891 blen=angle_length(logg[2],logg[1],logg[3],RAD2DEG*angle,ilist,iparams,
892 atoms);
893 lb=(1.0-end_margin)*blen;
894 ub=(1.0+end_margin)*blen;
895 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
896 (!dist_set(d,natoms,logg[2],logg[3]))) {
897 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
898 ndist++;
899 n13dist++;
901 /*SETDISTANCE for CG and HD21 (1-3) */
902 angle=lookup_angle(logg[1],logg[3],logg[4],ilist,iparams,atoms);
903 blen=angle_length(logg[1],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
904 atoms);
905 lb=(1.0-end_margin)*blen;
906 ub=(1.0+end_margin)*blen;
907 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
908 (!dist_set(d,natoms,logg[1],logg[4]))) {
909 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
910 ndist++;
911 n13dist++;
913 /*SETDISTANCE for CG and HD22 (1-3) */
914 angle=lookup_angle(logg[1],logg[3],logg[5],ilist,iparams,atoms);
915 blen=angle_length(logg[1],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
916 atoms);
917 lb=(1.0-end_margin)*blen;
918 ub=(1.0+end_margin)*blen;
919 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
920 (!dist_set(d,natoms,logg[1],logg[5]))) {
921 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
922 ndist++;
923 n13dist++;
925 /*SETDISTANCE for CB and HD22 (logg[0]&logg[5]) (transdihedral)*/
926 pdih_lengths(logg[0],logg[1],logg[3],logg[5],ilist,iparams,&lb,&blen,
927 atoms);
928 lb=(1.0-end_margin)*blen;
929 ub=(1.0+end_margin)*blen;
930 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
931 (!dist_set(d,natoms,logg[0],logg[5]))) {
932 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
933 ndist++;
934 n14dist++;
936 /*SETDISTANCE for OD1 and HD21 (logg[2]&logg[4]) (transdihedral)*/
937 pdih_lengths(logg[2],logg[1],logg[3],logg[4],ilist,iparams,&lb,&blen,
938 atoms);
939 lb=(1.0-end_margin)*blen;
940 ub=(1.0+end_margin)*blen;
941 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
942 (!dist_set(d,natoms,logg[2],logg[4]))) {
943 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
944 ndist++;
945 n14dist++;
947 /*SETDISTANCE for CB and HD21 (logg[0]&logg[4]) (cisdihedral)*/
948 pdih_lengths(logg[0],logg[1],logg[3],logg[4],ilist,iparams,&blen,&ub,
949 atoms);
950 lb=(1.0-end_margin)*blen;
951 ub=(1.0+end_margin)*blen;
952 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
953 (!dist_set(d,natoms,logg[0],logg[4]))) {
954 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
955 ndist++;
956 n14dist++;
958 /*SETDISTANCE for OD1 and HD22 (logg[2]&logg[5]) (cisdihedral)*/
959 pdih_lengths(logg[2],logg[1],logg[3],logg[5],ilist,iparams,&blen,&ub,
960 atoms);
961 lb=(1.0-end_margin)*blen;
962 ub=(1.0+end_margin)*blen;
963 if (((weight[logg[2]] != 0.0) || (weight[logg[5]] != 0.0)) &&
964 (!dist_set(d,natoms,logg[2],logg[5]))) {
965 set_dist(d,natoms,logg[2],logg[5],lb,ub,blen);
966 ndist++;
967 n14dist++;
969 if (bVir) {
970 /* VIRTUAL DISTANCES */
971 nVdist += set_virtual (logg,6,end_margin,d,natoms);
972 ndist += nVdist;
975 logg[7]=0;
978 fprintf(log,"There are %d new asparagine distances\n",ndist);
979 if (ndist > 0) {
980 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4, %d virtual)\n",
981 n12dist,n13dist,n14dist,nVdist);
985 /**********************************************************
987 * G L U T A M I N E
989 **********************************************************/
990 void gln (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
991 real end_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
993 int natoms,ndist,i,j,q,logg[8],residnr,oldresidnr,n12dist,n13dist,n14dist,nVdist;
994 real blen,lb,ub,angle;
996 natoms= atoms->nr;
997 ndist = 0;
998 n12dist = 0;
999 n13dist = 0;
1000 n14dist = 0;
1001 nVdist = 0;
1002 residnr = -1;
1003 oldresidnr=-1;
1005 for (i=0; (i<natoms); i++) {
1006 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"GLN") == 0) {
1007 oldresidnr=residnr;
1008 residnr=atoms->atom[i].resnr;
1009 logg[7]=0;
1010 if ( oldresidnr == residnr ) {
1011 continue;
1013 j=i;
1014 while ((atoms->atom[j].resnr) == residnr ) {
1015 if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
1016 logg[7]++;
1017 logg[0]=j;
1019 else if ( strcmp((*atoms->atomname[j]),"CD") == 0) {
1020 logg[7]++;
1021 logg[1]=j;
1023 else if ( strcmp((*atoms->atomname[j]),"OE1") == 0) {
1024 logg[7]++;
1025 logg[2]=j;
1027 else if ( strcmp((*atoms->atomname[j]),"NE2") == 0) {
1028 logg[7]++;
1029 logg[3]=j;
1031 else if ( strcmp((*atoms->atomname[j]),"HE21") == 0) {
1032 logg[7]++;
1033 logg[4]=j;
1035 else if ( strcmp((*atoms->atomname[j]),"HE22") == 0) {
1036 logg[7]++;
1037 logg[5]=j;
1039 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
1040 logg[7]++;
1041 logg[6]=j;
1043 if ( ((logg[7] == 6) && !bVir) || ((logg[7] == 7) && bVir) ) {
1044 break;
1046 j++;
1048 if ( ((logg[7] == 6) && !bVir) || ((logg[7] == 7) && bVir) ) {
1050 if ((logg[7] == 6) && !bVir) {
1051 fprintf(log,"logg (arg) = %d %d %d %d %d %d\n",logg[0],
1052 logg[1],logg[2],logg[3],logg[4],logg[5]);
1054 else if ((logg[7] == 7) && bVir) {
1055 fprintf(log,"logg (arg) = %d %d %d %d %d %d %d\n",logg[0],
1056 logg[1],logg[2],logg[3],logg[4],logg[5],logg[6]);
1058 /*SETDISTANCE for CG and CD (1-2) */
1059 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
1060 lb=(1.0-end_margin)*blen;
1061 ub=(1.0+end_margin)*blen;
1062 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1063 (!dist_set(d,natoms,logg[0],logg[1]))) {
1064 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
1065 ndist++;
1066 n12dist++;
1068 /*SETDISTANCE for CD and OE1 (1-2) */
1069 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
1070 lb=(1.0-end_margin)*blen;
1071 ub=(1.0+end_margin)*blen;
1072 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1073 (!dist_set(d,natoms,logg[1],logg[2]))) {
1074 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
1075 ndist++;
1076 n12dist++;
1078 /*SETDISTANCE for CD and NE2 (1-2) */
1079 blen=lookup_bondlength(logg[1],logg[3],ilist,iparams,TRUE,atoms);
1080 lb=(1.0-end_margin)*blen;
1081 ub=(1.0+end_margin)*blen;
1082 if (((weight[logg[1]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1083 (!dist_set(d,natoms,logg[1],logg[3]))) {
1084 set_dist(d,natoms,logg[1],logg[3],lb,ub,blen);
1085 ndist++;
1086 n12dist++;
1088 /*SETDISTANCE for NE2 and HE21 (1-2) */
1089 blen=lookup_bondlength(logg[3],logg[4],ilist,iparams,TRUE,atoms);
1090 lb=(1.0-end_margin)*blen;
1091 ub=(1.0+end_margin)*blen;
1092 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1093 (!dist_set(d,natoms,logg[3],logg[4]))) {
1094 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
1095 ndist++;
1096 n12dist++;
1098 /*SETDISTANCE for NE2 and HE22 (1-2) */
1099 blen=lookup_bondlength(logg[3],logg[5],ilist,iparams,TRUE,atoms);
1100 lb=(1.0-end_margin)*blen;
1101 ub=(1.0+end_margin)*blen;
1102 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1103 (!dist_set(d,natoms,logg[3],logg[5]))) {
1104 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
1105 ndist++;
1106 n12dist++;
1109 /* new 1-3 distances added 981126 */
1110 /*SETDISTANCE for HE21 and HE22 (1-3) */
1111 angle=lookup_angle(logg[4],logg[3],logg[5],ilist,iparams,atoms);
1112 blen=angle_length(logg[4],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
1113 atoms);
1114 lb=(1.0-end_margin)*blen;
1115 ub=(1.0+end_margin)*blen;
1116 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1117 (!dist_set(d,natoms,logg[4],logg[5]))) {
1118 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
1119 ndist++;
1120 n13dist++;
1122 /* end of new 1-3 distances */
1124 /*SETDISTANCE for CG and OE1 (1-3) */
1125 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
1126 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
1127 atoms);
1128 lb=(1.0-end_margin)*blen;
1129 ub=(1.0+end_margin)*blen;
1130 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1131 (!dist_set(d,natoms,logg[0],logg[2]))) {
1132 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
1133 ndist++;
1134 n13dist++;
1136 /*SETDISTANCE for CG and NE2 (1-3) */
1137 angle=lookup_angle(logg[0],logg[1],logg[3],ilist,iparams,atoms);
1138 blen=angle_length(logg[0],logg[1],logg[3],RAD2DEG*angle,ilist,iparams,
1139 atoms);
1140 lb=(1.0-end_margin)*blen;
1141 ub=(1.0+end_margin)*blen;
1142 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1143 (!dist_set(d,natoms,logg[0],logg[3]))) {
1144 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
1145 ndist++;
1146 n13dist++;
1148 /*SETDISTANCE for OE1 and NE2 (1-3) */
1149 angle=lookup_angle(logg[2],logg[1],logg[3],ilist,iparams,atoms);
1150 blen=angle_length(logg[2],logg[1],logg[3],RAD2DEG*angle,ilist,iparams,
1151 atoms);
1152 lb=(1.0-end_margin)*blen;
1153 ub=(1.0+end_margin)*blen;
1154 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1155 (!dist_set(d,natoms,logg[2],logg[3]))) {
1156 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
1157 ndist++;
1158 n13dist++;
1160 /*SETDISTANCE for CD and HE21 (1-3) */
1161 angle=lookup_angle(logg[1],logg[3],logg[4],ilist,iparams,atoms);
1162 blen=angle_length(logg[1],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
1163 atoms);
1164 lb=(1.0-end_margin)*blen;
1165 ub=(1.0+end_margin)*blen;
1166 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1167 (!dist_set(d,natoms,logg[1],logg[4]))) {
1168 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
1169 ndist++;
1170 n13dist++;
1172 /*SETDISTANCE for CD and HE22 (1-3) */
1173 angle=lookup_angle(logg[1],logg[3],logg[5],ilist,iparams,atoms);
1174 blen=angle_length(logg[1],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
1175 atoms);
1176 lb=(1.0-end_margin)*blen;
1177 ub=(1.0+end_margin)*blen;
1178 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1179 (!dist_set(d,natoms,logg[1],logg[5]))) {
1180 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
1181 ndist++;
1182 n13dist++;
1184 /*SETDISTANCE for CG and HE22 (logg[0]&logg[5]) (transdihedral)*/
1185 pdih_lengths(logg[0],logg[1],logg[3],logg[5],ilist,iparams,&lb,&blen,
1186 atoms);
1187 lb=(1.0-end_margin)*blen;
1188 ub=(1.0+end_margin)*blen;
1189 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1190 (!dist_set(d,natoms,logg[0],logg[5]))) {
1191 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
1192 ndist++;
1193 n14dist++;
1195 /*SETDISTANCE for OD1 and HE21 (logg[2]&logg[4]) (transdihedral)*/
1196 pdih_lengths(logg[2],logg[1],logg[3],logg[4],ilist,iparams,&lb,&blen,
1197 atoms);
1198 lb=(1.0-end_margin)*blen;
1199 ub=(1.0+end_margin)*blen;
1200 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1201 (!dist_set(d,natoms,logg[2],logg[4]))) {
1202 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
1203 ndist++;
1204 n14dist++;
1206 /*SETDISTANCE for CG and HE21 (logg[0]&logg[4]) (cisdihedral)*/
1207 pdih_lengths(logg[0],logg[1],logg[3],logg[4],ilist,iparams,&blen,&ub,
1208 atoms);
1209 lb=(1.0-end_margin)*blen;
1210 ub=(1.0+end_margin)*blen;
1211 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1212 (!dist_set(d,natoms,logg[0],logg[4]))) {
1213 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
1214 ndist++;
1215 n14dist++;
1217 /*SETDISTANCE for OD1 and HE22 (logg[2]&logg[5]) (cisdihedral)*/
1218 pdih_lengths(logg[2],logg[1],logg[3],logg[5],ilist,iparams,&blen,&ub,
1219 atoms);
1220 lb=(1.0-end_margin)*blen;
1221 ub=(1.0+end_margin)*blen;
1222 if (((weight[logg[2]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1223 (!dist_set(d,natoms,logg[2],logg[5]))) {
1224 set_dist(d,natoms,logg[2],logg[5],lb,ub,blen);
1225 ndist++;
1226 n14dist++;
1228 if (bVir) {
1229 /* VIRTUAL DISTANCES */
1230 nVdist += set_virtual (logg,6,end_margin,d,natoms);
1231 ndist += nVdist;
1234 logg[7]=0;
1237 fprintf(log,"There are %d new glutamine distances\n",ndist);
1238 if (ndist > 0 ) {
1239 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4)\n",n12dist,n13dist,n14dist);
1242 /**********************************************************
1244 * H I S T I D I N E
1246 **********************************************************/
1247 static void hisb_15_type2(int ai,int aj,int ak,int al,int am,
1248 t_ilist ilist[],t_iparams iparams[],
1249 real *lb,t_atoms *atoms)
1251 /* Returns the length corresponding to a 1-5 distance */
1252 real rij,rjk,rkl,rlm,rik,rkm,rim;
1253 real thijk,thjkl,thklm,thikj,thmkl;
1254 real real_pi = M_PI*2.0;
1255 real half_pi = M_PI*0.5;
1257 /* fprintf(stderr,"Got past initialisations\n");*/
1258 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
1259 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
1260 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
1261 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
1262 /*fprintf(stderr,"Got past lookup_bondlength\n");*/
1263 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
1264 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
1265 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
1266 /*fprintf(stderr,"Got past lookup_angle\n");*/
1267 /*fprintf(stderr,"%g %g %g %g %g %g %g\n",rij,rjk,rkl,rlm,RAD2DEG*thijk,
1268 RAD2DEG*thjkl,RAD2DEG*thklm);*/
1269 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
1270 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
1271 /*fprintf(stderr,"Got past angle_length\n");*/
1273 /* Compute angle thikj using law of sines */
1274 thikj = asin(rij*sin(thijk)/rik);
1276 /* Compute thmkl using law of sines */
1277 thmkl = asin(rlm*sin(thklm)/rkm);
1279 /* Compute cis length using law of cosines */
1280 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(real_pi-thikj-thmkl-thjkl));
1281 /*fprintf(stderr,"leaving routine\n");*/
1285 void hisb (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
1286 real ring_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
1288 int natoms,ndist,i,j,q,logg[11],residnr,oldresidnr,n12dist,n13dist,n14dist,
1289 n15dist,nVdist;
1290 real blen,lb,ub,angle;
1292 natoms= atoms->nr;
1293 ndist = 0;
1294 n12dist = 0;
1295 n13dist = 0;
1296 n14dist = 0;
1297 n15dist = 0;
1298 nVdist = 0;
1299 residnr = -1;
1300 oldresidnr=-1;
1302 for (i=0; (i<natoms); i++) {
1303 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"HISB") == 0) {
1304 oldresidnr=residnr;
1305 residnr=atoms->atom[i].resnr;
1306 logg[10]=0;
1307 if ( oldresidnr == residnr ) {
1308 continue;
1310 j=i;
1311 while ((atoms->atom[j].resnr) == residnr ) {
1312 if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
1313 logg[10]++;
1314 logg[0]=j;
1316 else if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
1317 logg[10]++;
1318 logg[1]=j;
1320 else if ( strcmp((*atoms->atomname[j]),"ND1") == 0) {
1321 logg[10]++;
1322 logg[2]=j;
1324 else if ( strcmp((*atoms->atomname[j]),"CE1") == 0) {
1325 logg[10]++;
1326 logg[3]=j;
1328 else if ( strcmp((*atoms->atomname[j]),"NE2") == 0) {
1329 logg[10]++;
1330 logg[4]=j;
1332 else if ( strcmp((*atoms->atomname[j]),"CD2") == 0) {
1333 logg[10]++;
1334 logg[5]=j;
1336 else if ( strcmp((*atoms->atomname[j]),"HE1") == 0) {
1337 logg[10]++;
1338 logg[6]=j;
1340 else if ( strcmp((*atoms->atomname[j]),"HE2") == 0) {
1341 logg[10]++;
1342 logg[7]=j;
1344 else if ( strcmp((*atoms->atomname[j]),"HD2") == 0) {
1345 logg[10]++;
1346 logg[8]=j;
1348 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
1349 logg[10]++;
1350 logg[9]=j;
1352 if ( ((logg[10] == 9) && !bVir) || ((logg[10] == 10) && bVir) ) {
1353 break;
1355 j++;
1357 if ( ((logg[10] == 9) && !bVir) || ((logg[10] == 10) && bVir) ) {
1359 if ((logg[10] == 9) && !bVir) {
1360 fprintf(log,"logg (hisb) = %d %d %d %d %d %d %d %d %d\n",
1361 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
1362 logg[7],logg[8]);
1364 else if ((logg[10] == 10) && bVir) {
1365 fprintf(log,"logg (hisb) = %d %d %d %d %d %d %d %d %d %d\n",
1366 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
1367 logg[7],logg[8],logg[9]);
1370 /*SETDISTANCE for CB and CG (1-2) */
1371 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
1372 lb=(1.0-ring_margin)*blen;
1373 ub=(1.0+ring_margin)*blen;
1374 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1375 (!dist_set(d,natoms,logg[0],logg[1]))) {
1376 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
1377 ndist++;
1378 n12dist++;
1380 /*SETDISTANCE for CG and ND1 (1-2) */
1381 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
1382 lb=(1.0-ring_margin)*blen;
1383 ub=(1.0+ring_margin)*blen;
1384 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1385 (!dist_set(d,natoms,logg[1],logg[2]))) {
1386 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
1387 ndist++;
1388 n12dist++;
1390 /*SETDISTANCE for ND1 and CE1 (1-2) */
1391 blen=lookup_bondlength(logg[2],logg[3],ilist,iparams,TRUE,atoms);
1392 lb=(1.0-ring_margin)*blen;
1393 ub=(1.0+ring_margin)*blen;
1394 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1395 (!dist_set(d,natoms,logg[2],logg[3]))) {
1396 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
1397 ndist++;
1398 n12dist++;
1400 /*SETDISTANCE for CE1 and NE2 (1-2) */
1401 blen=lookup_bondlength(logg[3],logg[4],ilist,iparams,TRUE,atoms);
1402 lb=(1.0-ring_margin)*blen;
1403 ub=(1.0+ring_margin)*blen;
1404 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1405 (!dist_set(d,natoms,logg[3],logg[4]))) {
1406 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
1407 ndist++;
1408 n12dist++;
1410 /*SETDISTANCE for NE2 and CD2 (1-2) */
1411 blen=lookup_bondlength(logg[4],logg[5],ilist,iparams,TRUE,atoms);
1412 lb=(1.0-ring_margin)*blen;
1413 ub=(1.0+ring_margin)*blen;
1414 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1415 (!dist_set(d,natoms,logg[4],logg[5]))) {
1416 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
1417 ndist++;
1418 n12dist++;
1420 /*SETDISTANCE for CD2 and CG (1-2) */
1421 blen=lookup_bondlength(logg[5],logg[1],ilist,iparams,TRUE,atoms);
1422 lb=(1.0-ring_margin)*blen;
1423 ub=(1.0+ring_margin)*blen;
1424 if (((weight[logg[5]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1425 (!dist_set(d,natoms,logg[5],logg[1]))) {
1426 set_dist(d,natoms,logg[5],logg[1],lb,ub,blen);
1427 ndist++;
1428 n12dist++;
1430 /*SETDISTANCE for CE1 and HE1 (1-2) */
1431 blen=lookup_bondlength(logg[3],logg[6],ilist,iparams,TRUE,atoms);
1432 lb=(1.0-ring_margin)*blen;
1433 ub=(1.0+ring_margin)*blen;
1434 if (((weight[logg[3]] != 0.0) || (weight[logg[6]] != 0.0)) &&
1435 (!dist_set(d,natoms,logg[3],logg[6]))) {
1436 set_dist(d,natoms,logg[3],logg[6],lb,ub,blen);
1437 ndist++;
1438 n12dist++;
1440 /*SETDISTANCE for NE2 and HE2 (1-2) */
1441 blen=lookup_bondlength(logg[4],logg[7],ilist,iparams,TRUE,atoms);
1442 lb=(1.0-ring_margin)*blen;
1443 ub=(1.0+ring_margin)*blen;
1444 if (((weight[logg[4]] != 0.0) || (weight[logg[7]] != 0.0)) &&
1445 (!dist_set(d,natoms,logg[4],logg[7]))) {
1446 set_dist(d,natoms,logg[4],logg[7],lb,ub,blen);
1447 ndist++;
1448 n12dist++;
1450 /*SETDISTANCE for CD2 and HD2 (1-2) */
1451 blen=lookup_bondlength(logg[5],logg[8],ilist,iparams,TRUE,atoms);
1452 lb=(1.0-ring_margin)*blen;
1453 ub=(1.0+ring_margin)*blen;
1454 if (((weight[logg[5]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1455 (!dist_set(d,natoms,logg[5],logg[8]))) {
1456 set_dist(d,natoms,logg[5],logg[8],lb,ub,blen);
1457 ndist++;
1458 n12dist++;
1460 /*SETDISTANCE for CB and ND1 (1-3) */
1461 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
1462 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
1463 atoms);
1464 lb=(1.0-ring_margin)*blen;
1465 ub=(1.0+ring_margin)*blen;
1466 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1467 (!dist_set(d,natoms,logg[0],logg[2]))) {
1468 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
1469 ndist++;
1470 n13dist++;
1472 /*SETDISTANCE for CB and CD2 (1-3) */
1473 angle=lookup_angle(logg[0],logg[1],logg[5],ilist,iparams,atoms);
1474 blen=angle_length(logg[0],logg[1],logg[5],RAD2DEG*angle,ilist,iparams,
1475 atoms);
1476 lb=(1.0-ring_margin)*blen;
1477 ub=(1.0+ring_margin)*blen;
1478 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1479 (!dist_set(d,natoms,logg[0],logg[5]))) {
1480 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
1481 ndist++;
1482 n13dist++;
1484 /*SETDISTANCE for CD2 and ND1 (1-3) */
1485 angle=lookup_angle(logg[5],logg[1],logg[2],ilist,iparams,atoms);
1486 blen=angle_length(logg[5],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
1487 atoms);
1488 lb=(1.0-ring_margin)*blen;
1489 ub=(1.0+ring_margin)*blen;
1490 if (((weight[logg[5]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1491 (!dist_set(d,natoms,logg[5],logg[2]))) {
1492 set_dist(d,natoms,logg[5],logg[2],lb,ub,blen);
1493 ndist++;
1494 n13dist++;
1496 /*SETDISTANCE for CG and CE1 (1-3) */
1497 angle=lookup_angle(logg[1],logg[2],logg[3],ilist,iparams,atoms);
1498 blen=angle_length(logg[1],logg[2],logg[3],RAD2DEG*angle,ilist,iparams,
1499 atoms);
1500 lb=(1.0-ring_margin)*blen;
1501 ub=(1.0+ring_margin)*blen;
1502 if (((weight[logg[1]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1503 (!dist_set(d,natoms,logg[1],logg[3]))) {
1504 set_dist(d,natoms,logg[1],logg[3],lb,ub,blen);
1505 ndist++;
1506 n13dist++;
1508 /*SETDISTANCE for ND1 and NE2 (1-3) */
1509 angle=lookup_angle(logg[2],logg[3],logg[4],ilist,iparams,atoms);
1510 blen=angle_length(logg[2],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
1511 atoms);
1512 lb=(1.0-ring_margin)*blen;
1513 ub=(1.0+ring_margin)*blen;
1514 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1515 (!dist_set(d,natoms,logg[2],logg[4]))) {
1516 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
1517 ndist++;
1518 n13dist++;
1520 /*SETDISTANCE for CE1 and CD2 (1-3) */
1521 angle=lookup_angle(logg[3],logg[4],logg[5],ilist,iparams,atoms);
1522 blen=angle_length(logg[3],logg[4],logg[5],RAD2DEG*angle,ilist,iparams,
1523 atoms);
1524 lb=(1.0-ring_margin)*blen;
1525 ub=(1.0+ring_margin)*blen;
1526 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1527 (!dist_set(d,natoms,logg[3],logg[5]))) {
1528 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
1529 ndist++;
1530 n13dist++;
1532 /*SETDISTANCE for NE2 and CG (1-3) */
1533 angle=lookup_angle(logg[4],logg[5],logg[1],ilist,iparams,atoms);
1534 blen=angle_length(logg[4],logg[5],logg[1],RAD2DEG*angle,ilist,iparams,
1535 atoms);
1536 lb=(1.0-ring_margin)*blen;
1537 ub=(1.0+ring_margin)*blen;
1538 if (((weight[logg[4]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1539 (!dist_set(d,natoms,logg[4],logg[1]))) {
1540 set_dist(d,natoms,logg[4],logg[1],lb,ub,blen);
1541 ndist++;
1542 n13dist++;
1544 /*SETDISTANCE for HD2 and CG (1-3) */
1545 angle=lookup_angle(logg[8],logg[5],logg[1],ilist,iparams,atoms);
1546 blen=angle_length(logg[8],logg[5],logg[1],RAD2DEG*angle,ilist,iparams,
1547 atoms);
1548 lb=(1.0-ring_margin)*blen;
1549 ub=(1.0+ring_margin)*blen;
1550 if (((weight[logg[8]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1551 (!dist_set(d,natoms,logg[8],logg[1]))) {
1552 set_dist(d,natoms,logg[8],logg[1],lb,ub,blen);
1553 ndist++;
1554 n13dist++;
1556 /*SETDISTANCE for HD2 and NE2 (1-3) */
1557 angle=lookup_angle(logg[8],logg[5],logg[4],ilist,iparams,atoms);
1558 blen=angle_length(logg[8],logg[5],logg[4],RAD2DEG*angle,ilist,iparams,
1559 atoms);
1560 lb=(1.0-ring_margin)*blen;
1561 ub=(1.0+ring_margin)*blen;
1562 if (((weight[logg[8]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1563 (!dist_set(d,natoms,logg[8],logg[4]))) {
1564 set_dist(d,natoms,logg[8],logg[4],lb,ub,blen);
1565 ndist++;
1566 n13dist++;
1568 /*SETDISTANCE for HE2 and CD2 (1-3) */
1569 angle=lookup_angle(logg[7],logg[4],logg[5],ilist,iparams,atoms);
1570 blen=angle_length(logg[7],logg[4],logg[5],RAD2DEG*angle,ilist,iparams,
1571 atoms);
1572 lb=(1.0-ring_margin)*blen;
1573 ub=(1.0+ring_margin)*blen;
1574 if (((weight[logg[7]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1575 (!dist_set(d,natoms,logg[7],logg[5]))) {
1576 set_dist(d,natoms,logg[7],logg[5],lb,ub,blen);
1577 ndist++;
1578 n13dist++;
1580 /*SETDISTANCE for HE2 and CE1 (1-3) */
1581 angle=lookup_angle(logg[7],logg[4],logg[3],ilist,iparams,atoms);
1582 blen=angle_length(logg[7],logg[4],logg[3],RAD2DEG*angle,ilist,iparams,
1583 atoms);
1584 lb=(1.0-ring_margin)*blen;
1585 ub=(1.0+ring_margin)*blen;
1586 if (((weight[logg[7]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1587 (!dist_set(d,natoms,logg[7],logg[3]))) {
1588 set_dist(d,natoms,logg[7],logg[3],lb,ub,blen);
1589 ndist++;
1590 n13dist++;
1592 /*SETDISTANCE for HE1 and NE2 (1-3) */
1593 angle=lookup_angle(logg[6],logg[3],logg[4],ilist,iparams,atoms);
1594 blen=angle_length(logg[6],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
1595 atoms);
1596 lb=(1.0-ring_margin)*blen;
1597 ub=(1.0+ring_margin)*blen;
1598 if (((weight[logg[6]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1599 (!dist_set(d,natoms,logg[6],logg[4]))) {
1600 set_dist(d,natoms,logg[6],logg[4],lb,ub,blen);
1601 ndist++;
1602 n13dist++;
1604 /*SETDISTANCE for HE1 and ND1 (1-3) */
1605 angle=lookup_angle(logg[6],logg[3],logg[2],ilist,iparams,atoms);
1606 blen=angle_length(logg[6],logg[3],logg[2],RAD2DEG*angle,ilist,iparams,
1607 atoms);
1608 lb=(1.0-ring_margin)*blen;
1609 ub=(1.0+ring_margin)*blen;
1610 if (((weight[logg[6]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1611 (!dist_set(d,natoms,logg[6],logg[2]))) {
1612 set_dist(d,natoms,logg[6],logg[2],lb,ub,blen);
1613 ndist++;
1614 n13dist++;
1616 /*SETDISTANCE for CB and CE1 (logg[0]&logg[3]) (transdihedral)*/
1617 pdih_lengths(logg[0],logg[1],logg[2],logg[3],ilist,iparams,&lb,&blen,
1618 atoms);
1619 lb=(1.0-ring_margin)*blen;
1620 ub=(1.0+ring_margin)*blen;
1621 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
1622 (!dist_set(d,natoms,logg[0],logg[3]))) {
1623 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
1624 ndist++;
1625 n14dist++;
1627 /*SETDISTANCE for CB and NE2 (logg[0]&logg[4]) (transdihedral)*/
1628 pdih_lengths(logg[0],logg[1],logg[5],logg[4],ilist,iparams,&lb,&blen,
1629 atoms);
1630 lb=(1.0-ring_margin)*blen;
1631 ub=(1.0+ring_margin)*blen;
1632 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
1633 (!dist_set(d,natoms,logg[0],logg[4]))) {
1634 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
1635 ndist++;
1636 n14dist++;
1638 /*SETDISTANCE for HE1 and CG (logg[6]&logg[1]) (transdihedral)*/
1639 pdih_lengths(logg[6],logg[3],logg[2],logg[1],ilist,iparams,&lb,&blen,
1640 atoms);
1641 lb=(1.0-ring_margin)*blen;
1642 ub=(1.0+ring_margin)*blen;
1643 if (((weight[logg[6]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1644 (!dist_set(d,natoms,logg[6],logg[1]))) {
1645 set_dist(d,natoms,logg[6],logg[1],lb,ub,blen);
1646 ndist++;
1647 n14dist++;
1649 /*SETDISTANCE for HE1 and CD2 (logg[6]&logg[5]) (transdihedral)*/
1650 pdih_lengths(logg[6],logg[3],logg[4],logg[5],ilist,iparams,&lb,&blen,
1651 atoms);
1652 lb=(1.0-ring_margin)*blen;
1653 ub=(1.0+ring_margin)*blen;
1654 if (((weight[logg[6]] != 0.0) || (weight[logg[5]] != 0.0)) &&
1655 (!dist_set(d,natoms,logg[6],logg[5]))) {
1656 set_dist(d,natoms,logg[6],logg[5],lb,ub,blen);
1657 ndist++;
1658 n14dist++;
1660 /*SETDISTANCE for HE2 and ND1 (logg[7]&logg[2]) (transdihedral)*/
1661 pdih_lengths(logg[7],logg[4],logg[3],logg[2],ilist,iparams,&lb,&blen,
1662 atoms);
1663 lb=(1.0-ring_margin)*blen;
1664 ub=(1.0+ring_margin)*blen;
1665 if (((weight[logg[7]] != 0.0) || (weight[logg[2]] != 0.0)) &&
1666 (!dist_set(d,natoms,logg[7],logg[2]))) {
1667 set_dist(d,natoms,logg[7],logg[2],lb,ub,blen);
1668 ndist++;
1669 n14dist++;
1671 /*SETDISTANCE for HE2 and CG (logg[7]&logg[1]) (transdihedral)*/
1672 pdih_lengths(logg[7],logg[4],logg[5],logg[1],ilist,iparams,&lb,&blen,
1673 atoms);
1674 lb=(1.0-ring_margin)*blen;
1675 ub=(1.0+ring_margin)*blen;
1676 if (((weight[logg[7]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1677 (!dist_set(d,natoms,logg[7],logg[1]))) {
1678 set_dist(d,natoms,logg[7],logg[1],lb,ub,blen);
1679 ndist++;
1680 n14dist++;
1682 /*SETDISTANCE for HE1 and HE2 (logg[6]&logg[7]) (cisdihedral)*/
1683 pdih_lengths(logg[6],logg[3],logg[4],logg[7],ilist,iparams,&blen,&ub,
1684 atoms);
1685 lb=(1.0-ring_margin)*blen;
1686 ub=(1.0+ring_margin)*blen;
1687 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
1688 (!dist_set(d,natoms,logg[6],logg[7]))) {
1689 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
1690 ndist++;
1691 n14dist++;
1693 /*SETDISTANCE for HE2 and HD2 (logg[7]&logg[5]) (cisdihedral)*/
1694 pdih_lengths(logg[7],logg[4],logg[5],logg[8],ilist,iparams,&blen,&ub,
1695 atoms);
1696 lb=(1.0-ring_margin)*blen;
1697 ub=(1.0+ring_margin)*blen;
1698 if (((weight[logg[7]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1699 (!dist_set(d,natoms,logg[7],logg[8]))) {
1700 set_dist(d,natoms,logg[7],logg[8],lb,ub,blen);
1701 ndist++;
1702 n14dist++;
1704 /*SETDISTANCE for CB and HD2 (logg[0]&logg[8]) (cisdihedral)*/
1705 pdih_lengths(logg[0],logg[1],logg[5],logg[8],ilist,iparams,&blen,&ub,
1706 atoms);
1707 lb=(1.0-ring_margin)*blen;
1708 ub=(1.0+ring_margin)*blen;
1709 if (((weight[logg[0]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1710 (!dist_set(d,natoms,logg[0],logg[8]))) {
1711 set_dist(d,natoms,logg[0],logg[8],lb,ub,blen);
1712 ndist++;
1713 n14dist++;
1715 /*SETDISTANCE for ND1 and HD2 (logg[2]&logg[8]) (transdihedral)*/
1716 pdih_lengths(logg[2],logg[1],logg[5],logg[8],ilist,iparams,&lb,&blen,
1717 atoms);
1718 lb=(1.0-ring_margin)*blen;
1719 ub=(1.0+ring_margin)*blen;
1720 if (((weight[logg[2]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1721 (!dist_set(d,natoms,logg[2],logg[8]))) {
1722 set_dist(d,natoms,logg[2],logg[8],lb,ub,blen);
1723 ndist++;
1724 n14dist++;
1726 /*SETDISTANCE for CE1 and HD2 (logg[3]&logg[8]) (transdihedral)*/
1727 pdih_lengths(logg[3],logg[4],logg[5],logg[8],ilist,iparams,&lb,&blen,
1728 atoms);
1729 lb=(1.0-ring_margin)*blen;
1730 ub=(1.0+ring_margin)*blen;
1731 if (((weight[logg[3]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1732 (!dist_set(d,natoms,logg[3],logg[8]))) {
1733 set_dist(d,natoms,logg[3],logg[8],lb,ub,blen);
1734 ndist++;
1735 n14dist++;
1738 /* new 1-5 distance added 981126 */
1740 /*SETDISTANCE for HE1 and HD2 (1-5) */
1741 hisb_15_type2(logg[6],logg[3],logg[4],logg[5],logg[8],ilist,
1742 iparams,&blen,atoms);
1743 lb=(1.0-ring_margin)*blen;
1744 ub=(1.0+ring_margin)*blen;
1745 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1746 (!dist_set(d,natoms,logg[6],logg[8]))) {
1747 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
1748 ndist++;
1749 n15dist++;
1751 /* end new distances */
1753 /*SETDISTANCE for CB and HE1 (1-5) */
1754 hisb_15_type2(logg[0],logg[1],logg[2],logg[3],logg[6],ilist,
1755 iparams,&blen,atoms);
1756 lb=(1.0-ring_margin)*blen;
1757 ub=(1.0+ring_margin)*blen;
1758 if (((weight[logg[0]] != 0.0) || (weight[logg[6]] != 0.0)) &&
1759 (!dist_set(d,natoms,logg[0],logg[6]))) {
1760 set_dist(d,natoms,logg[0],logg[6],lb,ub,blen);
1761 ndist++;
1762 n15dist++;
1764 /*SETDISTANCE for CB and HE2 (1-5) */
1765 hisb_15_type2(logg[0],logg[1],logg[5],logg[4],logg[7],ilist,
1766 iparams,&blen,atoms);
1767 lb=(1.0-ring_margin)*blen;
1768 ub=(1.0+ring_margin)*blen;
1769 if (((weight[logg[0]] != 0.0) || (weight[logg[7]] != 0.0)) &&
1770 (!dist_set(d,natoms,logg[0],logg[7]))) {
1771 set_dist(d,natoms,logg[0],logg[7],lb,ub,blen);
1772 ndist++;
1773 n15dist++;
1775 if (bVir) {
1776 /* VIRTUAL DISTANCES */
1777 nVdist = set_virtual (logg,9,ring_margin,d,natoms);
1778 ndist += nVdist;
1781 logg[10]=0;
1785 fprintf(log,"There are %d new histidine distances\n",ndist);
1787 if (ndist > 0 ) {
1788 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4, %d 1-5 \n",n12dist,n13dist,
1789 n14dist,n15dist);
1793 /**********************************************************
1795 * I S O L E U C I N E
1797 **********************************************************/
1798 void ile (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
1799 real ile_margin,t_ilist ilist[],t_iparams iparams[])
1801 /* Directly based on val.c */
1802 int natoms,ndist,i,j,logg[15],residnr,oldresidnr,n14dist,n15dist;
1803 real blen,lb,ub,angle;
1804 real pi = M_PI;
1806 natoms= atoms->nr;
1807 ndist = 0;
1808 n14dist = 0;
1809 n15dist = 0;
1810 residnr = -1;
1811 oldresidnr=-1;
1813 for (i=0; (i<natoms); i++) {
1814 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"ILE") == 0) {
1815 oldresidnr=residnr;
1816 residnr=atoms->atom[i].resnr;
1817 logg[14]=0;
1818 if ( oldresidnr == residnr ) {
1819 continue;
1821 j=i;
1822 while ((atoms->atom[j].resnr) == residnr ) {
1823 if ( strcmp((*atoms->atomname[j]),"CA") == 0) {
1824 logg[14]++;
1825 logg[0]=j;
1827 else if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
1828 logg[14]++;
1829 logg[1]=j;
1831 else if ( strcmp((*atoms->atomname[j]),"HB") == 0) {
1832 logg[14]++;
1833 logg[2]=j;
1835 else if ( strcmp((*atoms->atomname[j]),"CD") == 0) {
1836 logg[14]++;
1837 logg[3]=j;
1839 else if ( strcmp((*atoms->atomname[j]),"HD1") == 0) {
1840 logg[14]++;
1841 logg[4]=j;
1843 else if ( strcmp((*atoms->atomname[j]),"HD2") == 0) {
1844 logg[14]++;
1845 logg[5]=j;
1847 else if ( strcmp((*atoms->atomname[j]),"HD3") == 0) {
1848 logg[14]++;
1849 logg[6]=j;
1851 else if ( strcmp((*atoms->atomname[j]),"CG1") == 0) {
1852 logg[14]++;
1853 logg[7]=j;
1855 else if ( strcmp((*atoms->atomname[j]),"HG11") == 0) {
1856 logg[14]++;
1857 logg[8]=j;
1859 else if ( strcmp((*atoms->atomname[j]),"HG12") == 0) {
1860 logg[14]++;
1861 logg[9]=j;
1863 else if ( strcmp((*atoms->atomname[j]),"CG2") == 0) {
1864 logg[14]++;
1865 logg[10]=j;
1867 else if ( strcmp((*atoms->atomname[j]),"HG21") == 0) {
1868 logg[14]++;
1869 logg[11]=j;
1871 else if ( strcmp((*atoms->atomname[j]),"HG22") == 0) {
1872 logg[14]++;
1873 logg[12]=j;
1875 else if ( strcmp((*atoms->atomname[j]),"HG23") == 0) {
1876 logg[14]++;
1877 logg[13]=j;
1879 if ( logg[14] == 14) {
1880 break;
1882 j++;
1884 if ( logg[14] == 14 ) {
1885 fprintf(log,"logg (ile) =%d %d %d %d %d %d %d %d %d %d %d %d %d %d\n"
1886 ,logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],logg[7],
1887 logg[8],logg[9],logg[10],logg[11],logg[12],logg[13]);
1889 /*SETDISTANCE for HD1 and CB */
1890 gauche(logg[4],logg[3],logg[7],logg[1],ilist,iparams,&blen,atoms);
1891 lb=(1.0-ile_margin)*blen;
1892 ub=(1.0+ile_margin)*blen;
1893 if (((weight[logg[4]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1894 (!dist_set(d,natoms,logg[4],logg[1]))) {
1895 set_dist(d,natoms,logg[4],logg[1],lb,ub,blen);
1896 ndist++;
1897 n14dist++;
1899 /*SETDISTANCE for HD1 and HG12 */
1900 gauche(logg[4],logg[3],logg[7],logg[9],ilist,iparams,&blen,atoms);
1901 lb=(1.0-ile_margin)*blen;
1902 ub=(1.0+ile_margin)*blen;
1903 if (((weight[logg[4]] != 0.0) || (weight[logg[9]] != 0.0)) &&
1904 (!dist_set(d,natoms,logg[4],logg[9]))) {
1905 set_dist(d,natoms,logg[4],logg[9],lb,ub,blen);
1906 ndist++;
1907 n14dist++;
1909 /*SETDISTANCE for HD1 and HG11 */
1910 pdih_lengths(logg[4],logg[3],logg[7],logg[8],ilist,iparams,
1911 &lb,&blen,atoms);
1912 lb=(1.0-ile_margin)*blen;
1913 ub=(1.0+ile_margin)*blen;
1914 if (((weight[logg[4]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1915 (!dist_set(d,natoms,logg[4],logg[8]))) {
1916 set_dist(d,natoms,logg[4],logg[8],lb,ub,blen);
1917 ndist++;
1918 n14dist++;
1921 /*SETDISTANCE for HD2 and CB */
1922 gauche(logg[5],logg[3],logg[7],logg[1],ilist,iparams,&blen,atoms);
1923 lb=(1.0-ile_margin)*blen;
1924 ub=(1.0+ile_margin)*blen;
1925 if (((weight[logg[5]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1926 (!dist_set(d,natoms,logg[5],logg[1]))) {
1927 set_dist(d,natoms,logg[5],logg[1],lb,ub,blen);
1928 ndist++;
1929 n14dist++;
1931 /*SETDISTANCE for HD2 and HG11 */
1932 gauche(logg[5],logg[3],logg[7],logg[8],ilist,iparams,&blen,atoms);
1933 lb=(1.0-ile_margin)*blen;
1934 ub=(1.0+ile_margin)*blen;
1935 if (((weight[logg[5]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1936 (!dist_set(d,natoms,logg[5],logg[8]))) {
1937 set_dist(d,natoms,logg[5],logg[8],lb,ub,blen);
1938 ndist++;
1939 n14dist++;
1941 /*SETDISTANCE for HD2 and HG12 */
1942 pdih_lengths(logg[5],logg[3],logg[7],logg[9],ilist,iparams,
1943 &lb,&blen,atoms);
1944 lb=(1.0-ile_margin)*blen;
1945 ub=(1.0+ile_margin)*blen;
1946 if (((weight[logg[5]] != 0.0) || (weight[logg[9]] != 0.0)) &&
1947 (!dist_set(d,natoms,logg[5],logg[9]))) {
1948 set_dist(d,natoms,logg[5],logg[9],lb,ub,blen);
1949 ndist++;
1950 n14dist++;
1953 /*SETDISTANCE for HD3 and HG12 */
1954 gauche(logg[6],logg[3],logg[7],logg[9],ilist,iparams,&blen,atoms);
1955 lb=(1.0-ile_margin)*blen;
1956 ub=(1.0+ile_margin)*blen;
1957 if (((weight[logg[6]] != 0.0) || (weight[logg[9]] != 0.0)) &&
1958 (!dist_set(d,natoms,logg[6],logg[9]))) {
1959 set_dist(d,natoms,logg[6],logg[9],lb,ub,blen);
1960 ndist++;
1961 n14dist++;
1963 /*SETDISTANCE for HD3 and HG11 */
1964 gauche(logg[6],logg[3],logg[7],logg[8],ilist,iparams,&blen,atoms);
1965 lb=(1.0-ile_margin)*blen;
1966 ub=(1.0+ile_margin)*blen;
1967 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
1968 (!dist_set(d,natoms,logg[6],logg[8]))) {
1969 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
1970 ndist++;
1971 n14dist++;
1973 /*SETDISTANCE for HD3 and CB */
1974 pdih_lengths(logg[6],logg[3],logg[7],logg[1],ilist,iparams,
1975 &lb,&blen,atoms);
1976 lb=(1.0-ile_margin)*blen;
1977 ub=(1.0+ile_margin)*blen;
1978 if (((weight[logg[6]] != 0.0) || (weight[logg[1]] != 0.0)) &&
1979 (!dist_set(d,natoms,logg[6],logg[1]))) {
1980 set_dist(d,natoms,logg[6],logg[1],lb,ub,blen);
1981 ndist++;
1982 n14dist++;
1985 /*SETDISTANCE for HG21 and CG1 */
1986 gauche(logg[11],logg[10],logg[1],logg[7],ilist,iparams,&blen,atoms);
1987 lb=(1.0-ile_margin)*blen;
1988 ub=(1.0+ile_margin)*blen;
1989 if (((weight[logg[11]] != 0.0) || (weight[logg[7]] != 0.0)) &&
1990 (!dist_set(d,natoms,logg[11],logg[7]))) {
1991 set_dist(d,natoms,logg[11],logg[7],lb,ub,blen);
1992 ndist++;
1993 n14dist++;
1995 /*SETDISTANCE for HG21 and HB */
1996 gauche(logg[11],logg[10],logg[1],logg[2],ilist,iparams,&blen,atoms);
1997 lb=(1.0-ile_margin)*blen;
1998 ub=(1.0+ile_margin)*blen;
1999 if (((weight[logg[11]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2000 (!dist_set(d,natoms,logg[11],logg[2]))) {
2001 set_dist(d,natoms,logg[11],logg[2],lb,ub,blen);
2002 ndist++;
2003 n14dist++;
2005 /*SETDISTANCE for HG21 and CA */
2006 pdih_lengths(logg[11],logg[10],logg[1],logg[0],ilist,iparams,
2007 &lb,&blen,atoms);
2008 lb=(1.0-ile_margin)*blen;
2009 ub=(1.0+ile_margin)*blen;
2010 if (((weight[logg[11]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2011 (!dist_set(d,natoms,logg[11],logg[0]))) {
2012 set_dist(d,natoms,logg[11],logg[0],lb,ub,blen);
2013 ndist++;
2014 n14dist++;
2017 /*SETDISTANCE for HG22 and CG1 */
2018 gauche(logg[12],logg[10],logg[1],logg[7],ilist,iparams,&blen,atoms);
2019 lb=(1.0-ile_margin)*blen;
2020 ub=(1.0+ile_margin)*blen;
2021 if (((weight[logg[12]] != 0.0) || (weight[logg[7]] != 0.0)) &&
2022 (!dist_set(d,natoms,logg[12],logg[7]))) {
2023 set_dist(d,natoms,logg[12],logg[7],lb,ub,blen);
2024 ndist++;
2025 n14dist++;
2027 /*SETDISTANCE for HG22 and CA */
2028 gauche(logg[12],logg[10],logg[1],logg[0],ilist,iparams,&blen,atoms);
2029 lb=(1.0-ile_margin)*blen;
2030 ub=(1.0+ile_margin)*blen;
2031 if (((weight[logg[12]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2032 (!dist_set(d,natoms,logg[12],logg[0]))) {
2033 set_dist(d,natoms,logg[12],logg[0],lb,ub,blen);
2034 ndist++;
2035 n14dist++;
2037 /*SETDISTANCE for HG22 and HB */
2038 pdih_lengths(logg[12],logg[10],logg[1],logg[2],ilist,iparams,
2039 &lb,&blen,atoms);
2040 lb=(1.0-ile_margin)*blen;
2041 ub=(1.0+ile_margin)*blen;
2042 if (((weight[logg[12]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2043 (!dist_set(d,natoms,logg[12],logg[2]))) {
2044 set_dist(d,natoms,logg[12],logg[2],lb,ub,blen);
2045 ndist++;
2046 n14dist++;
2049 /*SETDISTANCE for HG23 and CA */
2050 gauche(logg[13],logg[10],logg[1],logg[0],ilist,iparams,&blen,atoms);
2051 lb=(1.0-ile_margin)*blen;
2052 ub=(1.0+ile_margin)*blen;
2053 if (((weight[logg[13]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2054 (!dist_set(d,natoms,logg[13],logg[0]))) {
2055 set_dist(d,natoms,logg[13],logg[0],lb,ub,blen);
2056 ndist++;
2057 n14dist++;
2059 /*SETDISTANCE for HG23 and HB */
2060 gauche(logg[13],logg[10],logg[1],logg[2],ilist,iparams,&blen,atoms);
2061 lb=(1.0-ile_margin)*blen;
2062 ub=(1.0+ile_margin)*blen;
2063 if (((weight[logg[13]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2064 (!dist_set(d,natoms,logg[13],logg[2]))) {
2065 set_dist(d,natoms,logg[13],logg[2],lb,ub,blen);
2066 ndist++;
2067 n14dist++;
2069 /*SETDISTANCE for HG23 and CG1*/
2070 pdih_lengths(logg[13],logg[10],logg[1],logg[7],ilist,iparams,
2071 &lb,&blen,atoms);
2072 lb=(1.0-ile_margin)*blen;
2073 ub=(1.0+ile_margin)*blen;
2074 if (((weight[logg[13]] != 0.0) || (weight[logg[7]] != 0.0)) &&
2075 (!dist_set(d,natoms,logg[13],logg[7]))) {
2076 set_dist(d,natoms,logg[13],logg[7],lb,ub,blen);
2077 ndist++;
2078 n14dist++;
2082 logg[14]=0;
2085 fprintf(log,"There are %d distances to keep isoleucine gauche\n",ndist);
2086 if (ndist > 0 ) {
2087 fprintf(log,"(%d 1-4, %d 1-5)\n",n14dist,n15dist);
2091 /**********************************************************
2093 * L E U C I N E
2095 **********************************************************/
2096 void leu (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
2097 real leu_margin,t_ilist ilist[],t_iparams iparams[])
2099 /* Directly based on val.c */
2100 int natoms,ndist,i,j,logg[12],residnr,oldresidnr,n14dist,n15dist;
2101 real blen,lb,ub,angle;
2102 real pi = M_PI;
2104 natoms= atoms->nr;
2105 ndist = 0;
2106 n14dist = 0;
2107 n15dist = 0;
2108 residnr = -1;
2109 oldresidnr=-1;
2111 for (i=0; (i<natoms); i++) {
2112 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"LEU") == 0) {
2113 oldresidnr=residnr;
2114 residnr=atoms->atom[i].resnr;
2115 logg[11]=0;
2116 if ( oldresidnr == residnr ) {
2117 continue;
2119 j=i;
2120 while ((atoms->atom[j].resnr) == residnr ) {
2121 if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
2122 logg[11]++;
2123 logg[0]=j;
2125 else if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
2126 logg[11]++;
2127 logg[1]=j;
2129 else if ( strcmp((*atoms->atomname[j]),"HG") == 0) {
2130 logg[11]++;
2131 logg[2]=j;
2133 else if ( strcmp((*atoms->atomname[j]),"CD1") == 0) {
2134 logg[11]++;
2135 logg[3]=j;
2137 else if ( strcmp((*atoms->atomname[j]),"HD11") == 0) {
2138 logg[11]++;
2139 logg[4]=j;
2141 else if ( strcmp((*atoms->atomname[j]),"HD12") == 0) {
2142 logg[11]++;
2143 logg[5]=j;
2145 else if ( strcmp((*atoms->atomname[j]),"HD13") == 0) {
2146 logg[11]++;
2147 logg[6]=j;
2149 else if ( strcmp((*atoms->atomname[j]),"CD2") == 0) {
2150 logg[11]++;
2151 logg[7]=j;
2153 else if ( strcmp((*atoms->atomname[j]),"HD21") == 0) {
2154 logg[11]++;
2155 logg[8]=j;
2157 else if ( strcmp((*atoms->atomname[j]),"HD22") == 0) {
2158 logg[11]++;
2159 logg[9]=j;
2161 else if ( strcmp((*atoms->atomname[j]),"HD23") == 0) {
2162 logg[11]++;
2163 logg[10]=j;
2165 if ( logg[11] == 11) {
2166 break;
2168 j++;
2170 if ( logg[11] == 11 ) {
2171 fprintf(log,"logg (leu) = %d %d %d %d %d %d %d %d %d %d %d\n",
2172 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
2173 logg[7],logg[8],logg[9],logg[10]);
2174 /*SETDISTANCE for HD11 and CB */
2175 gauche(logg[4],logg[3],logg[1],logg[0],ilist,iparams,&blen,atoms);
2176 lb=(1.0-leu_margin)*blen;
2177 ub=(1.0+leu_margin)*blen;
2178 if (((weight[logg[4]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2179 (!dist_set(d,natoms,logg[4],logg[0]))) {
2180 set_dist(d,natoms,logg[4],logg[0],lb,ub,blen);
2181 ndist++;
2182 n14dist++;
2184 /*SETDISTANCE for HD11 and CD2 */
2185 gauche(logg[4],logg[3],logg[1],logg[7],ilist,iparams,&blen,atoms);
2186 lb=(1.0-leu_margin)*blen;
2187 ub=(1.0+leu_margin)*blen;
2188 if (((weight[logg[4]] != 0.0) || (weight[logg[7]] != 0.0)) &&
2189 (!dist_set(d,natoms,logg[4],logg[7]))) {
2190 set_dist(d,natoms,logg[4],logg[7],lb,ub,blen);
2191 ndist++;
2192 n14dist++;
2194 /*SETDISTANCE for HD11 and HG */
2195 pdih_lengths(logg[4],logg[3],logg[1],logg[2],ilist,iparams,
2196 &lb,&blen,atoms);
2197 lb=(1.0-leu_margin)*blen;
2198 ub=(1.0+leu_margin)*blen;
2199 if (((weight[logg[4]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2200 (!dist_set(d,natoms,logg[4],logg[2]))) {
2201 set_dist(d,natoms,logg[4],logg[2],lb,ub,blen);
2202 ndist++;
2203 n14dist++;
2205 /*SETDISTANCE for HD12 and CD2 */
2206 gauche(logg[5],logg[3],logg[1],logg[7],ilist,iparams,&blen,atoms);
2207 lb=(1.0-leu_margin)*blen;
2208 ub=(1.0+leu_margin)*blen;
2209 if (((weight[logg[5]] != 0.0) || (weight[logg[7]] != 0.0)) &&
2210 (!dist_set(d,natoms,logg[5],logg[7]))) {
2211 set_dist(d,natoms,logg[5],logg[7],lb,ub,blen);
2212 ndist++;
2213 n14dist++;
2215 /*SETDISTANCE for HD12 and HG */
2216 gauche(logg[5],logg[3],logg[1],logg[2],ilist,iparams,&blen,atoms);
2217 lb=(1.0-leu_margin)*blen;
2218 ub=(1.0+leu_margin)*blen;
2219 if (((weight[logg[5]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2220 (!dist_set(d,natoms,logg[5],logg[2]))) {
2221 set_dist(d,natoms,logg[5],logg[2],lb,ub,blen);
2222 ndist++;
2223 n14dist++;
2225 /*SETDISTANCE for HD12 and CB */
2226 pdih_lengths(logg[5],logg[3],logg[1],logg[0],ilist,iparams,
2227 &lb,&blen,atoms);
2228 lb=(1.0-leu_margin)*blen;
2229 ub=(1.0+leu_margin)*blen;
2230 if (((weight[logg[5]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2231 (!dist_set(d,natoms,logg[5],logg[0]))) {
2232 set_dist(d,natoms,logg[5],logg[0],lb,ub,blen);
2233 ndist++;
2234 n14dist++;
2236 /*SETDISTANCE for HD13 and HG */
2237 gauche(logg[6],logg[3],logg[1],logg[2],ilist,iparams,&blen,atoms);
2238 lb=(1.0-leu_margin)*blen;
2239 ub=(1.0+leu_margin)*blen;
2240 if (((weight[logg[6]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2241 (!dist_set(d,natoms,logg[6],logg[2]))) {
2242 set_dist(d,natoms,logg[6],logg[2],lb,ub,blen);
2243 ndist++;
2244 n14dist++;
2246 /*SETDISTANCE for HD13 and CB */
2247 gauche(logg[6],logg[3],logg[1],logg[0],ilist,iparams,&blen,atoms);
2248 lb=(1.0-leu_margin)*blen;
2249 ub=(1.0+leu_margin)*blen;
2250 if (((weight[logg[6]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2251 (!dist_set(d,natoms,logg[6],logg[0]))) {
2252 set_dist(d,natoms,logg[6],logg[0],lb,ub,blen);
2253 ndist++;
2254 n14dist++;
2256 /*SETDISTANCE for HD13 and CD2 */
2257 pdih_lengths(logg[6],logg[3],logg[1],logg[7],ilist,iparams,
2258 &lb,&blen,atoms);
2259 lb=(1.0-leu_margin)*blen;
2260 ub=(1.0+leu_margin)*blen;
2261 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
2262 (!dist_set(d,natoms,logg[6],logg[7]))) {
2263 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
2264 ndist++;
2265 n14dist++;
2267 /*SETDISTANCE for HD21 and HG */
2268 gauche(logg[8],logg[7],logg[1],logg[2],ilist,iparams,&blen,atoms);
2269 lb=(1.0-leu_margin)*blen;
2270 ub=(1.0+leu_margin)*blen;
2271 if (((weight[logg[8]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2272 (!dist_set(d,natoms,logg[8],logg[2]))) {
2273 set_dist(d,natoms,logg[8],logg[2],lb,ub,blen);
2274 ndist++;
2275 n14dist++;
2277 /*SETDISTANCE for HD21 and CD1 */
2278 gauche(logg[8],logg[7],logg[1],logg[3],ilist,iparams,&blen,atoms);
2279 lb=(1.0-leu_margin)*blen;
2280 ub=(1.0+leu_margin)*blen;
2281 if (((weight[logg[8]] != 0.0) || (weight[logg[3]] != 0.0)) &&
2282 (!dist_set(d,natoms,logg[8],logg[3]))) {
2283 set_dist(d,natoms,logg[8],logg[3],lb,ub,blen);
2284 ndist++;
2285 n14dist++;
2287 /*SETDISTANCE for HD21 and CB */
2288 pdih_lengths(logg[8],logg[7],logg[1],logg[0],ilist,iparams,
2289 &lb,&blen,atoms);
2290 lb=(1.0-leu_margin)*blen;
2291 ub=(1.0+leu_margin)*blen;
2292 if (((weight[logg[8]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2293 (!dist_set(d,natoms,logg[8],logg[0]))) {
2294 set_dist(d,natoms,logg[8],logg[0],lb,ub,blen);
2295 ndist++;
2296 n14dist++;
2298 /*SETDISTANCE for HD22 and CD1 */
2299 gauche(logg[9],logg[7],logg[1],logg[3],ilist,iparams,&blen,atoms);
2300 lb=(1.0-leu_margin)*blen;
2301 ub=(1.0+leu_margin)*blen;
2302 if (((weight[logg[9]] != 0.0) || (weight[logg[3]] != 0.0)) &&
2303 (!dist_set(d,natoms,logg[9],logg[3]))) {
2304 set_dist(d,natoms,logg[9],logg[3],lb,ub,blen);
2305 ndist++;
2306 n14dist++;
2308 /*SETDISTANCE for HD22 and CB */
2309 gauche(logg[9],logg[7],logg[1],logg[0],ilist,iparams,&blen,atoms);
2310 lb=(1.0-leu_margin)*blen;
2311 ub=(1.0+leu_margin)*blen;
2312 if (((weight[logg[9]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2313 (!dist_set(d,natoms,logg[9],logg[0]))) {
2314 set_dist(d,natoms,logg[9],logg[0],lb,ub,blen);
2315 ndist++;
2316 n14dist++;
2318 /*SETDISTANCE for HD22 and HG */
2319 pdih_lengths(logg[9],logg[7],logg[1],logg[2],ilist,iparams,
2320 &lb,&blen,atoms);
2321 lb=(1.0-leu_margin)*blen;
2322 ub=(1.0+leu_margin)*blen;
2323 if (((weight[logg[9]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2324 (!dist_set(d,natoms,logg[9],logg[2]))) {
2325 set_dist(d,natoms,logg[9],logg[2],lb,ub,blen);
2326 ndist++;
2327 n14dist++;
2329 /*SETDISTANCE for HD23 and CB */
2330 gauche(logg[10],logg[7],logg[1],logg[0],ilist,iparams,&blen,atoms);
2331 lb=(1.0-leu_margin)*blen;
2332 ub=(1.0+leu_margin)*blen;
2333 if (((weight[logg[10]] != 0.0) || (weight[logg[0]] != 0.0)) &&
2334 (!dist_set(d,natoms,logg[10],logg[0]))) {
2335 set_dist(d,natoms,logg[10],logg[0],lb,ub,blen);
2336 ndist++;
2337 n14dist++;
2339 /*SETDISTANCE for HD23 and HG */
2340 gauche(logg[10],logg[7],logg[1],logg[2],ilist,iparams,&blen,atoms);
2341 lb=(1.0-leu_margin)*blen;
2342 ub=(1.0+leu_margin)*blen;
2343 if (((weight[logg[10]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2344 (!dist_set(d,natoms,logg[10],logg[2]))) {
2345 set_dist(d,natoms,logg[10],logg[2],lb,ub,blen);
2346 ndist++;
2347 n14dist++;
2349 /*SETDISTANCE for HD23 and CD1 */
2350 pdih_lengths(logg[10],logg[7],logg[1],logg[3],ilist,iparams,
2351 &lb,&blen,atoms);
2352 lb=(1.0-leu_margin)*blen;
2353 ub=(1.0+leu_margin)*blen;
2354 if (((weight[logg[10]] != 0.0) || (weight[logg[3]] != 0.0)) &&
2355 (!dist_set(d,natoms,logg[10],logg[3]))) {
2356 set_dist(d,natoms,logg[10],logg[3],lb,ub,blen);
2357 ndist++;
2358 n14dist++;
2361 /* 111111111-----------5555555555 */
2362 /*SETDISTANCE for HD11 and HD21 */
2363 gauche15(logg[4],logg[3],logg[1],logg[7],logg[8],pi,pi+(pi/3.0),
2364 pi+(pi/3.0),ilist,iparams,&blen,atoms);
2365 lb=(1.0-leu_margin)*blen;
2366 ub=(1.0+leu_margin)*blen;
2367 if (((weight[logg[4]] != 0.0) || (weight[logg[8]] != 0.0)) &&
2368 (!dist_set(d,natoms,logg[4],logg[8]))) {
2369 set_dist(d,natoms,logg[4],logg[8],lb,ub,blen);
2370 ndist++;
2371 n15dist++;
2373 /*SETDISTANCE for HD11 and HD22 */
2374 gauche15(logg[4],logg[3],logg[1],logg[7],logg[9],pi,pi+pi/3.0,
2375 pi-(pi/3.0),ilist,iparams,&blen,atoms);
2376 lb=(1.0-leu_margin)*blen;
2377 ub=(1.0+leu_margin)*blen;
2378 if (((weight[logg[4]] != 0.0) || (weight[logg[9]] != 0.0)) &&
2379 (!dist_set(d,natoms,logg[4],logg[9]))) {
2380 set_dist(d,natoms,logg[4],logg[9],lb,ub,blen);
2381 ndist++;
2382 n15dist++;
2384 /*SETDISTANCE for HD11 and HD23 */
2385 gauche15(logg[4],logg[3],logg[1],logg[7],logg[10],pi,pi+(pi/3.0),0,
2386 ilist,iparams,&blen,atoms);
2387 lb=(1.0-leu_margin)*blen;
2388 ub=(1.0+leu_margin)*blen;
2389 if (((weight[logg[4]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2390 (!dist_set(d,natoms,logg[4],logg[10]))) {
2391 set_dist(d,natoms,logg[4],logg[10],lb,ub,blen);
2392 ndist++;
2393 n15dist++;
2397 /*SETDISTANCE for HD12 and HD21 */
2398 gauche15(logg[5],logg[3],logg[1],logg[7],logg[8],pi,pi-pi/3.0,
2399 pi+pi/3.0,ilist,iparams,&blen,atoms);
2400 lb=(1.0-leu_margin)*blen;
2401 ub=(1.0+leu_margin)*blen;
2402 if (((weight[logg[5]] != 0.0) || (weight[logg[8]] != 0.0)) &&
2403 (!dist_set(d,natoms,logg[5],logg[8]))) {
2404 set_dist(d,natoms,logg[5],logg[8],lb,ub,blen);
2405 ndist++;
2406 n15dist++;
2408 /*SETDISTANCE for HD12 and HD22 */
2409 gauche15(logg[5],logg[3],logg[1],logg[7],logg[9],pi,pi-pi/3.0,
2410 pi-pi/3.0,ilist,iparams,&blen,atoms);
2411 lb=(1.0-leu_margin)*blen;
2412 ub=(1.0+leu_margin)*blen;
2413 if (((weight[logg[5]] != 0.0) || (weight[logg[9]] != 0.0)) &&
2414 (!dist_set(d,natoms,logg[5],logg[9]))) {
2415 set_dist(d,natoms,logg[5],logg[9],lb,ub,blen);
2416 ndist++;
2417 n15dist++;
2419 /*SETDISTANCE for HD12 and HD23 */
2420 gauche15(logg[5],logg[3],logg[1],logg[7],logg[10],pi,pi-pi/3.0,0,ilist,
2421 iparams,&blen,atoms);
2422 lb=(1.0-leu_margin)*blen;
2423 ub=(1.0+leu_margin)*blen;
2424 if (((weight[logg[5]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2425 (!dist_set(d,natoms,logg[5],logg[10]))) {
2426 set_dist(d,natoms,logg[5],logg[10],lb,ub,blen);
2427 ndist++;
2428 n15dist++;
2431 /*SETDISTANCE for HD13 and HD21 */
2432 gauche15(logg[6],logg[3],logg[1],logg[7],logg[8],pi,0,pi+pi/3.0,
2433 ilist,iparams,&blen,atoms);
2434 lb=(1.0-leu_margin)*blen;
2435 ub=(1.0+leu_margin)*blen;
2436 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
2437 (!dist_set(d,natoms,logg[6],logg[8]))) {
2438 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
2439 ndist++;
2440 n15dist++;
2442 /*SETDISTANCE for HD13 and HD22 */
2443 gauche15(logg[6],logg[3],logg[1],logg[7],logg[9],pi,0,pi-pi/3.0,
2444 ilist,iparams,&blen,atoms);
2445 lb=(1.0-leu_margin)*blen;
2446 ub=(1.0+leu_margin)*blen;
2447 if (((weight[logg[6]] != 0.0) || (weight[logg[9]] != 0.0)) &&
2448 (!dist_set(d,natoms,logg[6],logg[9]))) {
2449 set_dist(d,natoms,logg[6],logg[9],lb,ub,blen);
2450 ndist++;
2451 n15dist++;
2453 /*SETDISTANCE for HD13 and HD23 */
2454 gauche15(logg[6],logg[3],logg[1],logg[7],logg[10],pi,0,0,ilist,
2455 iparams,&blen,atoms);
2456 lb=(1.0-leu_margin)*blen;
2457 ub=(1.0+leu_margin)*blen;
2458 if (((weight[logg[6]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2459 (!dist_set(d,natoms,logg[6],logg[10]))) {
2460 set_dist(d,natoms,logg[6],logg[10],lb,ub,blen);
2461 ndist++;
2462 n15dist++;
2467 logg[11]=0;
2470 fprintf(log,"There are %d distances to keep leucine gauche\n",ndist);
2471 if (ndist > 0 ) {
2472 fprintf(log,"(%d 1-4, %d 1-5)\n",n14dist,n15dist);
2476 /**********************************************************
2478 * P H E N Y L A L A N I N E
2480 **********************************************************/
2481 static void phe_15_CBHE(int ai,int aj,int ak,int al,int am,
2482 t_ilist ilist[],t_iparams iparams[],
2483 real *lb,t_atoms *atoms)
2485 /* Returns the length corresponding to a 1-5 distance */
2486 real rij,rjk,rkl,rlm,rik,rkm,rim;
2487 real thijk,thjkl,thklm,thikj,thmkl;
2488 real real_pi = M_PI*2.0;
2489 real half_pi = M_PI*0.5;
2491 /* fprintf(stderr,"Got past initialisations\n");*/
2492 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
2493 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
2494 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
2495 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
2496 /*fprintf(stderr,"Got past lookup_bondlength\n");*/
2497 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
2498 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
2499 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
2500 /*fprintf(stderr,"Got past lookup_angle\n");*/
2501 /*fprintf(stderr,"%g %g %g %g %g %g %g\n",rij,rjk,rkl,rlm,RAD2DEG*thijk,
2502 RAD2DEG*thjkl,RAD2DEG*thklm);*/
2503 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
2504 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
2505 /*fprintf(stderr,"Got past angle_length\n");*/
2507 /* Compute angle thikj using law of sines */
2508 thikj = asin(rij*sin(thijk)/rik);
2510 /* Compute thmkl using law of sines */
2511 thmkl = asin(rlm*sin(thklm)/rkm);
2513 /* Compute cis length using law of cosines */
2514 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(real_pi-thikj-thmkl-thjkl));
2515 /*fprintf(stderr,"leaving routine\n");*/
2518 static void phe_15_CBCZ(int ai,int aj,int ak,int al,int am,
2519 t_ilist ilist[],t_iparams iparams[],
2520 real *lb,t_atoms *atoms)
2522 /* Returns the length corresponding to a 1-5 distance */
2523 real rij,rjk,rkl,rlm,rik,rkm;
2524 real thijk,thjkl,thklm,thikj,thmkl;
2525 real real_pi = M_PI*2.0;
2526 real half_pi = M_PI*0.5;
2528 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
2529 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
2530 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
2531 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
2532 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
2533 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
2534 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
2535 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
2536 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
2538 /* Compute angle thikj using law of sines */
2539 thikj = asin(rij*sin(thijk)/rik);
2541 /* Compute thmkl using law of sines */
2542 thmkl = asin(rlm*sin(thklm)/rkm);
2544 /* Compute cis length using law of cosines */
2545 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thjkl-thmkl+thikj));
2548 static void phe_15_CGHZ(int ai,int aj,int ak,int al,int am,
2549 t_ilist ilist[],t_iparams iparams[],
2550 real *lb,t_atoms *atoms)
2552 /* Returns the length corresponding to a 1-5 distance */
2553 real rij,rjk,rkl,rlm,rik,rkm;
2554 real thijk,thjkl,thklm,thikj,thmkl;
2555 real real_pi = M_PI*2.0;
2557 /*fprintf(stderr,"entering the routine\n");*/
2559 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
2560 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
2561 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
2562 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
2563 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
2564 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
2565 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
2566 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
2567 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
2568 /*fprintf(stderr,"Only calculations left\n");*/
2570 /* Compute angle thikj using law of sines */
2571 thikj = asin(rij*sin(thijk)/rik);
2573 /* Compute thmkl using law of sines */
2574 thmkl = asin(rlm*sin(thklm)/rkm);
2576 /* Compute cis length using law of cosines */
2577 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thjkl-thikj+thmkl));
2580 static void phe_16_type2(int ai,int aj,int ak,int al,int am,int an,
2581 t_ilist ilist[],t_iparams iparams[],
2582 real *lb,t_atoms *atoms)
2584 /* Returns the length corresponding to a 1-6 distance */
2586 real rij,rjk,rkl,rlm,rmn,rik,rln,ril;
2587 real thijk,thjkl,thklm,thlmn,thikj,thikl,thilk,thnlm,thiln;
2588 real real_pi = M_PI*2.0;
2589 real half_pi = M_PI*0.5;
2591 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
2592 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
2593 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
2594 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
2595 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
2596 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
2597 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
2598 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
2599 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
2601 /* Compute rik and rlm */
2602 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
2603 rln = sqrt(rlm*rlm+rmn*rmn-2.0*rlm*rmn*cos(thlmn));
2605 /* Compute thikj */
2606 thikj = asin(rij*sin(thijk)/rik);
2607 thikl = thikj+thjkl;
2609 /* Compute ril */
2610 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
2612 /* Compute thilk, thlnm and thiln */
2613 thilk = asin(rik*sin(thikl)/ril);
2614 thnlm = asin(rmn*sin(thlmn)/rln);
2615 thiln = thklm-thilk+thnlm;
2617 *lb = sqrt(ril*ril+rln*rln-2.0*ril*rln*cos(thiln));
2623 void phe (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
2624 real ring_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
2626 int natoms,ndist,i,j,q,logg[14],residnr,oldresidnr,n12dist,n13dist,n14dist,
2627 n15dist,n16dist,nVdist;
2628 real blen,lb,ub,angle;
2630 natoms= atoms->nr;
2631 ndist = 0;
2632 n12dist = 0;
2633 n13dist = 0;
2634 n14dist = 0;
2635 n15dist = 0;
2636 n16dist = 0;
2637 nVdist = 0;
2638 residnr = -1;
2639 oldresidnr=-1;
2641 for (i=0; (i<natoms); i++) {
2642 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"PHE") == 0) {
2643 oldresidnr=residnr;
2644 residnr=atoms->atom[i].resnr;
2645 logg[13]=0;
2646 if ( oldresidnr == residnr ) {
2647 continue;
2649 j=i;
2650 while ((atoms->atom[j].resnr) == residnr ) {
2651 if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
2652 logg[13]++;
2653 logg[0]=j;
2655 else if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
2656 logg[13]++;
2657 logg[1]=j;
2659 else if ( strcmp((*atoms->atomname[j]),"CD2") == 0) {
2660 logg[13]++;
2661 logg[2]=j;
2663 else if ( strcmp((*atoms->atomname[j]),"HD2") == 0) {
2664 logg[13]++;
2665 logg[3]=j;
2667 else if ( strcmp((*atoms->atomname[j]),"CE2") == 0) {
2668 logg[13]++;
2669 logg[4]=j;
2671 else if ( strcmp((*atoms->atomname[j]),"HE2") == 0) {
2672 logg[13]++;
2673 logg[5]=j;
2675 else if ( strcmp((*atoms->atomname[j]),"CZ") == 0) {
2676 logg[13]++;
2677 logg[6]=j;
2679 else if ( strcmp((*atoms->atomname[j]),"HZ") == 0) {
2680 logg[13]++;
2681 logg[7]=j;
2683 else if ( strcmp((*atoms->atomname[j]),"CE1") == 0) {
2684 logg[13]++;
2685 logg[8]=j;
2687 else if ( strcmp((*atoms->atomname[j]),"HE1") == 0) {
2688 logg[13]++;
2689 logg[9]=j;
2691 else if ( strcmp((*atoms->atomname[j]),"CD1") == 0) {
2692 logg[13]++;
2693 logg[10]=j;
2695 else if ( strcmp((*atoms->atomname[j]),"HD1") == 0) {
2696 logg[13]++;
2697 logg[11]=j;
2699 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
2700 logg[13]++;
2701 logg[12]=j;
2703 if ( ((logg[13] == 12) && !bVir) || ((logg[13] == 13) && bVir) ) {
2704 break;
2706 j++;
2708 if ( ((logg[13] == 12) && !bVir) || ((logg[13] == 13) && bVir) ) {
2710 if ((logg[13] == 12) && !bVir) {
2711 fprintf(log,"logg (phe) = %d %d %d %d %d %d %d %d %d %d %d %d\n",
2712 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
2713 logg[7],logg[8],logg[9],logg[10],logg[11]);
2715 else if ((logg[13] == 13) && bVir) {
2716 fprintf(log,"logg (phe) = %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
2717 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
2718 logg[7],logg[8],logg[9],logg[10],logg[11],logg[12]);
2721 /*SETDISTANCE for CB and CG (1-2) */
2722 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
2723 lb=(1.0-ring_margin)*blen;
2724 ub=(1.0+ring_margin)*blen;
2725 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
2726 (!dist_set(d,natoms,logg[0],logg[1]))) {
2727 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
2728 ndist++;
2729 n12dist++;
2731 /*SETDISTANCE for CG and CD2 (1-2) */
2732 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
2733 lb=(1.0-ring_margin)*blen;
2734 ub=(1.0+ring_margin)*blen;
2735 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2736 (!dist_set(d,natoms,logg[1],logg[2]))) {
2737 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
2738 ndist++;
2739 n12dist++;
2741 /*SETDISTANCE for CD2 and HD2 (1-2) */
2742 blen=lookup_bondlength(logg[2],logg[3],ilist,iparams,TRUE,atoms);
2743 lb=(1.0-ring_margin)*blen;
2744 ub=(1.0+ring_margin)*blen;
2745 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
2746 (!dist_set(d,natoms,logg[2],logg[3]))) {
2747 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
2748 ndist++;
2749 n12dist++;
2751 /*SETDISTANCE for CD2 and CE2 (1-2) */
2752 blen=lookup_bondlength(logg[2],logg[4],ilist,iparams,TRUE,atoms);
2753 lb=(1.0-ring_margin)*blen;
2754 ub=(1.0+ring_margin)*blen;
2755 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
2756 (!dist_set(d,natoms,logg[2],logg[4]))) {
2757 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
2758 ndist++;
2759 n12dist++;
2761 /*SETDISTANCE for CE2 and HE2 (1-2) */
2762 blen=lookup_bondlength(logg[4],logg[5],ilist,iparams,TRUE,atoms);
2763 lb=(1.0-ring_margin)*blen;
2764 ub=(1.0+ring_margin)*blen;
2765 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
2766 (!dist_set(d,natoms,logg[4],logg[5]))) {
2767 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
2768 ndist++;
2769 n12dist++;
2771 /*SETDISTANCE for CE2 and CZ (1-2) */
2772 blen=lookup_bondlength(logg[4],logg[6],ilist,iparams,TRUE,atoms);
2773 lb=(1.0-ring_margin)*blen;
2774 ub=(1.0+ring_margin)*blen;
2775 if (((weight[logg[4]] != 0.0) || (weight[logg[6]] != 0.0)) &&
2776 (!dist_set(d,natoms,logg[4],logg[6]))) {
2777 set_dist(d,natoms,logg[4],logg[6],lb,ub,blen);
2778 ndist++;
2779 n12dist++;
2781 /*SETDISTANCE for CZ and HZ (1-2) */
2782 blen=lookup_bondlength(logg[6],logg[7],ilist,iparams,TRUE,atoms);
2783 lb=(1.0-ring_margin)*blen;
2784 ub=(1.0+ring_margin)*blen;
2785 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
2786 (!dist_set(d,natoms,logg[6],logg[7]))) {
2787 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
2788 ndist++;
2789 n12dist++;
2791 /*SETDISTANCE for CZ and CE1 (1-2) */
2792 blen=lookup_bondlength(logg[6],logg[8],ilist,iparams,TRUE,atoms);
2793 lb=(1.0-ring_margin)*blen;
2794 ub=(1.0+ring_margin)*blen;
2795 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
2796 (!dist_set(d,natoms,logg[6],logg[8]))) {
2797 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
2798 ndist++;
2799 n12dist++;
2801 /*SETDISTANCE for CE1 and HE1 (1-2) */
2802 blen=lookup_bondlength(logg[8],logg[9],ilist,iparams,TRUE,atoms);
2803 lb=(1.0-ring_margin)*blen;
2804 ub=(1.0+ring_margin)*blen;
2805 if (((weight[logg[8]] != 0.0) || (weight[logg[9]] != 0.0)) &&
2806 (!dist_set(d,natoms,logg[8],logg[9]))) {
2807 set_dist(d,natoms,logg[8],logg[9],lb,ub,blen);
2808 ndist++;
2809 n12dist++;
2811 /*SETDISTANCE for CE1 and CD1 (1-2) */
2812 blen=lookup_bondlength(logg[8],logg[10],ilist,iparams,TRUE,atoms);
2813 lb=(1.0-ring_margin)*blen;
2814 ub=(1.0+ring_margin)*blen;
2815 if (((weight[logg[8]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2816 (!dist_set(d,natoms,logg[8],logg[10]))) {
2817 set_dist(d,natoms,logg[8],logg[10],lb,ub,blen);
2818 ndist++;
2819 n12dist++;
2821 /*SETDISTANCE for CD1 and HD1 (1-2) */
2822 blen=lookup_bondlength(logg[10],logg[11],ilist,iparams,TRUE,atoms);
2823 lb=(1.0-ring_margin)*blen;
2824 ub=(1.0+ring_margin)*blen;
2825 if (((weight[logg[10]] != 0.0) || (weight[logg[11]] != 0.0)) &&
2826 (!dist_set(d,natoms,logg[10],logg[11]))) {
2827 set_dist(d,natoms,logg[10],logg[11],lb,ub,blen);
2828 ndist++;
2829 n12dist++;
2831 /*SETDISTANCE for CD1 and CG (1-2) */
2832 blen=lookup_bondlength(logg[1],logg[10],ilist,iparams,TRUE,atoms);
2833 lb=(1.0-ring_margin)*blen;
2834 ub=(1.0+ring_margin)*blen;
2835 if (((weight[logg[1]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2836 (!dist_set(d,natoms,logg[1],logg[10]))) {
2837 set_dist(d,natoms,logg[1],logg[10],lb,ub,blen);
2838 ndist++;
2839 n12dist++;
2842 /* new 1-3 distances added 981126 */
2843 /*SETDISTANCE for CG and HD1 (1-3) */
2844 angle=lookup_angle(logg[1],logg[10],logg[11],ilist,iparams,atoms);
2845 blen=angle_length(logg[1],logg[10],logg[11],RAD2DEG*angle,ilist,iparams,
2846 atoms);
2847 lb=(1.0-ring_margin)*blen;
2848 ub=(1.0+ring_margin)*blen;
2849 if (((weight[logg[1]] != 0.0) || (weight[logg[11]] != 0.0)) &&
2850 (!dist_set(d,natoms,logg[1],logg[11]))) {
2851 set_dist(d,natoms,logg[1],logg[11],lb,ub,blen);
2852 ndist++;
2853 n13dist++;
2855 /* end of new 1-3 distances */
2857 /*SETDISTANCE for CD1 and CD2 (1-3) */
2858 angle=lookup_angle(logg[10],logg[1],logg[2],ilist,iparams,atoms);
2859 blen=angle_length(logg[10],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
2860 atoms);
2861 lb=(1.0-ring_margin)*blen;
2862 ub=(1.0+ring_margin)*blen;
2863 if (((weight[logg[10]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2864 (!dist_set(d,natoms,logg[10],logg[2]))) {
2865 set_dist(d,natoms,logg[10],logg[2],lb,ub,blen);
2866 ndist++;
2867 n13dist++;
2869 /*SETDISTANCE for CG and CE2 (1-3) */
2870 angle=lookup_angle(logg[1],logg[2],logg[4],ilist,iparams,atoms);
2871 blen=angle_length(logg[1],logg[2],logg[4],RAD2DEG*angle,ilist,iparams,
2872 atoms);
2873 lb=(1.0-ring_margin)*blen;
2874 ub=(1.0+ring_margin)*blen;
2875 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
2876 (!dist_set(d,natoms,logg[1],logg[4]))) {
2877 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
2878 ndist++;
2879 n13dist++;
2881 /*SETDISTANCE for CD2 and CZ (1-3) */
2882 angle=lookup_angle(logg[2],logg[4],logg[6],ilist,iparams,atoms);
2883 blen=angle_length(logg[2],logg[4],logg[6],RAD2DEG*angle,ilist,iparams,
2884 atoms);
2885 lb=(1.0-ring_margin)*blen;
2886 ub=(1.0+ring_margin)*blen;
2887 if (((weight[logg[2]] != 0.0) || (weight[logg[6]] != 0.0)) &&
2888 (!dist_set(d,natoms,logg[2],logg[6]))) {
2889 set_dist(d,natoms,logg[2],logg[6],lb,ub,blen);
2890 ndist++;
2891 n13dist++;
2893 /*SETDISTANCE for CE2 and CE1 (1-3) */
2894 angle=lookup_angle(logg[4],logg[6],logg[8],ilist,iparams,atoms);
2895 blen=angle_length(logg[4],logg[6],logg[8],RAD2DEG*angle,ilist,iparams,
2896 atoms);
2897 lb=(1.0-ring_margin)*blen;
2898 ub=(1.0+ring_margin)*blen;
2899 if (((weight[logg[4]] != 0.0) || (weight[logg[8]] != 0.0)) &&
2900 (!dist_set(d,natoms,logg[4],logg[8]))) {
2901 set_dist(d,natoms,logg[4],logg[8],lb,ub,blen);
2902 ndist++;
2903 n13dist++;
2905 /*SETDISTANCE for CZ and CE1 (1-3) */
2906 angle=lookup_angle(logg[6],logg[8],logg[10],ilist,iparams,atoms);
2907 blen=angle_length(logg[6],logg[8],logg[10],RAD2DEG*angle,ilist,iparams,
2908 atoms);
2909 lb=(1.0-ring_margin)*blen;
2910 ub=(1.0+ring_margin)*blen;
2911 if (((weight[logg[6]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2912 (!dist_set(d,natoms,logg[6],logg[10]))) {
2913 set_dist(d,natoms,logg[6],logg[10],lb,ub,blen);
2914 ndist++;
2915 n13dist++;
2917 /*SETDISTANCE for CE1 and CG (1-3) */
2918 angle=lookup_angle(logg[8],logg[10],logg[1],ilist,iparams,atoms);
2919 blen=angle_length(logg[8],logg[10],logg[1],RAD2DEG*angle,ilist,iparams,
2920 atoms);
2921 lb=(1.0-ring_margin)*blen;
2922 ub=(1.0+ring_margin)*blen;
2923 if (((weight[logg[8]] != 0.0) || (weight[logg[1]] != 0.0)) &&
2924 (!dist_set(d,natoms,logg[8],logg[1]))) {
2925 set_dist(d,natoms,logg[8],logg[1],lb,ub,blen);
2926 ndist++;
2927 n13dist++;
2929 /*SETDISTANCE for CB and CD1 (1-3) */
2930 angle=lookup_angle(logg[0],logg[1],logg[10],ilist,iparams,atoms);
2931 blen=angle_length(logg[0],logg[1],logg[10],RAD2DEG*angle,ilist,iparams,
2932 atoms);
2933 lb=(1.0-ring_margin)*blen;
2934 ub=(1.0+ring_margin)*blen;
2935 if (((weight[logg[0]] != 0.0) || (weight[logg[10]] != 0.0)) &&
2936 (!dist_set(d,natoms,logg[0],logg[10]))) {
2937 set_dist(d,natoms,logg[0],logg[10],lb,ub,blen);
2938 ndist++;
2939 n13dist++;
2941 /*SETDISTANCE for CB and CD2 (1-3) */
2942 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
2943 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
2944 atoms);
2945 lb=(1.0-ring_margin)*blen;
2946 ub=(1.0+ring_margin)*blen;
2947 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2948 (!dist_set(d,natoms,logg[0],logg[2]))) {
2949 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
2950 ndist++;
2951 n13dist++;
2953 /*SETDISTANCE for HD2 and CG (1-3) */
2954 angle=lookup_angle(logg[3],logg[2],logg[1],ilist,iparams,atoms);
2955 blen=angle_length(logg[3],logg[2],logg[1],RAD2DEG*angle,ilist,iparams,
2956 atoms);
2957 lb=(1.0-ring_margin)*blen;
2958 ub=(1.0+ring_margin)*blen;
2959 if (((weight[logg[3]] != 0.0) || (weight[logg[1]] != 0.0)) &&
2960 (!dist_set(d,natoms,logg[3],logg[1]))) {
2961 set_dist(d,natoms,logg[3],logg[1],lb,ub,blen);
2962 ndist++;
2963 n13dist++;
2965 /*SETDISTANCE for HD2 and CE2 (1-3) */
2966 angle=lookup_angle(logg[3],logg[2],logg[4],ilist,iparams,atoms);
2967 blen=angle_length(logg[3],logg[2],logg[4],RAD2DEG*angle,ilist,iparams,
2968 atoms);
2969 lb=(1.0-ring_margin)*blen;
2970 ub=(1.0+ring_margin)*blen;
2971 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
2972 (!dist_set(d,natoms,logg[3],logg[4]))) {
2973 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
2974 ndist++;
2975 n13dist++;
2977 /*SETDISTANCE for HE2 and CD2 (1-3) */
2978 angle=lookup_angle(logg[5],logg[4],logg[2],ilist,iparams,atoms);
2979 blen=angle_length(logg[5],logg[4],logg[2],RAD2DEG*angle,ilist,iparams,
2980 atoms);
2981 lb=(1.0-ring_margin)*blen;
2982 ub=(1.0+ring_margin)*blen;
2983 if (((weight[logg[5]] != 0.0) || (weight[logg[2]] != 0.0)) &&
2984 (!dist_set(d,natoms,logg[5],logg[2]))) {
2985 set_dist(d,natoms,logg[5],logg[2],lb,ub,blen);
2986 ndist++;
2987 n13dist++;
2989 /*SETDISTANCE for HE2 and CZ (1-3) */
2990 angle=lookup_angle(logg[5],logg[4],logg[6],ilist,iparams,atoms);
2991 blen=angle_length(logg[5],logg[4],logg[6],RAD2DEG*angle,ilist,iparams,
2992 atoms);
2993 lb=(1.0-ring_margin)*blen;
2994 ub=(1.0+ring_margin)*blen;
2995 if (((weight[logg[5]] != 0.0) || (weight[logg[6]] != 0.0)) &&
2996 (!dist_set(d,natoms,logg[5],logg[6]))) {
2997 set_dist(d,natoms,logg[5],logg[6],lb,ub,blen);
2998 ndist++;
2999 n13dist++;
3001 /*SETDISTANCE for HZ and CE2 (1-3) */
3002 angle=lookup_angle(logg[7],logg[6],logg[4],ilist,iparams,atoms);
3003 blen=angle_length(logg[7],logg[6],logg[4],RAD2DEG*angle,ilist,iparams,
3004 atoms);
3005 lb=(1.0-ring_margin)*blen;
3006 ub=(1.0+ring_margin)*blen;
3007 if (((weight[logg[7]] != 0.0) || (weight[logg[4]] != 0.0)) &&
3008 (!dist_set(d,natoms,logg[7],logg[4]))) {
3009 set_dist(d,natoms,logg[7],logg[4],lb,ub,blen);
3010 ndist++;
3011 n13dist++;
3013 /*SETDISTANCE for HZ and CE1 (1-3) */
3014 angle=lookup_angle(logg[7],logg[6],logg[8],ilist,iparams,atoms);
3015 blen=angle_length(logg[7],logg[6],logg[8],RAD2DEG*angle,ilist,iparams,
3016 atoms);
3017 lb=(1.0-ring_margin)*blen;
3018 ub=(1.0+ring_margin)*blen;
3019 if (((weight[logg[7]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3020 (!dist_set(d,natoms,logg[7],logg[8]))) {
3021 set_dist(d,natoms,logg[7],logg[8],lb,ub,blen);
3022 ndist++;
3023 n13dist++;
3025 /*SETDISTANCE for HE1 and CZ (1-3) */
3026 angle=lookup_angle(logg[9],logg[8],logg[6],ilist,iparams,atoms);
3027 blen=angle_length(logg[9],logg[8],logg[6],RAD2DEG*angle,ilist,iparams,
3028 atoms);
3029 lb=(1.0-ring_margin)*blen;
3030 ub=(1.0+ring_margin)*blen;
3031 if (((weight[logg[9]] != 0.0) || (weight[logg[6]] != 0.0)) &&
3032 (!dist_set(d,natoms,logg[9],logg[6]))) {
3033 set_dist(d,natoms,logg[9],logg[6],lb,ub,blen);
3034 ndist++;
3035 n13dist++;
3037 /*SETDISTANCE for HE1 and CD1 (1-3) */
3038 angle=lookup_angle(logg[9],logg[8],logg[10],ilist,iparams,atoms);
3039 blen=angle_length(logg[9],logg[8],logg[10],RAD2DEG*angle,ilist,iparams,
3040 atoms);
3041 lb=(1.0-ring_margin)*blen;
3042 ub=(1.0+ring_margin)*blen;
3043 if (((weight[logg[9]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3044 (!dist_set(d,natoms,logg[9],logg[10]))) {
3045 set_dist(d,natoms,logg[9],logg[10],lb,ub,blen);
3046 ndist++;
3047 n13dist++;
3049 /*SETDISTANCE for HD1 and CE1 (1-3) */
3050 angle=lookup_angle(logg[11],logg[10],logg[8],ilist,iparams,atoms);
3051 blen=angle_length(logg[11],logg[10],logg[8],RAD2DEG*angle,ilist,iparams,
3052 atoms);
3053 lb=(1.0-ring_margin)*blen;
3054 ub=(1.0+ring_margin)*blen;
3055 if (((weight[logg[11]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3056 (!dist_set(d,natoms,logg[11],logg[8]))) {
3057 set_dist(d,natoms,logg[11],logg[8],lb,ub,blen);
3058 ndist++;
3059 n13dist++;
3062 /* new 1-4 distances added 981126 */
3063 /*SETDISTANCE for CD2 and HD1 (logg[2]&logg[11]) (transdihedral)*/
3064 pdih_lengths(logg[2],logg[1],logg[10],logg[11],ilist,iparams,&lb,&blen,
3065 atoms);
3066 lb=(1.0-ring_margin)*blen;
3067 ub=(1.0+ring_margin)*blen;
3068 if (((weight[logg[2]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3069 (!dist_set(d,natoms,logg[2],logg[11]))) {
3070 set_dist(d,natoms,logg[2],logg[11],lb,ub,blen);
3071 ndist++;
3072 n14dist++;
3074 /*SETDISTANCE for CZ and HD1 (logg[6]&logg[11]) (transdihedral)*/
3075 pdih_lengths(logg[6],logg[8],logg[10],logg[11],ilist,iparams,&lb,&blen,
3076 atoms);
3077 lb=(1.0-ring_margin)*blen;
3078 ub=(1.0+ring_margin)*blen;
3079 if (((weight[logg[6]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3080 (!dist_set(d,natoms,logg[6],logg[11]))) {
3081 set_dist(d,natoms,logg[6],logg[11],lb,ub,blen);
3082 ndist++;
3083 n14dist++;
3085 /*SETDISTANCE for CD2 and CE1 (logg[2]&logg[8]) (cisdihedral)*/
3086 pdih_lengths(logg[2],logg[1],logg[10],logg[8],ilist,iparams,&blen,&ub,
3087 atoms);
3088 lb=(1.0-ring_margin)*blen;
3089 ub=(1.0+ring_margin)*blen;
3090 if (((weight[logg[2]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3091 (!dist_set(d,natoms,logg[2],logg[8]))) {
3092 set_dist(d,natoms,logg[2],logg[8],lb,ub,blen);
3093 ndist++;
3094 n14dist++;
3096 /*SETDISTANCE for CE2 and CD1 (logg[4]&logg[10]) (cisdihedral)*/
3097 pdih_lengths(logg[4],logg[6],logg[8],logg[10],ilist,iparams,&blen,&ub,
3098 atoms);
3099 lb=(1.0-ring_margin)*blen;
3100 ub=(1.0+ring_margin)*blen;
3101 if (((weight[logg[4]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3102 (!dist_set(d,natoms,logg[4],logg[10]))) {
3103 set_dist(d,natoms,logg[4],logg[10],lb,ub,blen);
3104 ndist++;
3105 n14dist++;
3107 /* end of new 1-4 distances */
3109 /*SETDISTANCE for CB and CE1 (logg[0]&logg[8]) (transdihedral)*/
3110 pdih_lengths(logg[0],logg[1],logg[10],logg[8],ilist,iparams,&lb,&blen,
3111 atoms);
3112 lb=(1.0-ring_margin)*blen;
3113 ub=(1.0+ring_margin)*blen;
3114 if (((weight[logg[0]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3115 (!dist_set(d,natoms,logg[0],logg[8]))) {
3116 set_dist(d,natoms,logg[0],logg[8],lb,ub,blen);
3117 ndist++;
3118 n14dist++;
3120 /*SETDISTANCE for CB and CE2 (logg[0]&logg[4]) (transdihedral)*/
3121 pdih_lengths(logg[0],logg[1],logg[2],logg[4],ilist,iparams,&lb,&blen,
3122 atoms);
3123 lb=(1.0-ring_margin)*blen;
3124 ub=(1.0+ring_margin)*blen;
3125 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
3126 (!dist_set(d,natoms,logg[0],logg[4]))) {
3127 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
3128 ndist++;
3129 n14dist++;
3131 /*SETDISTANCE for CD1 and HD2 (logg[10]&logg[3]) (transdihedral)*/
3132 pdih_lengths(logg[10],logg[1],logg[2],logg[3],ilist,iparams,&lb,&blen,
3133 atoms);
3134 lb=(1.0-ring_margin)*blen;
3135 ub=(1.0+ring_margin)*blen;
3136 if (((weight[logg[10]] != 0.0) || (weight[logg[3]] != 0.0)) &&
3137 (!dist_set(d,natoms,logg[10],logg[3]))) {
3138 set_dist(d,natoms,logg[10],logg[3],lb,ub,blen);
3139 ndist++;
3140 n14dist++;
3142 /*SETDISTANCE for CZ and HD2 (logg[6]&logg[3]) (transdihedral)*/
3143 pdih_lengths(logg[6],logg[4],logg[2],logg[3],ilist,iparams,&lb,&blen,
3144 atoms);
3145 lb=(1.0-ring_margin)*blen;
3146 ub=(1.0+ring_margin)*blen;
3147 if (((weight[logg[6]] != 0.0) || (weight[logg[3]] != 0.0)) &&
3148 (!dist_set(d,natoms,logg[6],logg[3]))) {
3149 set_dist(d,natoms,logg[6],logg[3],lb,ub,blen);
3150 ndist++;
3151 n14dist++;
3153 /*SETDISTANCE for CG and HE2 (logg[1]&logg[5]) (transdihedral)*/
3154 pdih_lengths(logg[1],logg[2],logg[4],logg[5],ilist,iparams,&lb,&blen,
3155 atoms);
3156 lb=(1.0-ring_margin)*blen;
3157 ub=(1.0+ring_margin)*blen;
3158 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
3159 (!dist_set(d,natoms,logg[1],logg[5]))) {
3160 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
3161 ndist++;
3162 n14dist++;
3164 /*SETDISTANCE for CE1 and HE2 (logg[8]&logg[5]) (transdihedral)*/
3165 pdih_lengths(logg[8],logg[6],logg[4],logg[5],ilist,iparams,&lb,&blen,
3166 atoms);
3167 lb=(1.0-ring_margin)*blen;
3168 ub=(1.0+ring_margin)*blen;
3169 if (((weight[logg[8]] != 0.0) || (weight[logg[5]] != 0.0)) &&
3170 (!dist_set(d,natoms,logg[8],logg[5]))) {
3171 set_dist(d,natoms,logg[8],logg[5],lb,ub,blen);
3172 ndist++;
3173 n14dist++;
3175 /*SETDISTANCE for CD1 and HZ (logg[10]&logg[7]) (transdihedral)*/
3176 pdih_lengths(logg[10],logg[8],logg[6],logg[7],ilist,iparams,&lb,&blen,
3177 atoms);
3178 lb=(1.0-ring_margin)*blen;
3179 ub=(1.0+ring_margin)*blen;
3180 if (((weight[logg[10]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3181 (!dist_set(d,natoms,logg[10],logg[7]))) {
3182 set_dist(d,natoms,logg[10],logg[7],lb,ub,blen);
3183 ndist++;
3184 n14dist++;
3186 /*SETDISTANCE for CD2 and HZ (logg[2]&logg[7]) (transdihedral)*/
3187 pdih_lengths(logg[2],logg[4],logg[6],logg[7],ilist,iparams,&lb,&blen,
3188 atoms);
3189 lb=(1.0-ring_margin)*blen;
3190 ub=(1.0+ring_margin)*blen;
3191 if (((weight[logg[2]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3192 (!dist_set(d,natoms,logg[2],logg[7]))) {
3193 set_dist(d,natoms,logg[2],logg[7],lb,ub,blen);
3194 ndist++;
3195 n14dist++;
3197 /*SETDISTANCE for CE2 and HE1 (logg[4]&logg[9]) (transdihedral)*/
3198 pdih_lengths(logg[4],logg[6],logg[8],logg[9],ilist,iparams,&lb,&blen,
3199 atoms);
3200 lb=(1.0-ring_margin)*blen;
3201 ub=(1.0+ring_margin)*blen;
3202 if (((weight[logg[4]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3203 (!dist_set(d,natoms,logg[4],logg[9]))) {
3204 set_dist(d,natoms,logg[4],logg[9],lb,ub,blen);
3205 ndist++;
3206 n14dist++;
3208 /*SETDISTANCE for CG and HE1 (logg[1]&logg[9]) (transdihedral)*/
3209 pdih_lengths(logg[1],logg[10],logg[8],logg[9],ilist,iparams,&lb,&blen,
3210 atoms);
3211 lb=(1.0-ring_margin)*blen;
3212 ub=(1.0+ring_margin)*blen;
3213 if (((weight[logg[1]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3214 (!dist_set(d,natoms,logg[1],logg[9]))) {
3215 set_dist(d,natoms,logg[1],logg[9],lb,ub,blen);
3216 ndist++;
3217 n14dist++;
3219 /*SETDISTANCE for CB and HD1 (logg[0]&logg[11]) (cisdihedral)*/
3220 pdih_lengths(logg[0],logg[1],logg[10],logg[11],ilist,iparams,&blen,&ub,
3221 atoms);
3222 lb=(1.0-ring_margin)*blen;
3223 ub=(1.0+ring_margin)*blen;
3224 if (((weight[logg[0]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3225 (!dist_set(d,natoms,logg[0],logg[11]))) {
3226 set_dist(d,natoms,logg[0],logg[11],lb,ub,blen);
3227 ndist++;
3228 n14dist++;
3230 /*SETDISTANCE for CB and HD2 (logg[0]&logg[3]) (cisdihedral)*/
3231 pdih_lengths(logg[0],logg[1],logg[2],logg[3],ilist,iparams,&blen,&ub,
3232 atoms);
3233 lb=(1.0-ring_margin)*blen;
3234 ub=(1.0+ring_margin)*blen;
3235 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
3236 (!dist_set(d,natoms,logg[0],logg[3]))) {
3237 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
3238 ndist++;
3239 n14dist++;
3241 /*SETDISTANCE for CG and CZ (logg[1]&logg[6]) (cisdihedral)*/
3242 pdih_lengths(logg[1],logg[2],logg[4],logg[6],ilist,iparams,&blen,&ub,
3243 atoms);
3244 lb=(1.0-ring_margin)*blen;
3245 ub=(1.0+ring_margin)*blen;
3246 if (((weight[logg[1]] != 0.0) || (weight[logg[6]] != 0.0)) &&
3247 (!dist_set(d,natoms,logg[1],logg[6]))) {
3248 set_dist(d,natoms,logg[1],logg[6],lb,ub,blen);
3249 ndist++;
3250 n14dist++;
3252 /*SETDISTANCE for HD2 and HE2 (logg[3]&logg[5]) (cisdihedral)*/
3253 pdih_lengths(logg[3],logg[2],logg[4],logg[5],ilist,iparams,&blen,&ub,
3254 atoms);
3255 lb=(1.0-ring_margin)*blen;
3256 ub=(1.0+ring_margin)*blen;
3257 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
3258 (!dist_set(d,natoms,logg[3],logg[5]))) {
3259 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
3260 ndist++;
3261 n14dist++;
3263 /*SETDISTANCE for HE2 and HZ (logg[5]&logg[7]) (cisdihedral)*/
3264 pdih_lengths(logg[5],logg[4],logg[6],logg[7],ilist,iparams,&blen,&ub,
3265 atoms);
3266 lb=(1.0-ring_margin)*blen;
3267 ub=(1.0+ring_margin)*blen;
3268 if (((weight[logg[5]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3269 (!dist_set(d,natoms,logg[5],logg[7]))) {
3270 set_dist(d,natoms,logg[5],logg[7],lb,ub,blen);
3271 ndist++;
3272 n14dist++;
3274 /*SETDISTANCE for HZ and HE1 (logg[7]&logg[9]) (cisdihedral)*/
3275 pdih_lengths(logg[7],logg[6],logg[8],logg[9],ilist,iparams,&blen,&ub,
3276 atoms);
3277 lb=(1.0-ring_margin)*blen;
3278 ub=(1.0+ring_margin)*blen;
3279 if (((weight[logg[7]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3280 (!dist_set(d,natoms,logg[7],logg[9]))) {
3281 set_dist(d,natoms,logg[7],logg[9],lb,ub,blen);
3282 ndist++;
3283 n14dist++;
3285 /*SETDISTANCE for HE1 and HD1 (logg[9]&logg[11]) (cisdihedral)*/
3286 pdih_lengths(logg[9],logg[8],logg[10],logg[11],ilist,iparams,&blen,&ub,
3287 atoms);
3288 lb=(1.0-ring_margin)*blen;
3289 ub=(1.0+ring_margin)*blen;
3290 if (((weight[logg[9]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3291 (!dist_set(d,natoms,logg[9],logg[11]))) {
3292 set_dist(d,natoms,logg[9],logg[11],lb,ub,blen);
3293 ndist++;
3294 n14dist++;
3297 /* new 1-5 distances added 981126 */
3298 /*SETDISTANCE for HD2 and HZ (1-5) */
3299 phe_15_CBHE(logg[3],logg[2],logg[4],logg[6],logg[7],ilist,
3300 iparams,&blen,atoms);
3301 lb=(1.0-ring_margin)*blen;
3302 ub=(1.0+ring_margin)*blen;
3303 if (((weight[logg[3]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3304 (!dist_set(d,natoms,logg[3],logg[7]))) {
3305 set_dist(d,natoms,logg[3],logg[7],lb,ub,blen);
3306 ndist++;
3307 n15dist++;
3309 /*SETDISTANCE for HD2 and HD1 (1-5) */
3310 phe_15_CBHE(logg[3],logg[2],logg[1],logg[10],logg[11],ilist,
3311 iparams,&blen,atoms);
3312 lb=(1.0-ring_margin)*blen;
3313 ub=(1.0+ring_margin)*blen;
3314 if (((weight[logg[3]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3315 (!dist_set(d,natoms,logg[3],logg[11]))) {
3316 set_dist(d,natoms,logg[3],logg[11],lb,ub,blen);
3317 ndist++;
3318 n15dist++;
3320 /*SETDISTANCE for HE2 and HE1 (1-5) */
3321 phe_15_CBHE(logg[5],logg[4],logg[6],logg[8],logg[9],ilist,
3322 iparams,&blen,atoms);
3323 lb=(1.0-ring_margin)*blen;
3324 ub=(1.0+ring_margin)*blen;
3325 if (((weight[logg[5]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3326 (!dist_set(d,natoms,logg[5],logg[9]))) {
3327 set_dist(d,natoms,logg[5],logg[9],lb,ub,blen);
3328 ndist++;
3329 n15dist++;
3331 /*SETDISTANCE for HZ and HD1 (1-5) */
3332 phe_15_CBHE(logg[7],logg[6],logg[8],logg[10],logg[11],ilist,
3333 iparams,&blen,atoms);
3334 lb=(1.0-ring_margin)*blen;
3335 ub=(1.0+ring_margin)*blen;
3336 if (((weight[logg[7]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3337 (!dist_set(d,natoms,logg[7],logg[11]))) {
3338 set_dist(d,natoms,logg[7],logg[11],lb,ub,blen);
3339 ndist++;
3340 n15dist++;
3342 /*SETDISTANCE for HE1 and CD2 (1-5) */
3343 phe_15_CBCZ(logg[9],logg[8],logg[6],logg[4],logg[2],ilist,
3344 iparams,&blen,atoms);
3345 lb=(1.0-ring_margin)*blen;
3346 ub=(1.0+ring_margin)*blen;
3347 if (((weight[logg[9]] != 0.0) || (weight[logg[2]] != 0.0)) &&
3348 (!dist_set(d,natoms,logg[9],logg[2]))) {
3349 set_dist(d,natoms,logg[9],logg[2],lb,ub,blen);
3350 ndist++;
3351 n15dist++;
3353 /*SETDISTANCE for HD2 and CE1 (1-5) */
3354 phe_15_CBCZ(logg[3],logg[2],logg[4],logg[6],logg[8],ilist,
3355 iparams,&blen,atoms);
3356 lb=(1.0-ring_margin)*blen;
3357 ub=(1.0+ring_margin)*blen;
3358 if (((weight[logg[3]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3359 (!dist_set(d,natoms,logg[3],logg[8]))) {
3360 set_dist(d,natoms,logg[3],logg[8],lb,ub,blen);
3361 ndist++;
3362 n15dist++;
3364 /*SETDISTANCE for HD1 and CE2 (1-5) */
3365 phe_15_CBCZ(logg[11],logg[10],logg[1],logg[2],logg[4],ilist,
3366 iparams,&blen,atoms);
3367 lb=(1.0-ring_margin)*blen;
3368 ub=(1.0+ring_margin)*blen;
3369 if (((weight[logg[11]] != 0.0) || (weight[logg[4]] != 0.0)) &&
3370 (!dist_set(d,natoms,logg[11],logg[4]))) {
3371 set_dist(d,natoms,logg[11],logg[4],lb,ub,blen);
3372 ndist++;
3373 n15dist++;
3375 /*SETDISTANCE for HE2 and CD1 (1-5) */
3376 phe_15_CBCZ(logg[5],logg[4],logg[6],logg[8],logg[10],ilist,
3377 iparams,&blen,atoms);
3378 lb=(1.0-ring_margin)*blen;
3379 ub=(1.0+ring_margin)*blen;
3380 if (((weight[logg[5]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3381 (!dist_set(d,natoms,logg[5],logg[10]))) {
3382 set_dist(d,natoms,logg[5],logg[10],lb,ub,blen);
3383 ndist++;
3384 n15dist++;
3386 /* end new 1-5 distances */
3388 /*fprintf(stderr,"Calling phe_15_CBHE\n");*/
3389 /*SETDISTANCE for CB and HE2 (1-5) */
3390 phe_15_CBHE(logg[0],logg[1],logg[2],logg[4],logg[5],ilist,
3391 iparams,&blen,atoms);
3392 /*fprintf(stderr,"Exited phe_15_CBHE\n");*/
3393 lb=(1.0-ring_margin)*blen;
3394 ub=(1.0+ring_margin)*blen;
3395 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
3396 (!dist_set(d,natoms,logg[0],logg[5]))) {
3397 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
3398 ndist++;
3399 n15dist++;
3401 /*fprintf(stderr,"Calling phe_15_CBHE\n");*/
3402 /*SETDISTANCE for CB and HE1 (1-5) */
3403 phe_15_CBHE(logg[0],logg[1],logg[10],logg[8],logg[9],ilist,
3404 iparams,&blen,atoms);
3405 lb=(1.0-ring_margin)*blen;
3406 ub=(1.0+ring_margin)*blen;
3407 if (((weight[logg[0]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3408 (!dist_set(d,natoms,logg[0],logg[9]))) {
3409 set_dist(d,natoms,logg[0],logg[9],lb,ub,blen);
3410 ndist++;
3411 n15dist++;
3413 /*SETDISTANCE for CB and CZ (1-5) */
3414 phe_15_CBCZ(logg[0],logg[1],logg[2],logg[4],logg[6],ilist,
3415 iparams,&blen,atoms);
3416 lb=(1.0-ring_margin)*blen;
3417 ub=(1.0+ring_margin)*blen;
3418 if (((weight[logg[0]] != 0.0) || (weight[logg[6]] != 0.0)) &&
3419 (!dist_set(d,natoms,logg[0],logg[6]))) {
3420 set_dist(d,natoms,logg[0],logg[6],lb,ub,blen);
3421 ndist++;
3422 n15dist++;
3424 /*SETDISTANCE for CG and HZ (1-5) */
3425 phe_15_CGHZ(logg[1],logg[2],logg[4],logg[6],logg[7],ilist,
3426 iparams,&blen,atoms);
3427 lb=(1.0-ring_margin)*blen;
3428 ub=(1.0+ring_margin)*blen;
3429 if (((weight[logg[1]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3430 (!dist_set(d,natoms,logg[1],logg[7]))) {
3431 set_dist(d,natoms,logg[1],logg[7],lb,ub,blen);
3432 ndist++;
3433 n15dist++;
3435 /* 1111111111-------------666666666666 */
3436 /*SETDISTANCE for CB and HZ (1-6) */
3437 phe_16_type2(logg[0],logg[1],logg[2],logg[4],logg[6],logg[7],
3438 ilist,iparams,&blen,atoms);
3439 lb=(1.0-ring_margin)*blen;
3440 ub=(1.0+ring_margin)*blen;
3441 if (((weight[logg[0]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3442 (!dist_set(d,natoms,logg[0],logg[7]))) {
3443 set_dist(d,natoms,logg[0],logg[7],lb,ub,blen);
3444 ndist++;
3445 n16dist++;
3447 /*SETDISTANCE for HD1 and HE2 (1-6) */
3448 phe_16_type2(logg[11],logg[10],logg[1],logg[2],logg[4],logg[5],
3449 ilist,iparams,&blen,atoms);
3450 lb=(1.0-ring_margin)*blen;
3451 ub=(1.0+ring_margin)*blen;
3452 if (((weight[logg[11]] != 0.0) || (weight[logg[5]] != 0.0)) &&
3453 (!dist_set(d,natoms,logg[11],logg[5]))) {
3454 set_dist(d,natoms,logg[11],logg[5],lb,ub,blen);
3455 ndist++;
3456 n16dist++;
3458 /*SETDISTANCE for HD2 and HE1 (1-6) */
3459 phe_16_type2(logg[3],logg[2],logg[4],logg[6],logg[8],logg[9],
3460 ilist,iparams,&blen,atoms);
3461 lb=(1.0-ring_margin)*blen;
3462 ub=(1.0+ring_margin)*blen;
3463 if (((weight[logg[3]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3464 (!dist_set(d,natoms,logg[3],logg[9]))) {
3465 set_dist(d,natoms,logg[3],logg[9],lb,ub,blen);
3466 ndist++;
3467 n16dist++;
3469 if (bVir) {
3470 /* VIRTUAL DISTANCES */
3471 nVdist += set_virtual (logg,12,ring_margin,d,natoms);
3472 ndist += nVdist;
3475 logg[13]=0;
3479 fprintf(log,"There are %d new phenylalanine distances\n",ndist);
3480 if (ndist > 0 ) {
3481 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4, %d 1-5, %d 1-6, %d virtual)\n",n12dist,n13dist,
3482 n14dist,n15dist,n16dist,nVdist);
3486 /**********************************************************
3488 * T Y R O S I N E
3490 **********************************************************/
3491 static void tyr_15_CBHE(int ai,int aj,int ak,int al,int am,
3492 t_ilist ilist[],t_iparams iparams[],
3493 real *lb,t_atoms *atoms)
3495 /* Returns the length corresponding to a 1-5 distance */
3496 real rij,rjk,rkl,rlm,rik,rkm,rim;
3497 real thijk,thjkl,thklm,thikj,thmkl;
3498 real real_pi = M_PI*2.0;
3499 real half_pi = M_PI*0.5;
3501 /* fprintf(stderr,"Got past initialisations\n");*/
3502 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
3503 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
3504 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
3505 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
3506 /*fprintf(stderr,"Got past lookup_bondlength\n");*/
3507 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
3508 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
3509 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
3510 /*fprintf(stderr,"Got past lookup_angle\n");*/
3511 /*fprintf(stderr,"%g %g %g %g %g %g %g\n",rij,rjk,rkl,rlm,RAD2DEG*thijk,
3512 RAD2DEG*thjkl,RAD2DEG*thklm);*/
3513 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
3514 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
3515 /*fprintf(stderr,"Got past angle_length\n");*/
3517 /* Compute angle thikj using law of sines */
3518 thikj = asin(rij*sin(thijk)/rik);
3520 /* Compute thmkl using law of sines */
3521 thmkl = asin(rlm*sin(thklm)/rkm);
3523 /* Compute cis length using law of cosines */
3524 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(real_pi-thikj-thmkl-thjkl));
3525 /*fprintf(stderr,"leaving routine\n");*/
3528 static void tyr_15_CBCZ(int ai,int aj,int ak,int al,int am,
3529 t_ilist ilist[],t_iparams iparams[],
3530 real *lb,t_atoms *atoms)
3532 /* Returns the length corresponding to a 1-5 distance */
3533 real rij,rjk,rkl,rlm,rik,rkm;
3534 real thijk,thjkl,thklm,thikj,thmkl;
3535 real real_pi = M_PI*2.0;
3536 real half_pi = M_PI*0.5;
3538 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
3539 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
3540 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
3541 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
3542 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
3543 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
3544 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
3545 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
3546 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
3548 /* Compute angle thikj using law of sines */
3549 thikj = asin(rij*sin(thijk)/rik);
3551 /* Compute thmkl using law of sines */
3552 thmkl = asin(rlm*sin(thklm)/rkm);
3554 /* Compute cis length using law of cosines */
3555 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thjkl-thmkl+thikj));
3558 static void tyr_15_CGOH(int ai,int aj,int ak,int al,int am,
3559 t_ilist ilist[],t_iparams iparams[],
3560 real *lb,t_atoms *atoms)
3562 /* Returns the length corresponding to a 1-5 distance */
3563 real rij,rjk,rkl,rlm,rik,rkm;
3564 real thijk,thjkl,thklm,thikj,thmkl;
3565 real real_pi = M_PI*2.0;
3567 /*fprintf(stderr,"entering the routine\n");*/
3569 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
3570 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
3571 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
3572 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
3573 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
3574 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
3575 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
3576 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
3577 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
3578 /*fprintf(stderr,"Only calculations left\n");*/
3580 /* Compute angle thikj using law of sines */
3581 thikj = asin(rij*sin(thijk)/rik);
3583 /* Compute thmkl using law of sines */
3584 thmkl = asin(rlm*sin(thklm)/rkm);
3586 /* Compute cis length using law of cosines */
3587 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thjkl-thikj+thmkl));
3590 static void tyr_16_type2(int ai,int aj,int ak,int al,int am,int an,
3591 t_ilist ilist[],t_iparams iparams[],
3592 real *lb,t_atoms *atoms)
3594 /* Returns the length corresponding to a 1-6 distance */
3596 real rij,rjk,rkl,rlm,rmn,rik,rln,ril;
3597 real thijk,thjkl,thklm,thlmn,thikj,thikl,thilk,thnlm,thiln;
3598 real real_pi = M_PI*2.0;
3599 real half_pi = M_PI*0.5;
3601 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
3602 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
3603 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
3604 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
3605 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
3606 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
3607 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
3608 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
3609 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
3611 /* Compute rik and rlm */
3612 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
3613 rln = sqrt(rlm*rlm+rmn*rmn-2.0*rlm*rmn*cos(thlmn));
3615 /* Compute thikj */
3616 thikj = asin(rij*sin(thijk)/rik);
3617 thikl = thikj+thjkl;
3619 /* Compute ril */
3620 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
3622 /* Compute thilk, thlnm and thiln */
3623 thilk = asin(rik*sin(thikl)/ril);
3624 thnlm = asin(rmn*sin(thlmn)/rln);
3625 thiln = thklm-thilk+thnlm;
3627 *lb = sqrt(ril*ril+rln*rln-2.0*ril*rln*cos(thiln));
3630 void tyr (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
3631 real ring_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
3633 int natoms,ndist,i,j,q,logg[14],residnr,oldresidnr,n12dist,n13dist,n14dist,
3634 n15dist,n16dist,nVdist;
3635 real blen,lb,ub,angle;
3637 natoms= atoms->nr;
3638 ndist = 0;
3639 n12dist = 0;
3640 n13dist = 0;
3641 n14dist = 0;
3642 n15dist = 0;
3643 n16dist = 0;
3644 nVdist = 0;
3645 residnr = -1;
3646 oldresidnr=-1;
3648 for (i=0; (i<natoms); i++) {
3649 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"TYR") == 0) {
3650 oldresidnr=residnr;
3651 residnr=atoms->atom[i].resnr;
3652 logg[13]=0;
3653 if ( oldresidnr == residnr ) {
3654 continue;
3656 j=i;
3657 while ((atoms->atom[j].resnr) == residnr ) {
3658 if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
3659 logg[13]++;
3660 logg[0]=j;
3662 else if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
3663 logg[13]++;
3664 logg[1]=j;
3666 else if ( strcmp((*atoms->atomname[j]),"CD2") == 0) {
3667 logg[13]++;
3668 logg[2]=j;
3670 else if ( strcmp((*atoms->atomname[j]),"HD2") == 0) {
3671 logg[13]++;
3672 logg[3]=j;
3674 else if ( strcmp((*atoms->atomname[j]),"CE2") == 0) {
3675 logg[13]++;
3676 logg[4]=j;
3678 else if ( strcmp((*atoms->atomname[j]),"HE2") == 0) {
3679 logg[13]++;
3680 logg[5]=j;
3682 else if ( strcmp((*atoms->atomname[j]),"CZ") == 0) {
3683 logg[13]++;
3684 logg[6]=j;
3686 else if ( strcmp((*atoms->atomname[j]),"OH") == 0) {
3687 logg[13]++;
3688 logg[7]=j;
3690 else if ( strcmp((*atoms->atomname[j]),"CE1") == 0) {
3691 logg[13]++;
3692 logg[8]=j;
3694 else if ( strcmp((*atoms->atomname[j]),"HE1") == 0) {
3695 logg[13]++;
3696 logg[9]=j;
3698 else if ( strcmp((*atoms->atomname[j]),"CD1") == 0) {
3699 logg[13]++;
3700 logg[10]=j;
3702 else if ( strcmp((*atoms->atomname[j]),"HD1") == 0) {
3703 logg[13]++;
3704 logg[11]=j;
3706 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
3707 logg[13]++;
3708 logg[12]=j;
3710 if ( ((logg[13] == 12) && !bVir) || ((logg[13] == 13) && bVir) ) {
3711 break;
3713 j++;
3715 if ( ((logg[13] == 12) && !bVir) || ((logg[13] == 13) && bVir) ) {
3717 if ((logg[13] == 12) && !bVir) {
3718 fprintf(log,"logg (tyr) = %d %d %d %d %d %d %d %d %d %d %d %d\n",
3719 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
3720 logg[7],logg[8],logg[9],logg[10],logg[11]);
3722 else if ((logg[13] == 13) && bVir) {
3723 fprintf(log,"logg (tyr) = %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
3724 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
3725 logg[7],logg[8],logg[9],logg[10],logg[11],logg[12]);
3728 /*SETDISTANCE for CB and CG (1-2) */
3729 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
3730 lb=(1.0-ring_margin)*blen;
3731 ub=(1.0+ring_margin)*blen;
3732 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
3733 (!dist_set(d,natoms,logg[0],logg[1]))) {
3734 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
3735 ndist++;
3736 n12dist++;
3738 /*SETDISTANCE for CG and CD2 (1-2) */
3739 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
3740 lb=(1.0-ring_margin)*blen;
3741 ub=(1.0+ring_margin)*blen;
3742 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
3743 (!dist_set(d,natoms,logg[1],logg[2]))) {
3744 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
3745 ndist++;
3746 n12dist++;
3748 /*SETDISTANCE for CD2 and HD2 (1-2) */
3749 blen=lookup_bondlength(logg[2],logg[3],ilist,iparams,TRUE,atoms);
3750 lb=(1.0-ring_margin)*blen;
3751 ub=(1.0+ring_margin)*blen;
3752 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
3753 (!dist_set(d,natoms,logg[2],logg[3]))) {
3754 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
3755 ndist++;
3756 n12dist++;
3758 /*SETDISTANCE for CD2 and CE2 (1-2) */
3759 blen=lookup_bondlength(logg[2],logg[4],ilist,iparams,TRUE,atoms);
3760 lb=(1.0-ring_margin)*blen;
3761 ub=(1.0+ring_margin)*blen;
3762 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
3763 (!dist_set(d,natoms,logg[2],logg[4]))) {
3764 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
3765 ndist++;
3766 n12dist++;
3768 /*SETDISTANCE for CE2 and HE2 (1-2) */
3769 blen=lookup_bondlength(logg[4],logg[5],ilist,iparams,TRUE,atoms);
3770 lb=(1.0-ring_margin)*blen;
3771 ub=(1.0+ring_margin)*blen;
3772 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
3773 (!dist_set(d,natoms,logg[4],logg[5]))) {
3774 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
3775 ndist++;
3776 n12dist++;
3778 /*SETDISTANCE for CE2 and CZ (1-2) */
3779 blen=lookup_bondlength(logg[4],logg[6],ilist,iparams,TRUE,atoms);
3780 lb=(1.0-ring_margin)*blen;
3781 ub=(1.0+ring_margin)*blen;
3782 if (((weight[logg[4]] != 0.0) || (weight[logg[6]] != 0.0)) &&
3783 (!dist_set(d,natoms,logg[4],logg[6]))) {
3784 set_dist(d,natoms,logg[4],logg[6],lb,ub,blen);
3785 ndist++;
3786 n12dist++;
3788 /*SETDISTANCE for CZ and OH (1-2) */
3789 blen=lookup_bondlength(logg[6],logg[7],ilist,iparams,TRUE,atoms);
3790 lb=(1.0-ring_margin)*blen;
3791 ub=(1.0+ring_margin)*blen;
3792 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
3793 (!dist_set(d,natoms,logg[6],logg[7]))) {
3794 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
3795 ndist++;
3796 n12dist++;
3798 /*SETDISTANCE for CZ and CE1 (1-2) */
3799 blen=lookup_bondlength(logg[6],logg[8],ilist,iparams,TRUE,atoms);
3800 lb=(1.0-ring_margin)*blen;
3801 ub=(1.0+ring_margin)*blen;
3802 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3803 (!dist_set(d,natoms,logg[6],logg[8]))) {
3804 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
3805 ndist++;
3806 n12dist++;
3808 /*SETDISTANCE for CE1 and HE1 (1-2) */
3809 blen=lookup_bondlength(logg[8],logg[9],ilist,iparams,TRUE,atoms);
3810 lb=(1.0-ring_margin)*blen;
3811 ub=(1.0+ring_margin)*blen;
3812 if (((weight[logg[8]] != 0.0) || (weight[logg[9]] != 0.0)) &&
3813 (!dist_set(d,natoms,logg[8],logg[9]))) {
3814 set_dist(d,natoms,logg[8],logg[9],lb,ub,blen);
3815 ndist++;
3816 n12dist++;
3818 /*SETDISTANCE for CE1 and CD1 (1-2) */
3819 blen=lookup_bondlength(logg[8],logg[10],ilist,iparams,TRUE,atoms);
3820 lb=(1.0-ring_margin)*blen;
3821 ub=(1.0+ring_margin)*blen;
3822 if (((weight[logg[8]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3823 (!dist_set(d,natoms,logg[8],logg[10]))) {
3824 set_dist(d,natoms,logg[8],logg[10],lb,ub,blen);
3825 ndist++;
3826 n12dist++;
3828 /*SETDISTANCE for CD1 and HD1 (1-2) */
3829 blen=lookup_bondlength(logg[10],logg[11],ilist,iparams,TRUE,atoms);
3830 lb=(1.0-ring_margin)*blen;
3831 ub=(1.0+ring_margin)*blen;
3832 if (((weight[logg[10]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3833 (!dist_set(d,natoms,logg[10],logg[11]))) {
3834 set_dist(d,natoms,logg[10],logg[11],lb,ub,blen);
3835 ndist++;
3836 n12dist++;
3838 /*SETDISTANCE for CD1 and CG (1-2) */
3839 blen=lookup_bondlength(logg[1],logg[10],ilist,iparams,TRUE,atoms);
3840 lb=(1.0-ring_margin)*blen;
3841 ub=(1.0+ring_margin)*blen;
3842 if (((weight[logg[1]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3843 (!dist_set(d,natoms,logg[1],logg[10]))) {
3844 set_dist(d,natoms,logg[1],logg[10],lb,ub,blen);
3845 ndist++;
3846 n12dist++;
3849 /* new 1-3 distances added 981126 */
3850 /*SETDISTANCE for CG and HD1 (1-3) */
3851 angle=lookup_angle(logg[1],logg[10],logg[11],ilist,iparams,atoms);
3852 blen=angle_length(logg[1],logg[10],logg[11],RAD2DEG*angle,ilist,iparams,
3853 atoms);
3854 lb=(1.0-ring_margin)*blen;
3855 ub=(1.0+ring_margin)*blen;
3856 if (((weight[logg[1]] != 0.0) || (weight[logg[11]] != 0.0)) &&
3857 (!dist_set(d,natoms,logg[1],logg[11]))) {
3858 set_dist(d,natoms,logg[1],logg[11],lb,ub,blen);
3859 ndist++;
3860 n13dist++;
3862 /* end of new 1-3 distances */
3864 /*SETDISTANCE for CD1 and CD2 (1-3) */
3865 angle=lookup_angle(logg[10],logg[1],logg[2],ilist,iparams,atoms);
3866 blen=angle_length(logg[10],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
3867 atoms);
3868 lb=(1.0-ring_margin)*blen;
3869 ub=(1.0+ring_margin)*blen;
3870 if (((weight[logg[10]] != 0.0) || (weight[logg[2]] != 0.0)) &&
3871 (!dist_set(d,natoms,logg[10],logg[2]))) {
3872 set_dist(d,natoms,logg[10],logg[2],lb,ub,blen);
3873 ndist++;
3874 n13dist++;
3876 /*SETDISTANCE for CG and CE2 (1-3) */
3877 angle=lookup_angle(logg[1],logg[2],logg[4],ilist,iparams,atoms);
3878 blen=angle_length(logg[1],logg[2],logg[4],RAD2DEG*angle,ilist,iparams,
3879 atoms);
3880 lb=(1.0-ring_margin)*blen;
3881 ub=(1.0+ring_margin)*blen;
3882 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
3883 (!dist_set(d,natoms,logg[1],logg[4]))) {
3884 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
3885 ndist++;
3886 n13dist++;
3888 /*SETDISTANCE for CD2 and CZ (1-3) */
3889 angle=lookup_angle(logg[2],logg[4],logg[6],ilist,iparams,atoms);
3890 blen=angle_length(logg[2],logg[4],logg[6],RAD2DEG*angle,ilist,iparams,
3891 atoms);
3892 lb=(1.0-ring_margin)*blen;
3893 ub=(1.0+ring_margin)*blen;
3894 if (((weight[logg[2]] != 0.0) || (weight[logg[6]] != 0.0)) &&
3895 (!dist_set(d,natoms,logg[2],logg[6]))) {
3896 set_dist(d,natoms,logg[2],logg[6],lb,ub,blen);
3897 ndist++;
3898 n13dist++;
3900 /*SETDISTANCE for CE2 and CE1 (1-3) */
3901 angle=lookup_angle(logg[4],logg[6],logg[8],ilist,iparams,atoms);
3902 blen=angle_length(logg[4],logg[6],logg[8],RAD2DEG*angle,ilist,iparams,
3903 atoms);
3904 lb=(1.0-ring_margin)*blen;
3905 ub=(1.0+ring_margin)*blen;
3906 if (((weight[logg[4]] != 0.0) || (weight[logg[8]] != 0.0)) &&
3907 (!dist_set(d,natoms,logg[4],logg[8]))) {
3908 set_dist(d,natoms,logg[4],logg[8],lb,ub,blen);
3909 ndist++;
3910 n13dist++;
3912 /*SETDISTANCE for CZ and CE1 (1-3) */
3913 angle=lookup_angle(logg[6],logg[8],logg[10],ilist,iparams,atoms);
3914 blen=angle_length(logg[6],logg[8],logg[10],RAD2DEG*angle,ilist,iparams,
3915 atoms);
3916 lb=(1.0-ring_margin)*blen;
3917 ub=(1.0+ring_margin)*blen;
3918 if (((weight[logg[6]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3919 (!dist_set(d,natoms,logg[6],logg[10]))) {
3920 set_dist(d,natoms,logg[6],logg[10],lb,ub,blen);
3921 ndist++;
3922 n13dist++;
3924 /*SETDISTANCE for CE1 and CG (1-3) */
3925 angle=lookup_angle(logg[8],logg[10],logg[1],ilist,iparams,atoms);
3926 blen=angle_length(logg[8],logg[10],logg[1],RAD2DEG*angle,ilist,iparams,
3927 atoms);
3928 lb=(1.0-ring_margin)*blen;
3929 ub=(1.0+ring_margin)*blen;
3930 if (((weight[logg[8]] != 0.0) || (weight[logg[1]] != 0.0)) &&
3931 (!dist_set(d,natoms,logg[8],logg[1]))) {
3932 set_dist(d,natoms,logg[8],logg[1],lb,ub,blen);
3933 ndist++;
3934 n13dist++;
3936 /*SETDISTANCE for CB and CD1 (1-3) */
3937 angle=lookup_angle(logg[0],logg[1],logg[10],ilist,iparams,atoms);
3938 blen=angle_length(logg[0],logg[1],logg[10],RAD2DEG*angle,ilist,iparams,
3939 atoms);
3940 lb=(1.0-ring_margin)*blen;
3941 ub=(1.0+ring_margin)*blen;
3942 if (((weight[logg[0]] != 0.0) || (weight[logg[10]] != 0.0)) &&
3943 (!dist_set(d,natoms,logg[0],logg[10]))) {
3944 set_dist(d,natoms,logg[0],logg[10],lb,ub,blen);
3945 ndist++;
3946 n13dist++;
3948 /*SETDISTANCE for CB and CD2 (1-3) */
3949 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
3950 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
3951 atoms);
3952 lb=(1.0-ring_margin)*blen;
3953 ub=(1.0+ring_margin)*blen;
3954 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
3955 (!dist_set(d,natoms,logg[0],logg[2]))) {
3956 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
3957 ndist++;
3958 n13dist++;
3960 /*SETDISTANCE for HD2 and CG (1-3) */
3961 angle=lookup_angle(logg[3],logg[2],logg[1],ilist,iparams,atoms);
3962 blen=angle_length(logg[3],logg[2],logg[1],RAD2DEG*angle,ilist,iparams,
3963 atoms);
3964 lb=(1.0-ring_margin)*blen;
3965 ub=(1.0+ring_margin)*blen;
3966 if (((weight[logg[3]] != 0.0) || (weight[logg[1]] != 0.0)) &&
3967 (!dist_set(d,natoms,logg[3],logg[1]))) {
3968 set_dist(d,natoms,logg[3],logg[1],lb,ub,blen);
3969 ndist++;
3970 n13dist++;
3972 /*SETDISTANCE for HD2 and CE2 (1-3) */
3973 angle=lookup_angle(logg[3],logg[2],logg[4],ilist,iparams,atoms);
3974 blen=angle_length(logg[3],logg[2],logg[4],RAD2DEG*angle,ilist,iparams,
3975 atoms);
3976 lb=(1.0-ring_margin)*blen;
3977 ub=(1.0+ring_margin)*blen;
3978 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
3979 (!dist_set(d,natoms,logg[3],logg[4]))) {
3980 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
3981 ndist++;
3982 n13dist++;
3984 /*SETDISTANCE for HE2 and CD2 (1-3) */
3985 angle=lookup_angle(logg[5],logg[4],logg[2],ilist,iparams,atoms);
3986 blen=angle_length(logg[5],logg[4],logg[2],RAD2DEG*angle,ilist,iparams,
3987 atoms);
3988 lb=(1.0-ring_margin)*blen;
3989 ub=(1.0+ring_margin)*blen;
3990 if (((weight[logg[5]] != 0.0) || (weight[logg[2]] != 0.0)) &&
3991 (!dist_set(d,natoms,logg[5],logg[2]))) {
3992 set_dist(d,natoms,logg[5],logg[2],lb,ub,blen);
3993 ndist++;
3994 n13dist++;
3996 /*SETDISTANCE for HE2 and CZ (1-3) */
3997 angle=lookup_angle(logg[5],logg[4],logg[6],ilist,iparams,atoms);
3998 blen=angle_length(logg[5],logg[4],logg[6],RAD2DEG*angle,ilist,iparams,
3999 atoms);
4000 lb=(1.0-ring_margin)*blen;
4001 ub=(1.0+ring_margin)*blen;
4002 if (((weight[logg[5]] != 0.0) || (weight[logg[6]] != 0.0)) &&
4003 (!dist_set(d,natoms,logg[5],logg[6]))) {
4004 set_dist(d,natoms,logg[5],logg[6],lb,ub,blen);
4005 ndist++;
4006 n13dist++;
4008 /*SETDISTANCE for OH and CE2 (1-3) */
4009 angle=lookup_angle(logg[7],logg[6],logg[4],ilist,iparams,atoms);
4010 blen=angle_length(logg[7],logg[6],logg[4],RAD2DEG*angle,ilist,iparams,
4011 atoms);
4012 lb=(1.0-ring_margin)*blen;
4013 ub=(1.0+ring_margin)*blen;
4014 if (((weight[logg[7]] != 0.0) || (weight[logg[4]] != 0.0)) &&
4015 (!dist_set(d,natoms,logg[7],logg[4]))) {
4016 set_dist(d,natoms,logg[7],logg[4],lb,ub,blen);
4017 ndist++;
4018 n13dist++;
4020 /*SETDISTANCE for OH and CE1 (1-3) */
4021 angle=lookup_angle(logg[7],logg[6],logg[8],ilist,iparams,atoms);
4022 blen=angle_length(logg[7],logg[6],logg[8],RAD2DEG*angle,ilist,iparams,
4023 atoms);
4024 lb=(1.0-ring_margin)*blen;
4025 ub=(1.0+ring_margin)*blen;
4026 if (((weight[logg[7]] != 0.0) || (weight[logg[8]] != 0.0)) &&
4027 (!dist_set(d,natoms,logg[7],logg[8]))) {
4028 set_dist(d,natoms,logg[7],logg[8],lb,ub,blen);
4029 ndist++;
4030 n13dist++;
4032 /*SETDISTANCE for HE1 and CZ (1-3) */
4033 angle=lookup_angle(logg[9],logg[8],logg[6],ilist,iparams,atoms);
4034 blen=angle_length(logg[9],logg[8],logg[6],RAD2DEG*angle,ilist,iparams,
4035 atoms);
4036 lb=(1.0-ring_margin)*blen;
4037 ub=(1.0+ring_margin)*blen;
4038 if (((weight[logg[9]] != 0.0) || (weight[logg[6]] != 0.0)) &&
4039 (!dist_set(d,natoms,logg[9],logg[6]))) {
4040 set_dist(d,natoms,logg[9],logg[6],lb,ub,blen);
4041 ndist++;
4042 n13dist++;
4044 /*SETDISTANCE for HE1 and CD1 (1-3) */
4045 angle=lookup_angle(logg[9],logg[8],logg[10],ilist,iparams,atoms);
4046 blen=angle_length(logg[9],logg[8],logg[10],RAD2DEG*angle,ilist,iparams,
4047 atoms);
4048 lb=(1.0-ring_margin)*blen;
4049 ub=(1.0+ring_margin)*blen;
4050 if (((weight[logg[9]] != 0.0) || (weight[logg[10]] != 0.0)) &&
4051 (!dist_set(d,natoms,logg[9],logg[10]))) {
4052 set_dist(d,natoms,logg[9],logg[10],lb,ub,blen);
4053 ndist++;
4054 n13dist++;
4056 /*SETDISTANCE for HD1 and CE1 (1-3) */
4057 angle=lookup_angle(logg[11],logg[10],logg[8],ilist,iparams,atoms);
4058 blen=angle_length(logg[11],logg[10],logg[8],RAD2DEG*angle,ilist,iparams,
4059 atoms);
4060 lb=(1.0-ring_margin)*blen;
4061 ub=(1.0+ring_margin)*blen;
4062 if (((weight[logg[11]] != 0.0) || (weight[logg[8]] != 0.0)) &&
4063 (!dist_set(d,natoms,logg[11],logg[8]))) {
4064 set_dist(d,natoms,logg[11],logg[8],lb,ub,blen);
4065 ndist++;
4066 n13dist++;
4069 /* new 1-4 distances added 981126 */
4070 /*SETDISTANCE for CD2 and HD1 (logg[2]&logg[11]) (transdihedral)*/
4071 pdih_lengths(logg[2],logg[1],logg[10],logg[11],ilist,iparams,&lb,&blen,
4072 atoms);
4073 lb=(1.0-ring_margin)*blen;
4074 ub=(1.0+ring_margin)*blen;
4075 if (((weight[logg[2]] != 0.0) || (weight[logg[11]] != 0.0)) &&
4076 (!dist_set(d,natoms,logg[2],logg[11]))) {
4077 set_dist(d,natoms,logg[2],logg[11],lb,ub,blen);
4078 ndist++;
4079 n14dist++;
4081 /*SETDISTANCE for CZ and HD1 (logg[6]&logg[11]) (transdihedral)*/
4082 pdih_lengths(logg[6],logg[8],logg[10],logg[11],ilist,iparams,&lb,&blen,
4083 atoms);
4084 lb=(1.0-ring_margin)*blen;
4085 ub=(1.0+ring_margin)*blen;
4086 if (((weight[logg[6]] != 0.0) || (weight[logg[11]] != 0.0)) &&
4087 (!dist_set(d,natoms,logg[6],logg[11]))) {
4088 set_dist(d,natoms,logg[6],logg[11],lb,ub,blen);
4089 ndist++;
4090 n14dist++;
4092 /*SETDISTANCE for CD2 and CE1 (logg[2]&logg[8]) (cisdihedral)*/
4093 pdih_lengths(logg[2],logg[1],logg[10],logg[8],ilist,iparams,&blen,&ub,
4094 atoms);
4095 lb=(1.0-ring_margin)*blen;
4096 ub=(1.0+ring_margin)*blen;
4097 if (((weight[logg[2]] != 0.0) || (weight[logg[8]] != 0.0)) &&
4098 (!dist_set(d,natoms,logg[2],logg[8]))) {
4099 set_dist(d,natoms,logg[2],logg[8],lb,ub,blen);
4100 ndist++;
4101 n14dist++;
4103 /*SETDISTANCE for CE2 and CD1 (logg[4]&logg[10]) (cisdihedral)*/
4104 pdih_lengths(logg[4],logg[6],logg[8],logg[10],ilist,iparams,&blen,&ub,
4105 atoms);
4106 lb=(1.0-ring_margin)*blen;
4107 ub=(1.0+ring_margin)*blen;
4108 if (((weight[logg[4]] != 0.0) || (weight[logg[10]] != 0.0)) &&
4109 (!dist_set(d,natoms,logg[4],logg[10]))) {
4110 set_dist(d,natoms,logg[4],logg[10],lb,ub,blen);
4111 ndist++;
4112 n14dist++;
4114 /* end of new 1-4 distances */
4116 /*SETDISTANCE for CB and CE1 (logg[0]&logg[8]) (transdihedral)*/
4117 pdih_lengths(logg[0],logg[1],logg[10],logg[8],ilist,iparams,&lb,&blen,
4118 atoms);
4119 lb=(1.0-ring_margin)*blen;
4120 ub=(1.0+ring_margin)*blen;
4121 if (((weight[logg[0]] != 0.0) || (weight[logg[8]] != 0.0)) &&
4122 (!dist_set(d,natoms,logg[0],logg[8]))) {
4123 set_dist(d,natoms,logg[0],logg[8],lb,ub,blen);
4124 ndist++;
4125 n14dist++;
4127 /*SETDISTANCE for CB and CE2 (logg[0]&logg[4]) (transdihedral)*/
4128 pdih_lengths(logg[0],logg[1],logg[2],logg[4],ilist,iparams,&lb,&blen,
4129 atoms);
4130 lb=(1.0-ring_margin)*blen;
4131 ub=(1.0+ring_margin)*blen;
4132 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
4133 (!dist_set(d,natoms,logg[0],logg[4]))) {
4134 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
4135 ndist++;
4136 n14dist++;
4138 /*SETDISTANCE for CD1 and HD2 (logg[10]&logg[3]) (transdihedral)*/
4139 pdih_lengths(logg[10],logg[1],logg[2],logg[3],ilist,iparams,&lb,&blen,
4140 atoms);
4141 lb=(1.0-ring_margin)*blen;
4142 ub=(1.0+ring_margin)*blen;
4143 if (((weight[logg[10]] != 0.0) || (weight[logg[3]] != 0.0)) &&
4144 (!dist_set(d,natoms,logg[10],logg[3]))) {
4145 set_dist(d,natoms,logg[10],logg[3],lb,ub,blen);
4146 ndist++;
4147 n14dist++;
4149 /*SETDISTANCE for CZ and HD2 (logg[6]&logg[3]) (transdihedral)*/
4150 pdih_lengths(logg[6],logg[4],logg[2],logg[3],ilist,iparams,&lb,&blen,
4151 atoms);
4152 lb=(1.0-ring_margin)*blen;
4153 ub=(1.0+ring_margin)*blen;
4154 if (((weight[logg[6]] != 0.0) || (weight[logg[3]] != 0.0)) &&
4155 (!dist_set(d,natoms,logg[6],logg[3]))) {
4156 set_dist(d,natoms,logg[6],logg[3],lb,ub,blen);
4157 ndist++;
4158 n14dist++;
4160 /*SETDISTANCE for CG and HE2 (logg[1]&logg[5]) (transdihedral)*/
4161 pdih_lengths(logg[1],logg[2],logg[4],logg[5],ilist,iparams,&lb,&blen,
4162 atoms);
4163 lb=(1.0-ring_margin)*blen;
4164 ub=(1.0+ring_margin)*blen;
4165 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
4166 (!dist_set(d,natoms,logg[1],logg[5]))) {
4167 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
4168 ndist++;
4169 n14dist++;
4171 /*SETDISTANCE for CE1 and HE2 (logg[8]&logg[5]) (transdihedral)*/
4172 pdih_lengths(logg[8],logg[6],logg[4],logg[5],ilist,iparams,&lb,&blen,
4173 atoms);
4174 lb=(1.0-ring_margin)*blen;
4175 ub=(1.0+ring_margin)*blen;
4176 if (((weight[logg[8]] != 0.0) || (weight[logg[5]] != 0.0)) &&
4177 (!dist_set(d,natoms,logg[8],logg[5]))) {
4178 set_dist(d,natoms,logg[8],logg[5],lb,ub,blen);
4179 ndist++;
4180 n14dist++;
4182 /*SETDISTANCE for CD1 and OH (logg[10]&logg[7]) (transdihedral)*/
4183 pdih_lengths(logg[10],logg[8],logg[6],logg[7],ilist,iparams,&lb,&blen,
4184 atoms);
4185 lb=(1.0-ring_margin)*blen;
4186 ub=(1.0+ring_margin)*blen;
4187 if (((weight[logg[10]] != 0.0) || (weight[logg[7]] != 0.0)) &&
4188 (!dist_set(d,natoms,logg[10],logg[7]))) {
4189 set_dist(d,natoms,logg[10],logg[7],lb,ub,blen);
4190 ndist++;
4191 n14dist++;
4193 /*SETDISTANCE for CD2 and OH (logg[2]&logg[7]) (transdihedral)*/
4194 pdih_lengths(logg[2],logg[4],logg[6],logg[7],ilist,iparams,&lb,&blen,
4195 atoms);
4196 lb=(1.0-ring_margin)*blen;
4197 ub=(1.0+ring_margin)*blen;
4198 if (((weight[logg[2]] != 0.0) || (weight[logg[7]] != 0.0)) &&
4199 (!dist_set(d,natoms,logg[2],logg[7]))) {
4200 set_dist(d,natoms,logg[2],logg[7],lb,ub,blen);
4201 ndist++;
4202 n14dist++;
4204 /*SETDISTANCE for CE2 and HE1 (logg[4]&logg[9]) (transdihedral)*/
4205 pdih_lengths(logg[4],logg[6],logg[8],logg[9],ilist,iparams,&lb,&blen,
4206 atoms);
4207 lb=(1.0-ring_margin)*blen;
4208 ub=(1.0+ring_margin)*blen;
4209 if (((weight[logg[4]] != 0.0) || (weight[logg[9]] != 0.0)) &&
4210 (!dist_set(d,natoms,logg[4],logg[9]))) {
4211 set_dist(d,natoms,logg[4],logg[9],lb,ub,blen);
4212 ndist++;
4213 n14dist++;
4215 /*SETDISTANCE for CG and HE1 (logg[1]&logg[9]) (transdihedral)*/
4216 pdih_lengths(logg[1],logg[10],logg[8],logg[9],ilist,iparams,&lb,&blen,
4217 atoms);
4218 lb=(1.0-ring_margin)*blen;
4219 ub=(1.0+ring_margin)*blen;
4220 if (((weight[logg[1]] != 0.0) || (weight[logg[9]] != 0.0)) &&
4221 (!dist_set(d,natoms,logg[1],logg[9]))) {
4222 set_dist(d,natoms,logg[1],logg[9],lb,ub,blen);
4223 ndist++;
4224 n14dist++;
4226 /*SETDISTANCE for CB and HD1 (logg[0]&logg[11]) (cisdihedral)*/
4227 pdih_lengths(logg[0],logg[1],logg[10],logg[11],ilist,iparams,&blen,&ub,
4228 atoms);
4229 lb=(1.0-ring_margin)*blen;
4230 ub=(1.0+ring_margin)*blen;
4231 if (((weight[logg[0]] != 0.0) || (weight[logg[11]] != 0.0)) &&
4232 (!dist_set(d,natoms,logg[0],logg[11]))) {
4233 set_dist(d,natoms,logg[0],logg[11],lb,ub,blen);
4234 ndist++;
4235 n14dist++;
4237 /*SETDISTANCE for CB and HD2 (logg[0]&logg[3]) (cisdihedral)*/
4238 pdih_lengths(logg[0],logg[1],logg[2],logg[3],ilist,iparams,&blen,&ub,
4239 atoms);
4240 lb=(1.0-ring_margin)*blen;
4241 ub=(1.0+ring_margin)*blen;
4242 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
4243 (!dist_set(d,natoms,logg[0],logg[3]))) {
4244 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
4245 ndist++;
4246 n14dist++;
4248 /*SETDISTANCE for CG and CZ (logg[1]&logg[6]) (cisdihedral)*/
4249 pdih_lengths(logg[1],logg[2],logg[4],logg[6],ilist,iparams,&blen,&ub,
4250 atoms);
4251 lb=(1.0-ring_margin)*blen;
4252 ub=(1.0+ring_margin)*blen;
4253 if (((weight[logg[1]] != 0.0) || (weight[logg[6]] != 0.0)) &&
4254 (!dist_set(d,natoms,logg[1],logg[6]))) {
4255 set_dist(d,natoms,logg[1],logg[6],lb,ub,blen);
4256 ndist++;
4257 n14dist++;
4259 /*SETDISTANCE for HD2 and HE2 (logg[3]&logg[5]) (cisdihedral)*/
4260 pdih_lengths(logg[3],logg[2],logg[4],logg[5],ilist,iparams,&blen,&ub,
4261 atoms);
4262 lb=(1.0-ring_margin)*blen;
4263 ub=(1.0+ring_margin)*blen;
4264 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
4265 (!dist_set(d,natoms,logg[3],logg[5]))) {
4266 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
4267 ndist++;
4268 n14dist++;
4270 /*SETDISTANCE for HE2 and OH (logg[5]&logg[7]) (cisdihedral)*/
4271 pdih_lengths(logg[5],logg[4],logg[6],logg[7],ilist,iparams,&blen,&ub,
4272 atoms);
4273 lb=(1.0-ring_margin)*blen;
4274 ub=(1.0+ring_margin)*blen;
4275 if (((weight[logg[5]] != 0.0) || (weight[logg[7]] != 0.0)) &&
4276 (!dist_set(d,natoms,logg[5],logg[7]))) {
4277 set_dist(d,natoms,logg[5],logg[7],lb,ub,blen);
4278 ndist++;
4279 n14dist++;
4281 /*SETDISTANCE for OH and HE1 (logg[7]&logg[9]) (cisdihedral)*/
4282 pdih_lengths(logg[7],logg[6],logg[8],logg[9],ilist,iparams,&blen,&ub,
4283 atoms);
4284 lb=(1.0-ring_margin)*blen;
4285 ub=(1.0+ring_margin)*blen;
4286 if (((weight[logg[7]] != 0.0) || (weight[logg[9]] != 0.0)) &&
4287 (!dist_set(d,natoms,logg[7],logg[9]))) {
4288 set_dist(d,natoms,logg[7],logg[9],lb,ub,blen);
4289 ndist++;
4290 n14dist++;
4292 /*SETDISTANCE for HE1 and HD1 (logg[9]&logg[11]) (cisdihedral)*/
4293 pdih_lengths(logg[9],logg[8],logg[10],logg[11],ilist,iparams,&blen,&ub,
4294 atoms);
4295 lb=(1.0-ring_margin)*blen;
4296 ub=(1.0+ring_margin)*blen;
4297 if (((weight[logg[9]] != 0.0) || (weight[logg[11]] != 0.0)) &&
4298 (!dist_set(d,natoms,logg[9],logg[11]))) {
4299 set_dist(d,natoms,logg[9],logg[11],lb,ub,blen);
4300 ndist++;
4301 n14dist++;
4304 /* new 1-5 distances added 981126 */
4305 /*SETDISTANCE for HD2 and OH (1-5) */
4306 tyr_15_CBHE(logg[3],logg[2],logg[4],logg[6],logg[7],ilist,
4307 iparams,&blen,atoms);
4308 lb=(1.0-ring_margin)*blen;
4309 ub=(1.0+ring_margin)*blen;
4310 if (((weight[logg[3]] != 0.0) || (weight[logg[7]] != 0.0)) &&
4311 (!dist_set(d,natoms,logg[3],logg[7]))) {
4312 set_dist(d,natoms,logg[3],logg[7],lb,ub,blen);
4313 ndist++;
4314 n15dist++;
4316 /*SETDISTANCE for HD2 and HD1 (1-5) */
4317 tyr_15_CBHE(logg[3],logg[2],logg[1],logg[10],logg[11],ilist,
4318 iparams,&blen,atoms);
4319 lb=(1.0-ring_margin)*blen;
4320 ub=(1.0+ring_margin)*blen;
4321 if (((weight[logg[3]] != 0.0) || (weight[logg[11]] != 0.0)) &&
4322 (!dist_set(d,natoms,logg[3],logg[11]))) {
4323 set_dist(d,natoms,logg[3],logg[11],lb,ub,blen);
4324 ndist++;
4325 n15dist++;
4327 /*SETDISTANCE for HE2 and HE1 (1-5) */
4328 tyr_15_CBHE(logg[5],logg[4],logg[6],logg[8],logg[9],ilist,
4329 iparams,&blen,atoms);
4330 lb=(1.0-ring_margin)*blen;
4331 ub=(1.0+ring_margin)*blen;
4332 if (((weight[logg[5]] != 0.0) || (weight[logg[9]] != 0.0)) &&
4333 (!dist_set(d,natoms,logg[5],logg[9]))) {
4334 set_dist(d,natoms,logg[5],logg[9],lb,ub,blen);
4335 ndist++;
4336 n15dist++;
4338 /*SETDISTANCE for OH and HD1 (1-5) */
4339 tyr_15_CBHE(logg[7],logg[6],logg[8],logg[10],logg[11],ilist,
4340 iparams,&blen,atoms);
4341 lb=(1.0-ring_margin)*blen;
4342 ub=(1.0+ring_margin)*blen;
4343 if (((weight[logg[7]] != 0.0) || (weight[logg[11]] != 0.0)) &&
4344 (!dist_set(d,natoms,logg[7],logg[11]))) {
4345 set_dist(d,natoms,logg[7],logg[11],lb,ub,blen);
4346 ndist++;
4347 n15dist++;
4349 /*SETDISTANCE for HE1 and CD2 (1-5) */
4350 tyr_15_CBCZ(logg[9],logg[8],logg[6],logg[4],logg[2],ilist,
4351 iparams,&blen,atoms);
4352 lb=(1.0-ring_margin)*blen;
4353 ub=(1.0+ring_margin)*blen;
4354 if (((weight[logg[9]] != 0.0) || (weight[logg[2]] != 0.0)) &&
4355 (!dist_set(d,natoms,logg[9],logg[2]))) {
4356 set_dist(d,natoms,logg[9],logg[2],lb,ub,blen);
4357 ndist++;
4358 n15dist++;
4360 /*SETDISTANCE for HD2 and CE1 (1-5) */
4361 tyr_15_CBCZ(logg[3],logg[2],logg[4],logg[6],logg[8],ilist,
4362 iparams,&blen,atoms);
4363 lb=(1.0-ring_margin)*blen;
4364 ub=(1.0+ring_margin)*blen;
4365 if (((weight[logg[3]] != 0.0) || (weight[logg[8]] != 0.0)) &&
4366 (!dist_set(d,natoms,logg[3],logg[8]))) {
4367 set_dist(d,natoms,logg[3],logg[8],lb,ub,blen);
4368 ndist++;
4369 n15dist++;
4371 /*SETDISTANCE for HD1 and CE2 (1-5) */
4372 tyr_15_CBCZ(logg[11],logg[10],logg[1],logg[2],logg[4],ilist,
4373 iparams,&blen,atoms);
4374 lb=(1.0-ring_margin)*blen;
4375 ub=(1.0+ring_margin)*blen;
4376 if (((weight[logg[11]] != 0.0) || (weight[logg[4]] != 0.0)) &&
4377 (!dist_set(d,natoms,logg[11],logg[4]))) {
4378 set_dist(d,natoms,logg[11],logg[4],lb,ub,blen);
4379 ndist++;
4380 n15dist++;
4382 /*SETDISTANCE for HE2 and CD1 (1-5) */
4383 tyr_15_CBCZ(logg[5],logg[4],logg[6],logg[8],logg[10],ilist,
4384 iparams,&blen,atoms);
4385 lb=(1.0-ring_margin)*blen;
4386 ub=(1.0+ring_margin)*blen;
4387 if (((weight[logg[5]] != 0.0) || (weight[logg[10]] != 0.0)) &&
4388 (!dist_set(d,natoms,logg[5],logg[10]))) {
4389 set_dist(d,natoms,logg[5],logg[10],lb,ub,blen);
4390 ndist++;
4391 n15dist++;
4393 /* end new 1-5 distances */
4395 /*fprintf(stderr,"Calling tyr_15_CBHE\n");*/
4396 /*SETDISTANCE for CB and HE2 (1-5) */
4397 tyr_15_CBHE(logg[0],logg[1],logg[2],logg[4],logg[5],ilist,
4398 iparams,&blen,atoms);
4399 /*fprintf(stderr,"Exited tyr_15_CBHE\n");*/
4400 lb=(1.0-ring_margin)*blen;
4401 ub=(1.0+ring_margin)*blen;
4402 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
4403 (!dist_set(d,natoms,logg[0],logg[5]))) {
4404 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
4405 ndist++;
4406 n15dist++;
4408 /*fprintf(stderr,"Calling tyr_15_CBHE\n");*/
4409 /*SETDISTANCE for CB and HE1 (1-5) */
4410 tyr_15_CBHE(logg[0],logg[1],logg[10],logg[8],logg[9],ilist,
4411 iparams,&blen,atoms);
4412 lb=(1.0-ring_margin)*blen;
4413 ub=(1.0+ring_margin)*blen;
4414 if (((weight[logg[0]] != 0.0) || (weight[logg[9]] != 0.0)) &&
4415 (!dist_set(d,natoms,logg[0],logg[9]))) {
4416 set_dist(d,natoms,logg[0],logg[9],lb,ub,blen);
4417 ndist++;
4418 n15dist++;
4420 /*SETDISTANCE for CB and CZ (1-5) */
4421 tyr_15_CBCZ(logg[0],logg[1],logg[2],logg[4],logg[6],ilist,
4422 iparams,&blen,atoms);
4423 lb=(1.0-ring_margin)*blen;
4424 ub=(1.0+ring_margin)*blen;
4425 if (((weight[logg[0]] != 0.0) || (weight[logg[6]] != 0.0)) &&
4426 (!dist_set(d,natoms,logg[0],logg[6]))) {
4427 set_dist(d,natoms,logg[0],logg[6],lb,ub,blen);
4428 ndist++;
4429 n15dist++;
4431 /*fprintf(stderr,"Calling tyr_15_CGOH\n");*/
4432 /*SETDISTANCE for CG and OH (1-5) */
4433 tyr_15_CGOH(logg[1],logg[2],logg[4],logg[6],logg[7],ilist,
4434 iparams,&blen,atoms);
4435 lb=(1.0-ring_margin)*blen;
4436 ub=(1.0+ring_margin)*blen;
4437 if (((weight[logg[1]] != 0.0) || (weight[logg[7]] != 0.0)) &&
4438 (!dist_set(d,natoms,logg[1],logg[7]))) {
4439 set_dist(d,natoms,logg[1],logg[7],lb,ub,blen);
4440 ndist++;
4441 n15dist++;
4443 /* 1111111111------------6666666666 */
4444 /*SETDISTANCE for CB and OH (1-6) */
4445 tyr_16_type2(logg[0],logg[1],logg[2],logg[4],logg[6],logg[7],
4446 ilist,iparams,&blen,atoms);
4447 lb=(1.0-ring_margin)*blen;
4448 ub=(1.0+ring_margin)*blen;
4449 if (((weight[logg[0]] != 0.0) || (weight[logg[7]] != 0.0)) &&
4450 (!dist_set(d,natoms,logg[0],logg[7]))) {
4451 set_dist(d,natoms,logg[0],logg[7],lb,ub,blen);
4452 ndist++;
4453 n16dist++;
4455 /*SETDISTANCE for HD1 and HE2 (1-6) */
4456 tyr_16_type2(logg[11],logg[10],logg[1],logg[2],logg[4],logg[5],
4457 ilist,iparams,&blen,atoms);
4458 lb=(1.0-ring_margin)*blen;
4459 ub=(1.0+ring_margin)*blen;
4460 if (((weight[logg[11]] != 0.0) || (weight[logg[5]] != 0.0)) &&
4461 (!dist_set(d,natoms,logg[11],logg[5]))) {
4462 set_dist(d,natoms,logg[11],logg[5],lb,ub,blen);
4463 ndist++;
4464 n16dist++;
4466 /*SETDISTANCE for HD2 and HE1 (1-6) */
4467 tyr_16_type2(logg[3],logg[2],logg[4],logg[6],logg[8],logg[9],
4468 ilist,iparams,&blen,atoms);
4469 lb=(1.0-ring_margin)*blen;
4470 ub=(1.0+ring_margin)*blen;
4471 if (((weight[logg[3]] != 0.0) || (weight[logg[9]] != 0.0)) &&
4472 (!dist_set(d,natoms,logg[3],logg[9]))) {
4473 set_dist(d,natoms,logg[3],logg[9],lb,ub,blen);
4474 ndist++;
4475 n16dist++;
4477 if (bVir) {
4478 /* VIRTUAL DISTANCES */
4479 nVdist += set_virtual (logg,12,ring_margin,d,natoms);
4480 ndist += nVdist;
4481 if (FALSE) {
4482 for (q=0 ; q<12 ; q++ ) {
4483 if (q == 10) {
4484 blen = 8.0;
4485 lb = (1.0-ring_margin)*blen;
4486 ub = (1.0+ring_margin)*blen;
4488 else {
4489 blen = d_len(d,natoms,logg[q],logg[10]);
4490 blen = sqrt(blen*blen+64.0);
4491 lb = (1.0-ring_margin)*blen;
4492 ub = (1.0+ring_margin)*blen;
4494 /* set distance to virtual atom */
4495 set_dist(d,natoms,logg[q],logg[12],lb,ub,blen);
4496 ndist++;
4497 nVdist++;
4504 logg[13]=0;
4508 fprintf(log,"There are %d new tyrosine distances\n",ndist);
4509 if (ndist > 0 ) {
4510 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4, %d 1-5, %d 1-6, %d virtual)\n",n12dist,n13dist,
4511 n14dist,n15dist,n16dist,nVdist);
4514 /**********************************************************
4516 * T R Y P T O P H A N
4518 **********************************************************/
4519 /* Remember that the order of atoms sent in to the 1-5-routines */
4520 /* is important */
4522 static void trp_15_type1(int ai,int aj,int ak,int al,int am,
4523 t_ilist ilist[],t_iparams iparams[],
4524 real *lb,t_atoms *atoms)
4526 /* Returns the length corresponding to a 1-5 distance */
4527 real rij,rjk,rkl,rlm,rik,rkm;
4528 real thijk,thjkl,thklm,thikj,thmkl;
4529 real real_pi = M_PI*2.0;
4530 real half_pi = M_PI*0.5;
4532 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4533 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4534 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4535 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4536 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4537 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4538 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4539 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4540 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
4542 /* Compute angle thikj using law of sines */
4543 thikj = asin(rij*sin(thijk)/rik);
4545 /* Compute thmkl using law of sines */
4546 thmkl = asin(rlm*sin(thklm)/rkm);
4548 /* Compute cis length using law of cosines */
4549 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thjkl-thmkl+thikj));
4552 static void trp_15_type2(int ai,int aj,int ak,int al,int am,
4553 t_ilist ilist[],t_iparams iparams[],
4554 real *lb,t_atoms *atoms)
4556 /* Returns the length corresponding to a 1-5 distance */
4557 real rij,rjk,rkl,rlm,rik,rkm,rim;
4558 real thijk,thjkl,thklm,thikj,thmkl;
4559 real real_pi = M_PI*2.0;
4560 real half_pi = M_PI*0.5;
4562 /* fprintf(stderr,"Got past initialisations\n");*/
4563 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4564 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4565 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4566 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4567 /*fprintf(stderr,"Got past lookup_bondlength\n");*/
4568 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4569 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4570 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4571 /*fprintf(stderr,"Got past lookup_angle\n");*/
4572 /*fprintf(stderr,"%g %g %g %g %g %g %g\n",rij,rjk,rkl,rlm,RAD2DEG*thijk,
4573 RAD2DEG*thjkl,RAD2DEG*thklm);*/
4574 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4575 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
4576 /*fprintf(stderr,"Got past angle_length\n");*/
4578 /* Compute angle thikj using law of sines */
4579 thikj = asin(rij*sin(thijk)/rik);
4581 /* Compute thmkl using law of sines */
4582 thmkl = asin(rlm*sin(thklm)/rkm);
4584 /* Compute cis length using law of cosines */
4585 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(real_pi-thikj-thmkl-thjkl));
4586 /*fprintf(stderr,"leaving routine\n");*/
4589 static void trp_15_type3(int ai,int aj,int ak,int al,int am,
4590 t_ilist ilist[],t_iparams iparams[],
4591 real *lb,t_atoms *atoms)
4593 /* Returns the length corresponding to a 1-5 distance */
4594 real rij,rjk,rkl,rlm,rik,rkm;
4595 real thijk,thjkl,thklm,thikj,thmkl;
4596 real real_pi = M_PI*2.0;
4597 real half_pi = M_PI*0.5;
4599 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4600 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4601 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4602 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4603 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4604 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4605 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4606 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4607 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
4609 /* Compute angle thikj using law of sines */
4610 thikj = asin(rij*sin(thijk)/rik);
4612 /* Compute thmkl using law of sines */
4613 thmkl = asin(rlm*sin(thklm)/rkm);
4615 /* Compute cis length using law of cosines */
4616 *lb = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thjkl-thikj-thmkl));
4619 static void trp_16_type1(int ai,int aj,int ak,int al,int am,int an,
4620 t_ilist ilist[],t_iparams iparams[],
4621 real *lb,t_atoms *atoms)
4624 real rij,rjk,rkl,rlm,rmn,rik,ril,rim;
4625 real thijk,thjkl,thklm,thlmn,thikj,thilk,thiml,thimn,thikl,thilm;
4626 real real_pi = M_PI*2.0;
4627 real half_pi = M_PI*0.5;
4629 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4630 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4631 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4632 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4633 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
4634 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4635 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4636 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4637 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
4639 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4641 /* Compute angle thikl */
4642 thikj = asin(rij*sin(thijk)/rik);
4643 thikl = thjkl-thikj;
4645 /* Compute ril */
4646 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
4648 /* Compute thilk */
4649 thilk = asin(rik*sin(thikl)/ril);
4651 /* Compute rim */
4652 thilm = thilk+thklm;
4653 rim = sqrt(ril*ril+rlm*rlm-2.0*ril*rlm*cos(thilm));
4655 /* Compute rin */
4656 thiml = asin(ril*sin(thilm)/rim);
4657 thimn = thlmn-thiml;
4658 *lb = sqrt(rim*rim+rmn*rmn-2.0*rim*rmn*cos(thimn));
4661 static void trp_16_type2(int ai,int aj,int ak,int al,int am,int an,
4662 t_ilist ilist[],t_iparams iparams[],
4663 real *lb,t_atoms *atoms)
4665 /* Returns the length corresponding to a 1-6 distance */
4667 real rij,rjk,rkl,rlm,rmn,rik,rln,ril;
4668 real thijk,thjkl,thklm,thlmn,thikj,thikl,thilk,thnlm,thiln;
4669 real real_pi = M_PI*2.0;
4670 real half_pi = M_PI*0.5;
4672 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4673 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4674 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4675 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4676 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
4677 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4678 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4679 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4680 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
4682 /* Compute rik and rlm */
4683 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4684 rln = sqrt(rlm*rlm+rmn*rmn-2.0*rlm*rmn*cos(thlmn));
4686 /* Compute thikj */
4687 thikj = asin(rij*sin(thijk)/rik);
4688 thikl = thikj+thjkl;
4690 /* Compute ril */
4691 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
4693 /* Compute thilk, thlnm and thiln */
4694 thilk = asin(rik*sin(thikl)/ril);
4695 thnlm = asin(rmn*sin(thlmn)/rln);
4696 thiln = thklm-thilk+thnlm;
4698 *lb = sqrt(ril*ril+rln*rln-2.0*ril*rln*cos(thiln));
4701 static void trp_16_type3(int ai,int aj,int ak,int al,int am,int an,
4702 t_ilist ilist[],t_iparams iparams[],
4703 real *lb,t_atoms *atoms)
4705 real rij,rjk,rkl,rlm,rmn,rik,ril,rim;
4706 real thijk,thjkl,thklm,thlmn,thikj,thilk,thiml,thimn,thikl,thilm;
4707 real real_pi = M_PI*2.0;
4708 real half_pi = M_PI*0.5;
4710 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4711 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4712 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4713 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4714 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
4715 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4716 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4717 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4718 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
4720 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4722 /* Compute angle thikl */
4723 thikj = asin(rij*sin(thijk)/rik);
4724 thikl = thjkl-thikj;
4726 /* Compute ril */
4727 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
4729 /* Compute thilk */
4730 thilk = asin(rik*sin(thikl)/ril);
4732 /* Compute rim */
4733 thilm = thilk+thklm;
4734 rim = sqrt(ril*ril+rlm*rlm-2.0*ril*rlm*cos(thilm));
4736 /* Compute rin */
4737 thiml = asin(ril*sin(thilm)/rim);
4738 thimn = thlmn+thiml;
4739 *lb = sqrt(rim*rim+rmn*rmn-2.0*rim*rmn*cos(thimn));
4743 static void trp_16_type4(int ai,int aj,int ak,int al,int am,int an,
4744 t_ilist ilist[],t_iparams iparams[],
4745 real *lb,t_atoms *atoms)
4747 real rij,rjk,rkl,rlm,rmn,rik,rln,ril;
4748 real thijk,thjkl,thklm,thlmn,thikj,thikl,thilk,thnlm,thiln;
4749 real real_pi = M_PI*2.0;
4750 real half_pi = M_PI*0.5;
4752 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4753 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4754 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4755 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4756 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
4757 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4758 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4759 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4760 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
4762 /* Compute rik and rln */
4763 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4764 rln = sqrt(rlm*rlm+rmn*rmn-2.0*rlm*rmn*cos(thlmn));
4766 /* Compute thikj and thikl */
4767 thikj = asin(rij*sin(thijk)/rik);
4768 thikl = thikj+thjkl;
4770 /* Compute ril */
4771 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
4773 /* Compute thilk, thnlm and thiln */
4774 thilk = asin(rik*sin(thikl)/ril);
4775 thnlm = asin(rmn*sin(thlmn)/rln);
4776 thiln = thilk+thklm+thnlm;
4778 /* Compute rin */
4779 *lb = sqrt(ril*ril+rln*rln-2.0*ril*rln*cos(thiln));
4782 static void trp_17_type1(int ai,int aj,int ak,int al,int am,int an,int ao,
4783 t_ilist ilist[],t_iparams iparams[],
4784 real *lb,t_atoms *atoms)
4786 real rij,rjk,rkl,rlm,rmn,rno,rik,rkm,rmo,rim;
4787 real thijk,thjkl,thklm,thlmn,thmno,thikj,thmkl,thikm,thomn,
4788 thkml,thimk,thimo;
4789 real real_pi = M_PI*2.0;
4790 real half_pi = M_PI*0.5;
4792 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4793 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4794 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4795 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4796 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
4797 rno = lookup_bondlength(an,ao,ilist,iparams,TRUE,atoms);
4798 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4799 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4800 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4801 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
4802 thmno = lookup_angle(am,an,ao,ilist,iparams,atoms);
4804 /* Compute rik, rkm, rmo */
4805 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4806 rkm = sqrt(rkl*rkl+rlm*rlm-2.0*rkl*rlm*cos(thklm));
4807 rmo = sqrt(rmn*rmn+rno*rno-2.0*rmn*rno*cos(thmno));
4809 /* Compute thikj,thkml,thomn,thikm */
4810 thikj = asin(rij*sin(thijk)/rik);
4811 thmkl = asin(rlm*sin(thklm)/rkm);
4812 thikm = thikj+thjkl-thmkl;
4814 /* Compute rim */
4815 rim = sqrt(rik*rik+rkm*rkm-2.0*rik*rkm*cos(thikm));
4817 /* Compute thimk,thmkl,thimo */
4818 thomn = asin(rno*sin(thmno)/rmo);
4819 thkml = asin(rkl*sin(thklm)/rkm);
4820 thimk = asin(rik*sin(thikm)/rim);
4821 thimo = thimk+thkml+thlmn+thomn;
4823 /* Compute rio */
4824 *lb = sqrt(rim*rim+rmo*rmo-2.0*rim*rmo*cos(thimo));
4827 static void trp_17_type2(int ai,int aj,int ak,int al,int am,int an,int ao,
4828 t_ilist ilist[],t_iparams iparams[],
4829 real *lb,t_atoms *atoms)
4831 real rij,rjk,rkl,rlm,rmn,rno,rik,rmo,ril,rlo;
4832 real thijk,thjkl,thklm,thlmn,thmno,thikj,thomn,thikl,thlmo,thkli,
4833 tholm,thilo;
4834 real real_pi = M_PI*2.0;
4835 real half_pi = M_PI*0.5;
4838 rij = lookup_bondlength(ai,aj,ilist,iparams,TRUE,atoms);
4839 rjk = lookup_bondlength(aj,ak,ilist,iparams,TRUE,atoms);
4840 rkl = lookup_bondlength(ak,al,ilist,iparams,TRUE,atoms);
4841 rlm = lookup_bondlength(al,am,ilist,iparams,TRUE,atoms);
4842 rmn = lookup_bondlength(am,an,ilist,iparams,TRUE,atoms);
4843 rno = lookup_bondlength(an,ao,ilist,iparams,TRUE,atoms);
4844 thijk = lookup_angle(ai,aj,ak,ilist,iparams,atoms);
4845 thjkl = lookup_angle(aj,ak,al,ilist,iparams,atoms);
4846 thklm = lookup_angle(ak,al,am,ilist,iparams,atoms);
4847 thlmn = lookup_angle(al,am,an,ilist,iparams,atoms);
4848 thmno = lookup_angle(am,an,ao,ilist,iparams,atoms);
4850 /* Compute rik, rmo */
4851 rik = sqrt(rij*rij+rjk*rjk-2.0*rij*rjk*cos(thijk));
4852 rmo = sqrt(rmn*rmn+rno*rno-2.0*rmn*rno*cos(thmno));
4854 /* Compute thikj,thomn, thikl and thlmo */
4855 thikj = asin(rij*sin(thijk)/rik);
4856 thomn = asin(rno*sin(thmno)/rmo);
4857 thikl = thikj+thjkl;
4858 thlmo = thlmn+thomn;
4860 /* Compute ril and rlo */
4861 ril = sqrt(rik*rik+rkl*rkl-2.0*rik*rkl*cos(thikl));
4862 rlo = sqrt(rlm*rlm+rmo*rmo-2.0*rlm*rmo*cos(thlmo));
4864 /* Compute thkli, tholm and thilo*/
4865 thkli = asin(rik*sin(thikl)/ril);
4866 tholm = asin(rmo*sin(thlmo)/rlo);
4867 thilo = thkli+tholm+thklm;
4869 /* Compute rio */
4870 *lb = sqrt(ril*ril+rlo*rlo-2.0*ril*rlo*cos(thilo));
4873 void trp (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
4874 real ring_margin,t_ilist ilist[],t_iparams iparams[],bool bVir)
4876 int natoms,ndist,i,j,q,logg[18],residnr,oldresidnr,n12dist,n13dist,n14dist,
4877 n15dist,n16dist,n17dist,nVdist;
4878 real blen,lb,ub,angle;
4880 natoms= atoms->nr;
4881 ndist = 0;
4882 n12dist = 0;
4883 n13dist = 0;
4884 n14dist = 0;
4885 n15dist = 0;
4886 n16dist = 0;
4887 n17dist = 0;
4888 nVdist = 0;
4889 residnr = -1;
4890 oldresidnr=-1;
4892 for (i=0; (i<natoms); i++) {
4893 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"TRP") == 0) {
4894 oldresidnr=residnr;
4895 residnr=atoms->atom[i].resnr;
4896 logg[17]=0;
4897 if ( oldresidnr == residnr ) {
4898 continue;
4900 j=i;
4901 while ((atoms->atom[j].resnr) == residnr ) {
4902 if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
4903 logg[17]++;
4904 logg[0]=j;
4906 else if ( strcmp((*atoms->atomname[j]),"CG") == 0) {
4907 logg[17]++;
4908 logg[1]=j;
4910 else if ( strcmp((*atoms->atomname[j]),"CD2") == 0) {
4911 logg[17]++;
4912 logg[2]=j;
4914 else if ( strcmp((*atoms->atomname[j]),"CE3") == 0) {
4915 logg[17]++;
4916 logg[3]=j;
4918 else if ( strcmp((*atoms->atomname[j]),"CZ3") == 0) {
4919 logg[17]++;
4920 logg[4]=j;
4922 else if ( strcmp((*atoms->atomname[j]),"CH2") == 0) {
4923 logg[17]++;
4924 logg[5]=j;
4926 else if ( strcmp((*atoms->atomname[j]),"CZ2") == 0) {
4927 logg[17]++;
4928 logg[6]=j;
4930 else if ( strcmp((*atoms->atomname[j]),"CE2") == 0) {
4931 logg[17]++;
4932 logg[7]=j;
4934 else if ( strcmp((*atoms->atomname[j]),"NE1") == 0) {
4935 logg[17]++;
4936 logg[8]=j;
4938 else if ( strcmp((*atoms->atomname[j]),"CD1") == 0) {
4939 logg[17]++;
4940 logg[9]=j;
4942 else if ( strcmp((*atoms->atomname[j]),"HE3") == 0) {
4943 logg[17]++;
4944 logg[10]=j;
4946 else if ( strcmp((*atoms->atomname[j]),"HZ3") == 0) {
4947 logg[17]++;
4948 logg[11]=j;
4950 else if ( strcmp((*atoms->atomname[j]),"HH2") == 0) {
4951 logg[17]++;
4952 logg[12]=j;
4954 else if ( strcmp((*atoms->atomname[j]),"HZ2") == 0) {
4955 logg[17]++;
4956 logg[13]=j;
4958 else if ( strcmp((*atoms->atomname[j]),"HE1") == 0) {
4959 logg[17]++;
4960 logg[14]=j;
4962 else if ( strcmp((*atoms->atomname[j]),"HD1") == 0) {
4963 logg[17]++;
4964 logg[15]=j;
4966 else if ( (strcmp((*atoms->atomname[j]),"VF") == 0) && bVir) {
4967 logg[17]++;
4968 logg[16]=j;
4970 if ( ((logg[17] == 16) && !bVir) || ((logg[17] == 17) && bVir) ) {
4971 break;
4973 j++;
4975 if ( ((logg[17] == 16) && !bVir) || ((logg[17] == 17) && bVir) ) {
4977 if ((logg[17] == 16) && !bVir) {
4978 fprintf(log,"logg (trp) = %d %d %d %d %d %d %d %d %d %d %d %d",
4979 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
4980 logg[7],logg[8],logg[9],logg[10],logg[11]);
4981 fprintf(log," %d %d %d %d\n",logg[12],logg[13],logg[14],logg[15]);
4983 else if ((logg[17] == 17) && bVir) {
4984 fprintf(log,"logg (trp) = %d %d %d %d %d %d %d %d %d %d %d %d",
4985 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
4986 logg[7],logg[8],logg[9],logg[10],logg[11]);
4987 fprintf(log," %d %d %d %d %d\n",logg[12],logg[13],logg[14],logg[15],
4988 logg[16]);
4991 /*SETDISTANCE for CB and CG (1-2) */
4992 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
4993 lb=(1.0-ring_margin)*blen;
4994 ub=(1.0+ring_margin)*blen;
4995 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
4996 (!dist_set(d,natoms,logg[0],logg[1]))) {
4997 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
4998 ndist++;
4999 n12dist++;
5001 /*SETDISTANCE for CG and CD2 (1-2) */
5002 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
5003 lb=(1.0-ring_margin)*blen;
5004 ub=(1.0+ring_margin)*blen;
5005 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5006 (!dist_set(d,natoms,logg[1],logg[2]))) {
5007 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
5008 ndist++;
5009 n12dist++;
5011 /*SETDISTANCE for CD2 and CE3 (1-2) */
5012 blen=lookup_bondlength(logg[2],logg[3],ilist,iparams,TRUE,atoms);
5013 lb=(1.0-ring_margin)*blen;
5014 ub=(1.0+ring_margin)*blen;
5015 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
5016 (!dist_set(d,natoms,logg[2],logg[3]))) {
5017 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
5018 ndist++;
5019 n12dist++;
5021 /*SETDISTANCE for CE3 and CZ3 (1-2) */
5022 blen=lookup_bondlength(logg[3],logg[4],ilist,iparams,TRUE,atoms);
5023 lb=(1.0-ring_margin)*blen;
5024 ub=(1.0+ring_margin)*blen;
5025 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
5026 (!dist_set(d,natoms,logg[3],logg[4]))) {
5027 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
5028 ndist++;
5029 n12dist++;
5031 /*SETDISTANCE for CZ3 and CH2 (1-2) */
5032 blen=lookup_bondlength(logg[4],logg[5],ilist,iparams,TRUE,atoms);
5033 lb=(1.0-ring_margin)*blen;
5034 ub=(1.0+ring_margin)*blen;
5035 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5036 (!dist_set(d,natoms,logg[4],logg[5]))) {
5037 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
5038 ndist++;
5039 n12dist++;
5041 /*SETDISTANCE for CH2 and CZ2 (1-2) */
5042 blen=lookup_bondlength(logg[5],logg[6],ilist,iparams,TRUE,atoms);
5043 lb=(1.0-ring_margin)*blen;
5044 ub=(1.0+ring_margin)*blen;
5045 if (((weight[logg[5]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5046 (!dist_set(d,natoms,logg[5],logg[6]))) {
5047 set_dist(d,natoms,logg[5],logg[6],lb,ub,blen);
5048 ndist++;
5049 n12dist++;
5051 /*SETDISTANCE for CZ2 and CE2 (1-2) */
5052 blen=lookup_bondlength(logg[6],logg[7],ilist,iparams,TRUE,atoms);
5053 lb=(1.0-ring_margin)*blen;
5054 ub=(1.0+ring_margin)*blen;
5055 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5056 (!dist_set(d,natoms,logg[6],logg[7]))) {
5057 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
5058 ndist++;
5059 n12dist++;
5061 /*SETDISTANCE for CE2 and CD2 (1-2) */
5062 blen=lookup_bondlength(logg[7],logg[2],ilist,iparams,TRUE,atoms);
5063 lb=(1.0-ring_margin)*blen;
5064 ub=(1.0+ring_margin)*blen;
5065 if (((weight[logg[7]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5066 (!dist_set(d,natoms,logg[7],logg[2]))) {
5067 set_dist(d,natoms,logg[7],logg[2],lb,ub,blen);
5068 ndist++;
5069 n12dist++;
5071 /*SETDISTANCE for CE2 and NE1 (1-2) */
5072 blen=lookup_bondlength(logg[7],logg[8],ilist,iparams,TRUE,atoms);
5073 lb=(1.0-ring_margin)*blen;
5074 ub=(1.0+ring_margin)*blen;
5075 if (((weight[logg[7]] != 0.0) || (weight[logg[8]] != 0.0)) &&
5076 (!dist_set(d,natoms,logg[7],logg[8]))) {
5077 set_dist(d,natoms,logg[7],logg[8],lb,ub,blen);
5078 ndist++;
5079 n12dist++;
5081 /*SETDISTANCE for NE1 and CD1 (1-2) */
5082 blen=lookup_bondlength(logg[8],logg[9],ilist,iparams,TRUE,atoms);
5083 lb=(1.0-ring_margin)*blen;
5084 ub=(1.0+ring_margin)*blen;
5085 if (((weight[logg[8]] != 0.0) || (weight[logg[9]] != 0.0)) &&
5086 (!dist_set(d,natoms,logg[8],logg[9]))) {
5087 set_dist(d,natoms,logg[8],logg[9],lb,ub,blen);
5088 ndist++;
5089 n12dist++;
5091 /*SETDISTANCE for CD1 and CG (1-2) */
5092 blen=lookup_bondlength(logg[9],logg[1],ilist,iparams,TRUE,atoms);
5093 lb=(1.0-ring_margin)*blen;
5094 ub=(1.0+ring_margin)*blen;
5095 if (((weight[logg[9]] != 0.0) || (weight[logg[1]] != 0.0)) &&
5096 (!dist_set(d,natoms,logg[9],logg[1]))) {
5097 set_dist(d,natoms,logg[9],logg[1],lb,ub,blen);
5098 ndist++;
5099 n12dist++;
5101 /*SETDISTANCE for CE3 and HE3 (1-2) */
5102 blen=lookup_bondlength(logg[3],logg[10],ilist,iparams,TRUE,atoms);
5103 lb=(1.0-ring_margin)*blen;
5104 ub=(1.0+ring_margin)*blen;
5105 if (((weight[logg[3]] != 0.0) || (weight[logg[10]] != 0.0)) &&
5106 (!dist_set(d,natoms,logg[3],logg[10]))) {
5107 set_dist(d,natoms,logg[3],logg[10],lb,ub,blen);
5108 ndist++;
5109 n12dist++;
5111 /*SETDISTANCE for CZ3 and HZ3 (1-2) */
5112 blen=lookup_bondlength(logg[4],logg[11],ilist,iparams,TRUE,atoms);
5113 lb=(1.0-ring_margin)*blen;
5114 ub=(1.0+ring_margin)*blen;
5115 if (((weight[logg[4]] != 0.0) || (weight[logg[11]] != 0.0)) &&
5116 (!dist_set(d,natoms,logg[4],logg[11]))) {
5117 set_dist(d,natoms,logg[4],logg[11],lb,ub,blen);
5118 ndist++;
5119 n12dist++;
5121 /*SETDISTANCE for CH2 and HH2 (1-2) */
5122 blen=lookup_bondlength(logg[5],logg[12],ilist,iparams,TRUE,atoms);
5123 lb=(1.0-ring_margin)*blen;
5124 ub=(1.0+ring_margin)*blen;
5125 if (((weight[logg[5]] != 0.0) || (weight[logg[12]] != 0.0)) &&
5126 (!dist_set(d,natoms,logg[5],logg[12]))) {
5127 set_dist(d,natoms,logg[5],logg[12],lb,ub,blen);
5128 ndist++;
5129 n12dist++;
5131 /*SETDISTANCE for CZ2 and HZ2 (1-2) */
5132 blen=lookup_bondlength(logg[6],logg[13],ilist,iparams,TRUE,atoms);
5133 lb=(1.0-ring_margin)*blen;
5134 ub=(1.0+ring_margin)*blen;
5135 if (((weight[logg[6]] != 0.0) || (weight[logg[13]] != 0.0)) &&
5136 (!dist_set(d,natoms,logg[6],logg[13]))) {
5137 set_dist(d,natoms,logg[6],logg[13],lb,ub,blen);
5138 ndist++;
5139 n12dist++;
5141 /*SETDISTANCE for NE1 and HE1 (1-2) */
5142 blen=lookup_bondlength(logg[8],logg[14],ilist,iparams,TRUE,atoms);
5143 lb=(1.0-ring_margin)*blen;
5144 ub=(1.0+ring_margin)*blen;
5145 if (((weight[logg[8]] != 0.0) || (weight[logg[14]] != 0.0)) &&
5146 (!dist_set(d,natoms,logg[8],logg[14]))) {
5147 set_dist(d,natoms,logg[8],logg[14],lb,ub,blen);
5148 ndist++;
5149 n12dist++;
5151 /*SETDISTANCE for CD1 and HD1 (1-2) */
5152 blen=lookup_bondlength(logg[9],logg[15],ilist,iparams,TRUE,atoms);
5153 lb=(1.0-ring_margin)*blen;
5154 ub=(1.0+ring_margin)*blen;
5155 if (((weight[logg[9]] != 0.0) || (weight[logg[15]] != 0.0)) &&
5156 (!dist_set(d,natoms,logg[9],logg[15]))) {
5157 set_dist(d,natoms,logg[9],logg[15],lb,ub,blen);
5158 ndist++;
5159 n12dist++;
5161 /*SETDISTANCE for CB and CD1 (1-3) */
5162 angle=lookup_angle(logg[0],logg[1],logg[9],ilist,iparams,atoms);
5163 blen=angle_length(logg[0],logg[1],logg[9],RAD2DEG*angle,ilist,iparams,
5164 atoms);
5165 lb=(1.0-ring_margin)*blen;
5166 ub=(1.0+ring_margin)*blen;
5167 if (((weight[logg[0]] != 0.0) || (weight[logg[9]] != 0.0)) &&
5168 (!dist_set(d,natoms,logg[0],logg[9]))) {
5169 set_dist(d,natoms,logg[0],logg[9],lb,ub,blen);
5170 ndist++;
5171 n13dist++;
5173 /*SETDISTANCE for CB and CD2 (1-3) */
5174 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
5175 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
5176 atoms);
5177 lb=(1.0-ring_margin)*blen;
5178 ub=(1.0+ring_margin)*blen;
5179 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5180 (!dist_set(d,natoms,logg[0],logg[2]))) {
5181 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
5182 ndist++;
5183 n13dist++;
5185 /*SETDISTANCE for CG and CE3 (1-3) */
5186 angle=lookup_angle(logg[1],logg[2],logg[3],ilist,iparams,atoms);
5187 blen=angle_length(logg[1],logg[2],logg[3],RAD2DEG*angle,ilist,iparams,
5188 atoms);
5189 lb=(1.0-ring_margin)*blen;
5190 ub=(1.0+ring_margin)*blen;
5191 if (((weight[logg[1]] != 0.0) || (weight[logg[3]] != 0.0)) &&
5192 (!dist_set(d,natoms,logg[1],logg[3]))) {
5193 set_dist(d,natoms,logg[1],logg[3],lb,ub,blen);
5194 ndist++;
5195 n13dist++;
5197 /*SETDISTANCE for HE2 and CD2 (1-3) */
5198 angle=lookup_angle(logg[10],logg[3],logg[2],ilist,iparams,atoms);
5199 blen=angle_length(logg[10],logg[3],logg[2],RAD2DEG*angle,ilist,iparams,
5200 atoms);
5201 lb=(1.0-ring_margin)*blen;
5202 ub=(1.0+ring_margin)*blen;
5203 if (((weight[logg[10]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5204 (!dist_set(d,natoms,logg[10],logg[2]))) {
5205 set_dist(d,natoms,logg[10],logg[2],lb,ub,blen);
5206 ndist++;
5207 n13dist++;
5209 /*SETDISTANCE for HE3 and CZ3 (1-3) */
5210 angle=lookup_angle(logg[10],logg[3],logg[4],ilist,iparams,atoms);
5211 blen=angle_length(logg[10],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
5212 atoms);
5213 lb=(1.0-ring_margin)*blen;
5214 ub=(1.0+ring_margin)*blen;
5215 if (((weight[logg[10]] != 0.0) || (weight[logg[4]] != 0.0)) &&
5216 (!dist_set(d,natoms,logg[10],logg[4]))) {
5217 set_dist(d,natoms,logg[10],logg[4],lb,ub,blen);
5218 ndist++;
5219 n13dist++;
5221 /*SETDISTANCE for HZ3 and CE3 (1-3) */
5222 angle=lookup_angle(logg[11],logg[4],logg[3],ilist,iparams,atoms);
5223 blen=angle_length(logg[11],logg[4],logg[3],RAD2DEG*angle,ilist,iparams,
5224 atoms);
5225 lb=(1.0-ring_margin)*blen;
5226 ub=(1.0+ring_margin)*blen;
5227 if (((weight[logg[11]] != 0.0) || (weight[logg[3]] != 0.0)) &&
5228 (!dist_set(d,natoms,logg[11],logg[3]))) {
5229 set_dist(d,natoms,logg[11],logg[3],lb,ub,blen);
5230 ndist++;
5231 n13dist++;
5233 /*SETDISTANCE for HZ3 and CH2 (1-3) */
5234 angle=lookup_angle(logg[11],logg[4],logg[5],ilist,iparams,atoms);
5235 blen=angle_length(logg[11],logg[4],logg[5],RAD2DEG*angle,ilist,iparams,
5236 atoms);
5237 lb=(1.0-ring_margin)*blen;
5238 ub=(1.0+ring_margin)*blen;
5239 if (((weight[logg[11]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5240 (!dist_set(d,natoms,logg[11],logg[5]))) {
5241 set_dist(d,natoms,logg[11],logg[5],lb,ub,blen);
5242 ndist++;
5243 n13dist++;
5245 /*SETDISTANCE for HH2 and CZ3 (1-3) */
5246 angle=lookup_angle(logg[12],logg[5],logg[4],ilist,iparams,atoms);
5247 blen=angle_length(logg[12],logg[5],logg[4],RAD2DEG*angle,ilist,iparams,
5248 atoms);
5249 lb=(1.0-ring_margin)*blen;
5250 ub=(1.0+ring_margin)*blen;
5251 if (((weight[logg[12]] != 0.0) || (weight[logg[4]] != 0.0)) &&
5252 (!dist_set(d,natoms,logg[12],logg[4]))) {
5253 set_dist(d,natoms,logg[12],logg[4],lb,ub,blen);
5254 ndist++;
5255 n13dist++;
5257 /*SETDISTANCE for HH2 and CZ2 (1-3) */
5258 angle=lookup_angle(logg[12],logg[5],logg[6],ilist,iparams,atoms);
5259 blen=angle_length(logg[12],logg[5],logg[6],RAD2DEG*angle,ilist,iparams,
5260 atoms);
5261 lb=(1.0-ring_margin)*blen;
5262 ub=(1.0+ring_margin)*blen;
5263 if (((weight[logg[12]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5264 (!dist_set(d,natoms,logg[12],logg[6]))) {
5265 set_dist(d,natoms,logg[12],logg[6],lb,ub,blen);
5266 ndist++;
5267 n13dist++;
5269 /*SETDISTANCE for HZ2 and CH2 (1-3) */
5270 angle=lookup_angle(logg[13],logg[6],logg[5],ilist,iparams,atoms);
5271 blen=angle_length(logg[13],logg[6],logg[5],RAD2DEG*angle,ilist,iparams,
5272 atoms);
5273 lb=(1.0-ring_margin)*blen;
5274 ub=(1.0+ring_margin)*blen;
5275 if (((weight[logg[13]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5276 (!dist_set(d,natoms,logg[13],logg[5]))) {
5277 set_dist(d,natoms,logg[13],logg[5],lb,ub,blen);
5278 ndist++;
5279 n13dist++;
5281 /*SETDISTANCE for HZ2 and CE2 (1-3) */
5282 angle=lookup_angle(logg[13],logg[6],logg[7],ilist,iparams,atoms);
5283 blen=angle_length(logg[13],logg[6],logg[7],RAD2DEG*angle,ilist,iparams,
5284 atoms);
5285 lb=(1.0-ring_margin)*blen;
5286 ub=(1.0+ring_margin)*blen;
5287 if (((weight[logg[13]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5288 (!dist_set(d,natoms,logg[13],logg[7]))) {
5289 set_dist(d,natoms,logg[13],logg[7],lb,ub,blen);
5290 ndist++;
5291 n13dist++;
5293 /*SETDISTANCE for CZ2 and NE1 (1-3) */
5294 angle=lookup_angle(logg[6],logg[7],logg[8],ilist,iparams,atoms);
5295 blen=angle_length(logg[6],logg[7],logg[8],RAD2DEG*angle,ilist,iparams,
5296 atoms);
5297 lb=(1.0-ring_margin)*blen;
5298 ub=(1.0+ring_margin)*blen;
5299 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
5300 (!dist_set(d,natoms,logg[6],logg[8]))) {
5301 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
5302 ndist++;
5303 n13dist++;
5305 /*SETDISTANCE for HE1 and CE2 (1-3) */
5306 angle=lookup_angle(logg[14],logg[8],logg[7],ilist,iparams,atoms);
5307 blen=angle_length(logg[14],logg[8],logg[7],RAD2DEG*angle,ilist,iparams,
5308 atoms);
5309 lb=(1.0-ring_margin)*blen;
5310 ub=(1.0+ring_margin)*blen;
5311 if (((weight[logg[14]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5312 (!dist_set(d,natoms,logg[14],logg[7]))) {
5313 set_dist(d,natoms,logg[14],logg[7],lb,ub,blen);
5314 ndist++;
5315 n13dist++;
5317 /*SETDISTANCE for HE1 and CD1 (1-3) */
5318 angle=lookup_angle(logg[14],logg[8],logg[9],ilist,iparams,atoms);
5319 blen=angle_length(logg[14],logg[8],logg[9],RAD2DEG*angle,ilist,iparams,
5320 atoms);
5321 lb=(1.0-ring_margin)*blen;
5322 ub=(1.0+ring_margin)*blen;
5323 if (((weight[logg[14]] != 0.0) || (weight[logg[9]] != 0.0)) &&
5324 (!dist_set(d,natoms,logg[14],logg[9]))) {
5325 set_dist(d,natoms,logg[14],logg[9],lb,ub,blen);
5326 ndist++;
5327 n13dist++;
5329 /*SETDISTANCE for HD1 and NE1 (1-3) */
5330 angle=lookup_angle(logg[15],logg[9],logg[8],ilist,iparams,atoms);
5331 blen=angle_length(logg[15],logg[9],logg[8],RAD2DEG*angle,ilist,iparams,
5332 atoms);
5333 lb=(1.0-ring_margin)*blen;
5334 ub=(1.0+ring_margin)*blen;
5335 if (((weight[logg[15]] != 0.0) || (weight[logg[8]] != 0.0)) &&
5336 (!dist_set(d,natoms,logg[15],logg[8]))) {
5337 set_dist(d,natoms,logg[15],logg[8],lb,ub,blen);
5338 ndist++;
5339 n13dist++;
5341 /*SETDISTANCE for HD1 and CG (1-3) */
5342 angle=lookup_angle(logg[15],logg[9],logg[1],ilist,iparams,atoms);
5343 blen=angle_length(logg[15],logg[9],logg[1],RAD2DEG*angle,ilist,iparams,
5344 atoms);
5345 lb=(1.0-ring_margin)*blen;
5346 ub=(1.0+ring_margin)*blen;
5347 if (((weight[logg[15]] != 0.0) || (weight[logg[1]] != 0.0)) &&
5348 (!dist_set(d,natoms,logg[15],logg[1]))) {
5349 set_dist(d,natoms,logg[15],logg[1],lb,ub,blen);
5350 ndist++;
5351 n13dist++;
5353 /*SETDISTANCE for CD1 and CD2 (1-3) */
5354 angle=lookup_angle(logg[9],logg[1],logg[2],ilist,iparams,atoms);
5355 blen=angle_length(logg[9],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
5356 atoms);
5357 lb=(1.0-ring_margin)*blen;
5358 ub=(1.0+ring_margin)*blen;
5359 if (((weight[logg[9]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5360 (!dist_set(d,natoms,logg[9],logg[2]))) {
5361 set_dist(d,natoms,logg[9],logg[2],lb,ub,blen);
5362 ndist++;
5363 n13dist++;
5365 /*SETDISTANCE for CG and CE2 (1-3) */
5366 angle=lookup_angle(logg[1],logg[2],logg[7],ilist,iparams,atoms);
5367 blen=angle_length(logg[1],logg[2],logg[7],RAD2DEG*angle,ilist,iparams,
5368 atoms);
5369 lb=(1.0-ring_margin)*blen;
5370 ub=(1.0+ring_margin)*blen;
5371 if (((weight[logg[1]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5372 (!dist_set(d,natoms,logg[1],logg[7]))) {
5373 set_dist(d,natoms,logg[1],logg[7],lb,ub,blen);
5374 ndist++;
5375 n13dist++;
5377 /*SETDISTANCE for CD2 and NE1 (1-3) */
5378 angle=lookup_angle(logg[2],logg[7],logg[8],ilist,iparams,atoms);
5379 blen=angle_length(logg[2],logg[7],logg[8],RAD2DEG*angle,ilist,iparams,
5380 atoms);
5381 lb=(1.0-ring_margin)*blen;
5382 ub=(1.0+ring_margin)*blen;
5383 if (((weight[logg[2]] != 0.0) || (weight[logg[8]] != 0.0)) &&
5384 (!dist_set(d,natoms,logg[2],logg[8]))) {
5385 set_dist(d,natoms,logg[2],logg[8],lb,ub,blen);
5386 ndist++;
5387 n13dist++;
5389 /*SETDISTANCE for CE2 and CD1 (1-3) */
5390 angle=lookup_angle(logg[7],logg[8],logg[9],ilist,iparams,atoms);
5391 blen=angle_length(logg[7],logg[8],logg[9],RAD2DEG*angle,ilist,iparams,
5392 atoms);
5393 lb=(1.0-ring_margin)*blen;
5394 ub=(1.0+ring_margin)*blen;
5395 if (((weight[logg[7]] != 0.0) || (weight[logg[9]] != 0.0)) &&
5396 (!dist_set(d,natoms,logg[7],logg[9]))) {
5397 set_dist(d,natoms,logg[7],logg[9],lb,ub,blen);
5398 ndist++;
5399 n13dist++;
5401 /*SETDISTANCE for NE1 and CG (1-3) */
5402 angle=lookup_angle(logg[8],logg[9],logg[1],ilist,iparams,atoms);
5403 blen=angle_length(logg[8],logg[9],logg[1],RAD2DEG*angle,ilist,iparams,
5404 atoms);
5405 lb=(1.0-ring_margin)*blen;
5406 ub=(1.0+ring_margin)*blen;
5407 if (((weight[logg[8]] != 0.0) || (weight[logg[1]] != 0.0)) &&
5408 (!dist_set(d,natoms,logg[8],logg[1]))) {
5409 set_dist(d,natoms,logg[8],logg[1],lb,ub,blen);
5410 ndist++;
5411 n13dist++;
5413 /*SETDISTANCE for CE2 and CE3 (1-3) */
5414 angle=lookup_angle(logg[7],logg[2],logg[3],ilist,iparams,atoms);
5415 blen=angle_length(logg[7],logg[2],logg[3],RAD2DEG*angle,ilist,iparams,
5416 atoms);
5417 lb=(1.0-ring_margin)*blen;
5418 ub=(1.0+ring_margin)*blen;
5419 if (((weight[logg[7]] != 0.0) || (weight[logg[3]] != 0.0)) &&
5420 (!dist_set(d,natoms,logg[7],logg[3]))) {
5421 set_dist(d,natoms,logg[7],logg[3],lb,ub,blen);
5422 ndist++;
5423 n13dist++;
5425 /*SETDISTANCE for CD2 and CZ3 (1-3) */
5426 angle=lookup_angle(logg[2],logg[3],logg[4],ilist,iparams,atoms);
5427 blen=angle_length(logg[2],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
5428 atoms);
5429 lb=(1.0-ring_margin)*blen;
5430 ub=(1.0+ring_margin)*blen;
5431 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
5432 (!dist_set(d,natoms,logg[2],logg[4]))) {
5433 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
5434 ndist++;
5435 n13dist++;
5437 /*SETDISTANCE for CE3 and CH2 (1-3) */
5438 angle=lookup_angle(logg[3],logg[4],logg[5],ilist,iparams,atoms);
5439 blen=angle_length(logg[3],logg[4],logg[5],RAD2DEG*angle,ilist,iparams,
5440 atoms);
5441 lb=(1.0-ring_margin)*blen;
5442 ub=(1.0+ring_margin)*blen;
5443 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5444 (!dist_set(d,natoms,logg[3],logg[5]))) {
5445 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
5446 ndist++;
5447 n13dist++;
5449 /*SETDISTANCE for CZ3 and CZ2 (1-3) */
5450 angle=lookup_angle(logg[4],logg[5],logg[6],ilist,iparams,atoms);
5451 blen=angle_length(logg[4],logg[5],logg[6],RAD2DEG*angle,ilist,iparams,
5452 atoms);
5453 lb=(1.0-ring_margin)*blen;
5454 ub=(1.0+ring_margin)*blen;
5455 if (((weight[logg[4]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5456 (!dist_set(d,natoms,logg[4],logg[6]))) {
5457 set_dist(d,natoms,logg[4],logg[6],lb,ub,blen);
5458 ndist++;
5459 n13dist++;
5461 /*SETDISTANCE for CH2 and CE2 (1-3) */
5462 angle=lookup_angle(logg[5],logg[6],logg[7],ilist,iparams,atoms);
5463 blen=angle_length(logg[5],logg[6],logg[7],RAD2DEG*angle,ilist,iparams,
5464 atoms);
5465 lb=(1.0-ring_margin)*blen;
5466 ub=(1.0+ring_margin)*blen;
5467 if (((weight[logg[5]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5468 (!dist_set(d,natoms,logg[5],logg[7]))) {
5469 set_dist(d,natoms,logg[5],logg[7],lb,ub,blen);
5470 ndist++;
5471 n13dist++;
5473 /*SETDISTANCE for CZ2 and CD2 (1-3) */
5474 angle=lookup_angle(logg[6],logg[7],logg[2],ilist,iparams,atoms);
5475 blen=angle_length(logg[6],logg[7],logg[2],RAD2DEG*angle,ilist,iparams,
5476 atoms);
5477 lb=(1.0-ring_margin)*blen;
5478 ub=(1.0+ring_margin)*blen;
5479 if (((weight[logg[6]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5480 (!dist_set(d,natoms,logg[6],logg[2]))) {
5481 set_dist(d,natoms,logg[6],logg[2],lb,ub,blen);
5482 ndist++;
5483 n13dist++;
5485 /*if (1>5) {*/
5486 /*SETDISTANCE for CB and CE3 (logg[0]&logg[3]) (cisdihedral)*/
5487 pdih_lengths(logg[0],logg[1],logg[2],logg[3],ilist,iparams,&blen,&ub,
5488 atoms);
5489 lb=(1.0-ring_margin)*blen;
5490 ub=(1.0+ring_margin)*blen;
5491 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
5492 (!dist_set(d,natoms,logg[0],logg[3]))) {
5493 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
5494 ndist++;
5495 n14dist++;
5497 /*SETDISTANCE for CB and HD1 (logg[0]&logg[15]) (cisdihedral)*/
5498 pdih_lengths(logg[0],logg[1],logg[9],logg[15],ilist,iparams,&blen,&ub,
5499 atoms);
5500 lb=(1.0-ring_margin)*blen;
5501 ub=(1.0+ring_margin)*blen;
5502 if (((weight[logg[0]] != 0.0) || (weight[logg[15]] != 0.0)) &&
5503 (!dist_set(d,natoms,logg[0],logg[15]))) {
5504 set_dist(d,natoms,logg[0],logg[15],lb,ub,blen);
5505 ndist++;
5506 n14dist++;
5508 /*SETDISTANCE for CG and HE3 (logg[1]&logg[10]) (cisdihedral)*/
5509 pdih_lengths(logg[1],logg[2],logg[3],logg[10],ilist,iparams,&blen,&ub,
5510 atoms);
5511 lb=(1.0-ring_margin)*blen;
5512 ub=(1.0+ring_margin)*blen;
5513 if (((weight[logg[1]] != 0.0) || (weight[logg[10]] != 0.0)) &&
5514 (!dist_set(d,natoms,logg[1],logg[10]))) {
5515 set_dist(d,natoms,logg[1],logg[10],lb,ub,blen);
5516 ndist++;
5517 n14dist++;
5519 /*SETDISTANCE for HE3 and HZ3 (logg[10]&logg[11]) (cisdihedral)*/
5520 pdih_lengths(logg[10],logg[3],logg[4],logg[11],ilist,iparams,&blen,&ub,
5521 atoms);
5522 lb=(1.0-ring_margin)*blen;
5523 ub=(1.0+ring_margin)*blen;
5524 if (((weight[logg[10]] != 0.0) || (weight[logg[11]] != 0.0)) &&
5525 (!dist_set(d,natoms,logg[10],logg[11]))) {
5526 set_dist(d,natoms,logg[10],logg[11],lb,ub,blen);
5527 ndist++;
5528 n14dist++;
5530 /*SETDISTANCE for HZ3 and HH2 (logg[11]&logg[12]) (cisdihedral)*/
5531 pdih_lengths(logg[11],logg[4],logg[5],logg[12],ilist,iparams,&blen,&ub,
5532 atoms);
5533 lb=(1.0-ring_margin)*blen;
5534 ub=(1.0+ring_margin)*blen;
5535 if (((weight[logg[11]] != 0.0) || (weight[logg[12]] != 0.0)) &&
5536 (!dist_set(d,natoms,logg[11],logg[12]))) {
5537 set_dist(d,natoms,logg[11],logg[12],lb,ub,blen);
5538 ndist++;
5539 n14dist++;
5541 /*SETDISTANCE for HH2 and HZ2 (logg[12]&logg[13]) (cisdihedral)*/
5542 pdih_lengths(logg[12],logg[5],logg[6],logg[13],ilist,iparams,&blen,&ub,
5543 atoms);
5544 lb=(1.0-ring_margin)*blen;
5545 ub=(1.0+ring_margin)*blen;
5546 if (((weight[logg[12]] != 0.0) || (weight[logg[13]] != 0.0)) &&
5547 (!dist_set(d,natoms,logg[12],logg[13]))) {
5548 set_dist(d,natoms,logg[12],logg[13],lb,ub,blen);
5549 ndist++;
5550 n14dist++;
5552 /*SETDISTANCE for HZ2 and NE1 (logg[13]&logg[8]) (cisdihedral)*/
5553 pdih_lengths(logg[13],logg[6],logg[7],logg[8],ilist,iparams,&blen,&ub,
5554 atoms);
5555 lb=(1.0-ring_margin)*blen;
5556 ub=(1.0+ring_margin)*blen;
5557 if (((weight[logg[13]] != 0.0) || (weight[logg[8]] != 0.0)) &&
5558 (!dist_set(d,natoms,logg[13],logg[8]))) {
5559 set_dist(d,natoms,logg[13],logg[8],lb,ub,blen);
5560 ndist++;
5561 n14dist++;
5563 /*SETDISTANCE for CZ2 and HE1 (logg[6]&logg[14]) (cisdihedral)*/
5564 pdih_lengths(logg[6],logg[7],logg[8],logg[14],ilist,iparams,&blen,&ub,
5565 atoms);
5566 lb=(1.0-ring_margin)*blen;
5567 ub=(1.0+ring_margin)*blen;
5568 if (((weight[logg[6]] != 0.0) || (weight[logg[14]] != 0.0)) &&
5569 (!dist_set(d,natoms,logg[6],logg[14]))) {
5570 set_dist(d,natoms,logg[6],logg[14],lb,ub,blen);
5571 ndist++;
5572 n14dist++;
5574 /*SETDISTANCE for HE1 and HD1 (logg[14]&logg[15]) (cisdihedral)*/
5575 pdih_lengths(logg[14],logg[8],logg[9],logg[15],ilist,iparams,&blen,&ub,
5576 atoms);
5577 lb=(1.0-ring_margin)*blen;
5578 ub=(1.0+ring_margin)*blen;
5579 if (((weight[logg[14]] != 0.0) || (weight[logg[15]] != 0.0)) &&
5580 (!dist_set(d,natoms,logg[14],logg[15]))) {
5581 set_dist(d,natoms,logg[14],logg[15],lb,ub,blen);
5582 ndist++;
5583 n14dist++;
5585 /*SETDISTANCE for CD2 and CH2 (logg[2]&logg[5]) (cisdihedral)*/
5586 pdih_lengths(logg[2],logg[3],logg[4],logg[5],ilist,iparams,&blen,&ub,
5587 atoms);
5588 lb=(1.0-ring_margin)*blen;
5589 ub=(1.0+ring_margin)*blen;
5590 if (((weight[logg[2]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5591 (!dist_set(d,natoms,logg[2],logg[5]))) {
5592 set_dist(d,natoms,logg[2],logg[5],lb,ub,blen);
5593 ndist++;
5594 n14dist++;
5596 /*SETDISTANCE for CE3 and CZ2 (logg[0]&logg[11]) (cisdihedral)*/
5597 pdih_lengths(logg[3],logg[4],logg[5],logg[6],ilist,iparams,&blen,&ub,
5598 atoms);
5599 lb=(1.0-ring_margin)*blen;
5600 ub=(1.0+ring_margin)*blen;
5601 if (((weight[logg[3]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5602 (!dist_set(d,natoms,logg[3],logg[6]))) {
5603 set_dist(d,natoms,logg[3],logg[6],lb,ub,blen);
5604 ndist++;
5605 n14dist++;
5607 /*SETDISTANCE for CZ3 and CE2 (logg[4]&logg[7]) (cisdihedral)*/
5608 pdih_lengths(logg[4],logg[5],logg[6],logg[7],ilist,iparams,&blen,&ub,
5609 atoms);
5610 lb=(1.0-ring_margin)*blen;
5611 ub=(1.0+ring_margin)*blen;
5612 if (((weight[logg[4]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5613 (!dist_set(d,natoms,logg[4],logg[7]))) {
5614 set_dist(d,natoms,logg[4],logg[7],lb,ub,blen);
5615 ndist++;
5616 n14dist++;
5618 /* trans 1-4's added 981124 */
5620 /*SETDISTANCE for CB and CE2 (logg[0]&logg[7]) (transdihedral)*/
5621 pdih_lengths(logg[0],logg[1],logg[2],logg[7],ilist,iparams,&lb,&blen,
5622 atoms);
5623 lb=(1.0-ring_margin)*blen;
5624 ub=(1.0+ring_margin)*blen;
5625 if (((weight[logg[0]] != 0.0) || (weight[logg[7]] != 0.0)) &&
5626 (!dist_set(d,natoms,logg[0],logg[7]))) {
5627 set_dist(d,natoms,logg[0],logg[7],lb,ub,blen);
5628 ndist++;
5629 n14dist++;
5631 /*SETDISTANCE for CB and NE1 (logg[0]&logg[8]) (transdihedral)*/
5632 pdih_lengths(logg[0],logg[1],logg[9],logg[8],ilist,iparams,&lb,&blen,
5633 atoms);
5634 lb=(1.0-ring_margin)*blen;
5635 ub=(1.0+ring_margin)*blen;
5636 if (((weight[logg[0]] != 0.0) || (weight[logg[8]] != 0.0)) &&
5637 (!dist_set(d,natoms,logg[0],logg[8]))) {
5638 set_dist(d,natoms,logg[0],logg[8],lb,ub,blen);
5639 ndist++;
5640 n14dist++;
5642 /*SETDISTANCE for CG and HE1 (logg[1]&logg[14]) (transdihedral)*/
5643 pdih_lengths(logg[1],logg[9],logg[8],logg[14],ilist,iparams,&lb,&blen,
5644 atoms);
5645 lb=(1.0-ring_margin)*blen;
5646 ub=(1.0+ring_margin)*blen;
5647 if (((weight[logg[1]] != 0.0) || (weight[logg[14]] != 0.0)) &&
5648 (!dist_set(d,natoms,logg[1],logg[14]))) {
5649 set_dist(d,natoms,logg[1],logg[14],lb,ub,blen);
5650 ndist++;
5651 n14dist++;
5653 /*SETDISTANCE for CD2 and HZ2 (logg[2]&logg[13]) (transdihedral)*/
5654 pdih_lengths(logg[2],logg[7],logg[6],logg[13],ilist,iparams,&lb,&blen,
5655 atoms);
5656 lb=(1.0-ring_margin)*blen;
5657 ub=(1.0+ring_margin)*blen;
5658 if (((weight[logg[2]] != 0.0) || (weight[logg[13]] != 0.0)) &&
5659 (!dist_set(d,natoms,logg[2],logg[13]))) {
5660 set_dist(d,natoms,logg[2],logg[13],lb,ub,blen);
5661 ndist++;
5662 n14dist++;
5664 /*SETDISTANCE for CD2 and HE1 (logg[2]&logg[14]) (transdihedral)*/
5665 pdih_lengths(logg[2],logg[7],logg[8],logg[14],ilist,iparams,&lb,&blen,
5666 atoms);
5667 lb=(1.0-ring_margin)*blen;
5668 ub=(1.0+ring_margin)*blen;
5669 if (((weight[logg[2]] != 0.0) || (weight[logg[14]] != 0.0)) &&
5670 (!dist_set(d,natoms,logg[2],logg[14]))) {
5671 set_dist(d,natoms,logg[2],logg[14],lb,ub,blen);
5672 ndist++;
5673 n14dist++;
5675 /*SETDISTANCE for CE3 and CD1 (logg[3]&logg[9]) (transdihedral)*/
5676 pdih_lengths(logg[3],logg[2],logg[1],logg[9],ilist,iparams,&lb,&blen,
5677 atoms);
5678 lb=(1.0-ring_margin)*blen;
5679 ub=(1.0+ring_margin)*blen;
5680 if (((weight[logg[3]] != 0.0) || (weight[logg[9]] != 0.0)) &&
5681 (!dist_set(d,natoms,logg[3],logg[9]))) {
5682 set_dist(d,natoms,logg[3],logg[9],lb,ub,blen);
5683 ndist++;
5684 n14dist++;
5686 /*SETDISTANCE for CH2 and HE3 (logg[5]&logg[10]) (transdihedral)*/
5687 pdih_lengths(logg[5],logg[4],logg[3],logg[10],ilist,iparams,&lb,&blen,
5688 atoms);
5689 lb=(1.0-ring_margin)*blen;
5690 ub=(1.0+ring_margin)*blen;
5691 if (((weight[logg[5]] != 0.0) || (weight[logg[10]] != 0.0)) &&
5692 (!dist_set(d,natoms,logg[5],logg[10]))) {
5693 set_dist(d,natoms,logg[5],logg[10],lb,ub,blen);
5694 ndist++;
5695 n14dist++;
5697 /*SETDISTANCE for CZ2 and HZ3 (logg[6]&logg[11]) (transdihedral)*/
5698 pdih_lengths(logg[6],logg[5],logg[4],logg[11],ilist,iparams,&lb,&blen,
5699 atoms);
5700 lb=(1.0-ring_margin)*blen;
5701 ub=(1.0+ring_margin)*blen;
5702 if (((weight[logg[6]] != 0.0) || (weight[logg[11]] != 0.0)) &&
5703 (!dist_set(d,natoms,logg[6],logg[11]))) {
5704 set_dist(d,natoms,logg[6],logg[11],lb,ub,blen);
5705 ndist++;
5706 n14dist++;
5708 /*SETDISTANCE for CE2 and HE3 (logg[7]&logg[10]) (transdihedral)*/
5709 pdih_lengths(logg[7],logg[2],logg[3],logg[10],ilist,iparams,&lb,&blen,
5710 atoms);
5711 lb=(1.0-ring_margin)*blen;
5712 ub=(1.0+ring_margin)*blen;
5713 if (((weight[logg[7]] != 0.0) || (weight[logg[10]] != 0.0)) &&
5714 (!dist_set(d,natoms,logg[7],logg[10]))) {
5715 set_dist(d,natoms,logg[7],logg[10],lb,ub,blen);
5716 ndist++;
5717 n14dist++;
5719 /*SETDISTANCE for CE2 and HH2 (logg[7]&logg[12]) (transdihedral)*/
5720 pdih_lengths(logg[7],logg[6],logg[5],logg[12],ilist,iparams,&lb,&blen,
5721 atoms);
5722 lb=(1.0-ring_margin)*blen;
5723 ub=(1.0+ring_margin)*blen;
5724 if (((weight[logg[7]] != 0.0) || (weight[logg[12]] != 0.0)) &&
5725 (!dist_set(d,natoms,logg[7],logg[12]))) {
5726 set_dist(d,natoms,logg[7],logg[12],lb,ub,blen);
5727 ndist++;
5728 n14dist++;
5730 /* end of 1-4's added 981124 */
5734 /*SETDISTANCE for CG and CZ3 (logg[1]&logg[4]) (transdihedral)*/
5735 pdih_lengths(logg[1],logg[2],logg[3],logg[4],ilist,iparams,&lb,&blen,
5736 atoms);
5737 lb=(1.0-ring_margin)*blen;
5738 ub=(1.0+ring_margin)*blen;
5739 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
5740 (!dist_set(d,natoms,logg[1],logg[4]))) {
5741 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
5742 ndist++;
5743 n14dist++;
5745 /*SETDISTANCE for CD1 and CZ2 (logg[9]&logg[6]) (transdihedral)*/
5746 pdih_lengths(logg[9],logg[8],logg[7],logg[6],ilist,iparams,&lb,&blen,
5747 atoms);
5748 lb=(1.0-ring_margin)*blen;
5749 ub=(1.0+ring_margin)*blen;
5750 if (((weight[logg[9]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5751 (!dist_set(d,natoms,logg[9],logg[6]))) {
5752 set_dist(d,natoms,logg[9],logg[6],lb,ub,blen);
5753 ndist++;
5754 n14dist++;
5756 /*SETDISTANCE for NE1 and CH2 (logg[8]&logg[5]) (transdihedral)*/
5757 pdih_lengths(logg[8],logg[7],logg[6],logg[5],ilist,iparams,&lb,&blen,
5758 atoms);
5759 lb=(1.0-ring_margin)*blen;
5760 ub=(1.0+ring_margin)*blen;
5761 if (((weight[logg[8]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5762 (!dist_set(d,natoms,logg[8],logg[5]))) {
5763 set_dist(d,natoms,logg[8],logg[5],lb,ub,blen);
5764 ndist++;
5765 n14dist++;
5767 /*SETDISTANCE for NE1 and CE3 (logg[8]&logg[3]) (transdihedral)*/
5768 pdih_lengths(logg[8],logg[7],logg[2],logg[3],ilist,iparams,&lb,&blen,
5769 atoms);
5770 lb=(1.0-ring_margin)*blen;
5771 ub=(1.0+ring_margin)*blen;
5772 if (((weight[logg[8]] != 0.0) || (weight[logg[3]] != 0.0)) &&
5773 (!dist_set(d,natoms,logg[8],logg[3]))) {
5774 set_dist(d,natoms,logg[8],logg[3],lb,ub,blen);
5775 ndist++;
5776 n14dist++;
5778 /*SETDISTANCE for CD2 and HZ3 (logg[2]&logg[11]) (transdihedral)*/
5779 pdih_lengths(logg[2],logg[3],logg[4],logg[11],ilist,iparams,&lb,&blen,
5780 atoms);
5781 lb=(1.0-ring_margin)*blen;
5782 ub=(1.0+ring_margin)*blen;
5783 if (((weight[logg[2]] != 0.0) || (weight[logg[11]] != 0.0)) &&
5784 (!dist_set(d,natoms,logg[2],logg[11]))) {
5785 set_dist(d,natoms,logg[2],logg[11],lb,ub,blen);
5786 ndist++;
5787 n14dist++;
5789 /*SETDISTANCE for CE3 and HH2 (logg[3]&logg[12]) (transdihedral)*/
5790 pdih_lengths(logg[3],logg[4],logg[5],logg[12],ilist,iparams,&lb,&blen,
5791 atoms);
5792 lb=(1.0-ring_margin)*blen;
5793 ub=(1.0+ring_margin)*blen;
5794 if (((weight[logg[3]] != 0.0) || (weight[logg[12]] != 0.0)) &&
5795 (!dist_set(d,natoms,logg[3],logg[12]))) {
5796 set_dist(d,natoms,logg[3],logg[12],lb,ub,blen);
5797 ndist++;
5798 n14dist++;
5800 /*SETDISTANCE for CZ3 and HZ2 (logg[4]&logg[13]) (transdihedral)*/
5801 pdih_lengths(logg[4],logg[5],logg[6],logg[13],ilist,iparams,&lb,&blen,
5802 atoms);
5803 lb=(1.0-ring_margin)*blen;
5804 ub=(1.0+ring_margin)*blen;
5805 if (((weight[logg[4]] != 0.0) || (weight[logg[13]] != 0.0)) &&
5806 (!dist_set(d,natoms,logg[4],logg[13]))) {
5807 set_dist(d,natoms,logg[4],logg[13],lb,ub,blen);
5808 ndist++;
5809 n14dist++;
5811 /*SETDISTANCE for CG and CZ2 (logg[1]&logg[6]) (transdihedral)*/
5812 pdih_lengths(logg[1],logg[2],logg[7],logg[6],ilist,iparams,&lb,&blen,
5813 atoms);
5814 lb=(1.0-ring_margin)*blen;
5815 ub=(1.0+ring_margin)*blen;
5816 if (((weight[logg[1]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5817 (!dist_set(d,natoms,logg[1],logg[6]))) {
5818 set_dist(d,natoms,logg[1],logg[6],lb,ub,blen);
5819 ndist++;
5820 n14dist++;
5822 /*SETDISTANCE for CE2 and HD1 (logg[7]&logg[15]) (transdihedral)*/
5823 pdih_lengths(logg[7],logg[8],logg[9],logg[15],ilist,iparams,&lb,&blen,
5824 atoms);
5825 lb=(1.0-ring_margin)*blen;
5826 ub=(1.0+ring_margin)*blen;
5827 if (((weight[logg[7]] != 0.0) || (weight[logg[15]] != 0.0)) &&
5828 (!dist_set(d,natoms,logg[7],logg[15]))) {
5829 set_dist(d,natoms,logg[7],logg[15],lb,ub,blen);
5830 ndist++;
5831 n14dist++;
5833 /*SETDISTANCE for CD2 and HD1 (logg[2]&logg[15]) (transdihedral)*/
5834 pdih_lengths(logg[2],logg[1],logg[9],logg[15],ilist,iparams,&lb,&blen,
5835 atoms);
5836 lb=(1.0-ring_margin)*blen;
5837 ub=(1.0+ring_margin)*blen;
5838 if (((weight[logg[2]] != 0.0) || (weight[logg[15]] != 0.0)) &&
5839 (!dist_set(d,natoms,logg[2],logg[15]))) {
5840 set_dist(d,natoms,logg[2],logg[15],lb,ub,blen);
5841 ndist++;
5842 n14dist++;
5844 /* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO*/
5846 /* new 1-5 distances added 981124 */
5848 /*SETDISTANCE for CZ3 and NE1 (1-5) */
5849 trp_15_type1(logg[8],logg[7],logg[2],logg[3],logg[4],ilist,
5850 iparams,&blen,atoms);
5851 lb=(1.0-(ring_margin*0.5))*blen;
5852 ub=(1.0+(ring_margin*0.5))*blen;
5853 if (((weight[logg[8]] != 0.0) || (weight[logg[4]] != 0.0)) &&
5854 (!dist_set(d,natoms,logg[8],logg[4]))) {
5855 set_dist(d,natoms,logg[8],logg[4],lb,ub,blen);
5856 ndist++;
5857 n15dist++;
5859 /*SETDISTANCE for CD1 and HE3 (1-5) */
5860 trp_15_type1(logg[9],logg[1],logg[2],logg[3],logg[10],ilist,
5861 iparams,&blen,atoms);
5862 lb=(1.0-(ring_margin*0.5))*blen;
5863 ub=(1.0+(ring_margin*0.5))*blen;
5864 if (((weight[logg[9]] != 0.0) || (weight[logg[10]] != 0.0)) &&
5865 (!dist_set(d,natoms,logg[9],logg[10]))) {
5866 set_dist(d,natoms,logg[9],logg[10],lb,ub,blen);
5867 ndist++;
5868 n15dist++;
5870 /*SETDISTANCE for CD1 and HZ2 (1-5) */
5871 trp_15_type1(logg[9],logg[8],logg[7],logg[6],logg[13],ilist,
5872 iparams,&blen,atoms);
5873 lb=(1.0-(ring_margin*0.5))*blen;
5874 ub=(1.0+(ring_margin*0.5))*blen;
5875 if (((weight[logg[9]] != 0.0) || (weight[logg[13]] != 0.0)) &&
5876 (!dist_set(d,natoms,logg[9],logg[13]))) {
5877 set_dist(d,natoms,logg[9],logg[13],lb,ub,blen);
5878 ndist++;
5879 n15dist++;
5882 /*SETDISTANCE for CG and HZ3 (1-5) */
5883 trp_15_type2(logg[1],logg[2],logg[3],logg[4],logg[11],ilist,
5884 iparams,&blen,atoms);
5885 lb=(1.0-(ring_margin*0.5))*blen;
5886 ub=(1.0+(ring_margin*0.5))*blen;
5887 if (((weight[logg[1]] != 0.0) || (weight[logg[11]] != 0.0)) &&
5888 (!dist_set(d,natoms,logg[1],logg[11]))) {
5889 set_dist(d,natoms,logg[1],logg[11],lb,ub,blen);
5890 ndist++;
5891 n15dist++;
5893 /*SETDISTANCE for CH2 and CD1 (1-5) */
5894 trp_15_type2(logg[5],logg[6],logg[7],logg[8],logg[9],ilist,
5895 iparams,&blen,atoms);
5896 lb=(1.0-(ring_margin*0.5))*blen;
5897 ub=(1.0+(ring_margin*0.5))*blen;
5898 if (((weight[logg[5]] != 0.0) || (weight[logg[9]] != 0.0)) &&
5899 (!dist_set(d,natoms,logg[5],logg[9]))) {
5900 set_dist(d,natoms,logg[5],logg[9],lb,ub,blen);
5901 ndist++;
5902 n15dist++;
5904 /*SETDISTANCE for NE1 and HE3 (1-5) */
5905 trp_15_type2(logg[8],logg[7],logg[2],logg[3],logg[10],ilist,
5906 iparams,&blen,atoms);
5907 lb=(1.0-(ring_margin*0.5))*blen;
5908 ub=(1.0+(ring_margin*0.5))*blen;
5909 if (((weight[logg[8]] != 0.0) || (weight[logg[10]] != 0.0)) &&
5910 (!dist_set(d,natoms,logg[8],logg[10]))) {
5911 set_dist(d,natoms,logg[8],logg[10],lb,ub,blen);
5912 ndist++;
5913 n15dist++;
5915 /*SETDISTANCE for NE1 and HH2 (1-5) */
5916 trp_15_type2(logg[8],logg[7],logg[6],logg[5],logg[12],ilist,
5917 iparams,&blen,atoms);
5918 lb=(1.0-(ring_margin*0.5))*blen;
5919 ub=(1.0+(ring_margin*0.5))*blen;
5920 if (((weight[logg[8]] != 0.0) || (weight[logg[12]] != 0.0)) &&
5921 (!dist_set(d,natoms,logg[8],logg[12]))) {
5922 set_dist(d,natoms,logg[8],logg[12],lb,ub,blen);
5923 ndist++;
5924 n15dist++;
5926 /*SETDISTANCE for HE3 and HH2 (1-5) */
5927 trp_15_type2(logg[10],logg[3],logg[4],logg[5],logg[12],ilist,
5928 iparams,&blen,atoms);
5929 lb=(1.0-(ring_margin*0.5))*blen;
5930 ub=(1.0+(ring_margin*0.5))*blen;
5931 if (((weight[logg[10]] != 0.0) || (weight[logg[12]] != 0.0)) &&
5932 (!dist_set(d,natoms,logg[10],logg[12]))) {
5933 set_dist(d,natoms,logg[10],logg[12],lb,ub,blen);
5934 ndist++;
5935 n15dist++;
5937 /*SETDISTANCE for HZ3 and HZ2 (1-5) */
5938 trp_15_type2(logg[11],logg[4],logg[5],logg[6],logg[13],ilist,
5939 iparams,&blen,atoms);
5940 lb=(1.0-(ring_margin*0.5))*blen;
5941 ub=(1.0+(ring_margin*0.5))*blen;
5942 if (((weight[logg[11]] != 0.0) || (weight[logg[13]] != 0.0)) &&
5943 (!dist_set(d,natoms,logg[11],logg[13]))) {
5944 set_dist(d,natoms,logg[11],logg[13],lb,ub,blen);
5945 ndist++;
5946 n15dist++;
5948 /*end of 1-5 distances added */
5951 /*SETDISTANCE for CB and CZ3 (1-5) */
5952 trp_15_type1(logg[4],logg[3],logg[2],logg[1],logg[0],ilist,
5953 iparams,&blen,atoms);
5954 lb=(1.0-(ring_margin*0.5))*blen;
5955 ub=(1.0+(ring_margin*0.5))*blen;
5956 if (((weight[logg[4]] != 0.0) || (weight[logg[0]] != 0.0)) &&
5957 (!dist_set(d,natoms,logg[4],logg[0]))) {
5958 set_dist(d,natoms,logg[4],logg[0],lb,ub,blen);
5959 ndist++;
5960 n15dist++;
5962 /*SETDISTANCE for CG and CH2 (1-5) */
5963 trp_15_type1(logg[1],logg[2],logg[7],logg[6],logg[5],ilist,
5964 iparams,&blen,atoms);
5965 lb=(1.0-(ring_margin*0.5))*blen;
5966 ub=(1.0+(ring_margin*0.5))*blen;
5967 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
5968 (!dist_set(d,natoms,logg[1],logg[5]))) {
5969 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
5970 ndist++;
5971 n15dist++;
5973 /*SETDISTANCE for CD and HH2 (1-5) */
5974 trp_15_type1(logg[12],logg[5],logg[6],logg[7],logg[2],ilist,
5975 iparams,&blen,atoms);
5976 lb=(1.0-(ring_margin*0.5))*blen;
5977 ub=(1.0+(ring_margin*0.5))*blen;
5978 if (((weight[logg[12]] != 0.0) || (weight[logg[2]] != 0.0)) &&
5979 (!dist_set(d,natoms,logg[12],logg[2]))) {
5980 set_dist(d,natoms,logg[12],logg[2],lb,ub,blen);
5981 ndist++;
5982 n15dist++;
5984 /*SETDISTANCE for HE3 and CZ2 (1-5) */
5985 trp_15_type1(logg[10],logg[3],logg[2],logg[7],logg[6],ilist,
5986 iparams,&blen,atoms);
5987 lb=(1.0-(ring_margin*0.5))*blen;
5988 ub=(1.0+(ring_margin*0.5))*blen;
5989 if (((weight[logg[10]] != 0.0) || (weight[logg[6]] != 0.0)) &&
5990 (!dist_set(d,natoms,logg[10],logg[6]))) {
5991 set_dist(d,natoms,logg[10],logg[6],lb,ub,blen);
5992 ndist++;
5993 n15dist++;
5995 /*SETDISTANCE for HZ2 and CE3 (1-5) */
5996 trp_15_type1(logg[13],logg[6],logg[7],logg[2],logg[3],ilist,
5997 iparams,&blen,atoms);
5998 lb=(1.0-(ring_margin*0.5))*blen;
5999 ub=(1.0+(ring_margin*0.5))*blen;
6000 if (((weight[logg[13]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6001 (!dist_set(d,natoms,logg[13],logg[3]))) {
6002 set_dist(d,natoms,logg[13],logg[3],lb,ub,blen);
6003 ndist++;
6004 n15dist++;
6006 /*SETDISTANCE for HZ3 and CE2 (1-5) */
6007 trp_15_type1(logg[11],logg[4],logg[3],logg[2],logg[7],ilist,
6008 iparams,&blen,atoms);
6009 lb=(1.0-(ring_margin*0.5))*blen;
6010 ub=(1.0+(ring_margin*0.5))*blen;
6011 if (((weight[logg[11]] != 0.0) || (weight[logg[7]] != 0.0)) &&
6012 (!dist_set(d,natoms,logg[11],logg[7]))) {
6013 set_dist(d,natoms,logg[11],logg[7],lb,ub,blen);
6014 ndist++;
6015 n15dist++;
6017 /*SETDISTANCE for HE1 and CB (1-5) */
6018 trp_15_type2(logg[14],logg[8],logg[9],logg[1],logg[0],ilist,
6019 iparams,&blen,atoms);
6020 lb=(1.0-(ring_margin*0.5))*blen;
6021 ub=(1.0+(ring_margin*0.5))*blen;
6022 if (((weight[logg[14]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6023 (!dist_set(d,natoms,logg[14],logg[0]))) {
6024 set_dist(d,natoms,logg[14],logg[0],lb,ub,blen);
6025 ndist++;
6026 n15dist++;
6028 /*SETDISTANCE for CB and CZ2 (1-5) */
6029 trp_15_type2(logg[0],logg[1],logg[2],logg[7],logg[6],ilist,
6030 iparams,&blen,atoms);
6031 lb=(1.0-(ring_margin*0.5))*blen;
6032 ub=(1.0+(ring_margin*0.5))*blen;
6033 if (((weight[logg[0]] != 0.0) || (weight[logg[6]] != 0.0)) &&
6034 (!dist_set(d,natoms,logg[0],logg[6]))) {
6035 set_dist(d,natoms,logg[0],logg[6],lb,ub,blen);
6036 ndist++;
6037 n15dist++;
6039 /*SETDISTANCE for CZ3 and CD1 (1-5) */
6040 trp_15_type2(logg[9],logg[1],logg[2],logg[3],logg[4],ilist,
6041 iparams,&blen,atoms);
6042 lb=(1.0-(ring_margin*0.5))*blen;
6043 ub=(1.0+(ring_margin*0.5))*blen;
6044 if (((weight[logg[9]] != 0.0) || (weight[logg[4]] != 0.0)) &&
6045 (!dist_set(d,natoms,logg[9],logg[4]))) {
6046 set_dist(d,natoms,logg[9],logg[4],lb,ub,blen);
6047 ndist++;
6048 n15dist++;
6050 /*SETDISTANCE for CB and HE3 (1-5) */
6051 trp_15_type3(logg[0],logg[1],logg[2],logg[3],logg[10],ilist,
6052 iparams,&blen,atoms);
6053 lb=(1.0-(ring_margin*0.5))*blen;
6054 ub=(1.0+(ring_margin*0.5))*blen;
6055 if (((weight[logg[0]] != 0.0) || (weight[logg[10]] != 0.0)) &&
6056 (!dist_set(d,natoms,logg[0],logg[10]))) {
6057 set_dist(d,natoms,logg[0],logg[10],lb,ub,blen);
6058 ndist++;
6059 n15dist++;
6065 /*SETDISTANCE for HD1 and CE3 (1-5) */
6066 trp_15_type2(logg[15],logg[9],logg[1],logg[2],logg[3],ilist,
6067 iparams,&blen,atoms);
6068 lb=(1.0-(ring_margin*0.5))*blen;
6069 ub=(1.0+(ring_margin*0.5))*blen;
6070 if (((weight[logg[15]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6071 (!dist_set(d,natoms,logg[15],logg[3]))) {
6072 set_dist(d,natoms,logg[15],logg[3],lb,ub,blen);
6073 ndist++;
6074 n15dist++;
6077 /*SETDISTANCE for HD1 and CZ2 (1-5) */
6078 trp_15_type2(logg[15],logg[9],logg[8],logg[7],logg[6],ilist,
6079 iparams,&blen,atoms);
6080 lb=(1.0-(ring_margin*0.5))*blen;
6081 ub=(1.0+(ring_margin*0.5))*blen;
6082 if (((weight[logg[15]] != 0.0) || (weight[logg[6]] != 0.0)) &&
6083 (!dist_set(d,natoms,logg[15],logg[6]))) {
6084 set_dist(d,natoms,logg[15],logg[6],lb,ub,blen);
6085 ndist++;
6086 n15dist++;
6088 /*SETDISTANCE for HE1 and HZ2 (1-5) */
6089 trp_15_type3(logg[14],logg[8],logg[7],logg[6],logg[13],ilist,
6090 iparams,&blen,atoms);
6091 lb=(1.0-(ring_margin*0.5))*blen;
6092 ub=(1.0+(ring_margin*0.5))*blen;
6093 if (((weight[logg[14]] != 0.0) || (weight[logg[13]] != 0.0)) &&
6094 (!dist_set(d,natoms,logg[14],logg[13]))) {
6095 set_dist(d,natoms,logg[14],logg[13],lb,ub,blen);
6096 ndist++;
6097 n15dist++;
6099 /*SETDISTANCE for HE1 and CH2 (1-5) */
6100 trp_15_type1(logg[5],logg[6],logg[7],logg[8],logg[14],ilist,
6101 iparams,&blen,atoms);
6102 lb=(1.0-(ring_margin*0.5))*blen;
6103 ub=(1.0+(ring_margin*0.5))*blen;
6104 if (((weight[logg[5]] != 0.0) || (weight[logg[14]] != 0.0)) &&
6105 (!dist_set(d,natoms,logg[5],logg[14]))) {
6106 set_dist(d,natoms,logg[5],logg[14],lb,ub,blen);
6107 ndist++;
6108 n15dist++;
6110 /*SETDISTANCE for HE1 and CE3 (1-5) */
6111 trp_15_type2(logg[14],logg[8],logg[7],logg[2],logg[3],ilist,
6112 iparams,&blen,atoms);
6113 lb=(1.0-(ring_margin*0.5))*blen;
6114 ub=(1.0+(ring_margin*0.5))*blen;
6115 if (((weight[logg[14]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6116 (!dist_set(d,natoms,logg[14],logg[3]))) {
6117 set_dist(d,natoms,logg[14],logg[3],lb,ub,blen);
6118 ndist++;
6119 n15dist++;
6121 /*SETDISTANCE for HZ2 and CG (1-5) */
6122 trp_15_type2(logg[13],logg[6],logg[7],logg[2],logg[1],ilist,
6123 iparams,&blen,atoms);
6124 lb=(1.0-(ring_margin*0.5))*blen;
6125 ub=(1.0+(ring_margin*0.5))*blen;
6126 if (((weight[logg[13]] != 0.0) || (weight[logg[1]] != 0.0)) &&
6127 (!dist_set(d,natoms,logg[13],logg[1]))) {
6128 set_dist(d,natoms,logg[13],logg[1],lb,ub,blen);
6129 ndist++;
6130 n15dist++;
6132 /*}*/
6137 /*1111111111111111---------------66666666666666*/
6139 /* new 1-6 distances added 981124 */
6141 /*SETDISTANCE for HE3 and HE1 (1-6) */
6142 trp_16_type4(logg[10],logg[3],logg[2],logg[7],logg[8],logg[14],
6143 ilist,iparams,&blen,atoms);
6144 lb=(1.0-(ring_margin*0.5))*blen;
6145 ub=(1.0+(ring_margin*0.5))*blen;
6146 if ((weight[logg[10]] != 0.0 || (weight[logg[14]] != 0.0)) &&
6147 (!dist_set(d,natoms,logg[10],logg[14]))) {
6148 set_dist(d,natoms,logg[10],logg[14],lb,ub,blen);
6149 ndist++;
6150 n16dist++;
6152 /* end new distances */
6154 /*SETDISTANCE for CB and CH2 (1-6) */
6155 trp_16_type1(logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],
6156 ilist,iparams,&blen,atoms);
6157 lb=(1.0-(ring_margin*0.5))*blen;
6158 ub=(1.0+(ring_margin*0.5))*blen;
6159 if ((weight[logg[0]] != 0.0 || (weight[logg[5]] != 0.0)) &&
6160 (!dist_set(d,natoms,logg[0],logg[5]))) {
6161 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
6162 ndist++;
6163 n16dist++;
6165 /*SETDISTANCE for CZ3 and HE1 (1-6) */
6166 trp_16_type1(logg[4],logg[5],logg[6],logg[7],logg[8],logg[14],
6167 ilist,iparams,&blen,atoms);
6168 lb=(1.0-(ring_margin*0.5))*blen;
6169 ub=(1.0+(ring_margin*0.5))*blen;
6170 if ((weight[logg[4]] != 0.0 || (weight[logg[14]] != 0.0)) &&
6171 (!dist_set(d,natoms,logg[4],logg[14]))) {
6172 set_dist(d,natoms,logg[4],logg[14],lb,ub,blen);
6173 ndist++;
6174 n16dist++;
6176 /*SETDISTANCE for CG and HH2 (1-6) */
6177 trp_16_type2(logg[12],logg[5],logg[6],logg[7],logg[2],logg[1],
6178 ilist,iparams,&blen,atoms);
6179 lb=(1.0-(ring_margin*0.5))*blen;
6180 ub=(1.0+(ring_margin*0.5))*blen;
6181 if ((weight[logg[12]] != 0.0 || (weight[logg[1]] != 0.0)) &&
6182 (!dist_set(d,natoms,logg[12],logg[1]))) {
6183 set_dist(d,natoms,logg[12],logg[1],lb,ub,blen);
6184 ndist++;
6185 n16dist++;
6187 /*SETDISTANCE for HZ3 and NE1 (1-6) */
6188 trp_16_type2(logg[11],logg[4],logg[3],logg[2],logg[7],logg[8],
6189 ilist,iparams,&blen,atoms);
6190 lb=(1.0-(ring_margin*0.5))*blen;
6191 ub=(1.0+(ring_margin*0.5))*blen;
6192 if ((weight[logg[11]] != 0.0 || (weight[logg[8]] != 0.0)) &&
6193 (!dist_set(d,natoms,logg[11],logg[8]))) {
6194 set_dist(d,natoms,logg[11],logg[8],lb,ub,blen);
6195 ndist++;
6196 n16dist++;
6198 /*SETDISTANCE for HZ2 and HE3 (1-6) */
6199 trp_16_type2(logg[13],logg[6],logg[5],logg[4],logg[3],logg[10],
6200 ilist,iparams,&blen,atoms);
6201 lb=(1.0-(ring_margin*0.5))*blen;
6202 ub=(1.0+(ring_margin*0.5))*blen;
6203 if ((weight[logg[13]] != 0.0 || (weight[logg[10]] != 0.0)) &&
6204 (!dist_set(d,natoms,logg[13],logg[10]))) {
6205 set_dist(d,natoms,logg[13],logg[10],lb,ub,blen);
6206 ndist++;
6207 n16dist++;
6209 /*SETDISTANCE for CB and HZ3 (1-6) */
6210 trp_16_type3(logg[0],logg[1],logg[2],logg[3],logg[4],logg[11],
6211 ilist,iparams,&blen,atoms);
6212 lb=(1.0-(ring_margin*0.5))*blen;
6213 ub=(1.0+(ring_margin*0.5))*blen;
6214 if ((weight[logg[0]] != 0.0 || (weight[logg[11]] != 0.0)) &&
6215 (!dist_set(d,natoms,logg[0],logg[11]))) {
6216 set_dist(d,natoms,logg[0],logg[11],lb,ub,blen);
6217 ndist++;
6218 n16dist++;
6220 /*SETDISTANCE for HE1 and HH2 (1-6) */
6221 trp_16_type3(logg[14],logg[8],logg[7],logg[6],logg[5],logg[12],
6222 ilist,iparams,&blen,atoms);
6223 lb=(1.0-(ring_margin*0.5))*blen;
6224 ub=(1.0+(ring_margin*0.5))*blen;
6225 if ((weight[logg[14]] != 0.0 || (weight[logg[12]] != 0.0)) &&
6226 (!dist_set(d,natoms,logg[14],logg[12]))) {
6227 set_dist(d,natoms,logg[14],logg[12],lb,ub,blen);
6228 ndist++;
6229 n16dist++;
6231 /*SETDISTANCE for HZ2 and HD1 (1-6) */
6232 trp_16_type3(logg[13],logg[6],logg[7],logg[8],logg[9],logg[15],
6233 ilist,iparams,&blen,atoms);
6234 lb=(1.0-(ring_margin*0.5))*blen;
6235 ub=(1.0+(ring_margin*0.5))*blen;
6236 if ((weight[logg[13]] != 0.0 || (weight[logg[15]] != 0.0)) &&
6237 (!dist_set(d,natoms,logg[13],logg[15]))) {
6238 set_dist(d,natoms,logg[13],logg[15],lb,ub,blen);
6239 ndist++;
6240 n16dist++;
6242 /*SETDISTANCE for HE3 and HD1 (1-6) */
6243 trp_16_type3(logg[10],logg[3],logg[2],logg[1],logg[9],logg[15],
6244 ilist,iparams,&blen,atoms);
6245 lb=(1.0-(ring_margin*0.5))*blen;
6246 ub=(1.0+(ring_margin*0.5))*blen;
6247 if ((weight[logg[10]] != 0.0 || (weight[logg[15]] != 0.0)) &&
6248 (!dist_set(d,natoms,logg[10],logg[15]))) {
6249 set_dist(d,natoms,logg[10],logg[15],lb,ub,blen);
6250 ndist++;
6251 n16dist++;
6253 /*SETDISTANCE for CB and HZ2 (1-6) */
6254 trp_16_type4(logg[0],logg[1],logg[2],logg[7],logg[6],logg[13],
6255 ilist,iparams,&blen,atoms);
6256 lb=(1.0-(ring_margin*0.5))*blen;
6257 ub=(1.0+(ring_margin*0.5))*blen;
6258 if ((weight[logg[0]] != 0.0 || (weight[logg[13]] != 0.0)) &&
6259 (!dist_set(d,natoms,logg[0],logg[13]))) {
6260 set_dist(d,natoms,logg[0],logg[13],lb,ub,blen);
6261 ndist++;
6262 n16dist++;
6264 /*SETDISTANCE for CZ3 and HD1 (1-6) */
6265 trp_16_type4(logg[4],logg[3],logg[2],logg[1],logg[9],logg[15],
6266 ilist,iparams,&blen,atoms);
6267 lb=(1.0-(ring_margin*0.5))*blen;
6268 ub=(1.0+(ring_margin*0.5))*blen;
6269 if ((weight[logg[4]] != 0.0 || (weight[logg[15]] != 0.0)) &&
6270 (!dist_set(d,natoms,logg[4],logg[15]))) {
6271 set_dist(d,natoms,logg[4],logg[15],lb,ub,blen);
6272 ndist++;
6273 n16dist++;
6275 /*SETDISTANCE for CH2 and HD1 (1-6) */
6276 trp_16_type4(logg[5],logg[6],logg[7],logg[8],logg[9],logg[15],
6277 ilist,iparams,&blen,atoms);
6278 lb=(1.0-(ring_margin*0.5))*blen;
6279 ub=(1.0+(ring_margin*0.5))*blen;
6280 if ((weight[logg[5]] != 0.0 || (weight[logg[15]] != 0.0)) &&
6281 (!dist_set(d,natoms,logg[5],logg[15]))) {
6282 set_dist(d,natoms,logg[5],logg[15],lb,ub,blen);
6283 ndist++;
6284 n16dist++;
6286 /*SETDISTANCE for HZ3 and CD1 (1-6) */
6287 trp_16_type4(logg[11],logg[4],logg[3],logg[2],logg[1],logg[9],
6288 ilist,iparams,&blen,atoms);
6289 lb=(1.0-(ring_margin*0.5))*blen;
6290 ub=(1.0+(ring_margin*0.5))*blen;
6291 if ((weight[logg[11]] != 0.0 || (weight[logg[9]] != 0.0)) &&
6292 (!dist_set(d,natoms,logg[11],logg[9]))) {
6293 set_dist(d,natoms,logg[11],logg[9],lb,ub,blen);
6294 ndist++;
6295 n16dist++;
6297 /*SETDISTANCE for HH2 and CD1 (1-6) */
6298 trp_16_type4(logg[12],logg[5],logg[6],logg[7],logg[8],logg[9],
6299 ilist,iparams,&blen,atoms);
6300 lb=(1.0-(ring_margin*0.5))*blen;
6301 ub=(1.0+(ring_margin*0.5))*blen;
6302 if ((weight[logg[12]] != 0.0 || (weight[logg[9]] != 0.0)) &&
6303 (!dist_set(d,natoms,logg[12],logg[9]))) {
6304 set_dist(d,natoms,logg[12],logg[9],lb,ub,blen);
6305 ndist++;
6306 n16dist++;
6309 /* 111111111111---------7777777777 */
6312 /* new 1-7 distances added 981124 */
6314 /*SETDISTANCE for HH2 and HD1 (1-6) */
6315 trp_17_type2(logg[12],logg[5],logg[6],logg[7],logg[8],logg[9],
6316 logg[15],ilist,iparams,&blen,atoms);
6317 lb=(1.0-(ring_margin*0.5))*blen;
6318 ub=(1.0+(ring_margin*0.5))*blen;
6319 if ((weight[logg[12]] != 0.0 || (weight[logg[15]] != 0.0)) &&
6320 (!dist_set(d,natoms,logg[12],logg[15]))) {
6321 set_dist(d,natoms,logg[12],logg[15],lb,ub,blen);
6322 ndist++;
6323 n17dist++;
6325 /* end of new distances */
6327 /*SETDISTANCE for HZ3 and HE1 (1-6) */
6328 trp_17_type1(logg[11],logg[4],logg[3],logg[2],logg[7],logg[8],
6329 logg[14],ilist,iparams,&blen,atoms);
6330 lb=(1.0-(ring_margin*0.5))*blen;
6331 ub=(1.0+(ring_margin*0.5))*blen;
6332 if ((weight[logg[11]] != 0.0 || (weight[logg[14]] != 0.0)) &&
6333 (!dist_set(d,natoms,logg[11],logg[14]))) {
6334 set_dist(d,natoms,logg[11],logg[14],lb,ub,blen);
6335 ndist++;
6336 n17dist++;
6338 /*SETDISTANCE for HH2 and CB (1-6) */
6339 trp_17_type1(logg[12],logg[5],logg[6],logg[7],logg[2],logg[1],
6340 logg[0],ilist,iparams,&blen,atoms);
6341 lb=(1.0-(ring_margin*0.5))*blen;
6342 ub=(1.0+(ring_margin*0.5))*blen;
6343 if ((weight[logg[12]] != 0.0 || (weight[logg[0]] != 0.0)) &&
6344 (!dist_set(d,natoms,logg[12],logg[0]))) {
6345 set_dist(d,natoms,logg[12],logg[0],lb,ub,blen);
6346 ndist++;
6347 n17dist++;
6349 /*SETDISTANCE for HZ3 and HD1 (1-6) */
6350 trp_17_type2(logg[11],logg[4],logg[3],logg[2],logg[1],logg[9],
6351 logg[15],ilist,iparams,&blen,atoms);
6352 lb=(1.0-(ring_margin*0.5))*blen;
6353 ub=(1.0+(ring_margin*0.5))*blen;
6354 if ((weight[logg[11]] != 0.0 || (weight[logg[15]] != 0.0)) &&
6355 (!dist_set(d,natoms,logg[11],logg[15]))) {
6356 set_dist(d,natoms,logg[11],logg[15],lb,ub,blen);
6357 ndist++;
6358 n17dist++;
6361 if (bVir) {
6362 /* VIRTUAL DISTANCES */
6363 nVdist += set_virtual (logg,16,ring_margin,d,natoms);
6364 ndist += nVdist;
6365 /* Try adding a virtual atom above CD1 (logg[9]) */
6366 if (FALSE) {
6367 for (q=0 ; q<16 ; q++ ) {
6368 if (q == 9) {
6369 blen = 8.0;
6370 lb = (1.0-ring_margin)*blen;
6371 ub = (1.0+ring_margin)*blen;
6373 else {
6374 blen = d_len(d,natoms,logg[q],logg[9]);
6375 blen = sqrt(blen*blen+64.0);
6376 lb = (1.0-ring_margin)*blen;
6377 ub = (1.0+ring_margin)*blen;
6379 /* set distance to virtual atom */
6380 set_dist(d,natoms,logg[q],logg[16],lb,ub,blen);
6381 ndist++;
6382 nVdist++;
6387 logg[17]=0;
6391 fprintf(log,"There are %d new tryptophan distances\n",ndist);
6392 if (ndist > 0 ) {
6393 fprintf(log,"(%d 1-2, %d 1-3, %d 1-4, %d 1-5, %d 1-6 %d 1-7, %d virtual)\n",n12dist,
6394 n13dist,n14dist,n15dist,n16dist,n17dist,nVdist);
6397 /**********************************************************
6399 * V A L I N E
6401 **********************************************************/
6403 void val (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,real weight[],
6404 real val_margin,t_ilist ilist[],t_iparams iparams[])
6406 int natoms,ndist,i,j,logg[12],residnr,oldresidnr,n14dist,n15dist;
6407 real blen,lb,ub,angle;
6408 real pi = M_PI;
6410 natoms= atoms->nr;
6411 ndist = 0;
6412 n14dist = 0;
6413 n15dist = 0;
6414 residnr = -1;
6415 oldresidnr=-1;
6417 for (i=0; (i<natoms); i++) {
6418 if ( strcmp((*atoms->resname[atoms->atom[i].resnr]),"VAL") == 0) {
6419 oldresidnr=residnr;
6420 residnr=atoms->atom[i].resnr;
6421 logg[11]=0;
6422 if ( oldresidnr == residnr ) {
6423 continue;
6425 j=i;
6426 while ((atoms->atom[j].resnr) == residnr ) {
6427 if ( strcmp((*atoms->atomname[j]),"CA") == 0) {
6428 logg[11]++;
6429 logg[0]=j;
6431 else if ( strcmp((*atoms->atomname[j]),"CB") == 0) {
6432 logg[11]++;
6433 logg[1]=j;
6435 else if ( strcmp((*atoms->atomname[j]),"HB") == 0) {
6436 logg[11]++;
6437 logg[2]=j;
6439 else if ( strcmp((*atoms->atomname[j]),"CG1") == 0) {
6440 logg[11]++;
6441 logg[3]=j;
6443 else if ( strcmp((*atoms->atomname[j]),"HG11") == 0) {
6444 logg[11]++;
6445 logg[4]=j;
6447 else if ( strcmp((*atoms->atomname[j]),"HG12") == 0) {
6448 logg[11]++;
6449 logg[5]=j;
6451 else if ( strcmp((*atoms->atomname[j]),"HG13") == 0) {
6452 logg[11]++;
6453 logg[6]=j;
6455 else if ( strcmp((*atoms->atomname[j]),"CG2") == 0) {
6456 logg[11]++;
6457 logg[7]=j;
6459 else if ( strcmp((*atoms->atomname[j]),"HG21") == 0) {
6460 logg[11]++;
6461 logg[8]=j;
6463 else if ( strcmp((*atoms->atomname[j]),"HG22") == 0) {
6464 logg[11]++;
6465 logg[9]=j;
6467 else if ( strcmp((*atoms->atomname[j]),"HG23") == 0) {
6468 logg[11]++;
6469 logg[10]=j;
6471 if ( logg[11] == 11) {
6472 break;
6474 j++;
6476 if ( logg[11] == 11 ) {
6477 fprintf(log,"logg (val) = %d %d %d %d %d %d %d %d %d %d %d\n",
6478 logg[0],logg[1],logg[2],logg[3],logg[4],logg[5],logg[6],
6479 logg[7],logg[8],logg[9],logg[10]);
6480 /*SETDISTANCE for HG11 and CA */
6481 gauche(logg[4],logg[3],logg[1],logg[0],ilist,iparams,&blen,atoms);
6482 lb=(1.0-val_margin)*blen;
6483 ub=(1.0+val_margin)*blen;
6484 if (((weight[logg[4]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6485 (!dist_set(d,natoms,logg[4],logg[0]))) {
6486 set_dist(d,natoms,logg[4],logg[0],lb,ub,blen);
6487 ndist++;
6488 n14dist++;
6490 /*SETDISTANCE for HG11 and CG2 */
6491 gauche(logg[4],logg[3],logg[1],logg[7],ilist,iparams,&blen,atoms);
6492 lb=(1.0-val_margin)*blen;
6493 ub=(1.0+val_margin)*blen;
6494 if (((weight[logg[4]] != 0.0) || (weight[logg[7]] != 0.0)) &&
6495 (!dist_set(d,natoms,logg[4],logg[7]))) {
6496 set_dist(d,natoms,logg[4],logg[7],lb,ub,blen);
6497 ndist++;
6498 n14dist++;
6500 /*SETDISTANCE for HG11 and HB */
6501 pdih_lengths(logg[4],logg[3],logg[1],logg[2],ilist,iparams,
6502 &lb,&blen,atoms);
6503 lb=(1.0-val_margin)*blen;
6504 ub=(1.0+val_margin)*blen;
6505 if (((weight[logg[4]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6506 (!dist_set(d,natoms,logg[4],logg[2]))) {
6507 set_dist(d,natoms,logg[4],logg[2],lb,ub,blen);
6508 ndist++;
6509 n14dist++;
6511 /*SETDISTANCE for HG12 and CG2 */
6512 gauche(logg[5],logg[3],logg[1],logg[7],ilist,iparams,&blen,atoms);
6513 lb=(1.0-val_margin)*blen;
6514 ub=(1.0+val_margin)*blen;
6515 if (((weight[logg[5]] != 0.0) || (weight[logg[7]] != 0.0)) &&
6516 (!dist_set(d,natoms,logg[5],logg[7]))) {
6517 set_dist(d,natoms,logg[5],logg[7],lb,ub,blen);
6518 ndist++;
6519 n14dist++;
6521 /*SETDISTANCE for HG12 and HB */
6522 gauche(logg[5],logg[3],logg[1],logg[2],ilist,iparams,&blen,atoms);
6523 lb=(1.0-val_margin)*blen;
6524 ub=(1.0+val_margin)*blen;
6525 if (((weight[logg[5]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6526 (!dist_set(d,natoms,logg[5],logg[2]))) {
6527 set_dist(d,natoms,logg[5],logg[2],lb,ub,blen);
6528 ndist++;
6529 n14dist++;
6531 /*SETDISTANCE for HG12 and CA */
6532 pdih_lengths(logg[5],logg[3],logg[1],logg[0],ilist,iparams,
6533 &lb,&blen,atoms);
6534 lb=(1.0-val_margin)*blen;
6535 ub=(1.0+val_margin)*blen;
6536 if (((weight[logg[5]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6537 (!dist_set(d,natoms,logg[5],logg[0]))) {
6538 set_dist(d,natoms,logg[5],logg[0],lb,ub,blen);
6539 ndist++;
6540 n14dist++;
6542 /*SETDISTANCE for HG13 and HB */
6543 gauche(logg[6],logg[3],logg[1],logg[2],ilist,iparams,&blen,atoms);
6544 lb=(1.0-val_margin)*blen;
6545 ub=(1.0+val_margin)*blen;
6546 if (((weight[logg[6]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6547 (!dist_set(d,natoms,logg[6],logg[2]))) {
6548 set_dist(d,natoms,logg[6],logg[2],lb,ub,blen);
6549 ndist++;
6550 n14dist++;
6552 /*SETDISTANCE for HG13 and CA */
6553 gauche(logg[6],logg[3],logg[1],logg[0],ilist,iparams,&blen,atoms);
6554 lb=(1.0-val_margin)*blen;
6555 ub=(1.0+val_margin)*blen;
6556 if (((weight[logg[6]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6557 (!dist_set(d,natoms,logg[6],logg[0]))) {
6558 set_dist(d,natoms,logg[6],logg[0],lb,ub,blen);
6559 ndist++;
6560 n14dist++;
6562 /*SETDISTANCE for HG13 and CG2 */
6563 pdih_lengths(logg[6],logg[3],logg[1],logg[7],ilist,iparams,
6564 &lb,&blen,atoms);
6565 lb=(1.0-val_margin)*blen;
6566 ub=(1.0+val_margin)*blen;
6567 if (((weight[logg[6]] != 0.0) || (weight[logg[7]] != 0.0)) &&
6568 (!dist_set(d,natoms,logg[6],logg[7]))) {
6569 set_dist(d,natoms,logg[6],logg[7],lb,ub,blen);
6570 ndist++;
6571 n14dist++;
6573 /*SETDISTANCE for HG21 and HB */
6574 gauche(logg[8],logg[7],logg[1],logg[2],ilist,iparams,&blen,atoms);
6575 lb=(1.0-val_margin)*blen;
6576 ub=(1.0+val_margin)*blen;
6577 if (((weight[logg[8]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6578 (!dist_set(d,natoms,logg[8],logg[2]))) {
6579 set_dist(d,natoms,logg[8],logg[2],lb,ub,blen);
6580 ndist++;
6581 n14dist++;
6583 /*SETDISTANCE for HG21 and CG1 */
6584 gauche(logg[8],logg[7],logg[1],logg[3],ilist,iparams,&blen,atoms);
6585 lb=(1.0-val_margin)*blen;
6586 ub=(1.0+val_margin)*blen;
6587 if (((weight[logg[8]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6588 (!dist_set(d,natoms,logg[8],logg[3]))) {
6589 set_dist(d,natoms,logg[8],logg[3],lb,ub,blen);
6590 ndist++;
6591 n14dist++;
6593 /*SETDISTANCE for HG21 and CA */
6594 pdih_lengths(logg[8],logg[7],logg[1],logg[0],ilist,iparams,
6595 &lb,&blen,atoms);
6596 lb=(1.0-val_margin)*blen;
6597 ub=(1.0+val_margin)*blen;
6598 if (((weight[logg[8]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6599 (!dist_set(d,natoms,logg[8],logg[0]))) {
6600 set_dist(d,natoms,logg[8],logg[0],lb,ub,blen);
6601 ndist++;
6602 n14dist++;
6604 /*SETDISTANCE for HG22 and CG1 */
6605 gauche(logg[9],logg[7],logg[1],logg[3],ilist,iparams,&blen,atoms);
6606 lb=(1.0-val_margin)*blen;
6607 ub=(1.0+val_margin)*blen;
6608 if (((weight[logg[9]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6609 (!dist_set(d,natoms,logg[9],logg[3]))) {
6610 set_dist(d,natoms,logg[9],logg[3],lb,ub,blen);
6611 ndist++;
6612 n14dist++;
6614 /*SETDISTANCE for HG22 and CA */
6615 gauche(logg[9],logg[7],logg[1],logg[0],ilist,iparams,&blen,atoms);
6616 lb=(1.0-val_margin)*blen;
6617 ub=(1.0+val_margin)*blen;
6618 if (((weight[logg[9]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6619 (!dist_set(d,natoms,logg[9],logg[0]))) {
6620 set_dist(d,natoms,logg[9],logg[0],lb,ub,blen);
6621 ndist++;
6622 n14dist++;
6624 /*SETDISTANCE for HG22 and HB */
6625 pdih_lengths(logg[9],logg[7],logg[1],logg[2],ilist,iparams,
6626 &lb,&blen,atoms);
6627 lb=(1.0-val_margin)*blen;
6628 ub=(1.0+val_margin)*blen;
6629 if (((weight[logg[9]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6630 (!dist_set(d,natoms,logg[9],logg[2]))) {
6631 set_dist(d,natoms,logg[9],logg[2],lb,ub,blen);
6632 ndist++;
6633 n14dist++;
6635 /*SETDISTANCE for HG23 and CA */
6636 gauche(logg[10],logg[7],logg[1],logg[0],ilist,iparams,&blen,atoms);
6637 lb=(1.0-val_margin)*blen;
6638 ub=(1.0+val_margin)*blen;
6639 if (((weight[logg[10]] != 0.0) || (weight[logg[0]] != 0.0)) &&
6640 (!dist_set(d,natoms,logg[10],logg[0]))) {
6641 set_dist(d,natoms,logg[10],logg[0],lb,ub,blen);
6642 ndist++;
6643 n14dist++;
6645 /*SETDISTANCE for HG23 and HB */
6646 gauche(logg[10],logg[7],logg[1],logg[2],ilist,iparams,&blen,atoms);
6647 lb=(1.0-val_margin)*blen;
6648 ub=(1.0+val_margin)*blen;
6649 if (((weight[logg[10]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6650 (!dist_set(d,natoms,logg[10],logg[2]))) {
6651 set_dist(d,natoms,logg[10],logg[2],lb,ub,blen);
6652 ndist++;
6653 n14dist++;
6655 /*SETDISTANCE for HG23 and CG1 */
6656 pdih_lengths(logg[10],logg[7],logg[1],logg[3],ilist,iparams,
6657 &lb,&blen,atoms);
6658 lb=(1.0-val_margin)*blen;
6659 ub=(1.0+val_margin)*blen;
6660 if (((weight[logg[10]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6661 (!dist_set(d,natoms,logg[10],logg[3]))) {
6662 set_dist(d,natoms,logg[10],logg[3],lb,ub,blen);
6663 ndist++;
6664 n14dist++;
6667 /* 111111111-----------5555555555 */
6668 /*SETDISTANCE for HG11 and HG21 */
6669 gauche15(logg[4],logg[3],logg[1],logg[7],logg[8],pi,pi+(pi/3.0),
6670 pi+(pi/3.0),ilist,iparams,&blen,atoms);
6671 lb=(1.0-val_margin)*blen;
6672 ub=(1.0+val_margin)*blen;
6673 if (((weight[logg[4]] != 0.0) || (weight[logg[8]] != 0.0)) &&
6674 (!dist_set(d,natoms,logg[4],logg[8]))) {
6675 set_dist(d,natoms,logg[4],logg[8],lb,ub,blen);
6676 ndist++;
6677 n15dist++;
6679 /*SETDISTANCE for HG11 and HG22 */
6680 gauche15(logg[4],logg[3],logg[1],logg[7],logg[9],pi,pi+pi/3.0,
6681 pi-(pi/3.0),ilist,iparams,&blen,atoms);
6682 lb=(1.0-val_margin)*blen;
6683 ub=(1.0+val_margin)*blen;
6684 if (((weight[logg[4]] != 0.0) || (weight[logg[9]] != 0.0)) &&
6685 (!dist_set(d,natoms,logg[4],logg[9]))) {
6686 set_dist(d,natoms,logg[4],logg[9],lb,ub,blen);
6687 ndist++;
6688 n15dist++;
6690 /*SETDISTANCE for HG11 and HG23 */
6691 gauche15(logg[4],logg[3],logg[1],logg[7],logg[10],pi,pi+(pi/3.0),0,
6692 ilist,iparams,&blen,atoms);
6693 lb=(1.0-val_margin)*blen;
6694 ub=(1.0+val_margin)*blen;
6695 if (((weight[logg[4]] != 0.0) || (weight[logg[10]] != 0.0)) &&
6696 (!dist_set(d,natoms,logg[4],logg[10]))) {
6697 set_dist(d,natoms,logg[4],logg[10],lb,ub,blen);
6698 ndist++;
6699 n15dist++;
6703 /*SETDISTANCE for HG12 and HG21 */
6704 gauche15(logg[5],logg[3],logg[1],logg[7],logg[8],pi,pi-pi/3.0,
6705 pi+pi/3.0,ilist,iparams,&blen,atoms);
6706 lb=(1.0-val_margin)*blen;
6707 ub=(1.0+val_margin)*blen;
6708 if (((weight[logg[5]] != 0.0) || (weight[logg[8]] != 0.0)) &&
6709 (!dist_set(d,natoms,logg[5],logg[8]))) {
6710 set_dist(d,natoms,logg[5],logg[8],lb,ub,blen);
6711 ndist++;
6712 n15dist++;
6714 /*SETDISTANCE for HG12 and HG22 */
6715 gauche15(logg[5],logg[3],logg[1],logg[7],logg[9],pi,pi-pi/3.0,
6716 pi-pi/3.0,ilist,iparams,&blen,atoms);
6717 lb=(1.0-val_margin)*blen;
6718 ub=(1.0+val_margin)*blen;
6719 if (((weight[logg[5]] != 0.0) || (weight[logg[9]] != 0.0)) &&
6720 (!dist_set(d,natoms,logg[5],logg[9]))) {
6721 set_dist(d,natoms,logg[5],logg[9],lb,ub,blen);
6722 ndist++;
6723 n15dist++;
6725 /*SETDISTANCE for HG12 and HG23 */
6726 gauche15(logg[5],logg[3],logg[1],logg[7],logg[10],pi,pi-pi/3.0,0,ilist,
6727 iparams,&blen,atoms);
6728 lb=(1.0-val_margin)*blen;
6729 ub=(1.0+val_margin)*blen;
6730 if (((weight[logg[5]] != 0.0) || (weight[logg[10]] != 0.0)) &&
6731 (!dist_set(d,natoms,logg[5],logg[10]))) {
6732 set_dist(d,natoms,logg[5],logg[10],lb,ub,blen);
6733 ndist++;
6734 n15dist++;
6737 /*SETDISTANCE for HG13 and HG21 */
6738 gauche15(logg[6],logg[3],logg[1],logg[7],logg[8],pi,0,pi+pi/3.0,
6739 ilist,iparams,&blen,atoms);
6740 lb=(1.0-val_margin)*blen;
6741 ub=(1.0+val_margin)*blen;
6742 if (((weight[logg[6]] != 0.0) || (weight[logg[8]] != 0.0)) &&
6743 (!dist_set(d,natoms,logg[6],logg[8]))) {
6744 set_dist(d,natoms,logg[6],logg[8],lb,ub,blen);
6745 ndist++;
6746 n15dist++;
6748 /*SETDISTANCE for HG13 and HG22 */
6749 gauche15(logg[6],logg[3],logg[1],logg[7],logg[9],pi,0,pi-pi/3.0,
6750 ilist,iparams,&blen,atoms);
6751 lb=(1.0-val_margin)*blen;
6752 ub=(1.0+val_margin)*blen;
6753 if (((weight[logg[6]] != 0.0) || (weight[logg[9]] != 0.0)) &&
6754 (!dist_set(d,natoms,logg[6],logg[9]))) {
6755 set_dist(d,natoms,logg[6],logg[9],lb,ub,blen);
6756 ndist++;
6757 n15dist++;
6759 /*SETDISTANCE for HG13 and HG23 */
6760 gauche15(logg[6],logg[3],logg[1],logg[7],logg[10],pi,0,0,ilist,
6761 iparams,&blen,atoms);
6762 lb=(1.0-val_margin)*blen;
6763 ub=(1.0+val_margin)*blen;
6764 if (((weight[logg[6]] != 0.0) || (weight[logg[10]] != 0.0)) &&
6765 (!dist_set(d,natoms,logg[6],logg[10]))) {
6766 set_dist(d,natoms,logg[6],logg[10],lb,ub,blen);
6767 ndist++;
6768 n15dist++;
6773 logg[11]=0;
6776 fprintf(log,"There are %d distances to keep valine gauche\n",ndist);
6777 if (ndist > 0 ) {
6778 fprintf(log,"(%d 1-4, %d 1-5)\n",n14dist,n15dist);
6781 /**********************************************************
6783 * P E P T I D E B O N D S
6785 **********************************************************/
6787 /* Hacked by Adam and probably full of errors. */
6788 void peptide_bonds (FILE *log,t_dist *d,t_idef *idef,t_atoms *atoms,
6789 real weight[], real pep_margin,
6790 t_ilist ilist[],t_iparams iparams[],bool bVir)
6794 int natoms,ndist,odist,i,j,q,logg[8],n12dist,n13dist,n14dist,nVdist,
6795 pronr,oldpronr;
6796 real blen,lb,ub,angle;
6798 natoms= atoms->nr;
6799 ndist = 0;
6800 odist = 0;
6801 n12dist = 0;
6802 n13dist = 0;
6803 n14dist = 0;
6804 nVdist = 0;
6805 pronr =-1;
6806 oldpronr=-1;
6808 for (i=0; (i<natoms); i++) {
6809 logg[7]=0;
6810 oldpronr=pronr;
6811 if ( strcmp((*atoms->atomname[i]),"CA") == 0) {
6812 logg[7]=1;
6813 logg[0]=i;
6814 /* Here comes an ugly initialisation. Put it in a separate function.*/
6815 logg[1]=-1;
6816 logg[2]=-1;
6817 logg[3]=-1;
6818 logg[4]=-1;
6819 logg[5]=-1;
6820 logg[6]=-1;
6821 /* end of ugly initialisation */
6822 /*for (j=(i+1); (j<natoms); j++) {*/
6823 j=i+1;
6824 while ( ((atoms->atom[j].resnr) <= ((atoms->atom[i].resnr)+1)) &&
6825 (j<natoms) ) {
6826 if ( strcmp((*atoms->atomname[j]),"C") == 0) {
6827 if (logg[1] == -1) {
6828 logg[7]++;
6829 logg[1]=j;
6832 if ( strcmp((*atoms->atomname[j]),"O") == 0 ) {
6833 if (logg[2] == -1) {
6834 logg[7]++;
6835 logg[2]=j;
6838 if ( strcmp((*atoms->atomname[j]),"N") == 0 ) {
6839 if (logg[3] == -1) {
6840 logg[7]++;
6841 logg[3]=j;
6844 if (( strcmp((*atoms->resname[atoms->atom[j].resnr]),"PRO") == 0) &&
6845 ( strcmp((*atoms->atomname[j]),"CD") == 0)) {
6846 pronr=atoms->atom[j].resnr;
6847 if (oldpronr != pronr) {
6848 if (logg[4] == -1) {
6849 logg[7]++;
6850 logg[4]=j;
6854 else if ( strcmp((*atoms->atomname[j]),"H") == 0 ) {
6855 if (logg[4] == -1) {
6856 logg[7]++;
6857 logg[4]=j;
6860 if ( strcmp((*atoms->atomname[j]),"CA") == 0) {
6861 if (logg[5] == -1) {
6862 logg[7]++;
6863 logg[5]=j;
6866 if ( (strcmp((*atoms->atomname[j]),"VP") == 0) && bVir) {
6867 if (logg[6] == -1) {
6868 logg[7]++;
6869 logg[6]=j;
6872 if ( ((logg[7] == 6) && !bVir) || ((logg[7] == 7) && bVir) ) {
6873 break;
6875 j++;
6876 } /* end of while-loop */
6879 if ( ((logg[7] == 6) && !bVir) || ((logg[7] == 7) && bVir) ) {
6880 if ((logg[7] == 6) && !bVir) {
6882 fprintf(log,"logg (pep) = %d %d %d %d %d %d\n",logg[0],logg[1],
6883 logg[2],logg[3],logg[4],logg[5]);
6885 else if ((logg[7] == 7) && bVir) {
6886 fprintf(log,"logg (pep) = %d %d %d %d %d %d %d\n",logg[0],logg[1],
6887 logg[2],logg[3],logg[4],logg[5],logg[6]);
6889 /*SETDISTANCE for O and H (logg[2]&logg[4]) (transdihedral)*/
6890 pdih_lengths(logg[2],logg[1],logg[3],logg[4],ilist,iparams,&lb,&blen,
6891 atoms);
6892 lb=(1.0-pep_margin)*blen;
6893 ub=(1.0+pep_margin)*blen;
6894 if (((weight[logg[2]] != 0.0) || (weight[logg[4]] != 0.0)) &&
6896 (!dist_set(d,natoms,logg[2],logg[4]))) {
6897 set_dist(d,natoms,logg[2],logg[4],lb,ub,blen);
6898 ndist++;
6899 n14dist++;
6901 /*SETDISTANCE for O and CA+ (logg[2]&logg[5]) (cisdihedral)*/
6902 pdih_lengths(logg[2],logg[1],logg[3],logg[5],ilist,iparams,&blen,&ub,
6903 atoms);
6904 lb=(1.0-pep_margin)*blen;
6905 ub=(1.0+pep_margin)*blen;
6906 if (((weight[logg[2]] != 0.0) || (weight[logg[5]] != 0.0)) &&
6907 (!dist_set(d,natoms,logg[2],logg[5]))) {
6908 set_dist(d,natoms,logg[2],logg[5],lb,ub,blen);
6909 ndist++;
6910 n14dist++;
6912 /*SETDISTANCE for CA- and CA+ (logg[0]&logg[5]) (transdihedral)*/
6913 pdih_lengths(logg[0],logg[1],logg[3],logg[5],ilist,iparams,&lb,&blen,
6914 atoms);
6915 lb=(1.0-pep_margin)*blen;
6916 ub=(1.0+pep_margin)*blen;
6917 if (((weight[logg[0]] != 0.0) || (weight[logg[5]] != 0.0)) &&
6918 (!dist_set(d,natoms,logg[0],logg[5]))) {
6919 set_dist(d,natoms,logg[0],logg[5],lb,ub,blen);
6920 ndist++;
6921 n14dist++;
6923 /*SETDISTANCE for CA- and H (logg[0]&logg[4]) (cisdihedral)*/
6924 pdih_lengths(logg[0],logg[1],logg[3],logg[4],ilist,iparams,&blen,&ub,
6925 atoms);
6926 lb=(1.0-pep_margin)*blen;
6927 ub=(1.0+pep_margin)*blen;
6928 if (((weight[logg[0]] != 0.0) || (weight[logg[4]] != 0.0)) &&
6929 (!dist_set(d,natoms,logg[0],logg[4]))) {
6930 set_dist(d,natoms,logg[0],logg[4],lb,ub,blen);
6931 ndist++;
6932 n14dist++;
6934 /*SETDISTANCE for CA- and C (1-2) */
6935 blen=lookup_bondlength(logg[0],logg[1],ilist,iparams,TRUE,atoms);
6936 lb=(1.0-pep_margin)*blen;
6937 ub=(1.0+pep_margin)*blen;
6938 if (((weight[logg[0]] != 0.0) || (weight[logg[1]] != 0.0)) &&
6939 (!dist_set(d,natoms,logg[0],logg[1]))) {
6940 set_dist(d,natoms,logg[0],logg[1],lb,ub,blen);
6941 ndist++;
6942 n12dist++;
6944 /*SETDISTANCE for N and CA+ (1-2) */
6945 blen=lookup_bondlength(logg[3],logg[5],ilist,iparams,TRUE,atoms);
6946 lb=(1.0-pep_margin)*blen;
6947 ub=(1.0+pep_margin)*blen;
6948 if (((weight[logg[3]] != 0.0) || (weight[logg[5]] != 0.0)) &&
6949 (!dist_set(d,natoms,logg[3],logg[5]))) {
6950 set_dist(d,natoms,logg[3],logg[5],lb,ub,blen);
6951 ndist++;
6952 n12dist++;
6954 /*SETDISTANCE for C and O (1-2) */
6955 blen=lookup_bondlength(logg[1],logg[2],ilist,iparams,TRUE,atoms);
6956 lb=(1.0-pep_margin)*blen;
6957 ub=(1.0+pep_margin)*blen;
6958 if (((weight[logg[1]] != 0.0) || (weight[logg[2]] != 0.0)) &&
6959 (!dist_set(d,natoms,logg[1],logg[2]))) {
6960 set_dist(d,natoms,logg[1],logg[2],lb,ub,blen);
6961 ndist++;
6962 n12dist++;
6964 /*SETDISTANCE for C and N (1-2) */
6965 blen=lookup_bondlength(logg[1],logg[3],ilist,iparams,TRUE,atoms);
6966 lb=(1.0-pep_margin)*blen;
6967 ub=(1.0+pep_margin)*blen;
6968 if (((weight[logg[1]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6969 (!dist_set(d,natoms,logg[1],logg[3]))) {
6970 set_dist(d,natoms,logg[1],logg[3],lb,ub,blen);
6971 ndist++;
6972 n12dist++;
6974 /*SETDISTANCE for N and H (1-2) */
6975 blen=lookup_bondlength(logg[3],logg[4],ilist,iparams,TRUE,atoms);
6976 lb=(1.0-pep_margin)*blen;
6977 ub=(1.0+pep_margin)*blen;
6978 if (((weight[logg[3]] != 0.0) || (weight[logg[4]] != 0.0)) &&
6979 (!dist_set(d,natoms,logg[3],logg[4]))) {
6980 set_dist(d,natoms,logg[3],logg[4],lb,ub,blen);
6981 ndist++;
6982 n12dist++;
6984 /*SETDISTANCE for O and N (1-3) */
6985 angle=lookup_angle(logg[2],logg[1],logg[3],ilist,iparams,atoms);
6986 blen=angle_length(logg[2],logg[1],logg[3],RAD2DEG*angle,ilist,iparams,
6987 atoms);
6988 lb=(1.0-pep_margin)*blen;
6989 ub=(1.0+pep_margin)*blen;
6990 if (((weight[logg[2]] != 0.0) || (weight[logg[3]] != 0.0)) &&
6991 (!dist_set(d,natoms,logg[2],logg[3]))) {
6992 set_dist(d,natoms,logg[2],logg[3],lb,ub,blen);
6993 ndist++;
6994 n13dist++;
6996 /*SETDISTANCE for C and H (1-3) */
6997 angle=lookup_angle(logg[1],logg[3],logg[4],ilist,iparams,atoms);
6998 /* fprintf(stderr,"Hej!pept.c(C-H)1-3 has angle:%g\n",RAD2DEG*angle);*/
6999 blen=angle_length(logg[1],logg[3],logg[4],RAD2DEG*angle,ilist,iparams,
7000 atoms);
7001 lb=(1.0-pep_margin)*blen;
7002 ub=(1.0+pep_margin)*blen;
7003 if (((weight[logg[1]] != 0.0) || (weight[logg[4]] != 0.0)) &&
7004 (!dist_set(d,natoms,logg[1],logg[4]))) {
7005 set_dist(d,natoms,logg[1],logg[4],lb,ub,blen);
7006 ndist++;
7007 n13dist++;
7009 /*SETDISTANCE for CA- and O (1-3) */
7010 angle=lookup_angle(logg[0],logg[1],logg[2],ilist,iparams,atoms);
7011 blen=angle_length(logg[0],logg[1],logg[2],RAD2DEG*angle,ilist,iparams,
7012 atoms);
7013 lb=(1.0-pep_margin)*blen;
7014 ub=(1.0+pep_margin)*blen;
7015 if (((weight[logg[0]] != 0.0) || (weight[logg[2]] != 0.0)) &&
7016 (!dist_set(d,natoms,logg[0],logg[2]))) {
7017 set_dist(d,natoms,logg[0],logg[2],lb,ub,blen);
7018 ndist++;
7019 n13dist++;
7021 /*SETDISTANCE for H and CA+ (1-3) */
7022 angle=lookup_angle(logg[4],logg[3],logg[5],ilist,iparams,atoms);
7023 /* fprintf(stderr,"Hej!pept.c(H-CA+)1-3 has angle:%g\n",RAD2DEG*angle);*/
7024 blen=angle_length(logg[4],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
7025 atoms);
7026 lb=(1.0-pep_margin)*blen;
7027 ub=(1.0+pep_margin)*blen;
7028 if (((weight[logg[4]] != 0.0) || (weight[logg[5]] != 0.0)) &&
7029 (!dist_set(d,natoms,logg[4],logg[5]))) {
7030 set_dist(d,natoms,logg[4],logg[5],lb,ub,blen);
7031 ndist++;
7032 n13dist++;
7034 /*SETDISTANCE for CA- and N (1-3) */
7035 angle=lookup_angle(logg[0],logg[1],logg[3],ilist,iparams,atoms);
7036 /*fprintf(stderr,"CA- N (1-3) angle:%g\n",RAD2DEG*angle);*/
7037 blen=angle_length(logg[0],logg[1],logg[3],RAD2DEG*angle,ilist,iparams,
7038 atoms);
7039 /*fprintf(stderr,"CA- N (1-3) dist:%g\n",blen);*/
7040 lb=(1.0-pep_margin)*blen;
7041 ub=(1.0+pep_margin)*blen;
7042 if (((weight[logg[0]] != 0.0) || (weight[logg[3]] != 0.0)) &&
7043 (!dist_set(d,natoms,logg[0],logg[3]))) {
7044 set_dist(d,natoms,logg[0],logg[3],lb,ub,blen);
7045 ndist++;
7046 n13dist++;
7048 /*SETDISTANCE for C and CA+ (1-3) */
7049 angle=lookup_angle(logg[1],logg[3],logg[5],ilist,iparams,atoms);
7050 /*fprintf(stderr,"Hej!pept.c(C-CA+)1-3 has angle:%g\n",RAD2DEG*angle); */
7051 blen=angle_length(logg[1],logg[3],logg[5],RAD2DEG*angle,ilist,iparams,
7052 atoms);
7053 lb=(1.0-pep_margin)*blen;
7054 ub=(1.0+pep_margin)*blen;
7055 if (((weight[logg[1]] != 0.0) || (weight[logg[5]] != 0.0)) &&
7056 (!dist_set(d,natoms,logg[1],logg[5]))) {
7057 set_dist(d,natoms,logg[1],logg[5],lb,ub,blen);
7058 ndist++;
7059 n13dist++;
7062 if (bVir) {
7063 /* VIRTUAL DISTANCES */
7064 nVdist += set_virtual (logg,6,pep_margin,d,natoms);
7065 ndist += nVdist;
7066 if (FALSE) {
7067 for (q=0 ; q<6 ; q++ ) {
7068 if (q == 3) {
7069 blen = 8.0;
7070 lb = (1.0-pep_margin)*blen;
7071 ub = (1.0+pep_margin)*blen;
7073 else {
7074 blen = d_len(d,natoms,logg[q],logg[3]);
7075 blen = sqrt(blen*blen+64.0);
7076 lb = (1.0-pep_margin)*blen;
7077 ub = (1.0+pep_margin)*blen;
7079 set_dist(d,natoms,logg[q],logg[6],lb,ub,blen);
7080 ndist++;
7081 nVdist++;
7087 fprintf(stderr,"There are %d new peptide distances\n",ndist);
7088 if (ndist > 0) {
7089 fprintf(stderr,"(%d 1-2, %d 1-3, %d 1-4, %d virtual)\n",
7090 n12dist,n13dist,n14dist,nVdist);