52extern G_MODULE_EXPORT
void cp2k_select_coord_id (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data);
69G_MODULE_EXPORT
void select_frag (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
72 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
73 gtk_tree_model_get_iter (GTK_TREE_MODEL(
add_model), & iter,
path);
75 gtk_tree_model_get (GTK_TREE_MODEL(
add_model), & iter, 0, & i, -1);
76 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
100void frag_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
103 gtk_tree_model_get (mod, iter, 1, & i, -1);
104 gtk_cell_renderer_set_visible (renderer, i);
118void frag_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
121 gtk_tree_model_get (mod, iter, 0, & i, -1);
122 gtk_tree_model_get (mod, iter, 1, & j, -1);
140 if (response_id == GTK_RESPONSE_YES)
143 for (i=0; i<
qm_coord -> totcoord[2]; i++)
147 gchar * str = g_strdup_printf (
"Fragment %d has been selected but no coordinates appear to be frozen !\n"
148 "Unselect fragment %d or select coordinate(s) to freeze !", i+1, i+1);
171 gboolean done = FALSE;
174 case GTK_RESPONSE_APPLY:
179 str = g_strdup_printf (
"Fragments N°%d",
fix_frag[0]+1);
182 for (i=1; i<
a_frag-1; i++)
184 str = g_strdup_printf (
"%s, %d", str,
fix_frag[i]+1);
187 str = g_strdup_printf (
"%s and %d have been selected !", str,
fix_frag[
a_frag-1]+1);
188 str = g_strdup_printf (
"%s\nConfirm this choice and fix these fragments ?", str);
192 str = g_strdup_printf (
"Fragment N°%d has been selected !",
fix_frag[0]+1);
193 str = g_strdup_printf (
"%s\nConfirm this choice and fix this fragment ?", str);
204 if (
tmp_cp2k -> fixcoord[1] != NULL)
216 for (i=0; i<
qm_coord -> totcoord[2]; i++)
231 case GTK_RESPONSE_CLOSE:
247 gchar * str = g_strdup_printf (
"Please select the fragment(s) to fix");
250 gtk_dialog_add_button (GTK_DIALOG(fmol),
"Apply", GTK_RESPONSE_APPLY);
251 GtkWidget * frag_tree = NULL;
253 GtkTreeViewColumn * frag_col[5];
254 GtkCellRenderer * frag_cell[5];
255 gchar * frag_title[5] = {
"Fragment",
"Viz.3D & Select",
"x",
"y",
"z"};
256 gchar * ctype[5]={
"text",
"active",
"active",
"active",
"active"};
257 GType
col_type[5] = {G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN};
259 frag_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
add_model));
264 frag_cell[i] = gtk_cell_renderer_text_new ();
268 frag_cell[i] = gtk_cell_renderer_toggle_new ();
271 g_signal_connect (G_OBJECT(frag_cell[i]),
"toggled", G_CALLBACK(
select_frag), NULL);
276 g_signal_connect (G_OBJECT(frag_cell[i]),
"toggled", G_CALLBACK(
cp2k_select_coord_id), GINT_TO_POINTER(j));
279 frag_col[i] = gtk_tree_view_column_new_with_attributes (frag_title[i], frag_cell[i], ctype[i], i, NULL);
280 gtk_tree_view_append_column (GTK_TREE_VIEW(frag_tree), frag_col[i]);
281 gtk_tree_view_column_set_alignment (frag_col[i], 0.5);
284 gtk_tree_view_column_set_cell_data_func (frag_col[i], frag_cell[i],
frag_set_color, NULL, NULL);
288 gtk_tree_view_column_set_cell_data_func (frag_col[i], frag_cell[i],
frag_set_visible, NULL, NULL);
296 for (i=0; i<
qm_coord -> totcoord[2]; i++)
298 gtk_tree_store_append (
add_model, & iter, NULL);
299 for (j=0; j<
tmp_cp2k -> fixat[1]; j++)
309 gtk_tree_store_set (
add_model, & iter, 0, i + 1,
316 gtk_tree_view_expand_all (GTK_TREE_VIEW(frag_tree));
318 i = ((
qm_coord -> totcoord[2]+1)*35 < 500) ? (
qm_coord -> totcoord[2]+1)*35 : 500;
void field_question(gchar *question, GCallback handler, gpointer data)
ask the use to confirm something
Variable declarations for the MD input preparation assistants.
Variable declarations for the creation of the CP2K input file(s)
void cp2k_fix_molecule()
CP2K assistant fixing fragment(s) - creating the dialog.
G_MODULE_EXPORT void cp2k_select_coord_id(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select CP2K fixed id toggle callback
void frag_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color in the CP2K molecule tree store
G_MODULE_EXPORT void select_fixed_atom_confirm(GtkDialog *dialog, gint response_id, gpointer data)
confirm fix selection
void frag_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
show / hide cell renderer in the CP2K molecule tree store
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
void proj_unselect_all_atoms()
unselect all atom(s) in the target project of the assistant
G_MODULE_EXPORT void select_frag(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select molecule toggle callback
G_MODULE_EXPORT void run_cp2k_fix_molecule(GtkDialog *dial, gint response_id, gpointer data)
CP2K assistant fixing fragment(s) - running the dialog.
GType col_type[MAXDATA][12]
int ** allocdint(int xal, int yal)
allocate an int ** pointer
int * allocint(int val)
allocate an int * pointer
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
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.
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void show_warning(char *warning, GtkWidget *win)
show warning
Messaging function declarations.