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\nand merged with the one of the selected molecule."), str);
99 return g_strdup_printf (_(
"The description of molecule <b>%s</b> will be deleted\nand merged with the one of molecule <b>%s</b>"), str,
get_active_field_molecule(i) -> name);
102 return g_strdup_printf (_(
"The description of atom <b>%s</b> will be deleted\n"
103 "and merged with the one of field atom <b>%s</b>\n"
104 "Field object(s) using atom <b>%s</b> will also be deleted\n"
105 "and the force field parameter(s) will be updated accordingly."),
149void set_sensitive_mol (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
152 gtk_tree_model_get (mod, iter, 0, & m, -1);
155 gtk_cell_renderer_set_visible (renderer, FALSE);
159 gtk_cell_renderer_set_visible (renderer, TRUE);
174G_MODULE_EXPORT
void select_mol (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
176 GtkTreeStore **
model = (GtkTreeStore **)data;
178 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
179 gtk_tree_model_get_iter (GTK_TREE_MODEL(*
model), & iter,
path);
180 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
198 gtk_tree_model_get (GTK_TREE_MODEL(*
model), & iter, 0, &
toviz.b, -1);
207 gtk_label_set_use_markup (GTK_LABEL(
remove_label), TRUE);
227 for (i=0; i < at -> num; i++)
230 for (j=0; j < mols; j++)
243 for (i=0; i < at -> num; i++)
246 for (j=0; j < mols; j++)
252 s_list[l] = at -> list_id[i];
253 t_list[l] = at -> frozen_id[i];
254 if (t_list[l]) at -> frozen ++;
261 at -> list_id = NULL;
262 at -> list_id =
allocint (at -> num);
263 at -> frozen_id = NULL;
265 for (i=0; i < at -> num; i++)
267 at -> list[i] = r_list[i];
268 at -> list_id[i] = s_list[i];
269 at -> frozen_id[i] = t_list[i];
271 k = at -> list_id[i];
272 for (l=0; l<mols; l++)
297void molecule_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
300 gtk_tree_model_get (mod, iter,
active_col, & j, -1);
301 gtk_tree_model_get (mod, iter, 0, & i, -1);
317 int * old_mol = NULL;
319 gboolean done = FALSE;
320 gboolean saveit = FALSE;
325 case GTK_RESPONSE_APPLY:
330 str = g_strdup_printf (_(
"Fragments N°%d"),
new_mol[0]+1);
333 for (i=1; i<
a_mol-1; i++)
335 str = g_strdup_printf (
"%s, %d", str,
new_mol[i]+1);
338 str = g_strdup_printf (_(
"%s and %d have been selected !"), str,
new_mol[
a_mol-1]+1);
339 str = g_strdup_printf (_(
"%s\nConfirm this choice and create a new field molecule to describe these fragments ?"), str);
343 str = g_strdup_printf (_(
"Fragment N°%d has been selected !"),
new_mol[0]+1);
344 str = g_strdup_printf (_(
"%s\nConfirm this choice and create a new field molecule to describe this fragment ?"), str);
358 next_fmol -> fragments = NULL;
360 for (i=0; i<
a_mol; i++) next_fmol -> fragments[i] =
new_mol[i];
363 for (i=0; i<next_fmol->
mol -> natoms; i++)
367 tmp_fat = next_fmol -> first_atom;
368 for (i=0; i < next_fmol ->
atoms; i++)
377 for (i=0; i<next_fmol->
mol -> natoms; i++)
380 for (j=0; j<next_fmol ->
multi; j++)
389 for (i=0; i<old_fmol ->
multi; i++)
392 for (j=0; j<
a_mol; j++)
394 if (
new_mol[j] == old_fmol -> fragments[i])
403 old_mol[k] = old_fmol -> fragments[i];
409 for (i=0; i<old_fmol ->
mol -> natoms; i++)
413 tmp_fat = old_fmol -> first_atom;
414 for (i=0; i < old_fmol ->
atoms; i++)
423 for (i=0; i<old_fmol->
mol -> natoms; i++)
426 for (j=0; j<old_fmol ->
multi; j++)
433 old_fmol -> fragments = NULL;
435 for (i=0; i<old_fmol ->
multi; i++) old_fmol -> fragments[i] = old_mol[i];
470 gchar * str = g_strdup_printf (_(
"Please select the fragment(s) of the new molecule"));
473 gtk_dialog_add_button (GTK_DIALOG(amol), _(
"Apply"), GTK_RESPONSE_APPLY);
476 GtkTreeViewColumn * mol_col[2];
477 GtkCellRenderer * mol_cell[2];
478 gchar * mol_title[2] = {
i18n(
"Fragment"),
i18n(
"Viz.3D & Select")};
479 gchar * ctype[2]={
"text",
"active"};
480 GType
col_type[2] = {G_TYPE_INT, G_TYPE_BOOLEAN};
491 mol_cell[i] = gtk_cell_renderer_text_new ();
495 mol_cell[i] = gtk_cell_renderer_toggle_new ();
498 mol_col[i] = gtk_tree_view_column_new_with_attributes (_(mol_title[i]), mol_cell[i], ctype[i], i, NULL);
499 gtk_tree_view_append_column (GTK_TREE_VIEW(
add_tree), mol_col[i]);
500 gtk_tree_view_column_set_alignment (mol_col[i], 0.5);
503 gtk_tree_view_column_set_cell_data_func (mol_col[i], mol_cell[i],
molecule_set_color, NULL, NULL);
512 gtk_tree_store_append (
add_model, & iter, NULL);
513 gtk_tree_store_set (
add_model, & iter, 0,
tmp_fmol -> fragments[i] + 1, 1, 0, -1);
517 gtk_tree_view_expand_all (GTK_TREE_VIEW(
add_tree));
537 int i, j, k, l, m, n;
538 for (i=0; i<fat -> num; i++)
541 k = fat -> list_id[i];
544 fbt -> list[fbt -> num] = j;
545 fbt -> list_id[fbt -> num] = k;
549 if (
new_mol -> fragments[n] == m)
572 int * saved_list =
allocint (at -> num);
573 int * saved_list_id =
allocint (at -> num);
574 int * saved_frozen_id =
allocbool (at -> num);
575 for (j=0; j < at -> num; j++)
577 saved_list[j] = at -> list[j];
578 saved_list_id[j] = at -> list_id[j];
579 saved_frozen_id[j] = at -> frozen_id[j];
583 i *= old_mol ->
multi;
585 at -> list =
allocint (at -> num + i);
586 g_free (at -> list_id);
587 at -> list_id =
allocint (at -> num + i);
588 g_free (at -> frozen_id);
589 at -> frozen_id =
allocbool (at -> num + i);
590 for (j=0; j< at -> num; j++)
592 at -> list[j] = saved_list[j];
593 at -> list_id[j] = saved_list_id[j];
594 at -> frozen_id[j] = saved_frozen_id[j];
597 g_free (saved_list_id);
598 g_free (saved_frozen_id);
612 fat = g_malloc0(
sizeof*fat);
615 fat -> num = fmol ->
mol -> natoms * fmol ->
multi;
618 fbt = fmol -> first_atom;
623 for (j=0; j<fbt -> num; j++)
625 fat -> list[i] = fbt -> list[j];
626 fat -> list_id[i] = fbt -> list_id[j];
646 gboolean done = FALSE;
649 case GTK_RESPONSE_APPLY:
655 for (i=0; i<to_merge ->
multi; i++) old_mol[i] = to_merge -> fragments[i];
656 g_free (to_merge -> fragments);
658 for (i=0; i<to_merge ->
multi; i++) to_merge -> fragments[i] = old_mol[i];
662 to_merge -> fragments[i] =
to_remove -> fragments[i - to_merge ->
multi];
665 for (i=0; i<to_merge ->
mol -> natoms; i++)
668 for (j=0; j<to_merge ->
multi; j++)
682 for (i=0; i<to_merge ->
mol -> natoms; i++)
685 for (j=0; j<to_merge ->
multi; j++)
694 to_merge ->
atoms ++;
695 tmp_fat = to_merge -> first_atom;
696 for (i=0; i < to_merge ->
atoms-1; i++)
705 to_merge ->
atoms --;
710 tmp_field -> first_molecule -> prev = NULL;
753 gchar * str = g_strdup_printf (_(
"Select the molecule to merge molecule \"%s\" with"),
to_remove -> name);
756 gtk_dialog_add_button (GTK_DIALOG(rmol), _(
"Apply"), GTK_RESPONSE_APPLY);
758 GtkWidget * remove_tree = NULL;
761 gchar * mol_title[4] = {
i18n(
"Id."),
i18n(
"Name"),
i18n(
"Multiplicity"),
i18n(
"Viz.3D & Merge with")};
762 gchar * ctype[4]={
"text",
"text",
"text",
"active"};
763 GType
col_type[4] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN};
768 GtkTreeStore * remove_model = gtk_tree_store_newv (4,
col_type);
769 remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
779 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(
remove_renderer[i]), TRUE);
783 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree),
remove_col[i]);
801 gtk_tree_store_append (remove_model, & iter, NULL);
802 gtk_tree_store_set (remove_model, & iter, 0, i+1,
810 g_object_unref (remove_model);
811 gtk_tree_view_expand_all (GTK_TREE_VIEW(remove_tree));
813 i = ((j+1)*40 < 500) ? (j+1)*40 : 500;
817 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.
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
field_molecule * get_active_field_molecule(int a)
retrieve field molecule
field_atom * get_active_atom(int a, int b)
retrieve field atom
GtkTreeViewColumn * remove_col[5]
GtkCellRenderer * remove_renderer[5]
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
gchar * set_field_atom_name(field_atom *ato, field_molecule *mol)
get name string for field atom
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)
gchar * remove_text(int i, int j, gchar *str)
get removal information text
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.
void show_the_widgets(GtkWidget *widg)
show 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)