1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Read configuration data. Configuration file is .garlicrc and up to
9
five directories are searched for this file. If all attempts fail,
10
default (hard-coded) parameters are used.
13
(1) Pointer to ConfigS structure, where some data will be stored.
16
(1) Some data stored to ConfigS structure.
20
(1) Positive if configuration read from file.
21
(2) Zero if default values used for initialization.
24
(1) This function is quite fast: on a 233 MHz Pentium MMX, it will
25
take few milliseconds to execute. Therefore do not be surprised
26
that if's are not optimized here.
28
========includes:============================================================*/
36
#include <X11/Xutil.h>
38
#include <X11/Xatom.h>
43
/*======function prototypes:=================================================*/
45
FILE *OpenConfigFile_ (void);
46
int ExtractInteger_ (char *);
47
int ExtractTwoIntegers_ (int *, int *, char *);
48
int ExtractPhrase_ (char *, char *);
49
double ExtractDouble_ (char *);
50
int ExtractTwoDoubles_ (double *, double *, char *);
51
int ExtractIndex_ (char *);
52
int ExtractRotationSteps_ (ConfigS *, char *);
53
int ExtractTranslationSteps_ (ConfigS *, char *);
54
int ExtractSlabSteps_ (ConfigS *, char *);
55
int ExtractFadingSteps_ (ConfigS *, char *);
57
/*======read configuration data (.garlicrc file):============================*/
59
int ReadConfig_ (ConfigS *configSP)
64
char phraseA[SHORTSTRINGSIZE];
69
/* Default values; used if both attempts to find .garlicrc fail, */
70
/* or if the corresponding entry does not exist in .garlicrc file: */
72
/** Main window geometry: **/
73
strcpy (configSP->geometryA, "default");
75
/** Font name and cursor name: **/
76
strcpy (configSP->font_nameA, "10x20");
77
strcpy (configSP->cursor_nameA, "default");
79
/** Coordinate system in the top left corner is visible by default: **/
80
configSP->show_coord_systemF = 1;
82
/** Control window in the top right corner is visible by default: **/
83
configSP->show_control_windowF = 1;
85
/** The sequence neighborhood of the residue **/
86
/** under the pointer is visible by default: **/
87
configSP->show_sequence_neighborhoodF = 1;
89
/** Stereo flag (default is mono): **/
90
configSP->stereoF = 0;
92
/** Light source theta angle (with respect to z): **/
93
configSP->light_theta = 150.0 * DEG_TO_RAD;
95
/** Light source phi angle (with respect to x): **/
96
configSP->light_phi = 225.0 * DEG_TO_RAD;
98
/** Window colors: **/
99
strcpy (configSP->bg_colorA, "black");
100
strcpy (configSP->fg_colorA, "white");
101
strcpy (configSP->text_bg_colorA, "black");
102
strcpy (configSP->text_fg_colorA, "white");
104
/** Slab mode index (default is planar): **/
105
configSP->default_slab_modeI = 1;
107
/** Color fading mode index (default is planar): **/
108
configSP->default_fading_modeI = 1;
110
/** Default number of color fading surfaces (up to MAXSURFACES): **/
111
configSP->default_surfacesN = 3;
113
/** Color specifications: **/
114
strcpy (configSP->left_colorAA[0], "RGB:FFFF/FFFF/0000");
115
strcpy (configSP->middle_colorAA[0], "RGB:FFFF/AAAA/0000");
116
strcpy (configSP->right_colorAA[0], "RGB:FFFF/5555/0000");
117
strcpy (configSP->left_colorAA[1], "RGB:FFFF/8888/0000");
118
strcpy (configSP->middle_colorAA[1], "RGB:FFFF/0000/0000");
119
strcpy (configSP->right_colorAA[1], "RGB:AAAA/0000/0000");
120
strcpy (configSP->left_colorAA[2], "RGB:7777/0000/0000");
121
strcpy (configSP->middle_colorAA[2], "RGB:5555/0000/0000");
122
strcpy (configSP->right_colorAA[2], "RGB:4444/0000/0000");
123
for (n = 3; n < MAXSURFACES; n++)
125
strcpy (configSP->left_colorAA[n], "white");
126
strcpy (configSP->middle_colorAA[n], "gray");
127
strcpy (configSP->right_colorAA[n], "DarkGray");
130
/* Drawing styles for atoms, bonds and backbone: */
131
configSP->default_atom_styleI = 2;
132
configSP->default_bond_styleI = 2;
133
configSP->default_backbone_styleI = 5;
135
/** Bond lengths (angstroms): **/
136
configSP->max_bond_length = 2.2;
137
configSP->C_C_bond_length_min = 1.40;
138
configSP->C_C_bond_length_max = 1.70;
139
configSP->C_N_bond_length_min = 1.10;
140
configSP->C_N_bond_length_max = 1.60;
141
configSP->C_O_bond_length_min = 1.10;
142
configSP->C_O_bond_length_max = 1.40;
143
configSP->C_S_bond_length_min = 1.60;
144
configSP->C_S_bond_length_max = 2.00;
145
configSP->C_H_bond_length_min = 0.80;
146
configSP->C_H_bond_length_max = 1.20;
147
configSP->N_H_bond_length_min = 0.90;
148
configSP->N_H_bond_length_max = 1.30;
149
configSP->O_H_bond_length_min = 0.70;
150
configSP->O_H_bond_length_max = 1.30;
151
configSP->S_H_bond_length_min = 0.90;
152
configSP->S_H_bond_length_max = 1.60;
153
configSP->O_P_bond_length_min = 1.20;
154
configSP->O_P_bond_length_max = 1.80;
155
configSP->S_S_bond_length_min = 1.80;
156
configSP->S_S_bond_length_max = 2.30;
157
configSP->generic_bond_length_min = 0.8;
158
configSP->generic_bond_length_max = 2.0;
159
configSP->hydro_bond_length_min = 2.4;
160
configSP->hydro_bond_length_max = 4.1;
161
configSP->hydro_bond_angle_min = (double) 125 * DEG_TO_RAD;
162
configSP->hydro_bond_angle_max = (double) 180 * DEG_TO_RAD;
164
/** The maximal CA_CA distance for two neighbouring residues (angstroms): **/
165
configSP->CA_CA_dist_max = 4.1;
167
/** Atomic radii (in angstroms): **/
168
configSP->H_radius = 0.70;
169
configSP->C_radius = 1.20;
170
configSP->N_radius = 1.05;
171
configSP->O_radius = 1.00;
172
configSP->S_radius = 1.25;
173
configSP->P_radius = 1.25;
174
configSP->generic_radius = 1.40;
176
/** van der Waals radii (in angstroms): **/
177
configSP->H_van_der_Waals_radius = 1.00;
178
configSP->C_van_der_Waals_radius = 1.70;
179
configSP->N_van_der_Waals_radius = 1.50;
180
configSP->O_van_der_Waals_radius = 1.40;
181
configSP->S_van_der_Waals_radius = 1.80;
182
configSP->P_van_der_Waals_radius = 1.80;
183
configSP->generic_van_der_Waals_radius = 2.00;
185
/** Ball radius (used to draw balls and sticks): **/
186
configSP->ball_radius = 0.45;
188
/** Number of neighbors to be checked as bond candidates: **/
189
configSP->bond_candidates_backward = 50;
190
configSP->bond_candidates_forward = 50;
192
/** Geometric parameters: **/
193
configSP->main_margin_left = 30;
194
configSP->main_margin_right = 30;
195
configSP->main_margin_top = 60;
196
configSP->main_margin_bottom = 30;
197
configSP->max_main_win_width = MAXWINWIDTH;
198
configSP->max_main_win_height = MAXWINHEIGHT;
199
configSP->nearest_line_thickness = MAXLINES;
200
configSP->screen_real_width = SCREEN_REAL_WX;
201
configSP->screen_real_height = SCREEN_REAL_WY;
202
configSP->user_screen_real_distance = USER_SCREEN_REAL_DIST;
203
configSP->screen_atomic_width = SCREEN_ATOMIC_WX;
204
configSP->user_atomic_position = USER_ATOMIC_Z;
205
configSP->stereo_screen_margin = STEREO_MARGIN;
206
configSP->stereo_angle = STEREO_ANGLE * DEG_TO_RAD;
207
configSP->rotation_stepA[0] = 0.2 * DEG_TO_RAD;
208
configSP->rotation_stepA[1] = 1.0 * DEG_TO_RAD;
209
configSP->rotation_stepA[2] = 5.0 * DEG_TO_RAD;
210
configSP->rotation_stepA[3] = 30.0 * DEG_TO_RAD;
211
configSP->rotation_stepA[4] = 90.0 * DEG_TO_RAD;
212
configSP->translation_stepA[0] = 0.2;
213
configSP->translation_stepA[1] = 1.0;
214
configSP->translation_stepA[2] = 5.0;
215
configSP->translation_stepA[3] = 25.0;
216
configSP->translation_stepA[4] = 100.0;
217
configSP->slab_stepA[0] = 0.2;
218
configSP->slab_stepA[1] = 1.0;
219
configSP->slab_stepA[2] = 5.0;
220
configSP->slab_stepA[3] = 20.0;
221
configSP->slab_stepA[4] = 80.0;
222
configSP->fading_stepA[0] = 0.2;
223
configSP->fading_stepA[1] = 1.0;
224
configSP->fading_stepA[2] = 5.0;
225
configSP->fading_stepA[3] = 20.0;
226
configSP->fading_stepA[4] = 80.0;
228
/* Try to find personal or public configuration file: */
229
if ((fileP = OpenConfigFile_ ()) == NULL) return 0;
231
/* If this point is reached, file is available - read and parse all lines: */
232
line_size = sizeof (s);
233
while (fgets (s, line_size, fileP))
236
if (strstr (s, "#") == s) continue;
238
/* Skip very short lines: */
239
if (strlen (s) <= 5) continue;
241
/* Main window geometry: */
242
if (strstr (s, "main") && strstr (s, "window") &&
243
strstr (s, "geometry"))
245
if (ExtractPhrase_ (phraseA, s) > 0)
247
strncpy (configSP->geometryA,
248
phraseA, SHORTSTRINGSIZE - 1);
249
configSP->geometryA[SHORTSTRINGSIZE - 1] = '\0';
254
/* Main font name: */
255
if (strstr (s, "main") && strstr (s, "font"))
257
if (ExtractPhrase_ (phraseA, s) > 0)
259
strncpy (configSP->font_nameA,
260
phraseA, SHORTSTRINGSIZE - 1);
261
configSP->font_nameA[SHORTSTRINGSIZE - 1] = '\0';
266
/* Main window cursor: */
267
if (strstr (s, "main") && strstr (s, "window") && strstr (s, "cursor"))
269
if (ExtractPhrase_ (phraseA, s) > 0)
271
strncpy (configSP->cursor_nameA,
272
phraseA, SHORTSTRINGSIZE - 1);
273
configSP->cursor_nameA[SHORTSTRINGSIZE - 1] = '\0';
278
/* Coordinate system in the top left corner (yes or no): */
279
if (strstr (s, "show") && strstr (s, "coordinate") &&
280
strstr (s, "system"))
282
if (ExtractPhrase_ (phraseA, s) > 0)
284
if (strstr (phraseA, "no"))
286
configSP->show_coord_systemF = 0;
292
/* Control window in the top right corner: */
293
if (strstr (s, "show") && strstr (s, "control") &&
294
strstr (s, "window"))
296
if (ExtractPhrase_ (phraseA, s) > 0)
298
if (strstr (phraseA, "no"))
300
configSP->show_control_windowF = 0;
306
/* Sequence neighborhood of the residue under the pointer: */
307
if (strstr (s, "show") && strstr (s, "sequence") &&
308
strstr (s, "neighborhood"))
310
if (ExtractPhrase_ (phraseA, s) > 0)
312
if (strstr (phraseA, "no"))
314
configSP->show_sequence_neighborhoodF = 0;
320
/* Stereo flag (0 = mono, 1 = stereo): */
321
if (strstr (s, "display") && strstr (s, "stereo") &&
324
if (ExtractPhrase_ (phraseA, s) > 0)
326
if (strstr (phraseA, "yes")) configSP->stereoF = 1;
331
/* Default slab mode index (see typedefs.h for available modes): */
332
if (strstr (s, "default") && strstr (s, "slab") && strstr (s, "mode"))
334
if (ExtractPhrase_ (phraseA, s) > 0)
336
if (strncmp (phraseA, "off", 50) == 0)
337
configSP->default_slab_modeI = 0;
338
else if (strncmp (phraseA, "planar", 50) == 0)
339
configSP->default_slab_modeI = 1;
340
else if (strncmp (phraseA, "sphere", 50) == 0)
341
configSP->default_slab_modeI = 2;
342
else if (strncmp (phraseA, "half-sphere", 50) == 0)
343
configSP->default_slab_modeI = 3;
344
else if (strncmp (phraseA, "cylinder", 50) == 0)
345
configSP->default_slab_modeI = 4;
346
else if (strncmp (phraseA, "half-cylinder", 50) == 0)
347
configSP->default_slab_modeI = 5;
348
else configSP->default_slab_modeI = 1; /* Default */
353
/* Default fading mode index (see typedefs.h for available modes): */
354
if (strstr (s, "default") && strstr (s, "fading") &&
357
if (ExtractPhrase_ (phraseA, s) > 0)
359
if (strncmp (phraseA, "off", 50) == 0)
360
configSP->default_fading_modeI = 0;
361
else if (strncmp (phraseA, "planar", 50) == 0)
362
configSP->default_fading_modeI = 1;
363
else if (strncmp (phraseA, "sphere", 50) == 0)
364
configSP->default_fading_modeI = 2;
365
else if (strncmp (phraseA, "half-sphere", 50) == 0)
366
configSP->default_fading_modeI = 3;
367
else if (strncmp (phraseA, "cylinder", 50) == 0)
368
configSP->default_fading_modeI = 4;
369
else if (strncmp (phraseA, "half-cylinder", 50) == 0)
370
configSP->default_fading_modeI = 5;
371
else configSP->default_fading_modeI = 1; /* Default */
376
/* Main window left margin: */
377
if (strstr (s, "main") && strstr (s, "window") &&
378
strstr (s, "left") && strstr (s, "margin"))
380
n = ExtractInteger_ (s);
381
if (n >= 0) configSP->main_margin_left = n;
385
/* Main window right margin: */
386
if (strstr (s, "main") && strstr (s, "window") &&
387
strstr (s, "right") && strstr (s, "margin"))
389
n = ExtractInteger_ (s);
390
if (n >= 0) configSP->main_margin_right = n;
394
/* Main window top margin: */
395
if (strstr (s, "main") && strstr (s, "window") &&
396
strstr (s, "top") && strstr (s, "margin"))
398
n = ExtractInteger_ (s);
399
if (n >= 0) configSP->main_margin_top = n;
403
/* Main window bottom margin: */
404
if (strstr (s, "main") && strstr (s, "window") &&
405
strstr (s, "bottom") && strstr (s, "margin"))
407
n = ExtractInteger_ (s);
408
if (n >= 0) configSP->main_margin_bottom = n;
412
/* Background color specification: */
413
if (strstr (s, "main") && strstr (s, "window") &&
414
strstr (s, "background") && strstr (s, "color"))
416
if (ExtractPhrase_ (phraseA, s) > 0)
418
strncpy (configSP->bg_colorA,
419
phraseA, SHORTSTRINGSIZE - 1);
420
configSP->bg_colorA[SHORTSTRINGSIZE - 1] = '\0';
425
/* Foreground color specification: */
426
if (strstr (s, "main") && strstr (s, "window") &&
427
strstr (s, "foreground") && strstr (s, "color"))
429
if (ExtractPhrase_ (phraseA, s) > 0)
431
strncpy (configSP->fg_colorA,
432
phraseA, SHORTSTRINGSIZE - 1);
433
configSP->fg_colorA[SHORTSTRINGSIZE - 1] = '\0';
438
/* Text background color: */
439
if (strstr (s, "text") && strstr (s, "background") &&
442
if (ExtractPhrase_ (phraseA, s) > 0)
444
strncpy (configSP->text_bg_colorA,
445
phraseA, SHORTSTRINGSIZE - 1);
446
configSP->text_bg_colorA[SHORTSTRINGSIZE - 1] = '\0';
451
/* Text foreground color: */
452
if (strstr (s, "text") && strstr (s, "foreground") &&
455
if (ExtractPhrase_ (phraseA, s) > 0)
457
strncpy (configSP->text_fg_colorA,
458
phraseA, SHORTSTRINGSIZE - 1);
459
configSP->text_fg_colorA[SHORTSTRINGSIZE - 1] = '\0';
464
/* Default number of color fading surfaces: */
465
if (strstr (s, "number") && strstr (s, "color") &&
466
strstr (s, "surfaces"))
468
n = ExtractInteger_ (s);
469
if ((n > 0) && (n <= MAXSURFACES))
471
configSP->default_surfacesN = n;
477
if (strstr (s, "left") && strstr (s, "color"))
479
surfaceI = ExtractIndex_ (s);
480
if ((surfaceI < 0) || (surfaceI >= MAXSURFACES)) continue;
481
if (ExtractPhrase_ (phraseA, s) > 0)
483
strncpy (configSP->left_colorAA[surfaceI],
484
phraseA, SHORTSTRINGSIZE - 1);
485
n = SHORTSTRINGSIZE - 1;
486
configSP->left_colorAA[surfaceI][n] = '\0';
492
if (strstr (s, "middle") && strstr (s, "color"))
494
surfaceI = ExtractIndex_ (s);
495
if ((surfaceI < 0) || (surfaceI >= MAXSURFACES)) continue;
496
if (ExtractPhrase_ (phraseA, s) > 0)
498
strncpy (configSP->middle_colorAA[surfaceI],
499
phraseA, SHORTSTRINGSIZE - 1);
500
n = SHORTSTRINGSIZE - 1;
501
configSP->middle_colorAA[surfaceI][n] = '\0';
507
if (strstr (s, "right") && strstr (s, "color"))
509
surfaceI = ExtractIndex_ (s);
510
if ((surfaceI < 0) || (surfaceI >= MAXSURFACES)) continue;
511
if (ExtractPhrase_ (phraseA, s) > 0)
513
strncpy (configSP->right_colorAA[surfaceI],
514
phraseA, SHORTSTRINGSIZE - 1);
515
n = SHORTSTRINGSIZE - 1;
516
configSP->right_colorAA[surfaceI][n] = '\0';
521
/* Default drawing style for atoms: */
522
if (strstr (s, "default") && strstr (s, "atom") &&
523
strstr (s, "drawing") && strstr (s, "style"))
525
n = ExtractInteger_ (s);
526
if ((n >= 0) && (n <= MAXATOMSTYLEI))
528
configSP->default_atom_styleI = (short int) n;
532
/* Default drawing style for bonds: */
533
if (strstr (s, "default") && strstr (s, "bond") &&
534
strstr (s, "drawing") && strstr (s, "style"))
536
n = ExtractInteger_ (s);
537
if ((n >= 0) && (n <= MAXBONDSTYLEI))
539
configSP->default_bond_styleI = (short int) n;
543
/* Default drawing style for bonds: */
544
if (strstr (s, "default") && strstr (s, "backbone") &&
545
strstr (s, "drawing") && strstr (s, "style"))
547
n = ExtractInteger_ (s);
548
if ((n >= 0) && (n <= MAXBONESTYLEI))
550
configSP->default_backbone_styleI = (short int) n;
554
/* Maximal main window width: */
555
if (strstr (s, "maximal") && strstr (s, "window") &&
558
n = ExtractInteger_ (s);
559
if (n >= 0) configSP->max_main_win_width = n;
563
/* Maximal main window height: */
564
if (strstr (s, "maximal") && strstr (s, "window") &&
565
strstr (s, "height"))
567
n = ExtractInteger_ (s);
568
if (n >= 0) configSP->max_main_win_height = n;
572
/* The nearest line (i.e. the nearest bond) thickness. */
573
/* Used only if line thickness is used for perspective! */
574
if (strstr (s, "nearest") && strstr (s, "line") &&
575
strstr (s, "thickness"))
577
n = ExtractInteger_ (s);
578
if (n >= 0) configSP->nearest_line_thickness = n;
582
/* Screen width in real world: */
583
if (strstr (s, "screen") && strstr (s, "real") && strstr (s, "width"))
585
d = ExtractDouble_ (s);
586
if (d > 0) configSP->screen_real_width = d;
590
/* Screen height in real world: */
591
if (strstr (s, "screen") && strstr (s, "real") && strstr (s, "height"))
593
d = ExtractDouble_ (s);
594
if (d > 0) configSP->screen_real_height = d;
598
/* Distance between user and screen in real world: */
599
if (strstr (s, "distance") && strstr (s, "user") &&
600
strstr (s, "screen") && strstr (s, "real"))
602
d = ExtractDouble_ (s);
603
if (d > 0) configSP->user_screen_real_distance = d;
607
/* Screen width in atomic world: */
608
if (strstr (s, "screen") && strstr (s, "width") &&
609
strstr (s, "atomic"))
611
d = ExtractDouble_ (s);
612
if (d > 0) configSP->screen_atomic_width = d;
616
/* User z coordinate in atomic world (must be negative!): */
617
if (strstr (s, "user") && strstr (s, "position") &&
618
strstr (s, "atomic"))
620
d = ExtractDouble_ (s);
621
if (d < 0) configSP->user_atomic_position = d; /* Negative! */
625
/* Stereo internal margin (separating left and right image): */
626
if (strstr (s, "stereo") && strstr (s, "internal") &&
627
strstr (s, "margin"))
629
n = ExtractInteger_ (s);
630
if (n > 0) configSP->stereo_screen_margin = n;
634
/* Stereo angle. The right image is rotated around y axis for that */
635
/* angle (right-handed rotation). Degrees read, radians stored: */
636
if (strstr (s, "stereo") && strstr (s, "angle"))
638
d = ExtractDouble_ (s);
639
configSP->stereo_angle = d * DEG_TO_RAD;
643
/* Light source theta angle: */
644
if (strstr (s, "light") && strstr (s, "source") &&
645
strstr (s, "theta") && strstr (s, "angle"))
647
d = ExtractDouble_ (s);
648
configSP->light_theta = d * DEG_TO_RAD;
652
/* Light source phi angle: */
653
if (strstr (s, "light") && strstr (s, "source") &&
654
strstr (s, "phi") && strstr (s, "angle"))
656
d = ExtractDouble_ (s);
657
configSP->light_phi = d * DEG_TO_RAD;
661
/* Rotation steps (very small, small, normal, large, very large): */
662
if (strstr (s, "rotation") && strstr (s, "steps"))
664
ExtractRotationSteps_ (configSP, s);
668
/* Translation steps (very small, small, normal, large, very large): */
669
if (strstr (s, "translation") && strstr (s, "steps"))
671
ExtractTranslationSteps_ (configSP, s);
675
/* Slab steps (very small, small, normal, large, very large): */
676
if (strstr (s, "slab") && strstr (s, "steps"))
678
ExtractSlabSteps_ (configSP, s);
682
/* Fading steps (very small, small, normal, large, very large): */
683
if (strstr (s, "fading") && strstr (s, "steps"))
685
ExtractFadingSteps_ (configSP, s);
689
/* Maximal bond length, used to check */
690
/* which atoms and bonds are invisible: */
691
if (strstr (s, "maximal") && strstr (s, "bond") &&
692
strstr (s, "length"))
694
d = ExtractDouble_ (s);
695
if (d > 0) configSP->max_bond_length = d;
699
/* Crude bond length limits for C-C bond: */
700
if (strstr (s, "approx") && strstr (s, "C-C") &&
701
strstr (s, "bond") && strstr (s, "length"))
703
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
705
if ((d1 > 0) && (d2 > d1))
707
configSP->C_C_bond_length_min = d1;
708
configSP->C_C_bond_length_max = d2;
714
/* Crude bond length limits for C-N bond: */
715
if (strstr (s, "approx") && strstr (s, "C-N") &&
716
strstr (s, "bond") && strstr (s, "length"))
718
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
720
if ((d1 > 0) && (d2 > d1))
722
configSP->C_N_bond_length_min = d1;
723
configSP->C_N_bond_length_max = d2;
729
/* Crude bond length limits for C-O bond: */
730
if (strstr (s, "approx") && strstr (s, "C-O") &&
731
strstr (s, "bond") && strstr (s, "length"))
733
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
735
if ((d1 > 0) && (d2 > d1))
737
configSP->C_O_bond_length_min = d1;
738
configSP->C_O_bond_length_max = d2;
744
/* Crude bond length limits for C-S bond: */
745
if (strstr (s, "approximate") && strstr (s, "C-S") &&
746
strstr (s, "bond") && strstr (s, "length"))
748
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
750
if ((d1 > 0) && (d2 > d1))
752
configSP->C_S_bond_length_min = d1;
753
configSP->C_S_bond_length_max = d2;
759
/* Crude bond length limits for C-H bond: */
760
if (strstr (s, "approximate") && strstr (s, "C-H") &&
761
strstr (s, "bond") && strstr (s, "length"))
763
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
765
if ((d1 > 0) && (d2 > d1))
767
configSP->C_H_bond_length_min = d1;
768
configSP->C_H_bond_length_max = d2;
774
/* Crude bond length limits for N-H bond: */
775
if (strstr (s, "approximate") && strstr (s, "N-H") &&
776
strstr (s, "bond") && strstr (s, "length"))
778
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
780
if ((d1 > 0) && (d2 > d1))
782
configSP->N_H_bond_length_min = d1;
783
configSP->N_H_bond_length_max = d2;
789
/* Crude bond length limits for O-H bond: */
790
if (strstr (s, "approximate") && strstr (s, "O-H") &&
791
strstr (s, "bond") && strstr (s, "length"))
793
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
795
if ((d1 > 0) && (d2 > d1))
797
configSP->O_H_bond_length_min = d1;
798
configSP->O_H_bond_length_max = d2;
804
/* Crude bond length limits for S-H bond: */
805
if (strstr (s, "approximate") && strstr (s, "S-H") &&
806
strstr (s, "bond") && strstr (s, "length"))
808
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
810
if ((d1 > 0) && (d2 > d1))
812
configSP->S_H_bond_length_min = d1;
813
configSP->S_H_bond_length_max = d2;
819
/* Crude bond length limits for O-P bond: */
820
if (strstr (s, "approximate") && strstr (s, "O-P") &&
821
strstr (s, "bond") && strstr (s, "length"))
823
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
825
if ((d1 > 0) && (d2 > d1))
827
configSP->O_P_bond_length_min = d1;
828
configSP->O_P_bond_length_max = d2;
834
/* Crude bond length limits for S-S bond: */
835
if (strstr (s, "approximate") && strstr (s, "S-S") &&
836
strstr (s, "bond") && strstr (s, "length"))
838
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
840
if ((d1 > 0) && (d2 > d1))
842
configSP->S_S_bond_length_min = d1;
843
configSP->S_S_bond_length_max = d2;
849
/* Bond length limits for unrecognized atomic pairs: */
850
if (strstr (s, "generic") && strstr (s, "bond") &&
851
strstr (s, "length"))
853
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
855
if ((d1 > 0) && (d2 > d1))
857
configSP->generic_bond_length_min = d1;
858
configSP->generic_bond_length_max = d2;
864
/* Hydrogen bond length range: */
865
if (strstr (s, "hydrogen") && strstr (s, "bond") &&
866
strstr (s, "length"))
868
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
870
if ((d1 > 0) && (d2 > d1))
872
configSP->hydro_bond_length_min = d1;
873
configSP->hydro_bond_length_max = d2;
879
/* Hydrogen bond angular range: */
880
if (strstr (s, "hydrogen") && strstr (s, "bond") &&
883
if (ExtractTwoDoubles_ (&d1, &d2, s) > 0)
885
if ((d1 >= 0.0) && (d1 <= 180.0) &&
886
(d2 > d1) && (d2 <= 180))
888
configSP->hydro_bond_angle_min =
890
configSP->hydro_bond_angle_max =
896
/* The maximal CA-CA distance for two neighbouring residues: */
897
if (strstr (s, "maximal") && strstr (s, "CA-CA") &&
898
strstr (s, "distance"))
900
d = ExtractDouble_ (s);
901
if (d > 0) configSP->CA_CA_dist_max = d;
905
/* Radius of hydrogen atom: */
906
if (strstr (s, "radius") && strstr (s, "hydrogen") &&
907
!strstr (s, "Waals"))
909
d = ExtractDouble_ (s);
910
if (d > 0) configSP->H_radius = (float) d;
914
/* Radius of carbon atom: */
915
if (strstr (s, "radius") && strstr (s, "carbon") &&
916
!strstr (s, "Waals"))
918
d = ExtractDouble_ (s);
919
if (d > 0) configSP->C_radius = (float) d;
923
/* Radius of nitrogen atom: */
924
if (strstr (s, "radius") && strstr (s, "nitrogen") &&
925
!strstr (s, "Waals"))
927
d = ExtractDouble_ (s);
928
if (d > 0) configSP->N_radius = (float) d;
932
/* Radius of oxygen atom: */
933
if (strstr (s, "radius") && strstr (s, "oxygen") &&
934
!strstr (s, "Waals"))
936
d = ExtractDouble_ (s);
937
if (d > 0) configSP->O_radius = (float) d;
941
/* Radius of sulfur atom: */
942
if (strstr (s, "radius") && strstr (s, "sulfur") &&
943
!strstr (s, "Waals"))
945
d = ExtractDouble_ (s);
946
if (d > 0) configSP->S_radius = (float) d;
950
/* Radius of phosphorus atom: */
951
if (strstr (s, "radius") && strstr (s, "phosphorus") &&
952
!strstr (s, "Waals"))
954
d = ExtractDouble_ (s);
955
if (d > 0) configSP->P_radius = (float) d;
959
/* Radius of unknown atom (generic radius): */
960
if (strstr (s, "generic") && strstr (s, "radius") &&
961
!strstr (s, "Waals"))
963
d = ExtractDouble_ (s);
964
if (d > 0) configSP->generic_radius = (float) d;
968
/* Van der Waals radius of hydrogen: */
969
if (strstr (s, "hydrogen") && strstr (s, "Waals"))
971
d = ExtractDouble_ (s);
972
if (d > 0) configSP->H_van_der_Waals_radius = (float) d;
976
/* Van der Waals radius of carbon: */
977
if (strstr (s, "carbon") && strstr (s, "Waals"))
979
d = ExtractDouble_ (s);
980
if (d > 0) configSP->C_van_der_Waals_radius = (float) d;
984
/* Van der Waals radius of nitrogen: */
985
if (strstr (s, "nitrogen") && strstr (s, "Waals"))
987
d = ExtractDouble_ (s);
988
if (d > 0) configSP->N_van_der_Waals_radius = (float) d;
992
/* Van der Waals radius of oxygen: */
993
if (strstr (s, "oxygen") && strstr (s, "Waals"))
995
d = ExtractDouble_ (s);
996
if (d > 0) configSP->O_van_der_Waals_radius = (float) d;
1000
/* Van der Waals radius of sulfur: */
1001
if (strstr (s, "sulfur") && strstr (s, "Waals"))
1003
d = ExtractDouble_ (s);
1004
if (d > 0) configSP->S_van_der_Waals_radius = (float) d;
1008
/* Van der Waals radius of phosphorus: */
1009
if (strstr (s, "phosphorus") && strstr (s, "Waals"))
1011
d = ExtractDouble_ (s);
1012
if (d > 0) configSP->P_van_der_Waals_radius = (float) d;
1016
/* Van der Waals radius of unknown atom (generic radius): */
1017
if (strstr (s, "generic") && strstr (s, "Waals"))
1019
d = ExtractDouble_ (s);
1020
if (d > 0) configSP->generic_van_der_Waals_radius = (float) d;
1024
/* Ball radius (used to draw balls and sticks): */
1025
if (strstr (s, "ball") && strstr (s, "radius"))
1027
d = ExtractDouble_ (s);
1028
if (d > 0) configSP->ball_radius = (float) d;
1032
/* The number of neighboring atoms which should be checked */
1033
/* as bond candidates, in each direction of AtomS array: */
1034
if (strstr (s, "number") && strstr (s, "bond") &&
1035
strstr (s, "candidates"))
1037
if (ExtractTwoIntegers_ (&n1, &n2, s) > 0)
1039
if (n1 > 0) configSP->bond_candidates_backward = n1;
1040
if (n2 > 0) configSP->bond_candidates_forward = n2;
1052
/*===========================================================================*/