atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
dlp_atom.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
23/*
24* This file: 'dlp_atom.c'
25*
26* Contains:
27*
28
29 - The functions to handle atom selection(s) when creating a force field
30 - The functions to remove / add field atom from a force field
31
32*
33* List of functions:
34
35 void set_sensitive_atom (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
36 void atom_set_color_and_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
37 void clean_old_atom (field_atom* at, int atos, int * atid);
38 void adjust_field_struct (int oid, int k, field_struct * olds);
39 void merging_atoms (field_atom* to_merge, field_atom* to_remove, gboolean upda);
40
41 G_MODULE_EXPORT void select_field_atom (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data);
42 G_MODULE_EXPORT void run_add_atom_dialog (GtkDialog * add_dialog, gint response_id, gpointer data);
43 G_MODULE_EXPORT void run_select_atom_dialog (GtkDialog * select_dialog, gint response_id, gpointer data);
44 G_MODULE_EXPORT void run_remove_atom_from_field_molecule (GtkDialog * rmol, gint response_id, gpointer data);
45 G_MODULE_EXPORT void remove_atom_from_field_molecule (GSimpleAction * action, GVariant * parameter, gpointer data);
46
47*/
48
49#include "dlp_field.h"
50#include "calc.h"
51#include "interface.h"
52#include "glview.h"
53
55int * new_at;
56int ** sel_at;
58extern int * astr;
59extern int vdw_id;
60extern ColRGBA init_color (int id, int numid);
62GtkTreeViewColumn * ato_col[4];
63GtkCellRenderer * ato_cell[4];
64extern GtkWidget * remove_label;
65extern GtkCellRenderer * remove_renderer[5];
66extern GtkTreeViewColumn * remove_col[5];
67extern float val;
68extern float * val_at;
69extern void field_selection (int i, int viz, int lab, int aid);
70extern void field_unselect_all ();
71extern void compare_non_bonded (gchar * fatom);
72extern void init_all_impropers_inversions (int stru);
73extern void init_default_shaders (glwin * view);
74
86void set_sensitive_atom (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
87{
88 int m;
89 gtk_tree_model_get (mod, iter, 0, & m, -1);
90 if (a_ato && m-1 != new_at[0])
91 {
92 gtk_cell_renderer_set_visible (renderer, FALSE);
93 }
94 else
95 {
96 gtk_cell_renderer_set_visible (renderer, TRUE);
97 }
98}
99
111void atom_set_color_and_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
112{
113 int i, j;
114 gtk_tree_model_get (mod, iter, 3, & j, -1);
115 gtk_tree_model_get (mod, iter, 0, & i, -1);
117}
118
128G_MODULE_EXPORT void select_field_atom (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
129{
130 int i, j;
131 GtkTreeStore ** model = (GtkTreeStore **)data;
132 GtkTreeIter iter;
133 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
134 gtk_tree_model_get_iter (GTK_TREE_MODEL(* model), & iter, path);
135 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
136 {
137 toviz.c = 0;
139 for (j=0; j<tmp_fbt -> num; j++) field_selection (tmp_fbt -> list[j], FALSE, FALSE, new_at[a_ato-1]);
140 new_at[a_ato-1] = -1;
141 a_ato --;
142 gtk_tree_store_set (* model, & iter, 3, 0, -1);
143 }
144 else
145 {
146 a_ato ++;
147 gtk_tree_store_set (* model, & iter, 3, 1, -1);
148 gtk_tree_model_get (GTK_TREE_MODEL(* model), & iter, 0, & i, -1);
149 new_at[a_ato-1] = i-1;
150 toviz.c = 1;
152 for (j=0; j<tmp_fbt -> num; j++) field_selection (tmp_fbt -> list[j], TRUE, TRUE, new_at[a_ato-1]);
153 }
155 gtk_tree_view_column_set_cell_data_func (remove_col[3],
157 set_sensitive_atom, NULL, NULL);
158 i = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_mol[0]));
159 if (new_at[0] == -1)
160 {
161 gtk_label_set_text (GTK_LABEL(remove_label), remove_text(-2, 0, at_to_remove -> name));
162 }
163 else
164 {
165 gtk_label_set_text (GTK_LABEL(remove_label), remove_text(i, new_at[0], at_to_remove -> name));
166 }
167 gtk_label_set_use_markup (GTK_LABEL(remove_label), TRUE);
168}
169
179void clean_old_atom (field_atom* at, int atos, int * atid)
180{
181 int h, i, j, k, l, m;
182 gboolean save;
183 h = at -> num - atos*tmp_fmol -> multi;
184 int * tlist = allocint (h);
185 int * dlist = allocint (h);
186 j = -1;
187 for (i=0; i < at -> num; i++)
188 {
189 save = TRUE;
190 for (k=0; k<atos; k++)
191 {
192 if (at -> list_id[i] == atid[k])
193 {
194 save = FALSE;
195 break;
196 }
197 }
198 if (save)
199 {
200 j ++;
201 tlist[j] = at -> list[i];
202 dlist[j] = at -> list_id[i];
203 }
204 }
205 at -> num = h;
206 g_free (at -> list);
207 at -> list = duplicate_int (h, tlist);
208 g_free (at -> list_id);
209 at -> list_id = duplicate_int (h, dlist);
210 for (i=0; i<h; i++)
211 {
212 k = at -> list[i];
213 l = at -> list_id[i];
214 for (m=0; m< tmp_fmol -> multi; m++)
215 {
216 if (tmp_proj -> atoms[0][k].coord[2] == tmp_fmol -> fragments[m]) break;
217 }
218 tmp_fmol -> atoms_id[l][m].b = i;
219 }
220 g_free (tlist);
221 g_free (dlist);
222}
223
224// extern void print_all_field_struct (field_molecule * mol, int str);
234void adjust_field_struct (int oid, int k, field_struct * olds)
235{
236 int i, j;
237 gboolean doit;
238 field_struct * str;
239 i = struct_id(k);
240 int * aids = allocint (i);
241
242 while (olds)
243 {
244 doit = TRUE;
245 if (oid < 0)
246 {
247 for (j=0; j<i; j++) aids[j] = olds -> aid[j];
248 }
249 else
250 {
251 for (j=0; j<i; j++)
252 {
253 if (olds -> aid[j] < oid)
254 {
255 aids[j] = olds -> aid[j];
256 }
257 else if (olds -> aid[j] > oid)
258 {
259 aids[j] = olds -> aid[j] - 1;
260 }
261 else
262 {
263 doit = FALSE;
264 }
265 }
266 }
267 if (doit)
268 {
269 j = get_struct_id_from_atom_id (k, aids);
270 if (j > 0)
271 {
272 str = get_active_struct (k, tmp_fmol -> id, j-1);
273 str -> def = duplicate_field_prop (olds -> def, k);
274 if (olds -> other)
275 {
276 duplicate_other_prop (oid, olds, str);
277 }
278 }
279 }
280 olds = olds -> next;
281 }
282 // if (k == 0) print_all_field_struct (tmp_fmol, k);
283 g_free (aids);
284}
285
295G_MODULE_EXPORT void run_add_atom_dialog (GtkDialog * add_dialog, gint response_id, gpointer data)
296{
297 gboolean done = FALSE;
298 selection_confirmed = FALSE;
299 int i, j, k;
300 gchar * str;
301 switch (response_id)
302 {
303 case GTK_RESPONSE_APPLY:
304 if (a_ato > 0 && a_ato < tmp_fat -> num / tmp_fmol -> multi)
305 {
306 if (a_ato > 1)
307 {
308 str = g_strdup_printf ("%d atoms have been selected !", a_ato);
309 str = g_strdup_printf ("%s\nConfirm this choice and create a new field atom to describe them ?", str);
310 }
311 else
312 {
313 str = g_strdup_printf ("A single atom has been selected !");
314 str = g_strdup_printf ("%s\nIs this correct, create a new field atom to describe it ?", str);
315 }
316 field_question (str, G_CALLBACK(confirm_selection), NULL);
318 {
319 done = TRUE;
320 i = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_mol[0]));
323 j = 0;
324 for (k=0; k<tmp_fat -> num/tmp_fmol -> multi; k++)
325 {
326 if (sel_at[1][k])
327 {
328 new_at[j] = sel_at[0][k];
329 j ++;
330 }
331 }
333 OTHER,
334 tmp_fat -> sp,
336 -1,
337 new_at);
338 tmp_fbt -> next -> prev = g_malloc (sizeof*tmp_fbt -> next -> prev);
339 tmp_fbt -> next -> prev = tmp_fbt;
340 tmp_fmol -> atoms ++;
342 g_free (new_at);
343 field_struct * struct_saved[8];
344 for (k=0; k<8; k++)
345 {
346 struct_saved[k] = duplicate_field_struct_list (tmp_fmol -> first_struct[k], FALSE);
347 }
348 init_all_field_struct (FALSE);
349 // Cross check saved vs. new struct
350 for (k=0; k<8; k++)
351 {
352 adjust_field_struct (-1, k, struct_saved[k]);
353 clean_field_struct_list (struct_saved[k]);
354 }
355 // Update non bonded interactions
356 compare_non_bonded (tmp_fbt -> next -> name);
357 }
358 }
359 break;
360 default:
361 done = TRUE;
362 break;
363 }
364 if (done)
365 {
366 destroy_this_dialog (add_dialog);
369 }
370}
371
381G_MODULE_EXPORT void run_select_atom_dialog (GtkDialog * select_dialog, gint response_id, gpointer data)
382{
383 int sid = GPOINTER_TO_INT (data);
384 gboolean done = FALSE;
385 gboolean redone;
386 gboolean save;
387 gchar * str;
388 int i, j, k, l;
389 redone = FALSE;
390 save = FALSE;
391 switch (response_id)
392 {
393 case GTK_RESPONSE_APPLY:
394 if (sid == 6 || sid == 7)
395 {
396 i = sid - 6;
397 if (tmp_fpmf -> num[i] > 0)
398 {
399 k = 0;
400 for (j=0; j<tmp_fmol -> mol -> natoms; j++)
401 {
402 if (sel_at[0][j]) k ++;
403 }
404 }
405 else
406 {
407 k = a_ato;
408 }
409 }
410 else if (sid == 8)
411 {
412 if (tmp_frig -> num > 0)
413 {
414 k = 0;
415 for (j=0; j<tmp_fmol -> mol -> natoms; j++)
416 {
417 if (sel_at[0][j]) k ++;
418 }
419 }
420 else
421 {
422 k = a_ato;
423 }
424 }
425 else
426 {
427 k = a_ato;
428 }
429 if (k > 1)
430 {
431 if (sid < 2 || sid > 4)
432 {
433 str = g_strdup_printf ("%d atoms selected !\nIs this correct ?", k);
434 }
435 else
436 {
437 str = g_strdup_printf ("%d atoms selected !\nOnly a single atom is required !", k);
438 redone = TRUE;
439 }
440 }
441 else if (k == 1)
442 {
443 switch (sid)
444 {
445 case 1:
446 str = g_strdup_printf ("A single atom selected !\nIs this correct ?");
447 break;
448 default:
449 done = TRUE;
450 save = TRUE;
451 break;
452 }
453 }
454 else
455 {
456 str = g_strdup_printf ("No atom selected !\nIs this correct ?");
457 }
458 if (! done)
459 {
460 selection_confirmed = FALSE;
461 field_question (str, G_CALLBACK(confirm_selection), NULL);
462 g_free (str);
463 if (selection_confirmed && ! redone)
464 {
465 done = TRUE;
466 save = TRUE;
467 }
468 }
469 break;
470 default:
471 done = TRUE;
472 break;
473 }
474 if (done)
475 {
476 destroy_this_dialog (select_dialog);
477 if (save)
478 {
479 if (sid == 1)
480 {
481 tmp_fat -> frozen = a_ato;
482 for (i=0; i < tmp_fat -> num/tmp_fmol -> multi; i++)
483 {
484 j = sel_at[0][i];
485 k = sel_at[1][i];
486 for (l=0; l<tmp_fat -> num; l++)
487 {
488 if (tmp_fat -> list_id[l] == j)
489 {
490 tmp_fat -> frozen_id[l] = k;
491 }
492 }
493 }
494 }
495 else if ((sid > 1 && sid < 6) || sid == 9)
496 {
497 for (j=0; j<tmp_fmol -> mol -> natoms; j++) if (sel_at[0][j]) break;
498 switch (sid)
499 {
500 case 2:
501 tmp_fshell -> ia[0] = j+1;
502 break;
503 case 3:
504 tmp_fshell -> ia[1] = j+1;
505 break;
506 case 4:
507 tmp_fcons -> ia[0] = j+1;
508 break;
509 case 5:
510 tmp_fcons -> ia[1] = j+1;
511 break;
512 case 9:
513 tmp_ftet -> num = j+1;
514 break;
515 }
516 }
517 else if (sid == 6 || sid == 7)
518 {
519 tmp_fpmf -> num[i] = k;
520 tmp_fpmf -> list[i] = NULL;
521 tmp_fpmf -> weight[i] = NULL;
522 if (k > 0)
523 {
524 tmp_fpmf -> list[i] = allocint(tmp_fpmf -> num[i]);
525 tmp_fpmf -> weight[i] = allocfloat(tmp_fpmf -> num[i]);
526 k = -1;
527 for (j=0; j<tmp_fmol -> mol -> natoms; j++)
528 {
529 if (sel_at[0][j])
530 {
531 k ++;
532 tmp_fpmf -> list[i][k] = j;
533 tmp_fpmf -> weight[i][k] = val_at[j];
534 }
535 }
536 }
537 }
538 else if (sid == 8)
539 {
540 tmp_frig -> num = k;
541 tmp_frig -> list = NULL;
542 if (k > 0)
543 {
544 tmp_frig -> list = allocint(tmp_frig -> num);
545 k = -1;
546 for (j=0; j<tmp_fmol -> mol -> natoms; j++)
547 {
548 if (sel_at[0][j])
549 {
550 k ++;
551 tmp_frig -> list[k] = j;
552 }
553 }
554 }
555 }
556 else if (sid > 10 && sid < SEXTERN)
557 {
558 i = sid - 11;
559 tmp_fbody -> na[i] = get_active_body (vdw_id, 0)-> na[0];
560 tmp_fbody -> a[i] = duplicate_int (get_active_body (vdw_id, 0) -> na[0], get_active_body (vdw_id, 0)-> a[0]);
561 tmp_fbody -> ma[i] = duplicate_int (get_active_body (vdw_id, 0)-> na[0], get_active_body (vdw_id, 0)-> ma[0]);
562 }
563 }
565 }
566}
567
577void merging_atoms (field_atom* to_merge, field_atom* to_remove, gboolean upda)
578{
579 int * tmp_ato = allocint (to_merge -> num + to_remove -> num);
580 int * tmp_atd = allocint (to_merge -> num + to_remove -> num);
581 int * tmp_fre = allocint (to_merge -> num + to_remove -> num);
582 int i, j, k, l;
583 i = to_merge -> num + to_remove -> num;
584 for (j=0; j<to_merge -> num; j++)
585 {
586 tmp_ato[j] = to_merge -> list[j];
587 tmp_atd[j] = to_merge -> list_id[j];
588 tmp_fre[j] = to_merge -> frozen_id[j];
589 }
590
591 for (j=to_merge -> num; j<i ; j++)
592 {
593 tmp_ato[j] = to_remove -> list[j - to_merge -> num];
594 tmp_atd[j] = to_remove -> list_id[j - to_merge -> num];
595 tmp_fre[j] = to_remove -> frozen_id[j - to_merge -> num];
596 }
597
598 int val_a, val_b, val_c;
599 for (j=1; j<i; j++)
600 {
601 val_a = tmp_ato[j];
602 val_b = tmp_atd[j];
603 val_c = tmp_fre[j];
604 for (k=j-1; k>-1; k--)
605 {
606 if (tmp_atd[k] < val_b) break;
607 tmp_ato[k+1] = tmp_ato[k];
608 tmp_atd[k+1] = tmp_atd[k];
609 tmp_fre[k+1] = tmp_fre[k];
610 }
611 tmp_ato[k+1] = val_a;
612 tmp_atd[k+1] = val_b;
613 tmp_fre[k+1] = val_c;
614 }
615 to_merge -> num = i;
616 g_free (to_merge -> list);
617 to_merge -> list = duplicate_int (to_merge -> num, tmp_ato);
618 g_free (tmp_ato);
619 g_free (to_merge -> list_id);
620 to_merge -> list_id = duplicate_int (to_merge -> num, tmp_atd);
621 g_free (tmp_atd);
622 g_free (to_merge -> frozen_id);
623 to_merge -> frozen_id = duplicate_int (to_merge -> num, tmp_fre);
624 g_free (tmp_fre);
625
626 if (upda)
627 {
628 for (i=0; i<to_merge -> num; i++)
629 {
630 j = to_merge -> list[i];
631 k = to_merge -> list_id[i];
632 for (l=0; l< tmp_fmol -> multi; l++)
633 {
634 if (tmp_proj -> atoms[0][j].coord[2] == tmp_fmol -> fragments[l]) break;
635 }
636 tmp_fmol -> atoms_id[k][l].a = to_merge -> id;
637 tmp_fmol -> atoms_id[k][l].b = i;
638 tmp_proj -> atoms[0][j].faid = to_merge -> id;
639 }
640 }
641}
642
652G_MODULE_EXPORT void run_remove_atom_from_field_molecule (GtkDialog * rmol, gint response_id, gpointer data)
653{
654 int i, j, k;
655 gboolean done = FALSE;
656 gchar * str;
657 switch (response_id)
658 {
659 case GTK_RESPONSE_APPLY:
660 if (a_ato)
661 {
662 i = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_mol[0]));
663 field_atom* to_merge = get_active_atom(i, new_at[0]);
664 str = g_strdup_printf ("Merging with atom N°%d - %s !\nIs this correct ?",
665 new_at[0]+1, to_merge -> name);
666 selection_confirmed = FALSE;
667 field_question (str, G_CALLBACK(confirm_selection), NULL);
668 g_free (str);
670 {
671 done = TRUE;
672 merging_atoms (to_merge, at_to_remove, TRUE);
673 field_struct * struct_saved[8];
674 for (k=0; k<8; k++)
675 {
676 struct_saved[k] = duplicate_field_struct_list (tmp_fmol -> first_struct[k], FALSE);
677 }
678 // Modify the atom list
679 j = at_to_remove -> id;
680 if (at_to_remove -> prev == NULL)
681 {
682 tmp_fmol -> first_atom = at_to_remove -> next;
683 tmp_fmol -> first_atom -> prev = NULL;
684 }
685 else if (at_to_remove -> next == NULL)
686 {
687 tmp_fct = at_to_remove -> prev;
688 tmp_fct -> next = NULL;
689 }
690 else
691 {
692 tmp_fct -> next = at_to_remove -> next;
693 at_to_remove -> next -> prev = tmp_fct;
694 }
695 // Finally clearing atom id
696 tmp_fct = tmp_fmol -> first_atom;
697 for (k=0; k<tmp_fmol -> atoms; k++)
698 {
699 tmp_fct -> id = k;
700 if (tmp_fct -> next != NULL) tmp_fct = tmp_fct -> next;
701 }
702 tmp_fmol -> atoms --;
703 init_all_field_struct (FALSE);
704 // Cross check saved vs. new struct
705 for (k=0; k<8; k++)
706 {
707 adjust_field_struct (j, k, struct_saved[k]);
708 clean_field_struct_list (struct_saved[k]);
709 }
710 // Non-bonded interactions:
711 compare_non_bonded (to_merge -> name);
712 }
713 }
714 break;
715 default:
716 done = TRUE;
717 break;
718 }
719 if (done) destroy_this_dialog (rmol);
720}
721
731G_MODULE_EXPORT void remove_atom_from_field_molecule (GSimpleAction * action, GVariant * parameter, gpointer data)
732{
733 at_to_remove = (field_atom*) data;
734 int i, j;
735 field_object = 1;
736 gchar * str = g_strdup_printf ("Select the field atom to merge atom \"%s\" with", at_to_remove -> name);
737 GtkWidget * rmol = dialogmodal (str, GTK_WINDOW(field_assistant));
738 g_free (str);
739 gtk_dialog_add_button (GTK_DIALOG(rmol), "Apply", GTK_RESPONSE_APPLY);
740
741 GtkWidget * remove_tree = NULL;
742 GtkTreeIter iter;
743
744 gchar * mol_title[4] = {"Id", "Name", "Number", "Viz.3D & Merge with"};
745 gchar * ctype[4] = {"text", "text", "text", "active"};
746 GType col_type[4] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN};
747
748 a_ato = 0;
749 new_at = allocint(1);
750 GtkTreeStore * remove_model = gtk_tree_store_newv (4, col_type);
751 remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
753 for (i=0; i<4; i++)
754 {
755 if (i < 3)
756 {
757 remove_renderer[i] = gtk_cell_renderer_text_new ();
758 }
759 else
760 {
761 remove_renderer[i] = gtk_cell_renderer_toggle_new ();
762 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(remove_renderer[i]), TRUE);
763 g_signal_connect (G_OBJECT(remove_renderer[i]), "toggled", G_CALLBACK(select_field_atom), & remove_model);
764 }
765 remove_col[i] = gtk_tree_view_column_new_with_attributes (mol_title[i], remove_renderer[i], ctype[i], i, NULL);
766 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree), remove_col[i]);
767 if (i < 3)
768 {
769 gtk_tree_view_column_set_cell_data_func (remove_col[i], remove_renderer[i], atom_set_color_and_markup, NULL, NULL);
770 }
771 }
772
773 // Clean 3D viz
775 // fill model
776 j = 0;
777 tmp_fat = tmp_fmol -> first_atom;
778 for (i=0; i<tmp_fmol -> atoms; i++)
779 {
780 if (tmp_fat -> sp == at_to_remove -> sp && tmp_fat -> id != at_to_remove -> id)
781 {
782 j ++;
783 gtk_tree_store_append (remove_model, & iter, NULL);
784 gtk_tree_store_set (remove_model, & iter, 0, tmp_fat -> id+1,
785 1, tmp_fat -> name,
786 2, tmp_fat -> num,
787 3, 0, -1);
788 }
789 if (tmp_fat -> next != NULL) tmp_fat = tmp_fat -> next;
790 }
791 g_object_unref (remove_model);
792 gtk_tree_view_expand_all (GTK_TREE_VIEW(remove_tree));
793
794 i = ((j+1)*40 < 500) ? (j+1)*40 : 500;
795 GtkWidget * scrollsets = create_scroll (dialog_get_content_area (rmol), 375, i, GTK_SHADOW_ETCHED_IN);
796 add_container_child (CONTAINER_SCR, scrollsets, remove_tree);
797 remove_label = markup_label(remove_text(-2, 0, at_to_remove -> name), -1, -1, 0.5, 0.5);
798 gtk_label_set_use_markup (GTK_LABEL(remove_label), TRUE);
799 add_box_child_start (GTK_ORIENTATION_VERTICAL, dialog_get_content_area (rmol), remove_label, FALSE, FALSE, 0);
803}
insertion_menu mol[]
Definition w_library.c:193
void field_question(gchar *question, GCallback handler, gpointer data)
ask the use to confirm something
Definition calc.c:103
gboolean selection_confirmed
Definition calc.c:77
G_MODULE_EXPORT void confirm_selection(GtkDialog *dialog, gint response_id, gpointer data)
confirm that the selection is good
Definition calc.c:88
Variable declarations for the MD input preparation assistants.
gboolean save
Definition callbacks.c:160
ColRGBA col
Definition d_measures.c:77
int atoms[NUM_STYLES][2]
GtkTreePath * path
Definition datab.c:103
field_struct * get_active_struct(int s, int a, int b)
retrieve field structural property
Definition dlp_active.c:318
field_atom * get_active_atom(int a, int b)
retrieve field atom
Definition dlp_active.c:145
field_nth_body * get_active_body(int a, int b)
retrieve field nth body interaction
Definition dlp_active.c:106
G_MODULE_EXPORT void run_remove_atom_from_field_molecule(GtkDialog *rmol, gint response_id, gpointer data)
remove atom from field molecule - running the dialog
Definition dlp_atom.c:652
void field_unselect_all()
unselect all atoms
Definition dlp_viz.c:130
GtkTreeViewColumn * ato_col[4]
Definition dlp_atom.c:62
float * val_at
Definition dlp_edit.c:1140
G_MODULE_EXPORT void remove_atom_from_field_molecule(GSimpleAction *action, GVariant *parameter, gpointer data)
remove atom from field molecule - creating the dialog
Definition dlp_atom.c:731
float val
Definition dlp_init.c:117
void init_all_impropers_inversions(int stru)
initialize all impropers and inversions
Definition dlp_init.c:1343
G_MODULE_EXPORT void run_add_atom_dialog(GtkDialog *add_dialog, gint response_id, gpointer data)
DL-POLY force field atom selection - running the dialog.
Definition dlp_atom.c:295
G_MODULE_EXPORT void run_select_atom_dialog(GtkDialog *select_dialog, gint response_id, gpointer data)
DL-POLY force field atom selection - creating the dialog.
Definition dlp_atom.c:381
void atom_set_color_and_markup(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
field atom set renderer color and markup in the DL-POLY atom(s) selection tree model
Definition dlp_atom.c:111
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
Definition initcoord.c:81
field_atom * at_to_remove
Definition dlp_atom.c:61
void compare_non_bonded(gchar *fatom)
compare non bond interaction parameters
Definition dlp_comp.c:184
int * astr
Definition dlp_init.c:116
int ** sel_at
Definition dlp_atom.c:56
void merging_atoms(field_atom *to_merge, field_atom *to_remove, gboolean upda)
merge the field atom to remove with already other field atom
Definition dlp_atom.c:577
GtkWidget * remove_label
Definition dlp_mol.c:62
void field_selection(int i, int viz, int lab, int aid)
select / unselect atom
Definition dlp_viz.c:91
int a_ato
Definition dlp_atom.c:57
G_MODULE_EXPORT void select_field_atom(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select field atom toggle callback
Definition dlp_atom.c:128
void set_sensitive_atom(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
field atom set renderer sensitivity in the DL-POLY atom(s) selection tree model
Definition dlp_atom.c:86
int * new_at
Definition dlp_atom.c:55
GtkTreeViewColumn * remove_col[5]
Definition dlp_mol.c:64
GtkCellRenderer * ato_cell[4]
Definition dlp_atom.c:63
GtkCellRenderer * remove_renderer[5]
Definition dlp_mol.c:63
int active_sel
Definition dlp_atom.c:54
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
void adjust_field_struct(int oid, int k, field_struct *olds)
adjust field molecule structural property
Definition dlp_atom.c:234
int vdw_id
Definition dlp_edit.c:919
void clean_old_atom(field_atom *at, int atos, int *atid)
remove atom list from field atom
Definition dlp_atom.c:179
field_prop * duplicate_field_prop(field_prop *old_prop, int ti)
create a copy of a field property
Definition dlp_copy.c:218
void duplicate_other_prop(int oid, field_struct *old_fstr, field_struct *new_fstr)
create copy of a field property 'other' list
Definition dlp_copy.c:269
field_struct * duplicate_field_struct_list(field_struct *list_str, gboolean init)
create copy of list of field structural element(s)
Definition dlp_copy.c:325
int * atoms_id
glwin * tmp_view
Definition dlp_field.c:952
field_constraint * tmp_fcons
Definition dlp_field.c:959
int field_object
Definition dlp_field.c:979
field_nth_body * tmp_fbody
Definition dlp_field.c:965
project * tmp_proj
Definition dlp_field.c:953
field_shell * tmp_fshell
Definition dlp_field.c:958
field_rigid * tmp_frig
Definition dlp_field.c:961
int num_field_objects
Definition dlp_field.c:981
field_pmf * tmp_fpmf
Definition dlp_field.c:960
field_atom * tmp_fat
Definition dlp_field.c:957
int struct_id(int f)
number of atoms in a structural element
Definition dlp_field.c:999
void update_field_trees()
classical force field assistant update all tree models
Definition dlp_field.c:1786
field_molecule * tmp_fmol
Definition dlp_field.c:955
field_tethered * tmp_ftet
Definition dlp_field.c:962
field_atom * tmp_fct
Definition dlp_field.c:957
GType col_type[MAXDATA][12]
Definition dlp_field.c:856
GtkWidget * field_assistant
Definition dlp_field.c:940
field_atom * tmp_fbt
Definition dlp_field.c:957
GtkWidget * combo_mol[MOLIMIT-1]
Definition dlp_field.c:944
Variable declarations for the creation of the DL_POLY input file(s)
void clean_field_struct_list(field_struct *stru)
clean force field structural property(ies)
Definition dlp_init.c:2146
int * duplicate_int(int num, int *old_val)
copy a list of int
Definition global.c:560
int get_struct_id_from_atom_id(int ids, int *aid)
retrieve field structural element id from a list of atom id
Definition dlp_init.c:559
tint toviz
Definition dlp_viz.c:75
#define SEXTERN
Definition dlp_field.h:118
gchar * remove_text(int i, int j, gchar *str)
get removal information text
Definition dlp_mol.c:81
field_atom * init_field_atom(int id, int type, int at, int nat, int coo, int *list)
intialize a new type of field atom
Definition dlp_init.c:304
@ OTHER
Definition dlp_field.h:149
void init_all_field_struct(gboolean init)
initialize the force field structural properties for a field molecule
Definition dlp_init.c:2170
int multi
Definition dlp_init.c:121
field_molecule * to_remove
Definition dlp_mol.c:61
int * allocint(int val)
allocate an int * pointer
Definition global.c:314
float * allocfloat(int val)
allocate a float * pointer
Definition global.c:398
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:492
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
Definition gtk-misc.c:1653
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:1960
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:510
@ CONTAINER_SCR
Definition global.h:251
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:825
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
Definition gtk-misc.c:1585
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
Definition gtk-misc.c:299
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2065
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:226
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
action
Definition glview.h:189
Messaging function declarations.
Definition glwin.h:875
int c
Definition global.h:107
int a
Definition tab-1.c:95
GtkWidget * lab
Definition workspace.c:73