1 // $Id: drawxtl.h 1084 2010-11-17 22:58:30Z martin $ 2 // 3 #ifndef DRAWxtl_h 4 #define DRAWxtl_h 5 #define MAX_VERTS 20000 6 #define VERSION "V5.5" 7 #define RAD 57.2957795 /* Conversion from radians to degrees */ 8 #ifndef PI 9 #define PI 3.1415926 10 #endif 11 #ifndef M_PI 12 #define M_PI 3.14159265358979323846 13 #endif 14 #define O_OPT 1 15 #define B_OPT 2 16 #define P_OPT 4 17 #define V_OPT 8 18 #define M_OPT 16 19 #define L_OPT 32 20 #define IDI_ICON1 101 21 #define BUFSIZE 512 22 23 #include <stdlib.h> 24 #include <string.h> 25 static inline void * zalloc(size_t size)26zalloc (size_t size) 27 { 28 void *ret = malloc (size); 29 30 if (ret) 31 memset (ret, 0, size); 32 return ret; 33 } 34 35 struct MAP_INFO 36 { 37 int info_valid; 38 char title[82]; 39 float lat_con[6]; 40 float rhomx; 41 float rhomn; 42 int map_int[3]; 43 float xlim[2]; 44 float ylim[2]; 45 float zlim[2]; 46 float x4lim[2]; 47 float x5lim[2]; 48 float x6lim[2]; 49 int map_type; 50 int res; /* points per A for calc maps */ 51 }; 52 53 struct arrow_struct 54 { 55 int arrow_fn; /* frame number for this arrow */ 56 char col_arrow[40]; /* the color of this one */ 57 float arrow_length; /* the length of this arrow */ 58 float arrow_diam; /* and its diameter */ 59 float mag_xp[3]; /* position of arrow in real-space cell */ 60 float mag_xc[3]; /* components of arrow wrt XYZ */ 61 }; 62 63 struct cone_struct 64 { 65 int cone_fn; // frame number for the cone commands 66 char cone_l1[5]; // label for atom end of cone 67 int numlonepairs; // number of lone pairs to draw at atom 68 float cone_height; // height of cone 69 float cone_min; // cone tip radius 70 float cone_max; // cone base radius 71 char col_cone[40]; // color and properties of cones for POV 72 }; 73 74 struct plane_struct 75 { 76 int plane_fn; // frame number for plane commands 77 char plane_col[40]; // plane colors for POV 78 char plane_l[5]; // plane center label 79 float plane_size; // size of plane coordination 80 }; 81 82 struct poly_struct 83 { 84 int poly_fn; // frame number for polyhedra commands 85 char poly_l[5]; // polyhedral center label 86 char poly_t[5]; // polyhedral vertex label 87 float poly_size; // size of polyhedron 88 float poly_min; // lower limit for shell-like polyhedron 89 char poly_col[40]; // polyhedron colors for POV 90 float poly_rad_edge; // individual edge radius for polyhedron 91 char poly_col_edge[40]; // color of individual poly edges for POV 92 }; 93 94 struct edge_struct 95 { 96 char name[5]; 97 char color[40]; 98 float radius; 99 }; 100 101 struct bplane_struct 102 { 103 char bplane_t[10][5]; // atom labels in plane list 104 int bplane_n[10]; // atom numbers in plane list 105 int nbatoms; // number of items in list 106 float bplane_d1; // width of plane segment to draw 107 float bplane_d2; // second dimension 108 char bplane_col[40]; // color 109 }; 110 111 struct bond_struct 112 { 113 int bond_fn; // frame number for bond commands 114 char bond_l1[5]; // label for one end of bond 115 char bond_l2[5]; // label for other end 116 float bond_size; // bond diameter 117 float bond_min; // minimum bond distance 118 float bond_max; // maximum bond distance 119 char col_bond[40]; // color and properties of bonds for POV 120 int bond_style; // solid bond or dash 121 }; 122 123 struct sphere_struct 124 { 125 int sphere_fn; // frame number for sphere commands 126 char sphere_l[5]; // sphere label 127 int sphere_n; // atom number - -1 for old behavior 128 float sphere_size; // sphere size 129 char sphere_col[40]; // sphere colors 130 }; 131 132 struct label_struct 133 { 134 int label_fn; // frame number 135 float label_x[3]; // position of textual labels 136 char label_label[64]; // label text 137 }; 138 139 struct map_struct 140 { 141 int FourierContourSolid; 142 float FourierContourLevel; // Level for 3d, initial level for 2d 143 float FourierContourStep; // Height between contours for 2d 144 float FourierContourTop; // Upper level for 2d 145 char FourierContourColor[40]; 146 char FourierBackColor[40]; 147 }; 148 149 struct frame_struct // allocate at max_frame 150 { 151 float clip_lim[6]; /* limits of clip box in cell coords */ 152 float cryst_lim[6]; /* limits of view box in cell coords */ 153 float map_lim[9]; 154 int map_lim_set; 155 int slice; 156 float mapslice[3]; 157 float mapnorm[3]; 158 float planeeq[4]; 159 char molecule_atom_name[5]; 160 int molecule_atom_no; 161 float molecule_distance; 162 }; 163 164 struct atom_struct // allocate at max_atom 165 { 166 float atom_xyz[3]; // atomic coordinates 167 char atom_l[5]; // atom labels 168 int atom_n; // input atom number 169 int atom_fn; // frame number for atom 170 int sv_atom_n; // saved input atom number 171 int atom_ismod; // flag for modulated position 172 int occ_ismod; // flag for modulated occupancy 173 float occupancy; // average occupancy 174 float min_occ; // minimum occupancy required for drawing the atom 175 float saved_xyz[3]; // storage to save the atom position 176 int TF_status; // Temperature factor status (-1 no Uij, 0 sphere, 1 ellipsoid) 177 float radius; // vdW Radius for solvent calculations etc. 178 }; 179 180 struct ellips_struct // allocate at max_el 181 { 182 char ellips_col[40]; // ellipsoid colors for POV 183 float ellips_EV[3][3]; // Eigenvectors 184 float ellips_RMS[3]; // RMS amplitudes 185 char ellips_l[5]; // label for anisotropic atom 186 int ellips_n; // atom number 187 int save_el_number; // save original atom number 188 int ell_type; // form of ellipsoid input 189 float ellips[6]; // thermal ellipsoid coefficients 190 int ellips_ismod; // flag for modulated Uij 191 }; 192 193 struct mod_gbl_struct // allocate at max_modulation 194 { 195 int vector_mult[3]; // coefficients ijk for modvector = i*cell_vec_1 + j*cell_vec_2 .. 196 float modvector[3]; // atom Fourier modulation vectors 197 }; 198 199 struct mod_x_struct // allocate at max_atom * max_modulation 200 { 201 float atom_mod_sawtooth[5]; // amplitudes and interval for sawtooth modulation 202 int ellips_modpar_atom; // atom number for this item 203 float atom_occpar[2]; // cosine and sine multiplier of occ fourier series 204 int atom_occpar_atom; // atom number for atom_occpar 205 int atom_occpar_id; // axis number (0-2) for atom_occpar 206 float atom_occ_crenel[2]; // crenel lower and upper limit for occupancy 207 }; 208 209 struct mod_3x_struct // allocate at 3 * max_atom * max_modulation 210 { 211 float atom_modpar[2]; // cosine and sine multiplier for an item 212 int atom_modpar_atom; // atom number for atom_modpar 213 int atom_modpar_axis; // axis number (0-2) for atom_modpar 214 int atom_modpar_id; // entry in vector_mult for this term (1 - no_mod_vectors) 215 }; 216 217 struct mod_3t_struct // allocate at 3 * max_el * max_modulation 218 { 219 float ellips_modpar[2]; // wave vector id, cosine and sine multip 220 int ellips_modpar_id; // entry for this term (1 - no_mod_vectors) 221 int ellips_modpar_term; // identity of this term (1-6); 222 }; 223 224 struct atprop_struct // atomic properties 225 { 226 int atprop_fn; // frame number 227 char atprop_l[5]; // label 228 int atprop_n; // atom number - -1 for old behavior 229 float radius; // van der waals size 230 }; 231 232 #endif 233