86void set_sensitive_atom (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
89 gtk_tree_model_get (mod, iter, 0, & m, -1);
92 gtk_cell_renderer_set_visible (renderer, FALSE);
96 gtk_cell_renderer_set_visible (renderer, TRUE);
114 gtk_tree_model_get (mod, iter, 3, & j, -1);
115 gtk_tree_model_get (mod, iter, 0, & i, -1);
128G_MODULE_EXPORT
void select_field_atom (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
131 GtkTreeStore **
model = (GtkTreeStore **)data;
133 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
134 gtk_tree_model_get_iter (GTK_TREE_MODEL(*
model), & iter,
path);
135 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
142 gtk_tree_store_set (*
model, & iter, 3, 0, -1);
147 gtk_tree_store_set (*
model, & iter, 3, 1, -1);
148 gtk_tree_model_get (GTK_TREE_MODEL(*
model), & iter, 0, & i, -1);
155 gtk_tree_view_column_set_cell_data_func (
remove_col[3],
158 i = gtk_combo_box_get_active(GTK_COMBO_BOX(
combo_mol[0]));
167 gtk_label_set_use_markup (GTK_LABEL(
remove_label), TRUE);
181 int h, i, j, k, l, m;
187 for (i=0; i < at -> num; i++)
190 for (k=0; k<atos; k++)
192 if (at -> list_id[i] == atid[k])
201 tlist[j] = at -> list[i];
202 dlist[j] = at -> list_id[i];
208 g_free (at -> list_id);
213 l = at -> list_id[i];
247 for (j=0; j<i; j++) aids[j] = olds -> aid[j];
253 if (olds -> aid[j] < oid)
255 aids[j] = olds -> aid[j];
257 else if (olds -> aid[j] > oid)
259 aids[j] = olds -> aid[j] - 1;
297 gboolean done = FALSE;
303 case GTK_RESPONSE_APPLY:
308 str = g_strdup_printf (
"%d atoms have been selected !",
a_ato);
309 str = g_strdup_printf (
"%s\nConfirm this choice and create a new field atom to describe them ?", str);
313 str = g_strdup_printf (
"A single atom has been selected !");
314 str = g_strdup_printf (
"%s\nIs this correct, create a new field atom to describe it ?", str);
320 i = gtk_combo_box_get_active(GTK_COMBO_BOX(
combo_mol[0]));
338 tmp_fbt -> next -> prev = g_malloc (
sizeof*
tmp_fbt -> next -> prev);
383 int sid = GPOINTER_TO_INT (data);
384 gboolean done = FALSE;
393 case GTK_RESPONSE_APPLY:
394 if (sid == 6 || sid == 7)
431 if (sid < 2 || sid > 4)
433 str = g_strdup_printf (
"%d atoms selected !\nIs this correct ?", k);
437 str = g_strdup_printf (
"%d atoms selected !\nOnly a single atom is required !", k);
446 str = g_strdup_printf (
"A single atom selected !\nIs this correct ?");
456 str = g_strdup_printf (
"No atom selected !\nIs this correct ?");
486 for (l=0; l<
tmp_fat -> num; l++)
488 if (
tmp_fat -> list_id[l] == j)
495 else if ((sid > 1 && sid < 6) || sid == 9)
517 else if (sid == 6 || sid == 7)
556 else if (sid > 10 && sid <
SEXTERN)
584 for (j=0; j<to_merge -> num; j++)
586 tmp_ato[j] = to_merge -> list[j];
587 tmp_atd[j] = to_merge -> list_id[j];
588 tmp_fre[j] = to_merge -> frozen_id[j];
591 for (j=to_merge -> num; j<i ; j++)
593 tmp_ato[j] =
to_remove -> list[j - to_merge -> num];
594 tmp_atd[j] =
to_remove -> list_id[j - to_merge -> num];
595 tmp_fre[j] =
to_remove -> frozen_id[j - to_merge -> num];
598 int val_a, val_b, val_c;
604 for (k=j-1; k>-1; k--)
606 if (tmp_atd[k] < val_b)
break;
607 tmp_ato[k+1] = tmp_ato[k];
608 tmp_atd[k+1] = tmp_atd[k];
609 tmp_fre[k+1] = tmp_fre[k];
611 tmp_ato[k+1] = val_a;
612 tmp_atd[k+1] = val_b;
613 tmp_fre[k+1] = val_c;
616 g_free (to_merge -> list);
619 g_free (to_merge -> list_id);
620 to_merge -> list_id =
duplicate_int (to_merge -> num, tmp_atd);
622 g_free (to_merge -> frozen_id);
623 to_merge -> frozen_id =
duplicate_int (to_merge -> num, tmp_fre);
628 for (i=0; i<to_merge -> num; i++)
630 j = to_merge -> list[i];
631 k = to_merge -> list_id[i];
655 gboolean done = FALSE;
659 case GTK_RESPONSE_APPLY:
662 i = gtk_combo_box_get_active(GTK_COMBO_BOX(
combo_mol[0]));
664 str = g_strdup_printf (
"Merging with atom N°%d - %s !\nIs this correct ?",
665 new_at[0]+1, to_merge -> name);
683 tmp_fmol -> first_atom -> prev = NULL;
736 gchar * str = g_strdup_printf (
"Select the field atom to merge atom \"%s\" with",
at_to_remove -> name);
739 gtk_dialog_add_button (GTK_DIALOG(rmol),
"Apply", GTK_RESPONSE_APPLY);
741 GtkWidget * remove_tree = NULL;
744 gchar * mol_title[4] = {
"Id",
"Name",
"Number",
"Viz.3D & Merge with"};
745 gchar * ctype[4] = {
"text",
"text",
"text",
"active"};
746 GType
col_type[4] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN};
750 GtkTreeStore * remove_model = gtk_tree_store_newv (4,
col_type);
751 remove_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(remove_model));
762 gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(
remove_renderer[i]), TRUE);
766 gtk_tree_view_append_column (GTK_TREE_VIEW(remove_tree),
remove_col[i]);
783 gtk_tree_store_append (remove_model, & iter, NULL);
784 gtk_tree_store_set (remove_model, & iter, 0,
tmp_fat ->
id+1,
791 g_object_unref (remove_model);
792 gtk_tree_view_expand_all (GTK_TREE_VIEW(remove_tree));
794 i = ((j+1)*40 < 500) ? (j+1)*40 : 500;
798 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_struct * get_active_struct(int s, int a, int b)
retrieve field structural property
field_atom * get_active_atom(int a, int b)
retrieve field atom
field_nth_body * get_active_body(int a, int b)
retrieve field nth body interaction
G_MODULE_EXPORT void run_remove_atom_from_field_molecule(GtkDialog *rmol, gint response_id, gpointer data)
remove atom from field molecule - running the dialog
void field_unselect_all()
unselect all atoms
GtkTreeViewColumn * ato_col[4]
G_MODULE_EXPORT void remove_atom_from_field_molecule(GSimpleAction *action, GVariant *parameter, gpointer data)
remove atom from field molecule - creating the dialog
void init_all_impropers_inversions(int stru)
initialize all impropers and inversions
G_MODULE_EXPORT void run_add_atom_dialog(GtkDialog *add_dialog, gint response_id, gpointer data)
DL-POLY force field atom selection - running the dialog.
G_MODULE_EXPORT void run_select_atom_dialog(GtkDialog *select_dialog, gint response_id, gpointer data)
DL-POLY force field atom selection - creating the dialog.
void atom_set_color_and_markup(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
field atom set renderer color and markup in the DL-POLY atom(s) selection tree model
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
field_atom * at_to_remove
void compare_non_bonded(gchar *fatom)
compare non bond interaction parameters
void merging_atoms(field_atom *to_merge, field_atom *to_remove, gboolean upda)
merge the field atom to remove with already other field atom
void field_selection(int i, int viz, int lab, int aid)
select / unselect atom
G_MODULE_EXPORT void select_field_atom(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select field atom toggle callback
void set_sensitive_atom(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
field atom set renderer sensitivity in the DL-POLY atom(s) selection tree model
GtkTreeViewColumn * remove_col[5]
GtkCellRenderer * ato_cell[4]
GtkCellRenderer * remove_renderer[5]
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
void adjust_field_struct(int oid, int k, field_struct *olds)
adjust field molecule structural property
void clean_old_atom(field_atom *at, int atos, int *atid)
remove atom list from field atom
field_prop * duplicate_field_prop(field_prop *old_prop, int ti)
create a copy of a field property
void duplicate_other_prop(int oid, field_struct *old_fstr, field_struct *new_fstr)
create copy of a field property 'other' list
field_struct * duplicate_field_struct_list(field_struct *list_str, gboolean init)
create copy of list of field structural element(s)
field_constraint * tmp_fcons
field_nth_body * tmp_fbody
int struct_id(int f)
number of atoms in a structural element
void update_field_trees()
classical force field assistant update all tree models
field_molecule * tmp_fmol
field_tethered * tmp_ftet
GType col_type[MAXDATA][12]
GtkWidget * field_assistant
GtkWidget * combo_mol[MOLIMIT-1]
Variable declarations for the creation of the DL_POLY input file(s)
void clean_field_struct_list(field_struct *stru)
clean force field structural property(ies)
int * duplicate_int(int num, int *old_val)
copy a list of int
int get_struct_id_from_atom_id(int ids, int *aid)
retrieve field structural element id from a list of atom id
gchar * remove_text(int i, int j, gchar *str)
get removal information text
field_atom * init_field_atom(int id, int type, int at, int nat, int coo, int *list)
intialize a new type of field atom
void init_all_field_struct(gboolean init)
initialize the force field structural properties for a field molecule
field_molecule * to_remove
int * allocint(int val)
allocate an int * pointer
float * allocfloat(int val)
allocate a float * 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
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 destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
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.