1 /*****
2 This file is part of the Babel Program
3 Copyright (C) 1992-96 W. Patrick Walters and Matthew T. Stahl
4 All Rights Reserved
5 
6 For more information please contact :
7 
8 babel@mercury.aichem.arizona.edu
9 --------------------------------------------------------------------------------
10 
11 FILE : bbl_types.h
12 AUTHOR(S) : Pat Walters
13 DATE : Constantly evolving
14 
15 ******/
16 
17 #ifndef __BABEL_BBLTYP_H__
18 #define __BABEL_BBLTYP_H__
19 
20 #include <stdio.h>
21 #include <string.h>
22 #include <ctype.h>
23 #include <stdarg.h>
24 #include <stdlib.h>
25 #include <math.h>
26 #include <assert.h>
27 #include "bblmacs.h"
28 
29 enum file_type {
30   none, mopac_cartesian, mopac_internal, mopac_output, macromodel,
31   mm2_output, pdb, csd_gstat, xyz, chemdraw,
32   idatm, mm2_input, alchemy, csd_cssr, free_fract,
33   mac_molecule, report, amber_prep, molin, boogie,
34   caccrt, ball_and_stick, chem3d1, chem3d2, micro_world,
35   molfile, gamess_output, gamess_input, mmads, diagnostics,
36   shelx, csd_fdat, charmm, gaussian_output,
37   gaussian_input, gaussian_cart, hyperchem_hin, biosym_car, cadpac,
38   cache_out, mm3, sybyl_mol, sybyl_mol2, spartan, quanta, molgen, wizard,
39   feature, pcmodel, spart_semi, cacao_int, fenske_zmat,spart_mm,
40   gaussian_template,bmin_com, conjure_tmplt, icon8, maccs, maccs2d,
41   maccs3d, xed, unixyz, isis, dock, dock_pdb, bgf, m3d,
42   psgvb_input, psgvb_output, psgvb_cart, psgvb_zmat,
43   csr, smiles, gaussian_94, torlist, schakal, mol_inventor,
44   gr96A,gr96N, tinker,box
45   };
46 
47 enum op_type {noaction, input, output};
48 
49 enum type_err {zero, dummy, all_caps};
50 
51 typedef struct
52 {
53   enum file_type type;
54   char *type_name;
55   char *code;
56   enum op_type operation;
57 #ifdef __cplusplus
58   int (*func)(FILE *fp,struct ums *mol);
59 #else
60   int (*func)();
61 #endif
62 } babel_rec;
63 
64 typedef char char3[3];
65 
66 typedef struct
67 {
68   int a,b,c,d;
69 } torsion_rec;
70 
71 typedef struct
72 {
73   int a,b,c;
74 } angle_rec;
75 
76 typedef struct
77 {
78   int setlen;
79   int *set;
80 } set_type;
81 
82 typedef struct
83 {
84   int number;
85   char name[3];
86   double cov_rad;
87   double bond_ord_rad;
88   double vdw_rad;
89   double bs_rad;
90   int max_bonds;
91   int color;
92   double red;
93   double green;
94   double blue;
95 } element_type;
96 
97 typedef struct
98 {
99   double x,y,z;
100 } coord_type;
101 
102 
103 typedef struct
104 {
105   coord_type point;
106   char type[5];
107   int max_bonds;
108   int valence;
109   int atomic_number;
110   int connected_atoms[MAX_CONNECTIONS];
111   int bond_order[MAX_CONNECTIONS];
112   double radius;
113   double bond_ord_rad;
114   double dble;
115   int organic;
116   int redo;
117   int pos[3];
118   double charge;
119   set_type *atm_set;
120 } atom_type;
121 
122 
123 typedef struct
124 {
125   int start;
126   int end;
127   int bond_order;
128 } connect_type;
129 
130 typedef struct
131 {
132   double r;
133   double w;
134   double t;
135 /*  int  n; */
136   int  na;
137   int  nb;
138   int  nc;
139 } int_type;
140 
141 typedef struct
142 {
143   char default_extension[BUFF_SIZE];
144   char base_name[BUFF_SIZE];
145   char infile_name[BUFF_SIZE];
146   char outfile_name[BUFF_SIZE];
147   char input_keywords[BUFF_SIZE];
148   char output_keywords[BUFF_SIZE];
149   char del_str[BUFF_SIZE];
150   babel_rec input_info;
151   babel_rec output_info;
152   int verbose;
153   int use_menus;
154   int do_add_hydrogens;
155   int do_delete_atoms;
156   int the_size;
157   int multi;
158   int lower_limit;
159   int upper_limit;
160   int spline;
161   int increment;
162   int renum;
163   int new_base;
164   int center;
165   int align;
166   int precipitate;
167   int new_file;
168   int calc_charges;
169   int orient;
170   int no_dummy;
171   int push_hydrogens;
172 } bbl_control;
173 
174 
175 
176 /*---------- structures for ring detection --- */
177 
178 typedef struct
179 {
180   int level;
181   int ancestor;
182 } spanning_tree;
183 
184 typedef struct
185 {
186   int length;
187   int bogus;
188   set_type *path_set;
189   int *path_atoms;
190   int closure;
191   int found;
192 } path;
193 
194 typedef struct
195 {
196   int count;
197   path *ring_list;
198 } ring_struct;
199 
200 
201 typedef struct
202 {
203   int num;
204   set_type *ring_atms;
205   set_type *arom_atms;
206   set_type *arom_rings;
207   set_type **rings;
208 } ring_info;
209 
210 /*--------------------------------------------*/
211 
212 
213 /*************
214 HUGEPTR as defined in the struct below is a maco
215 which defines HUGEPTR as the keyword huge when #define MSDOS
216 is present or as nothing when #define MSDOS is absent.  This is
217 necessary because of the lovely method Intel uses to segment memory.
218 
219 The macros are defined in bblmacs.h
220 PW - 072094
221 ****************/
222 
223 typedef struct
224 {
225   double A,B,C;
226   double Alpha,Beta,Gamma;
227 } fract_type;
228 
229 typedef struct
230 {
231   int serial_num;
232   int chain_num;
233   int res_num;
234   char res_type[6];
235   char atm_type[6];
236 } res_list;
237 
238 struct ums
239 {
240   bbl_control *control;
241   ring_struct *rings;
242   ring_info *ring_info;
243   char default_extension[20];
244   int num_atoms;
245   int num_bonds;
246   int num_connections_initialized;
247   int num_residues_initialized;
248   int num_internal_initialized;
249   char title[BUFF_SIZE];
250   double energy;
251   res_list HUGEPTR *residues;
252   atom_type HUGEPTR *atoms;
253   connect_type HUGEPTR *connections;
254   int_type HUGEPTR *internal;
255   fract_type HUGEPTR *fract;
256   struct ums *next;
257 };
258 typedef struct ums ums_type;
259 
260 /* structs for miniums functions */
261 
262 struct mini_ums_type
263 {
264   int num_atoms;
265   double energy;
266   coord_type *atoms;
267   struct mini_ums_type *next;
268 };
269 
270 typedef struct mini_ums_type mini_ums;
271 
272 typedef struct
273 {
274   int atom_number;
275   int heavy_atoms;
276 } heavy_rec;
277 
278 typedef struct
279 {
280   char name[8];
281   int number;
282 } pdb_type_rec;
283 
284 
285 typedef struct
286 {
287   char *text;
288   enum file_type type;
289   int keywords_required;
290 } menu_type;
291 
292 
293 typedef struct
294 {
295   double x,y,z;
296 } vect_type;
297 
298 
299 typedef struct
300 {
301   double a1, b1, c1;
302   double a2, b2, c2;
303   double a3, b3, c3;
304 } matrix_3x3;
305 
306 
307 typedef struct
308 {
309   double x;
310   double y;
311   double z;
312   int num;
313   double dist;
314 } temp_atom_rec;
315 
316 typedef char warning[80];
317 
318 typedef struct
319 {
320   char sym[10];
321   double val;
322 } zsymbol;
323 
324 typedef struct
325 {
326   int level;
327   int ancestor;
328   int kids;
329   int kid[MAX_CONNECTIONS];
330 } z_tree;
331 
332 
333 /* structure and macros for set operations */
334 #define SETWORD  32  /* platform dependant - should == sizeof(int) */
335 
336 #define LowBit(set, bit)\
337   {register int m;\
338    if (set != 0)\
339    {\
340       bit = 31;\
341       if (set != 0x80000000) {\
342       if (m = (set & 0x0000ffff)) {set = m; bit -= 16;}\
343       if (m = (set & 0x00ff00ff)) {set = m; bit -= 8;}\
344       if (m = (set & 0x0f0f0f0f)) {set = m; bit -= 4;}\
345       if (m = (set & 0x33333333)) {set = m; bit -= 2;}\
346       if (m = (set & 0x55555555)) {set = m; bit -= 1;}}}\
347    else bit = -1;}
348 
349 static int bitsoff[SETWORD] =
350 {
351 0xFFFFFFFF,0xFFFFFFFE,0xFFFFFFFC,0xFFFFFFF8,0xFFFFFFF0,0xFFFFFFE0,0xFFFFFFC0,
352 0xFFFFFF80,0xFFFFFF00,0xFFFFFE00,0xFFFFFC00,0xFFFFF800,0xFFFFF000,0xFFFFE000,
353 0xFFFFC000,0xFFFF8000,0xFFFF0000,0xFFFE0000,0xFFFC0000,0xFFF80000,0xFFF00000,
354 0xFFE00000,0xFFC00000,0xFF800000,0xFF000000,0xFE000000,0xFC000000,0xF8000000,
355 0xF0000000,0xE0000000,0xC0000000,0x80000000
356 };
357 
358 
359 #define biton(seta,member)   seta->set[(member / SETWORD)] |= \
360 (1 << (member % SETWORD));
361 
362 #define bitoff(seta,member)   seta->set[(member / SETWORD)] &= \
363 (~(1 << (member % SETWORD)));
364 
365 #define bit_is_on(seta,member) (seta->set[(member/SETWORD)]>>\
366                                 (member % SETWORD)&1)
367 
368 enum coord_state {linear, trigonal, tetrahedral, octahedral};
369 
370 typedef struct
371 {
372   int ptr;
373   int *bond;
374   int *choice;
375 } bnd_stack;
376 
377 typedef struct
378 {
379   double is,id,it,wsd,wdt;
380 } bnd_info;
381 
382 typedef struct
383 {
384   char atm_typ[3];
385   double a,b,c,d;
386 } gast_param;
387 
388 
389 
390 /*----------------------------------------------------
391 Data structures for Simon Kilvington's SMILES routines
392 -----------------------------------------------------*/
393 
394 typedef void *block_ptr;
395 
396 /* smiles connection table data */
397 
398 #define md_MAXBONDS  8	    /* max atoms that an atom can be bonded to */
399 #define md_NOBOND   -1	    /* used in bondedto[] arrays */
400 
401 typedef char smilesbond_t;
402 
403 #define SMILESBOND_NoBond   ((smilesbond_t) 0)
404 #define SMILESBOND_Single   ((smilesbond_t) 1)
405 #define SMILESBOND_Double   ((smilesbond_t) 2)
406 #define SMILESBOND_Triple   ((smilesbond_t) 3)
407 #define SMILESBOND_Aromatic ((smilesbond_t) 5)
408 
409 typedef struct
410 {
411    char         symbol[2];
412    int          bondedto[md_MAXBONDS];	    /* indices of atoms this one is bonded to */
413    smilesbond_t bondtype[md_MAXBONDS];
414 } smilesatom_t;
415 
416 typedef struct
417 {
418    int          natoms;
419    smilesatom_t atom[1];		    /* array extends to atom[natoms-1] */
420 } smilescontab_t;
421 
422 #define smiles_CONTABHDRSIZE (sizeof(smilescontab_t) - sizeof(smilesatom_t))
423 
424 /*-------------------------------------------------------------------------------------*/
425 
426 
427 #include "babel.h"
428 
429 #endif /* !__BABEL_BBLTYP_H__ */
430