1 /* Copyright (C) 2000-2006 Damir Zucic */
2 
3 
4 /* Structures used in garlic program. */
5 
6 
7 /* Color RGB specifications; this structure is slightly smaller than XColor: */
8 
9 typedef struct		/* RGBS */
10 	{
11 	unsigned short	red;
12 	unsigned short	green;
13 	unsigned short	blue;
14 
15 	} RGBS;
16 
17 
18 /* The structure used to store color schemes: */
19 typedef struct		/* ColorSchemeS */
20 	{
21 	int		surfacesN;
22 	RGBS		left_rgbSA[MAXCOLORSURFACES];
23 	RGBS		middle_rgbSA[MAXCOLORSURFACES];
24 	RGBS		right_rgbSA[MAXCOLORSURFACES];
25 
26 	} ColorSchemeS;
27 
28 
29 /* Three dimensional vector structure: */
30 
31 typedef struct		/* VectorS */
32 	{
33 	double		x;
34 	double		y;
35 	double		z;
36 
37 	} VectorS;
38 
39 
40 /* Configuration data from  $HOME/.garlicrc , or - if this file */
41 /* does not exist - from  /usr/local/lib/garlic/.garlicrc file: */
42 /*----------------------------------*/
43 /* _atomic_ = atomic world units    */
44 /* _real_   = real world units      */
45 /* _screen_ = screen units (pixels) */
46 /*----------------------------------*/
47 /* Slab and  fading modes: */
48 /*-------------------------*/
49 /* 0 = off (not used)      */
50 /* 1 = planar (default)    */
51 /* 2 = spherical           */
52 /* 3 = half-sphere         */
53 /* 4 = cylindrical         */
54 /* 5 = half-cylinder       */
55 /*-------------------------*/
56 
57 typedef struct		/* ConfigS */
58 	{
59 	/* Log file name, flag and pointer: */
60 	char		log_file_nameA[STRINGSIZE];
61 	int		log_fileF;
62 	FILE		*log_fileP;
63 
64 	/* Main window geometry: */
65 	char		geometryA[SHORTSTRINGSIZE];
66 
67 	/* Font name and cursor name: */
68 	char		font_nameA[SHORTSTRINGSIZE];
69 	char		cursor_nameA[SHORTSTRINGSIZE];
70 
71 	/* Coordinate system flag (0 = hidden, 1 = visible): */
72 	int		show_coord_systemF;
73 
74 	/* Control window flag (0 = hidden, 1 = visible): */
75 	int		show_control_windowF;
76 
77 	/* Sequence neighborhood flag  (0 = hide, 1 = show residue names, */
78 	/* 2 = show residue names, serial numbers and chain identifiers): */
79 	int		show_sequence_neighborhoodF;
80 
81 	/* Stereo flag (0 = draw mono image, 1 = draw stereo image): */
82 	int		stereoF;
83 
84 	/* Default slab mode flag (see the list above for possible values): */
85 	int		default_slab_modeI;
86 
87 	/* Default color fading mode (see above for possible modes): */
88 	int		default_fading_modeI;
89 
90 	/* If print_configF is 1, print configuration data to stdout: */
91 	int		print_configF;
92 
93 	/* If print_cursor_namesF is 1, print cursor names and exit: */
94 	int		print_cursor_namesF;
95 
96 	/* Light source position may be defined  using two angles. */
97 	/* The angle  light_theta  is defined relative  to z axis, */
98 	/* while light_phi is defined relative to x axis. Positive */
99 	/* values of light_phi are defined according to right-hand */
100 	/* rule if positive z axis  is rotation axis.  Ranges are: */
101 	/* light_theta from 0 to PI,  light_phi from  0 to 2 * PI. */
102 	double		light_theta;
103 	double		light_phi;
104 
105 	/* Light source unit vector: */
106 	VectorS		light_vectorS;
107 
108 	/* Strings specifying default colors for all windows: */
109 	char		bg_colorA[SHORTSTRINGSIZE];
110 	char		fg_colorA[SHORTSTRINGSIZE];
111 	char		text_bg_colorA[SHORTSTRINGSIZE];
112 	char		text_fg_colorA[SHORTSTRINGSIZE];
113 
114 	/* Default number of color fading surfaces: */
115 	int		default_surfacesN;
116 
117 	/* Strings specifying default basic colors for atoms and bonds: */
118 	char		left_colorAA[MAXCOLORSURFACES][SHORTSTRINGSIZE];
119 	char		middle_colorAA[MAXCOLORSURFACES][SHORTSTRINGSIZE];
120 	char		right_colorAA[MAXCOLORSURFACES][SHORTSTRINGSIZE];
121 
122 	/* Default basic colors (color structures) for atoms and bonds: */
123 	RGBS		left_rgbSA[MAXCOLORSURFACES];
124 	RGBS		middle_rgbSA[MAXCOLORSURFACES];
125 	RGBS		right_rgbSA[MAXCOLORSURFACES];
126 
127 	/* Default surface color schemes: */
128 	char		surface_outer_color_schemeA[SHORTSTRINGSIZE];
129 	char		surface_inner_color_schemeA[SHORTSTRINGSIZE];
130 
131 	/* Six default colors for the outer side of the surface: */
132 	RGBS		out_left_near_rgbS;
133 	RGBS		out_middle_near_rgbS;
134 	RGBS		out_right_near_rgbS;
135 	RGBS		out_left_far_rgbS;
136 	RGBS		out_middle_far_rgbS;
137 	RGBS		out_right_far_rgbS;
138 
139 	/* Six default colors for the inner side of the surface: */
140 	RGBS		in_left_near_rgbS;
141 	RGBS		in_middle_near_rgbS;
142 	RGBS		in_right_near_rgbS;
143 	RGBS		in_left_far_rgbS;
144 	RGBS		in_middle_far_rgbS;
145 	RGBS		in_right_far_rgbS;
146 
147 	/* Default drawing styles for atoms, bonds and backbone: */
148 	int		default_atom_styleI;
149 	int		default_bond_styleI;
150 	int		default_backbone_styleI;
151 
152 	/* Bond length parameters: */
153 	double		max_bond_length;	  /* In angstroms */
154 	double		C_C_bond_length_min;      /* carbon-carbon */
155 	double		C_C_bond_length_max;
156 	double		C_N_bond_length_min;	  /* carbon-nitrogen */
157 	double		C_N_bond_length_max;
158 	double		C_O_bond_length_min;	  /* carbon-oxygen */
159 	double		C_O_bond_length_max;
160 	double		C_S_bond_length_min;	  /* carbon-sulfur */
161 	double		C_S_bond_length_max;
162 	double		C_H_bond_length_min;      /* carbon-hydrogen */
163 	double		C_H_bond_length_max;
164 	double		N_O_bond_length_min;	  /* nitrogen-oxygen */
165 	double		N_O_bond_length_max;
166 	double		N_H_bond_length_min;      /* nitrogen-hydrogen */
167 	double		N_H_bond_length_max;
168 	double		O_H_bond_length_min;	  /* oxygen-hydrogen */
169 	double		O_H_bond_length_max;
170 	double		S_H_bond_length_min;	  /* sulfur-hydrogen */
171 	double		S_H_bond_length_max;
172 	double		O_P_bond_length_min;	  /* oxygen-phosphorus */
173 	double		O_P_bond_length_max;
174 	double		S_S_bond_length_min;	  /* sulfur-sulfur (disulf.) */
175 	double		S_S_bond_length_max;
176 	double		generic_bond_length_min;  /* unrecognized bond */
177 	double		generic_bond_length_max;
178 	double		hydro_bond_length_min;	  /* hydrogen bond */
179 	double		hydro_bond_length_max;
180 	double		hydro_bond_angle_min;
181 	double		hydro_bond_angle_max;
182 
183 	/* The calculated (practical) bond length parameters: */
184 	double		C_C_min_squared;
185 	double		C_C_max_squared;
186         double		C_N_min_squared;
187         double		C_N_max_squared;
188         double		C_O_min_squared;
189         double		C_O_max_squared;
190         double		C_S_min_squared;
191         double		C_S_max_squared;
192 	double		C_H_min_squared;
193 	double		C_H_max_squared;
194 	double		N_O_min_squared;
195 	double		N_O_max_squared;
196 	double		N_H_min_squared;
197 	double		N_H_max_squared;
198 	double		O_H_min_squared;
199 	double		O_H_max_squared;
200 	double		S_H_min_squared;
201 	double		S_H_max_squared;
202 	double		O_P_min_squared;
203 	double		O_P_max_squared;
204 	double		S_S_min_squared;
205 	double		S_S_max_squared;
206 	double		generic_min_squared;
207 	double		generic_max_squared;
208 	double		hydro_min_squared;
209 	double		hydro_max_squared;
210 
211 	/* The maximal CA-CA distance, for two neighbouring residues: */
212 	double		CA_CA_dist_max;
213 	double		CA_CA_dist_max_squared;
214 
215 	/* Atomic radii (in angstroms): */
216 	double		H_radius;
217 	double		C_radius;
218 	double		N_radius;
219 	double		O_radius;
220 	double		S_radius;
221 	double		P_radius;
222 	double		generic_radius;
223 
224 	/* Covalent radii (in angstroms): */
225 	double		H_covalent_radius;
226 	double		C_covalent_radius;
227 	double		N_covalent_radius;
228 	double		O_covalent_radius;
229 	double		S_covalent_radius;
230 	double		P_covalent_radius;
231 	double		generic_covalent_radius;
232 
233 	/* Small radii (in angstroms): */
234 	double		H_small_radius;
235 	double		C_small_radius;
236 	double		N_small_radius;
237 	double		O_small_radius;
238 	double		S_small_radius;
239 	double		P_small_radius;
240 	double		generic_small_radius;
241 
242 	/* van der Waals radii (in angstroms): */
243 	double		H_van_der_Waals_radius;
244 	double		C_van_der_Waals_radius;
245 	double		N_van_der_Waals_radius;
246 	double		O_van_der_Waals_radius;
247 	double		S_van_der_Waals_radius;
248 	double		P_van_der_Waals_radius;
249 	double		generic_van_der_Waals_radius;
250 
251 	/* Ball radius (used to draw balls and sticks): */
252 	double		default_ball_radius;
253 
254 	/* Default bond probe radius (used to draw nice bonds): */
255 	double		default_bond_probe_radius;
256 
257 	/* Default stick radius (used to draw bonds as sticks): */
258 	double		default_stick_radius;
259 
260 	/* Number of neighbors  which should  be checked as */
261 	/* bond candidates; both values should be positive: */
262 	int		bond_candidates_backward;
263 	int		bond_candidates_forward;
264 
265 	/* Miscelaneous geometric parameters, related to drawing: */
266 	int		main_margin_left;
267 	int		main_margin_right;
268 	int		main_margin_top;
269 	int		main_margin_bottom;
270 	int		max_main_win_width;
271 	int		max_main_win_height;
272 	int		nearest_line_thickness;
273 	double		screen_real_width;
274 	double		screen_real_height;
275 	double		user_screen_real_distance;
276 	double		screen_atomic_width;
277 	double		user_atomic_position;
278 	int		stereo_screen_margin;   /* Screen units */
279 	double		stereo_angle;		/* radians, not degrees */
280 	double		rotation_stepA[5];
281 	double		translation_stepA[5];
282 	double		slab_stepA[5];
283 	double		fading_stepA[5];
284 
285 	/* Parameters calculated from geometric data. Used */
286 	/* to reduce the number of mathematical operations */
287 	/* required to  project raw coordinates to screen. */
288 	/* The rationalized_x0 and other rationalized data */
289 	/* are used to identify atoms  which are invisible */
290 	/* and whose bonds are invisible  (out of window). */
291 	double		user_screen_atomic_distance;
292 	double		screen_atomic_height;
293 	double		screen_atomic_z;
294 	double		atomic_to_screen_scale_x;
295 	double		atomic_to_screen_scale_y;
296 	double		screen_to_atomic_scale_x;
297 	double		win_atomic_free_width;
298 	double		win_atomic_free_height;
299 	double		win_atomic_x0;		/* Window left edge (mono) */
300 	double		win_atomic_y0;		/* Top edge */
301 	double		win_atomic_z0;		/* Screen and window z value */
302 	double		win_atomic_x1;		/* Right edge */
303 	double		win_atomic_y1;		/* Bottom edge */
304 	double		rationalized_x0;
305 	double		rationalized_y0;
306 	double		rationalized_x1;
307 	double		rationalized_y1;
308 	double		stereo_atomic_margin;
309 	int		center_screen_x[2];	/* ..._x[0] is the left one */
310 	int		center_screen_y;
311 	int		image_screen_x0[2];	/* Image extent */
312 	int		image_screen_x1[2];
313 	int		image_screen_y0;
314 	int		image_screen_y1;
315 
316 	/* Blur rectangle default width and height: */
317 	int		blur_default_width;
318 	int		blur_default_height;
319 
320 	} ConfigS;
321 
322 
323 /* Structure with the most important window data: */
324 
325 typedef struct		/* WindowS */
326 	{
327 	Window		ID;
328 	int		x0;
329 	int		y0;
330 	unsigned int	width;
331 	unsigned int	height;
332 	int		border_width;
333 	XSizeHints	size_hintsS;
334 	unsigned int	colorsN;
335 	RGBS		bg_rgbS;
336 	unsigned long	bg_colorID;
337 	RGBS		fg_rgbS;
338 	unsigned long	fg_colorID;
339 	int		pixmapF;             /* 0 = created, 1 = not created */
340 	Pixmap		pixmapID;
341 	int		fontF;                 /* 0 = not loaded, 1 = loaded */
342 	int		font_height;
343 	int		half_font_height;
344 	int		quarter_font_height;
345 	int		text_line_height;
346 	XFontStruct	*fontSP;
347 	int		cursorF;             /* 0 = not created, 1 = created */
348 	Cursor		cursorID;
349 
350 	} WindowS;
351 
352 
353 /* Structure needed to store GUI data: */
354 
355 typedef struct		/* GUIS */
356 	{
357 	/* Main window refresh flag (0 = do not refresh, 1 = refresh): */
358 	int		main_window_refreshF;
359 
360 	/*-----------------------------------*/
361 	/* Main window drawing mode index:   */
362 	/*-----------------------------------*/
363 	/* 0             structure           */
364 	/* 1             Ramachandran plot   */
365 	/* 2             helical wheel       */
366 	/* 3             Venn diagram        */
367 	/* 4             plots (hydrophob.)  */
368 	/* 5             sequence comparison */
369 	/*-----------------------------------*/
370 	int		main_window_modeI;
371 
372 	/* Docking flag (0 = docking mode off, 1 = docking mode on) */
373 	int		dockingF;
374 
375 	/* Display data: */
376 	char		*display_nameP;
377 	char		display_nameA[STRINGSIZE];
378 	Display		*displaySP;
379 
380 	/* Screen data: */
381 	int		screenID;
382 	unsigned int	screen_width;
383 	unsigned int	screen_height;
384 
385 	/* Flags reserved for keyboard modifiers (0 = not pressed): */
386 	int		shift_pressedF;
387 	int		control_pressedF;
388 	int		alt_pressedF;
389 
390 	/* Data describing display color capabilities: */
391 	int		depth;
392 	XVisualInfo	visual_infoS;
393 	Visual		*visualSP;
394 	Colormap	colormapID;
395 
396 	/* Data for fast TrueColor color allocation: */
397 	int		red_right_shift;
398 	int		red_left_shift;
399 	int		green_right_shift;
400 	int		green_left_shift;
401 	int		blue_right_shift;
402 	int		blue_left_shift;
403 
404 	/* The main hidden pixmap.  Drawing is done to a hidden pixmap */
405 	/* which resides on the server side.  Another approach will be */
406 	/* to use an XImage on the client side. An experiment was made */
407 	/* to compare two approaches,  using XFree86 implementation of */
408 	/* X11 window system. The XImage-based method was twice faster */
409 	/* if both client and server run on the same machine. However, */
410 	/* the hidden pixmap method was choosen because it offers much */
411 	/* larger set of  drawing routines  (rectangles,  arcs  etc.). */
412 	int		main_hidden_pixmapF;
413 	Pixmap		main_hidden_pixmapID;
414 
415 	/* The hidden pixmap with small blue arrows. These arrows are used */
416 	/* to show the main chain direction,  projected to the  XY  plane. */
417 	int		small_arrows_pixmapF;
418 	unsigned int	small_arrows_width;
419 	unsigned int	small_arrows_height;
420 	Pixmap		small_arrows_pixmapID;
421 
422 	/* Array of graphics contexts: */
423 	GC		theGCA[10];
424 	int		gca_createdF;
425 
426 	/* Window manager hints: */
427 	XWMHints	wm_hintsS;
428 
429 	/* Main window data: */
430 	WindowS		main_winS;
431 	unsigned int	main_win_free_area_width;
432 	unsigned int	main_win_free_area_height;
433 
434 	/* Icon data: */
435 	WindowS		icon_winS;
436 
437 	/* Data required for control window: */
438 	WindowS		control_winS;
439 
440 	/* Data required for text input window: */
441 	WindowS		input_winS;
442 
443 	/* Data required for text output window: */
444 	WindowS		output_winS;
445 
446 	/* Data required for docking window: */
447 	int		docking_window_createdF;
448 	int		docking_window_mappedF;
449 	WindowS		docking_winS;
450 
451 	/* Data required for docking icon window: */
452 	WindowS		docking_icon_winS;
453 
454 	/* Atoms related to window manager: */
455 	Atom		delete_window_atom;
456 	Atom		protocols_atom;
457 
458 	/* Eighteen auxiliary colors: */
459 	unsigned long	black_colorID;
460 	unsigned long	gray_colorID;
461 	unsigned long	dark_gray_colorID;
462 	unsigned long	white_colorID;
463 	unsigned long	red_colorID;
464 	unsigned long	dark_red_colorID;
465 	unsigned long	green_colorID;
466 	unsigned long	dark_green_colorID;
467 	unsigned long	blue_colorID;
468 	unsigned long	dark_blue_colorID;
469 	unsigned long	yellow_colorID;
470 	unsigned long	dark_yellow_colorID;
471 	unsigned long	cyan_colorID;
472 	unsigned long	dark_cyan_colorID;
473 	unsigned long	magenta_colorID;
474 	unsigned long	dark_magenta_colorID;
475 	unsigned long	orange_colorID;
476 	unsigned long	dark_orange_colorID;
477 
478 	} GUIS;
479 
480 
481 /* Raw atomic data structure:  it stores atomic data read from PDB file. */
482 /* Each  molecular complex is  a set  of atoms;  the atomic  information */
483 /* is the most  important information about  molecular complex.  Residue */
484 /* information is  not considered to be of such  importance to group all */
485 /* atoms beloging to the same  residue into a special  structure, though */
486 /* this approach is  also possible.  As amino acids,  residues,  nucleic */
487 /* bases, detergents and other molecules  (commonly called residues) are */
488 /* quite different in size (number of atoms),  grouping AtomS structures */
489 /* into residue structures will lead to inefficient usage of the memory. */
490 
491 typedef struct		/* RawAtomS */
492 	{
493 	/* Hetero-flag (0 = ATOM, 1 = HETATM): */
494 	int		heteroF;
495 
496 	/* Data contained in PDB ATOM and HETATM records: */
497 	int		serialI;
498 	char		atom_nameA[ATOMNAMESIZE];	  /* With spaces */
499 	char		pure_atom_nameA[ATOMNAMESIZE]; /* Without spaces */
500 	char		chemical_symbolA[SYMBOLSIZE]; /* Right justified */
501 	char		remoteness_indicator;		   /* Alphabetic */
502 	char		branch_designator;		      /* Numeric */
503 	char		alt_location;
504 	char		residue_nameA[RESNAMESIZE];       /* With spaces */
505 	char		pure_residue_nameA[RESNAMESIZE];   /* Without s. */
506 	char		chainID;
507 	int		residue_sequenceI;
508 	char		residue_insertion_code;
509 	double		x[2];		/* Stereo: x[0] left, x[1] right */
510 	double		y;		/* x[0] is  read  from  PDB file */
511 	double		z[2];		/* x[1] is calculated  from x[0] */
512 	int		screen_x[2];	     /* Projection to the screen */
513 	int		screen_y;
514 	double		occupancy;
515 	double		temperature_factor;
516 
517 	/* Be careful with the remaining fields: older PDB files */
518 	/* contain some other data after the temperature factor: */
519 	char		segmentA[SEGNAMESIZE];
520 	char		elementA[ELEMNAMESIZE];           /* With spaces */
521 	char		pure_elementA[ELEMNAMESIZE];   /* Without spaces */
522 	char		chargeA[CHARGESIZE];
523 
524 	/* SIGATM, ANISOU and SIGUIJ fields not implemented at present! */
525 	/* Maybe some time later ... */
526 
527 	/* Model identifier (important for NMR structures): */
528 	int		model_serialI;
529 
530 	/* Data below this line are not covered by PDB: */
531 
532 	/* Style index: */
533 	int		atom_styleI;
534 
535 	/* Atomic radius: */
536 	double		radius;
537 
538 	/* Covalent radius: */
539 	double		covalent_radius;
540 
541 	/* Small radius: */
542 	double		small_radius;
543 
544 	/* van der Waals radius: */
545 	double		van_der_Waals_radius;
546 
547 	/* Ball radius, used to draw atoms as balls. */
548 	double		ball_radius;
549 
550 	/* Additional data: */
551 	double		hydrophobicity;
552 	double		special_value;         /* Since version 1.2 */
553 
554 	} RawAtomS;
555 
556 
557 /* True bond structure; it contains data about real chemical */
558 /* bond. Atomic pair ID's may be found in check_dist.c file. */
559 
560 typedef struct		/* TrueBondS */
561 	{
562 	/* Style index (0 = nothing to draw): */
563 	int		bond_styleI;
564 
565 	/* Bond ID (see check_dist.c for detailed information): */
566 	int		pairID;
567 
568 	/* Bond type:     */
569 	/*  1 = covalent  */
570 	/*  0 = hydrogen  */
571 	/*  2 = disulfide */
572 	/* 11 = pseudo    */
573 	int		bond_typeI;
574 
575 	/* Neighboring atom specification: */
576 	int		neighbor_mol_complexI;
577 	size_t		neighbor_arrayI;
578 
579 	/* Bond length: */
580 	double		bond_length;
581 
582 	} TrueBondS;
583 
584 
585 /* Atomic data structure; it contains raw atomic data and data */
586 /* about bonds.  The same basic colors are used both for given */
587 /* atom and  all bonds  associated with  this atom.  If one or */
588 /* more bonds should be colored differently,  try some special */
589 /* tricks.  For example,  it may be interesting to color bonds */
590 /* according to  bond  length  (red too close,  blue too far). */
591 /* Normally,  hydrogen  bonds should be  drawn using  the same */
592 /* basic colors and  the same  drawing style  for all hydrogen */
593 /* bonds.  These colors should be stored elsewhere,  not here. */
594 /*-------------------------------------------------------------*/
595 /* Flags:                                                      */
596 /*-------------------------------------------------------------*/
597 /* selectedF        Equal to 1 if atom is currently  selected. */
598 /* hiddenF          Equal to 1 if atom is hideen, 0 otherwise. */
599 /* inside_slabF     Depends on slab: visible atoms are inside. */
600 /* in_windowF       Some atoms may  fall outside  main window. */
601 /*-------------------------------------------------------------*/
602 
603 typedef struct		/* AtomS */
604 	{
605 	/* Selection flag (current and previous): */
606 	int		selectedF;
607 	int		previous_selectedF;
608 
609 	/* Visibility flags (read Note 4 in main_expose.c): */
610 	int		hiddenF;
611 	int		inside_slabF;
612 	int		inside_windowF;
613 
614 	/* Additional visibility flag, used only in ControlRefresh_ (): */
615 	int		inside_projected_slabF;
616 
617 	/* Label flag (1 = write label): */
618 	int		labelF;
619 
620 	/* Auxiliary index (used to recognize rings, for example). */
621 	/* Do not forget  to reset  this index  before  every use! */
622 	int		auxiliaryI;
623 
624 	/* The number of color fading surfaces: */
625 	int		surfacesN;
626 
627 	/* Basic colors, used both for atom and its bonds. */
628 	/* Used to prepare the  atom_colorID  for drawing. */
629 	RGBS		left_rgbSA[MAXCOLORSURFACES];
630 	RGBS		middle_rgbSA[MAXCOLORSURFACES];
631 	RGBS		right_rgbSA[MAXCOLORSURFACES];
632 
633 	/* Atom color ID's (used for drawing): */
634 	unsigned long	left_colorID;
635 	unsigned long	middle_colorID;
636 	unsigned long	right_colorID;
637 
638 	/* Array index of the residue to which this atom belongs: */
639 	size_t		residue_arrayI;
640 
641 	/* Raw atomic data (atom without bonds): */
642 	RawAtomS	raw_atomS;
643 
644 	/* Bonds: */
645 	int		bondsN;
646 	TrueBondS	true_bondSA[MAXBONDS];
647 
648 	} AtomS;
649 
650 
651 /* Structure for  macromolecular  complex  header data (text). */
652 /* Header is divided into six subsets:  header, title, compnd, */
653 /* source, expdta, author.  Each subset is  defined by  offset */
654 /* and number of lines. A total number of lines is stored too. */
655 
656 typedef struct		/* HeaderS */
657 	{
658 	char		*dataP;
659 	int		total_linesN;
660 	int		header_linesN;
661 	int		header_offset;
662 	int		title_linesN;
663 	int		title_offset;
664 	int		compnd_linesN;
665 	int		compnd_offset;
666 	int		source_linesN;
667 	int		source_offset;
668 	int		expdta_linesN;
669 	int		expdta_offset;
670 	int		author_linesN;
671 	int		author_offset;
672 
673 	} HeaderS;
674 
675 
676 /* Backbone structure, used to store information about CA atoms. */
677 
678 typedef struct		/* BackboneS */
679 	{
680 	int		hiddenF;
681 	size_t		c_alphaI;
682 	int		backbone_styleI;
683 	int		previous_c_alphaF;
684 	size_t		previous_c_alphaI;
685 	int		next_c_alphaF;
686 	size_t		next_c_alphaI;
687 
688 	} BackboneS;
689 
690 
691 /* Residue structure, used to store sequence */
692 /* info, dihedral angles and cis-trans flag. */
693 
694 typedef struct		/* ResidueS */
695 	{
696 	size_t		residue_startI;
697 	size_t		residue_endI;
698 	double		phi;
699 	double		psi;
700 	double		omega;
701 	int		cis_transF; /* 0 = bad/undefined, 1 = trans, 2 = cis */
702 	double		chi1;
703 	double		chi2;
704 	double		chi3;
705 	double		chi4;
706 	double		chi5;
707 
708 	} ResidueS;
709 
710 
711 /* Plane structure defines  the plane associated  with a given macromol. */
712 /* complex.  The plane is represented  by a circle and  defined by plane */
713 /* center,  normal vector  and  circle radius.  Projected to the screen, */
714 /* plane looks like a tilted ellipse.  The angle normal_phi is the angle */
715 /* between x axis and  the projection of  the normal vector to xy plane. */
716 /* It is equal to zero if the projection is parallel to x axis. Positive */
717 /* direction is clockwise.  The angle normal_theta  is the angle between */
718 /* the normal vector and z axis. The value is zero if they are parallel. */
719 /* Half axis  a and  b are given in screen units  but stored as doubles. */
720 
721 typedef struct		/* PlaneS */
722 	{
723 	int		hiddenF;           /* 0 = visible, 1 = unvisible */
724 	int		visible_sideI[2];  /* 0 = top, 1 = bottom */
725 	double		center_x[2];       /* Atomic units */
726 	double		center_y;
727 	double		center_z[2];
728 	int		center_screen_x[2];
729 	int		center_screen_y;
730 	double		normal_x[2];
731 	double		normal_y;
732 	double		normal_z[2];
733 	double		circle_radius;     /* Circle radius  in atomic units */
734 	double		screen_a;          /* Large half-axis of the ellipse */
735 	double		screen_b[2];       /* Small half-axis of the ellipse */
736 	double		normal_theta[2];   /* See definition above. */
737 	double		normal_phi[2];     /* See definition above. */
738 	RGBS		top_near_rgbS;     /* Top side  near color */
739 	RGBS		top_far_rgbS;      /* Top side  far  color */
740 	RGBS		bottom_near_rgbS;  /* Bottom s. near color */
741 	RGBS		bottom_far_rgbS;   /* Bottom s. far  color */
742 	unsigned long	top_near_colorID;
743 	unsigned long	top_far_colorID;
744 	unsigned long	bottom_near_colorID;
745 	unsigned long	bottom_far_colorID;
746 	double		transparency;     /* 0.0 = opaque, 1.0 = transparent */
747 
748 	} PlaneS;
749 
750 
751 /* Membrane structure defines  the membrane associated with a given */
752 /* macromolecular complex.  Due to  the thermal  motion,  it is not */
753 /* possible to define the inner and the outer edge of the membrane. */
754 /* However,  the representation which uses two planes to define the */
755 /* membrane is very popular. Do not forget that this is a bad idea. */
756 
757 typedef struct		/* MembraneS */
758 	{
759 	int		definedF;       /* 0 = missing, 1 = defined */
760 	int		hiddenF;      /* 0 = visible, 1 = unvisible */
761 	double		center_x;                   /* Atomic units */
762 	double		center_y;
763 	double		center_z;
764 	double		thickness;                 /* In angstroms. */
765 	PlaneS		plane1S;
766 	PlaneS		plane2S;
767 
768 	} MembraneS;
769 
770 
771 /* Dot structure is used  to define the surface.  The surfaces are */
772 /* treated as sets of dots, with some common properties.  A single */
773 /* dot on  a given surface is  defined by  the radius vector,  the */
774 /* unit (normal) vector, two flags and a set of twelve colors. Six */
775 /* outside colors are used if the projection of  the normal vector */
776 /* to z axis is negative, i.e. if the outer side of the surface at */
777 /* the given point is on observer's side. Six inside (rear) colors */
778 /* are used if the normal vector has a positive z component,  i.e. */
779 /* if the observer sees  the inner side of  the surface.  A single */
780 /* transparency value  is used for  all dots at  the same surface. */
781 
782 typedef struct		/* DotS */
783 	{
784 	/* Radius vector and unit vector normal to the surface: */
785 	VectorS		radius_vectorS;
786 	VectorS		normal_vectorS;
787 
788 	/* Six colors for the outer side of the surface: */
789 	RGBS		out_left_near_rgbS;
790 	RGBS		out_middle_near_rgbS;
791 	RGBS		out_right_near_rgbS;
792 	RGBS		out_left_far_rgbS;
793 	RGBS		out_middle_far_rgbS;
794 	RGBS		out_right_far_rgbS;
795 
796 	/* Six colors for the inner side of the surface: */
797 	RGBS		in_left_near_rgbS;
798 	RGBS		in_middle_near_rgbS;
799 	RGBS		in_right_near_rgbS;
800 	RGBS		in_left_far_rgbS;
801 	RGBS		in_middle_far_rgbS;
802 	RGBS		in_right_far_rgbS;
803 
804 	/* Selection flag (0 = dot is not selected, 1 = dot is selected): */
805 	char		selectedF;
806 
807 	/* Hide flag (0 = dot is visible, 1 = dot is hidden): */
808 	char		hiddenF;
809 
810 	/* The array index of  the macromolecular complex  and  the */
811 	/* array index of the atom to which this dot belongs (These */
812 	/* data are required if using  CPK color scheme  for dots): */
813 	int		mol_complexI;
814 	size_t		atomI;
815 
816 	} DotS;
817 
818 
819 /* Surface structure is used to define the molecular surface. It is */
820 /* possible to associate  more than one surface with a given molec. */
821 /* structure (the maximal number is MAXMOLSURFACES, see defines.h). */
822 /* Each surface is a finite set of dots (see DotS structure above), */
823 /* with a number of common properties, like transparency and color. */
824 /* If the number of dots for a given surface  (dotsN) is zero,  the */
825 /* surface is not defined (used) and  the storage is not allocated. */
826 /* Take care about  dotsN and storage when discarding some surface! */
827 
828 typedef struct		/* SurfaceS */
829 	{
830 	/* Number of dots and pointer to the storage: */
831 	int		dotsN;
832 	DotS		*dotSP;
833 
834 	int		hiddenF; /* 0 = visible, 1 = hidden; this flag */
835 				 /* overrides flags of individual dots */
836 
837 	/* Surface transparency mode index.        */
838 	/*-----------------------------------------*/
839 	/* 0 = Default mode (uniform transparency) */
840 	/* 1 = Transparency depends on the angle   */
841 	/*     between the unit vector and z axis  */
842 	/*-----------------------------------------*/
843 	int		transparency_modeI;
844 
845 	/* Surface transparency value: */
846 	double		transparency;
847 
848 	/* The surface probe radius. This probe radius is used */
849 	/* to generate  the surface.  Do not  confuse it  with */
850 	/* the probe radius  which is used to draw nice bonds! */
851 	double		surface_probe_radius;
852 
853 	} SurfaceS;
854 
855 
856 /* Structure which contains molecular complex data (proteins, DNA). */
857 /* Each  molecular complex is  a set  of atoms.  The fact that each */
858 /* molecular complex is made of building blocks called  residues is */
859 /* not very important for this program,  as atoms are considered to */
860 /* be  the  basic  building  blocks.  Atomic data  are stored  into */
861 /* dynamically  allocated  memory.  Reallocation  mechanism must be */
862 /* ensured  as the  molecular complex size  is not known in advance */
863 /* and large insertions into the structure are allowed  at runtime. */
864 
865 typedef struct		/* MolComplexS */
866 	{
867 	/* Macromolecular complex identifier: */
868 	int		mol_complexID;
869 
870 	/* Unique PDB identifier: */
871 	char		unique_PDB_codeA[PDBCODESIZE];
872 
873 	/* Tag associated with the complex: */
874 	int		tagF;
875 	char		tagA[TAGSIZE];
876 
877 	/* File name: */
878 	char		file_nameA[STRINGSIZE];
879 
880 	/* Catch flag; if equal to one, the movement, slab and */
881 	/* fading controls affect  the macromolecular complex: */
882 	int		catchF;
883 
884 	/* Move bits;  structure,  plane and */
885 	/* envelope may be moved separately. */
886 	/* By default,  everything is moved. */
887 	/*-----------------------------------*/
888 	/* Bit:               If set to one: */
889 	/*-----------------------------------*/
890 	/* 1 (LSB)            Move structure */
891 	/* 2                  Move plane     */
892 	/* 3                  Move membrane  */
893 	/* 4                  Move envelope  */
894 	/*-----------------------------------*/
895 	int		move_bits;
896 
897 	/* Slab mode flag (each macromol. complex has its own): */
898 	int		slab_modeI;
899 
900 	/* Color fading mode flag (each complex has its own): */
901 	int		fading_modeI;
902 
903 	/* Flag used to signal that position or orientation changed: */
904 	int		position_changedF;
905 
906 	/* Geometric center position and spacial extent of the object. */
907 	/* Note: spacial extent is very approximate, calculated at the */
908 	/* very beginning.  It is used to set  the initial slab width. */
909 	VectorS		geometric_center_vectorS;
910 	VectorS		left_top_near_vectorS;
911 	VectorS		right_bottom_far_vectorS;
912 
913 	/* The maximal extent (the largest dimension): */
914 	double		max_extent;
915 
916 	/* Rotation center position: */
917 	VectorS		rotation_center_vectorS;
918 
919 	/* The storage which is used  to backup the rotation */
920 	/* center position if  the macromolecular complex is */
921 	/* taking part  in a group of complexes.  The stored */
922 	/* value is copied back when the group is dismissed. */
923 	VectorS		backup_vectorS;
924 
925 	/* Slab center position. It is used as the reference point for */
926 	/* planar slab, cylindrical slab and spherical slab.  The sym- */
927 	/* metry axis of  the cylindrical slab  is parallel to y-axis. */
928 	VectorS		slab_center_vectorS;
929 
930 	/* Parameters which define the relative positions */
931 	/* of slab surfaces  with respect to slab center. */
932 	double		slab_front_relative_position;
933 	double		slab_back_relative_position;
934 
935 	/* Color fading center.  Used in a similar way as slab center. */
936 	VectorS		fading_center_vectorS;
937 
938 	/* Parameters  which define  the relative  positions of */
939 	/* color fading surfaces with respect to fading center. */
940 	double		fading_front_relative_position;
941 	double		fading_back_relative_position;
942 
943 	/* Hydrophobicity scale index and reference */
944 	/* hydrophobicity values for a given scale: */
945 	int		hydrophobicity_scaleI;
946 	double		min_hydrophobicity;    /* Extreme values for current */
947 	double		max_hydrophobicity;    /* scale, not for the complex */
948 	double		average_hydrophobicity;
949 	double		threshold_hydrophobicity;
950 
951 	/* Information header: */
952 	HeaderS		headerS;    /* Contains pointer to alloc. storage! */
953 
954 	/* Atoms: */
955 	size_t		atomsN;     /* Number of atoms in a complex */
956 	size_t		max_atomsN;
957 	AtomS		*atomSP;
958 
959 	/* Backbone: */
960 	size_t		c_alphaN;
961 	BackboneS	*backboneSP;
962 
963 	/* Sequence, dihedral angles,  cis-trans */
964 	/* flags and sec. structure information: */
965 	size_t		residuesN;
966 	ResidueS	*residueSP;
967 	char		*secondary_structureP;
968 
969 	/* Plane: */
970 	PlaneS		planeS;
971 
972 	/* Membrane: */
973 	MembraneS	membraneS;
974 
975 	/* A number of surfaces associated with the structure: */
976 	SurfaceS	surfaceSA[MAXMOLSURFACES];
977 
978 	/* Two flags related to  hydrogen bonds.  The first flag gives the */
979 	/* status of hydrogen bonds  (0 = missing or obsolete, 1 = valid). */
980 	/* The second flag is equal to zero if hydrogen bonds are visible. */
981 	int		hydrogen_bondsF;
982 	int		hydrogen_bonds_hiddenF;
983 
984 	/* Bond probe radius.  Each structure has  its own  probe radius. */
985 	/* Do not confuse this probe with the probe used for the surface. */
986 	double		bond_probe_radius;
987 
988 	/* Stick radius, used to draw bonds as sticks. Each structure has */
989 	/* its own stick radius.  A single radius is used  for all bonds. */
990 	double		stick_radius;
991 
992 	/* Group member flag. Zero for independent structures, */
993 	/* one for all structures which are forming the group. */
994 	int		group_memberF;
995 
996 	} MolComplexS;
997 
998 
999 /* NearestAtomS is used to store data about the nearest atom for a given */
1000 /* pixel of the main window  (excluding control, input and output win.). */
1001 /* Each time  the macromolecular complexes are drawn to the main window, */
1002 /* the fact that some atoms are closer to  the observer than other atoms */
1003 /* must be taken into account. Both complex array index and  atom serial */
1004 /* number are stored.  If some atoms are  inserted or deleted in  one or */
1005 /* more macromolecular complexes,  NearestAtomS has to be reinitialized. */
1006 /* Unvisible atoms are not taken into account while comparing distances. */
1007 /* Because NearestAtomS is used, there is no need to sort atoms by dist. */
1008 /* The value of the refreshI must be in range between 1 and MAXREFRESHI. */
1009 /* If maximal value is exceeded,  reinitialize the  NearestAtomS  array. */
1010 /* The size of  NearestAtomS  should be checked after the main window is */
1011 /* resized.  The array should be reallocated if main window is enlarged. */
1012 /* Always check the column and  row index of a  given pixel,  as well as */
1013 /* the combined (array) index before using  NearestAtomS array elements. */
1014 /* In addition,  the NearestAtomS is also used  for sequence comparison. */
1015 /* The member bondI is zero or positive if the specified pixel is filled */
1016 /* by certain true bond and negative  if it is filled by something else. */
1017 
1018 typedef struct		/* NearestAtomS */
1019 	{
1020 	unsigned int	last_refreshI;
1021 	int		mol_complexI;
1022 	size_t		atomI;
1023 	int		bondI;
1024 	double		z;
1025 	int		styleI;
1026 	unsigned long	colorID;
1027 	int		auxiliaryI;
1028 
1029 	} NearestAtomS;
1030 
1031 
1032 /* Aux1S structure,  used to store some data and pointers required to */
1033 /* draw simple bonds. Bond drawing functions require many parameters. */
1034 /* Aux1S is used to reduce the number of arguments in function calls. */
1035 
1036 typedef struct		/* Aux1S */
1037 	{
1038 	int		imageI;
1039 	int		screen_x0;
1040 	int		screen_x1;
1041 	int		screen_delta_x;
1042 	int		screen_y0;
1043 	int		screen_y1;
1044 	int		screen_delta_y;
1045 	double		atomic_z0;
1046 	double		atomic_z1;
1047 	double		atomic_delta_z;
1048 	ConfigS		*configSP;
1049 	GUIS		*guiSP;
1050 	NearestAtomS	*nearest_atomSP;
1051 	size_t		pixelsN;
1052 	unsigned int	refreshI;
1053 	int		mol_complexI;
1054 	size_t		atomI;
1055 	unsigned long	colorIDA[10];
1056 
1057 	} Aux1S;
1058 
1059 
1060 /* Aux2S structure,  used to store  some data and */
1061 /* pointers required to draw nice (curved) bonds. */
1062 
1063 typedef struct		/* Aux2S */
1064 	{
1065 	int		imageI;
1066 	int		mol_complexI;
1067 	size_t		atomI;
1068 	int		bondI;
1069 	ConfigS		*configSP;
1070 	GUIS		*guiSP;
1071 	NearestAtomS	*nearest_atomSP;
1072 	size_t		pixelsN;
1073 	unsigned int	refreshI;
1074 	AtomS		*atom1SP;
1075 	AtomS		*atom2SP;
1076 	TrueBondS	*curr_bondSP;
1077 	double		bond_probe_radius;
1078 	double		stick_radius;
1079 
1080 	} Aux2S;
1081 
1082 
1083 /* ExposedResidueS structure,  with data about  exposed polar residue. */
1084 /* If excludedF is equal to one the exposed residue should be ignored. */
1085 
1086 typedef struct		/* ExposedResidueS */
1087 	{
1088 	int		excludedF;
1089 	int		donorI;   /* 0 = acceptor, 1 = donor, 2 = both */
1090 	size_t		representative_atomI;
1091 	char		pure_residue_nameA[RESNAMESIZE];
1092 	char		chainID;
1093 	int		residue_sequenceI;
1094 	char		residue_insertion_code;
1095 
1096 	} ExposedResidueS;
1097 
1098 
1099 /* BetaCellS structure, used to find the proper membrane position */
1100 /* and orientation  with respect to a given  beta barrel protein. */
1101 typedef struct		/* BetaCellS */
1102 	{
1103 	int		cell_usedF;
1104 	double		distance;
1105 	double		hydrophobicity;
1106 	int		cells_usedN;
1107 	int		average_calculatedF;
1108 	double		average_hydrophobicity;
1109 	} BetaCellS;
1110 
1111 
1112 /*---------------------------------------------------*/
1113 /* RuntimeS structure: a lot of run-time data.       */
1114 /*---------------------------------------------------*/
1115 /* click_modeI:                                      */
1116 /*---------------------------------------------------*/
1117 /*   0 = use clicks for distances and angles.        */
1118 /*   1 = use clicks to pick bond for editing.        */
1119 /*---------------------------------------------------*/
1120 /* edit_modeI:                                       */
1121 /*---------------------------------------------------*/
1122 /*   0 = default mode (no editing).                  */
1123 /*   1 = edit atom(s).                               */
1124 /*   2 = edit phi.                                   */
1125 /*   3 = edit psi.                                   */
1126 /*   4 = edit omega.                                 */
1127 /*   5 = edit main chain (edit phi and psi).         */
1128 /*   6 = edit bond.                                  */
1129 /*   7 = edit side chain (chi1 and chi2).            */
1130 /* 101 = edit dimensions of selected portion.        */
1131 /*---------------------------------------------------*/
1132 /* rama_selectionF:                                  */
1133 /*---------------------------------------------------*/
1134 /* 0 = draw Ramachandran plot for all residues.      */
1135 /* 1 = draw Ramachandran plot for selected residues. */
1136 /*---------------------------------------------------*/
1137 /* *disulfideFP:                                     */
1138 /*---------------------------------------------------*/
1139 /* 0 = not involved in disulfide bond.               */
1140 /* 1 = involved in disulfide bond.                   */
1141 /*---------------------------------------------------*/
1142 /* wheel_clockwiseF:                                 */
1143 /*---------------------------------------------------*/
1144 /* 0 = draw helical wheel anticlockwise (top view).  */
1145 /* 1 = draw helical wheel clockwise (bottom view).   */
1146 /*---------------------------------------------------*/
1147 /* groupF:                                           */
1148 /*---------------------------------------------------*/
1149 /* 0 = only 1 struct. is caught,  there is no group. */
1150 /* 1 = one, two or more structures are grouped.      */
1151 /*---------------------------------------------------*/
1152 
1153 typedef struct		/* RuntimeS */
1154 	{
1155 	int		click_modeI;
1156 	int		edit_modeI;
1157 	int		edit_single_bondF;
1158 	int		default_complexI;
1159 	int		scriptF;
1160 	int		pauseF;
1161 	int		rama_selectionF;
1162 	int		wheel_clockwiseF;
1163 	int		groupF;
1164 
1165 	char		*commandsP;                 /* History buffer */
1166 	int		next_commandI;
1167 	int		old_commandI;
1168 	int		highest_commandI;
1169 	char		curr_commandA[COMMSTRINGSIZE];
1170 	int		command_length;
1171 	int		carriage_position;
1172 	int		left_part_widthA[COMMSTRINGSIZE];
1173 	char		messageA[COMMSTRINGSIZE];
1174 	int		message_length;
1175 
1176 	int		title_hiddenF[MAXTITLES];
1177 	int		title_screen_x[MAXTITLES];
1178 	int		title_screen_y[MAXTITLES];
1179 	char		*titlesP;                   /* Buffer for titles     */
1180 
1181 	int		atom1_serialI;              /* Serial numbers of two */
1182 	int		atom2_serialI;              /* atoms which form bond */
1183 	size_t		atom1_arrayI;               /* Array indices of      */
1184 	size_t		atom2_arrayI;               /* these two atoms       */
1185 
1186 	int		hydrophobicity_scaleI;
1187 	double		helix_step_angle;         /* degrees   */
1188 	double		arc_angle;                /* degrees   */
1189 	double		sphere_radius;            /* angstroms */
1190 	int		sliding_window_width;     /* residues  */
1191 	int		average_hydrophobicityF;  /* Average hydrophobicity  */
1192 	int		weighted_hydrophobicityF; /* Weighted hydrophobicity */
1193 	int		hydrophobic_momentF;      /* Hydrophobic moment      */
1194 	int		sided_hydrophobicityF;    /* Two sided-h. functions  */
1195 	int		function1F;               /* 1 = draw function F1    */
1196 	int		function2F;               /* 1 = draw function F2    */
1197 	int		function3F;               /* 1 = draw function F3    */
1198 	int		function4F;               /* 1 = draw function F4    */
1199 	int		function5F;               /* 1 = draw function F5    */
1200 	int		function6F;               /* 1 = draw function F6    */
1201 	int		function7F;               /* 1 = draw function F7    */
1202 
1203 	size_t		sequence_buffer_size;       /* Size of seq. buffer   */
1204 	size_t		residuesN;                  /* Sequence length       */
1205 	char		*sequenceP;                 /* Main sequence buffer  */
1206 	char		*sec_structureP;            /* Secondary structure   */
1207 	int		sec_structure_length;       /* Number of codes       */
1208 	int		*disulfideFP;               /* S-S bond flags        */
1209 	int		*serialIP;                  /* Serial numbers        */
1210 	int		*residue_codeIP;            /* Numeric residue codes */
1211 	double		*hydrophobicityP;           /* Hydrophobicity values */
1212 	double		*weighted_hydrophobicityP;  /* Weighted hyd. values  */
1213 	double		*average_hydrophobicityP;   /* For given  win. width */
1214 	double		*hydrophobic_momentP;       /* Absolute value        */
1215 	double		*larger_sided_hyphobP;      /* Sided h.,  upper line */
1216 	double		*smaller_sided_hyphobP;     /* Sided h., bottom line */
1217 	double		*function1P;		    /* Hydroph. function F1  */
1218 	double		*function2P;                /* Hydroph. function F2  */
1219 	double		*function3P;                /* Hydroph. function F3  */
1220 	double		*function4P;                /* Hydroph. function F4  */
1221 	double		*function5P;                /* Hydroph. function F5  */
1222 	double		*function6P;                /* Hydroph. function F6  */
1223 	double		*function7P;                /* Hydroph. function F7  */
1224 
1225 	int		*auxiliaryIP;               /* Aux. integer storage  */
1226 	double		*aux_doubleP;               /* Aux. double storage   */
1227 
1228 	size_t		reference_residuesN;        /* Reference seq. length */
1229 	char		*reference_sequenceP;       /* Reference seq. buffer */
1230 	char		*reference_sec_structureP;  /* Refer. sec. structure */
1231 	int		reference_sec_str_length;   /* Number of codes       */
1232 	int		*reference_serialIP;        /* Ref. seq. ser. number */
1233 	int		*reference_residue_codeIP;  /* Numeric residue codes */
1234 	double		*reference_hydrophobicityP; /* Hydrophobicity values */
1235 
1236 	int		zoom_factor;                /* Zoom factor: 1, 2 ... */
1237 	int		sequence_offset;            /* Sequence offset       */
1238 	int		reference_offset;           /* Reference seq. offset */
1239 	int		segment_width;              /* Use to compare 2 seq. */
1240 	int		minimal_score;              /* Use to compare 2 seq. */
1241 
1242 	int		range_startI;             /* Residue range start     */
1243 	int		range_endI;               /* Residue range end       */
1244 
1245 	size_t		pattern_buffer_size;      /* Size of pattern buffer  */
1246 	size_t		pattern_length;           /* Number of positions     */
1247 	char		*patternP;                /* Pattern buffer          */
1248 	int		namesNA[MAX_PATT_LENGTH]; /* Residue names per pos.  */
1249 	int		residues_in_patternN;	  /* Total number of resid.  */
1250 	int		pattern_tolerance;	  /* Numb. of allowed errors */
1251 
1252 	MolComplexS	*mol_complex1SP;          /* Involved in docking     */
1253 	MolComplexS	*mol_complex2SP;          /* Involved in docking     */
1254 	double		docking_area_width;       /* angstroms               */
1255 	double		docking_cell_width;       /* angstroms               */
1256 	int		docking_matrix_width;     /* Cells across width      */
1257 	int		*exposed_atom1IP;         /* Involved in docking     */
1258 	int		*exposed_atom2IP;         /* Involved in docking     */
1259 	ExposedResidueS	*exposed_polar1SP;        /* Exposed polar, bottom   */
1260 	int		exposed_polar1N;          /* Number of e.p.r. bottom */
1261 	ExposedResidueS	*exposed_polar2SP;        /* Exposed polar, top      */
1262 	int		exposed_polar2N;          /* Number of e.p.r. top    */
1263 
1264 	int		template_atomsN;          /* Numb. of template atoms */
1265 	int		max_template_atomsN;      /* Max. n. of template at. */
1266 	AtomS		*template_atomSP;         /* Used to create peptides */
1267 	size_t		template_residuesN;       /* N. of template residues */
1268 	ResidueS	*template_residueSP;      /* Information  about res. */
1269 
1270 	int		blurF;			  /* 0 = blur off, 1 = on    */
1271 	int		blur_width;		  /* Width of blur rectangle */
1272 	int		blur_height;		  /* Height of blur rect.    */
1273 
1274 	int		beta_cellsN;		  /* Auxiliary cells used to */
1275 	BetaCellS	*beta_cellSP;		  /* find  membrane position */
1276 						  /* relative to beta barrel */
1277 
1278 	int		active_surfaceI;          /* For default  m. complex */
1279 
1280 	} RuntimeS;
1281 
1282 
1283 /* SelectS structure, with the selection criteria. */
1284 
1285 typedef struct		/* SelectS */
1286 	{
1287 	int		all_chainsF;
1288 	int		chainsN;
1289 	char		chainIDA[MAXFIELDS];
1290 	int		all_residue_serialF;
1291 	int		residue_serial_rangesN;
1292 	int		residue_serial_start[MAXFIELDS];
1293 	int		residue_serial_end[MAXFIELDS];
1294 	int		all_residue_namesF;
1295 	int		residue_namesN;
1296 	char		residue_nameAA[MAXFIELDS][RESNAMESIZE];
1297 	int		all_atom_namesF;
1298 	int		atom_namesN;
1299 	char		atom_nameAA[MAXFIELDS][ATOMNAMESIZE];
1300 
1301 	} SelectS;
1302 
1303 
1304 /* ButtonS structure, defines positions */
1305 /* of dummy buttons  in control window. */
1306 
1307 typedef struct		/* ButtonS */
1308 	{
1309 	int		left_edge;
1310 	int		right_edge;
1311 	int		top_edge;
1312 	int		bottom_edge;
1313 
1314 	} ButtonS;
1315 
1316 
1317 /* DockingS contains data required for docking. */
1318 
1319 typedef struct		/* DockingS */
1320 	{
1321 	MolComplexS	*mol_complex1SP;
1322 	MolComplexS	*mol_complex2SP;
1323 	double		docking_area_width;
1324 	} DockingS;
1325 
1326 
1327 /* That's all! */
1328 
1329 
1330