File: globals.h

package info (click to toggle)
xmakemol 5.16-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,696 kB
  • ctags: 1,393
  • sloc: ansic: 19,032; sh: 2,989; makefile: 123; perl: 98
file content (315 lines) | stat: -rw-r--r-- 7,039 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
/*

Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges
This file is part of XMakemol.

XMakemol is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

XMakemol is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with XMakemol; see the file COPYING.  If not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

#ifndef __GLOBALS_H__
#define __GLOBALS_H__

#define MAX_VECTORS_PER_ATOM (3)

/* enum types */

enum gl_render_types
{
  DEFAULT,
  BALL_AND_STICK,
  TUBES
};

struct atoms {
  char label[4];
  char uppercase_label[4];
  double x,y,z;      /* real   x,y and z */
  double ox,oy,oz;   /* old    x,y and z */
  double g[3];   /* in global axis system */
  /* Vector */
  double v[MAX_VECTORS_PER_ATOM][3];
  /* Ellipse */
  double euler[3];
  double shape[3];
  double max_shape;
  double mass;
  double cov_rad;    /* covalent radius */
  double vdw_rad;    /* van der Waals radius */
  char color[20];
  int pixel;
  Boolean edit;     /* is to be edited (ie rotated/translated) ? */
  Boolean sel;       /* is selected ? */
  Boolean visi;      /* is visible ? */
  unsigned short red,green,blue;
  Boolean is_hydrogen; /* is the atom Hydrogen? */
  int type;          /* atom type index */
  int has_vector;
  int is_ellipse;
  enum gl_render_types gl_render_type;
  int molecule;
};

struct elements {
  char label[4];
  double mass;
  double cov_rad;
  double vdw_rad;
  char color[20];
  int pixel; 
  unsigned short red,green,blue;
  Boolean any_atoms;
  Boolean color_allocated;
  Boolean customized; /* aro */
};

typedef struct BOUNDING_BOX bounding_box;
struct BOUNDING_BOX {
  double x_min, x_max;
  double y_min, y_max;
  double z_min, z_max;
  double v[8][3];
};

 
/* Struct frame contains the number of atoms, the comment and pointers
   to struct *atom and the next frame */

struct atom
{
 /* Coordinates */
  double x;
  double y;
  double z;
  /* Vector */
  double vx[MAX_VECTORS_PER_ATOM];
  double vy[MAX_VECTORS_PER_ATOM];
  double vz[MAX_VECTORS_PER_ATOM];
  /* Ellipse */
  double euler[3];
  double shape[3];
  /* Properties */
  char label[4];
  int has_vector;
  int is_ellipse;
  Boolean visi;
  /* Override default colors: either RGB or name */
  Boolean has_rgb;
  double red, green, blue;
  Boolean has_color_name;
  char color_name[32];
  enum gl_render_types gl_render_type;
  int molecule;
};

struct frame
{
  int no_atoms;
  char comment[1024];
  struct atom *atom;
  struct frame *next;
  int perspective_depth;
  int perspective_scale;
  /* This is the bounding box from the input file, if any */
  double bbox[3][2];            /* x, y, z; min, max */
  Boolean bbox_available;
};

enum render_stereo_types
{
  NO_STEREO = 0,
  SIDE_BY_SIDE = 1,
  RED_BLUE = 2,
  SGI_HARDWARE = 3
};

#define ROTATE_ABOUT_ORIGIN     0
#define ROTATE_ABOUT_LOCAL_COM  1
#define MAX_PRINTERS 20 /* aro */

#ifdef __XMAKEMOL_C__

int no_atoms;
int no_atom_types;
int rotate_about = ROTATE_ABOUT_LOCAL_COM;
int *atom_types;

int no_frames = 0;
int frame_no;
int sel_init=0;
int selected[4];

int bg_color_parsed;/* aro */

Arg args[20]; /* should be enough! */

Dimension canvas_width=450;
Dimension canvas_height=450;

char bg_color[30]="lightgray";
char bb_color[30]="darkgray";
char sel_color_name[30]="orange";
XColor sel_color;
char current_file_name[1024] = ""; /* aro */

double depth;
double global_vector[3];
double global_matrix[3][3];
double angle_axis_matrix[3][3];
double bd_scale=1.0;
double bdfd_factor=1.0;
double hbdfd_factor=1.0;
double ibdfd_factor=1.0;
double ihbdfd_factor=1.0;
double largest_cov_rad;

Boolean redraw;
Boolean inhibit_canvas_callback = 0;
Boolean centre_each_frame=0;
Boolean depth_is_on=1;
Boolean never_use_vdw = 0;
Boolean atoms_sorted=0;
Boolean any_hydrogen;
Boolean view_ghost_atoms = False;

Widget main_w,toplevel,label,canvas,message_area;

Widget frames_dialog = NULL;
Widget anim_dialog   = NULL;
Widget meas_dialog   = NULL;
Widget pers_dialog   = NULL;
Widget edit_visi_dialog = NULL;
Widget edit_posn_dialog = NULL;
Widget edit_atbd_sizes_dialog = NULL;
Widget edit_bond_fudges_dialog = NULL;
Widget edit_element_props_dialog = NULL; /* aro */
Widget gl_render_dialog = NULL; /* aro */
Widget scale_coords_dialog = NULL;

Widget *meas_label_w=NULL;
Widget nth_menu[6];

XGCValues gcv;

GC gc;

Pixmap canvas_pm;

Display *display;
Screen  *screen_ptr;
int screen_num;
int screen_depth;
Drawable root_window;

XmString str;

struct atoms *atoms;
struct elements *element;

int *sorted_atoms;

bounding_box bbox, file_bbox, bbox_by_hand;
Boolean bbox_available;

Boolean changing_frame;

#else  /* __XMAKEMOL_C__ */

extern int no_atoms;
extern int no_atom_types;
extern int rotate_about;
extern int *atom_types;

extern int no_frames;
extern int frame_no;
extern int sel_init;
extern int selected[4];

extern int bg_color_parsed; /* aro */

extern Arg args[20];

extern Dimension canvas_width;
extern Dimension canvas_height;

extern char bg_color[30];
extern char bb_color[30];
extern char sel_color_name[30];
extern XColor sel_color;
extern char current_file_name[1024]; /* aro */

extern double depth;
extern double global_vector[3];
extern double global_matrix[3][3];
extern double angle_axis_matrix[3][3];
extern double bd_scale;
extern double bdfd_factor;
extern double hbdfd_factor;
extern double ibdfd_factor;
extern double ihbdfd_factor;
extern double largest_cov_rad;

extern Boolean redraw;
extern Boolean inhibit_canvas_callback;
extern Boolean centre_each_frame;
extern Boolean depth_is_on;
extern Boolean never_use_vdw;
extern Boolean atoms_sorted;
extern Boolean any_hydrogen;
extern Boolean view_ghost_atoms;

extern Widget main_w,toplevel,label,canvas,message_area;

extern Widget frames_dialog;
extern Widget anim_dialog;
extern Widget meas_dialog;
extern Widget pers_dialog;
extern Widget edit_visi_dialog;
extern Widget edit_posn_dialog;
extern Widget edit_atbd_sizes_dialog;
extern Widget edit_bond_fudges_dialog;
extern Widget edit_element_props_dialog;/* aro */
extern Widget gl_render_dialog; /* aro */
extern Widget scale_coords_dialog;

extern Widget *meas_label_w;
extern Widget nth_menu[6];

extern XGCValues gcv;

extern GC gc;

extern Pixmap canvas_pm;

extern Display *display;
extern Screen  *screen_ptr;
extern int screen_num;
extern int screen_depth;
extern Drawable root_window;

extern struct atoms *atoms;
extern struct elements *element;

extern int *sorted_atoms;

extern bounding_box bbox, file_bbox, bbox_by_hand;
extern Boolean bbox_available;

extern Boolean changing_frame;

#endif /* __XMAKEMOL_C__ */


#endif /* __GLOBALS_H__ */