atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
atom_object.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_object.c'
24*
25* Contains:
26*
27
28 - The functions to create atomic objects
29
30*
31* List of functions:
32
33 int in_object_bond_list (atomic_object * object, int aid, int bid);
34 int create_object_from_open_project (project * this_proj, int p);
35
36 int * duplicate_z (int species, double * old_z);
37
38 double get_object_dim (atomic_object * object);
39
40 gboolean rebuild_atom_neighbors (project * this_proj, int step, atomic_object * object, int target, int aid, atom * at, gboolean * checked_at);
41
42 void correct_pos_and_get_dim (atomic_object * object, gboolean adjust);
43 void reconstruct_bonds (project * this_proj, int ifcl, int * bcid);
44 void reconstruct_coordinates_for_object (project * this_proj, atomic_object * this_object, gboolean upcoord);
45 void correct_coordinates_for_object (project * this_proj, atomic_object * this_object, gboolean upcoord);
46 void create_object_from_library (int p);
47 void clean_object_vois (project * this_proj, atomic_object * object, int * new_id, gboolean movtion);
48 void clean_object_bonds (project * proj, int o_step, atomic_object * object, int * new_id, gboolean movtion);
49 void add_object_atoms (atomic_object * this_object, project * this_proj,
50 int o_step, int numa, int * old_id, gboolean alloc_new_id, atom_search * remove);
51 void adjust_object_frag_coord (atomic_object * object);
52 void clean_this_object (int orig, int act, project * this_proj, atom_search * asearch);
53 void to_insert_in_project (int stat, int orig, project * this_proj, atom_search * asearch, gboolean visible);
54
55 atomic_object * duplicate_atomic_object (atomic_object * old_obj);
56 atomic_object * create_object_from_species (project * this_proj, int sid, atom_search * remove);
57 atomic_object * create_object_from_selection (project * this_proj);
58 atomic_object * create_object_from_atom_coordination (project * this_proj, int coord, int aid, atom_search * remove);
59 atomic_object * create_object_from_overall_coordination (project * this_proj, int coord, int aid, atom_search * remove);
60 atomic_object * create_object_from_frag_mol (project * this_proj, int coord, int geo, atom_search * remove);
61
62 tint ulam_coord (glwin * view);
63
64*/
65
66#include "atom_edit.h"
67
69
78{
79 double dmax = 0.0;
80 vec3_t at, bt;
82 int i, j;
83 for (i=0; i<object -> atoms-1; i++)
84 {
85 at = vec3 (object -> at_list[i].x, object -> at_list[i].y, object -> at_list[i].z);
86 for (j=i+1; j<object -> atoms; j++)
87 {
88 bt = vec3 (object -> at_list[j].x, object -> at_list[j].y, object -> at_list[j].z);
89 dist = v3_sub(at, bt);
90 dmax = max (dmax, v3_length(dist));
91 }
92 }
93 return dmax+1.0;
94}
95
104void correct_pos_and_get_dim (atomic_object * object, gboolean adjust)
105{
106 int i;
107 if (object -> baryc) g_free(object -> baryc);
108 object -> baryc = allocdouble(3);
109 for (i=0; i<object -> atoms; i++)
110 {
111 object -> baryc[0] += object -> at_list[i].x;
112 object -> baryc[1] += object -> at_list[i].y;
113 object -> baryc[2] += object -> at_list[i].z;
114 }
115 for (i=0; i<3; i++) object -> baryc[i] /= object -> atoms;
116 if (adjust)
117 {
118 for (i=0; i<object -> atoms; i++)
119 {
120 object -> at_list[i].x -= object -> baryc[0];
121 object -> at_list[i].y -= object -> baryc[1];
122 object -> at_list[i].z -= object -> baryc[2];
123 }
124 }
125 object -> dim = get_object_dim (object);
126}
127
141gboolean rebuild_atom_neighbors (project * this_proj, int step, atomic_object * object, int target, int aid, atom * at, gboolean * checked_at)
142{
143 int i, j;
145 for (i=0; i<at -> numv; i++)
146 {
147 j = at -> vois[i];
148 dist = distance_3d (& this_proj -> cell, step, at, & object -> at_list[j]);
149 if (dist.pbc && ! checked_at[j])
150 {
151 object -> at_list[j].x = at -> x - dist.x;
152 object -> at_list[j].y = at -> y - dist.y;
153 object -> at_list[j].z = at -> z - dist.z;
154 }
155 }
156 checked_at[aid] = TRUE;
157 i = 0;
158 for (j=0; j<object -> atoms; j++) if (checked_at[j]) i ++;
159 if (i == target) return TRUE;
160 for (i=0; i<at -> numv; i++)
161 {
162 j = at -> vois[i];
163 if (! checked_at[j])
164 {
165 if (rebuild_atom_neighbors (this_proj, step, object, target, j, & object -> at_list[j], checked_at)) return TRUE;
166 }
167 }
168 return FALSE;
169}
170
180void reconstruct_bonds (project * this_proj, int ifcl, int * bcid)
181{
182 int i, j, k, l;
183 int o_step = this_proj -> modelgl -> anim -> last -> img -> step;
184 int ** old_bid = NULL;
185 old_bid = allocdint (this_proj -> modelgl -> bonds[o_step][0], 2);
186 for (i=0; i<this_proj -> modelgl -> bonds[o_step][0]; i++)
187 {
188 for (j=0; j<2; j++) old_bid[i][j] = this_proj -> modelgl -> bondid[o_step][0][i][j];
189 }
190 g_free (this_proj -> modelgl -> bondid[o_step][0]);
191 this_proj -> modelgl -> bondid[o_step][0] = allocdint (this_proj -> modelgl -> bonds[o_step][0]+ ifcl, 2);
192 for (i=0; i<this_proj -> modelgl -> bonds[o_step][0]; i++)
193 {
194 for (j=0; j<2; j++) this_proj -> modelgl -> bondid[o_step][0][i][j] = old_bid[i][j];
195 }
196 if (old_bid) g_free (old_bid);
197 old_bid = NULL;
198
199 for (i=0; i<ifcl; i++)
200 {
201 j = bcid[i];
202 k = this_proj -> modelgl -> bonds[o_step][0];
203 for (l=0; l<2; l++)
204 {
205 this_proj -> modelgl -> bondid[o_step][0][k][l] = this_proj -> modelgl -> bondid[o_step][1][j][l];
206 }
207 this_proj -> modelgl -> bonds[o_step][0] ++;
208 this_proj -> modelgl -> allbonds[0] ++;
209 this_proj -> modelgl -> bondid[o_step][1][j][0] = -1;
210 }
211
212 vec3_t * old_clo = NULL;
213 i = this_proj -> modelgl -> bonds[o_step][1] - ifcl;
214 l = 0;
215 if (i)
216 {
217 old_clo = g_malloc0 (i*sizeof*old_clo);
218 old_bid = allocdint (i, 2);
219 for (i=0; i<this_proj -> modelgl -> bonds[o_step][1]; i++)
220 {
221 if (this_proj -> modelgl -> bondid[o_step][1][i][0] > -1)
222 {
223 for (k=0; k<2; k++) old_bid[l][k] = this_proj -> modelgl -> bondid[o_step][1][i][k];
224 old_clo[l].x = this_proj -> modelgl -> clones[o_step][i].x;
225 old_clo[l].y = this_proj -> modelgl -> clones[o_step][i].y;
226 old_clo[l].z = this_proj -> modelgl -> clones[o_step][i].z;
227 l ++;
228 }
229 }
230 }
231 g_free (this_proj -> modelgl -> bondid[o_step][1]);
232 this_proj -> modelgl -> bondid[o_step][1] = NULL;
233 g_free (this_proj -> modelgl -> clones[o_step]);
234 this_proj -> modelgl -> clones[o_step] = NULL;
235 this_proj -> modelgl -> bonds[o_step][1] = this_proj -> modelgl -> allbonds[1] = l;
236 if (l)
237 {
238 this_proj -> modelgl -> bondid[o_step][1] = allocdint (l, 2);
239 this_proj -> modelgl -> clones[o_step] = g_malloc0 (l*sizeof*this_proj -> modelgl -> clones[o_step]);
240 for (i=0; i<l; i++)
241 {
242 for (j=0; j<2; j++) this_proj -> modelgl -> bondid[o_step][1][i][j] = old_bid[i][j];
243 this_proj -> modelgl -> clones[o_step][i].x = old_clo[i].x;
244 this_proj -> modelgl -> clones[o_step][i].y = old_clo[i].y;
245 this_proj -> modelgl -> clones[o_step][i].z = old_clo[i].z;
246 }
247 if (old_clo) g_free (old_clo);
248 old_clo = NULL;
249 if (old_bid) g_free (old_bid);
250 old_bid = NULL;
251 }
252}
253
263void reconstruct_coordinates_for_object (project * this_proj, atomic_object * this_object, gboolean upcoord)
264{
265 int h, i, j, k;
266 if (this_proj -> coord -> totcoord[2])
267 {
268 int * tmp_multi = allocint (this_proj -> coord -> totcoord[2]);
269 for (i=0; i<this_object -> atoms; i++)
270 {
271 j = this_object -> at_list[i].coord[2];
272 tmp_multi[j] = 1;
273 }
274 gboolean * checked_at = allocbool (this_object -> atoms);
275 h = (this_proj -> cell.npt) ? this_proj -> modelgl -> anim -> last -> img -> step : 0;
276 for (i=0; i<this_proj -> coord -> totcoord[2]; i++)
277 {
278 if (tmp_multi[i])
279 {
280 k = 0;
281 for (j=0; j<this_object -> atoms; j++)
282 {
283 checked_at[j] = FALSE;
284 if (this_object -> at_list[j].coord[2] == i)
285 {
286 k ++;
287 }
288 }
289 for (j=0; j<this_object -> atoms; j++)
290 {
291 if (this_object -> at_list[j].coord[2] == i)
292 {
293 rebuild_atom_neighbors (this_proj, h, this_object, k, j, & this_object -> at_list[j], checked_at);
294 }
295 }
296 }
297 }
298 g_free (checked_at);
299 }
300 correct_pos_and_get_dim (this_object, TRUE);
301 if (upcoord)
302 {
303 reconstruct_bonds (this_proj, this_object -> ifcl, this_object -> bcid);
304 for (i=0; i<this_object -> atoms; i++)
305 {
306 j = this_object -> at_list[i].id;
307 this_proj -> atoms[0][j].x = this_object -> at_list[i].x + this_object -> baryc[0];
308 this_proj -> atoms[0][j].y = this_object -> at_list[i].y + this_object -> baryc[1];
309 this_proj -> atoms[0][j].z = this_object -> at_list[i].z + this_object -> baryc[2];
310 this_proj -> atoms[0][j].cloned = FALSE;
311 }
312 for (i=0; i<3; i++) this_proj -> modelgl -> saved_coord[i] = save_coordinates (this_proj, i);
313 }
314}
315
325void correct_coordinates_for_object (project * this_proj, atomic_object * this_object, gboolean upcoord)
326{
327 if (this_object -> ifcl)
328 {
329 if (upcoord)
330 {
331 reconstruct_coordinates_for_object (this_proj, this_object, upcoord);
332 this_object -> ifcl = 0;
333 g_free (this_object -> bcid);
334 this_object -> bcid = NULL;
335 }
336 else
337 {
338 correct_pos_and_get_dim (this_object, FALSE);
339 }
340 }
341 else
342 {
343 correct_pos_and_get_dim (this_object, TRUE);
344 }
345}
346
355{
356 tint pos;
357 int m;
358 pos.a = pos.b = pos.c = 0;
359 if (view -> builder_win) return pos;
360 int p = view -> nth_copy;
361 if (p > 0)
362 {
363 pos.c = p/9;
364 m = p - pos.c*9;
365 pos.b = m/3;
366 pos.a = p - pos.c*9 - pos.b*3;
367 }
368 return pos;
369}
370
373
382{
383 atomic_object * new_obj = g_malloc0 (sizeof*new_obj);
384 new_obj -> origin = old_obj -> origin;
385 new_obj -> type = old_obj -> type;
386 new_obj -> dim = old_obj -> dim;
387 new_obj -> name = g_strdup_printf ("%s", old_obj -> name);
388 new_obj -> atoms = old_obj -> atoms;
389 new_obj -> at_list = g_malloc0 (new_obj -> atoms*sizeof*new_obj -> at_list);
390 int i;
391 for (i=0; i<new_obj -> atoms; i++)
392 {
393 new_obj -> at_list[i] = * duplicate_atom (& old_obj -> at_list[i]);
394 }
395 new_obj -> old_z = duplicate_int (old_obj -> species, old_obj -> old_z);
396 new_obj -> coord = duplicate_coord_info (old_obj -> coord);
397 new_obj -> baryc = duplicate_double (3, old_obj -> baryc);
398
399 new_obj -> occ = old_obj -> occ;
400 new_obj -> species = old_obj -> species;
401 if (old_obj -> bonds)
402 {
403 new_obj -> ibonds = g_malloc0 (old_obj -> bonds*sizeof*new_obj -> ibonds);
404 int i;
405 for (i=0; i<old_obj -> bonds; i++)
406 {
407 new_obj -> ibonds[i] = duplicate_int (2, old_obj -> ibonds[i]);
408 }
409 }
410 new_obj -> bonds = old_obj -> bonds;
411 return new_obj;
412}
413
422{
423 int i, j;
424 lib_object = g_malloc0 (sizeof*lib_object);
425 project * other_proj = get_project_by_id (p);
426 i = other_proj -> natomes;
427 lib_object -> type = FROM_LIBRARY;
428 lib_object -> origin = p;
429 lib_object -> name = g_strdup_printf ("%s", other_proj -> name);
430 lib_object -> coord = duplicate_coord_info (other_proj -> coord);
431 lib_object -> atoms = i;
432 lib_object -> at_list = g_malloc0 (lib_object -> atoms*sizeof*lib_object -> at_list);
433 lib_object -> occ = 1.0;
434 lib_object -> species = other_proj -> nspec;
435 lib_object -> old_z = allocint (other_proj -> nspec);
436 for (j=0; j<other_proj -> nspec; j++) lib_object -> old_z[j] = (int) other_proj -> chemistry -> chem_prop[CHEM_Z][j];
437 for (j=0; j<i; j++)
438 {
439 lib_object -> at_list[j] = * duplicate_atom (& other_proj -> atoms[0][j]);
440 }
442 if (other_proj -> modelgl -> bonds[0][0])
443 {
444 i = other_proj -> modelgl -> bonds[0][0];
445 lib_object -> ibonds = allocdint (i, 2);
446 for (j=0; j<i; j++)
447 {
448 lib_object -> ibonds[j][0] = other_proj -> modelgl -> bondid[0][0][j][0];
449 lib_object -> ibonds[j][1] = other_proj -> modelgl -> bondid[0][0][j][1];
450 }
451 lib_object -> bonds = i;
452 }
453 // Always one frag from library
454 lib_object -> coord -> totcoord[2] = 1;
455}
456
466int in_object_bond_list (atomic_object * object, int aid, int bid)
467{
468 int i;
469 for (i=0; i<object -> bonds; i++)
470 {
471 if (object -> ibonds[i][0] == aid && object -> ibonds[i][1] == bid) return 1;
472 if (object -> ibonds[i][1] == aid && object -> ibonds[i][0] == bid) return 1;
473 }
474 return 0;
475}
476
487void clean_object_vois (project * this_proj, atomic_object * object, int * new_id, gboolean movtion)
488{
489 int i, j, k, l;
490 int * tmpv;
491
492 for (i=0; i<object -> atoms; i++)
493 {
494 if (object -> at_list[i].numv)
495 {
496 tmpv = duplicate_int (object -> at_list[i].numv, object -> at_list[i].vois);
497 g_free (object -> at_list[i].vois);
498 object -> at_list[i].vois = NULL;
499 j = 0;
500 for (k=0; k<object -> at_list[i].numv; k++)
501 {
502 l = tmpv[k];
503 if (new_id[l])
504 {
505 j += (! movtion) ? in_object_bond_list(object, i, new_id[l]-1) : 1;
506 }
507 }
508 if (j)
509 {
510 object -> at_list[i].vois = allocint (j);
511 j = 0;
512 for (k=0; k<object -> at_list[i].numv; k++)
513 {
514 l = tmpv[k];
515 if (new_id[l])
516 {
517 if (! movtion || in_object_bond_list(object, i, new_id[l]-1))
518 {
519 object -> at_list[i].vois[j] = new_id[l]-1;
520 j ++;
521 }
522 }
523 }
524 }
525 object -> at_list[i].numv = j;
526 g_free (tmpv);
527 }
528 }
529}
530
542void clean_object_bonds (project * proj, int o_step, atomic_object * object, int * new_id, gboolean movtion)
543{
544 int h, i, j, k, l, m;
545 gboolean doit;
546 int ** tmpibonds = allocdint (proj -> modelgl -> bonds[o_step][0]+proj -> modelgl -> bonds[o_step][1], 2);
547 if (proj -> modelgl -> bonds[o_step][1])
548 {
549 h = (movtion) ? 2 : 1;
550 }
551 else
552 {
553 h = 1;
554 }
555 i = 0;
556 if (new_id) object -> bcid = allocint (proj -> modelgl -> bonds[o_step][1]);
557 for (j=0; j<h; j++)
558 {
559 for (k=0; k<proj -> modelgl -> bonds[o_step][j]; k++)
560 {
561 l = proj -> modelgl -> bondid[o_step][j][k][0];
562 m = proj -> modelgl -> bondid[o_step][j][k][1];
563 doit = FALSE;
564 if (new_id)
565 {
566 if (new_id[l] && new_id[m]) doit = TRUE;
567 }
568 else
569 {
570 doit = TRUE;
571 }
572 if (doit)
573 {
574 if (new_id)
575 {
576 tmpibonds[i][0] = new_id[l] - 1;
577 tmpibonds[i][1] = new_id[m] - 1;
578 }
579 else
580 {
581 tmpibonds[i][0] = l;
582 tmpibonds[i][1] = m;
583 }
584 i ++;
585 if (j && new_id)
586 {
587 object -> bcid[object -> ifcl] = k;
588 object -> ifcl ++;
589 }
590 }
591 }
592 }
593 if (i)
594 {
595 object -> ibonds = allocdint (i, 2);
596 for (j=0; j<i; j++)
597 {
598 object -> ibonds[j][0] = tmpibonds[j][0];
599 object -> ibonds[j][1] = tmpibonds[j][1];
600 }
601 }
602 g_free (tmpibonds);
603 object -> bonds = i;
604 if (new_id) clean_object_vois (proj, object, new_id, movtion);
605}
606
621void add_object_atoms (atomic_object * this_object, project * this_proj,
622 int o_step, int numa, int * old_id, gboolean check_bonding, atom_search * remove)
623{
624 int i, j;
625 this_object -> atoms = numa;
626 this_object -> at_list = g_malloc0 (this_object -> atoms*sizeof*this_object -> at_list);
627 int * new_id = allocint (this_proj -> natomes);
628 for (i=0; i<this_object -> atoms; i++)
629 {
630 j = old_id[i]-1;
631 new_id[j] = i+1;
632 if (remove) remove -> todo[j] = 1;
633 this_object -> at_list[i] = * duplicate_atom (& this_proj -> atoms[o_step][j]);
634 if (i)
635 {
636 this_object -> at_list[i].prev = & this_object -> at_list[i-1];
637 this_object -> at_list[i-1].next = & this_object -> at_list[i];
638 }
639 }
640 gboolean movtion = ((object_motion && this_proj -> modelgl -> rebuild[0][0]) || (! object_motion && this_proj -> modelgl -> rebuild[1][0]));
641 if (check_bonding)
642 {
643 clean_object_bonds (this_proj, o_step, this_object, new_id, movtion);
644 }
645 correct_coordinates_for_object (this_proj, this_object, movtion);
646 if (check_bonding)
647 {
648 check_coord_modification (this_proj, NULL, & this_object -> at_list[0], this_object, FALSE, FALSE);
649 }
650 g_free (old_id);
651 g_free (new_id);
652}
653
663int * duplicate_z (int species, double * old_z)
664{
665 int i;
666 int * new_z = allocint (species);
667 for (i=0; i<species; i++)
668 {
669 new_z[i] = (int)old_z[i];
670 }
671 return new_z;
672}
673
684{
685 int i, j;
686 atomic_object * this_object = g_malloc0 (sizeof*this_object);
687 int o_step = this_proj -> modelgl -> anim -> last -> img -> step;
688 this_object -> name = g_strdup_printf ("%s", this_proj -> chemistry -> label[sid]);
689 i = this_proj -> chemistry -> nsps[sid];
690 this_object -> type = FROM_SPEC;
691 this_object -> origin = this_proj -> id;
692 this_object -> atoms = i;
693 this_object -> at_list = g_malloc0 (this_object -> atoms*sizeof*this_object -> at_list);
694 this_object -> occ = 1.0;
695 this_object -> coord = duplicate_coord_info (this_proj -> coord);
696 this_object -> species = this_proj -> nspec;
697 this_object -> old_z = duplicate_z (this_proj -> nspec, this_proj -> chemistry -> chem_prop[CHEM_Z]);
698 int * new_id = NULL;
699 new_id = allocint (this_proj -> natomes);
700 gboolean check_bonding = FALSE;
701 gboolean bonding = FALSE;
702 i = 0;
703 for (j=0; j<this_proj -> natomes; j++)
704 {
705 if (this_proj -> atoms[o_step][j].sp == sid)
706 {
707 if (this_proj -> atoms[o_step][j].numv) bonding = TRUE;
708 new_id[i] = j+1;
709 i ++;
710 }
711 }
712 check_bonding = (i != this_proj -> natomes && bonding) ? TRUE : FALSE;
713 add_object_atoms (this_object, this_proj, o_step, i, new_id, check_bonding, remove);
714 return this_object;
715}
716
725{
726 int i, j;
727 atomic_object * this_object = g_malloc0 (sizeof*this_object);
728 int o_step = this_proj -> modelgl -> anim -> last -> img -> step;
729 this_object -> name = g_strdup_printf ("From selection");
730 i = 0;
731 for (j=0; j<this_proj->natomes; j++)
732 {
733 if (pasted_todo[j]) i++;
734 }
735 this_object -> type = FROM_DATA;
736 this_object -> origin = this_proj -> id;
737 this_object -> atoms = i;
738 this_object -> at_list = g_malloc0 (this_object -> atoms*sizeof*this_object -> at_list);
739 this_object -> occ = 1.0;
740 this_object -> coord = duplicate_coord_info (this_proj -> coord);
741 this_object -> species = this_proj -> nspec;
742 this_object -> old_z = duplicate_z (this_proj -> nspec, this_proj -> chemistry -> chem_prop[CHEM_Z]);
743 i = 0;
744 int * new_id = NULL;
745 new_id = allocint(this_proj -> natomes);
746 gboolean check_bonding = FALSE;
747 gboolean bonding = FALSE;
748 for (j=0; j<this_proj -> natomes; j++)
749 {
750 if (pasted_todo[j])
751 {
752 new_id[i] = j+1;
753 if (this_proj -> atoms[o_step][j].numv) bonding = TRUE;
754 i ++;
755 }
756 }
757 check_bonding = (i != this_proj -> natomes && bonding) ? TRUE : FALSE;
758 add_object_atoms (this_object, this_proj, o_step, i, new_id, check_bonding, NULL);
759 if (pasted_todo)
760 {
761 g_free (pasted_todo);
762 pasted_todo = NULL;
763 }
764 return this_object;
765}
766
777atomic_object * create_object_from_atom_coordination (project * this_proj, int coord, int aid, atom_search * remove)
778{
779 int i, j, k;
780 atomic_object * this_object = g_malloc0 (sizeof*this_object);
781 gchar * str;
782 int o_step = this_proj -> modelgl -> anim -> last -> img -> step;
783 i = this_proj -> atoms[o_step][aid].numv;
784 k = this_proj -> atoms[o_step][aid].coord[coord];
785 j = this_proj -> atoms[o_step][aid].sp;
786 switch (coord)
787 {
788 case 0:
789 if (i > 0)
790 {
791 str = g_strdup_printf ("%d-fold", i);
792 }
793 else
794 {
795 str = g_strdup_printf ("Isolated");
796 }
797 break;
798 case 1:
799 str = g_strdup_printf ("%s", env_name(this_proj, k, j, 1, NULL));
800 break;
801 }
802 this_object -> name = g_strdup_printf ("%s - %s<sub>%d</sub>", str, this_proj -> chemistry -> label[j], aid+1);
803 g_free (str);
804 this_object -> type = - (coord + 3);
805 this_object -> origin = this_proj -> id;
806 this_object -> atoms = i+1;
807 this_object -> at_list = g_malloc0 (this_object -> atoms*sizeof*this_object -> at_list);
808 this_object -> occ = 1.0;
809 this_object -> coord = duplicate_coord_info (this_proj -> coord);
810 this_object -> species = this_proj -> nspec;
811 this_object -> old_z = duplicate_int (this_proj -> nspec, (int *)this_proj -> chemistry -> chem_prop[CHEM_Z]);
812 this_object -> at_list[0] = * duplicate_atom (& this_proj -> atoms[o_step][aid]);
813 if (remove) remove_search -> todo[aid] = 1;
814 gboolean movtion = (object_motion && this_proj -> modelgl -> rebuild[0][0]) || (! object_motion && this_proj -> modelgl -> rebuild[1][0]);
815 if (this_proj -> atoms[o_step][aid].numv)
816 {
817 int * new_id = NULL;
818 new_id = allocint (this_proj -> natomes);
819 new_id[aid] = 1;
820 for (i=0; i<this_proj -> atoms[o_step][aid].numv; i++)
821 {
822 j = this_proj -> atoms[o_step][aid].vois[i];
823 if (remove) remove_search -> todo[j] = 1;
824 new_id[j] = i+2;
825 this_object -> at_list[i+1] = * duplicate_atom (& this_proj -> atoms[o_step][j]);
826 }
827 clean_object_bonds (this_proj, o_step, this_object, new_id, movtion);
828 if (new_id)
829 {
830 g_free (new_id);
831 new_id = NULL;
832 }
833 correct_coordinates_for_object (this_proj, this_object, movtion);
834 }
835 return this_object;
836}
837
849{
850 int i, j, k, l, m, n;
851 atomic_object * this_object = g_malloc0 (sizeof*this_object);
852 int o_step = this_proj -> modelgl -> anim -> last -> img -> step;
853 this_object -> coord = duplicate_coord_info (this_proj -> coord);
854 this_object -> species = this_proj -> nspec;
855 this_object -> old_z = duplicate_z (this_proj -> nspec, this_proj -> chemistry -> chem_prop[CHEM_Z]);
856 this_object -> type = - (coord + 3);
857 this_object -> origin = this_proj -> id;
858 this_object -> occ = 1.0;
859 int * new_id = NULL;
860 new_id = allocint(this_proj -> natomes);
861 gchar * str;
862 gboolean check_bonding = FALSE;
863 gboolean bonding = FALSE;
864 switch (coord)
865 {
866 case 0:
867 for (k=0; k<this_proj -> natomes; k++)
868 {
869 if (this_proj -> atoms[o_step][k].coord[0] == aid)
870 {
871 i = this_proj -> atoms[o_step][k].numv;
872 break;
873 }
874 }
875 if (i)
876 {
877 bonding = TRUE;
878 str = g_strdup_printf ("%d-fold", i);
879 }
880 else
881 {
882 str = g_strdup_printf ("Isolated");
883 }
884 j = 0;
885 for (k=0; k<this_proj -> natomes; k++)
886 {
887 if (this_proj -> atoms[o_step][k].numv == aid)
888 {
889 new_id[j] = k+1;
890 j ++;
891 }
892 }
893 break;
894 case 1:
895 j = 0;
896 for (k=0; k<this_proj -> natomes; k++)
897 {
898 l = this_proj -> atoms[o_step][k].sp;
899 m = this_proj -> atoms[o_step][k].coord[coord-1];
900 for (n=0; n<l; n++) m += this_proj -> coord -> ntg[1][n];
901 if (m == aid)
902 {
903 new_id[j] = k+1;
904 if (this_proj -> atoms[o_step][k].numv) bonding = TRUE;
905 j ++;
906 }
907 }
908 str = g_strdup_printf ("%s", env_name(this_proj, l, aid, 1, NULL));
909 break;
910 }
911 this_object -> name = g_strdup_printf ("All %s - atom(s)", str);
912 g_free (str);
913 check_bonding = (j != this_proj -> natomes && bonding) ? TRUE : FALSE;
914 add_object_atoms (this_object, this_proj, o_step, j, new_id, check_bonding, remove);
915 return this_object;
916}
917
928atomic_object * create_object_from_frag_mol (project * this_proj, int coord, int geo, atom_search * remove)
929{
930 int i, j;
931 atomic_object * this_object = g_malloc0 (sizeof*this_object);
932 if (coord == 2)
933 {
934 this_object -> name = g_strdup_printf ("Fragment N°%d", geo+1);
935 }
936 else
937 {
938 this_object -> name = g_strdup_printf ("Molecule N°%d", geo+1);
939 }
940 int o_step = this_proj -> modelgl -> anim -> last -> img -> step;
941 this_object -> type = - (coord + 3);
942 this_object -> origin = this_proj -> id;
943 this_object -> occ = 1.0;
944 this_object -> coord = duplicate_coord_info (this_proj -> coord);
945 this_object -> species = this_proj -> nspec;
946 this_object -> old_z = duplicate_z (this_proj -> nspec, this_proj -> chemistry -> chem_prop[CHEM_Z]);
947 int * new_id = NULL;
948 new_id = allocint(this_proj -> natomes);
949 gboolean check_bonding = FALSE;
950 gboolean bonding = FALSE;
951 i = 0;
952 for (j=0; j<this_proj->natomes; j++)
953 {
954 if (this_proj -> atoms[o_step][j].coord[coord] == geo)
955 {
956 new_id[i] = j+1;
957 if (this_proj -> atoms[o_step][j].numv) bonding = TRUE;
958 i++;
959 }
960 }
961 check_bonding = (i != this_proj -> natomes && bonding) ? TRUE : FALSE;
962 add_object_atoms (this_object, this_proj, o_step, i, new_id, check_bonding, remove);
963 return this_object;
964}
965
974{
975 int i, j, k;
976 int * corf = allocint (object -> coord -> totcoord[2]);
977 int * rorf = allocint (object -> coord -> totcoord[2]);
978 for (i=0; i<object -> atoms; i++)
979 {
980 j = object -> at_list[i].coord[2];
981 rorf[j] ++;
982 }
983 j = k = 0;
984 for (i=0; i<object -> coord -> totcoord[2]; i++)
985 {
986 corf[i] = k;
987 if (rorf[i])
988 {
989 j++;
990 }
991 else
992 {
993 k++;
994 }
995 }
996 object -> coord -> totcoord[2] = j;
997
998 for (i=0; i<object -> atoms; i++)
999 {
1000 j = corf[object -> at_list[i].coord[2]];
1001 object -> at_list[i].coord[2] -= j;
1002 object -> at_list[i].id = i;
1003 }
1004 remove_bonds_from_project (NULL, object, NULL, & object -> at_list[0], FALSE, FALSE);
1005}
1006
1016{
1017 int i, j;
1018 lib_object = g_malloc0 (sizeof*lib_object);
1019 project * other_proj;
1020 other_proj = get_project_by_id (p);
1021 int o_step = other_proj -> modelgl -> anim -> last -> img -> step;
1022 switch (this_proj -> modelgl -> other_status)
1023 {
1024 case 0:
1025 i = other_proj -> natomes - other_proj -> modelgl -> anim -> last -> img -> selected[0] -> selected;
1026 lib_object -> name = g_strdup_printf ("All non-selected atom(s) from: %s", get_project_by_id(p) -> name);
1027 break;
1028 case 1:
1029 i = other_proj -> modelgl -> anim -> last -> img -> selected[0] -> selected;
1030 lib_object -> name = g_strdup_printf ("All selected atom(s) from: %s", get_project_by_id(p) -> name);
1031 break;
1032 case 2:
1033 i = other_proj -> natomes;
1034 lib_object -> name = g_strdup_printf ("All atom(s) from: %s", get_project_by_id(p) -> name);
1035 break;
1036 }
1037 lib_object -> type = FROM_PROJECT;
1038 lib_object -> origin = p;
1039 lib_object -> atoms = i;
1040 lib_object -> at_list = g_malloc0 (lib_object -> atoms*sizeof*lib_object -> at_list);
1041 lib_object -> occ = 1.0;
1042 lib_object -> coord = duplicate_coord_info (other_proj -> coord);
1043 lib_object -> species = other_proj -> nspec;
1044 lib_object -> old_z = duplicate_z (other_proj -> nspec, other_proj -> chemistry -> chem_prop[CHEM_Z]);
1045 int * new_id = NULL;
1046 gboolean check_bonding = FALSE;
1047 new_id = allocint (other_proj -> natomes);
1048 if (this_proj -> modelgl -> other_status == 2)
1049 {
1050 for (j=0; j<i; j++)
1051 {
1052 lib_object -> at_list[j] = * duplicate_atom (& other_proj -> atoms[o_step][j]);
1053 new_id[j] = j+1;
1054 if (j)
1055 {
1056 lib_object -> at_list[j].prev = & lib_object -> at_list[j-1];
1057 lib_object -> at_list[j-1].next = & lib_object -> at_list[j];
1058 }
1059 }
1060 }
1061 else
1062 {
1063 i = 0;
1064 for (j=0; j<other_proj -> natomes; j++)
1065 {
1066 if (other_proj -> atoms[o_step][j].pick[0] == this_proj -> modelgl -> other_status)
1067 {
1068 lib_object -> at_list[i] = * duplicate_atom (& other_proj -> atoms[o_step][j]);
1069 new_id[j] = i+1;
1070 if (i)
1071 {
1072 lib_object -> at_list[i].prev = & lib_object -> at_list[i-1];
1073 lib_object -> at_list[i-1].next = & lib_object -> at_list[i];
1074 }
1075 i ++;
1076 }
1077 }
1078 }
1079 check_bonding = (i != other_proj -> natomes && (other_proj -> modelgl -> bonds[o_step][0] || other_proj -> modelgl -> bonds[o_step][1])) ? TRUE : FALSE;
1080 clean_object_bonds (other_proj, o_step, lib_object, new_id, check_bonding);
1081 if (i < other_proj -> natomes)
1082 {
1083 for (j=0; j<lib_object -> atoms; j++) lib_object -> at_list[j].id = new_id[lib_object -> at_list[j].id]-1;
1084 if (check_bonding) check_coord_modification (other_proj, NULL, & lib_object -> at_list[0], lib_object, FALSE, FALSE);
1085 }
1086 correct_coordinates_for_object (other_proj, lib_object, TRUE);
1087 if (i < other_proj -> natomes && check_bonding) adjust_object_frag_coord (lib_object);
1088
1089 return FROM_PROJECT;
1090}
1091
1102void clean_this_object (int orig, int act, project * this_proj, atom_search * asearch)
1103{
1104 atomic_object * tmp_object = NULL;
1105 atomic_object * object;
1106 switch (asearch -> action)
1107 {
1108 case REPLACE:
1109 object = (this_proj -> modelgl) ? this_proj -> modelgl -> atom_win -> to_be_inserted[act] : cif_object;
1110 break;
1111 default:
1112 object = this_proj -> modelgl -> atom_win -> to_be_moved[act];
1113 break;
1114 }
1115 while (object)
1116 {
1117 if ((object -> origin > -1 || object -> origin < -2) && object -> origin == orig)
1118 {
1119 if (object -> ibonds) g_free (object -> ibonds);
1120 if (object -> baryc) g_free (object -> baryc);
1121 if (object -> at_list) g_free (object -> at_list);
1122 if (object -> coord) g_free (object -> coord);
1123 object -> atoms = object -> bonds = 0;
1124 asearch -> in_selection --;
1125 if (object -> prev != NULL)
1126 {
1127 if (object -> next != NULL)
1128 {
1129 object -> next -> prev = object -> prev;
1130 object -> prev -> next = object -> next;
1131 tmp_object = object -> next;
1132 g_free (object);
1133 object = tmp_object;
1134 }
1135 else
1136 {
1137 object = object -> prev;
1138 g_free (object -> next);
1139 object -> next = NULL;
1140 break;
1141 }
1142 }
1143 else
1144 {
1145 if (object -> next != NULL)
1146 {
1147 object = object -> next;
1148 if (this_proj -> modelgl)
1149 {
1150 g_free (this_proj -> modelgl -> atom_win -> to_be_inserted[act]);
1151 }
1152 else
1153 {
1154 g_free (cif_object);
1155 }
1156 object -> prev = NULL;
1157 switch (asearch -> action)
1158 {
1159 case REPLACE:
1160 if (this_proj -> modelgl)
1161 {
1162 this_proj -> modelgl -> atom_win -> to_be_inserted[act] = object;
1163 }
1164 else
1165 {
1166 cif_object = object;
1167 }
1168 break;
1169 default:
1170 this_proj -> modelgl -> atom_win -> to_be_moved[act] = object;
1171 break;
1172 }
1173 }
1174 else
1175 {
1176 g_free (object);
1177 switch (asearch -> action)
1178 {
1179 case REPLACE:
1180 if (this_proj -> modelgl)
1181 {
1182 object = this_proj -> modelgl -> atom_win -> to_be_inserted[act] = NULL;
1183 }
1184 else
1185 {
1186 object = cif_object = NULL;
1187 }
1188 break;
1189 default:
1190 object = this_proj -> modelgl -> atom_win -> to_be_moved[act] = NULL;
1191 break;
1192 }
1193 }
1194 }
1195 }
1196 else
1197 {
1198 object = object -> next;
1199 }
1200 }
1201}
1202
1214void to_insert_in_project (int stat, int orig, project * this_proj, atom_search * asearch, gboolean visible)
1215{
1216 int i, j;
1217 atomic_object * tmp_object = NULL;
1218 atomic_object * object;
1219 int act;
1220 if (asearch -> pointer[0].c == 3)
1221 {
1222 act = 0;
1223 }
1224 else if (asearch -> pointer[0].c == 5)
1225 {
1226 act = 1;
1227 }
1228 else
1229 {
1230 act = asearch -> pointer[0].c - 5;
1231 }
1232 if (! this_proj -> modelgl || ((! act || act == 3) && this_proj -> modelgl -> atom_win -> to_be_inserted[act]))
1233 {
1234 clean_this_object (orig, act, this_proj, asearch);
1235 }
1236
1238
1239 tint ulam;
1240 tmp_object = NULL;
1241 vec3_t coor_ins = vec3 (0.0,0.0,0.0);
1242 if (! visible)
1243 {
1244 if (act > 0)
1245 {
1246 if (this_proj -> modelgl)
1247 {
1248 if (this_proj -> modelgl -> anim && ! this_proj -> modelgl -> builder_win)
1249 {
1250 this_proj -> modelgl -> insert_coords = get_insertion_coordinates (this_proj -> modelgl);
1251 coor_ins = this_proj -> modelgl -> insert_coords;
1252 }
1253 }
1254 }
1255 else if (! act)
1256 {
1257 if (orig < -2 && asearch -> object && ! asearch -> mode)
1258 {
1259 int filter = get_asearch_filter (asearch);
1260 if (! filter)
1261 {
1262 tmp_object = create_object_from_species (this_proj, -orig-3, NULL);
1263 }
1264 else if (filter < 3)
1265 {
1266 tmp_object = create_object_from_atom_coordination (this_proj, filter-1, -orig-3, NULL);
1267 }
1268 else
1269 {
1270 tmp_object = create_object_from_frag_mol (this_proj, filter-1, -orig-3, NULL);
1271 }
1272 coor_ins = vec3 (tmp_object -> baryc[0], tmp_object -> baryc[1], tmp_object -> baryc[2]);
1273 if (tmp_object) g_free (tmp_object);
1274 }
1275 else if (orig > -1)
1276 {
1277 coor_ins = vec3 (this_proj -> atoms[0][orig].x, this_proj -> atoms[0][orig].y, this_proj -> atoms[0][orig].z);
1278 }
1279 }
1280 }
1281 if (stat > 0)
1282 {
1283 lib_object = g_malloc0 (sizeof*lib_object);
1284 lib_object -> type = stat;
1285 lib_object -> old_z = allocint (1);
1286 lib_object -> old_z[0] = (stat < 119) ? stat : 0.0;
1287 lib_object -> at_list = g_malloc0(sizeof*lib_object -> at_list);
1288 lib_object -> coord = g_malloc0 (sizeof*lib_object -> coord);
1289 lib_object -> coord -> species = 1;
1290 for (j=0; j<2; j++)
1291 {
1292 lib_object -> coord -> totcoord[j] = 1;
1293 lib_object -> coord -> ntg[j] = allocint (1);
1294 lib_object -> coord -> ntg[j][0] = 1;
1295 lib_object -> coord -> geolist[j] = allocdint (1, 1);
1296 if (j) lib_object -> coord -> partial_geo = alloctint (1, 1, 1);
1297 }
1298 lib_object -> coord -> totcoord[j] = 1;
1299 lib_object -> baryc = allocdouble (3);
1300 lib_object -> atoms = 1;
1301 lib_object -> occ = 1.0;
1302 lib_object -> species = 1;
1304 if (stat > 119)
1305 {
1306 lib_object -> name = g_strdup_printf ("Empty position");
1307 }
1308 else
1309 {
1310 lib_object -> name = g_strdup_printf ("%s atom", periodic_table_info[stat].lab);
1311 }
1312 }
1313
1314 if (this_proj -> modelgl)
1315 {
1316 ulam = ulam_coord (this_proj -> modelgl);
1317 if (this_proj -> modelgl -> atom_win -> to_be_inserted[act] == NULL)
1318 {
1319 this_proj -> modelgl -> atom_win -> to_be_inserted[act] = duplicate_atomic_object (lib_object);
1320 object = this_proj -> modelgl -> atom_win -> to_be_inserted[act];
1321 }
1322 else
1323 {
1324 object = this_proj -> modelgl -> atom_win -> to_be_inserted[act];
1325 while (object -> next) object = object -> next;
1326 object -> next = duplicate_atomic_object (lib_object);
1327 object -> next -> prev = object;
1328 object = object -> next;
1329 }
1330 }
1331 else
1332 {
1333 ulam.a = ulam.b = ulam.c = 0.0;
1334 if (cif_object == NULL)
1335 {
1337 object = cif_object;
1338 }
1339 else
1340 {
1341 object = cif_object;
1342 while (object -> next) object = object -> next;
1343 object -> next = duplicate_atomic_object (lib_object);
1344 object -> next -> prev = object;
1345 object = object -> next;
1346 }
1347 }
1348 if (act)
1349 {
1350 object -> id = (object -> prev) ? object -> prev -> id + 1 : 0;
1351 }
1352 else
1353 {
1354 object -> id = (orig > -1) ? orig : (orig < -2) ? abs(orig) - 3 : abs(orig) - 1;
1355 }
1356 object -> origin = orig;
1357
1358 for (i=0; i<object -> atoms; i++)
1359 {
1360 object -> at_list[i].x += coor_ins.x + object -> dim*ulam.a;
1361 object -> at_list[i].y += coor_ins.y + object -> dim*ulam.b;
1362 object -> at_list[i].z += coor_ins.z + object -> dim*ulam.c;
1363 }
1364 asearch -> in_selection ++;
1365
1366 if (visible)
1367 {
1368 int * atid;
1369 if (act == 1 || act == 2)
1370 {
1371 if (object -> id > 0)
1372 {
1373 atid = duplicate_int (object -> id, asearch -> todo);
1374 g_free (asearch -> todo);
1375 }
1376 allocate_todo (asearch, object -> id+1);
1377 for (i=0; i<object -> id; i++)
1378 {
1379 asearch -> todo[i] = atid[i];
1380 }
1381 asearch -> todo[i] = 0;
1382 update_search_tree (asearch);
1383 }
1384 }
1385}
coord_info * duplicate_coord_info(coord_info *old_coord)
duplicate coordination information data structure
Definition atom_coord.c:190
Function declarations for the mode edition window.
double ** save_coordinates(project *this_proj, int status)
save atomic coordinates
Definition atom_move.c:91
atom_search * remove_search
Definition popup.c:175
void update_search_tree(atom_search *asearch)
update search tree
Definition w_search.c:1294
int get_asearch_filter(atom_search *asearch)
get asearch filter
Definition w_search.c:170
gboolean * remove_bonds_from_project(project *this_proj, atomic_object *this_object, int *old_id, atom *new_list, gboolean remove, gboolean passivate)
remove bond(s) from project
void check_coord_modification(project *this_proj, int old_id[], atom *new_list, atomic_object *this_object, gboolean movtion, gboolean passivating)
void allocate_todo(atom_search *asearch, int tsize)
allocate the selection list data buffer
Definition w_search.c:3717
atomic_object * create_object_from_selection(project *this_proj)
create object from atom selection
int in_object_bond_list(atomic_object *object, int aid, int bid)
is there a bond between atom aid and atom bid ?
atomic_object * lib_object
atomic_object * create_object_from_frag_mol(project *this_proj, int coord, int geo, atom_search *remove)
create object from a fragment or a molecule
atomic_object * create_object_from_species(project *this_proj, int sid, atom_search *remove)
create object from all atom(s) of the same chemical species
void clean_object_vois(project *this_proj, atomic_object *object, int *new_id, gboolean movtion)
clean the object neigbours list
void add_object_atoms(atomic_object *this_object, project *this_proj, int o_step, int numa, int *old_id, gboolean check_bonding, atom_search *remove)
add atom list to insert object
void correct_pos_and_get_dim(atomic_object *object, gboolean adjust)
get the barycenter of the atomic coordinates of an object
double get_object_dim(atomic_object *object)
get estimate of an object dimension
Definition atom_object.c:77
int create_object_from_open_project(project *this_proj, int p)
create object from atom(s) of a project opened in the workspace
void adjust_object_frag_coord(atomic_object *object)
adjust object number of fragment(s)
atomic_object * create_object_from_overall_coordination(project *this_proj, int coord, int aid, atom_search *remove)
create object from all the atom(s) that have the same exact coordination than the target atom
void reconstruct_coordinates_for_object(project *this_proj, atomic_object *this_object, gboolean upcoord)
reconstruct object atomic coordinates using PBC
tint ulam_coord(glwin *view)
shift insertion position for object not to have overlapping objects for multiple/repeated insertions
void correct_coordinates_for_object(project *this_proj, atomic_object *this_object, gboolean upcoord)
correct the atomic coordinates for 'this_object'
atomic_object * create_object_from_atom_coordination(project *this_proj, int coord, int aid, atom_search *remove)
create object from an atom and its nearest neighbors
int * duplicate_z(int species, double *old_z)
duplicate z table when creating an object, integer is preferred to avoid comparison errors during act...
void create_object_from_library(int p)
create object using the molecular library
void clean_this_object(int orig, int act, project *this_proj, atom_search *asearch)
clean object data
atomic_object * duplicate_atomic_object(atomic_object *old_obj)
duplicate an insert object
void to_insert_in_project(int stat, int orig, project *this_proj, atom_search *asearch, gboolean visible)
to insert object in project
gboolean rebuild_atom_neighbors(project *this_proj, int step, atomic_object *object, int target, int aid, atom *at, gboolean *checked_at)
rebuild target atom id coordinates using PBC
int being_copied
void reconstruct_bonds(project *this_proj, int ifcl, int *bcid)
reconstruct the project bond(s)/clone(s) lists after reconstruction using PBC
atomic_object * cif_object
Definition read_cif.c:282
void clean_object_bonds(project *proj, int o_step, atomic_object *object, int *new_id, gboolean movtion)
create the object bond list, and adjust the bond's atom id
integer(kind=c_int) function bonding(scf, sbf, adv, bdist, bmin, delt_ij, sfil)
Definition bonds.F90:22
GtkFileFilter * filter[NCFORMATS+1]
Definition callbacks.c:1405
GtkWidget * builder_win(project *this_proj, gpointer data)
create crystal builder window
integer(kind=c_int) function chemistry()
Definition chemistry.F90:22
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
double dist
Definition d_measures.c:73
int atoms[NUM_STYLES][2]
int bonds[NUM_STYLES][2]
int * duplicate_int(int num, int *old_val)
copy a list of int
Definition global.c:560
distance distance_3d(cell_info *cell, int mdstep, atom *at, atom *bt)
distance between atom a and b in 3D
Definition ogl_utils.c:81
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
int *** alloctint(int xal, int yal, int zal)
allocate an int *** pointer
Definition global.c:353
int * pasted_todo
Definition global.c:174
gboolean * allocbool(int val)
allocate a gboolean * pointer
Definition global.c:254
double * allocdouble(int val)
allocate a double * pointer
Definition global.c:459
int * allocint(int val)
allocate an int * pointer
Definition global.c:314
gboolean object_motion
Definition global.c:186
element_data periodic_table_info[]
Definition w_library.c:71
project * proj
#define CHEM_Z
Definition global.h:297
atomic_object * copied_object
Definition glwindow.c:123
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
#define max(a, b)
Definition global.h:80
action
Definition glview.h:189
gboolean pick
int step
Definition ogl_draw.c:70
vec3_t get_insertion_coordinates(glwin *view)
get the insertion coordinates to insert object in the 3D window
Definition glwindow.c:794
atom * duplicate_atom(atom *at)
copy (partially) an atom data structure
Definition ogl_draw.c:396
@ REPLACE
Definition glview.h:225
@ FROM_LIBRARY
Definition glwin.h:80
@ FROM_SPEC
Definition glwin.h:75
@ FROM_PROJECT
Definition glwin.h:81
@ FROM_DATA
Definition glwin.h:74
gchar * env_name(project *this_proj, int g, int s, int f, GtkTextBuffer *buffer)
ouput the name of a coordination sphere
Definition interface.c:889
double z
Definition ogl_draw.c:57
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
Definition global.h:886
double z
Definition global.h:892
double y
Definition global.h:891
double x
Definition global.h:890
atomic_object * prev
Definition glwin.h:583
coord_info * coord
Definition glwin.h:582
atomic_object * next
Definition glwin.h:584
Definition glwin.h:875
int natomes
Definition global.h:951
coord_info * coord
Definition global.h:956
Definition global.h:104
int b
Definition global.h:106
int c
Definition global.h:107
int a
Definition global.h:105
float y
Definition math_3d.h:130
float x
Definition math_3d.h:130
float z
Definition math_3d.h:130
int c
Definition tab-1.c:95
GtkWidget * img
Definition workspace.c:70
GtkWidget * lab
Definition workspace.c:73