91extern GtkWidget *
p_box;
99extern G_MODULE_EXPORT
void markup_action_renderer (GtkCellRendererCombo * cell, GtkCellEditable * editable, gchar * path_string, gpointer data);
130 gboolean a_match, b_match;
131 for (i=0; i<nat; i++)
133 if (fpar[i] == -1 || ffc[i] == -1) has_x ++;
135 if (has_x == nat)
return FALSE;
141 j = (i == 0) ? 1 : 0;
142 if (ffc[0] == fpar[i] && ffc[1] == fpar[j])
return TRUE;
143 if (ffc[0] == fpar[i] && has_x)
return TRUE;
144 if (ffc[1] == fpar[i] && has_x)
return TRUE;
149 if (ffc[1] != fpar[1] && fpar[1] != -1 && ffc[1] != -1)
return FALSE;
150 for (i=0; i<3; i=i+2)
153 if (ffc[0] == fpar[i] && ffc[2] == fpar[j])
return TRUE;
154 if (ffc[i] == fpar[i] && (ffc[j] == -1 || fpar[j] == -1))
return TRUE;
155 if (ffc[j] == fpar[i] && (ffc[i] == -1 || fpar[j] == -1))
return TRUE;
160 a_match = b_match = TRUE;
163 if (ffc[i] != fpar[i] && ffc[i] != -1 && fpar[i] != -1)
174 if (ffc[i] != fpar[j] && ffc[i] != -1 && fpar[j] != -1)
183 if (ffc[0] != fpar[0] && ffc[0] != -1 && fpar[0] != -1)
187 else if (ffc[3] != fpar[3] && ffc[3] != -1 && fpar[3] != -1)
193 if ((ffc[1] == fpar[1] || ffc[1] == -1 || fpar[1] == -1) && (ffc[2] == fpar[2] || ffc[2] == -1 || fpar[2] == -1))
197 else if ((ffc[1] == fpar[2] || ffc[1] == -1 || fpar[2] == -1) && (ffc[2] == fpar[1] || ffc[2] == -1 || fpar[1] == -1))
203 if (! a_match && ! b_match)
return FALSE;
262 char * vbdq[4] = {
"k/2",
"r<sub>0</sub>",
"k'/3",
"k''/4"};
263 char * vanq[4] = {
"k/2",
"θ<sub>0</sub>",
"k'/3",
"k''/4"};
264 char * vdwij[2] = {
"Ɛ<sub>i</sub>",
"r0<sub>i</sub>/2.0"};
268 if (newp && (key == 0 || key == 5))
270 vars = (
char **)vbdq;
280 vars = (
char **)vanq;
290 if (newp && (
tmp_field -> type <= CHARMMSI || tmp_field -> type >
COMPASS) && ! calc)
292 vars = (
char **)vdwij;
310 return g_strdup_printf (
"%s pot. (%s)",
fnames[
activef][(sid > 7) ? 10 : sid+2][key],
336 str = g_strdup_printf (
"%s-%s", str, (k < 0) ?
"X" :
ff_atoms[k][2]);
340 str = g_strdup_printf (
"%s", (k < 0) ?
"X" :
ff_atoms[k][2]);
348 if (sid == 8 && calc)
377 new_m ->
id = old_m -> id;
378 new_m -> obj = old_m -> obj;
379 new_m -> oid = old_m -> oid;
380 new_m -> type = old_m -> type;
381 new_m -> use = old_m -> use;
402 if (mbp ->
id == map ->
id && mbp -> obj == map -> obj)
405 if (mbp -> next && mbp -> prev)
407 mbp -> prev -> next = map;
408 map -> prev = mbp -> prev;
409 map -> next = mbp -> next;
410 mbp -> next -> prev = map;
412 else if (mbp -> next)
414 mbp -> next -> prev = map;
415 map -> next = mbp -> next;
417 else if (mbp -> prev)
419 mbp -> prev -> next = map;
420 map -> prev = mbp -> prev;
423 else if (! mbp -> next)
426 map -> prev = mbp -> next;
447 GtkTreeIter prop_level, struct_level;
451 gchar * stra, * strb, * strc, * strd, * stre;
454 g = (i==8) ? i+1 : i;
462 str = g_strdup_printf (
"<b>%s(s)</b> <sup>(2,3)</sup>",
felemts[8+g]);
466 str = g_strdup_printf (
"<b>%s(s)</b> <sup>(2)</sup>",
felemts[8+g]);
473 str = g_strdup_printf (
"<b>%s(s)</b> <sup>(3)</sup>",
felemts[8+g]);
477 str = g_strdup_printf (
"<b>%s(s)</b>",
felemts[8+g]);
482 str = g_strdup_printf (
"<b>%s(s)</b> <sup>(3)</sup>",
felemts[8+i]);
486 str = g_strdup_printf (
"<b>%s(s)</b> <sup>(4)</sup>",
felemts[8+i]);
490 str = g_strdup_printf (
"<b>%s(s)</b>",
felemts[8+i]);
492 gtk_tree_store_append (store, & prop_level, NULL);
493 gtk_tree_store_set (store, & prop_level, 0, -(i+1),
536 stra = g_strdup_printf (
"%s - ""%s""", stra, upat -> name);
537 if (
tmp_match -> obj > 0 && i < 8) strb = g_strdup_printf (
"%s-%d", strb,
tmp_fprop -> aid[j]+1);
542 stra = g_strdup_printf (
"""%s""", upat -> name);
543 if (
tmp_match -> obj > 0 && i < 8) strb = g_strdup_printf (
"%d",
tmp_fprop -> aid[j]+1);
555 strd = g_strdup_printf (
"Select ...");
568 str = g_strdup_printf (
"%s", strb);
573 str = g_strdup_printf (
"%s <sup>(*)</sup>", stra);
575 gtk_tree_store_append (store, & struct_level, & prop_level);
580 gtk_tree_store_set (store, & struct_level, 0, i,
608 GtkTreeStore * store;
610 store = gtk_tree_store_new (1, G_TYPE_STRING);
611 gtk_tree_store_append (store, & iter, NULL);
612 gtk_tree_store_set (store, & iter, 0,
"Select ...", -1);
623 gtk_tree_store_append (store, & iter, NULL);
624 gtk_tree_store_set (store, & iter, 0, str, -1);
630 return gtk_tree_model_filter_new(GTK_TREE_MODEL (store), NULL);
645 gboolean done = FALSE;
656 if (i ==
up.
a && ((i < 8 && other_match ->
id ==
up.
b) || (i == 8 &&
other_match -> obj ==
up.
b)))
661 if (g_strcmp0 (str, the_name) == 0)
691G_MODULE_EXPORT
void changed_update_renderer (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * iter, gpointer data)
696 g_object_get (combo,
"model", & cmodel, NULL);
697 gtk_tree_model_get_value ((GtkTreeModel *)cmodel, iter, 0, &
val);
698 if (gtk_tree_model_get_iter_from_string ((GtkTreeModel *)
update_model, iter, path_string))
700 gchar * str = g_strdup_printf (
"%s", (
char *)g_value_get_string (&
val));
721 GtkTreeModel * tmodel = gtk_tree_view_get_model (GTK_TREE_VIEW(tree));
722 GtkTreeIter update_iter;
724 if (gtk_tree_model_get_iter (tmodel, & update_iter,
path))
726 gtk_tree_model_get (tmodel, & update_iter, 0, &
up.
a, 1, &
up.
b, -1);
727 gtk_tree_model_filter_refilter ((GtkTreeModelFilter *)
prop_to_up);
744void ff_button_event (
double event_x,
double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
759void ff_button_event (GdkEvent * event,
double event_x,
double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
762 if (event_type == GDK_BUTTON_PRESS)
765 GtkTreeViewColumn * column;
769 gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW(
update_tree), event_x, event_y, & e_x, & e_y);
770 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(
update_tree), e_x, e_y, &
path, & column, & i, & j);
772 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(
update_tree), event_x, event_y, &
path, & column, & i, & j);
793G_MODULE_EXPORT
void on_ff_button_pressed (GtkGesture * gesture,
int n_press,
double x,
double y, gpointer data)
795 ff_button_event (
x,
y, gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), GDK_BUTTON_PRESS, gtk_event_controller_get_current_event_time((GtkEventController *)gesture), data);
809G_MODULE_EXPORT
void on_ff_button_released (GtkGesture * gesture,
int n_press,
double x,
double y, gpointer data)
811 ff_button_event (
x,
y, gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), GDK_BUTTON_RELEASE, gtk_event_controller_get_current_event_time((GtkEventController *)gesture), data);
825 GdkEventButton * bevent = (GdkEventButton *)event;
826 ff_button_event (event, bevent ->
x, bevent ->
y, bevent -> button, bevent -> type, bevent -> time, data);
840G_MODULE_EXPORT
void on_toggle_update (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
844 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
846 gtk_tree_model_get (GTK_TREE_MODEL(
update_model), & iter, 7, & i, -1);
848 gtk_tree_model_get (GTK_TREE_MODEL(
update_model), & iter, 5, & str, -1);
876static gboolean update_rend (GtkTreeModel *
model, GtkTreeIter * iter, gpointer data)
881 if (gtk_tree_model_get_iter_first(
model, & upiter))
883 GtkTreePath *
path = gtk_tree_model_get_path(
model, iter);
884 str = gtk_tree_path_to_string(
path);
885 gtk_tree_path_free(
path);
886 if (g_strcmp0 (str,
"0") == 0)
return TRUE;
888 int p = (int)atof(str);
890 if (p > vis.
a && p < vis.
a+vis.
b+1)
return TRUE;
909 i = GPOINTER_TO_INT(data);
910 gtk_tree_model_get (mod, iter, 0, & j, -1);
912 gtk_cell_renderer_set_visible (renderer, (i == 2) ? ! k : k);
913 if ((j < 0 && i == 2) || (j>-1 && i != 7))
916 gtk_tree_model_get (mod, iter, i, & str, -1);
917 g_object_set (renderer,
"markup", str, NULL, NULL);
931 gchar * up_title[
NUCOL]={
" ",
" ",
"Property",
"Atoms",
"Species",
"parameters (1)",
"Actual parameters (1)",
"Update ?"};
932 GType up_type[
NUCOL] = {G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN};
936 for (i=0; i<
NUCOL; i++)
944 str = g_strdup_printf (
"%s", up_title[i]);
951 gtk_tree_model_filter_set_visible_func ((GtkTreeModelFilter *)
prop_to_up, (GtkTreeModelFilterVisibleFunc)G_CALLBACK(update_rend), GTK_TREE_VIEW(
update_tree), NULL);
957 else if (i ==
NUCOL-1)
971 gtk_tree_view_column_set_alignment (
update_col[i], 0.5);
976 for (i=0; i<9; i++)
tmp_res[i] = NULL;
979 GtkTreeSelection * update_select = gtk_tree_view_get_selection (GTK_TREE_VIEW(
update_tree));
980 gtk_tree_selection_set_mode (update_select, GTK_SELECTION_SINGLE);
982 add_widget_gesture_and_key_action (
update_tree,
"ff-button-pressed", G_CALLBACK(on_ff_button_pressed), NULL,
983 "ff-button-released", G_CALLBACK(on_ff_button_released), NULL,
984 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1004 for (i=0; i<
NUCOL; i++)
1009 GtkWidget * scrollsets =
create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
1010 gtk_widget_set_size_request (scrollsets, 800, 400);
1016 gchar * funits[5] ={
"Ev",
"kcal mol<sup>-1</sup>",
"kJ mol<sup>-1</sup>",
"K B<sup>-1</sup>",
"DL_POLY internal units"};
1017 gchar * str = g_strdup_printf (
"\t<b>(*)</b> Each force field element can be tuned separately, if not this <b>default</b> parameters will be used.\n"
1018 "\t<b>(1)</b> %s energy unit: %s, if required conversion to FIELD file energy unit will be performed upon selection.\n"
1019 "\t<b>(2)</b> Restraint parameters are duplicates of the non-restraint parameters.\n",
1024 str = g_strdup_printf (
"%s\t<b>(%d)</b> Urey-Bradley terms provided by the %s force field are ignored.\n", str, i,
field_acro[
tmp_field -> type]);
1029 str = g_strdup_printf (
"%s\t<b>(%d)</b> In %s, 12-6 non-bonded interactions are evaluated using:", str, i,
field_acro[
tmp_field -> type]);
1039 str = g_strdup_printf (
"%s\n<i><b>A</b></i> and <i><b>B</b></i> are calculated using Ɛ<sub>i/j</sub> and r0<sub>i/j</sub> provided by the force field parameters.",
get_this_vdw_string());
1042 str = g_strdup_printf (
"%s\nScaled 1-4 exclusion parameters, provided by the %s force field, are ignored.", str,
field_acro[
tmp_field -> type]);
1047 str = g_strdup_printf (
"%s\n<i><b>A</b></i> and <i><b>B</b></i> are calculated using A<sub>i/j</sub> and B<sub>i/j</sub> provided by the force field parameters.",
get_this_vdw_string());
1122 if (tmpat ->
id !=
tmp_fat ->
id)
1124 if (tmpat -> afid < 0)
1164 for (j=0; j<body -> na[i]; j++)
1166 k = body -> ma[i][j];
1167 l = body ->
a[i][j];
1187 gboolean update_vdw = FALSE;
1188 if (response_id == GTK_RESPONSE_APPLY)
1211 for (l=0; l<
ff_data -> npar; l++)
1225 else if (i/2 == 0 &&
tmp_fprop -> key == 1)
1312 gboolean update_this = FALSE;
1321 if ((i != 4 && i != 5) ||
tmp_field -> type < CFF91 || tmp_field -> type >
COMPASS)
1424 i = gtk_combo_box_get_active (box);
1438 for (j=0; j<
ff_data -> npar; j++)
1447 if (((prop ->
a - 7)/2 == 1 &&
tmp_fprop -> key == 1) || ((prop ->
a - 7)/2 == 1 &&
tmp_fprop -> key == 3))
1452 else if ((prop ->
a - 7)/2 == 0 &&
tmp_fprop -> key == 1)
1479 if (prop ->
a == 15)
1484 i = (prop ->
b) ? 0 : 1;
1497 eij = sqrt(
val[0]*vbl[0]);
1498 rij = (
val[1] + vbl[1]);
1499 vcl[0] = eij * pow((
double) rij, 12.0);
1500 vcl[1] = 2.0 * eij * pow((
double) rij, 6.0);
1509 vcl[0] = sqrt(
val[0]*vbl[0]);
1510 vcl[1] = sqrt(
val[1]*vbl[1]);
1535 int h, i, j, k, l, m, n;
1541 i = (f == 15) ? 2 : 1;
1557 if (g_strcmp0 (str_vdw[0], str_vdw[1]) == 0)
1572 str = g_strdup_printf (
"Atom (1 and 2) <b>%s</b>", str_vdw[j]);
1576 str = g_strdup_printf (
"Atom (%d) <b>%s</b>", j+1, str_vdw[j]);
1582 for (j=0; j<2; j++) g_free (str_vdw[j]);
1625 else if (f == 15 &&
ff_data -> atoms_z[k][0] == spec_z[j])
1636 if (g_strcmp0 (
ff_data -> info[k],
" ") != 0) str = g_strdup_printf (
"%s : %s", str,
ff_data -> info[k]);
1657 GList * cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(
ff_p_combo[j]));
1658 if (cell_list && cell_list -> data)
1660 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(
ff_p_combo[j]), cell_list -> data,
"markup", 0, NULL);
1664 gtk_combo_box_set_active (GTK_COMBO_BOX(
ff_p_combo[j]), n);
integer(kind=c_int) function chemistry()
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
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
field_prop * get_active_prop(struct field_prop *pr, int a)
the field molecule structural property id to retrieve
gchar * get_this_prop_string(int sid, int oid, int type, int calc)
get property name
field_object_match * tmp_res[9]
char * fvars_bond[2][FBONDS][FBONDS_P]
G_MODULE_EXPORT void on_toggle_update(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select field parameter toggle callback
void check_this_fprop(int fsid, int fpid, int ssid, int *fat, int *fsp)
check if the database offers parameters for a field property
void field_set_markup_and_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
field parameter set renderer markup and visibility in the parameter database selection tree model
G_MODULE_EXPORT void markup_action_renderer(GtkCellRendererCombo *cell, GtkCellEditable *editable, gchar *path_string, gpointer data)
add pango markup to a combo box inserted in the cell of a tree view
field_object_match * duplicate_match(field_object_match *old_m)
create a copy of a field match
GtkTreeViewColumn * update_col[NUCOL]
void update_result_list(int sid, field_object_match *new_match)
update avialable parameter list
gchar * felemts[MAXDATA+1]
field_object_match * up_match[9]
dint get_visible(gboolean result, gchar *the_name)
get cell renderer visibility poitner
GtkTreeStore * update_model
char * fvars_inversion[2][FINVERS][FINVERS_P]
G_MODULE_EXPORT void run_check_atom_for_updates(GtkDialog *dialog, gint response_id, gpointer data)
check for parameters in the database to be used in the force field - running the dialog
char * fvars_dihedral[2][FDIHEDRAL][FDIHEDRAL_P]
gchar * get_this_vdw_string()
get VdW formalism description string
char * fvars_angle[2][FANGLES][FANGLES_P]
int get_num_vdw_max()
Get the number of field shell interactions.
void fill_update_model(GtkTreeStore *store)
fill the parameters database tree store
int this_body_has_atom(field_nth_body *body, char *name)
check if non bonded potential has this field atom
gboolean is_this_object_a_match(int fsid, int nat, int *ffc, int *fpar)
check if object matches parameters from the database
void win_update_tree(GtkWidget *vbx)
update the parameters database tree model
GtkCellRenderer * update_renderer[NUCOL]
GtkWidget * create_field_prop_combo(int f, int is_moy)
create field parameter selection combo box
GtkWidget * param_prop_param_box(int pid)
prepare field parameter edition widgets
GtkWidget * field_key_combo
field_data * get_ff_data(int i, int j)
retrieve field property from database
void get_update_tree_data(GtkWidget *tree, gpointer data, GtkTreePath *path)
update force field parameters database tree model data
char * fvars_vdw[2][FVDW][FVDW_P]
void check_atom_for_updates()
check for parameters in the database to be used in the force field - creating the dialog
G_MODULE_EXPORT void changed_update_renderer(GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *iter, gpointer data)
change combo box in tree model callback
gchar * get_this_prop_param(int sid, int key, int calc, int newp, float *val)
prepare field property parameters description string
field_object_match * tmp_match
GtkTreeModel * prop_to_up
G_MODULE_EXPORT gboolean on_ff_button_event(GtkWidget *widget, GdkEvent *event, gpointer data)
mouse button event on the DL-POLY force field parameters database window
field_object_match * other_match
GtkWidget * ff_p_combo[2]
GtkTreeModel * global_render_tree()
create the field property combo box model that contains the list of available parameters
void ff_button_event(GdkEvent *event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
handle mouse button event on the DL-POLY force field parameters database window GTK3
G_MODULE_EXPORT void changed_field_prop_combo(GtkComboBox *box, gpointer data)
change the field parameter selection
gchar * get_body_element_name(field_nth_body *body, int aid, int nbd)
get field body potential element name
void look_up_this_field_object(int fsid, int fpid, int ssid, int nat, int *fsp, int *fat)
look up in database for this field property
GtkWidget * create_update_tree()
create the parameters database tree model
field_nth_body * tmp_fbody
float internal_to_other[5]
gchar * fnames[2][16][21]
int struct_id(int f)
number of atoms in a structural element
gchar * parameters_info(int obj, int key, gchar **words, float *data)
prepare classical force field parameter description string
field_molecule * tmp_fmol
GtkWidget * field_assistant
classical_field * tmp_field
Variable declarations for the creation of the DL_POLY input file(s)
field_data * ff_angles[2]
char * field_acro[N_FIELDS]
float * duplicate_float(int num, float *old_val)
copy a list of float
field_object_match * field_objects_id[6]
field_object_match * tmp_obj_id
int * allocint(int val)
allocate an int * pointer
float * allocfloat(int val)
allocate a float * pointer
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * dialog_cancel_apply(gchar *title, GtkWidget *parent, gboolean resiz)
create a dialog modal offering a choice to apply something or not
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
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)
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
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
#define MAXDATA
Number of tabs for the description of the classical force field.
void show_the_widgets(GtkWidget *widg)
show GtkWidget
void update(glwin *view)
update the rendering of the OpenGL window
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
Function declarations for the creation of the OpenGL window.
gchar * exact_name(gchar *name)
short cut to print string without spaces
Messaging function declarations.