atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
read_opengl.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2026 by CNRS and University of Strasbourg */
15
21
22/*
23* This file: 'read_opengl.c'
24*
25* Contains:
26*
27
28 - The functions to read the OpenGL window data in the atomes project file format
29
30*
31* List of functions:
32
33 int read_atom_a (FILE * fp, project * this_proj, int s, int a);
34 int read_atom_b (FILE * fp, project * this_proj, int s, int a);
35 int read_rings_chains_data (FILE * fp, glwin * view, int type, int rid, int size, int steps);
36 int read_this_image_label (FILE * fp, screen_label * label);
37 int read_this_box (FILE * fp, box * abc);
38 int read_this_axis (FILE * fp, axis * xyz);
39 int read_opengl_image (FILE * fp, project * this_proj, image * img, int sid);
40
41*/
42
43#include "global.h"
44#include "project.h"
45#include "glview.h"
46#include "initcoord.h"
47#include "preferences.h"
48
49extern gboolean version_2_8_and_above;
50extern gboolean version_2_9_and_above;
51
62int read_atom_a (FILE * fp, project * this_proj, int s, int a)
63{
64 if (fread (& this_proj -> atoms[s][a].id, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_A);
65 if (fread (& this_proj -> atoms[s][a].sp, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_A);
66 if (fread (& this_proj -> atoms[s][a].x, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_A);
67 if (fread (& this_proj -> atoms[s][a].y, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_A);
68 if (fread (& this_proj -> atoms[s][a].z, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_A);
69 //g_debug ("Reading:: step= %d, at= %d, sp[%d]= %d, x[%d]= %f, y[%d]= %f, z[%d]= %f",
70 // s, a+1, a, this_proj -> atoms[s][a].sp, a, this_proj -> atoms[s][a].x, a, this_proj -> atoms[s][a].y, a, this_proj -> atoms[s][a].z);
71 return OK;
72}
73
84int read_atom_b (FILE * fp, project * this_proj, int s, int a)
85{
86 if (fread (this_proj -> atoms[s][a].show, sizeof(gboolean), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_B);
87 if (fread (this_proj -> atoms[s][a].label, sizeof(gboolean), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_B);
88 if (fread (& this_proj -> atoms[s][a].style, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_ATOM_B);
89 int i, j, k, l, m;
90 int * rings_ij;
91 if (this_proj -> modelgl -> rings)
92 {
93 for (i=0; i<5; i++)
94 {
95 if (this_proj -> modelgl -> ring_max[i])
96 {
97 this_proj -> atoms[s][a].rings[i] = g_malloc0(this_proj -> rsparam[i][1]*sizeof*this_proj -> atoms[s][a].rings[i]);
98 for (j=0; j<this_proj -> rsparam[i][1]; j++)
99 {
100 rings_ij = allocint (this_proj -> modelgl -> num_rings[i][s][j]);
101 m = 0;
102 for (k=0; k<this_proj -> modelgl -> num_rings[i][s][j]; k++)
103 {
104 for (l=0; l<j+1; l++)
105 {
106 if (this_proj -> modelgl -> all_rings[i][s][j][k][l] == a)
107 {
108 rings_ij[m] = k;
109 m ++;
110 break;
111 }
112 }
113 }
114 this_proj -> atoms[s][a].rings[i][j] = allocint (m+1);
115 this_proj -> atoms[s][a].rings[i][j][0] = m;
116 for (k=0; k<m; k++) this_proj -> atoms[s][a].rings[i][j][k+1] = rings_ij[k];
117 g_free (rings_ij);
118 }
119 }
120 }
121 }
122 if (this_proj -> modelgl -> chains)
123 {
124 if (this_proj -> modelgl -> chain_max)
125 {
126 this_proj -> atoms[s][a].chain = g_malloc0(this_proj -> csparam[5]*sizeof*this_proj -> atoms[s][a].chain);
127 for (j=0; j<this_proj -> csparam[5]; j++)
128 {
129 rings_ij = allocint (this_proj -> modelgl -> num_chains[s][j]);
130 m = 0;
131 for (k=0; k<this_proj -> modelgl -> num_chains[s][j]; k++)
132 {
133 for (l=0; l<j; l++)
134 {
135 if (this_proj -> modelgl -> all_chains[s][j][k][l] == a)
136 {
137 m ++;
138 rings_ij[m] = k;
139 break;
140 }
141 }
142 }
143 this_proj -> atoms[s][a].chain[j] = allocint (m + 1);
144 this_proj -> atoms[s][a].chain[j][0] = m;
145 for (k=0; k<m; k++) this_proj -> atoms[s][a].chain[j][k+1] = rings_ij[k];
146 g_free (rings_ij);
147 }
148 }
149 }
150 return OK;
151}
152
165int read_rings_chains_data (FILE * fp, glwin * view, int type, int rid, int size, int steps)
166{
167 int i, j, k;
168 int * tmpcoo, * tmpcoord;
169 if (! type)
170 {
171 if (fread (& view -> ring_max[rid], sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_RINGS);
172 if (view -> ring_max[rid])
173 {
174 view -> num_rings[rid] = allocdint (steps, size);
175 view -> show_rpoly[rid] = g_malloc0(steps*sizeof*view -> show_rpoly[rid]);
176 view -> all_rings[rid] = g_malloc0(steps*sizeof*view -> all_rings[rid]);
177 tmpcoo = allocint (size);
178 for (i=0; i<steps; i++)
179 {
180 if (fread (view -> num_rings[rid][i], sizeof(int), size, fp) != size) return signal_error (__FILE__, __func__, __LINE__, ERROR_RINGS);
181 view -> all_rings[rid][i] = g_malloc0(size*sizeof*view -> all_rings[rid][i]);
182 view -> show_rpoly[rid][i] = g_malloc0(size*sizeof*view -> show_rpoly[rid][i]);
183 for (j=0; j<size; j++)
184 {
185 tmpcoo[j] += view -> num_rings[rid][i][j];
186 if (view -> num_rings[rid][i][j])
187 {
188 view -> all_rings[rid][i][j] = allocdint (view -> num_rings[rid][i][j], j+1);
189 view -> show_rpoly[rid][i][j] = allocbool (view -> num_rings[rid][i][j]);
190 if (fread (view -> show_rpoly[rid][i][j], sizeof(int), view -> num_rings[rid][i][j], fp) != view -> num_rings[rid][i][j]) return signal_error (__FILE__, __func__, __LINE__, ERROR_RINGS);
191 for (k=0; k<view -> num_rings[rid][i][j]; k++)
192 {
193 if (fread (view -> all_rings[rid][i][j][k], sizeof(int), j+1, fp) != j+1) return signal_error (__FILE__, __func__, __LINE__, ERROR_RINGS);
194 }
195 }
196 }
197 }
198 i = 0;
199 for (j=0; j<size; j++)
200 {
201 if (tmpcoo[j]) i++;
202 }
203
204 tmpcoord = allocint (i);
205 i = 0;
206 for (j=0; j<size; j++)
207 {
208 if (tmpcoo[j])
209 {
210 tmpcoord[i] = j+1;
211 i ++;
212 }
213 }
214 j = 4 + rid;
215 gboolean * show_rings = duplicate_bool(i, view -> anim -> last -> img -> show_coord[j]);
216 init_opengl_coords (4+rid, i, 1);
217 k = 0;
218 init_menurings_ (& j, & rid, & i, tmpcoord, & k);
219 g_free (tmpcoo);
220 g_free (tmpcoord);
221 view -> anim -> last -> img -> show_coord[j] = duplicate_bool(i, show_rings);
222 g_free (show_rings);
223 }
224 }
225 else
226 {
227 if (fread (& view -> chain_max, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_CHAINS);
228 if (view -> chain_max)
229 {
230 view -> num_chains = allocdint (steps, size);
231 view -> all_chains = g_malloc0(steps*sizeof*view -> all_rings[rid]);
232 tmpcoo = allocint (size);
233 for (i=0; i<steps; i++)
234 {
235 if (fread (view -> num_chains[i], sizeof(int), size, fp) != size) return signal_error (__FILE__, __func__, __LINE__, ERROR_CHAINS);
236 view -> all_chains[i] = g_malloc0(size*sizeof*view -> all_chains[i]);
237 for (j=0; j<size; j++)
238 {
239 tmpcoo[j] += view -> num_chains[i][j];
240 if (view -> num_chains[i][j])
241 {
242 view -> all_chains[i][j] = allocdint (view -> num_chains[i][j], j+1);
243 for (k=0; k<view -> num_chains[i][j]; k++)
244 {
245 if (fread (view -> all_chains[i][j][k], sizeof(int), j+1, fp) != j+1) return signal_error (__FILE__, __func__, __LINE__, ERROR_CHAINS);
246 }
247 }
248 }
249 }
250 i = 0;
251 for (j=0; j<size; j++)
252 {
253 if (tmpcoo[j]) i++;
254 }
255 tmpcoord = allocint (i);
256 i = 0;
257 for (j=0; j<size; j++)
258 {
259 if (tmpcoo[j])
260 {
261 tmpcoord[i] = j+1;
262 i ++;
263 }
264 }
265 j = 9;
266 k = 0;
267 gboolean * show_chains = duplicate_bool(i, view -> anim -> last -> img -> show_coord[j]);
268 init_opengl_coords (j, i, 1);
269 init_menurings_ (& j, & k , & i, tmpcoord, & k);
270 g_free (tmpcoo);
271 g_free (tmpcoord);
272 view -> anim -> last -> img -> show_coord[j] = duplicate_bool(i, show_chains);
273 g_free (show_chains);
274 }
275 }
276 return OK;
277}
278
288{
289 if (fread (& label -> position, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
290 if (fread (& label -> render, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
291 if (fread (& label -> scale, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
292 if (fread (& label -> shift, sizeof(double), 3, fp) != 3) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
293 if (fread (& label -> n_colors, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
294 if (label -> n_colors)
295 {
296 label -> color = g_malloc0(label -> n_colors*sizeof*label -> color);
297 if (fread (label -> color, sizeof(ColRGBA), label -> n_colors, fp) != label -> n_colors) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
298 }
299 else if (label -> color)
300 {
301 g_free (label -> color);
302 label -> color = NULL;
303 }
304 label -> font = read_this_string (fp);
305 if (label -> font == NULL) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
306 return OK;
307}
308
317int read_this_box (FILE * fp, box * abc)
318{
319 if (fread (& abc -> box, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
320 if (fread (& abc -> rad, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
321 if (fread (& abc -> line, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
322 if (fread (& abc -> color, sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
323 if (fread (abc -> extra_cell, sizeof(int), 3, fp) != 3) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
324 return OK;
325}
326
335int read_this_axis (FILE * fp, axis * xyz)
336{
337 if (fread (& xyz -> axis, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
338 if (fread (& xyz -> rad, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
339 if (fread (& xyz -> line, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
341 {
342 xyz -> color = g_malloc0(sizeof*xyz -> color);
343 if (fread (& xyz -> color[0], sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
344 g_free (xyz -> color);
345 xyz -> color = NULL;
346 }
347 if (fread (& xyz -> t_pos, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
348 if (fread (& xyz -> length, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
349 if (fread (xyz -> c_pos, sizeof(double), 3, fp) != 3) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
350 gboolean val;
351 int i;
352 if (fread (& val, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
353 if (val)
354 {
355 xyz -> color = g_malloc0(3*sizeof*xyz -> color);
356 for (i=0; i<3; i++)
357 {
358 if (fread (& xyz -> color[i], sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
359 }
360 }
361 if (fread (& xyz -> labels, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
362 for (i=0; i<3; i++)
363 {
364 xyz -> title[i] = read_this_string (fp);
365 if (xyz -> title[i] == NULL) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
366 }
367 return OK;
368}
369
370
381int read_opengl_image (FILE * fp, project * this_proj, image * img, int sid)
382{
383 int i, j, k, l, m, n;
384 gboolean val;
385
388 {
389 if (fread (& img -> back -> gradient, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
390 if (img -> back -> gradient)
391 {
392 if (fread (& img -> back -> direction, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
393 if (fread (& img -> back -> position, sizeof(float), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
394 if (fread (img -> back -> gradient_color, sizeof(ColRGBA), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
395 }
396 else
397 {
398 if (fread (& img -> back -> color, sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
399 }
400 }
401 else
402 {
403 img -> back -> gradient = 0;
404 img -> back -> position = 0.5;
405 if (fread (& img -> back -> color, sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
406 }
407 if (fread (img -> color_map, sizeof(int), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
408 if (img -> color_map[0] > ATOM_MAPS-1)
409 {
410 img -> color_map[0] -= 10;
411 if (fread (& j, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
412 this_proj -> modelgl -> custom_map = allocate_color_map (j, this_proj);
413 this_proj -> modelgl -> custom_map -> points = j;
414 if (fread (& this_proj -> modelgl -> custom_map -> cmax, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
415 if (fread (& this_proj -> modelgl -> custom_map -> cmin, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
416 this_proj -> modelgl -> custom_map -> positions = allocfloat (j);
417 this_proj -> modelgl -> custom_map -> values = g_malloc0(j*sizeof*this_proj -> modelgl -> custom_map -> values);
418 if (fread (this_proj -> modelgl -> custom_map -> positions, sizeof(float), j, fp) != j) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
419 if (fread (this_proj -> modelgl -> custom_map -> values, sizeof(ColRGBA), j, fp) != j) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
420 j = this_proj -> steps*this_proj -> natomes;
421 for (i=0; i<this_proj -> steps; i++)
422 {
423 if (fread (this_proj -> modelgl -> custom_map -> data[i], sizeof(float), this_proj -> natomes, fp) != this_proj -> natomes) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
424 }
425 setup_custom_color_map (NULL, this_proj, FALSE);
426 }
427
428 if (fread (& img -> cloned_poly, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
429 if (fread (img -> at_color, sizeof(ColRGBA), sid*2, fp) != sid*2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
430 if (fread (img -> sphererad, sizeof(double), sid*2, fp) != sid*2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
431 if (fread (img -> pointrad, sizeof(double), sid*2, fp) != sid*2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
432 if (fread (img -> atomicrad, sizeof(double), sid*2, fp) != sid*2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
433
434 for (i=0; i<sid*2; i++)
435 {
436 if (fread (img -> bondrad[i], sizeof(double), 2*sid, fp) != 2*sid) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
437 if (fread (img -> linerad[i], sizeof(double), 2*sid, fp) != 2*sid) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
438 }
439 if (fread (img -> radall, sizeof(double), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
440 if (fread (& img -> draw_clones, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
442 {
443 for (i=0; i<5; i++)
444 {
445 if (fread (& img -> labels[i].position, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
446 }
447 for (i=0; i<5; i++)
448 {
449 if (fread (& img -> labels[i].render, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
450 }
451 for (i=0; i<5; i++)
452 {
453 if (fread (& img -> labels[i].scale, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
454 }
455 if (fread (img -> acl_format, sizeof(int), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
456 for (i=0; i<5; i++)
457 {
458 if (fread (img -> labels[i].shift, sizeof(double), 3, fp) != 3) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
459 if (fread (& val, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
460 if (val)
461 {
462 if (i < 2)
463 {
464 j = 2*sid;
465 }
466 else if (i == 2)
467 {
468 j = 3;
469 }
470 else
471 {
472 j = 1;
473 }
474 img -> labels[i].n_colors = j;
475 img -> labels[i].color = g_malloc0(j*sizeof*img -> labels[i].color);
476 for (k=0; k<j; k++)
477 {
478 if (fread (& img -> labels[i].color[k], sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
479 }
480 }
481 else
482 {
483 img -> labels[i].n_colors = 0;
484 if (img -> labels[i].color)
485 {
486 g_free (img -> labels[i].color);
487 img -> labels[i].color = NULL;
488 }
489 }
490 img -> labels[i].font = read_this_string (fp);
491 if (img -> labels[i].font == NULL) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
492 }
493
494 if (fread (& img -> mtilt[0], sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
495 img -> mtilt[1] = img -> mtilt[0];
496 if (fread (& img -> mpattern[0], sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
497 img -> mpattern[1] = img -> mpattern[0];
498 if (fread (& img -> mfactor[0], sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
499 img -> mfactor[1] = img -> mfactor[0];
500 if (fread (& img -> mwidth[0], sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
501 img -> mwidth[1] = img -> mwidth[0];
502 }
503 else
504 {
505 for (i=0; i<5; i++)
506 {
507 if (read_this_image_label (fp, & img -> labels[i]) != OK)
508 {
509 update_error_trace (__FILE__, __func__, __LINE__-2);
510 return ERROR_IMAGE;
511 }
512 }
513 if (fread (img -> acl_format, sizeof(int), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
514 if (fread (img -> mtilt, sizeof(gboolean), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
515 if (fread (img -> mpattern, sizeof(int), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
516 if (fread (img -> mfactor, sizeof(int), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
517 if (fread (img -> mwidth, sizeof(double), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
518
519 }
520 if (fread (& img -> m_is_pressed, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
521
522 // Model box and axis
524 {
525 if (fread (& img -> abc -> box, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
526 if (fread (& img -> xyz -> axis, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
527 if (fread (& img -> abc -> rad, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
528 if (fread (& img -> xyz -> rad, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
529 if (fread (& img -> abc -> line, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
530 if (fread (& img -> xyz -> line, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
531 if (fread (& img -> abc -> color, sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
532 if (fread (img -> abc -> extra_cell, sizeof(int), 3, fp) != 3) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
533 // Axis
534 if (fread (& img -> xyz -> t_pos, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
535 if (fread (& img -> xyz -> length, sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
536 if (fread (img -> xyz -> c_pos, sizeof(double), 3, fp) != 3) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
537
538 if (fread (& val, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
539 if (val)
540 {
541 img -> xyz -> color = g_malloc0(3*sizeof*img -> xyz -> color);
542 for (i=0; i<3; i++)
543 {
544 if (fread (& img -> xyz -> color[i], sizeof(ColRGBA), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
545 }
546 }
547 if (fread (& img -> xyz -> labels, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
548 for (i=0; i<3; i++)
549 {
550 img -> xyz -> title[i] = read_this_string (fp);
551 if (img -> xyz -> title[i] == NULL) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
552 }
553 }
554 else
555 {
556 // Model box
557 if (read_this_box (fp, img -> abc) != OK)
558 {
559 update_error_trace (__FILE__, __func__, __LINE__-2);
560 return ERROR_IMAGE;
561 }
562 // Axis
563 if (read_this_axis (fp, img -> xyz) != OK)
564 {
565 update_error_trace (__FILE__, __func__, __LINE__-2);
566 return ERROR_IMAGE;
567 }
568 }
569 // OpenGL
570 if (fread (& img -> p_depth, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
571 if (fread (& img -> gnear, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
572 if (fread (& img -> gfar, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
573 if (fread (& img -> gleft, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
574 if (fread (& img -> gright, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
575 if (fread (& img -> gtop, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
576 if (fread (& img -> gbottom, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
577 if (fread (& img -> rotation_quaternion, sizeof(vec4_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
578 if (fread (& img -> rotation_mode, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
579 if (fread (& img -> zoom, sizeof(GLdouble), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
580 if (fread (img -> c_shift, sizeof(GLdouble), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
581 if (fread (& img -> style, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
582 if (fread (& img -> quality, sizeof(GLint), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
584 {
585 if (fread (& img -> ray_tracing, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
586 }
587 if (fread (& img -> render, sizeof(GLint), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
588 if (fread (& img -> l_ghtning.lights, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
589 if (img -> l_ghtning.spot != NULL)
590 {
591 g_free (img -> l_ghtning.spot);
592 img -> l_ghtning.spot = NULL;
593 }
594 img -> l_ghtning.spot = g_malloc0(img -> l_ghtning.lights*sizeof*img -> l_ghtning.spot);
595 for (i=0; i<img -> l_ghtning.lights; i++)
596 {
597 img -> l_ghtning.spot[i] = g_malloc0(sizeof*img -> l_ghtning.spot[i]);
598 if (fread (& img -> l_ghtning.spot[i] -> type, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
599 if (fread (& img -> l_ghtning.spot[i] -> fix, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
600 if (fread (& img -> l_ghtning.spot[i] -> show, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
601 if (fread (& img -> l_ghtning.spot[i] -> position, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
602 if (fread (& img -> l_ghtning.spot[i] -> direction, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
603 if (fread (& img -> l_ghtning.spot[i] -> intensity, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
604 if (fread (& img -> l_ghtning.spot[i] -> attenuation, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
605 if (fread (& img -> l_ghtning.spot[i] -> spot_data, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
606 }
607 if (fread (& img -> m_terial.predefine, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
608 if (fread (& img -> m_terial.albedo, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
609 if (fread (img -> m_terial.param, sizeof(GLfloat), 6, fp) != 6) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
610 if (fread (& img -> f_g.mode, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
611 if (fread (& img -> f_g.based, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
612 if (fread (& img -> f_g.density, sizeof(float), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
613 if (fread (& img -> f_g.depth, sizeof(float), 2, fp) != 2) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
614 if (fread (& img -> f_g.color, sizeof(vec3_t), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
615
616 if (fread (& img -> filled_type, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
617 if (fread (& img -> step, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
618 if (fread (& img -> rep, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
619
620 for (i=0; i<4; i++)
621 {
622 if (i < 2)
623 {
624 for (j=0; j<sid; j++)
625 {
626 if (fread (img -> spcolor[i][j], sizeof(ColRGBA), this_proj -> coord -> ntg[i][j], fp) != this_proj -> coord -> ntg[i][j]) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
627 }
628 }
629 else
630 {
631 if (fread (& j, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
632 if (j)
633 {
634 if (j != this_proj -> coord -> totcoord[i])
635 {
636 return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
637 }
638 if (fread (img -> spcolor[i][0], sizeof(ColRGBA), this_proj -> coord -> totcoord[i], fp) != this_proj -> coord -> totcoord[i]) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
639 }
640 }
641 }
642 active_glwin = this_proj -> modelgl;
643 active_image = this_proj -> modelgl -> anim -> last -> img;
644 active_coord = this_proj -> coord;
645 if (fread (& this_proj -> modelgl -> rings, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
646 if (this_proj -> modelgl -> rings)
647 {
648 for (i=0; i<5; i++)
649 {
650 if (read_rings_chains_data (fp, this_proj -> modelgl, 0, i, this_proj -> rsparam[i][1], this_proj -> steps) != OK)
651 {
652 update_error_trace (__FILE__, __func__, __LINE__-2);
653 return ERROR_RINGS;
654 }
655 }
656 }
657 if (fread (& this_proj -> modelgl -> chains, sizeof(gboolean), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
658 if (this_proj -> modelgl -> chains)
659 {
660 if (read_rings_chains_data (fp, this_proj -> modelgl, 1, 0, this_proj -> csparam[5], this_proj -> steps) != OK)
661 {
662 update_error_trace (__FILE__, __func__, __LINE__-2);
663 return ERROR_CHAINS;
664 }
665 }
666 if (fread (& i, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
667 if (i)
668 {
669 this_proj -> modelgl -> create_shaders[VOLMS] = TRUE;
670 this_proj -> modelgl -> volumes = TRUE;
671 for (i=0; i<FILLED_STYLES; i++)
672 {
673 this_proj -> modelgl -> atoms_volume[i] = allocdouble (this_proj -> steps);
674 this_proj -> modelgl -> atoms_ppvolume[i] = allocdouble (this_proj -> steps);
675 if (fread (this_proj -> modelgl -> atoms_volume[i], sizeof(double), this_proj -> steps, fp) != this_proj -> steps) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
676 if (fread (this_proj -> modelgl -> atoms_ppvolume[i], sizeof(double), this_proj -> steps, fp) != this_proj -> steps) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
677 this_proj -> modelgl -> volume_box[i] = allocddouble (this_proj -> steps, 9);
678 for (j=0; j<this_proj -> steps; j++)
679 {
680 if (fread (this_proj -> modelgl -> volume_box[i][j], sizeof(double), 9, fp) != 9) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
681 }
682 }
683 if (fread (this_proj -> modelgl -> comp_vol, sizeof(gboolean), FILLED_STYLES, fp) != FILLED_STYLES) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
684 if (fread (active_image -> show_vol, sizeof(gboolean), FILLED_STYLES, fp) != FILLED_STYLES) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
685 if (fread (active_image -> vol_col, sizeof(ColRGBA), FILLED_STYLES, fp) != FILLED_STYLES) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
686 if (fread (& i, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
687 if (i)
688 {
689 for (j=0; j<FILLED_STYLES; j++)
690 {
691 if (fread (& k, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
692 if (k)
693 {
694 this_proj -> modelgl -> frag_mol_volume[0][j] = allocddouble (this_proj -> steps, i);
695 this_proj -> modelgl -> frag_mol_ppvolume[0][j] = allocddouble (this_proj -> steps, i);
696 this_proj -> modelgl -> fm_comp_vol[0][j] = allocdbool (this_proj -> steps, i);
697 active_image -> fm_show_vol[0][j] = allocbool (i);
698 this_proj -> modelgl -> frag_box[j] = alloctdouble (this_proj -> steps, i, 9);
699 for (l=0; l<k; l++)
700 {
701 if (fread (& m, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
702 if (fread (& n, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
703 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[0][j][m][n], sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
704 if (fread (this_proj -> modelgl -> frag_box[j][m][n], sizeof(double), 9, fp) != 9) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
705 this_proj -> modelgl -> fm_comp_vol[0][j][m][n] = TRUE;
706 }
707 active_image -> fm_vol_col[0][j] = g_malloc0(i*sizeof*active_image -> fm_vol_col[0][j]);
708 if (fread (active_image -> fm_show_vol[0][j], sizeof(gboolean), i, fp) != i) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
709 if (fread (active_image -> fm_vol_col[0][j], sizeof(ColRGBA), i, fp) != i) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
710 }
711 }
712 if (fread (& i, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
713 if (i)
714 {
715 for (j=0; j<FILLED_STYLES; j++)
716 {
717 if (fread (& k, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
718 if (k)
719 {
720 this_proj -> modelgl -> frag_mol_volume[1][j] = allocddouble (this_proj -> steps, i);
721 this_proj -> modelgl -> frag_mol_ppvolume[1][j] = allocddouble (this_proj -> steps, i);
722 this_proj -> modelgl -> fm_comp_vol[1][j] = allocdbool (this_proj -> steps, i);
723 active_image -> fm_show_vol[1][j] = allocbool (i);
724 for (l=0; l<k; l++)
725 {
726 if (fread (& m, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
727 if (fread (& n, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
728 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[1][j][m][n], sizeof(double), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
729 this_proj -> modelgl -> fm_comp_vol[1][j][m][n] = TRUE;
730 }
731 if (fread (active_image -> fm_show_vol[1][j], sizeof(gboolean), i, fp) != i) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
732 active_image -> fm_vol_col[1][j] = g_malloc0(i*sizeof*active_image -> fm_vol_col[1][j]);
733 if (fread (active_image -> fm_vol_col[1][j], sizeof(ColRGBA), i, fp) != i) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
734 }
735 }
736 }
737 }
738 }
739
740 for (i=0; i<this_proj -> steps; i++)
741 {
742 for (j=0; j< this_proj -> natomes; j++)
743 {
744 if (read_atom_b (fp, this_proj, i, j) != OK)
745 {
746 update_error_trace (__FILE__, __func__, __LINE__-2);
747 return ERROR_ATOM_B;
748 }
749 }
750 }
751 // Finally selection lists, bonds, angles and dihedrals
752 for (i=0; i<2; i++)
753 {
754 if (fread (& j, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
755 if (j)
756 {
757 for (k=0; k<j; k++)
758 {
759 if (fread (& l, sizeof(int), 1, fp) != 1) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
760 process_selected_atom (this_proj, this_proj -> modelgl, l, 0, 0, i);
761 }
762 update_all_selections (this_proj -> modelgl, i);
763 if (img -> selected[i] -> selected >= 2 && img -> selected[i] -> selected <= 20)
764 {
765 j = num_bonds (img -> selected[i] -> selected);
766 if (fread (img -> selected[i] -> selected_bonds, sizeof(int), j, fp) != j) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
767 if (img -> selected[i] -> selected >= 3)
768 {
769 j = num_angles (img -> selected[i] -> selected);
770 if (fread (img -> selected[i] -> selected_angles, sizeof(int), j, fp) != j) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
771 if (img -> selected[i] -> selected >= 4 && img -> selected[i] -> selected <= 10)
772 {
773 j = num_dihedrals (img -> selected[i] -> selected);
774 if (fread (img -> selected[i] -> selected_dihedrals, sizeof(int), j, fp) != j) return signal_error (__FILE__, __func__, __LINE__, ERROR_IMAGE);
775 }
776 }
777 }
778 }
779 }
780 this_proj -> modelgl -> labelled = check_label_numbers (this_proj, 2);
781#ifdef GTK3
782 // GTK3 Menu Action To Check
783 for (i=0; i<2; i++)
784 {
785 for (j=0; j<sid; j++)
786 {
787 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_spec[i][j]))
788 {
789 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j]) != img -> show_atom[i][j])
790 {
791 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j], img -> show_atom[i][j]);
792 }
793 }
794 }
795 }
796 for (i=0; i<10; i++)
797 {
798 if (this_proj -> modelgl -> ogl_poly[0][i] != NULL)
799 {
800 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
801 {
802 if (i < 2 || (i > 3 && i < 9))
803 {
804 if (this_proj -> modelgl -> ogl_poly[0][i][j] != NULL)
805 {
806 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_poly[0][i][j]))
807 {
808 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j]) != img -> show_poly[i][j])
809 {
810 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j], img -> show_poly[i][j]);
811 }
812 }
813 }
814 }
815 }
816 }
817 if (this_proj -> modelgl -> ogl_geom[0][i] != NULL)
818 {
819 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
820 {
821 if (this_proj -> modelgl -> ogl_geom[0][i][j] != NULL)
822 {
823 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_geom[0][i][j]))
824 {
825 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j]) != img -> show_coord[i][j])
826 {
827 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j], img -> show_coord[i][j]);
828 }
829 }
830 }
831 }
832 }
833 }
834 show_the_widgets (this_proj -> modelgl -> ogl_coord[0]);
835 update_all_menus (this_proj -> modelgl, this_proj -> natomes);
836#endif
837 this_proj -> modelgl -> labelled = check_label_numbers (this_proj, 2);
838#ifdef GTK4
839 for (i=0; i<2; i++)
840 {
841 for (j=0; j<sid; j++)
842 {
843 if (! img -> show_atom[i][j])
844 {
845 show_hide_atoms (NULL, NULL, & this_proj -> modelgl -> colorp[i][j]);
846 }
847 }
848 }
849 for (i=0; i<10; i++)
850 {
851 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
852 {
853 if (i < 2 || (i > 3 && i < 9))
854 {
855 if (img -> show_poly[i][j])
856 {
857 show_hide_poly (NULL, NULL, & this_proj -> modelgl -> gcid[i][j][i]);
858 }
859 }
860 }
861 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
862 {
863 if (! img -> show_coord[i][j])
864 {
865 show_hide_coord (NULL, NULL, & this_proj -> modelgl -> gcid[i][j][i]);
866 }
867 }
868 }
869 update_menu_bar (this_proj -> modelgl);
870#endif
871 return OK;
872}
int num_bonds(int i)
number of distinct pair(s) of atoms in selection
Definition selection.c:183
int num_dihedrals(int i)
number of distinct quadruplet(s) of atoms in selection
Definition selection.c:207
int num_angles(int i)
number of distinct triplet(s) of atoms in selection
Definition selection.c:195
integer function chains()
Definition chains.F90:54
color colorp[64]
double scale(double axe)
find appropriate major tick spacing based on axis length
Definition curve.c:205
void process_selected_atom(project *this_proj, glwin *view, int id, int ac, int se, int pi)
process selected atom
Definition selection.c:514
int * shift
Definition d_measures.c:72
int atoms[NUM_STYLES][2]
float val
Definition dlp_init.c:117
dint rep
Definition dlp_edit.c:2242
gboolean * duplicate_bool(int num, gboolean *old_val)
copy a list of gboolean
Definition global.c:563
FILE * fp
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:317
gboolean * allocbool(int val)
allocate a gboolean * pointer
Definition global.c:241
double ** allocddouble(int xal, int yal)
allocate a double ** pointer
Definition global.c:462
double * allocdouble(int val)
allocate a double * pointer
Definition global.c:446
double *** alloctdouble(int xal, int yal, int zal)
allocate a double *** pointer
Definition global.c:485
int * allocint(int val)
allocate an int * pointer
Definition global.c:301
gboolean ** allocdbool(int xal, int yal)
allocate a gboolean ** pointer
Definition global.c:257
float * allocfloat(int val)
allocate a float * pointer
Definition global.c:385
Global variable declarations Global convenience function declarations Global data structure defin...
#define ERROR_CHAINS
Definition global.h:306
int signal_error(const char *file, const char *func, int error_line, int error_id)
Definition callbacks.c:182
glwin * active_glwin
Definition project.c:53
G_MODULE_EXPORT void show_hide_poly(GtkWidget *widg, gpointer data)
show / hide polyhedra callback - GTK3
Definition m_poly.c:79
coord_info * active_coord
Definition project.c:49
#define ERROR_ATOM_B
Definition global.h:301
G_MODULE_EXPORT void show_hide_coord(GtkWidget *widg, gpointer data)
show/hide coordination callback GTK3
Definition m_coord.c:106
#define ERROR_IMAGE
Definition global.h:299
#define ERROR_RINGS
Definition global.h:305
#define ERROR_ATOM_A
Definition global.h:300
#define OK
Definition global.h:295
G_MODULE_EXPORT void show_hide_atoms(GtkWidget *widg, gpointer data)
void update_error_trace(const char *file, const char *func, int trace_line)
Definition callbacks.c:200
image * active_image
Definition project.c:52
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
void zoom(glwin *view, int delta)
zoom in or zoom out in the OpenGL window
Definition glview.c:1028
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void update_all_menus(glwin *view, int nats)
update all menus of the OpenGL window
Definition glwindow.c:338
int check_label_numbers(project *this_proj, int types)
check how many atom label(s) are visible
Definition popup.c:1059
render
Definition glview.h:191
int step
Definition ogl_draw.c:76
labels
Definition glview.h:223
void update_all_selections(glwin *view, int pi)
update the selection data: bonds, angles and dihedrals
Definition selection.c:387
#define FILLED_STYLES
Definition glwin.h:106
@ VOLMS
Definition glwin.h:102
#define ATOM_MAPS
Definition glwin.h:61
void init_opengl_coords(int id, int nt, int init)
initialize data to store the coordination data
Definition initcoord.c:661
void init_menurings_(int *coo, int *ids, int *ngsp, int coordt[*ngsp], int *init)
getting rings statistics data from Fortran90, and related GTK3 menu elements creation
Definition initcoord.c:572
Function declarations to handle the atomic coordination data.
gboolean setup_custom_color_map(float *data, project *this_proj, gboolean init)
prepare the custom color map data
Definition m_map.c:211
colormap * allocate_color_map(int pts, project *this_proj)
allocate custom color map data
Definition m_map.c:188
G_MODULE_EXPORT void cloned_poly(GtkWidget *widg, gpointer data)
cloned polyehdra callback - GTK3
Definition m_poly.c:181
position
Definition m_proj.c:48
double z
Definition ogl_draw.c:63
double y
Definition ogl_draw.c:63
double x
Definition ogl_draw.c:63
gboolean version_2_8_and_above
Definition open_p.c:78
gchar * read_this_string(FILE *fp)
is there a string to read in this file ? yes do it
Definition open_p.c:109
gboolean version_2_9_and_above
Definition open_p.c:79
background default_background
void duplicate_background_data(background *new_back, background *old_back)
duplicate background data structure
Preference variable declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
int read_atom_b(FILE *fp, project *this_proj, int s, int a)
read atom properties from file (b)
Definition read_opengl.c:84
int read_this_image_label(FILE *fp, screen_label *label)
int read_this_box(FILE *fp, box *abc)
read OpenGL image box properties to file
int read_rings_chains_data(FILE *fp, glwin *view, int type, int rid, int size, int steps)
read rings and chains statistics data from file
int read_atom_b(FILE *fp, project *this_proj, int s, int a)
read atom properties from file (b)
Definition read_opengl.c:84
int read_opengl_image(FILE *fp, project *this_proj, image *img, int sid)
read OpenGL image properties from file
int read_atom_a(FILE *fp, project *this_proj, int s, int a)
read atom properties from file (a)
Definition read_opengl.c:62
int read_this_axis(FILE *fp, axis *xyz)
read OpenGL image axis properties to file
Definition glwin.h:332
Definition glwin.h:350
Definition glwin.h:967
Definition glwin.h:364
GtkWidget * img
Definition workspace.c:70