atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
atom_coord.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-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'atom_coord.c'
24*
25* Contains:
26*
27
28 - The functions to correct the coordination menus and the corresponding data pointers after edition
29
30*
31* List of functions:
32
33 int test_this_coord (project * this_proj, int spec, int gid, int cid, int minc, int maxc);
34
35 void print_coord_info (project * this_proj, coord_info * coord);
36 void clean_coords_and_geoms (project * this_proj, atom_edition * edit,
37 int new_spec, int rem, int adds, int * spid, int *** tmpgeo,
38 gboolean * showcoord[2], gboolean * showpoly[2]);
39 void new_coord_menus (project * this_proj, coord_info * coord, int new_spec, int nmols,
40 gboolean * showcoord[2], gboolean * showpoly[2], gboolean * showfrag,
41 gboolean update_it, gboolean update_mol);
42 void recover_opengl_data (project * this_proj, int nmols, int add, int rem, int * num, int * rec, int *** tmpgeo, gboolean * showfrag);
43
44 coord_info * duplicate_coord_info (coord_info * old_coord);
45
46*/
47
48#include "atom_edit.h"
49
62int test_this_coord (project * this_proj, int spec, int gid, int cid, int minc, int maxc)
63{
64 int i, j, k, l;
65 l = 0;
66 for (i=0; i<this_proj -> natomes; i++)
67 {
68 j = this_proj -> atoms[0][i].sp;
69 k = this_proj -> atoms[0][i].coord[gid];
70 if (j == spec && (k > maxc && k < minc)) return -1;
71 if (j == spec && k == cid)
72 {
73 l ++;
74 }
75 }
76 return l;
77}
78
87void print_coord_info (project * this_proj, coord_info * coord)
88{
89 int * min_bs, * max_bs;
90 int i, j, k, l, m;
91 gchar * str;
92 int test;
93 if (coord -> species)
94 {
95 min_bs = allocint(coord -> species);
96 max_bs = allocint(coord -> species);
97 g_debug (" ");
98 g_debug ("coord -> species = %d", coord -> species);
99 g_debug (" ");
100 for (i=0; i<4; i++)
101 {
102 g_debug (" --- start geo[%d] ---", i);
103 g_debug ("geo i = %d, totcoord[%d] = %d", i, i, coord -> totcoord[i]);
104 if ((i < 2 || i > 3) && coord -> totcoord[i])
105 {
106 j = (i < 2) ? coord -> species : 1;
107 g_debug (" spec i = %d, jmax= %d", i, j);
108 g_debug (" ");
109 for (k=0; k<j; k++)
110 {
111 min_bs[k] = max_bs[k] = coord -> partial_geo[k][0][0];
112 for (m=0; m<coord -> species; m++)
113 {
114 min_bs[k] = min (min_bs[k], coord -> partial_geo[k][0][m]);
115 max_bs[k] = max (max_bs[k], coord -> partial_geo[k][0][m]);
116 }
117 for (l=1; l<coord -> ntg[i][k]; l++)
118 {
119 for (m=0; m<coord -> species; m++)
120 {
121 min_bs[k] = min (min_bs[k], coord -> partial_geo[k][l][m]);
122 max_bs[k] = max (max_bs[k], coord -> partial_geo[k][l][m]);
123 }
124 }
125 }
126 for (k=0; k<j; k++)
127 {
128 g_debug (" coord i = %d, k = %d, coord -> ntg[%d][%d] = %d", i, k, i, k, coord -> ntg[i][k]);
129 test = (this_proj) ? test_this_coord (this_proj, k, i, 0, min_bs[k], max_bs[k]) : 0;
130 str = g_strdup_printf (" l = %d, coord -> geolist[%d][%d][%d]= %d, num[at,%d]= %d", 0, i, k, 0, coord -> geolist[i][k][0], 0, test);
131 if (coord -> ntg[i][k] > 1)
132 {
133 for (l=1; l<coord -> ntg[i][k]; l++)
134 {
135 test = (this_proj) ? test_this_coord (this_proj, k, i, l, min_bs[k], max_bs[k]) : 0;
136 str = g_strdup_printf ("%s\n l = %d, coord -> geolist[%d][%d][%d]= %d, num[at,%d]= %d", str, l, i, k, l, coord -> geolist[i][k][l], l, test);
137 }
138 }
139 g_debug ("%s", str);
140 g_free (str);
141 }
142 if (i == 1)
143 {
144 g_debug (" ");
145 for (k=0; k<j; k++)
146 {
147 str = g_strdup_printf (" Partials geo\n k = %d, coord -> partial_geo[%d][%d][%d]= %d", k, k, 0, 0, coord -> partial_geo[k][0][0]);
148 for (l=1; l<j; l++)
149 {
150 str = g_strdup_printf ("%s\n k = %d, coord -> partial_geo[%d][%d][%d]= %d", str, k, k, 0, l, coord -> partial_geo[k][0][l]);
151 }
152 if (coord -> ntg[i][k] > 1)
153 {
154 for (l=1; l<coord -> ntg[i][k]; l++)
155 {
156 str = g_strdup_printf ("%s\n\n k = %d, coord -> partial_geo[%d][%d][%d]= %d", str, k, k, l, 0, coord -> partial_geo[k][l][0]);
157 for (m=1; m<j; m++)
158 {
159 str = g_strdup_printf ("%s\n k = %d, coord -> partial_geo[%d][%d][%d]= %d", str, k, k, l, m, coord -> partial_geo[k][l][m]);
160 }
161 }
162 }
163 g_debug ("%s", str);
164 g_free (str);
165 }
166 }
167 g_debug (" ");
168 }
169 g_debug (" --- end geo[%d] ---", i);
170 g_debug (" ");
171 }
172 g_free (min_bs);
173 g_free (max_bs);
174 }
175 else
176 {
177 g_debug (" ");
178 g_debug ("Coord is empty no species !");
179 g_debug (" ");
180 }
181}
182
191{
192 coord_info * new_coord = g_malloc0 (sizeof*new_coord);
193 int i, j, k, l;
194 if (! old_coord -> species) return new_coord;
195 new_coord -> species = old_coord -> species;
196 new_coord -> cmax = old_coord -> cmax;
197 new_coord -> cmin = old_coord -> cmin;
198 for (i=0; i<10; i++)
199 {
200 new_coord -> totcoord[i] = old_coord -> totcoord[i];
201 if ((i < 2 || i > 3) && old_coord -> totcoord[i])
202 {
203 j = (i < 2) ? new_coord -> species : 1;
204 new_coord -> ntg[i] = duplicate_int (j, old_coord -> ntg[i]);
205 new_coord -> geolist[i] = g_malloc0 (j*sizeof*new_coord -> geolist[i]);
206 if (i == 1) new_coord -> partial_geo = g_malloc0 (j*sizeof*new_coord -> partial_geo);
207 for (k=0; k<j; k++)
208 {
209 new_coord -> geolist[i][k] = duplicate_int (new_coord -> ntg[i][k], old_coord -> geolist[i][k]);
210 if (i == 1)
211 {
212 new_coord -> partial_geo[k] = g_malloc0 (new_coord -> ntg[i][k]*sizeof*new_coord -> partial_geo[k]);
213 for (l=0; l<new_coord -> ntg[i][k]; l++)
214 {
215 new_coord -> partial_geo[k][l] = duplicate_int (new_coord -> species, old_coord -> partial_geo[k][l]);
216 }
217 }
218 }
219 }
220 }
221 return new_coord;
222}
223
242 int new_spec, int rem, int adds, int * spid, int *** tmpgeo,
243 gboolean * showcoord[2], gboolean * showpoly[2])
244{
245 int i, j, k, l, m, n, o, p, q, r, s;
246 int * tntg;
247 coord_info * old_coord = duplicate_coord_info (edit -> coord);
248 g_free (edit -> coord);
249 edit -> coord = g_malloc0 (sizeof*edit -> coord);
250 coord_info * tmp_coord = edit -> coord;
251 this_proj -> coord -> cmin = 20;
252 this_proj -> coord -> cmax = 0;
253 for (i=0; i<2; i++)
254 {
255 tmp_coord -> totcoord[i] = 0;
256 tmp_coord -> geolist[i] = g_malloc (new_spec*sizeof*tmp_coord -> geolist[i]);
257 tmp_coord -> ntg[i] = allocint (new_spec);
258 if (i) tmp_coord -> partial_geo = g_malloc (new_spec*sizeof*tmp_coord -> partial_geo);
259 showcoord[i] = allocbool(old_coord -> totcoord[i]);
260 showpoly[i] = allocbool(old_coord -> totcoord[i]);
261 // g_debug ("i= %d, allocating showcoord/poly of %d", i, old_coord -> totcoord[i]);
262 tmp_coord -> totcoord[i] = 0;
263 j = s = 0;
264 // g_debug ("i= %d, new_spec= %d, rem= %d", i, new_spec, rem);
265 for (k=0; k<new_spec+rem; k++)
266 {
267 if (spid[k])
268 {
269 l = 0;
270 // g_debug ("k= %d, alloc tntg of: %d", k, old_coord -> ntg[i][k]);
271 tntg = allocint (old_coord -> ntg[i][k]);
272 // if (i == 0) g_debug (" checking geom:: i= %d, SP= %d, ntg[%d][%d]= %d", i, k, i, k, old_coord -> ntg[i][k]);
273 for (m=0; m<old_coord -> ntg[i][k]; m++)
274 {
275 // if (i == 0) g_debug (" :: m = %d, tmpgeo[%d][%d][%d]= %d", m, i, k, m, tmpgeo[i][k][m]);
276 if (tmpgeo[i][k][m])
277 {
278 p = 1;
279 if (i)
280 {
281 //g_debug ("checking partial, m= %d, l= %d", m, l);
282 if (l)
283 {
284 p = 0;
285 for (o=0; o<m; o++)
286 {
287 for (q=0; q<new_spec+rem; q++)
288 {
289 if (spid[q] && old_coord -> partial_geo[k][m][q] != old_coord -> partial_geo[k][o][q])
290 {
291 p = 1;
292 break;
293 }
294 }
295 if (! p) break;
296 }
297 }
298 }
299 else
300 {
301 for (o=0; o<m; o++)
302 {
303 if (old_coord -> geolist[i][k][m] == old_coord -> geolist[i][k][o])
304 {
305 // g_debug (" WAS HERE:: k= %d, m= %d, o= %d, geolist = %d", k, m, o, old_coord -> geolist[i][k][m]);
306 p = 0;
307 break;
308 }
309 }
310 }
311 if (p)
312 {
313 // g_debug (" i= %d, tntg[m]= 1, m= %d", i, m);
314 tntg[m] = 1;
315 o = l;
316 l ++;
317 }
318 // if (i == 0) g_debug (" geo= %d, old_sp= %d, new_sp= %d, old_geo= %d, new_geo= %d", i, k, s, m, o);
319 for (p=0; p<this_proj -> natomes; p++)
320 {
321 if (this_proj -> atoms[0][p].sp == s)
322 {
323 if (this_proj -> atoms[0][p].coord[i] == m)
324 {
325 this_proj -> atoms[0][p].coord[i] = o;
326 }
327 }
328 }
329 }
330 }
331 if (l)
332 {
333 tmp_coord -> geolist[i][j] = allocint(l);
334 if (i)
335 {
336 // g_debug ("allocating partial[%d] of %d and %d", j, l, new_spec);
337 tmp_coord -> partial_geo[j] = allocdint (l, new_spec);
338 }
339 // if (! i) g_debug (" ntg[0][%d]= %d", j, l);
340 tmp_coord -> ntg[i][j] = l;
341 tmp_coord -> totcoord[i] += l;
342
343 p = (k < new_spec+rem-adds) ? k : new_spec+rem-adds;
344 q = 0;
345 for (r=0; r<p; r++) q += this_proj -> coord -> ntg[i][r];
346 p = 0;
347 for (r=0; r<j; r++) p += tmp_coord -> ntg[i][r];
348 m = 0;
349 for (n=0; n<old_coord -> ntg[i][k]; n++)
350 {
351 // g_debug ("n= %d, tntg[%d]= %d", n, n, tntg[n]);
352 if (tntg[n])
353 {
354 tmp_coord -> geolist[i][j][m] = old_coord -> geolist[i][k][n];
355 this_proj -> coord -> cmax = max (tmp_coord -> geolist[i][j][m], this_proj -> coord -> cmax);
356 this_proj -> coord -> cmin = min (tmp_coord -> geolist[i][j][m], this_proj -> coord -> cmin);
357 if (k < new_spec-adds+rem)
358 {
359 if (n < this_proj -> coord -> ntg[i][k])
360 {
361 //g_debug ("p= %d, m= %d, p+m= %d, q= %d, n= %d, q+n= %d", p, m, p+m, q, n, q+n);
362 showcoord[i][p+m] = this_proj -> modelgl -> anim -> last -> img -> show_coord[i][q+n];
363 showpoly[i][p+m] = this_proj -> modelgl -> anim -> last -> img -> show_poly[i][q+n];
364 }
365 else
366 {
367 showcoord[i][p+m] = TRUE;
368 showpoly[i][p+m] = FALSE;
369 }
370 }
371 else
372 {
373 //g_debug ("p= %d, m= %d, p+m= %d", p, m, p+m);
374 showcoord[i][p+m] = TRUE;
375 showpoly[i][p+m] = FALSE;
376 }
377 if (i)
378 {
379 o = 0;
380 for (r=0; r<new_spec+rem; r++)
381 {
382 if (spid[r])
383 {
384 tmp_coord -> partial_geo[j][m][o] = old_coord -> partial_geo[k][n][r];
385 //g_debug ("j= %d, m= %d, o= %d, partial= %d, %d", j, m, o, tmp_coord -> partial_geo[j][m][o], old_coord -> partial_geo[k][n][r]);
386 o ++;
387 }
388 }
389 }
390 m ++;
391 }
392 }
393 }
394 g_free (tntg);
395 j ++;
396 }
397 s += (spid[k]) ? 1 : 0;
398 }
399 }
400}
401
419void new_coord_menus (project * this_proj, coord_info * coord, int new_spec, int nmols,
420 gboolean * showcoord[2], gboolean * showpoly[2], gboolean * showfrag,
421 gboolean update_it, gboolean update_mol)
422{
423 int i, j, k;
424 for (i=0; i<4; i++)
425 {
426 g_free (this_proj -> modelgl -> gcid[i]);
427 this_proj -> modelgl -> gcid[i] = NULL;
428 }
429
430 for (i=0; i<2; i++) init_opengl_coords (i, coord -> totcoord[i], 0);
431 i = 0;
432 for (j=0; j<new_spec; j++)
433 {
434 init_menu_coordinations_ (& i, & j, & coord -> ntg[0][j], coord -> geolist[0][j]);
435 }
436 i ++;
437 for (j=0; j<new_spec; j++)
438 {
439 allocate_partial_geo_ (& j, & coord -> ntg[1][j]);
440 for (k=0; k<coord -> ntg[1][j]; k++) partial_geo_out_ (& j, & k, & new_spec, coord -> partial_geo[j][k]);
441 init_menu_coordinations_ (& i, & j, & coord -> ntg[1][j], coord -> geolist[1][j]);
442 }
443
444 i = 2;
445 this_proj -> coord -> totcoord[i] += nmols;
446 if (this_proj -> coord -> totcoord[i])
447 {
448 this_proj -> modelgl -> adv_bonding[i-2] = TRUE;
449 init_opengl_coords (i, this_proj -> coord -> totcoord[i], 0);
450 init_menu_fragmol_ (& i);
451 }
452 else
453 {
454 this_proj -> modelgl -> adv_bonding[i-2] = FALSE;
455 }
456 if (update_mol)
457 {
458 i = 3;
459 if (this_proj -> coord -> totcoord[i])
460 {
461 this_proj -> modelgl -> adv_bonding[i-2] = TRUE;
462 init_opengl_coords (i, this_proj -> coord -> totcoord[i], 0);
463 init_menu_fragmol_ (& i);
464 }
465 }
466 else
467 {
468 this_proj -> modelgl -> adv_bonding[1] = FALSE;
469 this_proj -> coord -> totcoord[3] = 0;
470 }
471
472#ifdef GTK3
473 prep_all_coord_menus (this_proj -> modelgl);
474#endif
475 if (update_it)
476 {
477 gboolean * viz[2];
478 for (i=0; i<2; i++) viz[i] = allocbool (this_proj -> natomes);
479 for (i=0; i<this_proj -> natomes; i++)
480 {
481 for (j=0; j<2; j++) viz[j][i] = this_proj -> atoms[0][i].show[j];
482 }
483#ifdef GTK3
484 // GTK3 Menu Action To Check
485 for (i=0; i<2; i++)
486 {
487 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
488 {
489 if (this_proj -> modelgl -> ogl_geom[0][i][j])
490 {
491 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_geom[0][i][j]))
492 {
493 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j]) != showcoord[i][j])
494 {
495 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j], showcoord[i][j]);
496 }
497 }
498 }
499 if (this_proj -> modelgl -> ogl_poly[0][i][j])
500 {
501 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_poly[0][i][j]))
502 {
503 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j]) != showpoly[i][j])
504 {
505 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j], showpoly[i][j]);
506 }
507 }
508 }
509 }
510 g_free (showcoord[i]);
511 g_free (showpoly[i]);
512 }
513 for (i=0; i<this_proj -> coord -> totcoord[2]; i++)
514 {
515 if (this_proj -> modelgl -> ogl_geom[0][2][i])
516 {
517 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_geom[0][2][i]))
518 {
519 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][2][i]) != showfrag[i])
520 {
521 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][2][i], showfrag[i]);
522 }
523 }
524 }
525 }
526#endif
527 for (i=0; i<this_proj -> natomes; i++)
528 {
529 for (j=0; j<2; j++) this_proj -> atoms[0][i].show[j] = viz[j][i];
530 }
531 for (i=0; i<2; i++) g_free (viz[i]);
532 }
533}
534
549void recover_opengl_data (project * this_proj, int nmols, int add, int rem, int * num, int * rec, int *** tmpgeo, gboolean * showfrag)
550{
551 // Now OpenGL data
552 int old_spec = this_proj -> nspec;
553 //g_debug ("recover opengl:: old_spec= %d, add= %d, rem= %d", old_spec, add, rem);
554 int new_spec = old_spec + add - rem;
555 gboolean * showcoord[2];
556 gboolean * showpoly[2];
557 gboolean update_it = FALSE;
558
559 clean_coords_and_geoms (this_proj, this_proj -> modelgl -> atom_win, new_spec, rem, add, num, tmpgeo, showcoord, showpoly);
560
561 if (add || rem)
562 {
563 if (old_spec) free_glwin_spec_data (this_proj, old_spec);
564 glwin_init_spec_data (this_proj, new_spec);
565 }
566
567 this_proj -> nspec = new_spec;
568 active_project_changed (this_proj -> id);
569
570 if ((add && old_spec) || rem)
571 {
572 int h, i, j, k, l, m, n, o, p, q;
573 image * new_img = g_malloc0 (sizeof*new_img);
574 image_init_spec_data (new_img, this_proj, new_spec);
575 image * old_img = this_proj -> modelgl -> anim -> last -> img;
576 // copy info in new data, then clean old data and copy it back
577 for (i=0; i<2; i++)
578 {
579 for (j=0; j<old_spec; j++)
580 {
581 if (num[j])
582 {
583 k = rec[j];
584 new_img -> show_atom[i][j-k] = old_img -> show_atom[i][j];
585 new_img -> show_label[i][j-k] = old_img -> show_label[i][j];
586 }
587 }
588 }
589 for (h=0; h<2*old_spec; h++)
590 {
591 i = (h < old_spec) ? h : h - old_spec;
592 if (num[i])
593 {
594 j = rec[i];
595 k = (h < old_spec) ? 0 : 1;
596 l = h - k*old_spec - j + k*new_spec;
597 new_img -> sphererad[l] = old_img -> sphererad[h];
598 new_img -> atomicrad[l] = old_img -> atomicrad[h];
599 new_img -> pointrad[l] = old_img -> pointrad[h];
600 new_img -> at_color[l].red = old_img -> at_color[h].red;
601 new_img -> at_color[l].green = old_img -> at_color[h].green;
602 new_img -> at_color[l].blue = old_img -> at_color[h].blue;
603 new_img -> at_color[l].alpha = old_img -> at_color[h].alpha;
604 for (m=0; m<2*old_spec; m++)
605 {
606 n = (m < old_spec) ? m : m - old_spec;
607 if (num[n])
608 {
609 o = rec[n];
610 p = (m < old_spec) ? 0 : 1;
611 q = m - p*old_spec - o + p*new_spec;
612 new_img -> linerad[l][q] = old_img -> linerad[h][m];
613 new_img -> bondrad[l][q] = old_img -> bondrad[h][m];
614 }
615 }
616 }
617 }
618 for (i=0; i<2; i++)
619 {
620 if (old_img -> show_atom[i] != NULL)
621 {
622 g_free (old_img -> show_atom[i]);
623 old_img -> show_atom[i] = NULL;
624 }
625 if (old_img -> show_label[i] != NULL)
626 {
627 g_free (old_img -> show_label[i]);
628 old_img -> show_label[i] = NULL;
629 }
630 }
631 for (i=0; i<9; i++)
632 {
633 g_free (old_img -> spcolor[i]);
634 old_img -> spcolor[i] = NULL;
635 }
636 g_free (old_img -> sphererad);
637 g_free (old_img -> atomicrad);
638 g_free (old_img -> pointrad);
639 g_free (old_img -> at_color);
640 g_free (old_img -> linerad);
641 g_free (old_img -> bondrad);
642 for (i=0; i<2; i++)
643 {
644 old_img -> show_atom[i] = duplicate_bool (new_spec, new_img -> show_atom[i]);
645 old_img -> show_label[i] = duplicate_bool (new_spec, new_img -> show_label[i]);
646 }
647 old_img -> sphererad = duplicate_double (2*new_spec, new_img -> sphererad);
648 old_img -> atomicrad = duplicate_double (2*new_spec, new_img -> atomicrad);
649 old_img -> pointrad = duplicate_double (2*new_spec, new_img -> pointrad);
650 old_img -> at_color = duplicate_color (2*new_spec, new_img -> at_color);
651 old_img -> linerad = g_malloc (2*new_spec*sizeof*old_img -> linerad);
652 old_img -> bondrad = g_malloc (2*new_spec*sizeof*old_img -> bondrad);
653 for (i=0; i<2*new_spec; i++)
654 {
655 old_img -> linerad[i] = duplicate_double (2*new_spec, new_img -> linerad[i]);
656 old_img -> bondrad[i] = duplicate_double (2*new_spec, new_img -> bondrad[i]);
657 }
658 for (i=0; i<9; i++)
659 {
660 old_img -> spcolor[i] = NULL;
661 if (i < 2)
662 {
663 old_img -> spcolor[i] = g_malloc (new_spec*sizeof*old_img -> spcolor[i]);
664 }
665 else
666 {
667 old_img -> spcolor[i] = g_malloc (1*sizeof*old_img -> spcolor[i]);
668 old_img -> spcolor[i][0] = NULL;
669 }
670 }
671 g_free (new_img);
672 update_it = TRUE;
673 }
674 else if (add)
675 {
676 image_init_spec_data (this_proj -> modelgl -> anim -> last -> img, this_proj, new_spec);
677 }
678
679 if (add || rem)
680 {
681#ifdef GTK3
682 // GTK3 Menu Action To Check
683 int i;
684 for (i=1; i<OGL_COORDS; i++) this_proj -> modelgl -> ogl_coord[i] = NULL;
685 for (i=0; i<OGL_RINGS; i++) this_proj -> modelgl -> ogl_rings[i] = NULL;
686 this_proj -> modelgl -> ogl_chains[0] = NULL;
687 prepare_opengl_menu_bar (this_proj -> modelgl);
688 // GTK3 Menu Action To Check
689 set_advanced_bonding_menus (this_proj -> modelgl);
690#endif
691 }
692 new_coord_menus (this_proj, this_proj -> modelgl -> atom_win -> coord, new_spec, nmols, showcoord, showpoly, showfrag, update_it, (add || rem) ? FALSE : (! nmols) ? TRUE : FALSE);
693}
void print_coord_info(project *this_proj, coord_info *coord)
print coordination info
Definition atom_coord.c:87
int test_this_coord(project *this_proj, int spec, int gid, int cid, int minc, int maxc)
Look for a type of coordination sphere in a model.
Definition atom_coord.c:62
coord_info * duplicate_coord_info(coord_info *old_coord)
duplicate coordination information data structure
Definition atom_coord.c:190
void recover_opengl_data(project *this_proj, int nmols, int add, int rem, int *num, int *rec, int ***tmpgeo, gboolean *showfrag)
recover image pointer data and OpenGL window menu structure
Definition atom_coord.c:549
void new_coord_menus(project *this_proj, coord_info *coord, int new_spec, int nmols, gboolean *showcoord[2], gboolean *showpoly[2], gboolean *showfrag, gboolean update_it, gboolean update_mol)
Definition atom_coord.c:419
void clean_coords_and_geoms(project *this_proj, atom_edition *edit, int new_spec, int rem, int adds, int *spid, int ***tmpgeo, gboolean *showcoord[2], gboolean *showpoly[2])
clean coordination data and atomic coordination id data
Definition atom_coord.c:241
Function declarations for the mode edition window.
void free_glwin_spec_data(project *this_proj, int spec)
free the memory used by the chemical species related data in a glwin data structure
Definition glview.c:1543
void glwin_init_spec_data(project *this_proj, int nspec)
initialize the glwin chemical species related pointers
Definition glview.c:1588
void prepare_opengl_menu_bar(glwin *view)
update the OpenGL window menu bar
Definition glwindow.c:600
void image_init_spec_data(image *img, project *this_proj, int nsp)
initialize the chemical species related pointers in an image data structure
Definition glview.c:1190
int atoms[NUM_STYLES][2]
coord_info * tmp_coord
Definition dlp_field.c:954
int * duplicate_int(int num, int *old_val)
copy a list of int
Definition global.c:560
gboolean * duplicate_bool(int num, gboolean *old_val)
copy a list of gboolean
Definition global.c:576
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:330
double * duplicate_double(int num, double *old_val)
copy a list of double
Definition global.c:608
gboolean * allocbool(int val)
allocate a gboolean * pointer
Definition global.c:254
int * allocint(int val)
allocate an int * pointer
Definition global.c:314
#define min(a, b)
Definition global.h:81
ColRGBA * duplicate_color(int num, ColRGBA *col)
duplicate a ColRGBA pointer
Definition gtk-misc.c:1602
#define max(a, b)
Definition global.h:80
#define OGL_COORDS
Definition glwin.h:63
#define OGL_RINGS
Definition glwin.h:64
void prep_all_coord_menus(glwin *view)
void init_menu_coordinations_(int *id, int *sp, int *ngsp, int coordt[*ngsp])
getting atomic coordinations data from Fortran90, and related GTK3 menu elements creation
Definition initcoord.c:342
void init_opengl_coords(int id, int nt, int init)
initialize data to store the coordination data
Definition initcoord.c:659
void init_menu_fragmol_(int *id)
getting fragment(s)/molecule(s) data from Fortran90, and related GTK3 menu elements creation
Definition initcoord.c:478
void allocate_partial_geo_(int *sp, int *ngsp)
allocate partial coordination(s) data
Definition initcoord.c:322
void partial_geo_out_(int *sp, int *id, int *ngsp, int coord[*ngsp])
partial coordination data from Fortran90
Definition initcoord.c:309
void set_advanced_bonding_menus(glwin *view)
void active_project_changed(int id)
change the active project
Definition update_p.c:175
Definition glwin.h:277
coord_info * coord
Definition global.h:956
GtkWidget * img
Definition workspace.c:70