atomes 1.1.15
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-2024 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#ifdef GTK4
988 j = gtk_check_button_get_active (but);
989#else
990 j = gtk_toggle_button_get_active (but);
991#endif
992 for (i=0; i<qm_proj -> natomes; i++)
993 {
994 m = 0;
995 if (j)
996 {
997 k = l = m = 1;
998 if (was_it_selected(h, i) != 1)
999 {
1000 m = 0;
1001 }
1002 }
1003 else if (old_thermo[i])
1004 {
1005 k = -1;
1006 l = 0;
1007 m = 1;
1008 }
1009 if (m)
1010 {
1011 n_therm += k;
1012 old_thermo[i] = l;
1013 if (l) qm_view -> picked ++;
1014 qm_proj -> atoms[0][i].pick[0] = l;
1015 qm_proj -> atoms[0][i].label[0] = l;
1016 }
1017 }
1018 gtk_tree_store_clear (add_model);
1021}
1022
1032G_MODULE_EXPORT void run_select_atom_from_model (GtkDialog * dialog, gint response_id, gpointer data)
1033{
1034 int i, j;
1035 gboolean done = FALSE;
1036 gchar * str;
1037 switch (response_id)
1038 {
1039 case GTK_RESPONSE_APPLY:
1040 if (n_therm > 1)
1041 {
1042 str = g_strdup_printf ("%d atoms have been selected !", n_therm);
1043 }
1044 else if (n_therm)
1045 {
1046 str = g_strdup_printf ("A single atom has been selected !");
1047 }
1048 else
1049 {
1050 str = g_strdup_printf ("Not at single atom has been selected !");
1051 }
1052 str = g_strdup_printf ("%s\nis this correct ?", str);
1053 selection_confirmed = FALSE;
1054 field_question (str, G_CALLBACK(confirm_selection), NULL);
1055 g_free (str);
1057 {
1058 done = TRUE;
1059 if (fixco)
1060 {
1061 for (i=0; i<qm_proj -> natomes; i++)
1062 {
1063 if (old_thermo[i] && ! old_fixed[i][0] && ! old_fixed[i][1] && ! old_fixed[i][2])
1064 {
1065 str = g_strdup_printf ("Atom %d has been selected but not coordinates are frozen !\n"
1066 "Unselect atom %d or select coordinate(s) to freeze !", i+1, i+1);
1068 done = FALSE;
1069 }
1070 }
1071 }
1072 }
1073 thermostat * thermo;
1074 dummy_atom * dummy;
1075 if (done)
1076 {
1077 if (the_therm < -1)
1078 {
1080 dummy -> natoms = n_therm;
1081 if (dummy -> list != NULL)
1082 {
1083 g_free (dummy -> list);
1084 dummy -> list = NULL;
1085 }
1086 if (n_therm > 0 && n_therm < qm_proj -> natomes)
1087 {
1088 dummy -> list = allocint (n_therm);
1089 j = -1;
1090 for (i=0; i< qm_proj -> natomes; i++)
1091 {
1092 if (old_thermo[i])
1093 {
1094 j ++;
1095 dummy -> list[j] = i;
1096 }
1097 }
1098 }
1099 }
1100 else if (the_therm == -1)
1101 {
1102 if (is_cpmd)
1103 {
1104 if (tmp_cpmd -> fixlist != NULL)
1105 {
1106 g_free (tmp_cpmd -> fixlist);
1107 tmp_cpmd -> fixlist = NULL;
1108 if (tmp_cpmd -> fixcoord != NULL)
1109 {
1110 g_free (tmp_cpmd -> fixcoord);
1111 tmp_cpmd -> fixcoord = NULL;
1112 }
1113 }
1114 if (n_therm > 0)
1115 {
1116 tmp_cpmd -> fixlist = allocint (n_therm);
1117 if (fixco) tmp_cpmd -> fixcoord = allocdint (n_therm, 3);
1118 tmp_cpmd -> fixat = n_therm;
1119 j = -1;
1120 for (i=0; i< qm_proj -> natomes; i++)
1121 {
1122 if (old_thermo[i])
1123 {
1124 j ++;
1125 tmp_cpmd -> fixlist[j] = i;
1126 if (fixco)
1127 {
1128 tmp_cpmd -> fixcoord[j][0] = old_fixed[i][0];
1129 tmp_cpmd -> fixcoord[j][1] = old_fixed[i][1];
1130 tmp_cpmd -> fixcoord[j][2] = old_fixed[i][2];
1131 }
1132 }
1133 }
1134 }
1135 }
1136 else
1137 {
1138 if (tmp_cp2k -> fixlist[0] != NULL)
1139 {
1140 g_free (tmp_cp2k -> fixlist[0]);
1141 tmp_cp2k -> fixlist[0] = NULL;
1142 if (tmp_cp2k -> fixcoord[0] != NULL)
1143 {
1144 g_free (tmp_cp2k -> fixcoord[0]);
1145 tmp_cp2k -> fixcoord[0] = NULL;
1146 }
1147 }
1148 if (n_therm > 0)
1149 {
1150 tmp_cp2k -> fixlist[0] = allocint (n_therm);
1151 tmp_cp2k -> fixcoord[0] = allocdint (n_therm, 3);
1152 tmp_cp2k -> fixat[0] = n_therm;
1153 j = -1;
1154 for (i=0; i< qm_proj -> natomes; i++)
1155 {
1156 if (old_thermo[i])
1157 {
1158 j ++;
1159 tmp_cp2k -> fixlist[0][j] = i;
1160 tmp_cp2k -> fixcoord[0][j][0] = old_fixed[i][0];
1161 tmp_cp2k -> fixcoord[0][j][1] = old_fixed[i][1];
1162 tmp_cp2k -> fixcoord[0][j][2] = old_fixed[i][2];
1163 }
1164 }
1165 }
1166 }
1167 }
1168 else
1169 {
1171 thermo -> natoms = n_therm;
1172 if (thermo -> list != NULL)
1173 {
1174 g_free (thermo -> list);
1175 thermo -> list = NULL;
1176 }
1177 if (n_therm > 0)
1178 {
1179 thermo -> list = allocint (n_therm);
1180 j = -1;
1181 for (i=0; i< qm_proj -> natomes; i++)
1182 {
1183 if (old_thermo[i])
1184 {
1185 j ++;
1186 thermo -> list[j] = i;
1187 }
1188 }
1189 }
1190 }
1191 }
1192 break;
1193 case GTK_RESPONSE_CLOSE:
1194 done = TRUE;
1195 break;
1196 }
1197 if (done) destroy_this_dialog (dialog);
1198}
1199
1208{
1209 int i, j, k, l, m;
1210 the_therm = therm;
1211 GtkTreeViewColumn * ato_col[8];
1212 GtkCellRenderer * ato_cell[8];
1213 gchar * ato_title[2][8] = {{"Species", "Id (*)", "Atom", "Viz.3D & Select", " "},
1214 {"Species", "Id (*)", "Atom", "Viz.3D & Select", "x", "y", "z", " "}};
1215 gchar * ctype[2][8] = {{"text", "text", "text", "active", "text", "active", "active", "active"},
1216 {"text", "text", "text", "active", "active", "active", "active", "text"}};
1217 GType col_type[2][8] = {{G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT},
1218 {G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT}};
1219 gchar * str;
1220 at_col = 4;
1221
1222 fixco = FALSE;
1223 qm_view -> picked = 0;
1224 if (! is_cpmd && the_therm == -1)
1225 {
1226 fixco = TRUE;
1227 }
1228 else if (is_cpmd)
1229 {
1230 if ((int)tmp_cpmd -> default_opts[DEFFI] == 2) fixco = TRUE;
1231 }
1232 if (the_therm < -1)
1233 {
1234 str = g_strdup_printf ("Select atom(s) to construct dummy N°%d", -(the_therm+1));
1235 }
1236 else if (the_therm == -1)
1237 {
1238 str = g_strdup_printf ("Select atom(s) to fix");
1239 if (fixco)
1240 {
1241 g_free (str);
1242 at_col = 7;
1243 str = g_strdup_printf ("Select atom(s) and coordinate(s) to fix");
1244 }
1245 }
1246 else
1247 {
1248 str = g_strdup_printf ("Add atom(s) to thermostat N°%d", the_therm+1);
1249 }
1250 GtkWidget * amol = dialogmodal (str, GTK_WINDOW(qm_assistant));
1251 g_free (str);
1252 gtk_dialog_add_button (GTK_DIALOG(amol), "Apply", GTK_RESPONSE_APPLY);
1253 n_therm = 0;
1254 i = (fixco) ? 1 : 0;
1255 j = (fixco) ? 8 : 5;
1256 add_model = gtk_tree_store_newv (j, col_type[i]);
1257 GtkWidget * add_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(add_model));
1258 for (k=0; k<j-1; k++)
1259 {
1260 if (k < 3)
1261 {
1262 ato_cell[k] = gtk_cell_renderer_text_new ();
1263 }
1264 else
1265 {
1266 ato_cell[k] = gtk_cell_renderer_toggle_new ();
1267 if (k==3)
1268 {
1269 g_signal_connect (G_OBJECT(ato_cell[k]), "toggled", G_CALLBACK(cpmd_select_atom_id), & add_model);
1270 }
1271 else
1272 {
1273 g_signal_connect (G_OBJECT(ato_cell[k]), "toggled", G_CALLBACK(cp2k_select_coord_id), GINT_TO_POINTER(k));
1274 }
1275 }
1276 ato_col[k] = gtk_tree_view_column_new_with_attributes (ato_title[i][k], ato_cell[k], ctype[i][k], k, NULL);
1277 gtk_tree_view_append_column (GTK_TREE_VIEW(add_tree), ato_col[k]);
1278 gtk_tree_view_column_set_alignment (ato_col[k], 0.5);
1279 gtk_tree_view_column_set_cell_data_func (ato_col[k], ato_cell[k], atom_set_visible, GINT_TO_POINTER(k), NULL);
1280 }
1281 old_thermo = allocint (qm_proj -> natomes);
1282 if (fixco)
1283 {
1284 old_fixed = allocdint (qm_proj -> natomes, 3);
1285 }
1286 k = l = 0;
1287 for (i=0; i < qm_proj -> nspec; i++)
1288 {
1289 for (j=0; j < qm_proj -> natomes; j++)
1290 {
1291 if (qm_proj -> atoms[0][j].sp == i)
1292 {
1293 k ++;
1294 m = was_it_selected (the_therm, j);
1295 if (m)
1296 {
1297 l ++;
1298 n_therm += (m > 1) ? 1 : 0;
1299 old_thermo[j] = (m > 1) ? 1 : 0;
1300 qm_proj -> atoms[0][j].pick[0] = old_thermo[j];
1301 qm_view -> picked += old_thermo[j];
1302 if (fixco && m > 1)
1303 {
1304 if (is_cpmd)
1305 {
1306 old_fixed[j][0] = tmp_cpmd -> fixcoord[m-2][0];
1307 old_fixed[j][1] = tmp_cpmd -> fixcoord[m-2][1];
1308 old_fixed[j][2] = tmp_cpmd -> fixcoord[m-2][2];
1309 }
1310 else
1311 {
1312 old_fixed[j][0] = tmp_cp2k -> fixcoord[0][m-2][0];
1313 old_fixed[j][1] = tmp_cp2k -> fixcoord[0][m-2][1];
1314 old_fixed[j][2] = tmp_cp2k -> fixcoord[0][m-2][2];
1315 }
1316 }
1317 }
1318 }
1319 }
1320 }
1323 num_cpmd_objects = l;
1324 g_object_unref (add_model);
1325 i = ((qm_proj -> nspec + l)*37 < 500) ? (qm_proj -> nspec + l)*37 : 500;
1326 //GtkWidget * scrollsets = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN, 0);
1327 GtkWidget * scrollsets = create_scroll (dialog_get_content_area (amol), 320, i, GTK_SHADOW_ETCHED_IN);
1329 str = g_strdup_printf (" <b>(*)</b> Order of appearance in the input file");
1330 GtkWidget * vbox = dialog_get_content_area (amol);
1331 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
1332 g_free (str);
1333 if (the_therm != -1)
1334 {
1335 if (get_num_thermo() > 1 || the_therm < -1)
1336 {
1337 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);
1338 GtkWidget * hbox = create_hbox (0);
1339 gchar * lab[2] = {"All non-thermostated atom(s)", "All atom(s)"};
1340 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox,
1341 check_button (lab[(the_therm > -1) ? 0 : 1], -1, -1,
1342 FALSE, G_CALLBACK(select_atoms_not_thermostated), GINT_TO_POINTER(the_therm)),
1343 FALSE, FALSE, 50);
1344 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
1345 }
1346 }
1349 if (the_therm > -1) set_going_forward ();
1350 g_free (old_thermo);
1351 fixco = FALSE;
1352}
1353
1362G_MODULE_EXPORT void atom_selection_button (GtkButton * but, gpointer data)
1363{
1364 int num, id;
1365 int i = GPOINTER_TO_INT(data);
1367 if (i < -1)
1368 {
1369 id = 2;
1370 num = get_active_dummy (-(i+2)) -> natoms;
1371 }
1372 else if (i == -1)
1373 {
1374 id = 1;
1375 num = (is_cpmd) ? tmp_cpmd -> fixat : tmp_cp2k -> fixat[0];
1376 }
1377 else
1378 {
1379 id = 0;
1380 thermostat * thermo = get_active_thermostat (i);
1381 num = thermo -> natoms;
1382 }
1383 gchar * stra, * strb;
1384 if (num == 0)
1385 {
1386 stra = g_strdup_printf ("Not picked yet !");
1387 strb = g_strdup_printf (DELETEB);
1388 }
1389 else
1390 {
1391 stra = g_strdup_printf ("%d atom(s)", num);
1392 strb = g_strdup_printf (APPLY);
1393 }
1395 gtk_button_set_label (but, stra);
1396 g_free (stra);
1397 g_free (strb);
1398 if (is_cpmd)
1399 {
1400 // CPMD
1401 if (i < -1)
1402 {
1403 print_the_section (8, 0, qmbuffer[8]);
1404 }
1405 else if (i == -1)
1406 {
1407 print_the_section (8, 0, qmbuffer[8]);
1408 }
1409 else
1410 {
1411 for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1412 }
1413 }
1414 else
1415 {
1416 // CP2K
1417 }
1418}
1419
1430void create_selection_button (GtkWidget * box, int num, int id, gpointer data)
1431{
1432 int i = GPOINTER_TO_INT(data);
1433 GtkWidget * hbox = cpmd_box (box, "Atom(s) selection: ", 5, 20, (i < -1) ? 120 : 220);
1434 gchar * str;
1435 if (num == 0)
1436 {
1437 str = g_strdup_printf ("Not picked yet !");
1438 sel_img[id] = stock_image (DELETEB);
1439 }
1440 else
1441 {
1442 str = g_strdup_printf ("%d atom(s)", (int)num);
1443 sel_img[id] = stock_image (APPLY);
1444 }
1445 sel_but[id] = gtk_button_new_with_label (str);
1446 gtk_widget_set_size_request (sel_but[id], 150, -1);
1447 g_free (str);
1448 g_signal_connect (G_OBJECT(sel_but[id]), "clicked", G_CALLBACK(atom_selection_button), data);
1449 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sel_but[id], FALSE, FALSE, 0);
1450 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sel_img[id], FALSE, FALSE, 30);
1451}
1452
1461{
1462 gchar * str;
1464 str = g_strdup_printf ("Configuration for thermostat N°<b>%d</b>: ", therm_id+1);
1466 cpmd_box (nose_id_box[1], str, 5, 5, 220);
1467 g_free (str);
1468 thermostat * thermo = get_active_thermostat (therm_id);
1469 create_selection_button (nose_id_box[1], thermo -> natoms, 0, GINT_TO_POINTER(therm_id));
1470 nose_parameters (nose_id_box[1], therm_id,
1471 v_thermo[!is_cpmd][thermo->type],
1472 c_thermo[!is_cpmd][thermo->type],
1473 u_thermo[!is_cpmd][thermo->type]);
1474 add_box_child_start (GTK_ORIENTATION_VERTICAL, nose_id_box[0], nose_id_box[1], FALSE, FALSE, 0);
1476}
1477
1486G_MODULE_EXPORT void changed_nose_thermo_id_box (GtkComboBox * box, gpointer data)
1487{
1488 int i;
1489 i = gtk_combo_box_get_active (box);
1491}
1492
1503void create_selection_combo (int id, int num, int type, GCallback handler)
1504{
1505 int i, j;
1506 gchar * str;
1507 gchar * lab[2]={"Thermostat", "Dummy atom"};
1509 combo_id_box[id] = create_combo ();
1510 for (i=0; i<num; i++)
1511 {
1512 str = g_strdup_printf ("%s N°%d", lab[id], i+1);
1514 g_free (str);
1515 }
1516 j = type;
1517 if (num > 0)
1518 {
1519 gtk_combo_box_set_active (GTK_COMBO_BOX(combo_id_box[id]), 0);
1520 if (id == 0)
1521 {
1523 }
1524 else
1525 {
1527 }
1528 }
1529 else
1530 {
1531 gtk_combo_box_set_active (GTK_COMBO_BOX(combo_id_box[id]), -1);
1533 }
1534 g_signal_connect (G_OBJECT (combo_id_box[id]), "changed", handler, GINT_TO_POINTER(j));
1535 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, combo_id[id], combo_id_box[id], FALSE, FALSE, 0);
1537}
1538
1547{
1548 int i, j;
1549 thermostat * thermo = get_thermo ();
1550 j = get_num_thermo ();
1551 while (thermo -> next != NULL) thermo = thermo -> next;
1552 for (i=0; i<extra; i++)
1553 {
1554 thermo -> next = init_thermo (i+j, thermo -> type, thermo -> sys);
1555 thermo -> next -> prev = thermo;
1556 if (i < extra-1) thermo = thermo -> next;
1557 }
1558
1559 if (is_cpmd)
1560 {
1561 tmp_cpmd -> thermostats += extra;
1562 }
1563 else
1564 {
1565 tmp_cp2k -> thermostats += extra;
1566 }
1567 // finally update the combobox
1569}
1570
1579G_MODULE_EXPORT void add_or_remove_thermostat (GtkSpinButton * res, gpointer data)
1580{
1581 int id = gtk_spin_button_get_value_as_int(res);
1582 int i, j, k;
1583 gchar * str;
1584 gboolean add_thermo = TRUE;
1585 thermostat * thermo = get_thermo();
1586 if (id != get_num_thermo ())
1587 {
1588 if (id > get_num_thermo ())
1589 {
1590 // adding thermostats
1591 // ok if: 1) all atoms do not already have a thermostat assigned
1592 // 2) number of thermostat(s) to create < number of atoms that do have a thermostat assigned
1593 j = 0;
1594 for (i=0; i<get_num_thermo (); i++)
1595 {
1596 j += thermo -> natoms;
1597 if (thermo -> next != NULL) thermo = thermo -> next;
1598 }
1599 if (j < qm_proj -> natomes)
1600 {
1601 // Number of thermostat to create
1602 k = id - get_num_thermo ();
1603 if (k < (qm_proj -> natomes - j))
1604 {
1605 if (k > 1)
1606 {
1607 str = g_strdup_printf ("Do you really want to add %d thermostat(s) ?", k);
1608 add_thermo = ask_yes_no ("Adding thermostat(s) ?", str, GTK_MESSAGE_QUESTION, qm_assistant);
1609 g_free (str);
1610 }
1611 if (add_thermo)
1612 {
1613 add_thermostat (k);
1614 }
1615 else
1616 {
1617 // Set value back to the number of ionic thermostats
1618 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1619 }
1620 }
1621 else
1622 {
1623 show_warning ("It is not possible to create so many thermostats", qm_assistant);
1624 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1625 }
1626 }
1627 else
1628 {
1629 show_warning ("All atoms arleady have a thermostat assigned", qm_assistant);
1630 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1631 }
1632 }
1633 else
1634 {
1635 // removing thermostats
1637 }
1638 }
1639 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)(get_num_thermo ()));
1640 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1641}
1642
1651G_MODULE_EXPORT void update_thermo_parameter (GtkEntry * res, gpointer data)
1652{
1653 int i, j;
1654 i = GPOINTER_TO_INT(data);
1655 const gchar * m = entry_get_text (res);
1656 double v = string_to_double ((gpointer)m);
1657 if (i < 0)
1658 {
1659 if (tmp_cpmd -> elec_thermostat -> params[i+2] != v)
1660 {
1661 tmp_cpmd -> elec_thermostat -> params[i+2] = v;
1663 }
1664 }
1665 else
1666 {
1667 if (get_num_thermo () > 1)
1668 {
1669 j = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_id_box[0]));
1670 }
1671 else
1672 {
1673 j = 0;
1674 }
1675 thermostat * thermo = get_active_thermostat (j);
1676 if (i < 2)
1677 {
1678 if (thermo -> params[i] != v)
1679 {
1680 thermo -> params[i] = v;
1682 }
1683 }
1684 else
1685 {
1686 if ((int)thermo -> params[i] != (int)v)
1687 {
1688 thermo -> params[i] = v;
1689 update_entry_int (res, (int)v);
1690 }
1691 }
1692 }
1693 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1694}
1695
1703GtkWidget * create_nose_box (int n)
1704{
1705 GtkWidget * vbox = create_vbox (BSEP);
1706 GtkWidget * hbox;
1707 GtkWidget * widg;
1708 if (n > GLOBAL)
1709 {
1710 hbox = cpmd_box (vbox, "Number of thermostat(s): ", 5, 5, 220);
1711 widg = spin_button (G_CALLBACK(add_or_remove_thermostat),
1712 (double)(get_num_thermo ()), 1.0, (double)qm_proj -> natomes, 1.0, 0, 100, NULL);
1713 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, widg, FALSE, FALSE, 0);
1714 combo_id[0] = cpmd_box (vbox, "Thermostat to configure: ", 5, 5, 220);
1716 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, nose_id_box[0], FALSE, FALSE, 10);
1719 }
1720 else
1721 {
1723 v_thermo[!is_cpmd][get_thermo()->type],
1724 c_thermo[!is_cpmd][get_thermo()->type],
1725 u_thermo[!is_cpmd][get_thermo()->type]);
1726 }
1727 return vbox;
1728}
1729
1738G_MODULE_EXPORT void changed_thermo_box_nose (GtkComboBox * box, gpointer data)
1739{
1740 int i;
1741 i = gtk_combo_box_get_active (box);
1742 if (i != get_thermo () -> sys)
1743 {
1744 clean_thermostat (get_thermo () -> type);
1746 get_thermo () -> sys = i;
1747 nose_box = create_nose_box (get_thermo () -> sys);
1748 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
1749 int j;
1750 if (is_cpmd) for (j=1; j<4; j++) print_the_section (j, 0, qmbuffer[j]);
1752 }
1754}
1755
1762{
1763 int i, j, k;
1764 GtkWidget * hbox;
1765 GtkWidget * tbox;
1766 gchar * str;
1770 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_ions, therm_param_ions, FALSE, FALSE, 0);
1771 i = (is_cpmd) ? 1 : 0;
1772 //if (is_cpmd)
1773 {
1774 if (get_thermo () -> type > i)
1775 {
1776 hbox = cpmd_box (therm_param_ions, "Thermostat type: ", 5, 5, 220);
1777 tbox = create_combo ();
1778 j = 2; // For QM-MM: qm_view -> bonding + 2;
1779 for (k=0; k<j; k++)
1780 {
1781 str = g_strdup_printf ("%s", nosetype[k]);
1782 combo_text_append (tbox, str);
1783 g_free (str);
1784 }
1785 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tbox, FALSE, FALSE, 0);
1786 gtk_combo_box_set_active (GTK_COMBO_BOX (tbox), get_thermo () -> sys);
1787 g_signal_connect (G_OBJECT (tbox), "changed", G_CALLBACK(changed_thermo_box_nose), NULL);
1788 }
1789 }
1790 nose_box = create_nose_box (get_thermo () -> sys);
1791 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
1793 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1794}
1795
1802{
1805 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_elec, therm_param_elec, FALSE, FALSE, 0);
1806 int i;
1808 v_thermo[0][tmp_cpmd -> elec_thermostat -> type],
1809 c_thermo[0][tmp_cpmd -> elec_thermostat -> type],
1810 ue_thermo[tmp_cpmd -> elec_thermostat -> type]);
1812 for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1813}
1814
1823G_MODULE_EXPORT void changed_thermo_box (GtkComboBox * box, gpointer data)
1824{
1825 int i, j;
1826 i = gtk_combo_box_get_active (box);
1827 j = GPOINTER_TO_INT (data);
1828 if (j == 0 && i != get_thermo () -> type)
1829 {
1830 clean_thermostat (i);
1831 thermostat * thermo = get_thermo();
1832 thermo -> sys = GLOBAL;
1834 }
1835 else if (j == -1)
1836 {
1837 if (i != tmp_cpmd -> elec_thermostat -> type)
1838 {
1839 g_free (tmp_cpmd -> elec_thermostat);
1840 tmp_cpmd -> elec_thermostat = init_thermo (-1, i, 0);
1841 tmp_cpmd -> elec_thermostat -> sys = 0;
1843 }
1844 }
1846}
1847
1857void thermo_type_box (GtkWidget * vbox, gchar * str, int id)
1858{
1859 int i;
1860 GtkWidget * hbox = create_hbox (0);
1861 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 5);
1862 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 5);
1863 GtkWidget * tbox = create_combo ();
1864 for (i=0; i<num_thermo[!is_cpmd]; i++)
1865 {
1866 str = g_strdup_printf ("%s", thermo_name[!is_cpmd][i]);
1867 combo_text_append (tbox, str);
1868 g_free (str);
1869 }
1870 if (id == -1)
1871 {
1872 gtk_combo_box_set_active (GTK_COMBO_BOX(tbox), tmp_cpmd -> elec_thermostat -> type);
1873 }
1874 else
1875 {
1876 thermostat * thermo = get_thermo();
1877 gtk_combo_box_set_active (GTK_COMBO_BOX(tbox), thermo -> type);
1878 }
1879 g_signal_connect (G_OBJECT (tbox), "changed", G_CALLBACK(changed_thermo_box), GINT_TO_POINTER(id));
1880 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tbox, FALSE, FALSE, 0);
1881}
1882
1888GtkWidget * thermo_box ()
1889{
1890 gchar * thermo_info[2] = {"<u>Ionic subsystem thermostat:</u> ", "Thermostat: "};
1891 GtkWidget * vbox = create_vbox (BSEP);
1892 GtkWidget * vvbox;
1893 nose_id_box[0] = nose_id_box[1] = NULL;
1894 therm_param_ions = NULL;
1895 therm_param_elec = NULL;
1896 nose_box = NULL;
1897 combo_id_box[0] = NULL;
1898 combo_id[0] = NULL;
1899 if (get_num_thermo() == 0) init_thermostats (0, 1);
1900 // Thermostat type ions
1901 vvbox = create_vbox (BSEP);
1902 gtk_widget_set_size_request (vvbox, (is_cpmd) ? 525 : -1, (is_cpmd) ? 350 : 260);
1903 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, vvbox, FALSE, FALSE, 0);
1904 thermo_type_box (vvbox, thermo_info[!is_cpmd], 0);
1906 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox, therm_ions, FALSE, FALSE, (is_cpmd) ? 0 : 20);
1908 // Thermostat type electrons
1909 if (is_cpmd)
1910 {
1912 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, electron_box, FALSE, FALSE, 5);
1913 thermo_type_box (electron_box, "<u>Fictitious electronic subsystem:</u> ", -1);
1915 add_box_child_start (GTK_ORIENTATION_VERTICAL, electron_box, therm_elec, FALSE, FALSE, 0);
1917 }
1918 return vbox;
1919}
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:1486
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:1460
G_MODULE_EXPORT void update_thermo_parameter(GtkEntry *res, gpointer data)
update thermostat parameter value entry callback
Definition cpmd_nose.c:1651
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:1430
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:1032
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:1703
void create_selection_combo(int id, int num, int type, GCallback handler)
create thermostat selection combo box
Definition cpmd_nose.c:1503
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:1857
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:1801
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:1761
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:1579
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:1546
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:1738
G_MODULE_EXPORT void atom_selection_button(GtkButton *but, gpointer data)
select atom(s) to be thermostated
Definition cpmd_nose.c:1362
G_MODULE_EXPORT void changed_thermo_box(GtkComboBox *box, gpointer data)
change the thermostat family (ionic / fictitious electronic)
Definition cpmd_nose.c:1823
void proj_unselect_all_atoms()
unselect all atom(s) in the target project of the assistant
Definition cpmd_init.c:1033
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:1207
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:1888
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:918
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:492
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1314
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:633
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
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:597
#define BSEP
Definition global.h:245
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:614
GtkWidget * stock_image(const gchar *stock_id)
create a GtkImage for the Gtk database
Definition gtk-misc.c:1364
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:1772
#define APPLY
Definition global.h:220
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1799
@ CONTAINER_SCR
Definition global.h:251
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:923
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
#define DELETEB
Definition global.h:222
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:206
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2065
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:813
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:900
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2034
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:226
void set_image_from_icon_name(GtkWidget *widg, gchar *icon)
set a image from a stock icon name
Definition gtk-misc.c:1894
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:801
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:173
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.
int type
Definition global.h:739
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