86 return g_strdup_printf (
"The description of atom <b>%s</b> will be deleted\n"
87 "and merged with the one of the selected field atom.\n"
88 "Field object(s) using atom <b>%s</b> will also be deleted\n"
89 "and the force field parameter(s) will be updated accordingly.",
93 return g_strdup_printf (
"The description of molecule <b>%s</b> will be deleted\n"
94 "and merged with the one of the selected molecule.",
101 return g_strdup_printf (
"The description of molecule <b>%s</b> will be deleted\n"
102 "and merged with the one of molecule <b>%s</b>",
106 return g_strdup_printf (
"The description of atom <b>%s</b> will be deleted\n"
107 "and merged with the one of field atom <b>%s</b>\n"
108 "Field object(s) using atom <b>%s</b> will also be deleted\n"
109 "and the force field parameter(s) will be updated accordingly.",
153void set_sensitive_mol (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
156 gtk_tree_model_get (mod, iter, 0, & m, -1);
159 gtk_cell_renderer_set_visible (renderer, FALSE);
163 gtk_cell_renderer_set_visible (renderer, TRUE);
178G_MODULE_EXPORT
void select_mol (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
180 GtkTreeStore **
model = (GtkTreeStore **)data;
182 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
183 gtk_tree_model_get_iter (GTK_TREE_MODEL(*
model), & iter,
path);
184 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
202 gtk_tree_model_get (GTK_TREE_MODEL(*
model), & iter, 0, &
toviz.
b, -1);
211 gtk_label_set_use_markup (GTK_LABEL(
remove_label), TRUE);
231 for (i=0; i < at -> num; i++)
234 for (j=0; j < mols; j++)
247 for (i=0; i < at -> num; i++)
250 for (j=0; j < mols; j++)
256 s_list[l] = at -> list_id[i];
257 t_list[l] = at -> frozen_id[i];
258 if (t_list[l]) at -> frozen ++;
265 at -> list_id = NULL;
266 at -> list_id =
allocint (at -> num);
267 at -> frozen_id = NULL;
269 for (i=0; i < at -> num; i++)
271 at -> list[i] = r_list[i];
272 at -> list_id[i] = s_list[i];
273 at -> frozen_id[i] = t_list[i];
275 k = at -> list_id[i];
276 for (l=0; l<mols; l++)
301void molecule_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
304 gtk_tree_model_get (mod, iter,
active_col, & j, -1);
305 gtk_tree_model_get (mod, iter, 0, & i, -1);
321 int * old_mol = NULL;
323 gboolean done = FALSE;
324 gboolean saveit = FALSE;
329 case GTK_RESPONSE_APPLY:
334 str = g_strdup_printf (
"Fragments N°%d",
new_mol[0]+1);
337 for (i=1; i<
a_mol-1; i++)
339 str = g_strdup_printf (
"%s, %d", str,
new_mol[i]+1);
342 str = g_strdup_printf (
"%s and %d have been selected !", str,
new_mol[
a_mol-1]+1);
343 str = g_strdup_printf (
"%s\nConfirm this choice and create a new field molecule to describe these fragments ?", str);
347 str = g_strdup_printf (
"Fragment N°%d has been selected !",
new_mol[0]+1);
348 str = g_strdup_printf (
"%s\nConfirm this choice and create a new field molecule to describe this fragment ?", str);
362 next_fmol -> fragments = NULL;
364 for (i=0; i<
a_mol; i++) next_fmol -> fragments[i] =
new_mol[i];
367 for (i=0; i<next_fmol->
mol -> natoms; i++)
371 tmp_fat = next_fmol -> first_atom;
372 for (i=0; i < next_fmol ->
atoms; i++)
381 for (i=0; i<next_fmol->
mol -> natoms; i++)
384 for (j=0; j<next_fmol ->
multi; j++)
393 for (i=0; i<old_fmol ->
multi; i++)
396 for (j=0; j<
a_mol; j++)
398 if (
new_mol[j] == old_fmol -> fragments[i])
407 old_mol[k] = old_fmol -> fragments[i];
413 for (i=0; i<old_fmol ->
mol -> natoms; i++)
417 tmp_fat = old_fmol -> first_atom;
418 for (i=0; i < old_fmol ->
atoms; i++)
427 for (i=0; i<old_fmol->
mol -> natoms; i++)
430 for (j=0; j<old_fmol ->
multi; j++)
437 old_fmol -> fragments = NULL;
439 for (i=0; i<old_fmol ->
multi; i++) old_fmol -> fragments[i] = old_mol[i];
474 gchar * str = g_strdup_printf (
"Please select the fragment(s) of the new molecule");
477 gtk_dialog_add_button (GTK_DIALOG(amol),
"Apply", GTK_RESPONSE_APPLY);
480 GtkTreeViewColumn * mol_col[2];
481 GtkCellRenderer * mol_cell[2];
482 gchar * mol_title[2] = {
"Fragment",
"Viz.3D & Select"};
483 gchar * ctype[2]={
"text",
"active"};
484 GType
col_type[2] = {G_TYPE_INT, G_TYPE_BOOLEAN};
495 mol_cell[i] = gtk_cell_renderer_text_new ();
499 mol_cell[i] = gtk_cell_renderer_toggle_new ();
502 mol_col[i] = gtk_tree_view_column_new_with_attributes (mol_title[i], mol_cell[i], ctype[i], i, NULL);
503 gtk_tree_view_append_column (GTK_TREE_VIEW(
add_tree), mol_col[i]);
504 gtk_tree_view_column_set_alignment (mol_col[i], 0.5);
507 gtk_tree_view_column_set_cell_data_func (mol_col[i], mol_cell[i],
molecule_set_color, NULL, NULL);
516 gtk_tree_store_append (
add_model, & iter, NULL);
517 gtk_tree_store_set (
add_model, & iter, 0,
tmp_fmol -> fragments[i] + 1, 1, 0, -1);
521 gtk_tree_view_expand_all (GTK_TREE_VIEW(
add_tree));
541 int i, j, k, l, m, n;
542 for (i=0; i<fat -> num; i++)
545 k = fat -> list_id[i];
548 fbt -> list[fbt -> num] = j;
549 fbt -> list_id[fbt -> num] = k;
553 if (
new_mol -> fragments[n] == m)
576 int * saved_list =
allocint (at -> num);
577 int * saved_list_id =
allocint (at -> num);
578 int * saved_frozen_id =
allocbool (at -> num);
579 for (j=0; j < at -> num; j++)
581 saved_list[j] = at -> list[j];
582 saved_list_id[j] = at -> list_id[j];
583 saved_frozen_id[j] = at -> frozen_id[j];
587 i *= old_mol ->
multi;
589 at -> list =
allocint (at -> num + i);
590 g_free (at -> list_id);
591 at -> list_id =
allocint (at -> num + i);
592 g_free (at -> frozen_id);
593 at -> frozen_id =
allocbool (at -> num + i);
594 for (j=0; j< at -> num; j++)
596 at -> list[j] = saved_list[j];
597 at -> list_id[j] = saved_list_id[j];
598 at -> frozen_id[j] = saved_frozen_id[j];
601 g_free (saved_list_id);
602 g_free (saved_frozen_id);
616 fat = g_malloc (
sizeof*fat);
619 fat -> num = fmol ->
mol -> natoms * fmol ->
multi;
622 fbt = fmol -> first_atom;
627 for (j=0; j<fbt -> num; j++)
629 fat -> list[i] = fbt -> list[j];
630 fat -> list_id[i] = fbt -> list_id[j];
650 gboolean done = FALSE;
653 case GTK_RESPONSE_APPLY:
659 for (i=0; i<to_merge ->
multi; i++) old_mol[i] = to_merge -> fragments[i];
660 g_free (to_merge -> fragments);
662 for (i=0; i<to_merge ->
multi; i++) to_merge -> fragments[i] = old_mol[i];
666 to_merge -> fragments[i] =
to_remove -> fragments[i - to_merge ->
multi];
669 for (i=0; i<to_merge ->
mol -> natoms; i++)
672 for (j=0; j<to_merge ->
multi; j++)
686 for (i=0; i<to_merge ->
mol -> natoms; i++)
689 for (j=0; j<to_merge ->
multi; j++)
698 to_merge ->
atoms ++;
699 tmp_fat = to_merge -> first_atom;
700 for (i=0; i < to_merge ->
atoms-1; i++)
709 to_merge ->
atoms --;
714 tmp_field -> first_molecule -> prev = NULL;
757 gchar * str = g_strdup_printf (
"Select the molecule to merge molecule \"%s\" with",
to_remove -> name);
760 gtk_dialog_add_button (GTK_DIALOG(rmol),
"Apply", GTK_RESPONSE_APPLY);
762 GtkWidget * remove_tree = NULL;
765 gchar * mol_title[4] = {
"Id",
"Name",
"Multiplicity",
"Viz.3D & Merge with"};
766 gchar * ctype[4]={
"text",
"text",
"text",
"active"};
767 GType
col_type[4] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN};
772 GtkTreeStore * remove_model = gtk_tree_store_newv (4,
col_type);
773 remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
783 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(
remove_renderer[i]), TRUE);
787 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree),
remove_col[i]);
805 gtk_tree_store_append (remove_model, & iter, NULL);
806 gtk_tree_store_set (remove_model, & iter, 0, i+1,
814 g_object_unref (remove_model);
815 gtk_tree_view_expand_all (GTK_TREE_VIEW(remove_tree));
817 i = ((j+1)*40 < 500) ? (j+1)*40 : 500;
821 gtk_label_set_use_markup (GTK_LABEL(
remove_label), TRUE);
void field_question(gchar *question, GCallback handler, gpointer data)
ask the use to confirm something
gboolean selection_confirmed
G_MODULE_EXPORT void confirm_selection(GtkDialog *dialog, gint response_id, gpointer data)
confirm that the selection is good
Variable declarations for the MD input preparation assistants.
field_molecule * get_active_field_molecule(int a)
retrieve field molecule
field_atom * get_active_atom(int a, int b)
retrieve field atom
field_molecule * duplicate_field_molecule(field_molecule *old_fmol)
create copy of a field molecule
G_MODULE_EXPORT void edit_field_prop(GSimpleAction *action, GVariant *parameter, gpointer data)
edit field property callback
GtkWidget * mol_box[MOLIMIT-1]
void set_mol_num_label()
classical force field prepare the molecule information widget
GtkTreeStore * field_model[MAXDATA]
G_MODULE_EXPORT void changed_mol_box(GtkComboBox *box, gpointer data)
classical force field assistant change the target molecule for the page
void fill_field_model(GtkTreeStore *store, int f, int m)
classical force field fill the tree store
field_molecule * tmp_fmol
GType col_type[MAXDATA][12]
GtkWidget * create_combo_mol(int f)
classical force field create molecule selection combo box
GtkWidget * field_assistant
classical_field * tmp_field
GtkWidget * combo_mol[MOLIMIT-1]
Variable declarations for the creation of the DL_POLY input file(s)
void visualize_object(int id, int jd, int kd)
visualize object and update OpenGL rendering
void find_atom_id_in_field_molecule()
find field atom id in field molecule (fragment multiplicity > 1)
void field_unselect_all()
unselect all atoms
field_molecule * to_remove
G_MODULE_EXPORT void run_remove_molecule_from_field(GtkDialog *rmol, gint response_id, gpointer data)
remove molecule from force field - running the dialog
void set_sensitive_mol(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer sensitivity in the force field molecule selection tree store
G_MODULE_EXPORT void add_molecule_to_field(GSimpleAction *action, GVariant *parameter, gpointer data)
add molecule to force field - creating the dialog
void prepare_atoms_to_merge(field_atom *at, field_molecule *new_mol, field_molecule *old_mol)
update the data for the newly 'merged' field atom
G_MODULE_EXPORT void select_mol(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select field molecule toggle callback
void viz_fragment(field_molecule *fmol, int id, int viz)
show / hide fragment
void molecule_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color in the force field molecule selection tree store
G_MODULE_EXPORT void run_add_molecule_to_field(GtkDialog *dialog, gint response_id, gpointer data)
add molecule to force field - running the dialog
gchar * set_field_atom_name(field_atom *ato, field_molecule *mol)
get name string for field atom
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
void check_to_visualize_properties(int id)
check if it is requried to update rendering
G_MODULE_EXPORT void remove_molecule_from_field(GSimpleAction *action, GVariant *parameter, gpointer data)
remove molecule from force field - creating the dialog
field_atom * new_atom_to_merge(int id, field_molecule *fmol)
merge field atoms from a field molecule
void merge_all_atoms_to_mol(field_molecule *new_mol, int mstart)
merge all field atoms to another field molecule
void clear_field_atoms(field_molecule *fmol, field_atom *at, int mols, int *mol)
clean the field atom from a list of atom(s)
GtkTreeViewColumn * remove_col[5]
gchar * remove_text(int i, int j, gchar *str)
get removal information text
GtkCellRenderer * remove_renderer[5]
void clean_up_molecules_info(gboolean usel)
prepare molecule related widgets in the assistant
gboolean * allocbool(int val)
allocate a gboolean * pointer
int * allocint(int val)
allocate an int * pointer
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 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 destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
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.
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
Messaging function declarations.
integer(kind=c_int) function molecules(frag_and_mol, allbonds)