89 while (dumm ->
id !=
id)
91 if (dumm -> next != NULL) dumm = dumm -> next;
107 i = GPOINTER_TO_INT(data);
129 if (i !=
dummy -> type)
152 str = g_strdup_printf (_(
"Configuration for dummy atom N°<b>%d</b>: "), dummy_id+1);
159 gchar * dtext[3] = {
i18n(
"fixed in space:"),
160 i18n(
"calculated by\nthe arithmetic mean of the coordinates of the selected atom(s)"),
161 i18n(
"calculated by\nthe center of mass of the coordinates of the selected atom(s)")};
164 str = g_strdup_printf (
"%s %d", _(
"Type"), i+1);
171 str = g_strdup_printf (_(
"The coordinates of the dummy atom are %s"), _(dtext[
dummy -> type]));
177 if (
dummy -> type > 0)
183 gchar * lcoo[3]={
"<b>x</b>",
"<b>y</b>",
"<b>z</b>"};
187 str = g_strdup_printf (_(
"Dummy %s coordinate: "), lcoo[i]);
228 dumm -> show = FALSE;
231 dumm -> xyz[0] = 0.0;
232 dumm -> xyz[1] = 0.0;
233 dumm -> xyz[2] = 0.0;
246G_MODULE_EXPORT
void select_dummy (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
248 GtkTreeStore **
model = (GtkTreeStore **)data;
250 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
251 gtk_tree_model_get_iter (GTK_TREE_MODEL(*
model), & iter,
path);
252 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
257 gtk_tree_store_set (*
model, & iter, 4, 0, -1);
263 gtk_tree_store_set (*
model, & iter, 4, 1, -1);
283void dummy_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
286 gtk_tree_model_get (mod, iter, 0, & i, -1);
302void dummy_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
305 i = GPOINTER_TO_INT(data);
306 gtk_tree_model_get (mod, iter, 0, & j, -1);
309 gtk_cell_renderer_set_visible (renderer, TRUE);
314 gtk_cell_renderer_set_visible (renderer, FALSE);
318 gtk_cell_renderer_set_visible (renderer, TRUE);
323 gtk_cell_renderer_set_visible (renderer, FALSE);
355 gboolean done = FALSE;
356 int num_to_remove = GPOINTER_TO_INT(data);
361 case GTK_RESPONSE_APPLY:
369 for (j=0; j<
tmp_cpmd -> dummies; j++)
373 if (dumm -> next != NULL)
375 if (dumm -> prev != NULL)
377 dumm -> next -> prev = dumm -> prev;
378 dumm -> prev -> next = dumm -> next;
387 else if (dumm -> prev != NULL)
389 dumm -> prev -> next = NULL;
399 if (dumm -> next != NULL) dumm = dumm -> next;
402 tmp_cpmd -> dummies -= num_to_remove;
406 for (j=0; j<
tmp_cpmd -> dummies; j++)
409 if (dumm -> next != NULL) dumm = dumm -> next;
419 str = g_strdup_printf (_(
"You must select %d dummy atom(s) to be deleted !"), num_to_remove);
443 str = g_strdup_printf (_(
"Select the %d dummy atom(s) to be removed"), num_to_remove);
446 gtk_dialog_add_button (GTK_DIALOG(rdummy), _(
"Apply"), GTK_RESPONSE_APPLY);
448 gchar * mol_title[5] = {
i18n(
"Id."),
i18n(
"Type"),
i18n(
"Atom(s)"),
" ",
i18n(
"Select")};
449 gchar * ctype[5] = {
"text",
"text",
"text",
"text",
"active"};
450 GType
col_type[5] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN};
452 GtkTreeIter dummy_level, atom_level;
455 GtkTreeStore * remove_model = gtk_tree_store_newv (5,
col_type);
456 GtkWidget * remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
466 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(
dummy_renderer[i]), TRUE);
469 dummy_col[i] = gtk_tree_view_column_new_with_attributes ((i != 3) ? _(mol_title[i]) : mol_title[i],
dummy_renderer[i], ctype[i], i, NULL);
470 gtk_tree_view_column_set_alignment (
dummy_col[i], 0.5);
471 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree),
dummy_col[i]);
476 for (i=0; i<
tmp_cpmd -> dummies; i++)
478 gtk_tree_store_append (remove_model, & dummy_level, NULL);
479 gtk_tree_store_set (remove_model, & dummy_level, 0, i+1,
480 1, g_strdup_printf (
"%s %d", _(
"Type"), dumm -> type + 1),
484 for (j=0; j<dumm -> natoms; j++)
486 gtk_tree_store_append (remove_model, & atom_level, & dummy_level);
489 gtk_tree_store_set (remove_model, & atom_level, 0, -(i+1), 1, 0.0, 2, 0.0, 3, str, 4, 0, -1);
492 if (dumm -> next != NULL) dumm = dumm -> next;
495 g_object_unref (remove_model);
521 while (dumm -> next != NULL) dumm = dumm -> next;
522 for (i=0; i<extra; i++)
525 dumm -> next -> prev = dumm;
544 int id = gtk_spin_button_get_value_as_int(
res);
547 gboolean to_add_dummy = TRUE;
556 str = g_strdup_printf (_(
"Do you really want to add %d dummy atom(s) ?"), k);
565 else if (id < tmp_cpmd -> dummies)
570 gtk_spin_button_set_value (GTK_SPIN_BUTTON(
res),
tmp_cpmd -> dummies);
586 tmp_cpmd -> dummies, 0.0, (
double)
qm_proj -> natomes, 1.0, 0, 100, NULL);
606 i = GPOINTER_TO_INT(data);
607 GtkWidget * amol =
dialogmodal ((i ==
DEFCO) ? _(
"Add and configure constraint(s)") : _(
"Add and configure dummy atoms"), GTK_WINDOW(
qm_assistant));
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
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
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
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
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
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.
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
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)
create a GtkLabel with pango markup
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.