atomes 1.3.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-2026 by CNRS and University of Strasbourg */
15
21
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
98gchar * c_thermo[2][CP2NTHERM][4] = {{{i18n("Initial temperature: "), " ", " ", " "},
99 {i18n("Target temperature: "),i18n("Tolerance: "), " ", " "},
100 {i18n("Target temperature: "), i18n("Target frequency: "), " ", " "},
101 {" ", " ", " ", " "},
102 {" ", " ", " ", " "}},
103 {{" ", " ", " ", " "},
104 {i18n("Time constant (Langevin): "), i18n("Time constant (Nosë-Hoover): "), i18n("Mass: "), "Chi: "},
105 {i18n("Time constant: "), " ", " ", " "},
106 {" ", " ", " ", " "},
107 {i18n("Length: "), i18n("Multiple time steps: "), i18n("Time constant: "), i18n("Yoshida integrator: ")}}};
108
109gchar * 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
120gchar * 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] = {i18n("Id."), i18n("Target T°"), i18n("Frequency"), i18n("Atom(s)"), " ", i18n("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 ((i != 4) ? _(mol_title[i]) : 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 gchar * str;
627 GtkWidget * hbox;
628 GtkWidget * widg;
629 int i, j;
630 i = (id < 0) ? id : 0;
631 for (j=0; j<jd; j++)
632 {
633 if (! is_cpmd)
634 {
635 str = g_strdup_printf ("%s", (j < 3 || thermo -> type == 4) ? _(la[j]) : la[j]);
636 }
637 else
638 {
639 str = g_strdup_printf ("%s", _(la[j]));
640 }
641 hbox = cpmd_box (vbox, str, 5, (is_cpmd) ? 20 : 50, 220);
642 g_free (str);
643 widg = create_entry (G_CALLBACK(update_thermo_parameter), 100, 15, FALSE, GINT_TO_POINTER(i+j));
644 update_entry_double (GTK_ENTRY(widg), thermo -> params[j]);
645 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, widg, FALSE, FALSE, 0);
646 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(lb[j], -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
647 }
648}
649
660G_MODULE_EXPORT void cpmd_select_atom_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
661{
662 GtkTreeStore ** model = (GtkTreeStore **)data;
663 GtkTreeIter iter;
664 int i, j;
665 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
666 gtk_tree_model_get_iter (GTK_TREE_MODEL(* model), & iter, path);
667
668 gtk_tree_model_get (GTK_TREE_MODEL(* model), & iter, at_col, & i, -1);
669 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
670 {
671 j = 0;
672 n_therm --;
673 old_thermo[i-1] = 0;
674 qm_view -> picked --;
675 }
676 else
677 {
678 j = 1;
679 n_therm ++;
680 old_thermo[i-1] = 1;
681 qm_view -> picked ++;
682 }
683 qm_proj -> atoms[0][i-1].pick[0] = j;
684 qm_proj -> atoms[0][i-1].label[0] = j;
686 gtk_tree_store_set (* model, & iter, 3, j, -1);
687}
688
699G_MODULE_EXPORT void cp2k_select_coord_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
700{
701 int i, j;
702 j = GPOINTER_TO_INT(data);
703 GtkTreeIter iter;
704 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
705 gtk_tree_model_get_iter (GTK_TREE_MODEL(add_model), & iter, path);
706 gtk_tree_model_get (GTK_TREE_MODEL(add_model), & iter, at_col, & i, -1);
707 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
708 {
709 old_fixed[i-1][j-4] = 0;
710 }
711 else
712 {
713 old_fixed[i-1][j-4] = 1;
714 }
715 gtk_tree_store_set (add_model, & iter, (fixco) ? j : j-2, old_fixed[i-1][j-4], -1);
716}
717
729void atom_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
730{
731 int i, j, k;
732 gtk_tree_model_get (mod, iter, 1, & i, -1);
733 gtk_tree_model_get (mod, iter, 3, & j, -1);
734 set_renderer_color (j, renderer, init_color (i-1, num_cpmd_objects));
735 k = GPOINTER_TO_INT(data);
736 if (k == 2)
737 {
738 set_renderer_markup (mod, iter, renderer, 2);
739 }
740}
741
753void atom_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
754{
755 int i, j, k;
756 i = GPOINTER_TO_INT(data);
757 gtk_tree_model_get (mod, iter, at_col, & j, -1);
758 if (j == 0 && i != 0)
759 {
760 gtk_cell_renderer_set_visible (renderer, FALSE);
761 }
762 else if (j == 0)
763 {
764 gtk_cell_renderer_set_visible (renderer, TRUE);
765 }
766 else if (j > 0 && i == 0)
767 {
768 gtk_cell_renderer_set_visible (renderer, FALSE);
769 }
770 else if (j > 0)
771 {
772 if (i < 4)
773 {
774 gtk_cell_renderer_set_visible (renderer, TRUE);
775 }
776 else
777 {
778 gtk_tree_model_get (mod, iter, 3, & k, -1);
779 gtk_cell_renderer_set_visible (renderer, k);
780 }
781 if (i < 3) atom_set_color (col, renderer, mod, iter, data);
782 }
783}
784
793int is_not_thermostated (int at, int therm)
794{
795 int i, j;
796 thermostat * thermo = get_thermo ();
797 for (i=0; i<get_num_thermo(); i++)
798 {
799 for (j=0; j<thermo -> natoms; j++)
800 {
801 if (thermo -> list[j] == at)
802 {
803 if (i == therm)
804 {
805 return 2;
806 }
807 else
808 {
809 return 0;
810 }
811 }
812 }
813 if (thermo -> next != NULL) thermo = thermo -> next;
814 }
815 return 1;
816}
817
825int is_fixed_atom (int at)
826{
827 int i;
828 if (is_cpmd)
829 {
830 for (i=0; i<tmp_cpmd -> fixat; i++)
831 {
832 if (tmp_cpmd -> fixlist[i] == at)
833 {
834 return i+2;
835 }
836 }
837 }
838 else
839 {
840 for (i=0; i<tmp_cp2k -> fixat[0]; i++)
841 {
842 if (tmp_cp2k -> fixlist[0][i] == at)
843 {
844 return i+2;
845 }
846 }
847 }
848 return 1;
849}
850
859int in_dummy (int at, int id)
860{
861 dummy_atom * dummy = get_active_dummy (-(id+2));
862 int i;
863 if (dummy -> natoms == qm_proj -> natomes) return 2;
864 for (i=0; i<dummy -> natoms; i++)
865 {
866 if (dummy -> list[i] == at) return 2;
867 }
868 return 1;
869}
870
879gboolean was_it_selected (int id, int at)
880{
881 if (id < -1)
882 {
883 return in_dummy (at, id);
884 }
885 else if (id == -1)
886 {
887 return is_fixed_atom (at);
888 }
889 else
890 {
891 return is_not_thermostated (at, id);
892 }
893}
894
903{
904 int i, j, k, l, m;
905 gchar * str;
906 GtkTreeIter spec_level;
907 GtkTreeIter atom_level;
908 k = 0;
909 for (i=0; i< qm_proj -> nspec; i++)
910 {
911 gtk_tree_store_append (add_model, & spec_level, NULL);
912 gtk_tree_store_set (add_model, & spec_level, 0, qm_proj -> chemistry -> label[i], 1, 0, 3, 0, 4, 0, -1);
913 for (j=0; j< qm_proj -> natomes; j++)
914 {
915 if (qm_proj -> atoms[0][j].sp == i)
916 {
917 k ++;
918 l = was_it_selected (therm, j);
919 if (fixco)
920 {
921 if (is_cpmd)
922 {
923 if (tmp_cpmd -> fixat > 0)
924 {
925 for (m=0; m<tmp_cpmd -> fixat; m++)
926 {
927 if (qm_proj -> atoms[0][j].coord[2] == tmp_cpmd-> fixlist[m])
928 {
929 l = 0;
930 break;
931 }
932 }
933 }
934 }
935 else
936 {
937 if (tmp_cp2k -> fixat[1] > 0)
938 {
939 for (m=0; m<tmp_cp2k -> fixat[1]; m++)
940 {
941 if (qm_proj -> atoms[0][j].coord[2] == tmp_cp2k -> fixlist[1][m])
942 {
943 l = 0;
944 break;
945 }
946 }
947 }
948 }
949 }
950 if (l)
951 {
952 gtk_tree_store_append (add_model, & atom_level, & spec_level);
953 str = g_strdup_printf ("%s<sub>%d</sub>", exact_name(qm_proj -> chemistry -> label[i]), j+1);
954 if (fixco)
955 {
956 gtk_tree_store_set (add_model, & atom_level, 0, 0, 1, k, 2, str, 3, old_thermo[j],
957 4, old_fixed[j][0], 5, old_fixed[j][1], 6, old_fixed[j][2], at_col, j+1, -1);
958 }
959 else
960 {
961 gtk_tree_store_set (add_model, & atom_level, 0, 0, 1, k, 2, str, 3, old_thermo[j], at_col, j+1, -1);
962 }
963 g_free (str);
964 }
965 }
966 }
967 }
968}
969
970#ifdef GTK4
979G_MODULE_EXPORT void select_atoms_not_thermostated (GtkCheckButton * but, gpointer data)
980#else
989G_MODULE_EXPORT void select_atoms_not_thermostated (GtkToggleButton * but, gpointer data)
990#endif
991{
992 int h, i, j, k, l, m;
993 h = GPOINTER_TO_INT (data);
994 j = button_get_status ((GtkWidget *)but);
995 for (i=0; i<qm_proj -> natomes; i++)
996 {
997 m = 0;
998 if (j)
999 {
1000 k = l = m = 1;
1001 if (was_it_selected(h, i) != 1)
1002 {
1003 m = 0;
1004 }
1005 }
1006 else if (old_thermo[i])
1007 {
1008 k = -1;
1009 l = 0;
1010 m = 1;
1011 }
1012 if (m)
1013 {
1014 n_therm += k;
1015 old_thermo[i] = l;
1016 if (l) qm_view -> picked ++;
1017 qm_proj -> atoms[0][i].pick[0] = l;
1018 qm_proj -> atoms[0][i].label[0] = l;
1019 }
1020 }
1021 gtk_tree_store_clear (add_model);
1024}
1025
1035G_MODULE_EXPORT void run_select_atom_from_model (GtkDialog * dialog, gint response_id, gpointer data)
1036{
1037 int i, j;
1038 gboolean done = FALSE;
1039 gchar * str;
1040 switch (response_id)
1041 {
1042 case GTK_RESPONSE_APPLY:
1043 if (n_therm > 1)
1044 {
1045 str = g_strdup_printf (_("%d atoms have been selected !"), n_therm);
1046 }
1047 else if (n_therm)
1048 {
1049 str = g_strdup_printf (_("A single atom has been selected !"));
1050 }
1051 else
1052 {
1053 str = g_strdup_printf (_("Not at single atom has been selected !"));
1054 }
1055 str = g_strdup_printf (_("%s\nis this correct ?"), str);
1056 selection_confirmed = FALSE;
1057 field_question (str, G_CALLBACK(confirm_selection), NULL);
1058 g_free (str);
1060 {
1061 done = TRUE;
1062 if (fixco)
1063 {
1064 for (i=0; i<qm_proj -> natomes; i++)
1065 {
1066 if (old_thermo[i] && ! old_fixed[i][0] && ! old_fixed[i][1] && ! old_fixed[i][2])
1067 {
1068 str = g_strdup_printf (_("Atom %d has been selected but not coordinates are frozen !\n"
1069 "Unselect atom %d or select coordinate(s) to freeze !"), i+1, i+1);
1071 done = FALSE;
1072 }
1073 }
1074 }
1075 }
1076 thermostat * thermo;
1077 dummy_atom * dummy;
1078 if (done)
1079 {
1080 if (the_therm < -1)
1081 {
1083 dummy -> natoms = n_therm;
1084 if (dummy -> list != NULL)
1085 {
1086 g_free (dummy -> list);
1087 dummy -> list = NULL;
1088 }
1089 if (n_therm > 0 && n_therm < qm_proj -> natomes)
1090 {
1091 dummy -> list = allocint (n_therm);
1092 j = -1;
1093 for (i=0; i< qm_proj -> natomes; i++)
1094 {
1095 if (old_thermo[i])
1096 {
1097 j ++;
1098 dummy -> list[j] = i;
1099 }
1100 }
1101 }
1102 }
1103 else if (the_therm == -1)
1104 {
1105 if (is_cpmd)
1106 {
1107 if (tmp_cpmd -> fixlist != NULL)
1108 {
1109 g_free (tmp_cpmd -> fixlist);
1110 tmp_cpmd -> fixlist = NULL;
1111 if (tmp_cpmd -> fixcoord != NULL)
1112 {
1113 g_free (tmp_cpmd -> fixcoord);
1114 tmp_cpmd -> fixcoord = NULL;
1115 }
1116 }
1117 if (n_therm > 0)
1118 {
1119 tmp_cpmd -> fixlist = allocint (n_therm);
1120 if (fixco) tmp_cpmd -> fixcoord = allocdint (n_therm, 3);
1121 tmp_cpmd -> fixat = n_therm;
1122 j = -1;
1123 for (i=0; i< qm_proj -> natomes; i++)
1124 {
1125 if (old_thermo[i])
1126 {
1127 j ++;
1128 tmp_cpmd -> fixlist[j] = i;
1129 if (fixco)
1130 {
1131 tmp_cpmd -> fixcoord[j][0] = old_fixed[i][0];
1132 tmp_cpmd -> fixcoord[j][1] = old_fixed[i][1];
1133 tmp_cpmd -> fixcoord[j][2] = old_fixed[i][2];
1134 }
1135 }
1136 }
1137 }
1138 }
1139 else
1140 {
1141 if (tmp_cp2k -> fixlist[0] != NULL)
1142 {
1143 g_free (tmp_cp2k -> fixlist[0]);
1144 tmp_cp2k -> fixlist[0] = NULL;
1145 if (tmp_cp2k -> fixcoord[0] != NULL)
1146 {
1147 g_free (tmp_cp2k -> fixcoord[0]);
1148 tmp_cp2k -> fixcoord[0] = NULL;
1149 }
1150 }
1151 if (n_therm > 0)
1152 {
1153 tmp_cp2k -> fixlist[0] = allocint (n_therm);
1154 tmp_cp2k -> fixcoord[0] = allocdint (n_therm, 3);
1155 tmp_cp2k -> fixat[0] = n_therm;
1156 j = -1;
1157 for (i=0; i< qm_proj -> natomes; i++)
1158 {
1159 if (old_thermo[i])
1160 {
1161 j ++;
1162 tmp_cp2k -> fixlist[0][j] = i;
1163 tmp_cp2k -> fixcoord[0][j][0] = old_fixed[i][0];
1164 tmp_cp2k -> fixcoord[0][j][1] = old_fixed[i][1];
1165 tmp_cp2k -> fixcoord[0][j][2] = old_fixed[i][2];
1166 }
1167 }
1168 }
1169 }
1170 }
1171 else
1172 {
1174 thermo -> natoms = n_therm;
1175 if (thermo -> list != NULL)
1176 {
1177 g_free (thermo -> list);
1178 thermo -> list = NULL;
1179 }
1180 if (n_therm > 0)
1181 {
1182 thermo -> list = allocint (n_therm);
1183 j = -1;
1184 for (i=0; i< qm_proj -> natomes; i++)
1185 {
1186 if (old_thermo[i])
1187 {
1188 j ++;
1189 thermo -> list[j] = i;
1190 }
1191 }
1192 }
1193 }
1194 }
1195 break;
1196 case GTK_RESPONSE_CLOSE:
1197 done = TRUE;
1198 break;
1199 }
1200 if (done) destroy_this_dialog (dialog);
1201}
1202
1211{
1212 int i, j, k, l, m;
1213 the_therm = therm;
1214 GtkTreeViewColumn * ato_col[8];
1215 GtkCellRenderer * ato_cell[8];
1216 gchar * ato_title[2][8] = {{i18n("Species"), i18n("Id. (*)"), i18n("Atom"), i18n("Viz.3D & Select"), " "},
1217 {i18n("Species"), i18n("Id. (*)"), i18n("Atom"), i18n("Viz.3D & Select"), "x", "y", "z", " "}};
1218 gchar * ctype[2][8] = {{"text", "text", "text", "active", "text", "active", "active", "active"},
1219 {"text", "text", "text", "active", "active", "active", "active", "text"}};
1220 GType col_type[2][8] = {{G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT},
1221 {G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT}};
1222 gchar * str;
1223 at_col = 4;
1224
1225 fixco = FALSE;
1226 qm_view -> picked = 0;
1227 if (! is_cpmd && the_therm == -1)
1228 {
1229 fixco = TRUE;
1230 }
1231 else if (is_cpmd)
1232 {
1233 if ((int)tmp_cpmd -> default_opts[DEFFI] == 2) fixco = TRUE;
1234 }
1235 if (the_therm < -1)
1236 {
1237 str = g_strdup_printf (_("Select atom(s) to construct dummy N°%d"), -(the_therm+1));
1238 }
1239 else if (the_therm == -1)
1240 {
1241 str = g_strdup_printf (_("Select atom(s) to fix"));
1242 if (fixco)
1243 {
1244 g_free (str);
1245 at_col = 7;
1246 str = g_strdup_printf (_("Select atom(s) and coordinate(s) to fix"));
1247 }
1248 }
1249 else
1250 {
1251 str = g_strdup_printf (_("Add atom(s) to thermostat N°%d"), the_therm+1);
1252 }
1253 GtkWidget * amol = dialogmodal (str, GTK_WINDOW(qm_assistant));
1254 g_free (str);
1255 gtk_dialog_add_button (GTK_DIALOG(amol), _("Apply"), GTK_RESPONSE_APPLY);
1256 n_therm = 0;
1257 i = (fixco) ? 1 : 0;
1258 j = (fixco) ? 8 : 5;
1259 add_model = gtk_tree_store_newv (j, col_type[i]);
1260 GtkWidget * add_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(add_model));
1261 for (k=0; k<j-1; k++)
1262 {
1263 if (k < 3)
1264 {
1265 ato_cell[k] = gtk_cell_renderer_text_new ();
1266 }
1267 else
1268 {
1269 ato_cell[k] = gtk_cell_renderer_toggle_new ();
1270 if (k==3)
1271 {
1272 g_signal_connect (G_OBJECT(ato_cell[k]), "toggled", G_CALLBACK(cpmd_select_atom_id), & add_model);
1273 }
1274 else
1275 {
1276 g_signal_connect (G_OBJECT(ato_cell[k]), "toggled", G_CALLBACK(cp2k_select_coord_id), GINT_TO_POINTER(k));
1277 }
1278 }
1279 ato_col[k] = gtk_tree_view_column_new_with_attributes ((k < 4) ? _(ato_title[i][k]) : ato_title[i][k], ato_cell[k], ctype[i][k], k, NULL);
1280 gtk_tree_view_append_column (GTK_TREE_VIEW(add_tree), ato_col[k]);
1281 gtk_tree_view_column_set_alignment (ato_col[k], 0.5);
1282 gtk_tree_view_column_set_cell_data_func (ato_col[k], ato_cell[k], atom_set_visible, GINT_TO_POINTER(k), NULL);
1283 }
1284 old_thermo = allocint (qm_proj -> natomes);
1285 if (fixco)
1286 {
1287 old_fixed = allocdint (qm_proj -> natomes, 3);
1288 }
1289 k = l = 0;
1290 for (i=0; i < qm_proj -> nspec; i++)
1291 {
1292 for (j=0; j < qm_proj -> natomes; j++)
1293 {
1294 if (qm_proj -> atoms[0][j].sp == i)
1295 {
1296 k ++;
1297 m = was_it_selected (the_therm, j);
1298 if (m)
1299 {
1300 l ++;
1301 n_therm += (m > 1) ? 1 : 0;
1302 old_thermo[j] = (m > 1) ? 1 : 0;
1303 qm_proj -> atoms[0][j].pick[0] = old_thermo[j];
1304 qm_view -> picked += old_thermo[j];
1305 if (fixco && m > 1)
1306 {
1307 if (is_cpmd)
1308 {
1309 old_fixed[j][0] = tmp_cpmd -> fixcoord[m-2][0];
1310 old_fixed[j][1] = tmp_cpmd -> fixcoord[m-2][1];
1311 old_fixed[j][2] = tmp_cpmd -> fixcoord[m-2][2];
1312 }
1313 else
1314 {
1315 old_fixed[j][0] = tmp_cp2k -> fixcoord[0][m-2][0];
1316 old_fixed[j][1] = tmp_cp2k -> fixcoord[0][m-2][1];
1317 old_fixed[j][2] = tmp_cp2k -> fixcoord[0][m-2][2];
1318 }
1319 }
1320 }
1321 }
1322 }
1323 }
1326 num_cpmd_objects = l;
1327 g_object_unref (add_model);
1328 i = ((qm_proj -> nspec + l)*37 < 500) ? (qm_proj -> nspec + l)*37 : 500;
1329 //GtkWidget * scrollsets = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN, 0);
1330 GtkWidget * scrollsets = create_scroll (dialog_get_content_area (amol), 320, i, GTK_SHADOW_ETCHED_IN);
1332 str = g_strdup_printf (_(" <b>(*)</b> Order of appearance in the input file"));
1333 GtkWidget * vbox = dialog_get_content_area (amol);
1334 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
1335 g_free (str);
1336 if (the_therm != -1)
1337 {
1338 if (get_num_thermo() > 1 || the_therm < -1)
1339 {
1340 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);
1341 GtkWidget * hbox = create_hbox (0);
1342 gchar * lab[2] = {i18n("All non-thermostated atom(s)"), i18n("All atom(s)")};
1343 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox,
1344 check_button (_(lab[(the_therm > -1) ? 0 : 1]), -1, -1,
1345 FALSE, G_CALLBACK(select_atoms_not_thermostated), GINT_TO_POINTER(the_therm)),
1346 FALSE, FALSE, 50);
1347 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
1348 }
1349 }
1352 if (the_therm > -1) set_going_forward ();
1353 g_free (old_thermo);
1354 fixco = FALSE;
1355}
1356
1365G_MODULE_EXPORT void atom_selection_button (GtkButton * but, gpointer data)
1366{
1367 int num, id;
1368 int i = GPOINTER_TO_INT(data);
1370 if (i < -1)
1371 {
1372 id = 2;
1373 num = get_active_dummy (-(i+2)) -> natoms;
1374 }
1375 else if (i == -1)
1376 {
1377 id = 1;
1378 num = (is_cpmd) ? tmp_cpmd -> fixat : tmp_cp2k -> fixat[0];
1379 }
1380 else
1381 {
1382 id = 0;
1383 thermostat * thermo = get_active_thermostat (i);
1384 num = thermo -> natoms;
1385 }
1386 gchar * stra, * strb;
1387 if (num == 0)
1388 {
1389 stra = g_strdup_printf (_("Not picked yet !"));
1390 strb = g_strdup_printf (DELETEB);
1391 }
1392 else
1393 {
1394 stra = g_strdup_printf (_("%d atom(s)"), num);
1395 strb = g_strdup_printf (APPLY);
1396 }
1398 gtk_button_set_label (but, stra);
1399 g_free (stra);
1400 g_free (strb);
1401 if (is_cpmd)
1402 {
1403 // CPMD
1404 if (i < -1)
1405 {
1406 print_the_section (8, 0, qmbuffer[8]);
1407 }
1408 else if (i == -1)
1409 {
1410 print_the_section (8, 0, qmbuffer[8]);
1411 }
1412 else
1413 {
1414 for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1415 }
1416 }
1417 else
1418 {
1419 // CP2K
1420 }
1421}
1422
1433void create_selection_button (GtkWidget * box, int num, int id, gpointer data)
1434{
1435 int i = GPOINTER_TO_INT(data);
1436 GtkWidget * hbox = cpmd_box (box, _("Atom(s) selection: "), 5, 20, (i < -1) ? 120 : 220);
1437 gchar * str;
1438 if (num == 0)
1439 {
1440 str = g_strdup_printf (_("Not picked yet !"));
1441 sel_img[id] = stock_image (DELETEB);
1442 }
1443 else
1444 {
1445 str = g_strdup_printf (_("%d atom(s)"), (int)num);
1446 sel_img[id] = stock_image (APPLY);
1447 }
1448 sel_but[id] = gtk_button_new_with_label (str);
1449 gtk_widget_set_size_request (sel_but[id], 150, -1);
1450 g_free (str);
1451 g_signal_connect (G_OBJECT(sel_but[id]), "clicked", G_CALLBACK(atom_selection_button), data);
1452 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sel_but[id], FALSE, FALSE, 0);
1453 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sel_img[id], FALSE, FALSE, 30);
1454}
1455
1464{
1465 gchar * str;
1467 str = g_strdup_printf (_("Configuration for thermostat N°<b>%d</b>: "), therm_id+1);
1469 cpmd_box (nose_id_box[1], str, 5, 5, 220);
1470 g_free (str);
1471 thermostat * thermo = get_active_thermostat (therm_id);
1472 create_selection_button (nose_id_box[1], thermo -> natoms, 0, GINT_TO_POINTER(therm_id));
1473 nose_parameters (nose_id_box[1], therm_id,
1474 v_thermo[!is_cpmd][thermo->type],
1475 c_thermo[!is_cpmd][thermo->type],
1476 u_thermo[!is_cpmd][thermo->type]);
1477 add_box_child_start (GTK_ORIENTATION_VERTICAL, nose_id_box[0], nose_id_box[1], FALSE, FALSE, 0);
1479}
1480
1489G_MODULE_EXPORT void changed_nose_thermo_id_box (GtkComboBox * box, gpointer data)
1490{
1491 int i;
1492 i = combo_get_active ((GtkWidget *)box);
1494}
1495
1506void create_selection_combo (int id, int num, int type, GCallback handler)
1507{
1508 int i, j;
1509 gchar * str;
1510 gchar * lab[2]={i18n("Thermostat"), i18n("Dummy atom")};
1512 combo_id_box[id] = create_combo ();
1513 for (i=0; i<num; i++)
1514 {
1515 str = g_strdup_printf ("%s N°%d", _(lab[id]), i+1);
1517 g_free (str);
1518 }
1519 j = type;
1520 if (num > 0)
1521 {
1523 if (id == 0)
1524 {
1526 }
1527 else
1528 {
1530 }
1531 }
1532 else
1533 {
1536 }
1537 g_signal_connect (G_OBJECT (combo_id_box[id]), "changed", handler, GINT_TO_POINTER(j));
1538 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, combo_id[id], combo_id_box[id], FALSE, FALSE, 0);
1540}
1541
1549void add_thermostat (int extra)
1550{
1551 int i, j;
1552 thermostat * thermo = get_thermo ();
1553 j = get_num_thermo ();
1554 while (thermo -> next != NULL) thermo = thermo -> next;
1555 for (i=0; i<extra; i++)
1556 {
1557 thermo -> next = init_thermo (i+j, thermo -> type, thermo -> sys);
1558 thermo -> next -> prev = thermo;
1559 if (i < extra-1) thermo = thermo -> next;
1560 }
1561
1562 if (is_cpmd)
1563 {
1564 tmp_cpmd -> thermostats += extra;
1565 }
1566 else
1567 {
1568 tmp_cp2k -> thermostats += extra;
1569 }
1570 // finally update the combobox
1572}
1573
1582G_MODULE_EXPORT void add_or_remove_thermostat (GtkSpinButton * res, gpointer data)
1583{
1584 int id = gtk_spin_button_get_value_as_int(res);
1585 int i, j, k;
1586 gchar * str;
1587 gboolean add_thermo = TRUE;
1588 thermostat * thermo = get_thermo();
1589 if (id != get_num_thermo ())
1590 {
1591 if (id > get_num_thermo ())
1592 {
1593 // adding thermostats
1594 // ok if: 1) all atoms do not already have a thermostat assigned
1595 // 2) number of thermostat(s) to create < number of atoms that do have a thermostat assigned
1596 j = 0;
1597 for (i=0; i<get_num_thermo (); i++)
1598 {
1599 j += thermo -> natoms;
1600 if (thermo -> next != NULL) thermo = thermo -> next;
1601 }
1602 if (j < qm_proj -> natomes)
1603 {
1604 // Number of thermostat to create
1605 k = id - get_num_thermo ();
1606 if (k < (qm_proj -> natomes - j))
1607 {
1608 if (k > 1)
1609 {
1610 str = g_strdup_printf (_("Do you really want to add %d thermostat(s) ?"), k);
1611 add_thermo = ask_yes_no (_("Adding thermostat(s) ?"), str, GTK_MESSAGE_QUESTION, qm_assistant);
1612 g_free (str);
1613 }
1614 if (add_thermo)
1615 {
1616 add_thermostat (k);
1617 }
1618 else
1619 {
1620 // Set value back to the number of ionic thermostats
1621 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1622 }
1623 }
1624 else
1625 {
1626 show_warning (_("It is not possible to create so many thermostats"), qm_assistant);
1627 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1628 }
1629 }
1630 else
1631 {
1632 show_warning (_("All atoms arleady have a thermostat assigned"), qm_assistant);
1633 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)get_num_thermo ());
1634 }
1635 }
1636 else
1637 {
1638 // removing thermostats
1640 }
1641 }
1642 gtk_spin_button_set_value (GTK_SPIN_BUTTON(res), (double)(get_num_thermo ()));
1643 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1644}
1645
1654G_MODULE_EXPORT void update_thermo_parameter (GtkEntry * res, gpointer data)
1655{
1656 int i, j;
1657 i = GPOINTER_TO_INT(data);
1658 const gchar * m = entry_get_text (res);
1659 double v = string_to_double ((gpointer)m);
1660 if (i < 0)
1661 {
1662 if (tmp_cpmd -> elec_thermostat -> params[i+2] != v)
1663 {
1664 tmp_cpmd -> elec_thermostat -> params[i+2] = v;
1666 }
1667 }
1668 else
1669 {
1670 if (get_num_thermo () > 1)
1671 {
1673 }
1674 else
1675 {
1676 j = 0;
1677 }
1678 thermostat * thermo = get_active_thermostat (j);
1679 if (i < 2)
1680 {
1681 if (thermo -> params[i] != v)
1682 {
1683 thermo -> params[i] = v;
1685 }
1686 }
1687 else
1688 {
1689 if ((int)thermo -> params[i] != (int)v)
1690 {
1691 thermo -> params[i] = v;
1692 update_entry_int (res, (int)v);
1693 }
1694 }
1695 }
1696 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1697}
1698
1706GtkWidget * create_nose_box (int n)
1707{
1708 GtkWidget * vbox = create_vbox (BSEP);
1709 GtkWidget * hbox;
1710 GtkWidget * widg;
1711 if (n > GLOBAL)
1712 {
1713 hbox = cpmd_box (vbox, _("Number of thermostat(s): "), 5, 5, 220);
1714 widg = spin_button (G_CALLBACK(add_or_remove_thermostat),
1715 (double)(get_num_thermo ()), 1.0, (double)qm_proj -> natomes, 1.0, 0, 100, NULL);
1716 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, widg, FALSE, FALSE, 0);
1717 combo_id[0] = cpmd_box (vbox, _("Thermostat to configure: "), 5, 5, 220);
1719 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, nose_id_box[0], FALSE, FALSE, 10);
1722 }
1723 else
1724 {
1726 v_thermo[!is_cpmd][get_thermo()->type],
1727 c_thermo[!is_cpmd][get_thermo() -> type],
1728 u_thermo[!is_cpmd][get_thermo()->type]);
1729 }
1730 return vbox;
1731}
1732
1741G_MODULE_EXPORT void changed_thermo_box_nose (GtkComboBox * box, gpointer data)
1742{
1743 int i;
1744 i = combo_get_active ((GtkWidget *)box);
1745 if (i != get_thermo () -> sys)
1746 {
1747 clean_thermostat (get_thermo () -> type);
1749 get_thermo () -> sys = i;
1750 nose_box = create_nose_box (get_thermo () -> sys);
1751 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
1752 int j;
1753 if (is_cpmd) for (j=1; j<4; j++) print_the_section (j, 0, qmbuffer[j]);
1755 }
1757}
1758
1765{
1766 int i, j, k;
1767 GtkWidget * hbox;
1768 GtkWidget * tbox;
1769 gchar * str;
1773 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_ions, therm_param_ions, FALSE, FALSE, 0);
1774 i = (is_cpmd) ? 1 : 0;
1775 //if (is_cpmd)
1776 {
1777 if (get_thermo () -> type > i)
1778 {
1779 hbox = cpmd_box (therm_param_ions, _("Thermostat type: "), 5, 5, 220);
1780 tbox = create_combo ();
1781 j = 2; // For QM-MM: qm_view -> bonding + 2;
1782 for (k=0; k<j; k++)
1783 {
1784 str = g_strdup_printf ("%s", _(nosetype[k]));
1785 combo_text_append (tbox, str);
1786 g_free (str);
1787 }
1788 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tbox, FALSE, FALSE, 0);
1789 combo_set_active (tbox, get_thermo () -> sys);
1790 g_signal_connect (G_OBJECT (tbox), "changed", G_CALLBACK(changed_thermo_box_nose), NULL);
1791 }
1792 }
1793 nose_box = create_nose_box (get_thermo () -> sys);
1794 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_param_ions, nose_box, FALSE, FALSE, 0);
1796 if (is_cpmd) for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1797}
1798
1805{
1808 add_box_child_start (GTK_ORIENTATION_VERTICAL, therm_elec, therm_param_elec, FALSE, FALSE, 0);
1809 int i;
1811 v_thermo[0][tmp_cpmd -> elec_thermostat -> type],
1812 c_thermo[0][tmp_cpmd -> elec_thermostat -> type],
1813 ue_thermo[tmp_cpmd -> elec_thermostat -> type]);
1815 for (i=1; i<4; i++) print_the_section (i, 0, qmbuffer[i]);
1816}
1817
1826G_MODULE_EXPORT void changed_thermo_box (GtkComboBox * box, gpointer data)
1827{
1828 int i, j;
1829 i = combo_get_active ((GtkWidget *)box);
1830 j = GPOINTER_TO_INT (data);
1831 if (j == 0 && i != get_thermo () -> type)
1832 {
1833 clean_thermostat (i);
1834 thermostat * thermo = get_thermo();
1835 thermo -> sys = GLOBAL;
1837 }
1838 else if (j == -1)
1839 {
1840 if (i != tmp_cpmd -> elec_thermostat -> type)
1841 {
1842 g_free (tmp_cpmd -> elec_thermostat);
1843 tmp_cpmd -> elec_thermostat = init_thermo (-1, i, 0);
1844 tmp_cpmd -> elec_thermostat -> sys = 0;
1846 }
1847 }
1849}
1850
1860void thermo_type_box (GtkWidget * vbox, gchar * str, int id)
1861{
1862 int i;
1863 GtkWidget * hbox = create_hbox (0);
1864 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 5);
1865 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 5);
1866 GtkWidget * tbox = create_combo ();
1867 for (i=0; i<num_thermo[!is_cpmd]; i++)
1868 {
1869 str = g_strdup_printf ("%s", (!is_cpmd || i != 3) ? _(thermo_name[!is_cpmd][i]) : thermo_name[!is_cpmd][i]);
1870 combo_text_append (tbox, str);
1871 g_free (str);
1872 }
1873 if (id == -1)
1874 {
1875 combo_set_active (tbox, tmp_cpmd -> elec_thermostat -> type);
1876 }
1877 else
1878 {
1879 thermostat * thermo = get_thermo();
1880 combo_set_active (tbox, thermo -> type);
1881 }
1882 g_signal_connect (G_OBJECT (tbox), "changed", G_CALLBACK(changed_thermo_box), GINT_TO_POINTER(id));
1883 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tbox, FALSE, FALSE, 0);
1884}
1885
1891GtkWidget * thermo_box ()
1892{
1893 gchar * thermo_info[2] = {i18n("<u>Ionic subsystem thermostat:</u> "), i18n("Thermostat: ")};
1894 GtkWidget * vbox = create_vbox (BSEP);
1895 GtkWidget * vvbox;
1896 nose_id_box[0] = nose_id_box[1] = NULL;
1897 therm_param_ions = NULL;
1898 therm_param_elec = NULL;
1899 nose_box = NULL;
1900 combo_id_box[0] = NULL;
1901 combo_id[0] = NULL;
1902 if (get_num_thermo() == 0) init_thermostats (0, 1);
1903 // Thermostat type ions
1904 vvbox = create_vbox (BSEP);
1905 gtk_widget_set_size_request (vvbox, (is_cpmd) ? 525 : -1, (is_cpmd) ? 350 : 260);
1906 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, vvbox, FALSE, FALSE, 0);
1907 thermo_type_box (vvbox, _(thermo_info[!is_cpmd]), 0);
1909 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox, therm_ions, FALSE, FALSE, (is_cpmd) ? 0 : 20);
1911 // Thermostat type electrons
1912 if (is_cpmd)
1913 {
1915 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, electron_box, FALSE, FALSE, 5);
1916 thermo_type_box (electron_box, _("<u>Fictitious electronic subsystem:</u> "), -1);
1918 add_box_child_start (GTK_ORIENTATION_VERTICAL, electron_box, therm_elec, FALSE, FALSE, 0);
1920 }
1921 return vbox;
1922}
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
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
Definition initcoord.c:81
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:699
GtkTreeStore * add_model
Definition cpmd_nose.c:157
int at_col
Definition cpmd_nose.c:151
int ** old_fixed
Definition cpmd_nose.c:153
int v_thermo[2][CP2NTHERM]
Definition cpmd_nose.c:125
Variable declarations for the creation of the CPMD input file.
#define DEFFI
Definition cpmd.h:50
@ LOCAL
Definition cpmd.h:115
@ GLOBAL
Definition cpmd.h:114
GtkWidget * sel_img[3]
Definition cpmd_nose.c:138
gchar * thermo_name[2][5]
Definition cpmd_init.c:215
gboolean is_cpmd
Definition cpmd_init.c:231
cpmd * tmp_cpmd
Definition cpmd_init.c:103
int num_thermo[2]
Definition cpmd_init.c:217
gchar * default_opts[MAXDATAQM-1][NSECOP]
Definition cpmd_init.c:123
GtkWidget * sel_but[3]
Definition cpmd_nose.c:137
gchar * nosetype[3]
Definition cpmd_init.c:214
dummy_atom * dummy
Definition cpmd_atoms.c:73
int num_cpmd_objects
Definition cpmd_nose.c:154
void print_the_section(int s, int p, GtkTextBuffer *buffer)
print CPMD input section
Definition cpmd_print.c:697
GtkWidget * combo_id_box[2]
Definition cpmd_nose.c:146
GtkWidget * combo_id[2]
Definition cpmd_nose.c:145
GtkWidget * electron_box
Definition cpmd_nose.c:139
gboolean are_all_atoms_thermostated()
are all atom(s) in the model thermostated ?
Definition cpmd_nose.c:198
G_MODULE_EXPORT void changed_nose_thermo_id_box(GtkComboBox *box, gpointer data)
change thermostat id
Definition cpmd_nose.c:1489
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:753
gchar * c_thermo[2][CP2NTHERM][4]
Definition cpmd_nose.c:98
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:989
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:879
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:699
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:1463
G_MODULE_EXPORT void update_thermo_parameter(GtkEntry *res, gpointer data)
update thermostat parameter value entry callback
Definition cpmd_nose.c:1654
GtkTreeViewColumn * thermo_col[6]
Definition cpmd_nose.c:149
double d_thermo[2][CP2NTHERM][4]
Definition cpmd_nose.c:127
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:1433
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:244
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:1035
void fill_thermo_atom_model(int therm)
fill thermostat atom model
Definition cpmd_nose.c:902
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:1706
void create_selection_combo(int id, int num, int type, GCallback handler)
create thermostat selection combo box
Definition cpmd_nose.c:1506
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:1860
GtkWidget * therm_ions
Definition cpmd_nose.c:140
int is_not_thermostated(int at, int therm)
is atom thermostated ?
Definition cpmd_nose.c:793
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
void prepare_therm_elec()
prepare electrons thermostat widgets
Definition cpmd_nose.c:1804
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:1764
int n_therm
Definition cpmd_nose.c:150
int in_dummy(int at, int id)
is atom in dummy ?
Definition cpmd_nose.c:859
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:1582
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:660
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:697
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:1549
void set_going_forward()
QM / QM-MM assistant going forward on thermostat page.
Definition cpmd_nose.c:224
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:1741
G_MODULE_EXPORT void atom_selection_button(GtkButton *but, gpointer data)
select atom(s) to be thermostated
Definition cpmd_nose.c:1365
G_MODULE_EXPORT void changed_thermo_box(GtkComboBox *box, gpointer data)
change the thermostat family (ionic / fictitious electronic)
Definition cpmd_nose.c:1826
void proj_unselect_all_atoms()
unselect all atom(s) in the target project of the assistant
Definition cpmd_init.c:1049
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:1210
dummy_atom * get_active_dummy(int id)
get dummy atom by id
Definition cpmd_atoms.c:86
GtkWidget * thermo_box()
create the thermostat configuration widgets
Definition cpmd_nose.c:1891
thermostat * get_thermo()
get QM / QM-MM ions thermostat
Definition cpmd_nose.c:164
gchar * u_thermo[2][CP2NTHERM][4]
Definition cpmd_nose.c:109
int is_fixed_atom(int at)
is atom fixed ?
Definition cpmd_nose.c:825
void clean_thermostat(int new_type)
free thermostat data, then initialiaze new type of thermostat
Definition cpmd_nose.c:586
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:729
gchar * ue_thermo[CP2NTHERM][4]
Definition cpmd_nose.c:120
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:929
GType col_type[MAXDATA][12]
Definition dlp_field.c:946
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:317
int * allocint(int val)
allocate an int * pointer
Definition global.c:301
#define i18n(String)
Definition global.c:80
double string_to_double(gpointer string)
convert string to double
Definition global.c:611
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:533
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
Definition gtk-misc.c:935
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1401
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:688
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
Definition gtk-misc.c:1740
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:2139
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:552
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:958
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:652
#define BSEP
Definition global.h:261
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:669
GtkWidget * stock_image(const gchar *stock_id)
create a GtkImage for the Gtk database
Definition gtk-misc.c:1451
void set_renderer_markup(GtkTreeModel *mod, GtkTreeIter *iter, GtkCellRenderer *renderer, int col)
set Pango text markup for a GtkCellRenderer
Definition gtk-misc.c:1764
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:1877
#define APPLY
Definition global.h:236
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1937
@ CONTAINER_SCR
Definition global.h:267
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:1010
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:861
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
Definition gtk-misc.c:1672
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:340
#define DELETEB
Definition global.h:238
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:247
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2235
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:849
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:987
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:267
void set_image_from_icon_name(GtkWidget *widg, gchar *icon)
set a image from a stock icon name
Definition gtk-misc.c:2030
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:837
int button_get_status(GtkWidget *button)
get status of check / toggle button
Definition gtk-misc.c:1899
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
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:266
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
Definition interface.c:420
gchar * exact_name(gchar *name)
short cut to print string without spaces
Definition interface.c:434
Messaging function declarations.
Definition glwin.h:350
int type
Definition global.h:817
GtkWidget * res[2]
Definition w_encode.c:342
GtkWidget * hbox
Definition workspace.c:71
GtkWidget * vbox
Definition workspace.c:72
GtkWidget * lab
Definition workspace.c:73