151 if (asearch ->
object < 0)
return 0;
152 if (asearch -> mode)
return asearch -> object;
155 return (asearch ->
object > 1) ? 2 : asearch -> object;
159 return asearch -> object;
172 if (asearch -> object < 0 || asearch ->
filter < 0)
return 0;
175 return asearch ->
object + asearch ->
filter;
179 return (asearch ->
object > 1) ? 1 + asearch ->
filter : asearch ->
filter;
183 return asearch ->
object + asearch ->
filter;
196 if (asearch -> passivating)
198 return (asearch ->
object > 1) ? TRUE : FALSE;
202 return (asearch ->
object) ? TRUE : FALSE;
216 int j, k, l, m, n, o, p;
222 gboolean dothis, dothat, is_first;
226 int is_clone = (asearch ->
action == 1) ? 1 : 0;
229 int step = this_proj -> modelgl -> anim -> last ->
img ->
step;
231 if (gtk_tree_model_get_iter_first (
atom_model, & iter))
242 gtk_tree_store_set (asearch ->
atom_model, & iter,
TOLAB, this_proj -> modelgl -> anim -> last ->
img -> show_label[is_clone][j], -1);
243 if (gtk_tree_model_iter_children (
atom_model, & child, & iter))
245 dothat = is_first = TRUE;
257 v = this_proj -> modelgl -> atom_win ->
msd[k];
258 if (! is_first && u != v) v = 0.0;
262 m = (l && m) ? 1 : 0;
266 if (this_proj -> modelgl -> atom_win ->
msd[k] > 0.0)
268 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win ->
msd[k]);
272 str = g_strdup_printf (
"Set MSD<sub>max</sub> for ...");
279 dothat = gtk_tree_model_iter_next (
atom_model, & child);
281 asearch ->
pick[j] = m;
286 str = g_strdup_printf (
"For all: MSD<sub>max</sub>= %f", v);
290 str = g_strdup_printf (
"Set MSD<sub>max</sub> for all ...");
298 dothis = gtk_tree_model_iter_next (
atom_model, & iter);
307 if (j > -1 && j <
val)
313 for (m=0; m<this_proj -> natomes; m++)
319 l += (this_proj ->
atoms[
step][m].label[is_clone]) ? 1 : 0;
324 for (m=0; m<this_proj -> natomes; m++)
331 l += (this_proj ->
atoms[
step][m].label[is_clone]) ? 1 : 0;
336 for (m=0; m<this_proj -> natomes; m++)
344 o += this_proj -> coord -> ntg[1][p];
350 l += (this_proj ->
atoms[
step][m].label[is_clone]) ? 1 : 0;
355 gtk_tree_store_set (asearch ->
atom_model, & iter,
TOLAB, (k == l && k != 0) ? 1 : 0, -1);
356 if (gtk_tree_model_iter_children (
atom_model, & child, & iter))
374 v = this_proj -> modelgl -> atom_win ->
msd[k];
375 if (! is_first && u != v) v = 0.0;
379 m = (m && l) ? 1 : 0;
380 o = (o && n) ? 1 : 0;
384 if (this_proj -> modelgl -> atom_win ->
msd[k] > 0.0)
386 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win ->
msd[k]);
390 str = g_strdup_printf (
"Set MSD<sub>max</sub> for ...");
396 dothat = gtk_tree_model_iter_next (
atom_model, & child);
400 asearch ->
pick[j] = (m && o) ? 3 : (o) ? 2 : (m) ? 1 : 0;
404 asearch ->
pick[j] = m;
413 str = g_strdup_printf (
"For all: MSD<sub>max</sub>= %f", v);
417 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", v);
424 str = g_strdup_printf (
"Set MSD<sub>max</sub> for ...");
428 str = g_strdup_printf (
"Set MSD<sub>max</sub> for all ...");
433 if (obj) gtk_tree_store_set (asearch ->
atom_model, & iter,
TOPIC+1, o, -1);
437 dothis = gtk_tree_model_iter_next (
atom_model, & iter);
455 if (i != 5 && this_proj -> modelgl -> search_widg[i] != NULL)
457 if (this_proj -> modelgl -> search_widg[i] ->
atom_model && this_proj -> modelgl -> search_widg[i] -> todo_size < 10000)
479 if (! aid &&
object -> origin == oid)
return object;
480 if (aid &&
object ->
id == aid-1)
return object;
481 object =
object -> next;
501 this_proj -> modelgl -> atom_win -> old_param[asearch ->
status][i][j] = this_proj -> modelgl -> atom_win -> new_param[asearch ->
status][i][j] = 0.0;
525 gboolean adjust_mv = FALSE;
527 if (this_proj -> modelgl -> atom_win -> to_be_moved[mv])
529 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_moved[mv];
531 gboolean remove_it = FALSE;
532 gboolean add_it = FALSE;
535 if (
object ->
id ==
id)
537 if (! asearch -> todo[
id]) remove_it = TRUE;
544 object =
object -> next;
556 if (
object -> ibonds) g_free (
object -> ibonds);
557 if (
object -> baryc) g_free (
object -> baryc);
558 if (
object -> at_list) g_free (
object -> at_list);
559 if (
object -> coord) g_free (
object -> coord);
560 if (
object -> bcid) g_free (
object -> bcid);
562 if (
object -> next &&
object -> prev)
564 object -> prev -> next =
object -> next;
565 object -> next -> prev =
object -> prev;
568 else if (!
object -> prev &&
object -> next)
570 object =
object -> next;
571 object -> prev = NULL;
572 g_free (this_proj -> modelgl -> atom_win -> to_be_moved[mv]);
573 this_proj -> modelgl -> atom_win -> to_be_moved[mv] = object;
575 else if (
object -> prev)
577 object -> prev -> next = NULL;
582 g_free (this_proj -> modelgl -> atom_win -> to_be_moved[mv]);
583 this_proj -> modelgl -> atom_win -> to_be_moved[mv] = NULL;
602 object -> next ->
id = id;
604 this_proj -> modelgl -> atom_win -> rebuilt[mv] = FALSE;
605 object -> next -> prev = object;
624 this_proj -> modelgl -> atom_win -> to_be_moved[mv] ->
id = id;
625 this_proj -> modelgl -> atom_win -> rebuilt[mv] = FALSE;
628 if (adjust_mv && ! mv && this_proj -> modelgl -> atom_win)
motion_to_zero (asearch);
646 int step = this_proj -> modelgl -> anim -> last ->
img ->
step;
648 j = this_proj ->
atoms[0][i].sp;
649 str = g_strdup_printf (
"%s<sub>%d</sub>", this_proj ->
chemistry ->
label[j], i+1);
651 if (aobj == 2) str = g_strdup_printf (
"%s + neighbor(s)", str);
652 gboolean is_clone = (asearch -> pointer[0].c == 1) ? 1 : 0;
653 gtk_tree_store_set (asearch ->
atom_model, atom_level,
IDCOL, i+1, 1,
" ", 2, str,
TOLAB, this_proj ->
atoms[
step][i].
label[is_clone], -1);
656 switch (asearch ->
action)
665 if (asearch -> set_for_all > 0)
667 asearch -> todo[i] = asearch -> set_for_all;
673 k = (asearch -> todo[i] == 1 || asearch -> todo[i] == 3) ? 1 : 0;
674 l = (asearch -> todo[i] == 2 || asearch -> todo[i] == 3) ? 1 : 0;
675 if (this_proj -> modelgl -> atom_win ->
msd[i] > 0.0)
677 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win ->
msd[i]);
681 str = g_strdup_printf (
"Set MSD<sub>max</sub> for ...");
686 gtk_tree_store_set (asearch ->
atom_model, atom_level,
TOPIC+1, l, -1);
691 if (asearch -> set_for_all > 0)
693 asearch -> todo[i] = asearch -> set_for_all;
702 gtk_tree_store_set (asearch ->
atom_model, atom_level,
TOPIC, asearch -> todo[i], -1);
706 gtk_tree_store_set (asearch ->
atom_model, atom_level,
TOPIC+1, (
object) ?
object -> name :
"Select ...",
TOPIC+3, h, -1);
725 if (asearch -> spec == 0 || asearch -> spec == j+1)
727 if (asearch ->
action > 1)
729 if (asearch ->
status == 2)
759 gchar * str_a, * str_b;
760 k = this_proj -> modelgl -> anim -> last ->
img ->
step;
764 if (asearch -> search_digit == -1)
766 if (asearch -> pointer[0].
c == 1)
777 str_a = g_strdup_printf (
"%d", i+1);
778 str_b = g_strdup_printf (
"%d", asearch -> search_digit);
779 if (strlen (str_b) > strlen (str_a))
787 while (k < strlen (str_b))
789 if (str_a[k] != str_b[k])
817 if (init && ! picked)
819 return g_strdup_printf (
"%s",
object -> name);
823 if (g_strcmp0(picked,
object -> name) == 0)
825 return g_strdup_printf (
"%s", picked);
855 str = g_strdup_printf (
"%s", this_proj ->
chemistry ->
label[node]);
859 str = (node) ? g_strdup_printf (
"%d-fold", node) : g_strdup_printf (
"Isolated");
864 for (j=0; j<this_proj -> nspec; j++)
866 i += this_proj -> coord -> ntg[1][j];
870 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[
filter - 1][l];
871 str = g_strdup_printf (
"%s",
env_name(this_proj, node-k, j, 1, NULL));
875 str = g_strdup_printf (
"Fragment N°%d", node+1);
879 str = g_strdup_printf (
"Molecule N°%d", node+1);
881 if (filter < 3 && asearch -> pointer[0].
c == 1) str = g_strdup_printf (
"%s<sup>*</sup>", str);
895 GtkTreeIter spec_level, atom_level;
896 int g, h, i, j, k, l, m, n;
900 gboolean * to_insert;
902 gchar ** picked_names;
905 int step = this_proj -> modelgl -> anim -> last ->
img ->
step;
908 if (asearch -> todo_size >= 10000 && ! asearch -> passivating && ! asearch -> mode)
934 if (asearch -> passivating || (
filter > 2 && obj == 2))
954 picked_names = g_malloc0(
val*
sizeof*picked_names);
955 n = (asearch -> pointer[0].c == 3) ? 0 : 3;
960 for (h=0; h<
val; h++)
963 if (! asearch -> spec || asearch -> spec == h+1)
965 for (i=0; i<this_proj -> natomes; i++)
967 j = this_proj ->
atoms[0][i].sp;
970 to_insert[h] =
append (asearch, this_proj, i, j);
976 get_atomic_object_by_origin (this_proj -> modelgl -> atom_win -> to_be_inserted[n], (asearch -> mode) ? -(h+3) : (asearch -> passivating) ? h : i, 0),
980 if (asearch ->
action !=
REPLACE || n || ! picked_names[h] || asearch -> mode)
break;
988 for (h=0; h<
val; h++)
991 for (i=0; i<this_proj -> natomes; i++)
993 if (this_proj ->
atoms[0][i].numv == h)
995 j = this_proj ->
atoms[0][i].sp;
996 to_insert[h] =
append (asearch, this_proj, i, j);
1002 get_atomic_object_by_origin (this_proj -> modelgl -> atom_win -> to_be_inserted[n], (asearch -> mode) ? -(h+3) : (asearch -> passivating) ? h : i, 0),
1005 if (asearch ->
action !=
REPLACE || n || ! picked_names[h] || asearch -> mode)
break;
1012 if (
val >= 10000 && (obj == 1 || asearch ->
object == 3))
1016 to_insert[0] = TRUE;
1017 picked_names[0] = g_strdup_printf (
"All %s(s)", (
filter == 2) ?
"fragment" :
"molecule");
1022 for (h=0; h<
val; h++)
1025 for (i=0; i<this_proj -> natomes; i++)
1027 if (asearch -> spec == 0 || asearch -> spec == this_proj ->
atoms[0][i].sp + 1)
1032 for (k=0; k<this_proj ->
atoms[0][i].sp; k++) j += this_proj -> coord -> ntg[
filter - 1][k];
1036 to_insert[h] =
append (asearch, this_proj, i, this_proj ->
atoms[0][i].sp);
1039 if (asearch ->
action ==
REPLACE && asearch -> in_selection)
1042 get_atomic_object_by_origin (this_proj -> modelgl -> atom_win -> to_be_inserted[n], (asearch -> mode) ? -(h+3) : (asearch -> passivating) ? h : i, 0),
1045 if (asearch ->
action !=
REPLACE || n || ! picked_names[h] || asearch -> mode)
break;
1056 if (
filter == 3 && this_proj -> coord -> totcoord[2] > 1)
1058 str = g_strdup_printf (
"Fragments");
1059 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1060 if (asearch -> set_for_all > 0) asearch ->
pick[0] = asearch -> set_for_all;
1063 str = g_strdup_printf (
"%d", asearch -> todo[0]);
1065 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+j, str, -1);
1069 if (picked_names[0])
1071 str = g_strdup_printf (
"For all: %s", picked_names[0]);
1072 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, str, -1);
1077 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1081 else if (
filter == 4 && this_proj -> modelfc)
1083 for (k=0; k<this_proj -> modelfc -> mol_by_step[0]; k++)
1085 if (this_proj -> modelfc -> mols[0][k].multiplicity > 1)
1087 str = g_strdup_printf (
"Molecule N°%d", k+1);
1088 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1089 if (asearch -> set_for_all > 0) asearch ->
pick[k] = asearch -> set_for_all;
1092 str = g_strdup_printf (
"%d", asearch -> todo[k]);
1093 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1097 if (picked_names[k])
1099 str = g_strdup_printf (
"For all: %s", picked_names[k]);
1100 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, str, -1);
1105 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1114 for (h=0; h<
val; h++)
1118 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1121 g = (asearch -> pointer[0].c == 3) ? 0 : 1;
1122 this_proj -> modelgl -> atom_win -> replace_nodes[g][h] = gtk_tree_model_get_path (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level);
1125 if (asearch -> set_for_all > 0) asearch ->
pick[h] = asearch -> set_for_all;
1126 if (asearch -> action < RANMOVE || asearch ->
action >
RANMOVE)
1129 if (asearch -> passivating)
1131 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOLAB, asearch ->
lab[h], -1);
1136 asearch -> todo[h] = asearch -> set_for_all;
1139 if (asearch -> mode)
1142 str = g_strdup_printf (
"%d", asearch -> todo[h]);
1148 i = (asearch ->
pick[h] == 1 || asearch ->
pick[h] == 3) ? 1 : 0;
1152 i = (asearch ->
pick[h] == 2 || asearch ->
pick[h] == 3) ? 1 : 0;
1153 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, i, -1);
1154 if (asearch -> set_for_all > 0)
1158 asearch -> todo[h] = asearch -> set_for_all;
1167 if (picked_names[h])
1169 if (asearch -> mode || (obj &&
filter > 2))
1171 str = g_strdup_printf (
"%s", picked_names[h]);
1175 str = g_strdup_printf (
"For all: %s", picked_names[h]);
1177 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, str, -1);
1182 if (asearch -> mode || (obj &&
filter > 2))
1184 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select ...", -1);
1188 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1194 if (this_proj -> modelgl -> atom_win -> msd_all[h] > 0.0)
1198 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[h]);
1202 str = g_strdup_printf (
"For all: MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[h]);
1204 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1211 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2,
"Set MSD<sub>max</sub> for ...", -1);
1215 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2,
"Set MSD<sub>max</sub> for all ...", -1);
1226 doit = (asearch -> passivating) ? FALSE : ! asearch -> mode;
1230 for (i=0; i<this_proj -> natomes; i++)
1233 j = this_proj ->
atoms[0][i].sp;
1236 if (j == h &&
append (asearch, this_proj, i, j)) do_append=TRUE;
1244 m = this_proj -> coord -> geolist[0][j][l];
1245 if (m == h &&
append (asearch, this_proj, i, j)) do_append=TRUE;
1249 if (
filter == 2)
for (m=0; m<j; m++) l += this_proj -> coord -> ntg[1][m];
1250 if (l == h &&
append (asearch, this_proj, i, j)) do_append=TRUE;
1255 gtk_tree_store_append (asearch ->
atom_model, & atom_level, & spec_level);
1272 i = (asearch -> pointer[0].c == 7) ? 2 : 1;
1273 atomic_object * iobj = this_proj -> modelgl -> atom_win -> to_be_inserted[i];
1277 gtk_list_store_append (asearch -> obj_model, & atom_level);
1278 str = g_strdup_printf (
"x= %f, y= %f, z= %f", iobj -> baryc[0], iobj -> baryc[1], iobj -> baryc[2]);
1279 gtk_list_store_set (asearch -> obj_model, & atom_level,
IDCOL, j+1, 1, g_strdup_printf (
"%d", j+1), 2, iobj -> name,
1284 str = g_strdup_printf (
"%f", iobj -> occ);
1285 gtk_list_store_set (asearch -> obj_model, & atom_level,
TOPIC+1, str, -1);
1289 iobj = iobj -> next;
1292 if (asearch -> set_for_all > 0) asearch -> set_for_all = -asearch -> set_for_all;
1295G_MODULE_EXPORT
void move_up_down (GtkTreeModel * tree_model, GtkTreePath *
path, gpointer data);
1307 if (asearch -> pointer[0].
c == 7 && asearch -> obj_model)
1309 g_signal_handler_disconnect (G_OBJECT(GTK_TREE_MODEL(asearch -> obj_model)), asearch ->
filter);
1310 gtk_list_store_clear (asearch -> obj_model);
1311 asearch ->
filter = g_signal_connect_data (G_OBJECT(GTK_TREE_MODEL(asearch -> obj_model)),
"row-deleted", G_CALLBACK(
move_up_down), asearch, NULL, (GConnectFlags) 0);
1316 if (asearch -> obj_model) gtk_list_store_clear (asearch -> obj_model);
1333 if (asearch -> passivating)
1337 else if (! asearch -> passivating && asearch -> todo_size >= 10000)
1341 else if (! (
object &&
filter > 2))
1356G_MODULE_EXPORT
void set_atom (GtkEntry * entry, gpointer data)
1361 gchar * str_a, * str_b;
1362 str_a = g_strdup_printf (
"%s",
entry_get_text (GTK_ENTRY(asearch -> entry_a)));
1363 asearch -> spec_to_add = -1;
1364 for (i = 0; i < this_proj -> nspec; i++)
1367 if (g_strcmp0 (str_a, str_b) == 0)
1369 asearch -> spec_to_add = i;
1374 if (asearch -> spec_to_add != -1)
1356G_MODULE_EXPORT
void set_atom (GtkEntry * entry, gpointer data) {
…}
1398 int i = gtk_combo_box_get_active (GTK_COMBO_BOX(asearch -> atom_box));
1407 set_atom (GTK_ENTRY(asearch -> entry_a), asearch);
1428 if (gtk_tree_model_get_iter (
model, iter,
path))
1430 gtk_tree_model_get (
model, iter,
IDCOL, & i, -1);
1431 if (i == asearch -> int_b)
1433 j = (i > 0) ? i -- : abs(i) - 1;
1434 asearch -> todo[j] = 0;
1437 j = (i > 0) ? i -- : i - 2;
1440 asearch -> in_selection --;
1442 if (gtk_tree_model_iter_parent (
model, & parent, iter))
1444 gtk_tree_store_remove (GTK_TREE_STORE(
model), iter);
1445 if (! gtk_tree_model_iter_has_child(
model, & parent))
1447 gtk_tree_store_remove (GTK_TREE_STORE(
model), & parent);
1451 gtk_tree_path_free (this_proj -> modelgl -> atom_win -> replace_nodes[0][j]);
1452 this_proj -> modelgl -> atom_win -> replace_nodes[0][j] = NULL;
1458 gtk_tree_store_remove (GTK_TREE_STORE(
model), iter);
1496 if (gtk_tree_model_get_iter (
model, iter,
path))
1499 if (
b == asearch -> int_b)
1501 asearch -> was_selected = TRUE;
1502 asearch ->
path = gtk_tree_model_get_path (
model, iter);
1517G_MODULE_EXPORT
void add_atom (GtkButton * but, gpointer data)
1521 GtkTreeIter spec_level, atom_level, new_level;
1523 i = this_proj -> modelgl -> anim -> last ->
img ->
step;
1524 j = asearch -> spec_to_add;
1527 if (! asearch -> mode)
1529 if (
append (asearch, this_proj, -1, j))
1531 asearch -> was_selected = FALSE;
1532 m = asearch -> int_b;
1533 asearch -> int_b = j+1;
1535 if (! asearch -> was_selected)
1543 l = this_proj ->
atoms[i][asearch -> num_to_add].numv;
1547 for (k=0; k<j; k++) l += this_proj -> coord -> ntg[
filter - 1][k];
1553 asearch -> int_b = -(l+1);
1555 asearch -> was_selected = FALSE;
1557 if (! asearch -> was_selected)
1559 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1562 this_proj -> modelgl -> atom_win -> replace_nodes[0][l] = gtk_tree_model_get_path (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level);
1564 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
IDCOL, -(l+1), 1, str, -1);
1565 gtk_tree_store_append (asearch ->
atom_model, & atom_level, & spec_level);
1566 append_to_model (& atom_level, asearch, is_object, l, asearch -> num_to_add, this_proj);
1571 gtk_tree_model_get_iter (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level, asearch ->
path);
1572 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level, & spec_level))
1575 gboolean dothat = TRUE;
1579 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level,
IDCOL, & k, -1);
1580 if (k > asearch -> num_to_add)
1586 dothat = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level);
1590 gtk_tree_store_insert_before (asearch ->
atom_model, & new_level, & spec_level, (
append) ? NULL : & atom_level);
1591 append_to_model (& new_level, asearch, l, is_object, asearch -> num_to_add, this_proj);
1595 asearch -> int_b = m;
1598 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1602 str = g_strdup_printf (
"Set MSD<sub>max</sub> for all ...");
1603 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1517G_MODULE_EXPORT
void add_atom (GtkButton * but, gpointer data) {
…}
1622 GtkTreeIter spec_level, atom_level, new_level;
1624 i = this_proj -> modelgl -> anim -> last ->
img ->
step;
1627 int s_int_b = asearch -> int_b;
1628 for (j=0; j<asearch -> todo_size; j++)
1630 if (asearch -> todo[j])
1632 k = this_proj ->
atoms[i][j].sp;
1633 if (
append (asearch, this_proj, -1, k))
1635 asearch -> was_selected = FALSE;
1642 l = this_proj ->
atoms[i][j].numv;
1646 for (m=0; m<k; m++) l += this_proj -> coord -> ntg[
filter - 1][m];
1652 asearch -> int_b = -(l+1);
1654 if (! asearch -> was_selected)
1657 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1658 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
IDCOL, asearch -> int_b, 1, str, -1);
1661 str = g_strdup_printf (
"Set MSD<sub>max</sub> for all ...");
1662 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1665 gtk_tree_store_append (asearch ->
atom_model, & atom_level, & spec_level);
1671 gtk_tree_model_get_iter (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level, asearch ->
path);
1672 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level, & spec_level))
1675 gboolean dothat = TRUE;
1679 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level,
IDCOL, & k, -1);
1686 dothat = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level);
1690 gtk_tree_store_insert_before (asearch ->
atom_model, & new_level, & spec_level, (
append) ? NULL : & atom_level);
1697 asearch -> int_b = s_int_b;
1708G_MODULE_EXPORT
void set_id (GtkEntry * entry, gpointer data)
1713 if (asearch -> int_b > 0 && asearch -> int_b < this_proj -> natomes+1)
1715 asearch -> was_selected = FALSE;
1717 int s = this_proj -> modelgl -> anim -> last ->
img ->
step;
1718 asearch -> int_b --;
1719 if (asearch -> was_selected && this_proj ->
atoms[s][asearch -> int_b].sp == asearch -> spec_to_add)
1727 if (this_proj ->
atoms[s][asearch -> int_b].sp == asearch -> spec_to_add)
1729 asearch -> num_to_add = asearch -> int_b;
1708G_MODULE_EXPORT
void set_id (GtkEntry * entry, gpointer data) {
…}
1760 i = (
a < 0) ? 0 :
a;
1761 for (j=i; j<this_proj -> natomes; j++)
1763 k = this_proj ->
atoms[0][j].pick[0];
1764 l = this_proj ->
atoms[0][j].sp;
1765 m = this_proj ->
atoms[0][j].label[0];
1766 if (s < 0 || l == s)
1770 if (
a == j ||
a < 0)
1784 asearch -> todo[j] =
status;
1789 switch (asearch -> todo[j])
1792 asearch -> todo[j] += (
c-
TOLAB);
1797 asearch -> todo[j] -= (
c-
TOLAB);
1801 asearch -> todo[j] += (
c-
TOLAB);
1807 asearch -> todo[j] += (
c-
TOLAB);
1811 asearch -> todo[j] -= (
c-
TOLAB);
1815 asearch -> todo[j] -= (
c-
TOLAB);
1844 int k, l, m, n, o, p, q;
1846 int * to_label = NULL;
1847 int is_clone = (asearch ->
action == 1) ? 1 : 0;
1851 GtkTreeModel *
model = (asearch ->
action ==
INSERT) ? GTK_TREE_MODEL(asearch -> obj_model) : GTK_TREE_MODEL(asearch ->
atom_model);
1853 gtk_tree_model_get (
model, & iter, oid, &
status, -1);
1871 k = this_proj -> modelgl -> selection_mode;
1872 this_proj -> modelgl -> selection_mode = object;
1874 p = this_proj -> modelgl -> anim -> last ->
img ->
step;
1875 for (l=0; l<this_proj -> natomes; l++)
1877 n = this_proj ->
atoms[p][l].sp;
1882 if (this_proj ->
atoms[p][l].numv == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1890 o += this_proj -> coord -> ntg[1][m];
1893 if (o == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1913 if (
filter < 3) this_proj -> modelgl -> selection_mode = k;
1923 if (asearch -> pointer[0].
c == 8)
1931 if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
1933 to_label =
allocint (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected);
1936 p = this_proj -> modelgl -> anim -> last ->
img ->
step;
1940 if (asearch -> pointer[0].
c == 8)
1942 if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
1944 selected = this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> first;
1947 if (selected -> sp == sid)
1949 to_label[q] = selected -> id;
1952 selected = selected -> next;
1962 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[is_clone][sid], !
status);
1963 show_hide_labels (this_proj -> modelgl -> ogl_lab[is_clone][sid], & this_proj -> modelgl ->
colorp[is_clone][sid]);
1970 k = this_proj -> modelgl -> selection_mode;
1971 this_proj -> modelgl -> selection_mode = object;
1973 for (l=0; l<this_proj -> natomes; l++)
1975 n = this_proj ->
atoms[p][l].sp;
1980 if (this_proj ->
atoms[p][l].numv == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1988 o += this_proj -> coord -> ntg[1][m];
1991 if (o == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1995 if (asearch -> mode &&
object)
2001 if (o == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
2006 if (asearch -> pointer[0].
c == 8)
2008 if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
2010 selected = this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> first;
2013 if (selected ->
id == l)
2018 selected = selected -> next;
2033 if (
filter < 3) this_proj -> modelgl -> selection_mode = k;
2037 if (asearch -> pointer[0].
c == 8)
2051 this_proj -> modelgl -> create_shaders[
SLABS] = TRUE;
2057 if (asearch -> passivating || (
object &&
filter > 2))
2063 asearch -> todo[sid] += (oid-
TOLAB);
2067 asearch -> todo[sid] -= (oid-
TOLAB);
2073 asearch -> todo[sid] = !
status;
2081 else if (! asearch -> mode)
2086 for (l=0; l<this_proj -> natomes; l++)
2088 n = this_proj ->
atoms[0][l].sp;
2089 if (n == sid &&
append (asearch, this_proj, l, n))
2095 asearch -> todo[l] += (oid-
TOLAB);
2099 asearch -> todo[l] -= (oid-
TOLAB);
2105 asearch -> todo[l] = !
status;
2112 for (l=0; l<this_proj -> natomes; l++)
2114 n = this_proj ->
atoms[0][l].sp;
2115 if (this_proj ->
atoms[0][l].numv == sid &&
append (asearch, this_proj, l, n))
2121 asearch -> todo[l] += (oid-
TOLAB);
2125 asearch -> todo[l] -= (oid-
TOLAB);
2131 asearch -> todo[l] = !
status;
2138 for (l=0; l<this_proj -> natomes; l++)
2140 n = this_proj ->
atoms[0][l].sp;
2144 o += this_proj -> coord -> ntg[1][m];
2146 if (o == sid &&
append (asearch, this_proj, l, n))
2152 asearch -> todo[l] += (oid-
TOLAB);
2156 asearch -> todo[l] -= (oid-
TOLAB);
2162 asearch -> todo[l] = !
status;
2169 for (l=0; l<this_proj -> natomes; l++)
2171 n = this_proj ->
atoms[0][l].sp;
2173 if (o == sid &&
append (asearch, this_proj, l, n))
2179 asearch -> todo[l] += (oid-
TOLAB);
2183 asearch -> todo[l] -= (oid-
TOLAB);
2189 asearch -> todo[l] = !
status;
2201 for (k=0; k<asearch -> in_selection; k++)
2203 asearch -> todo[k] = !
status;
2231 if (asearch -> todo_size < 10000 || asearch -> passivating || (
object == 2 &&
filter > 2))
update_search_tree (asearch);
2251 int sel = this_proj -> modelgl -> selection_mode;
2252 int is_clone = (asearch ->
action == 1) ? 1 : 0;
2253 int object = (asearch -> object) ? 1 : 0;
2254 this_proj -> modelgl -> selection_mode = object;
2255 p = this_proj -> modelgl -> anim -> last ->
img ->
step;
2261 if (asearch -> todo[aid] != new_status || new_status < 0)
2263 status = ! asearch -> todo[aid];
2264 asearch -> todo[aid] =
status;
2267 else if (this_proj ->
atoms[p][aid].
label[is_clone] != new_status || new_status < 0)
2274 status = this_proj ->
atoms[p][aid].label[is_clone];
2279 if (asearch ->
action < 2)
2281 if (this_proj ->
atoms[p][aid].
pick[0] != new_status || new_status < 0)
2295 if (asearch -> todo[aid] != new_status || new_status < 0)
2297 status = ! asearch -> todo[aid];
2305 k = (asearch -> todo[aid] == 1 || asearch -> todo[aid] == 3) ? 1 : 0;
2306 l = (asearch -> todo[aid] == 2 || asearch -> todo[aid] == 3) ? 1 : 0;
2309 if (
object) gtk_tree_store_set (asearch ->
atom_model, & iter,
TOPIC+1, l, -1);
2313 gtk_list_store_set (asearch -> obj_model, & iter, oid,
status, -1);
2320 this_proj -> modelgl -> selection_mode =
sel;
2333G_MODULE_EXPORT
void select_atom (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
2339 atom_search * asearch = this_proj -> modelgl -> search_widg[dat ->
c];
2340 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
2341 GtkTreeModel *
model = (asearch ->
action ==
INSERT) ? GTK_TREE_MODEL(asearch -> obj_model) : GTK_TREE_MODEL(asearch ->
atom_model);
2342 gtk_tree_model_get_iter (
model, & iter,
path);
2343 gtk_tree_model_get (
model, & iter,
IDCOL, & i, -1);
2345 if (this_proj -> modelgl -> atom_win)
2347 this_proj -> modelgl -> atom_win -> rebuilt[(asearch ->
action ==
RANMOVE) ? 1 : 0] = FALSE;
2358 if (asearch -> todo_size >= 10000 && ! asearch -> passivating)
2361 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & iter, dat ->
b, & j, -1);
2362 gtk_tree_store_set (asearch ->
atom_model, & iter, dat ->
b, ! j, -1);
2363 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & child, & iter))
2365 gboolean dothis = TRUE;
2368 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & child,
IDCOL, & k, -1);
2371 dothis = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & child);
2383 update (this_proj -> modelgl);
2333G_MODULE_EXPORT
void select_atom (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data) {
…}
2399 gchar * word, * name;
2402 if (
mol[i].
object != NULL)
2404 if (g_strcmp0 (
mol[i].
object, str) == 0)
2408 return (
int)
mol[i].
Z;
2414 else if (i > 10 && i < 17)
2430 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
2431 if (g_strcmp0 (word, str) == 0)
2445 if (g_strcmp0 (
"Copied data", str) == 0)
2449 if (g_strcmp0 (
"Empty position", str) == 0)
return 120;
2470 for (i=0; i<this_proj -> natomes; i++)
2472 if (this_proj ->
atoms[0][i].sp == sid &&
append (asearch, this_proj, i, this_proj ->
atoms[0][i].sp))
2479 for (i=0; i<this_proj -> natomes; i++)
2481 if (this_proj ->
atoms[0][i].numv == sid)
2483 j = this_proj ->
atoms[0][i].sp;
2484 if (
append (asearch, this_proj, i, j))
2492 for (i=0; i<this_proj -> natomes; i++)
2494 j = this_proj ->
atoms[0][i].sp;
2496 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
2497 if (k == sid &&
append (asearch, this_proj, i, j))
2504 for (i=0; i<this_proj -> natomes; i++)
2506 j = this_proj ->
atoms[0][i].sp;
2508 if (k == sid &&
append (asearch, this_proj, i, j))
2527G_MODULE_EXPORT
void changed_action_renderer (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * iter, gpointer data)
2532 atom_search * asearch = this_proj -> modelgl -> search_widg[dat ->
c];
2535 g_object_get (combo,
"model", & cmodel, NULL);
2536 gtk_tree_model_get_value ((GtkTreeModel *)cmodel, iter, 0, &
val);
2539 GtkTreeModel *
model = (asearch ->
action ==
INSERT) ? GTK_TREE_MODEL(asearch -> obj_model) : GTK_TREE_MODEL(asearch ->
atom_model);
2540 if (gtk_tree_model_get_iter_from_string (
model, iter, path_string))
2542 gtk_tree_model_get (
model, iter,
IDCOL, & h, -1);
2543 gchar * str = g_strdup_printf (
"%s", (
char *)g_value_get_string (&
val));
2548 k = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
2549 if (h > 0 || (
object && ! asearch -> passivating &&
filter > 2) || asearch -> passivating || asearch -> mode)
2554 j = (asearch -> mode) ? h - 2 : abs(h) - 1;
2556 str = (asearch -> mode) ? g_strdup_printf (
"%s",
get_atomic_object_by_origin(this_proj -> modelgl -> atom_win -> to_be_inserted[k], j, 0) -> name) : g_strdup_printf (
"For all: %s",
get_atomic_object_by_origin(this_proj -> modelgl -> atom_win -> to_be_inserted[k], j, 0) -> name);
2562 gtk_tree_store_set (asearch ->
atom_model, iter,
TOPIC+1, (h > 0) ?
"Select ..." :
"Select for all ...", -1);
2570 if (! asearch -> passivating && this_proj -> natomes >= 10000)
2572 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & child, iter))
2577 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & child,
IDCOL, & j, -1);
2581 dothis = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & child);
2584 str = g_strdup_printf (
"For all: %s",
get_atomic_object_by_origin(this_proj -> modelgl -> atom_win -> to_be_inserted[k], j, 0) -> name);
2595 if (! asearch -> passivating && this_proj -> natomes >= 10000)
2597 gtk_tree_store_set (asearch ->
atom_model, iter, 5,
"Select for all ...", -1);
2598 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & child, iter))
2603 gtk_tree_store_set (asearch ->
atom_model, & child,
TOPIC+1,
"Select ...", -1);
2604 dothis = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & child);
2610 gtk_tree_store_set (asearch ->
atom_model, iter, 5,
"Select ...", -1);
2628 GtkTreeIter iter, iter2, iter3;
2629 GtkTreeStore *store;
2631 gchar * name, * word;
2633 store = gtk_tree_store_new (1, G_TYPE_STRING);
2637 gtk_tree_store_append (store, & iter, NULL);
2638 gtk_tree_store_set (store, & iter, 0,
"Select ...", -1);
2644 gtk_tree_store_append (store, & iter, NULL);
2645 gtk_tree_store_set (store, & iter, 0,
mol[i].type, -1);
2647 else if (
mol[i].
object)
2649 gtk_tree_store_append (store, & iter2, & iter);
2650 gtk_tree_store_set (store, & iter2, 0,
mol[i].
object, -1);
2653 gboolean doit = FALSE;
2664 gtk_tree_store_append (store, & iter, NULL);
2665 gtk_tree_store_set (store, & iter, 0,
"Import from project", -1);
2670 gtk_tree_store_append (store, & iter2, & iter);
2672 gtk_tree_store_set (store, & iter2, 0, name, -1);
2675 gtk_tree_store_append (store, & iter3, & iter2);
2676 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
2677 gtk_tree_store_set (store, & iter3, 0, word, -1);
2686 gtk_tree_store_append (store, &iter, NULL);
2687 gtk_tree_store_set (store, & iter, 0,
"Copied data", -1);
2693 gtk_tree_store_append (store, &iter, NULL);
2694 gtk_tree_store_set (store, & iter, 0,
"Empty position", -1);
2697 return GTK_TREE_MODEL (store);
2711void search_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
2714 i = GPOINTER_TO_INT(data);
2716 gtk_tree_model_get (mod, iter,
IDCOL, & j, -1);
2717 gboolean vis = (j < 0 && i == 2) ? FALSE : TRUE;
2718 gtk_cell_renderer_set_visible (renderer, vis);
2719 if (vis && (i < TOLAB || i >
TOPIC))
2722 gtk_tree_model_get (mod, iter, i, & str, -1);
2723 g_object_set (renderer,
"markup", str, NULL, NULL);
2711void search_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data) {
…}
2744 if (v > 0.0 && v<= 1.0)
2763 int ax = GPOINTER_TO_INT (data);
2765 int oid = (
csearch -> pointer[0].c == 5) ? 1 : 2;
2767 object -> baryc[
ax] = v;
2783 int ax = GPOINTER_TO_INT (data);
2790 this_proj -> modelgl -> atom_win ->
msd[
ax-1] = v;
2795 this_proj -> modelgl -> atom_win -> msd_all[
ax] = v;
2804 for (i=0; i<this_proj -> natomes; i++)
2806 if (this_proj ->
atoms[0][i].sp ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2810 for (i=0; i<this_proj -> natomes; i++)
2812 j = this_proj ->
atoms[0][i].sp;
2813 if (this_proj ->
atoms[0][i].numv ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2817 for (i=0; i<this_proj -> natomes; i++)
2819 j = this_proj ->
atoms[0][i].sp;
2821 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
2822 if (k ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2828 for (i=0; i<this_proj -> natomes; i++)
2831 if (j ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2845 v = this_proj -> modelgl -> atom_win ->
msd[
ax-1];
2849 v = this_proj -> modelgl -> atom_win -> msd_all[-
ax-1];
2869 int ax = GPOINTER_TO_INT (data);
2890 csearch = this_proj -> modelgl -> search_widg[cid ->
c];
2893 if (gtk_tree_model_get_iter (
model, & iter, gtk_tree_path_new_from_string (path_string)))
2896 gtk_tree_model_get (
model, & iter,
IDCOL, & h, -1);
2901 GtkWidget * win = gtk_dialog_new ();
2904 gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW(this_proj -> modelgl ->
builder_win -> win));
2908 gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW(this_proj -> modelgl -> atom_win -> win));
2910 gtk_window_set_resizable (GTK_WINDOW (win), FALSE);
2913 gchar * obj[5]={
"atom(s)",
"total coordination(s)",
"partial coordination(s)",
"in fragment",
"in molecule"};
2914 gchar * act[2]={
"Replace",
"Remove"};
2920 str = g_strdup_printf (
"Replace %s randomly", obj[(
object) ?
filter : 0]);
2923 str = g_strdup_printf (
"Remove %s randomly", obj[(
object) ?
filter : 0]);
2926 str = g_strdup_printf (
"Maximum Mean Square Displacement");
2929 i = (
csearch -> pointer[0].c == 5) ? 1 : 2;
2933 str = g_strdup_printf (
"Site occupancy for %s",
prepare_for_title(iobj -> name));
2941 gtk_window_set_title (GTK_WINDOW(win), str);
2943 gtk_window_set_modal (GTK_WINDOW (win), TRUE);
2947 gchar *
axis[3]={
"x",
"y",
"z"};
2948 gchar * nran = NULL;
2955 str = g_strdup_printf (
"Occupancy= ");
2968 str = g_strdup_printf (
"%s =",
axis[i]);
2986 str = g_strdup_printf (
"MSD<sub>max</sub> for %s<sub>%d</sub> + neighbors = ", this_proj ->
chemistry ->
label[j],
atom_to_edit+1);
2999 str = g_strdup_printf (
"MSD<sub>max</sub> for all %s atom(s) = ", this_proj ->
chemistry ->
label[-h-1]);
3004 str = g_strdup_printf (
"MSD<sub>max</sub> for all isolated atom(s) = ");
3008 str = g_strdup_printf (
"MSD<sub>max</sub> for all %d-fold atom(s) + neighbors = ", -h-1);
3012 str = g_strdup_printf (
"MSD<sub>max</sub> for all %d-fold atom(s) = ", -h-1);
3017 for (j=0; j<this_proj -> nspec; j++)
3019 i += this_proj -> coord -> ntg[1][j];
3020 if (i > -h-1)
break;
3023 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
3025 nran =
env_name(this_proj, i, j, 1, NULL);
3028 str = g_strdup_printf (
"MSD<sub>max</sub> for all %s + neighbors = ", nran);
3032 str = g_strdup_printf (
"MSD<sub>max</sub> for all %s = ", nran);
3038 str = g_strdup_printf (
"MSD<sub>max</sub> for fragment N°%d = ", -h);
3042 str = g_strdup_printf (
"MSD<sub>max</sub> for the atom(s) in fragment N°%d = ", -h);
3048 str = g_strdup_printf (
"MSD<sub>max</sub> for molecule N°%d = ", -h);
3052 str = g_strdup_printf (
"MSD<sub>max</sub> for the atom(s) in molecule N°%d = ", -h);
3056 update_entry_double (GTK_ENTRY(entry), this_proj -> modelgl -> atom_win -> msd_all[-h-1]);
3072 nran = g_strdup_printf (
"%s", this_proj ->
chemistry ->
label[-h-1]);
3077 for (i=0; i<this_proj -> natomes; i++)
3084 for (i=0; i<this_proj -> natomes; i++)
3090 nran = g_strdup_printf (
"%d-fold", -h-1);
3094 nran = g_strdup_printf (
"isolated");
3099 for (j=0; j<this_proj -> nspec; j++)
3101 i += this_proj -> coord -> ntg[1][j];
3102 if (i > -h-1)
break;
3105 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
3107 for (k=0; k<this_proj -> natomes; k++)
3109 if (this_proj ->
atoms[0][k].sp == j && this_proj ->
atoms[0][k].coord[1] == i)
3122 max_random = this_proj -> coord -> totcoord[2];
3126 max_random = this_proj -> modelfc -> mols[0][i].multiplicity;
3132 for (k=0; k<this_proj -> natomes; k++)
3134 if (this_proj ->
atoms[0][k].coord[
filter-1] == i)
3139 nran = g_strdup_printf (
"atom(s)");
3150 str = g_strdup_printf (
"%s randomly <i>n</i> <b>fragment(s)</b> in all fragments, <i>n</i>= ", act[
csearch ->
action - 3]);
3154 str = g_strdup_printf (
"%s randomly <i>n</i> <b>fragment(s)</b> in molecule N°%d, <i>n</i>= ", act[
csearch ->
action - 3], -h);
3158 str = g_strdup_printf (
"%s randomly <i>n</i> <b>%s</b> coordinations, <i>n</i>= ", act[
csearch ->
action - 3], nran);
3165 str = g_strdup_printf (
"%s randomly <i>n</i> <b>%s</b> %s, <i>n</i>= ", act[
csearch ->
action - 3], nran, obj[0]);
3169 str = g_strdup_printf (
"%s randomly <i>n</i> <b>%s</b> %s N°%d, <i>n</i>= ", act[
csearch ->
action - 3], nran, obj[
filter], -h);
3172 if (nran) g_free (nran);
3177 str = g_strdup_printf (
" with <i>n</i><sub>max</sub> = <b>%d</b>",
max_random);
3194 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win ->
msd[
atom_to_edit]);
3198 str = g_strdup_printf (
"Set MSD<sub>max</sub> for ...");
3205 if (this_proj -> modelgl -> atom_win -> msd_all[-h-1] > 0.0)
3207 if (
object &&
filter > 2)
3209 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[-h-1]);
3213 str = g_strdup_printf (
"For all: MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[-h-1]);
3220 if (
object &&
filter > 2)
3246G_MODULE_EXPORT
void to_edit_coords (GtkCellRenderer * cell, GtkCellEditable * editable, gchar * path_string, gpointer data)
3246G_MODULE_EXPORT
void to_edit_coords (GtkCellRenderer * cell, GtkCellEditable * editable, gchar * path_string, gpointer data) {
…}
3262G_MODULE_EXPORT
void markup_action_renderer (GtkCellRendererCombo * cell, GtkCellEditable * editable, gchar * path_string, gpointer data)
3264 GtkComboBox * combo = GTK_COMBO_BOX(editable);
3265 GList * cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(combo));
3266 if (cell_list && cell_list -> data)
3268 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell_list -> data,
"markup", 0, NULL);
3262G_MODULE_EXPORT
void markup_action_renderer (GtkCellRendererCombo * cell, GtkCellEditable * editable, gchar * path_string, gpointer data) {
…}
3297 v = this_proj -> modelgl -> atom_win ->
msd[0];
3302 this_proj -> modelgl -> atom_win ->
msd[j] = v;
3307 this_proj -> modelgl -> atom_win -> msd_all[j] = v;
3327 atom_search * asearch = this_proj -> modelgl -> search_widg[dat ->
c];
3328 if (gtk_tree_model_get_iter (
model, iter,
path))
3330 gtk_tree_model_get (
model, iter,
IDCOL, & i, -1);
3331 gtk_tree_store_set (GTK_TREE_STORE(
model), iter, dat ->
b, asearch -> int_b, -1);
3337 else if (asearch ->
object)
3361 csearch = this_proj -> modelgl -> search_widg[dat ->
c];
3366 GtkWidget * win = gtk_dialog_new ();
3367 gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW(this_proj -> modelgl -> atom_win -> win));
3368 gtk_window_set_resizable (GTK_WINDOW (win), FALSE);
3369 gchar * str = g_strdup_printf (
"Maximum Mean Square Displacement");
3370 gtk_window_set_title (GTK_WINDOW(win), str);
3372 gtk_window_set_modal (GTK_WINDOW (win), TRUE);
3377 str = g_strdup_printf (
"MSD<sub>max</sub> for all object(s) = ");
3381 str = g_strdup_printf (
"[Å<sup>2</sup>]");
3393 k = (
csearch -> pointer[0].c == 5) ? 1 : 2;
3394 if (this_proj -> modelgl -> atom_win -> to_be_inserted[k])
3397 for (i=0; i<
csearch -> in_selection; i++)
csearch -> todo[i] = j;
3402 k = this_proj -> modelgl -> anim -> last ->
img ->
step;
3413 for (i=0; i<this_proj -> natomes; i++)
3424 j = ! this_proj ->
atoms[k][i].label[0];
3437 k = this_proj -> modelgl -> anim -> last ->
img ->
step;
3440 j = ! this_proj ->
atoms[k][0].pick[0];
3452 j = (
csearch -> set_for_all < 0) ? 0 : 1;
3457 switch (abs(
csearch -> set_for_all))
3535G_MODULE_EXPORT
void move_up_down (GtkTreeModel * tree_model, GtkTreePath *
path, gpointer data)
3543 int * old_todo =
duplicate_int (asearch -> in_selection, asearch -> todo);
3545 obja -> next = this_proj -> modelgl -> atom_win -> to_be_inserted[2] -> next;
3546 g_free (this_proj -> modelgl -> atom_win -> to_be_inserted[2]);
3548 valid = gtk_tree_model_get_iter_first (tree_model, & iter);
3552 gtk_tree_model_get (tree_model, & iter, 0, & i, -1);
3555 while (objc ->
id != i) objc = objc -> next;
3561 objb = this_proj -> modelgl -> atom_win -> to_be_inserted[2];
3566 objb -> next -> prev = objb;
3567 objb = objb -> next;
3570 asearch -> todo[j] = old_todo[i];
3573 valid = gtk_tree_model_iter_next (tree_model, & iter);
3577 valid = gtk_tree_model_get_iter_first (tree_model, & iter);
3580 gtk_list_store_set (GTK_LIST_STORE(tree_model), & iter,
IDCOL, i+1, 1, g_strdup_printf (
"%d", i+1), -1);
3582 valid = gtk_tree_model_iter_next (tree_model, & iter);
3598 GtkTreeViewColumn * atom_col[5];
3599 GtkCellRenderer * atom_cell[5];
3600 gchar *
ctitle[6][5]={{
"Object",
"Name",
"Label",
"Pick",
" "},
3601 {
"Object",
"Name",
"Label",
"Move",
" "},
3602 {
"Object",
"Name",
"Label",
"Replace",
"By"},
3603 {
"Object",
"Name",
"Label",
"Remove",
" "},
3604 {
"Object",
"Name",
"Insert",
"Position",
"Occupancy"},
3605 {
"Object",
"Name",
"Label",
"Translate",
"Max. MSD"}};
3606 gchar * ctype[3][5]={{
"text",
"text",
"active",
"active",
"text"},
3607 {
"text",
"text",
"active",
"text",
"text"},
3608 {
"text",
"text",
"active",
"active",
"text"}};
3611 if (asearch ->
action ==
INSERT && asearch -> pointer[0].
c == 7) j ++;
3613 GType coltype[3][8] = {{G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT},
3614 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT},
3615 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_INT}};
3618 asearch -> obj_model = gtk_list_store_newv (8, coltype[k]);
3622 asearch ->
atom_model = gtk_tree_store_newv (8, coltype[k]);
3630 asearch -> atom_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(asearch -> obj_model));
3634 asearch -> atom_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(asearch ->
atom_model));
3637 for (i=0; i<4+j; i++)
3642 atom_cell[i] = gtk_cell_renderer_text_new ();
3645 g_object_set (atom_cell[i],
"editable", TRUE, NULL);
3646 g_signal_connect (G_OBJECT(atom_cell[i]),
"editing-started", G_CALLBACK(
to_edit_coords), & asearch -> pointer[i-3]);
3652 atom_cell[i] = gtk_cell_renderer_toggle_new ();
3653 g_signal_connect (G_OBJECT(atom_cell[i]),
"toggled", G_CALLBACK(
select_atom), & asearch -> pointer[i-2]);
3658 atom_cell[i] = gtk_cell_renderer_combo_new ();
3660 g_object_set (atom_cell[i],
"model",
model,
"text-column", 0,
"has-entry", FALSE,
"editable", TRUE, NULL);
3661 g_object_unref (
model);
3662 g_signal_connect (G_OBJECT(atom_cell[i]),
"editing-started", G_CALLBACK(
markup_action_renderer), & asearch -> pointer[i-4]);
3663 g_signal_connect (G_OBJECT(atom_cell[i]),
"changed", G_CALLBACK(
changed_action_renderer), & asearch -> pointer[i-4]);
3665 gtk_cell_renderer_set_fixed_size (atom_cell[i], -1, 25);
3667 atom_col[i] = gtk_tree_view_column_new_with_attributes (
ctitle[(asearch ->
action < 2) ? 0 : asearch ->
action - 1][i], atom_cell[i], ctype[k][i], l+1, NULL);
3668 if (toggle && ! asearch -> passivating)
3670 gtk_tree_view_column_set_clickable (atom_col[i], TRUE);
3671 g_signal_connect (G_OBJECT(atom_col[i]),
"clicked", G_CALLBACK(
select_all_atoms), & asearch -> pointer[l-2]);
3673 gtk_tree_view_append_column(GTK_TREE_VIEW(asearch -> atom_tree), atom_col[i]);
3674 gtk_tree_view_column_set_alignment (atom_col[i], 0.5);
3675 gtk_tree_view_column_set_cell_data_func (atom_col[i], atom_cell[i],
search_set_visible, GINT_TO_POINTER(l), NULL);
3677 if (asearch -> pointer[0].
c == 7)
3679 asearch ->
filter = g_signal_connect_data (G_OBJECT(GTK_TREE_MODEL(asearch -> obj_model)),
"row-deleted", G_CALLBACK(
move_up_down), asearch, NULL, (GConnectFlags) 0);
3680 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(asearch -> atom_tree), TRUE);
3682 return asearch -> atom_tree;
3701 tsize = (asearch -> mode || asearch -> passivating) ? this_proj -> nspec : this_proj -> natomes;
3704 tsize = (asearch -> mode || asearch -> passivating) ? this_proj -> coord -> cmax+1 : this_proj -> natomes;
3707 if (asearch -> mode || asearch -> passivating)
3709 tsize = this_proj -> coord -> totcoord[
filter -1];
3713 tsize = (
object &&
filter > 2) ? this_proj -> coord -> totcoord[
filter -1] : this_proj -> natomes;
3730 asearch -> todo =
allocint (tsize);
3731 asearch -> todo_size = tsize;
3744 if (asearch -> todo) g_free (asearch -> todo);
3747 switch (asearch ->
action)
3750 if (this_proj -> modelgl -> atom_win -> to_be_moved[0])
3752 object = this_proj -> modelgl -> atom_win -> to_be_moved[0];
3753 while (
object -> next)
3755 object =
object -> next;
3756 g_free (
object -> prev);
3759 this_proj -> modelgl -> atom_win -> to_be_moved[0] = NULL;
3763 if (this_proj -> modelgl -> atom_win -> to_be_moved[1])
3765 object = this_proj -> modelgl -> atom_win -> to_be_moved[1];
3766 while (
object -> next)
3768 object =
object -> next;
3769 g_free (
object -> prev);
3772 this_proj -> modelgl -> atom_win -> to_be_moved[1] = NULL;
3774 g_free (this_proj -> modelgl -> atom_win ->
msd);
3775 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (asearch -> todo_size);
3778 if (this_proj -> modelgl -> atom_win -> to_be_inserted[0])
3780 object = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
3781 while (
object -> next)
3783 object =
object -> next;
3784 g_free (
object -> prev);
3787 this_proj -> modelgl -> atom_win -> to_be_inserted[0] = NULL;
3789 asearch -> in_selection = 0;
3811 if (this_proj -> modelgl -> atom_win && clean_msd)
3813 g_free (this_proj -> modelgl -> atom_win -> msd_all);
3814 this_proj -> modelgl -> atom_win -> msd_all =
allocfloat (
val);
3820 int i = (asearch -> pointer[0].c == 3) ? 0 : 1;
3821 if (this_proj -> modelgl -> atom_win)
3823 if (this_proj -> modelgl -> atom_win -> win && this_proj -> modelgl -> atom_win -> replace_nodes[i])
3825 g_free (this_proj -> modelgl -> atom_win -> replace_nodes[i]);
3827 this_proj -> modelgl -> atom_win -> replace_nodes[i] = g_malloc0(
val*
sizeof*this_proj -> modelgl -> atom_win -> replace_nodes[i]);
3843 int i = gtk_combo_box_get_active (box);
3844 asearch -> spec = i;
3856 set_atom (GTK_ENTRY(asearch -> entry_a), asearch);
3872 asearch ->
filter = gtk_combo_box_get_active (box);
3877 if (
object &&
filter > 2)
3879 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> atom_box), 0);
3898 GtkTreeViewColumn * rot_c;
3904 was_object = ((! asearch -> mode && asearch ->
object > 1) || (asearch -> mode && asearch ->
object)) ? 1 : 0;
3905 asearch ->
object = gtk_combo_box_get_active (box);
3907 object = ((! asearch -> mode && asearch ->
object > 1) || (asearch -> mode && asearch ->
object)) ? 1 : 0;
3908 if ((! asearch -> mode && (asearch ->
object == 1 || asearch ->
object == 3)) || (asearch -> mode && asearch ->
object))
3910 if (! asearch -> mode) asearch -> passivating = TRUE;
3916 asearch -> passivating = FALSE;
3917 if (((! asearch -> mode && asearch ->
object == 2) || (asearch -> mode && asearch ->
object)) &&
filter > 2)
3931 was_object = (asearch -> object) ? 1 : 0;
3932 asearch ->
object = gtk_combo_box_get_active (box);
3934 object = (asearch -> object) ? 1 : 0;
3943 rot_c = gtk_tree_view_get_column (GTK_TREE_VIEW(asearch -> atom_tree), 4);
3944 gtk_tree_view_remove_column (GTK_TREE_VIEW(asearch -> atom_tree), rot_c);
3949 gtk_combo_box_text_remove ((GtkComboBoxText *)asearch -> filter_box, 0);
3952 GtkCellRenderer * rot = gtk_cell_renderer_toggle_new ();
3953 g_signal_connect (G_OBJECT(rot),
"toggled", G_CALLBACK(
select_atom), & asearch -> pointer[2]);
3955 rot_c = gtk_tree_view_column_new_with_attributes (
"Rotate", rot,
"active", i, NULL);
3956 gtk_tree_view_column_set_clickable (rot_c, TRUE);
3957 g_signal_connect (G_OBJECT(rot_c),
"clicked", G_CALLBACK(
select_all_atoms), & asearch -> pointer[2]);
3958 gtk_tree_view_column_set_alignment (rot_c, 0.5);
3959 gtk_tree_view_insert_column (GTK_TREE_VIEW(asearch -> atom_tree), rot_c, i-1);
3964 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> filter_box), 0);
3977 int i = 8 - asearch ->
action;
3978 GtkCellRenderer * num = gtk_cell_renderer_text_new ();
3979 g_object_set (num,
"editable", TRUE, NULL);
3980 g_signal_connect (G_OBJECT(num),
"editing-started", G_CALLBACK(
to_edit_coords), & asearch -> pointer[0]);
3981 GtkTreeViewColumn * num_c = gtk_tree_view_column_new_with_attributes (
"Number", num,
"text", i, NULL);
3982 gtk_tree_view_column_set_cell_data_func (num_c, num,
search_set_visible, GINT_TO_POINTER(i), NULL);
3983 gtk_tree_view_append_column(GTK_TREE_VIEW(asearch -> atom_tree), num_c);
3998 asearch -> mode = gtk_combo_box_get_active (box);
4001 if (! asearch -> mode)
4003 GtkTreeViewColumn * num_c;
4004 num_c = gtk_tree_view_get_column (GTK_TREE_VIEW(asearch -> atom_tree), 8 - asearch ->
action);
4005 gtk_tree_view_remove_column (GTK_TREE_VIEW(asearch -> atom_tree), num_c);
4012 if (this_proj -> natomes >= 10000)
4014 if (asearch -> object_box)
4016 if (asearch -> mode)
4018 gtk_combo_box_text_remove ((GtkComboBoxText *)asearch -> object_box, 3);
4019 gtk_combo_box_text_remove ((GtkComboBoxText *)asearch -> object_box, 1);
4023 gtk_combo_box_text_insert ((GtkComboBoxText *)asearch -> object_box, 1, NULL,
"Atom(s): all");
4030 gtk_combo_box_text_remove_all ((GtkComboBoxText *)asearch -> object_box);
4048 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> object_box), 0);
4065 asearch -> search_digit = (int)v;
4066 if (asearch -> search_digit <= 0)
4068 asearch -> search_digit --;
4092 GtkWidget * fixed = gtk_fixed_new ();
4094 gtk_widget_set_size_request (combo, 175, -1);
4095 gtk_fixed_put (GTK_FIXED(fixed), combo, 0, 0);
4110 widg =
bbox (too_box,
"\t Atom species: ");
4111 gtk_widget_set_size_request (widg, 200, -1);
4113 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> entry_a, FALSE, FALSE, 0);
4115 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> img_a, FALSE, FALSE, 5);
4116 widg =
bbox (too_box,
"\t Atom Id: ");
4117 gtk_widget_set_size_request (widg, 200, -1);
4119 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> entry_b, FALSE, FALSE, 0);
4121 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> img_b, FALSE, FALSE, 5);
4126 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, asearch -> but_a, FALSE, FALSE, 75);
4145 i = (nats < 10000) ? 1 : 0;
4146 j = (asearch ->
action == 5) ? 300 : -1;
4147 GtkWidget * selection =
create_layout (j, 390 + (! i)*60 - i*100);
4149 GtkWidget *
hbox, * vvbox;
4151 if (asearch ->
action != 5)
4168 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> object_box), asearch ->
object);
4170 gchar * filters[5]={
"Chemical species",
"Total coordination",
"Partial coordination",
"Fragment",
"Molecule"};
4172 if (this_proj -> modelgl -> adv_bonding[0])
combo_text_append (asearch -> filter_box, filters[3]);
4173 if (this_proj -> modelgl -> adv_bonding[1])
combo_text_append (asearch -> filter_box, filters[4]);
4174 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> filter_box), asearch ->
filter);
4179 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> atom_box), asearch -> spec);
4181 g_signal_connect (G_OBJECT (asearch -> object_box),
"changed", G_CALLBACK(
set_object_changed), asearch);
4182 g_signal_connect (G_OBJECT (asearch -> filter_box),
"changed", G_CALLBACK(
set_filter_changed), asearch);
4183 g_signal_connect (G_OBJECT (asearch -> atom_box),
"changed", G_CALLBACK(
set_spec_changed), asearch);
4185 if (asearch ->
action < 2)
4191 add_box_child_start (GTK_ORIENTATION_VERTICAL, asearch -> info[0], asearch -> id_box, FALSE, FALSE, 0);
4207 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, asearch -> id_box, entry, FALSE, FALSE, 0);
4211 if (asearch ->
action < 2)
4213 lab =
markup_label(
"\t<b>The number of atoms in the model is too large</b>\n"
4214 "\t\t<b>to display and browse the entire list !</b>\n"
4215 "\t<b>You need to search for object(s) manually:</b>", -1, -1, 0.5, 0.5);
4219 lab =
markup_label(
"<b>The number of atoms in the model is too large to display and browse the entire list !</b>\n"
4220 "\t\t\t\t<b>You need to search for object(s) manually:</b>", -1, -1, 0.5, 0.5);
4238 markup_label(
"The search must be performed using species and/or ID.\n"
4239 "Use the filters above to define the object(s) of the search", -1, -1, 0.5, 0.5), FALSE, FALSE, 5);
4245 GtkWidget * scrollsets =
create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
4246 i = (asearch ->
action < 2) ? 0 : 1;
4247 j = (asearch ->
action < 2) ? 1 : 0;
4248 if (asearch ->
action < 2)
4250 gtk_widget_set_size_request (scrollsets, 400+i*100, 270);
4254 gtk_widget_set_size_request (scrollsets, 400+i*100, 290-i*120);
4256 gtk_widget_set_hexpand (scrollsets, TRUE);
Function declarations for the mode edition window.
atomic_object * create_object_from_frag_mol(project *this_proj, int coord, int geo, atom_search *remove)
create object from a fragment or a molecule
atomic_object * create_object_from_species(project *this_proj, int sid, atom_search *remove)
create object from all atom(s) of the same chemical species
int create_object_from_open_project(project *this_proj, int p)
create object from atom(s) of a project opened in the workspace
atomic_object * create_object_from_atom_coordination(project *this_proj, int coord, int aid, atom_search *remove)
create object from an atom and its nearest neighbors
void clean_this_object(int orig, int act, project *this_proj, atom_search *asearch)
clean object data
atomic_object * duplicate_atomic_object(atomic_object *old_obj)
duplicate an insert object
void update_range_and_entry(project *this_proj, int i, int j, int k)
update motion range
int insert_this_project_from_lib(int id, gboolean visible, project *this_proj, atom_search *asearch)
insert object from the library
void to_insert_in_project(int stat, int orig, project *this_proj, atom_search *asearch, gboolean visible)
to insert object in project
void check_motion_interactors(project *this_proj, atom_search *asearch)
add motion check button
GtkFileFilter * filter[NCFORMATS+1]
GtkWidget * builder_win(project *this_proj, gpointer data)
create crystal builder window
G_MODULE_EXPORT void cut_this_slab(GtkButton *but, gpointer data)
cut this slab callback
integer(kind=c_int) function chemistry()
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
gboolean check_it(int i, int j, int k, int l)
test this atom id ?
gchar * ctitle[MAXDATA][12]
int * duplicate_int(int num, int *old_val)
copy a list of int
gboolean * allocbool(int val)
allocate a gboolean * pointer
int * allocint(int val)
allocate an int * pointer
float * allocfloat(int val)
allocate a float * pointer
double string_to_double(gpointer string)
convert string to double
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
G_MODULE_EXPORT void show_hide_labels(GtkWidget *widg, gpointer data)
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
gboolean is_the_widget_visible(GtkWidget *widg)
test if a GtkWidget exist, then return if it is visible or not
GtkWidget * add_vbox_to_layout(GtkWidget *layout, int size_x, int size_y)
Insert a vertical GtkBox in a GtkLatout then send back the GtkBox.
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
void opengl_project_changed(int id)
change the OpenGL project
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
G_MODULE_EXPORT void select_unselect_this_atom(GtkWidget *widg, gpointer data)
select / unselect this atom callback GTK3
GtkWidget * stock_image(const gchar *stock_id)
create a GtkImage for the Gtk database
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
G_MODULE_EXPORT void label_unlabel_atoms(GtkWidget *widg, gpointer data)
label / unlabel a type of atom(s) callback GTK3
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.
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
G_MODULE_EXPORT void select_unselect_atoms(GtkWidget *widg, gpointer data)
select / unselect a type of atom(s) callback GTK3
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
G_MODULE_EXPORT void run_destroy_dialog(GtkDialog *dialog, gint response_id, gpointer data)
to destroy a GtkDialog when the dialog emit the closing signal
GtkWidget * create_layout(int x, int y)
create a GtkLayout / GtkFixed widget
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
GtkWidget * bbox(GtkWidget *box, char *lab)
void update_entry_text(GtkEntry *entry, gchar *text)
update the content of a GtkEntry as string
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void set_image_from_icon_name(GtkWidget *widg, gchar *icon)
set a image from a stock icon name
void combo_text_prepend(GtkWidget *combo, gchar *text)
prepend text in GtkComboBox widget
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
GtkWidget * abox(GtkWidget *box, char *lab, int vspace)
box creating routine, to help design faster elements for the GUI
G_MODULE_EXPORT void label_unlabel_this_atom(GtkWidget *widg, gpointer data)
label / unlabel this atom callback GTK3
atomic_object * copied_object
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
void update(glwin *view)
update the rendering of the OpenGL window
void update_all_selections(glwin *view, int pi)
update the selection data: bonds, angles and dihedrals
void save_all_selections(glwin *view, int pi)
save all selection data
int get_atom_id_from_periodic_table(atom_search *asearch)
get atom Z from selection in the periodic table
gchar * env_name(project *this_proj, int g, int s, int f, GtkTextBuffer *buffer)
ouput the name of a coordination sphere
gchar * exact_name(gchar *name)
short cut to print string without spaces
integer(kind=c_int) function msd(dlt, ndts)
GtkTreeStore * atom_model
GtkTreeModel * replace_combo_tree(gboolean insert, int proj)
replace combo box in the tree view
gboolean atom_is_in_model(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
is this atom already in the tree model if >= 10 000 atoms
void adjust_this_tree_leaf(atom_search *asearch, project *this_proj, int oid, int aid, int new_status, GtkTreeIter iter)
adjust tree leaf (for a single object)
G_MODULE_EXPORT void select_all_atoms(GtkTreeViewColumn *col, gpointer data)
select all element(s) in the tree view column
void motion_to_zero(atom_search *asearch)
reset motion to 0.0
int get_asearch_object(atom_search *asearch)
get the number of object(s) in this atom search
gboolean update_this_search(atom_search *asearch)
test if it is required to update the search tree or not
G_MODULE_EXPORT void to_edit_coords(GtkCellRenderer *cell, GtkCellEditable *editable, gchar *path_string, gpointer data)
to edit data in the atom search tree model
void adjust_object_to_move(project *this_proj, atom_search *asearch, int mv, int id)
adjust atom search parameters for motion cases
gboolean get_asearch_is_object(atom_search *asearch)
get asearch object
void append_to_model(GtkTreeIter *atom_level, atom_search *asearch, gboolean is_object, int h, int i, project *this_proj)
append data to the search tree store
GtkWidget * create_atoms_tree(atom_search *asearch, project *this_proj, int nats)
create atom search tree view
G_MODULE_EXPORT void add_atom(GtkButton *but, gpointer data)
add atom (or object) to the search tree if >= 10 000 atoms
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
atom_selection * preserve_ogl_selection(glwin *view)
copy the atom selection, so that it can be re-used once the input assistant is closed.
GtkWidget * selection_tab(atom_search *asearch, int nats)
create the search widget
G_MODULE_EXPORT void set_occupancy(GtkEntry *res, gpointer data)
set occupancy entry callback
G_MODULE_EXPORT void set_max_msd(GtkEntry *res, gpointer data)
set MSD max entry callback
G_MODULE_EXPORT void select_atom(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
toggle select / unselect object in the atom search tree model
int check_label_numbers(project *this_proj, int types)
check how many atom label(s) are visible
int get_todo_size(atom_search *asearch)
get the size of the atom search selection list
gboolean append(atom_search *asearch, project *this_proj, int i, int j)
test if the atom 'i' of species 'j' must be added to the tree store or not
gchar * adjust_picked(gchar *picked, atomic_object *object, gboolean init)
adjust the name of the replacement object to use for a type of object if any
G_MODULE_EXPORT void set_i_coord(GtkEntry *res, gpointer data)
set insertion coordinate(s) for the object to be inserted entry callback
G_MODULE_EXPORT void set_atom(GtkEntry *entry, gpointer data)
adjust atom search parameters if >= 10 000 atoms
G_MODULE_EXPORT void set_max_msd_for_all(GtkEntry *res, gpointer data)
set the maximum MSD for all atom(s) / object(s) of the search
void update_search_tree(atom_search *asearch)
update search tree
void create_slab_lists(project *this_proj)
prepare slab(s) OpenGL rendering
int get_asearch_num_objects(atom_search *asearch)
the number of type of object(s) in this atom search
G_MODULE_EXPORT void set_filter_changed(GtkComboBox *box, gpointer data)
change the search filter
int get_selected_object_id(gboolean visible, int p, gchar *str, atom_search *asearch)
get the id of the object selected (in contextual menu, or in combo box)
void re_populate_tree_search(atom_search *asearch)
re populate search tree after atom action if >= 10 000 atoms
G_MODULE_EXPORT void remove_atom(GtkButton *but, gpointer data)
remove atom (or object) from the search tree if >= 10 000 atoms
void add_random_column(atom_search *asearch)
add a column to the search tree model for the case of random search
int get_asearch_filter(atom_search *asearch)
get asearch filter
void get_coord_iter_and_edit(gchar *path_string, gpointer data, GtkWidget *widg)
find iter in the tree model using path string, then edit the data
int get_to_be_selected(glwin *view)
find which atom(s) are to be selected
void search_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
show / hide cell renderer, if visible then add or not pango markup
void restore_ogl_selection(glwin *view)
restore a saved atom selection
void fill_atom_model(atom_search *asearch, project *this_proj)
fill atom search tree store
void adjust_search_param(atom_search *asearch, project *this_proj, int a, int s, int c, gboolean status)
adjust parameters for this atom search
void clean_picked_and_labelled(atom_search *asearch, gboolean clean_msd)
initialize atom search data buffers
G_MODULE_EXPORT void set_max_action(GtkEntry *res, gpointer data)
set how many time(s) to re-do the action
GtkWidget * prepare_box_too_much(atom_search *asearch)
if too many atoms, then individual search
void check_all_trees(project *this_proj)
check all search trees
gboolean update_search_model(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
update tree model for each iter
void clear_fields(atom_search *asearch)
clear all search fields if >= 10 000 atoms
void adjust_this_tree_branch(atom_search *asearch, project *this_proj, int oid, int sid, GtkTreeIter iter)
adjust tree branch (for an entire type of object)
gboolean fill_for_action(atom_search *asearch, int i, int j, project *this_proj)
test if the atom 'i' of species 'j' matches requirement(s) to be in the tree store
G_MODULE_EXPORT void set_search_digit(GtkEntry *res, gpointer data)
update search entry
gboolean remove_from_model(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
remove from the tree model
void allocate_todo(atom_search *asearch, int tsize)
allocate the selection list data buffer
gchar * get_node_name(int node, atom_search *asearch, project *this_proj)
get node label in the atom search tree store
void prep_search_box(GtkWidget *vbox, GtkWidget *lab, GtkWidget *combo)
prepare some search widgets
G_MODULE_EXPORT void set_object_changed(GtkComboBox *box, gpointer data)
change the search object
void clean_todo(atom_search *asearch)
clean atom search selection list
G_MODULE_EXPORT void changed_action_renderer(GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *iter, gpointer data)
change combo box in atom search tree model
G_MODULE_EXPORT void set_id(GtkEntry *entry, gpointer data)
set search id if >= 10 000 atoms
void adjust_data_model_to_replace(project *this_proj, atom_search *asearch, int sid, int vid)
adjust the data of the tree model to insert 'vid'
G_MODULE_EXPORT void set_search_mode(GtkComboBox *box, gpointer data)
change search mode
atomic_object * get_atomic_object_by_origin(atomic_object *first, int oid, int aid)
get insert object from a list by id
G_MODULE_EXPORT void move_up_down(GtkTreeModel *tree_model, GtkTreePath *path, gpointer data)
Move row up or down in the tree model using the mouse.
int select_from_library(gboolean visible, project *this_proj, atom_search *asearch)
select object to insert from the library
G_MODULE_EXPORT void set_spec_changed(GtkComboBox *box, gpointer data)
change the search chemical species
void check_tree_for_this_search(project *this_proj, atom_search *asearch)
check, and adjust if needed, the tree construction for this atom search