64extern G_MODULE_EXPORT
void changed_opt_box (GtkComboBox * box, gpointer data);
89 while (dumm ->
id !=
id)
91 if (dumm -> next != NULL) dumm = dumm -> next;
107 i = GPOINTER_TO_INT(data);
128 i = gtk_combo_box_get_active (box);
129 if (i !=
dummy -> type)
152 str = g_strdup_printf (
"Configuration for dummy atom N°<b>%d</b>: ", dummy_id+1);
159 gchar * dtypes[3] = {
"Type 1",
"Type 2",
"Type 3"};
160 gchar * dtext[3] = {
"fixed in space:",
161 "calculated by\nthe arithmetic mean of the coordinates of the selected atom(s)",
162 "calculated by\nthe center of mass of the coordinates of the selected atom(s)"};
170 str = g_strdup_printf (
"The coordinates of the dummy atom are %s", dtext[
dummy -> type]);
176 if (
dummy -> type > 0)
182 gchar * lcoo[3]={
"<b>x</b>",
"<b>y</b>",
"<b>z</b>"};
186 str = g_strdup_printf (
"Dummy %s coordinate: ", lcoo[i]);
193 gtk_combo_box_set_active (GTK_COMBO_BOX(box),
dummy -> type);
210 i = gtk_combo_box_get_active (box);
227 dumm -> show = FALSE;
230 dumm -> xyz[0] = 0.0;
231 dumm -> xyz[1] = 0.0;
232 dumm -> xyz[2] = 0.0;
245G_MODULE_EXPORT
void select_dummy (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
247 GtkTreeStore **
model = (GtkTreeStore **)data;
249 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
250 gtk_tree_model_get_iter (GTK_TREE_MODEL(*
model), & iter,
path);
251 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
256 gtk_tree_store_set (*
model, & iter, 4, 0, -1);
262 gtk_tree_store_set (*
model, & iter, 4, 1, -1);
282void dummy_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
285 gtk_tree_model_get (mod, iter, 0, & i, -1);
301void dummy_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
304 i = GPOINTER_TO_INT(data);
305 gtk_tree_model_get (mod, iter, 0, & j, -1);
308 gtk_cell_renderer_set_visible (renderer, TRUE);
313 gtk_cell_renderer_set_visible (renderer, FALSE);
317 gtk_cell_renderer_set_visible (renderer, TRUE);
322 gtk_cell_renderer_set_visible (renderer, FALSE);
354 gboolean done = FALSE;
355 int num_to_remove = GPOINTER_TO_INT(data);
360 case GTK_RESPONSE_APPLY:
368 for (j=0; j<
tmp_cpmd -> dummies; j++)
372 if (dumm -> next != NULL)
374 if (dumm -> prev != NULL)
376 dumm -> next -> prev = dumm -> prev;
377 dumm -> prev -> next = dumm -> next;
386 else if (dumm -> prev != NULL)
388 dumm -> prev -> next = NULL;
398 if (dumm -> next != NULL) dumm = dumm -> next;
401 tmp_cpmd -> dummies -= num_to_remove;
405 for (j=0; j<
tmp_cpmd -> dummies; j++)
408 if (dumm -> next != NULL) dumm = dumm -> next;
418 str = g_strdup_printf (
"You must select %d dummy atom(s) to be deleted !", num_to_remove);
442 str = g_strdup_printf (
"Select the %d dummy atom(s) to be removed", num_to_remove);
445 gtk_dialog_add_button (GTK_DIALOG(rdummy),
"Apply", GTK_RESPONSE_APPLY);
447 gchar * mol_title[5] = {
"Id",
"Type",
"Atom(s)",
" ",
"Select"};
448 gchar * ctype[5] = {
"text",
"text",
"text",
"text",
"active"};
449 GType
col_type[5] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN};
451 GtkTreeIter dummy_level, atom_level;
454 GtkTreeStore * remove_model = gtk_tree_store_newv (5,
col_type);
455 GtkWidget * remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
465 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(
dummy_renderer[i]), TRUE);
469 gtk_tree_view_column_set_alignment (
dummy_col[i], 0.5);
470 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree),
dummy_col[i]);
475 for (i=0; i<
tmp_cpmd -> dummies; i++)
477 gtk_tree_store_append (remove_model, & dummy_level, NULL);
478 gtk_tree_store_set (remove_model, & dummy_level, 0, i+1,
479 1, g_strdup_printf (
"Type %d", dumm -> type + 1),
483 for (j=0; j<dumm -> natoms; j++)
485 gtk_tree_store_append (remove_model, & atom_level, & dummy_level);
488 gtk_tree_store_set (remove_model, & atom_level, 0, -(i+1), 1, 0.0, 2, 0.0, 3, str, 4, 0, -1);
491 if (dumm -> next != NULL) dumm = dumm -> next;
494 g_object_unref (remove_model);
520 while (dumm -> next != NULL) dumm = dumm -> next;
521 for (i=0; i<
extra; i++)
524 dumm -> next -> prev = dumm;
543 int id = gtk_spin_button_get_value_as_int(
res);
546 gboolean to_add_dummy = TRUE;
555 str = g_strdup_printf (
"Do you really want to add %d dummy atom(s) ?", k);
564 else if (id < tmp_cpmd -> dummies)
569 gtk_spin_button_set_value (GTK_SPIN_BUTTON(
res),
tmp_cpmd -> dummies);
585 tmp_cpmd -> dummies, 0.0, (
double)
qm_proj -> natomes, 1.0, 0, 100, NULL);
605 i = GPOINTER_TO_INT(data);
606 gchar * atom_cons[2] = {
"Add and configure constraint(s)",
"Add and configure dummy atoms"};
623 g_signal_connect (G_OBJECT (widg),
"changed", G_CALLBACK(
changed_opt_box), GINT_TO_POINTER(i+1));
GtkTextBuffer * qmbuffer[MAXDATAQM+2]
Variable declarations for the MD input preparation assistants.
integer(kind=c_int) function chemistry()
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
Variable declarations for the creation of the CPMD input file.
gchar * default_text[9][NDFT]
gchar * default_opts[MAXDATAQM-1][NSECOP]
void create_dummy_param_box(int dummy_id)
crreate dummy atom parameter widgets
void dummy_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
show / hide cell renderer in the CPMD dummy atom(s) tree store
void create_selection_button(GtkWidget *box, int num, int id, gpointer data)
create thermostat atom(s) selection button
G_MODULE_EXPORT void dummy_type_changed(GtkComboBox *box, gpointer data)
change the dummy atom type
GtkWidget * create_dummy_box()
create the dummy atom(s) widgets
void create_selection_combo(int id, int num, int type, GCallback handler)
create thermostat selection combo box
GtkWidget * dummy_param_box
void clean_dummy_widgets()
destroy dummy atom(s) widgets
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
void print_the_section(int s, int p, GtkTextBuffer *buffer)
print CPMD input section
G_MODULE_EXPORT void select_dummy(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select dummy atom toggle callback
GtkWidget * combo_id_box[2]
GtkWidget * the_dummy_box
void dummy_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color in the CPMD dummy atom(s) tree store
dummy_atom * init_dummy(int type, int id)
create dummy atom
dummy_atom * get_active_dummy(int id)
get dummy atom by id
void remove_dummy(int num_to_remove)
remove dummy atom(s) - creating the dialog
GtkCellRenderer * dummy_renderer[5]
G_MODULE_EXPORT void atom_button(GtkWidget *but, gpointer data)
CPMD input file, add constraint(s) or dummy atom(s) - creating the dialog.
GtkTreeViewColumn * dummy_col[5]
G_MODULE_EXPORT void changed_opt_box(GtkComboBox *box, gpointer data)
change CPMD QM option
void add_dummy(int extra)
add dummy atom(s)
G_MODULE_EXPORT void add_or_remove_dummy(GtkSpinButton *res, gpointer data)
add or remove dummy atom spin callback
G_MODULE_EXPORT void changed_dummy_id_box(GtkComboBox *box, gpointer data)
change the dummy atom id
G_MODULE_EXPORT void run_remove_dummy(GtkDialog *dialog, gint response_id, gpointer data)
remove dummy atom(s) - running the dialog
G_MODULE_EXPORT void update_dummy_coord(GtkEntry *res, gpointer data)
udate dummy atom coordinate entry callback
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
GType col_type[MAXDATA][12]
int * allocint(int val)
allocate an int * pointer
double string_to_double(gpointer string)
convert string to double
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
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
GtkWidget * spin_button(GCallback handler, double value, double start, double end, double step, int digits, int dim, gpointer data)
create a spin button
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
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.
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
G_MODULE_EXPORT void run_destroy_dialog(GtkDialog *dialog, gint response_id, gpointer data)
to destroy a GtkDialog when the dialog emit the closing signal
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void show_warning(char *warning, GtkWidget *win)
show warning
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
gchar * exact_name(gchar *name)
short cut to print string without spaces
Messaging function declarations.