atomes 1.2.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
cpmd_nose.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-2025 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'cpmd_nose.c'
24*
25* Contains:
26*
27
28 - The functions to prepare the thermostat(s) configuration widgets for QM / QM-MM input files
29
30*
31* List of functions:
32
33 int get_num_thermo ();
34 int is_not_thermostated (int at, int therm);
35 int is_fixed_atom (int at);
36 int in_dummy (int at, int id);
37
38 gboolean are_all_atoms_thermostated ();
39 gboolean was_it_selected (int id, int at);
40
41 void set_going_forward ();
42 void clean_nose_widgets ();
43 void thermo_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
44 void thermo_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
45 void remove_nose_thermostat (int num_to_remove);
46 void init_thermostats (int type, int elec);
47 void clean_thermostat (int new_type);
48 void nose_parameters (GtkWidget * vbox, int id, int jd, gchar ** la, gchar ** lb);
49 void atom_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
50 void atom_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
51 void fill_thermo_atom_model (int therm);
52 void select_atom_from_model (int therm);
53 void create_selection_button (GtkWidget * box, int num, int id, gpointer data);
54 void create_nose_thermo_param_box (int therm_id);
55 void create_selection_combo (int id, int num, int type, GCallback handler);
56 void add_thermostat (int extra);
57 void prepare_therm_ions ();
58 void prepare_therm_elec ();
59 void thermo_type_box (GtkWidget * vbox, gchar * str, int id);
60
61 G_MODULE_EXPORT void select_thermo (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data);
62 G_MODULE_EXPORT void run_remove_nose_thermostat (GtkDialog * dialog, gint response_id, gpointer data);
63 G_MODULE_EXPORT void cpmd_select_atom_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data);
64 G_MODULE_EXPORT void cp2k_select_coord_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data);
65 G_MODULE_EXPORT void select_atoms_not_thermostated (GtkCheckButton * but, gpointer data);
66 G_MODULE_EXPORT void select_atoms_not_thermostated (GtkToggleButton * but, gpointer data);
67 G_MODULE_EXPORT void run_select_atom_from_model (GtkDialog * dialog, gint response_id, gpointer data);
68 G_MODULE_EXPORT void atom_selection_button (GtkButton * but, gpointer data);
69 G_MODULE_EXPORT void changed_nose_thermo_id_box (GtkComboBox * box, gpointer data);
70 G_MODULE_EXPORT void add_or_remove_thermostat (GtkSpinButton * res, gpointer data);
71 G_MODULE_EXPORT void update_thermo_parameter (GtkEntry * res, gpointer data);
72 G_MODULE_EXPORT void changed_thermo_box_nose (GtkComboBox * box, gpointer data);
73 G_MODULE_EXPORT void changed_thermo_box (GtkComboBox * box, gpointer data);
74
75 GtkWidget * create_nose_box (int n);
76 GtkWidget * thermo_box ();
77
78 thermostat * get_thermo ();
79 thermostat * get_active_thermostat (int id);
80 thermostat * init_thermo (int id, int type, int sys);
81
82*/
83
84#include "global.h"
85#include "interface.h"
86#include "glview.h"
87#include "calc.h"
88#include "cpmd.h"
89#include "cp2k.h"
90
91extern void print_the_section (int s, int p, GtkTextBuffer * buffer);
92extern ColRGBA init_color (int id, int numid);
93extern void proj_unselect_all_atoms ();
94extern GtkWidget * cpmd_box (GtkWidget * box, gchar * lab, int v_space, int h_space, int dim);
95extern dummy_atom * get_active_dummy (int id);
96extern void create_dummy_param_box (int dummy_id);
97
98char * c_thermo[2][CP2NTHERM][4] = {{{"Initial temperature: ", " ", " ", " "},
99 {"Target temperature: ","Tolerance: ", " ", " "},
100 {"Target temperature: ", "Target frequency: ", " ", " "},
101 {" ", " ", " ", " "},
102 {" ", " ", " ", " "}},
103 {{" ", " ", " ", " "},
104 {"Time constant (Langevin): ", "Time constant (Nosë-Hoover): ", "Mass: ", "Chi: "},
105 {"Time constant: ", " ", " ", " "},
106 {" ", " ", " ", " "},
107 {"Length: ", "Multiple time steps: ", "Time constant: ", "Yoshida integrator: "}}};
108
109char * u_thermo[2][CP2NTHERM][4] = {{{" K", " ", " ", " "},
110 {" K", " K", " ", " "},
111 {" K", " cm<sup>-1</sup>", " ", " "},
112 {" ", " ", " ", " "},
113 {" ", " ", " ", " "}},
114 {{" ", " ", " ", " "},
115 {" fs", " fs", " fs<sup>-1</sup>", " fs<sup>-1</sup>"},
116 {" fs", " ", " ", " "},
117 {" ", " ", " ", " "},
118 {" ", " ", " fs", " "}}};
119
120char * ue_thermo[CP2NTHERM][4] = {{" a.u.", " ", " ", " "},
121 {" a.u.", " ", " ", " "},
122 {" a.u.", " a.u.", " ", " "},
123 {" a.u.", " cm<sup>-1</sup>", " ", " "}};
124
125int v_thermo[2][CP2NTHERM] = {{1, 2, 2, 0, 0}, {0, 4, 1, 0, 4}};
126
127double d_thermo[2][CP2NTHERM][4] = {{{ 300.0, 0.0, 0.0, 0.0},
128 { 300.0, 20.0, 0.0, 0.0},
129 { 300.0, 200.0, 0.0, 0.0},
130 { 0.0, 0.0, 0.0, 0.0},
131 { 0.0, 0.0, 0.0, 0.0}},
132 {{ 0.0, 0.0, 0.0, 0.0},
133 { 100.0, 100.0, 1.0, 1.0},
134 { 100.0, 0.0, 0.0, 0.0},
135 { 0.0, 0.0, 0.0, 0.0},
136 { 3.0, 2.0, 1000.0, 3.0}}};
137GtkWidget * sel_but[3];
138GtkWidget * sel_img[3];
139GtkWidget * electron_box;
140GtkWidget * therm_ions;
141GtkWidget * therm_elec;
144GtkWidget * nose_box;
145GtkWidget * combo_id[2];
146GtkWidget * combo_id_box[2];
147GtkWidget * nose_id_box[2];
148GtkCellRenderer * thermo_renderer[6];
149GtkTreeViewColumn * thermo_col[6];
156gboolean fixco;
157GtkTreeStore * add_model;
158
165{
166 if (is_cpmd)
167 {
168 return tmp_cpmd -> ions_thermostat;
169 }
170 else
171 {
172 return tmp_cp2k -> ions_thermostat;
173 }
174}
175
182{
183 if (is_cpmd)
184 {
185 return tmp_cpmd -> thermostats;
186 }
187 else
188 {
189 return tmp_cp2k -> thermostats;
190 }
191}
192
199{
200 int i, j;
201 thermostat * thermo = get_thermo();
202 j = 0;
203 if (thermo -> sys < LOCAL) return TRUE;
204 for (i=0; i<get_num_thermo(); i++)
205 {
206 j += thermo -> natoms;
207 if (thermo -> next != NULL) thermo = thermo -> next;
208 }
209 if (j == qm_proj -> natomes)
210 {
211 return TRUE;
212 }
213 else
214 {
215 return FALSE;
216 }
217}
218
225{
226 GtkAssistant * assist = GTK_ASSISTANT(qm_assistant);
227 GtkWidget * page = gtk_assistant_get_nth_page (assist, (is_cpmd) ? 3 : 5);
228 gtk_assistant_set_page_complete (assist, page, are_all_atoms_thermostated ());
229}
230
244
253{
254 if (id < 0)
255 {
256 return tmp_cpmd -> elec_thermostat;
257 }
258 else
259 {
260 thermostat * thermo = get_thermo ();
261 while (thermo -> id != id)
262 {
263 if (thermo -> next != NULL) thermo = thermo -> next;
264 }
265 return thermo;
266 }
267}
268
279G_MODULE_EXPORT void select_thermo (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
280{
281 GtkTreeStore ** model = (GtkTreeStore **)data;
282 GtkTreeIter iter;
283 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
284 gtk_tree_model_get_iter (GTK_TREE_MODEL(* model), & iter, path);
285 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
286 {
287 get_active_thermostat (old_thermo[n_therm-1]) -> show = FALSE;
288 old_thermo[n_therm-1] = -1;
289 n_therm --;
290 gtk_tree_store_set (* model, & iter, 5, 0, -1);
291 //toviz.c = 0;
292 }
293 else
294 {
295 n_therm ++;
296 gtk_tree_store_set (* model, & iter, 5, 1, -1);
297 gtk_tree_model_get (GTK_TREE_MODEL(* model), & iter, 0, & old_thermo[n_therm-1], -1);
298 old_thermo[n_therm-1] --;
299 get_active_thermostat (old_thermo[n_therm-1]) -> show = TRUE;
300 //toviz.c = 1;
301 }
302 // Viz
303}
304
316void thermo_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
317{
318 int i, j;
319 gtk_tree_model_get (mod, iter, 0, & i, -1);
320 i = abs(i);
321 gtk_tree_model_get (mod, iter, 5, & j, -1);
322 set_renderer_color (j, renderer, init_color (i-1, num_cpmd_objects));
323}
324
336void thermo_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
337{
338 int i, j;
339 i = GPOINTER_TO_INT(data);
340 gtk_tree_model_get (mod, iter, 0, & j, -1);
341 if (j > 0 && i != 4)
342 {
343 gtk_cell_renderer_set_visible (renderer, TRUE);
344 if (i < 5) thermo_set_color (col, renderer, mod, iter, data);
345 }
346 else if (j > 0)
347 {
348 gtk_cell_renderer_set_visible (renderer, FALSE);
349 }
350 else if (i == 4)
351 {
352 gtk_cell_renderer_set_visible (renderer, TRUE);
353 thermo_set_color (col, renderer, mod, iter, data);
354 }
355 else
356 {
357 gtk_cell_renderer_set_visible (renderer, FALSE);
358 }
359}
360
361GtkWidget * create_nose_box (int n);
362
372G_MODULE_EXPORT void run_remove_nose_thermostat (GtkDialog * dialog, gint response_id, gpointer data)
373{
374 int i, j;
375 int num_to_remove = GPOINTER_TO_INT(data);
376 gboolean done = FALSE;
377 gchar * str;
378 thermostat * thermo;
379 switch (response_id)
380 {
381 case GTK_RESPONSE_APPLY:
382 if (n_therm == num_to_remove)
383 {
384 done = TRUE;
385 // Now we remove all selected thermostats:
386 for (i=0; i<n_therm; i++)
387 {
388 thermo = get_thermo();
389 for (j=0; j<get_num_thermo(); j++)
390 {
391 if (thermo -> id == old_thermo[i])
392 {
393 if (thermo -> next != NULL)
394 {
395 if (thermo -> prev != NULL)
396 {
397 thermo -> next -> prev = thermo -> prev;
398 thermo -> prev -> next = thermo -> next;
399 }
400 else
401 {
402 tmp_cpmd -> ions_thermostat = thermo -> next;
403 tmp_cpmd -> ions_thermostat -> prev = NULL;
404 }
405 }
406 else
407 {
408 thermo -> prev -> next = NULL;
409 }
410 g_free (thermo);
411 break;
412 }
413 if (thermo -> next != NULL) thermo = thermo -> next;
414 }
415 }
416 if (is_cpmd)
417 {
418 tmp_cpmd -> thermostats -= num_to_remove;
419 }
420 else
421 {
422 tmp_cp2k -> thermostats -= num_to_remove;
423 }
424 thermo = get_thermo();
425 for (j=0; j<get_num_thermo(); j++)
426 {
427 thermo -> id = j;
428 if (thermo -> next != NULL) thermo = thermo -> next;
429 }
431 nose_box = create_nose_box (get_thermo() -> type);
432 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
433 //int j;
434 //for (j=1; j<4; j++) print_the_section (j, 0, qmbuffer[j]););
436 }
437 else
438 {
439 str = g_strdup_printf ("You must select %d thermostat(s) to be deleted !", num_to_remove);
441 g_free (str);
442 }
443 break;
444 default:
445 done = TRUE;
446 break;
447 }
448 if (done) destroy_this_dialog (dialog);
449}
450
458void remove_nose_thermostat (int num_to_remove)
459{
460 int i, j, k;
461 gchar * str;
462 // int cpmd_object = 0;
463 str = g_strdup_printf ("Select the %d thermostat(s) to be removed", num_to_remove);
464 GtkWidget * rthermo = dialogmodal (str, GTK_WINDOW(qm_assistant));
465 g_free (str);
466 gtk_dialog_add_button (GTK_DIALOG(rthermo), "Apply", GTK_RESPONSE_APPLY);
467
468 gchar * mol_title[6] = {"Id", "Target T°", "Frequency", "Atom(s)", " ", "Select"};
469 gchar * ctype[6] = {"text", "text", "text", "text", "text", "active"};
470 GType col_type[6] = {G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN};
471
472 GtkTreeIter thermo_level, atom_level;
473 n_therm = 0;
475 GtkTreeStore * remove_model = gtk_tree_store_newv (6, col_type);
476 GtkWidget * remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
477 for (i=0; i<6; i++)
478 {
479 if (i < 5)
480 {
481 thermo_renderer[i] = gtk_cell_renderer_text_new ();
482 }
483 else
484 {
485 thermo_renderer[i] = gtk_cell_renderer_toggle_new ();
486 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(thermo_renderer[i]), TRUE);
487 g_signal_connect (G_OBJECT(thermo_renderer[i]), "toggled", G_CALLBACK(select_thermo), & remove_model);
488 }
489 thermo_col[i] = gtk_tree_view_column_new_with_attributes (mol_title[i], thermo_renderer[i], ctype[i], i, NULL);
490 gtk_tree_view_column_set_alignment (thermo_col[i], 0.5);
491 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree), thermo_col[i]);
492 gtk_tree_view_column_set_cell_data_func (thermo_col[i], thermo_renderer[i], thermo_set_visible, GINT_TO_POINTER(i), NULL);
493 }
494 // fill model
495 thermostat * thermo = get_thermo();
496 for (i=0; i<get_num_thermo(); i++)
497 {
498 gtk_tree_store_append (remove_model, & thermo_level, NULL);
499 gtk_tree_store_set (remove_model, & thermo_level, 0, i+1,
500 1, thermo -> params[0],
501 2, thermo -> params[1],
502 3, thermo -> natoms,
503 4, " ",
504 5, 0, -1);
505 for (j=0; j<thermo -> natoms; j++)
506 {
507 gtk_tree_store_append (remove_model, & atom_level, & thermo_level);
508 k = qm_proj -> atoms[0][thermo -> list[j]].sp;
509 str = g_strdup_printf ("%s<sub>%d</sub>", exact_name(qm_proj -> chemistry -> label[k]), thermo -> list[j]+1);
510 gtk_tree_store_set (remove_model, & atom_level, 0, -(i+1), 1, 0.0, 2, 0.0, 3, 0, 4, str, 5, 0, -1);
511 g_free (str);
512 }
513 if (thermo -> next != NULL) thermo = thermo -> next;
514 }
516 g_object_unref (remove_model);
517 i = ((num_cpmd_objects+1)*40 < 500) ? (num_cpmd_objects+1)*40 : 500;
518 GtkWidget * scrollsets = create_scroll (dialog_get_content_area (rthermo), 450, i, GTK_SHADOW_ETCHED_IN);
519 add_container_child (CONTAINER_SCR, scrollsets, remove_tree);
520 run_this_gtk_dialog (rthermo, G_CALLBACK(run_remove_nose_thermostat), GINT_TO_POINTER(num_to_remove));
521}
522
532thermostat * init_thermo (int id, int type, int sys)
533{
534 thermostat * thermo = g_malloc0 (sizeof*thermo);
535 thermo -> id = id;
536 thermo -> type = type;
537 thermo -> sys = sys;
538 thermo -> show = FALSE;
539 if (id < 0)
540 {
541 thermo -> params[0] = 0.5;
542 thermo -> params[1] = (type == 0) ? 0.2: 200.0;
543 }
544 else
545 {
546 int i;
547 for (i=0; i<v_thermo[!is_cpmd][type]; i++)
548 {
549 thermo -> params[i] = d_thermo[!is_cpmd][type][i];
550 }
551 }
552 return thermo;
553}
554
563void init_thermostats (int type, int elec)
564{
565 //int i = (type == ULTRA) ? qm_proj -> nspec: 1;
566 if (is_cpmd)
567 {
568 tmp_cpmd -> thermostats = 1;
569 tmp_cpmd -> ions_thermostat = init_thermo (0, type, 0);
570 }
571 else
572 {
573 tmp_cp2k -> thermostats = 1;
574 tmp_cp2k -> ions_thermostat = init_thermo (0, type, 0);
575 }
576 if (is_cpmd && elec) tmp_cpmd -> elec_thermostat = init_thermo (-1, type, 0);
577}
578
586void clean_thermostat (int new_type)
587{
588 int i;
589 thermostat * thermo = get_thermo ();
590 if (thermo -> sys > 0)
591 {
592 for (i=0; i<get_num_thermo(); i++)
593 {
594 if (thermo -> next != NULL) thermo = thermo -> next;
595 }
596 for (i=0; i<get_num_thermo(); i++)
597 {
598 if (thermo -> prev != NULL)
599 {
600 thermo = thermo -> prev;
601 g_free (thermo -> next);
602 }
603 }
604 }
605 g_free (thermo);
606 init_thermostats (new_type, 0);
607}
608
609G_MODULE_EXPORT void update_thermo_parameter (GtkEntry * res, gpointer data);
610
622void nose_parameters (GtkWidget * vbox, int id, int jd, gchar ** la, gchar ** lb)
623{
624 thermostat * thermo = get_active_thermostat (id);
625 //gchar * itemp[2]={"Initial temperature:", "Target temperature:"};
626 GtkWidget * hbox;
627 GtkWidget * widg;
628 int i, j;
629 i = (id < 0) ? id : 0;
630 for (j=0; j<jd; j++)
631 {
632 hbox = cpmd_box (vbox, la[j], 5, (is_cpmd) ? 20 : 50, 220);
633 widg = create_entry (G_CALLBACK(update_thermo_parameter), 100, 15, FALSE, GINT_TO_POINTER(i+j));
634 update_entry_double (GTK_ENTRY(widg), thermo -> params[j]);
635 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, widg, FALSE, FALSE, 0);
636 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(lb[j], -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
637 }
638}
639
650G_MODULE_EXPORT void cpmd_select_atom_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
651{
652 GtkTreeStore ** model = (GtkTreeStore **)data;
653 GtkTreeIter iter;
654 int i, j;
655 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
656 gtk_tree_model_get_iter (GTK_TREE_MODEL(* model), & iter, path);
657
658 gtk_tree_model_get (GTK_TREE_MODEL(* model), & iter, at_col, & i, -1);
659 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
660 {
661 j = 0;
662 n_therm --;
663 old_thermo[i-1] = 0;
664 qm_view -> picked --;
665 }
666 else
667 {
668 j = 1;
669 n_therm ++;
670 old_thermo[i-1] = 1;
671 qm_view -> picked ++;
672 }
673 qm_proj -> atoms[0][i-1].pick[0] = j;
674 qm_proj -> atoms[0][i-1].label[0] = j;
676 gtk_tree_store_set (* model, & iter, 3, j, -1);
677}
678
689G_MODULE_EXPORT void cp2k_select_coord_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
690{
691 int i, j;
692 j = GPOINTER_TO_INT(data);
693 GtkTreeIter iter;
694 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
695 gtk_tree_model_get_iter (GTK_TREE_MODEL(add_model), & iter, path);
696 gtk_tree_model_get (GTK_TREE_MODEL(add_model), & iter, at_col, & i, -1);
697 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
698 {
699 old_fixed[i-1][j-4] = 0;
700 }
701 else
702 {
703 old_fixed[i-1][j-4] = 1;
704 }
705 gtk_tree_store_set (add_model, & iter, (fixco) ? j : j-2, old_fixed[i-1][j-4], -1);
706}
707
719void atom_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
720{
721 int i, j, k;
722 gtk_tree_model_get (mod, iter, 1, & i, -1);
723 gtk_tree_model_get (mod, iter, 3, & j, -1);
724 set_renderer_color (j, renderer, init_color (i-1, num_cpmd_objects));
725 k = GPOINTER_TO_INT(data);
726 if (k == 2)
727 {
728 gchar * str;
729 gtk_tree_model_get (mod, iter, 2, & str, -1);
730 g_object_set (renderer, "markup", str, NULL, NULL);
731 g_free (str);
732 }
733}
734
746void atom_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
747{
748 int i, j, k;
749 i = GPOINTER_TO_INT(data);
750 gtk_tree_model_get (mod, iter, at_col, & j, -1);
751 if (j == 0 && i != 0)
752 {
753 gtk_cell_renderer_set_visible (renderer, FALSE);
754 }
755 else if (j == 0)
756 {
757 gtk_cell_renderer_set_visible (renderer, TRUE);
758 }
759 else if (j > 0 && i == 0)
760 {
761 gtk_cell_renderer_set_visible (renderer, FALSE);
762 }
763 else if (j > 0)
764 {
765 if (i < 4)
766 {
767 gtk_cell_renderer_set_visible (renderer, TRUE);
768 }
769 else
770 {
771 gtk_tree_model_get (mod, iter, 3, & k, -1);
772 gtk_cell_renderer_set_visible (renderer, k);
773 }
774 if (i < 3) atom_set_color (col, renderer, mod, iter, data);
775 }
776}
777
786int is_not_thermostated (int at, int therm)
787{
788 int i, j;
789 thermostat * thermo = get_thermo ();
790 for (i=0; i<get_num_thermo(); i++)
791 {
792 for (j=0; j<thermo -> natoms; j++)
793 {
794 if (thermo -> list[j] == at)
795 {
796 if (i == therm)
797 {
798 return 2;
799 }
800 else
801 {
802 return 0;
803 }
804 }
805 }
806 if (thermo -> next != NULL) thermo = thermo -> next;
807 }
808 return 1;
809}
810
818int is_fixed_atom (int at)
819{
820 int i;
821 if (is_cpmd)
822 {
823 for (i=0; i<tmp_cpmd -> fixat; i++)
824 {
825 if (tmp_cpmd -> fixlist[i] == at)
826 {
827 return i+2;
828 }
829 }
830 }
831 else
832 {
833 for (i=0; i<tmp_cp2k -> fixat[0]; i++)
834 {
835 if (tmp_cp2k -> fixlist[0][i] == at)
836 {
837 return i+2;
838 }
839 }
840 }
841 return 1;
842}
843
852int in_dummy (int at, int id)
853{
854 dummy_atom * dummy = get_active_dummy (-(id+2));
855 int i;
856 if (dummy -> natoms == qm_proj -> natomes) return 2;
857 for (i=0; i<dummy -> natoms; i++)
858 {
859 if (dummy -> list[i] == at) return 2;
860 }
861 return 1;
862}
863
872gboolean was_it_selected (int id, int at)
873{
874 if (id < -1)
875 {
876 return in_dummy (at, id);
877 }
878 else if (id == -1)
879 {
880 return is_fixed_atom (at);
881 }
882 else
883 {
884 return is_not_thermostated (at, id);
885 }
886}
887
896{
897 int i, j, k, l, m;
898 gchar * str;
899 GtkTreeIter spec_level;
900 GtkTreeIter atom_level;
901 k = 0;
902 for (i=0; i< qm_proj -> nspec; i++)
903 {
904 gtk_tree_store_append (add_model, & spec_level, NULL);
905 gtk_tree_store_set (add_model, & spec_level, 0, qm_proj -> chemistry -> label[i], 1, 0, 3, 0, 4, 0, -1);
906 for (j=0; j< qm_proj -> natomes; j++)
907 {
908 if (qm_proj -> atoms[0][j].sp == i)
909 {
910 k ++;
911 l = was_it_selected (therm, j);
912 if (fixco)
913 {
914 if (is_cpmd)
915 {
916 if (tmp_cpmd -> fixat > 0)
917 {
918 for (m=0; m<tmp_cpmd -> fixat; m++)
919 {
920 if (qm_proj -> atoms[0][j].coord[2] == tmp_cpmd-> fixlist[m])
921 {
922 l = 0;
923 break;
924 }
925 }
926 }
927 }
928 else
929 {
930 if (tmp_cp2k -> fixat[1] > 0)
931 {
932 for (m=0; m<tmp_cp2k -> fixat[1]; m++)
933 {
934 if (qm_proj -> atoms[0][j].coord[2] == tmp_cp2k -> fixlist[1][m])
935 {
936 l = 0;
937 break;
938 }
939 }
940 }
941 }
942 }
943 if (l)
944 {
945 gtk_tree_store_append (add_model, & atom_level, & spec_level);
946 str = g_strdup_printf ("%s<sub>%d</sub>", exact_name(qm_proj -> chemistry -> label[i]), j+1);
947 if (fixco)
948 {
949 gtk_tree_store_set (add_model, & atom_level, 0, 0, 1, k, 2, str, 3, old_thermo[j],
950 4, old_fixed[j][0], 5, old_fixed[j][1], 6, old_fixed[j][2], at_col, j+1, -1);
951 }
952 else
953 {
954 gtk_tree_store_set (add_model, & atom_level, 0, 0, 1, k, 2, str, 3, old_thermo[j], at_col, j+1, -1);
955 }
956 g_free (str);
957 }
958 }
959 }
960 }
961}
962
963#ifdef GTK4
972G_MODULE_EXPORT void select_atoms_not_thermostated (GtkCheckButton * but, gpointer data)
973#else
982G_MODULE_EXPORT void select_atoms_not_thermostated (GtkToggleButton * but, gpointer data)
983#endif
984{
985 int h, i, j, k, l, m;
986 h = GPOINTER_TO_INT (data);
987 j = button_get_status ((GtkWidget *)but);
988 for (i=0; i<qm_proj -> natomes; i++)
989 {
990 m = 0;
991 if (j)
992 {
993 k = l = m = 1;
994 if (was_it_selected(h, i) != 1)
995 {
996 m = 0;
997 }
998 }
999 else if (old_thermo[i])
1000 {
1001 k = -1;
1002 l = 0;
1003 m = 1;
1004 }
1005 if (m)
1006 {
1007 n_therm += k;
1008 old_thermo[i] = l;
1009 if (l) qm_view -> picked ++;
1010 qm_proj -> atoms[0][i].pick[0] = l;
1011 qm_proj -> atoms[0][i].label[0] = l;
1012 }
1013 }
1014 gtk_tree_store_clear (add_model);
1017}
1018
1028G_MODULE_EXPORT void run_select_atom_from_model (GtkDialog * dialog, gint response_id, gpointer data)
1029{
1030 int i, j;
1031 gboolean done = FALSE;
1032 gchar * str;
1033 switch (response_id)
1034 {
1035 case GTK_RESPONSE_APPLY:
1036 if (n_therm > 1)
1037 {
1038 str = g_strdup_printf ("%d atoms have been selected !", n_therm);
1039 }
1040 else if (n_therm)
1041 {
1042 str = g_strdup_printf ("A single atom has been selected !");
1043 }
1044 else
1045 {
1046 str = g_strdup_printf ("Not at single atom has been selected !");
1047 }
1048 str = g_strdup_printf ("%s\nis this correct ?", str);
1049 selection_confirmed = FALSE;
1050 field_question (str, G_CALLBACK(confirm_selection), NULL);
1051 g_free (str);
1053 {
1054 done = TRUE;
1055 if (fixco)
1056 {
1057 for (i=0; i<qm_proj -> natomes; i++)
1058 {
1059 if (old_thermo[i] && ! old_fixed[i][0] && ! old_fixed[i][1] && ! old_fixed[i][2])
1060 {
1061 str = g_strdup_printf ("Atom %d has been selected but not coordinates are frozen !\n"
1062 "Unselect atom %d or select coordinate(s) to freeze !", i+1, i+1);
1064 done = FALSE;
1065 }
1066 }
1067 }
1068 }
1069 thermostat * thermo;
1070 dummy_atom * dummy;
1071 if (done)
1072 {
1073 if (the_therm < -1)
1074 {
1076 dummy -> natoms = n_therm;
1077 if (dummy -> list != NULL)
1078 {
1079 g_free (dummy -> list);
1080 dummy -> list = NULL;
1081 }
1082 if (n_therm > 0 && n_therm < qm_proj -> natomes)
1083 {
1084 dummy -> list = allocint (n_therm);
1085 j = -1;
1086 for (i=0; i< qm_proj -> natomes; i++)
1087 {
1088 if (old_thermo[i])
1089 {
1090 j ++;
1091 dummy -> list[j] = i;
1092 }
1093 }
1094 }
1095 }
1096 else if (the_therm == -1)
1097 {
1098 if (is_cpmd)
1099 {
1100 if (tmp_cpmd -> fixlist != NULL)
1101 {
1102 g_free (tmp_cpmd -> fixlist);
1103 tmp_cpmd -> fixlist = NULL;
1104 if (tmp_cpmd -> fixcoord != NULL)
1105 {
1106 g_free (tmp_cpmd -> fixcoord);
1107 tmp_cpmd -> fixcoord = NULL;
1108 }
1109 }
1110 if (n_therm > 0)
1111 {
1112 tmp_cpmd -> fixlist = allocint (n_therm);
1113 if (fixco) tmp_cpmd -> fixcoord = allocdint (n_therm, 3);
1114 tmp_cpmd -> fixat = n_therm;
1115 j = -1;
1116 for (i=0; i< qm_proj -> natomes; i++)
1117 {
1118 if (old_thermo[i])
1119 {
1120 j ++;
1121 tmp_cpmd -> fixlist[j] = i;
1122 if (fixco)
1123 {
1124 tmp_cpmd -> fixcoord[j][0] = old_fixed[i][0];
1125 tmp_cpmd -> fixcoord[j][1] = old_fixed[i][1];
1126 tmp_cpmd -> fixcoord[j][2] = old_fixed[i][2];
1127 }
1128 }
1129 }
1130 }
1131 }
1132 else
1133 {
1134 if (tmp_cp2k -> fixlist[0] != NULL)
1135 {
1136 g_free (tmp_cp2k -> fixlist[0]);
1137 tmp_cp2k -> fixlist[0] = NULL;
1138 if (tmp_cp2k -> fixcoord[0] != NULL)
1139 {
1140 g_free (tmp_cp2k -> fixcoord[0]);
1141 tmp_cp2k -> fixcoord[0] = NULL;
1142 }
1143 }
1144 if (n_therm > 0)
1145 {
1146 tmp_cp2k -> fixlist[0] = allocint (n_therm);
1147 tmp_cp2k -> fixcoord[0] = allocdint (n_therm, 3);
1148 tmp_cp2k -> fixat[0] = n_therm;
1149 j = -1;
1150 for (i=0; i< qm_proj -> natomes; i++)
1151 {
1152 if (old_thermo[i])
1153 {
1154 j ++;
1155 tmp_cp2k -> fixlist[0][j] = i;
1156 tmp_cp2k -> fixcoord[0][j][0] = old_fixed[i][0];
1157 tmp_cp2k -> fixcoord[0][j][1] = old_fixed[i][1];
1158 tmp_cp2k -> fixcoord[0][j][2] = old_fixed[i][2];
1159 }
1160 }
1161 }
1162 }
1163 }
1164 else
1165 {
1167 thermo -> natoms = n_therm;
1168 if (thermo -> list != NULL)
1169 {
1170 g_free (thermo -> list);
1171 thermo -> list = NULL;
1172 }
1173 if (n_therm > 0)
1174 {
1175 thermo -> list = allocint (n_therm);
1176 j = -1;
1177 for (i=0; i< qm_proj -> natomes; i++)
1178 {
1179 if (old_thermo[i])
1180 {
1181 j ++;
1182 thermo -> list[j] = i;
1183 }
1184 }
1185 }
1186 }
1187 }
1188 break;
1189 case GTK_RESPONSE_CLOSE:
1190 done = TRUE;
1191 break;
1192 }
1193 if (done) destroy_this_dialog (dialog);
1194}
1195
1204{
1205 int i, j, k, l, m;
1206 the_therm = therm;
1207 GtkTreeViewColumn * ato_col[8];
1208 GtkCellRenderer * ato_cell[8];
1209 gchar * ato_title[2][8] = {{"Species", "Id (*)", "Atom", "Viz.3D & Select", " "},
1210 {"Species", "Id (*)", "Atom", "Viz.3D & Select", "x", "y", "z", " "}};
1211 gchar * ctype[2][8] = {{"text", "text", "text", "active", "text", "active", "active", "active"},
1212 {"text", "text", "text", "active", "active", "active", "active", "text"}};
1213 GType col_type[2][8] = {{G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT},
1214 {G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT}};
1215 gchar * str;
1216 at_col = 4;
1217
1218 fixco = FALSE;
1219 qm_view -> picked = 0;
1220 if (! is_cpmd && the_therm == -1)
1221 {
1222 fixco = TRUE;
1223 }
1224 else if (is_cpmd)
1225 {
1226 if ((int)tmp_cpmd -> default_opts[DEFFI] == 2) fixco = TRUE;
1227 }
1228 if (the_therm < -1)
1229 {
1230 str = g_strdup_printf ("Select atom(s) to construct dummy N°%d", -(the_therm+1));
1231 }
1232 else if (the_therm == -1)
1233 {
1234 str = g_strdup_printf ("Select atom(s) to fix");
1235 if (fixco)
1236 {
1237 g_free (str);
1238 at_col = 7;
1239 str = g_strdup_printf ("Select atom(s) and coordinate(s) to fix");
1240 }
1241 }
1242 else
1243 {
1244 str = g_strdup_printf ("Add atom(s) to thermostat N°%d", the_therm+1);
1245 }
1246 GtkWidget * amol = dialogmodal (str, GTK_WINDOW(qm_assistant));
1247 g_free (str);
1248 gtk_dialog_add_button (GTK_DIALOG(amol), "Apply", GTK_RESPONSE_APPLY);
1249 n_therm = 0;
1250 i = (fixco) ? 1 : 0;
1251 j = (fixco) ? 8 : 5;
1252 add_model = gtk_tree_store_newv (j, col_type[i]);
1253 GtkWidget * add_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(add_model));
1254 for (k=0; k<j-1; k++)
1255 {
1256 if (k < 3)
1257 {
1258 ato_cell[k] = gtk_cell_renderer_text_new ();
1259 }
1260 else
1261 {
1262 ato_cell[k] = gtk_cell_renderer_toggle_new ();
1263 if (k==3)
1264 {
1265 g_signal_connect (G_OBJECT(ato_cell[k]), "toggled", G_CALLBACK(cpmd_select_atom_id), & add_model);
1266 }
1267 else
1268 {
1269 g_signal_connect (G_OBJECT(ato_cell[k]), "toggled", G_CALLBACK(cp2k_select_coord_id), GINT_TO_POINTER(k));
1270 }
1271 }
1272 ato_col[k] = gtk_tree_view_column_new_with_attributes (ato_title[i][k], ato_cell[k], ctype[i][k], k, NULL);
1273 gtk_tree_view_append_column (GTK_TREE_VIEW(add_tree), ato_col[k]);
1274 gtk_tree_view_column_set_alignment (ato_col[k], 0.5);
1275 gtk_tree_view_column_set_cell_data_func (ato_col[k], ato_cell[k], atom_set_visible, GINT_TO_POINTER(k), NULL);
1276 }
1277 old_thermo = allocint (qm_proj -> natomes);
1278 if (fixco)
1279 {
1280 old_fixed = allocdint (qm_proj -> natomes, 3);
1281 }
1282 k = l = 0;
1283 for (i=0; i < qm_proj -> nspec; i++)
1284 {
1285 for (j=0; j < qm_proj -> natomes; j++)
1286 {
1287 if (qm_proj -> atoms[0][j].sp == i)
1288 {
1289 k ++;
1290 m = was_it_selected (the_therm, j);
1291 if (m)
1292 {
1293 l ++;
1294 n_therm += (m > 1) ? 1 : 0;
1295 old_thermo[j] = (m > 1) ? 1 : 0;
1296 qm_proj -> atoms[0][j].pick[0] = old_thermo[j];
1297 qm_view -> picked += old_thermo[j];
1298 if (fixco && m > 1)
1299 {
1300 if (is_cpmd)
1301 {
1302 old_fixed[j][0] = tmp_cpmd -> fixcoord[m-2][0];
1303 old_fixed[j][1] = tmp_cpmd -> fixcoord[m-2][1];
1304 old_fixed[j][2] = tmp_cpmd -> fixcoord[m-2][2];
1305 }
1306 else
1307 {
1308 old_fixed[j][0] = tmp_cp2k -> fixcoord[0][m-2][0];
1309 old_fixed[j][1] = tmp_cp2k -> fixcoord[0][m-2][1];
1310 old_fixed[j][2] = tmp_cp2k -> fixcoord[0][m-2][2];
1311 }
1312 }
1313 }
1314 }
1315 }
1316 }
1319 num_cpmd_objects = l;
1320 g_object_unref (add_model);
1321 i = ((qm_proj -> nspec + l)*37 < 500) ? (qm_proj -> nspec + l)*37 : 500;
1322 //GtkWidget * scrollsets = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN, 0);
1323 GtkWidget * scrollsets = create_scroll (dialog_get_content_area (amol), 320, i, GTK_SHADOW_ETCHED_IN);
1325 str = g_strdup_printf (" <b>(*)</b> Order of appearance in the input file");
1326 GtkWidget * vbox = dialog_get_content_area (amol);
1327 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
1328 g_free (str);
1329 if (the_therm != -1)
1330 {
1331 if (get_num_thermo() > 1 || the_therm < -1)
1332 {
1333 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);
1334 GtkWidget * hbox = create_hbox (0);
1335 gchar * lab[2] = {"All non-thermostated atom(s)", "All atom(s)"};
1336 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox,
1337 check_button (lab[(the_therm > -1) ? 0 : 1], -1, -1,
1338 FALSE, G_CALLBACK(select_atoms_not_thermostated), GINT_TO_POINTER(the_therm)),
1339 FALSE, FALSE, 50);
1340 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
1341 }
1342 }
1345 if (the_therm > -1) set_going_forward ();
1346 g_free (old_thermo);
1347 fixco = FALSE;
1348}
1349
1358G_MODULE_EXPORT void atom_selection_button (GtkButton * but, gpointer data)
1359{
1360 int num, id;
1361 int i = GPOINTER_TO_INT(data);
1363 if (i < -1)
1364 {
1365 id = 2;
1366 num = get_active_dummy (-(i+2)) -> natoms;
1367 }
1368 else if (i == -1)
1369 {
1370 id = 1;
1371 num = (is_cpmd) ? tmp_cpmd -> fixat : tmp_cp2k -> fixat[0];
1372 }
1373 else
1374 {
1375 id = 0;
1376 thermostat * thermo = get_active_thermostat (i);
1377 num = thermo -> natoms;
1378 }
1379 gchar * stra, * strb;
1380 if (num == 0)
1381 {
1382 stra = g_strdup_printf ("Not picked yet !");
1383 strb = g_strdup_printf (DELETEB);
1384 }
1385 else
1386 {
1387 stra = g_strdup_printf ("%d atom(s)", num);
1388 strb = g_strdup_printf (APPLY);
1389 }
1391 gtk_button_set_label (but, stra);
1392 g_free (stra);
1393 g_free (strb);
1394 if (is_cpmd)
1395 {
1396 // CPMD
1397 if (i < -1)
1398 {
1399 print_the_section (8, 0, qmbuffer[8]);
1400 }
1401 else if (i == -1)
1402 {
1403 print_the_section (8, 0, qmbuffer[8]);
1404 }
1405 else
1406 {
1407 for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1408 }
1409 }
1410 else
1411 {
1412 // CP2K
1413 }
1414}
1415
1426void create_selection_button (GtkWidget * box, int num, int id, gpointer data)
1427{
1428 int i = GPOINTER_TO_INT(data);
1429 GtkWidget * hbox = cpmd_box (box, "Atom(s) selection: ", 5, 20, (i < -1) ? 120 : 220);
1430 gchar * str;
1431 if (num == 0)
1432 {
1433 str = g_strdup_printf ("Not picked yet !");
1434 sel_img[id] = stock_image (DELETEB);
1435 }
1436 else
1437 {
1438 str = g_strdup_printf ("%d atom(s)", (int)num);
1439 sel_img[id] = stock_image (APPLY);
1440 }
1441 sel_but[id] = gtk_button_new_with_label (str);
1442 gtk_widget_set_size_request (sel_but[id], 150, -1);
1443 g_free (str);
1444 g_signal_connect (G_OBJECT(sel_but[id]), "clicked", G_CALLBACK(atom_selection_button), data);
1445 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sel_but[id], FALSE, FALSE, 0);
1446 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sel_img[id], FALSE, FALSE, 30);
1447}
1448
1457{
1458 gchar * str;
1460 str = g_strdup_printf ("Configuration for thermostat N°<b>%d</b>: ", therm_id+1);
1462 cpmd_box (nose_id_box[1], str, 5, 5, 220);
1463 g_free (str);
1464 thermostat * thermo = get_active_thermostat (therm_id);
1465 create_selection_button (nose_id_box[1], thermo -> natoms, 0, GINT_TO_POINTER(therm_id));
1466 nose_parameters (nose_id_box[1], therm_id,
1467 v_thermo[!is_cpmd][thermo->type],
1468 c_thermo[!is_cpmd][thermo->type],
1469 u_thermo[!is_cpmd][thermo->type]);
1470 add_box_child_start (GTK_ORIENTATION_VERTICAL, nose_id_box[0], nose_id_box[1], FALSE, FALSE, 0);
1472}
1473
1482G_MODULE_EXPORT void changed_nose_thermo_id_box (GtkComboBox * box, gpointer data)
1483{
1484 int i;
1485 i = combo_get_active ((GtkWidget *)box);
1487}
1488
1499void create_selection_combo (int id, int num, int type, GCallback handler)
1500{
1501 int i, j;
1502 gchar * str;
1503 gchar * lab[2]={"Thermostat", "Dummy atom"};
1505 combo_id_box[id] = create_combo ();
1506 for (i=0; i<num; i++)
1507 {
1508 str = g_strdup_printf ("%s N°%d", lab[id], i+1);
1510 g_free (str);
1511 }
1512 j = type;
1513 if (num > 0)
1514 {
1516 if (id == 0)
1517 {
1519 }
1520 else
1521 {
1523 }
1524 }
1525 else
1526 {
1529 }
1530 g_signal_connect (G_OBJECT (combo_id_box[id]), "changed", handler, GINT_TO_POINTER(j));
1531 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, combo_id[id], combo_id_box[id], FALSE, FALSE, 0);
1533}
1534
1543{
1544 int i, j;
1545 thermostat * thermo = get_thermo ();
1546 j = get_num_thermo ();
1547 while (thermo -> next != NULL) thermo = thermo -> next;
1548 for (i=0; i<extra; i++)
1549 {
1550 thermo -> next = init_thermo (i+j, thermo -> type, thermo -> sys);
1551 thermo -> next -> prev = thermo;
1552 if (i < extra-1) thermo = thermo -> next;
1553 }
1554
1555 if (is_cpmd)
1556 {
1557 tmp_cpmd -> thermostats += extra;
1558 }
1559 else
1560 {
1561 tmp_cp2k -> thermostats += extra;
1562 }
1563 // finally update the combobox
1565}
1566
1575G_MODULE_EXPORT void add_or_remove_thermostat (GtkSpinButton * res, gpointer data)
1576{
1577 int id = gtk_spin_button_get_value_as_int(res);
1578 int i, j, k;
1579 gchar * str;
1580 gboolean add_thermo = TRUE;
1581 thermostat * thermo = get_thermo();
1582 if (id != get_num_thermo ())
1583 {
1584 if (id > get_num_thermo ())
1585 {
1586 // adding thermostats
1587 // ok if: 1) all atoms do not already have a thermostat assigned
1588 // 2) number of thermostat(s) to create < number of atoms that do have a thermostat assigned
1589 j = 0;
1590 for (i=0; i<get_num_thermo (); i++)
1591 {
1592 j += thermo -> natoms;
1593 if (thermo -> next != NULL) thermo = thermo -> next;
1594 }
1595 if (j < qm_proj -> natomes)
1596 {
1597 // Number of thermostat to create
1598 k = id - get_num_thermo ();
1599 if (k < (qm_proj -> natomes - j))
1600 {
1601 if (k > 1)
1602 {
1603 str = g_strdup_printf ("Do you really want to add %d thermostat(s) ?", k);
1604 add_thermo = ask_yes_no ("Adding thermostat(s) ?", str, GTK_MESSAGE_QUESTION, qm_assistant);
1605 g_free (str);
1606 }
1607 if (add_thermo)
1608 {
1609 add_thermostat (k);
1610 }
1611 else
1612 {
1613 // Set value back to the number of ionic thermostats
1614 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1615 }
1616 }
1617 else
1618 {
1619 show_warning ("It is not possible to create so many thermostats", qm_assistant);
1620 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1621 }
1622 }
1623 else
1624 {
1625 show_warning ("All atoms arleady have a thermostat assigned", qm_assistant);
1626 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1627 }
1628 }
1629 else
1630 {
1631 // removing thermostats
1633 }
1634 }
1635 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)(get_num_thermo ()));
1636 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1637}
1638
1647G_MODULE_EXPORT void update_thermo_parameter (GtkEntry * res, gpointer data)
1648{
1649 int i, j;
1650 i = GPOINTER_TO_INT(data);
1651 const gchar * m = entry_get_text (res);
1652 double v = string_to_double ((gpointer)m);
1653 if (i < 0)
1654 {
1655 if (tmp_cpmd -> elec_thermostat -> params[i+2] != v)
1656 {
1657 tmp_cpmd -> elec_thermostat -> params[i+2] = v;
1659 }
1660 }
1661 else
1662 {
1663 if (get_num_thermo () > 1)
1664 {
1666 }
1667 else
1668 {
1669 j = 0;
1670 }
1671 thermostat * thermo = get_active_thermostat (j);
1672 if (i < 2)
1673 {
1674 if (thermo -> params[i] != v)
1675 {
1676 thermo -> params[i] = v;
1678 }
1679 }
1680 else
1681 {
1682 if ((int)thermo -> params[i] != (int)v)
1683 {
1684 thermo -> params[i] = v;
1685 update_entry_int (res, (int)v);
1686 }
1687 }
1688 }
1689 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1690}
1691
1699GtkWidget * create_nose_box (int n)
1700{
1701 GtkWidget * vbox = create_vbox (BSEP);
1702 GtkWidget * hbox;
1703 GtkWidget * widg;
1704 if (n > GLOBAL)
1705 {
1706 hbox = cpmd_box (vbox, "Number of thermostat(s): ", 5, 5, 220);
1707 widg = spin_button (G_CALLBACK(add_or_remove_thermostat),
1708 (double)(get_num_thermo ()), 1.0, (double)qm_proj -> natomes, 1.0, 0, 100, NULL);
1709 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, widg, FALSE, FALSE, 0);
1710 combo_id[0] = cpmd_box (vbox, "Thermostat to configure: ", 5, 5, 220);
1712 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, nose_id_box[0], FALSE, FALSE, 10);
1715 }
1716 else
1717 {
1719 v_thermo[!is_cpmd][get_thermo()->type],
1720 c_thermo[!is_cpmd][get_thermo()->type],
1721 u_thermo[!is_cpmd][get_thermo()->type]);
1722 }
1723 return vbox;
1724}
1725
1734G_MODULE_EXPORT void changed_thermo_box_nose (GtkComboBox * box, gpointer data)
1735{
1736 int i;
1737 i = combo_get_active ((GtkWidget *)box);
1738 if (i != get_thermo () -> sys)
1739 {
1740 clean_thermostat (get_thermo () -> type);
1742 get_thermo () -> sys = i;
1743 nose_box = create_nose_box (get_thermo () -> sys);
1744 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
1745 int j;
1746 if (is_cpmd) for (j=1; j<4; j++) print_the_section (j, 0, qmbuffer[j]);
1748 }
1750}
1751
1758{
1759 int i, j, k;
1760 GtkWidget * hbox;
1761 GtkWidget * tbox;
1762 gchar * str;
1766 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_ions, therm_param_ions, FALSE, FALSE, 0);
1767 i = (is_cpmd) ? 1 : 0;
1768 //if (is_cpmd)
1769 {
1770 if (get_thermo () -> type > i)
1771 {
1772 hbox = cpmd_box (therm_param_ions, "Thermostat type: ", 5, 5, 220);
1773 tbox = create_combo ();
1774 j = 2; // For QM-MM: qm_view -> bonding + 2;
1775 for (k=0; k<j; k++)
1776 {
1777 str = g_strdup_printf ("%s", nosetype[k]);
1778 combo_text_append (tbox, str);
1779 g_free (str);
1780 }
1781 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tbox, FALSE, FALSE, 0);
1782 combo_set_active (tbox, get_thermo () -> sys);
1783 g_signal_connect (G_OBJECT (tbox), "changed", G_CALLBACK(changed_thermo_box_nose), NULL);
1784 }
1785 }
1786 nose_box = create_nose_box (get_thermo () -> sys);
1787 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
1789 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1790}
1791
1798{
1801 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_elec, therm_param_elec, FALSE, FALSE, 0);
1802 int i;
1804 v_thermo[0][tmp_cpmd -> elec_thermostat -> type],
1805 c_thermo[0][tmp_cpmd -> elec_thermostat -> type],
1806 ue_thermo[tmp_cpmd -> elec_thermostat -> type]);
1808 for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1809}
1810
1819G_MODULE_EXPORT void changed_thermo_box (GtkComboBox * box, gpointer data)
1820{
1821 int i, j;
1822 i = combo_get_active ((GtkWidget *)box);
1823 j = GPOINTER_TO_INT (data);
1824 if (j == 0 && i != get_thermo () -> type)
1825 {
1826 clean_thermostat (i);
1827 thermostat * thermo = get_thermo();
1828 thermo -> sys = GLOBAL;
1830 }
1831 else if (j == -1)
1832 {
1833 if (i != tmp_cpmd -> elec_thermostat -> type)
1834 {
1835 g_free (tmp_cpmd -> elec_thermostat);
1836 tmp_cpmd -> elec_thermostat = init_thermo (-1, i, 0);
1837 tmp_cpmd -> elec_thermostat -> sys = 0;
1839 }
1840 }
1842}
1843
1853void thermo_type_box (GtkWidget * vbox, gchar * str, int id)
1854{
1855 int i;
1856 GtkWidget * hbox = create_hbox (0);
1857 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 5);
1858 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 5);
1859 GtkWidget * tbox = create_combo ();
1860 for (i=0; i<num_thermo[!is_cpmd]; i++)
1861 {
1862 str = g_strdup_printf ("%s", thermo_name[!is_cpmd][i]);
1863 combo_text_append (tbox, str);
1864 g_free (str);
1865 }
1866 if (id == -1)
1867 {
1868 combo_set_active (tbox, tmp_cpmd -> elec_thermostat -> type);
1869 }
1870 else
1871 {
1872 thermostat * thermo = get_thermo();
1873 combo_set_active (tbox, thermo -> type);
1874 }
1875 g_signal_connect (G_OBJECT (tbox), "changed", G_CALLBACK(changed_thermo_box), GINT_TO_POINTER(id));
1876 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tbox, FALSE, FALSE, 0);
1877}
1878
1884GtkWidget * thermo_box ()
1885{
1886 gchar * thermo_info[2] = {"<u>Ionic subsystem thermostat:</u> ", "Thermostat: "};
1887 GtkWidget * vbox = create_vbox (BSEP);
1888 GtkWidget * vvbox;
1889 nose_id_box[0] = nose_id_box[1] = NULL;
1890 therm_param_ions = NULL;
1891 therm_param_elec = NULL;
1892 nose_box = NULL;
1893 combo_id_box[0] = NULL;
1894 combo_id[0] = NULL;
1895 if (get_num_thermo() == 0) init_thermostats (0, 1);
1896 // Thermostat type ions
1897 vvbox = create_vbox (BSEP);
1898 gtk_widget_set_size_request (vvbox, (is_cpmd) ? 525 : -1, (is_cpmd) ? 350 : 260);
1899 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, vvbox, FALSE, FALSE, 0);
1900 thermo_type_box (vvbox, thermo_info[!is_cpmd], 0);
1902 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox, therm_ions, FALSE, FALSE, (is_cpmd) ? 0 : 20);
1904 // Thermostat type electrons
1905 if (is_cpmd)
1906 {
1908 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, electron_box, FALSE, FALSE, 5);
1909 thermo_type_box (electron_box, "<u>Fictitious electronic subsystem:</u> ", -1);
1911 add_box_child_start (GTK_ORIENTATION_VERTICAL, electron_box, therm_elec, FALSE, FALSE, 0);
1913 }
1914 return vbox;
1915}
void field_question(gchar *question, GCallback handler, gpointer data)
ask the use to confirm something
Definition calc.c:103
GtkTextBuffer * qmbuffer[MAXDATAQM+2]
Definition calc.c:70
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
GtkWidget * qm_assistant
Definition calc.c:66
glwin * qm_view
Definition calc.c:68
project * qm_proj
Definition calc.c:67
Variable declarations for the MD input preparation assistants.
integer(kind=c_int) function chemistry()
Definition chemistry.F90:22
Variable declarations for the creation of the CP2K input file(s)
cp2k * tmp_cp2k
Definition cp2k_init.c:86
#define CP2NTHERM
Definition cp2k.h:86
Variable declarations for the creation of the CPMD input file.
#define DEFFI
Definition cpmd.h:50
@ LOCAL
Definition cpmd.h:118
@ GLOBAL
Definition cpmd.h:117
gchar * thermo_name[2][5]
Definition cpmd_init.c:218
gboolean is_cpmd
Definition cpmd_init.c:235
cpmd * tmp_cpmd
Definition cpmd_init.c:103
int num_thermo[2]
Definition cpmd_init.c:220
gchar * default_opts[MAXDATAQM-1][NSECOP]
Definition cpmd_init.c:123
gchar * nosetype[3]
Definition cpmd_init.c:216
dummy_atom * dummy
Definition cpmd_atoms.c:73
G_MODULE_EXPORT void changed_nose_thermo_id_box(GtkComboBox *box, gpointer data)
change thermostat id
Definition cpmd_nose.c:1482
void atom_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
show / hide cell renderer in the CPMD atom selection tree store
Definition cpmd_nose.c:746
void create_dummy_param_box(int dummy_id)
crreate dummy atom parameter widgets
Definition cpmd_atoms.c:144
G_MODULE_EXPORT void select_atoms_not_thermostated(GtkToggleButton *but, gpointer data)
select atom to thermostat toggle callback GTK3
Definition cpmd_nose.c:982
G_MODULE_EXPORT void run_remove_nose_thermostat(GtkDialog *dialog, gint response_id, gpointer data)
remove thermostat(s) - running the dialog
Definition cpmd_nose.c:372
gboolean was_it_selected(int id, int at)
was this atom already selected ?
Definition cpmd_nose.c:872
G_MODULE_EXPORT void cp2k_select_coord_id(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select CP2K fixed id toggle callback
Definition cpmd_nose.c:689
thermostat * init_thermo(int id, int type, int sys)
initialize new thermostat
Definition cpmd_nose.c:532
void create_nose_thermo_param_box(int therm_id)
create thermostat configuration widgets
Definition cpmd_nose.c:1456
G_MODULE_EXPORT void update_thermo_parameter(GtkEntry *res, gpointer data)
update thermostat parameter value entry callback
Definition cpmd_nose.c:1647
GtkTreeViewColumn * thermo_col[6]
Definition cpmd_nose.c:149
double d_thermo[2][CP2NTHERM][4]
Definition cpmd_nose.c:127
GtkWidget * sel_img[3]
Definition cpmd_nose.c:138
gboolean fixco
Definition cpmd_nose.c:156
GtkWidget * nose_box
Definition cpmd_nose.c:144
void create_selection_button(GtkWidget *box, int num, int id, gpointer data)
create thermostat atom(s) selection button
Definition cpmd_nose.c:1426
void clean_nose_widgets()
clean thermostat widgets
Definition cpmd_nose.c:236
void thermo_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color in the QM / QM-MM thermostat selection tree store
Definition cpmd_nose.c:316
GtkWidget * cpmd_box(GtkWidget *box, gchar *lab, int v_space, int h_space, int dim)
prepare a labelled box widget for the CPMD input creation assistant
Definition cpmd_init.c:248
GtkWidget * electron_box
Definition cpmd_nose.c:139
GtkWidget * therm_param_ions
Definition cpmd_nose.c:142
G_MODULE_EXPORT void run_select_atom_from_model(GtkDialog *dialog, gint response_id, gpointer data)
select atom from model - running the dialgo
Definition cpmd_nose.c:1028
void fill_thermo_atom_model(int therm)
fill thermostat atom model
Definition cpmd_nose.c:895
gboolean are_all_atoms_thermostated()
are all atom(s) in the model thermostated ?
Definition cpmd_nose.c:198
GtkWidget * create_nose_box(int n)
create thermostat configuration widgets
Definition cpmd_nose.c:1699
void create_selection_combo(int id, int num, int type, GCallback handler)
create thermostat selection combo box
Definition cpmd_nose.c:1499
void nose_parameters(GtkWidget *vbox, int id, int jd, gchar **la, gchar **lb)
create thermostat parameters configuration widgets
Definition cpmd_nose.c:622
void thermo_type_box(GtkWidget *vbox, gchar *str, int id)
prepare the thermostat option widgets
Definition cpmd_nose.c:1853
GtkWidget * therm_ions
Definition cpmd_nose.c:140
int is_not_thermostated(int at, int therm)
is atom thermostated ?
Definition cpmd_nose.c:786
GtkWidget * therm_elec
Definition cpmd_nose.c:141
void thermo_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
show / hide cell renderer in the QM / QM-MM thermostat selection tree store
Definition cpmd_nose.c:336
int v_thermo[2][CP2NTHERM]
Definition cpmd_nose.c:125
void prepare_therm_elec()
prepare electrons thermostat widgets
Definition cpmd_nose.c:1797
void remove_nose_thermostat(int num_to_remove)
remove thermostat(s) - creating the dialog
Definition cpmd_nose.c:458
int get_num_thermo()
get the number of thermostat(s)
Definition cpmd_nose.c:181
G_MODULE_EXPORT void select_thermo(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select QM / QM-MM thermostat toggle callback
Definition cpmd_nose.c:279
thermostat * get_active_thermostat(int id)
get thermostat using id
Definition cpmd_nose.c:252
void prepare_therm_ions()
prepare ions thermostat widgets
Definition cpmd_nose.c:1757
int n_therm
Definition cpmd_nose.c:150
int num_cpmd_objects
Definition cpmd_nose.c:154
int in_dummy(int at, int id)
is atom in dummy ?
Definition cpmd_nose.c:852
void init_thermostats(int type, int elec)
initialize thermostat(s)
Definition cpmd_nose.c:563
G_MODULE_EXPORT void add_or_remove_thermostat(GtkSpinButton *res, gpointer data)
add / remove thermostat
Definition cpmd_nose.c:1575
G_MODULE_EXPORT void cpmd_select_atom_id(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select CPMD atom id toggle callback
Definition cpmd_nose.c:650
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
Definition initcoord.c:81
void print_the_section(int s, int p, GtkTextBuffer *buffer)
print CPMD input section
Definition cpmd_print.c:695
GtkWidget * combo_id_box[2]
Definition cpmd_nose.c:146
int * old_thermo
Definition cpmd_nose.c:152
int the_therm
Definition cpmd_nose.c:155
void add_thermostat(int extra)
add thermostat(s)
Definition cpmd_nose.c:1542
void set_going_forward()
QM / QM-MM assistant going forward on thermostat page.
Definition cpmd_nose.c:224
GtkWidget * combo_id[2]
Definition cpmd_nose.c:145
char * u_thermo[2][CP2NTHERM][4]
Definition cpmd_nose.c:109
GtkCellRenderer * thermo_renderer[6]
Definition cpmd_nose.c:148
G_MODULE_EXPORT void changed_thermo_box_nose(GtkComboBox *box, gpointer data)
change the type of the ionic thermostat
Definition cpmd_nose.c:1734
G_MODULE_EXPORT void atom_selection_button(GtkButton *but, gpointer data)
select atom(s) to be thermostated
Definition cpmd_nose.c:1358
G_MODULE_EXPORT void changed_thermo_box(GtkComboBox *box, gpointer data)
change the thermostat family (ionic / fictitious electronic)
Definition cpmd_nose.c:1819
void proj_unselect_all_atoms()
unselect all atom(s) in the target project of the assistant
Definition cpmd_init.c:1024
GtkTreeStore * add_model
Definition cpmd_nose.c:157
GtkWidget * nose_id_box[2]
Definition cpmd_nose.c:147
void select_atom_from_model(int therm)
select atom from model - creating the dialog
Definition cpmd_nose.c:1203
dummy_atom * get_active_dummy(int id)
get dummy atom by id
Definition cpmd_atoms.c:86
char * c_thermo[2][CP2NTHERM][4]
Definition cpmd_nose.c:98
GtkWidget * thermo_box()
create the thermostat configuration widgets
Definition cpmd_nose.c:1884
char * ue_thermo[CP2NTHERM][4]
Definition cpmd_nose.c:120
thermostat * get_thermo()
get QM / QM-MM ions thermostat
Definition cpmd_nose.c:164
int at_col
Definition cpmd_nose.c:151
int is_fixed_atom(int at)
is atom fixed ?
Definition cpmd_nose.c:818
GtkWidget * sel_but[3]
Definition cpmd_nose.c:137
void clean_thermostat(int new_type)
free thermostat data, then initialiaze new type of thermostat
Definition cpmd_nose.c:586
int ** old_fixed
Definition cpmd_nose.c:153
GtkWidget * therm_param_elec
Definition cpmd_nose.c:143
void atom_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color in the CPMD atom selection tree store
Definition cpmd_nose.c:719
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
float extra
ColRGBA col
Definition d_measures.c:77
int atoms[NUM_STYLES][2]
GtkTreePath * path
Definition datab.c:103
GtkTreeViewColumn * ato_col[4]
Definition dlp_atom.c:62
GtkCellRenderer * ato_cell[4]
Definition dlp_atom.c:63
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
GtkWidget * add_tree
Definition dlp_edit.c:910
GType col_type[MAXDATA][12]
Definition dlp_field.c:856
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:330
int * allocint(int val)
allocate an int * pointer
Definition global.c:314
double string_to_double(gpointer string)
convert string to double
Definition global.c:624
Global variable declarations Global convenience function declarations Global data structure defin...
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:501
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
Definition gtk-misc.c:909
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1375
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:643
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
Definition gtk-misc.c:1714
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:2095
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:520
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:932
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:607
#define BSEP
Definition global.h:247
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:624
GtkWidget * stock_image(const gchar *stock_id)
create a GtkImage for the Gtk database
Definition gtk-misc.c:1425
GtkWidget * spin_button(GCallback handler, double value, double start, double end, double step, int digits, int dim, gpointer data)
create a spin button
Definition gtk-misc.c:1833
#define APPLY
Definition global.h:222
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1893
@ CONTAINER_SCR
Definition global.h:253
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:984
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:835
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
Definition gtk-misc.c:1646
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:308
#define DELETEB
Definition global.h:224
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:215
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2200
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:823
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:961
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2169
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:235
void set_image_from_icon_name(GtkWidget *widg, gchar *icon)
set a image from a stock icon name
Definition gtk-misc.c:1986
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:811
int button_get_status(GtkWidget *button)
get status of check / toggle button
Definition gtk-misc.c:1855
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:182
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void show_warning(char *warning, GtkWidget *win)
show warning
Definition interface.c:260
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
Definition interface.c:356
gchar * exact_name(gchar *name)
short cut to print string without spaces
Definition interface.c:370
Messaging function declarations.
Definition glwin.h:351
int type
Definition global.h:744
GtkWidget * res[2]
Definition w_encode.c:212
GtkWidget * hbox
Definition workspace.c:71
GtkWidget * vbox
Definition workspace.c:72
GtkWidget * lab
Definition workspace.c:73