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)
912 gtk_widget_show (asearch -> info[1]);
916 gtk_widget_hide (asearch -> id_box);
923 gtk_widget_hide (asearch -> info[1]);
929 gtk_widget_hide (asearch -> id_box);
934 if (asearch -> passivating || (
filter > 2 && obj == 2))
938 gtk_widget_hide (asearch -> id_box);
945 gtk_widget_show (asearch -> id_box);
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 for (h=0; h<
val; h++)
1015 for (i=0; i<this_proj -> natomes; i++)
1017 if (asearch -> spec == 0 || asearch -> spec == this_proj ->
atoms[0][i].sp + 1)
1022 for (k=0; k<this_proj ->
atoms[0][i].sp; k++) j += this_proj -> coord -> ntg[
filter - 1][k];
1026 to_insert[h] =
append (asearch, this_proj, i, this_proj ->
atoms[0][i].sp);
1029 if (asearch ->
action ==
REPLACE && asearch -> in_selection)
1032 get_atomic_object_by_origin (this_proj -> modelgl -> atom_win -> to_be_inserted[n], (asearch -> mode) ? -(h+3) : (asearch -> passivating) ? h : i, 0),
1035 if (asearch ->
action !=
REPLACE || n || ! picked_names[h] || asearch -> mode)
break;
1045 if (
filter == 3 && this_proj -> coord -> totcoord[2] > 1)
1047 str = g_strdup_printf (
"Fragments");
1048 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1049 if (asearch -> set_for_all > 0) asearch ->
pick[0] = asearch -> set_for_all;
1052 str = g_strdup_printf (
"%d", asearch -> todo[0]);
1054 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+j, str, -1);
1058 if (picked_names[0])
1060 str = g_strdup_printf (
"For all: %s", picked_names[0]);
1061 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, str, -1);
1066 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1070 else if (
filter == 4 && this_proj -> modelfc)
1072 for (k=0; k<this_proj -> modelfc -> mol_by_step[0]; k++)
1074 if (this_proj -> modelfc -> mols[0][k].multiplicity > 1)
1076 str = g_strdup_printf (
"Molecule N°%d", k+1);
1077 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1078 if (asearch -> set_for_all > 0) asearch ->
pick[k] = asearch -> set_for_all;
1081 str = g_strdup_printf (
"%d", asearch -> todo[k]);
1082 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1086 if (picked_names[k])
1088 str = g_strdup_printf (
"For all: %s", picked_names[k]);
1089 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, str, -1);
1094 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1103 for (h=0; h<
val; h++)
1107 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1110 g = (asearch -> pointer[0].c == 3) ? 0 : 1;
1111 this_proj -> modelgl -> atom_win -> replace_nodes[g][h] = gtk_tree_model_get_path (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level);
1114 if (asearch -> set_for_all > 0) asearch ->
pick[h] = asearch -> set_for_all;
1115 if (asearch -> action < RANMOVE || asearch ->
action >
RANMOVE)
1118 if (asearch -> passivating)
1120 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOLAB, asearch ->
lab[h], -1);
1125 asearch -> todo[h] = asearch -> set_for_all;
1128 if (asearch -> mode)
1131 str = g_strdup_printf (
"%d", asearch -> todo[h]);
1137 i = (asearch ->
pick[h] == 1 || asearch ->
pick[h] == 3) ? 1 : 0;
1141 i = (asearch ->
pick[h] == 2 || asearch ->
pick[h] == 3) ? 1 : 0;
1142 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, i, -1);
1143 if (asearch -> set_for_all > 0)
1147 asearch -> todo[h] = asearch -> set_for_all;
1156 if (picked_names[h])
1158 if (asearch -> mode || (obj &&
filter > 2))
1160 str = g_strdup_printf (
"%s", picked_names[h]);
1164 str = g_strdup_printf (
"For all: %s", picked_names[h]);
1166 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1, str, -1);
1171 if (asearch -> mode || (obj &&
filter > 2))
1173 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select ...", -1);
1177 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1183 if (this_proj -> modelgl -> atom_win -> msd_all[h] > 0.0)
1187 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[h]);
1191 str = g_strdup_printf (
"For all: MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[h]);
1193 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1200 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2,
"Set MSD<sub>max</sub> for ...", -1);
1204 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2,
"Set MSD<sub>max</sub> for all ...", -1);
1215 doit = (asearch -> passivating) ? FALSE : ! asearch -> mode;
1219 for (i=0; i<this_proj -> natomes; i++)
1222 j = this_proj ->
atoms[0][i].sp;
1225 if (j == h &&
append (asearch, this_proj, i, j)) do_append=TRUE;
1233 m = this_proj -> coord -> geolist[0][j][l];
1234 if (m == h &&
append (asearch, this_proj, i, j)) do_append=TRUE;
1238 if (
filter == 2)
for (m=0; m<j; m++) l += this_proj -> coord -> ntg[1][m];
1239 if (l == h &&
append (asearch, this_proj, i, j)) do_append=TRUE;
1244 gtk_tree_store_append (asearch ->
atom_model, & atom_level, & spec_level);
1261 i = (asearch -> pointer[0].c == 7) ? 2 : 1;
1262 atomic_object * iobj = this_proj -> modelgl -> atom_win -> to_be_inserted[i];
1266 gtk_list_store_append (asearch -> obj_model, & atom_level);
1267 str = g_strdup_printf (
"x= %f, y= %f, z= %f", iobj -> baryc[0], iobj -> baryc[1], iobj -> baryc[2]);
1268 gtk_list_store_set (asearch -> obj_model, & atom_level,
IDCOL, j+1, 1, g_strdup_printf (
"%d", j+1), 2, iobj -> name,
1273 str = g_strdup_printf (
"%f", iobj -> occ);
1274 gtk_list_store_set (asearch -> obj_model, & atom_level,
TOPIC+1, str, -1);
1278 iobj = iobj -> next;
1281 if (asearch -> set_for_all > 0) asearch -> set_for_all = -asearch -> set_for_all;
1284G_MODULE_EXPORT
void move_up_down (GtkTreeModel * tree_model, GtkTreePath *
path, gpointer data);
1296 if (asearch -> pointer[0].
c == 7 && asearch -> obj_model)
1298 g_signal_handler_disconnect (G_OBJECT(GTK_TREE_MODEL(asearch -> obj_model)), asearch ->
filter);
1299 gtk_list_store_clear (asearch -> obj_model);
1300 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);
1305 if (asearch -> obj_model) gtk_list_store_clear (asearch -> obj_model);
1322 if (asearch -> passivating)
1326 else if (! asearch -> passivating && asearch -> todo_size >= 10000)
1330 else if (! (
object &&
filter > 2))
1345G_MODULE_EXPORT
void set_atom (GtkEntry * entry, gpointer data)
1350 gchar * str_a, * str_b;
1351 str_a = g_strdup_printf (
"%s",
entry_get_text (GTK_ENTRY(asearch -> entry_a)));
1352 asearch -> spec_to_add = -1;
1353 for (i = 0; i < this_proj -> nspec; i++)
1356 if (g_strcmp0 (str_a, str_b) == 0)
1358 asearch -> spec_to_add = i;
1363 if (asearch -> spec_to_add != -1)
1387 int i = gtk_combo_box_get_active (GTK_COMBO_BOX(asearch -> atom_box));
1396 set_atom (GTK_ENTRY(asearch -> entry_a), asearch);
1417 if (gtk_tree_model_get_iter (
model, iter,
path))
1419 gtk_tree_model_get (
model, iter,
IDCOL, & i, -1);
1420 if (i == asearch -> int_b)
1422 j = (i > 0) ? i -- : abs(i) - 1;
1423 asearch -> todo[j] = 0;
1426 j = (i > 0) ? i -- : i - 2;
1429 asearch -> in_selection --;
1431 if (gtk_tree_model_iter_parent (
model, & parent, iter))
1433 gtk_tree_store_remove (GTK_TREE_STORE(
model), iter);
1434 if (! gtk_tree_model_iter_has_child(
model, & parent))
1436 gtk_tree_store_remove (GTK_TREE_STORE(
model), & parent);
1440 gtk_tree_path_free (this_proj -> modelgl -> atom_win -> replace_nodes[0][j]);
1441 this_proj -> modelgl -> atom_win -> replace_nodes[0][j] = NULL;
1447 gtk_tree_store_remove (GTK_TREE_STORE(
model), iter);
1466 asearch -> int_b = (int )atof(
entry_get_text (GTK_ENTRY(asearch -> entry_b)));
1485 if (gtk_tree_model_get_iter (
model, iter,
path))
1488 if (
b == asearch -> int_b)
1490 asearch -> was_selected = TRUE;
1491 asearch ->
path = gtk_tree_model_get_path (
model, iter);
1506G_MODULE_EXPORT
void add_atom (GtkButton * but, gpointer data)
1510 GtkTreeIter spec_level, atom_level, new_level;
1512 i = this_proj -> modelgl -> anim -> last ->
img ->
step;
1513 j = asearch -> spec_to_add;
1516 if (! asearch -> mode)
1518 if (
append (asearch, this_proj, -1, j))
1520 asearch -> was_selected = FALSE;
1521 m = asearch -> int_b;
1522 asearch -> int_b = j+1;
1524 if (! asearch -> was_selected)
1532 l = this_proj ->
atoms[i][asearch -> num_to_add].numv;
1536 for (k=0; k<j; k++) l += this_proj -> coord -> ntg[
filter - 1][k];
1542 asearch -> int_b = -(l+1);
1544 asearch -> was_selected = FALSE;
1546 if (! asearch -> was_selected)
1548 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1551 this_proj -> modelgl -> atom_win -> replace_nodes[0][l] = gtk_tree_model_get_path (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level);
1553 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
IDCOL, -(l+1), 1, str, -1);
1554 gtk_tree_store_append (asearch ->
atom_model, & atom_level, & spec_level);
1555 append_to_model (& atom_level, asearch, is_object, l, asearch -> num_to_add, this_proj);
1560 gtk_tree_model_get_iter (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level, asearch ->
path);
1561 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level, & spec_level))
1564 gboolean dothat = TRUE;
1568 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level,
IDCOL, & k, -1);
1569 if (k > asearch -> num_to_add)
1575 dothat = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level);
1579 gtk_tree_store_insert_before (asearch ->
atom_model, & new_level, & spec_level, (
append) ? NULL : & atom_level);
1580 append_to_model (& new_level, asearch, l, is_object, asearch -> num_to_add, this_proj);
1584 asearch -> int_b = m;
1587 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+1,
"Select for all ...", -1);
1591 str = g_strdup_printf (
"Set MSD<sub>max</sub> for all ...");
1592 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1611 GtkTreeIter spec_level, atom_level, new_level;
1613 i = this_proj -> modelgl -> anim -> last ->
img ->
step;
1616 int s_int_b = asearch -> int_b;
1617 for (j=0; j<asearch -> todo_size; j++)
1619 if (asearch -> todo[j])
1621 k = this_proj ->
atoms[i][j].sp;
1622 if (
append (asearch, this_proj, -1, k))
1624 asearch -> was_selected = FALSE;
1631 l = this_proj ->
atoms[i][j].numv;
1635 for (m=0; m<k; m++) l += this_proj -> coord -> ntg[
filter - 1][m];
1641 asearch -> int_b = -(l+1);
1643 if (! asearch -> was_selected)
1646 gtk_tree_store_append (asearch ->
atom_model, & spec_level, NULL);
1647 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
IDCOL, asearch -> int_b, 1, str, -1);
1650 str = g_strdup_printf (
"Set MSD<sub>max</sub> for all ...");
1651 gtk_tree_store_set (asearch ->
atom_model, & spec_level,
TOPIC+2, str, -1);
1654 gtk_tree_store_append (asearch ->
atom_model, & atom_level, & spec_level);
1660 gtk_tree_model_get_iter (GTK_TREE_MODEL(asearch ->
atom_model), & spec_level, asearch ->
path);
1661 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level, & spec_level))
1664 gboolean dothat = TRUE;
1668 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level,
IDCOL, & k, -1);
1675 dothat = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & atom_level);
1679 gtk_tree_store_insert_before (asearch ->
atom_model, & new_level, & spec_level, (
append) ? NULL : & atom_level);
1686 asearch -> int_b = s_int_b;
1697G_MODULE_EXPORT
void set_id (GtkEntry * entry, gpointer data)
1701 asearch -> int_b = (int )atof(
entry_get_text (GTK_ENTRY(asearch -> entry_b)));
1702 if (asearch -> int_b > 0 && asearch -> int_b < this_proj -> natomes+1)
1704 asearch -> was_selected = FALSE;
1706 int s = this_proj -> modelgl -> anim -> last ->
img ->
step;
1707 asearch -> int_b --;
1708 if (asearch -> was_selected && this_proj ->
atoms[s][asearch -> int_b].sp == asearch -> spec_to_add)
1716 if (this_proj ->
atoms[s][asearch -> int_b].sp == asearch -> spec_to_add)
1718 asearch -> num_to_add = asearch -> int_b;
1749 i = (
a < 0) ? 0 :
a;
1750 for (j=i; j<this_proj -> natomes; j++)
1752 k = this_proj ->
atoms[0][j].pick[0];
1753 l = this_proj ->
atoms[0][j].sp;
1754 m = this_proj ->
atoms[0][j].label[0];
1755 if (s < 0 || l == s)
1759 if (
a == j ||
a < 0)
1773 asearch -> todo[j] =
status;
1778 switch (asearch -> todo[j])
1781 asearch -> todo[j] += (
c-
TOLAB);
1786 asearch -> todo[j] -= (
c-
TOLAB);
1790 asearch -> todo[j] += (
c-
TOLAB);
1796 asearch -> todo[j] += (
c-
TOLAB);
1800 asearch -> todo[j] -= (
c-
TOLAB);
1804 asearch -> todo[j] -= (
c-
TOLAB);
1833 int k, l, m, n, o, p, q;
1835 int * to_label = NULL;
1836 int is_clone = (asearch ->
action == 1) ? 1 : 0;
1840 GtkTreeModel *
model = (asearch ->
action ==
INSERT) ? GTK_TREE_MODEL(asearch -> obj_model) : GTK_TREE_MODEL(asearch ->
atom_model);
1842 gtk_tree_model_get (
model, & iter, oid, &
status, -1);
1860 k = this_proj -> modelgl -> selection_mode;
1861 this_proj -> modelgl -> selection_mode = object;
1863 p = this_proj -> modelgl -> anim -> last ->
img ->
step;
1864 for (l=0; l<this_proj -> natomes; l++)
1866 n = this_proj ->
atoms[p][l].sp;
1871 if (this_proj ->
atoms[p][l].numv == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1879 o += this_proj -> coord -> ntg[1][m];
1882 if (o == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1902 if (
filter < 3) this_proj -> modelgl -> selection_mode = k;
1912 if (asearch -> pointer[0].
c == 8)
1920 if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
1922 to_label =
allocint (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected);
1925 p = this_proj -> modelgl -> anim -> last ->
img ->
step;
1929 if (asearch -> pointer[0].
c == 8)
1931 if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
1933 selected = this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> first;
1936 if (selected -> sp == sid)
1938 to_label[q] = selected -> id;
1941 selected = selected -> next;
1951 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[is_clone][sid], !
status);
1952 show_hide_labels (this_proj -> modelgl -> ogl_lab[is_clone][sid], & this_proj -> modelgl ->
colorp[is_clone][sid]);
1959 k = this_proj -> modelgl -> selection_mode;
1960 this_proj -> modelgl -> selection_mode = object;
1962 for (l=0; l<this_proj -> natomes; l++)
1964 n = this_proj ->
atoms[p][l].sp;
1969 if (this_proj ->
atoms[p][l].numv == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1977 o += this_proj -> coord -> ntg[1][m];
1980 if (o == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1984 if (asearch -> mode &&
object)
1990 if (o == sid &&
append (asearch, this_proj, l, n)) doit = TRUE;
1995 if (asearch -> pointer[0].
c == 8)
1997 if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
1999 selected = this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> first;
2002 if (selected ->
id == l)
2007 selected = selected -> next;
2022 if (
filter < 3) this_proj -> modelgl -> selection_mode = k;
2026 if (asearch -> pointer[0].
c == 8)
2040 this_proj -> modelgl -> create_shaders[
SLABS] = TRUE;
2046 if (asearch -> passivating || (
object &&
filter > 2))
2052 asearch -> todo[sid] += (oid-
TOLAB);
2056 asearch -> todo[sid] -= (oid-
TOLAB);
2062 asearch -> todo[sid] = !
status;
2070 else if (! asearch -> mode)
2075 for (l=0; l<this_proj -> natomes; l++)
2077 n = this_proj ->
atoms[0][l].sp;
2078 if (n == sid &&
append (asearch, this_proj, l, n))
2084 asearch -> todo[l] += (oid-
TOLAB);
2088 asearch -> todo[l] -= (oid-
TOLAB);
2094 asearch -> todo[l] = !
status;
2101 for (l=0; l<this_proj -> natomes; l++)
2103 n = this_proj ->
atoms[0][l].sp;
2104 if (this_proj ->
atoms[0][l].numv == sid &&
append (asearch, this_proj, l, n))
2110 asearch -> todo[l] += (oid-
TOLAB);
2114 asearch -> todo[l] -= (oid-
TOLAB);
2120 asearch -> todo[l] = !
status;
2127 for (l=0; l<this_proj -> natomes; l++)
2129 n = this_proj ->
atoms[0][l].sp;
2133 o += this_proj -> coord -> ntg[1][m];
2135 if (o == sid &&
append (asearch, this_proj, l, n))
2141 asearch -> todo[l] += (oid-
TOLAB);
2145 asearch -> todo[l] -= (oid-
TOLAB);
2151 asearch -> todo[l] = !
status;
2158 for (l=0; l<this_proj -> natomes; l++)
2160 n = this_proj ->
atoms[0][l].sp;
2162 if (o == sid &&
append (asearch, this_proj, l, n))
2168 asearch -> todo[l] += (oid-
TOLAB);
2172 asearch -> todo[l] -= (oid-
TOLAB);
2178 asearch -> todo[l] = !
status;
2190 for (k=0; k<asearch -> in_selection; k++)
2192 asearch -> todo[k] = !
status;
2220 if (asearch -> todo_size < 10000 || asearch -> passivating || (
object == 2 &&
filter > 2))
update_search_tree (asearch);
2240 int sel = this_proj -> modelgl -> selection_mode;
2241 int is_clone = (asearch ->
action == 1) ? 1 : 0;
2242 int object = (asearch -> object) ? 1 : 0;
2243 this_proj -> modelgl -> selection_mode = object;
2244 p = this_proj -> modelgl -> anim -> last ->
img ->
step;
2250 if (asearch -> todo[aid] != new_status || new_status < 0)
2252 status = ! asearch -> todo[aid];
2253 asearch -> todo[aid] =
status;
2256 else if (this_proj ->
atoms[p][aid].
label[is_clone] != new_status || new_status < 0)
2263 status = this_proj ->
atoms[p][aid].label[is_clone];
2268 if (asearch ->
action < 2)
2270 if (this_proj ->
atoms[p][aid].
pick[0] != new_status || new_status < 0)
2284 if (asearch -> todo[aid] != new_status || new_status < 0)
2286 status = ! asearch -> todo[aid];
2294 k = (asearch -> todo[aid] == 1 || asearch -> todo[aid] == 3) ? 1 : 0;
2295 l = (asearch -> todo[aid] == 2 || asearch -> todo[aid] == 3) ? 1 : 0;
2298 if (
object) gtk_tree_store_set (asearch ->
atom_model, & iter,
TOPIC+1, l, -1);
2302 gtk_list_store_set (asearch -> obj_model, & iter, oid,
status, -1);
2309 this_proj -> modelgl -> selection_mode =
sel;
2322G_MODULE_EXPORT
void select_atom (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
2328 atom_search * asearch = this_proj -> modelgl -> search_widg[dat ->
c];
2329 GtkTreePath *
path = gtk_tree_path_new_from_string (string_path);
2330 GtkTreeModel *
model = (asearch ->
action ==
INSERT) ? GTK_TREE_MODEL(asearch -> obj_model) : GTK_TREE_MODEL(asearch ->
atom_model);
2331 gtk_tree_model_get_iter (
model, & iter,
path);
2332 gtk_tree_model_get (
model, & iter,
IDCOL, & i, -1);
2334 if (this_proj -> modelgl -> atom_win)
2336 this_proj -> modelgl -> atom_win -> rebuilt[(asearch ->
action ==
RANMOVE) ? 1 : 0] = FALSE;
2347 if (asearch -> todo_size >= 10000 && ! asearch -> passivating)
2350 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & iter, dat ->
b, & j, -1);
2351 gtk_tree_store_set (asearch ->
atom_model, & iter, dat ->
b, ! j, -1);
2352 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & child, & iter))
2354 gboolean dothis = TRUE;
2357 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & child,
IDCOL, & k, -1);
2360 dothis = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & child);
2372 update (this_proj -> modelgl);
2388 gchar * word, * name;
2391 if (
mol[i].
object != NULL)
2393 if (g_strcmp0 (
mol[i].
object, str) == 0)
2397 return (
int)
mol[i].
Z;
2403 else if (i > 10 && i < 17)
2419 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
2420 if (g_strcmp0 (word, str) == 0)
2434 if (g_strcmp0 (
"Copied data", str) == 0)
2438 if (g_strcmp0 (
"Empty position", str) == 0)
return 120;
2459 for (i=0; i<this_proj -> natomes; i++)
2461 if (this_proj ->
atoms[0][i].sp == sid &&
append (asearch, this_proj, i, this_proj ->
atoms[0][i].sp))
2468 for (i=0; i<this_proj -> natomes; i++)
2470 if (this_proj ->
atoms[0][i].numv == sid)
2472 j = this_proj ->
atoms[0][i].sp;
2473 if (
append (asearch, this_proj, i, j))
2481 for (i=0; i<this_proj -> natomes; i++)
2483 j = this_proj ->
atoms[0][i].sp;
2485 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
2486 if (k == sid &&
append (asearch, this_proj, i, j))
2493 for (i=0; i<this_proj -> natomes; i++)
2495 j = this_proj ->
atoms[0][i].sp;
2497 if (k == sid &&
append (asearch, this_proj, i, j))
2516G_MODULE_EXPORT
void changed_action_renderer (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * iter, gpointer data)
2521 atom_search * asearch = this_proj -> modelgl -> search_widg[dat ->
c];
2524 g_object_get (combo,
"model", & cmodel, NULL);
2525 gtk_tree_model_get_value ((GtkTreeModel *)cmodel, iter, 0, &
val);
2528 GtkTreeModel *
model = (asearch ->
action ==
INSERT) ? GTK_TREE_MODEL(asearch -> obj_model) : GTK_TREE_MODEL(asearch ->
atom_model);
2529 if (gtk_tree_model_get_iter_from_string (
model, iter, path_string))
2531 gtk_tree_model_get (
model, iter,
IDCOL, & h, -1);
2532 gchar * str = g_strdup_printf (
"%s", (
char *)g_value_get_string (&
val));
2537 k = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
2538 if (h > 0 || (
object && ! asearch -> passivating &&
filter > 2) || asearch -> passivating || asearch -> mode)
2543 j = (asearch -> mode) ? h - 2 : abs(h) - 1;
2545 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);
2551 gtk_tree_store_set (asearch ->
atom_model, iter,
TOPIC+1, (h > 0) ?
"Select ..." :
"Select for all ...", -1);
2559 if (! asearch -> passivating && this_proj -> natomes >= 10000)
2561 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & child, iter))
2566 gtk_tree_model_get (GTK_TREE_MODEL(asearch ->
atom_model), & child,
IDCOL, & j, -1);
2570 dothis = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & child);
2573 str = g_strdup_printf (
"For all: %s",
get_atomic_object_by_origin(this_proj -> modelgl -> atom_win -> to_be_inserted[k], j, 0) -> name);
2584 if (! asearch -> passivating && this_proj -> natomes >= 10000)
2586 gtk_tree_store_set (asearch ->
atom_model, iter, 5,
"Select for all ...", -1);
2587 if (gtk_tree_model_iter_children (GTK_TREE_MODEL(asearch ->
atom_model), & child, iter))
2592 gtk_tree_store_set (asearch ->
atom_model, & child,
TOPIC+1,
"Select ...", -1);
2593 dothis = gtk_tree_model_iter_next (GTK_TREE_MODEL(asearch ->
atom_model), & child);
2599 gtk_tree_store_set (asearch ->
atom_model, iter, 5,
"Select ...", -1);
2617 GtkTreeIter iter, iter2, iter3;
2618 GtkTreeStore *store;
2620 gchar * name, * word;
2622 store = gtk_tree_store_new (1, G_TYPE_STRING);
2626 gtk_tree_store_append (store, & iter, NULL);
2627 gtk_tree_store_set (store, & iter, 0,
"Select ...", -1);
2633 gtk_tree_store_append (store, & iter, NULL);
2634 gtk_tree_store_set (store, & iter, 0,
mol[i].type, -1);
2636 else if (
mol[i].
object)
2638 gtk_tree_store_append (store, & iter2, & iter);
2639 gtk_tree_store_set (store, & iter2, 0,
mol[i].
object, -1);
2642 gboolean doit = FALSE;
2653 gtk_tree_store_append (store, & iter, NULL);
2654 gtk_tree_store_set (store, & iter, 0,
"Import from project", -1);
2659 gtk_tree_store_append (store, & iter2, & iter);
2661 gtk_tree_store_set (store, & iter2, 0, name, -1);
2664 gtk_tree_store_append (store, & iter3, & iter2);
2665 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
2666 gtk_tree_store_set (store, & iter3, 0, word, -1);
2675 gtk_tree_store_append (store, &iter, NULL);
2676 gtk_tree_store_set (store, & iter, 0,
"Copied data", -1);
2682 gtk_tree_store_append (store, &iter, NULL);
2683 gtk_tree_store_set (store, & iter, 0,
"Empty position", -1);
2686 return GTK_TREE_MODEL (store);
2700void search_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
2703 i = GPOINTER_TO_INT(data);
2705 gtk_tree_model_get (mod, iter,
IDCOL, & j, -1);
2706 gboolean vis = (j < 0 && i == 2) ? FALSE : TRUE;
2707 gtk_cell_renderer_set_visible (renderer, vis);
2708 if (vis && (i < TOLAB || i >
TOPIC))
2711 gtk_tree_model_get (mod, iter, i, & str, -1);
2712 g_object_set (renderer,
"markup", str, NULL, NULL);
2733 if (v > 0.0 && v<= 1.0)
2752 int ax = GPOINTER_TO_INT (data);
2754 int oid = (
csearch -> pointer[0].c == 5) ? 1 : 2;
2756 object -> baryc[
ax] = v;
2772 int ax = GPOINTER_TO_INT (data);
2779 this_proj -> modelgl -> atom_win ->
msd[
ax-1] = v;
2784 this_proj -> modelgl -> atom_win -> msd_all[
ax] = v;
2793 for (i=0; i<this_proj -> natomes; i++)
2795 if (this_proj ->
atoms[0][i].sp ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2799 for (i=0; i<this_proj -> natomes; i++)
2801 j = this_proj ->
atoms[0][i].sp;
2802 if (this_proj ->
atoms[0][i].numv ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2806 for (i=0; i<this_proj -> natomes; i++)
2808 j = this_proj ->
atoms[0][i].sp;
2810 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
2811 if (k ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2817 for (i=0; i<this_proj -> natomes; i++)
2820 if (j ==
ax) this_proj -> modelgl -> atom_win ->
msd[i] = v;
2834 v = this_proj -> modelgl -> atom_win ->
msd[
ax-1];
2838 v = this_proj -> modelgl -> atom_win -> msd_all[-
ax-1];
2857 int v = (int)atof(m);
2858 int ax = GPOINTER_TO_INT (data);
2879 csearch = this_proj -> modelgl -> search_widg[cid ->
c];
2882 if (gtk_tree_model_get_iter (
model, & iter, gtk_tree_path_new_from_string (path_string)))
2885 gtk_tree_model_get (
model, & iter,
IDCOL, & h, -1);
2890 GtkWidget * win = gtk_dialog_new ();
2893 gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW(this_proj -> modelgl ->
builder_win -> win));
2897 gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW(this_proj -> modelgl -> atom_win -> win));
2899 gtk_window_set_resizable (GTK_WINDOW (win), FALSE);
2902 gchar * obj[5]={
"atom(s)",
"total coordination(s)",
"partial coordination(s)",
"in fragment",
"in molecule"};
2903 gchar * act[2]={
"Replace",
"Remove"};
2909 str = g_strdup_printf (
"Replace %s randomly", obj[(
object) ?
filter : 0]);
2912 str = g_strdup_printf (
"Remove %s randomly", obj[(
object) ?
filter : 0]);
2915 str = g_strdup_printf (
"Maximum Mean Square Displacement");
2918 i = (
csearch -> pointer[0].c == 5) ? 1 : 2;
2922 str = g_strdup_printf (
"Site occupancy for %s",
prepare_for_title(iobj -> name));
2930 gtk_window_set_title (GTK_WINDOW(win), str);
2932 gtk_window_set_modal (GTK_WINDOW (win), TRUE);
2936 gchar *
axis[3]={
"x",
"y",
"z"};
2937 gchar * nran = NULL;
2944 str = g_strdup_printf (
"Occupancy= ");
2957 str = g_strdup_printf (
"%s =",
axis[i]);
2975 str = g_strdup_printf (
"MSD<sub>max</sub> for %s<sub>%d</sub> + neighbors = ", this_proj ->
chemistry ->
label[j],
atom_to_edit+1);
2988 str = g_strdup_printf (
"MSD<sub>max</sub> for all %s atom(s) = ", this_proj ->
chemistry ->
label[-h-1]);
2993 str = g_strdup_printf (
"MSD<sub>max</sub> for all isolated atom(s) = ");
2997 str = g_strdup_printf (
"MSD<sub>max</sub> for all %d-fold atom(s) + neighbors = ", -h-1);
3001 str = g_strdup_printf (
"MSD<sub>max</sub> for all %d-fold atom(s) = ", -h-1);
3006 for (j=0; j<this_proj -> nspec; j++)
3008 i += this_proj -> coord -> ntg[1][j];
3009 if (i > -h-1)
break;
3012 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
3014 nran =
env_name(this_proj, i, j, 1, NULL);
3017 str = g_strdup_printf (
"MSD<sub>max</sub> for all %s + neighbors = ", nran);
3021 str = g_strdup_printf (
"MSD<sub>max</sub> for all %s = ", nran);
3027 str = g_strdup_printf (
"MSD<sub>max</sub> for fragment N°%d = ", -h);
3031 str = g_strdup_printf (
"MSD<sub>max</sub> for the atom(s) in fragment N°%d = ", -h);
3037 str = g_strdup_printf (
"MSD<sub>max</sub> for molecule N°%d = ", -h);
3041 str = g_strdup_printf (
"MSD<sub>max</sub> for the atom(s) in molecule N°%d = ", -h);
3045 update_entry_double (GTK_ENTRY(entry), this_proj -> modelgl -> atom_win -> msd_all[-h-1]);
3061 nran = g_strdup_printf (
"%s", this_proj ->
chemistry ->
label[-h-1]);
3066 for (i=0; i<this_proj -> natomes; i++)
3073 for (i=0; i<this_proj -> natomes; i++)
3079 nran = g_strdup_printf (
"%d-fold", -h-1);
3083 nran = g_strdup_printf (
"isolated");
3088 for (j=0; j<this_proj -> nspec; j++)
3090 i += this_proj -> coord -> ntg[1][j];
3091 if (i > -h-1)
break;
3094 for (l=0; l<j; l++) k += this_proj -> coord -> ntg[1][l];
3096 for (k=0; k<this_proj -> natomes; k++)
3098 if (this_proj ->
atoms[0][k].sp == j && this_proj ->
atoms[0][k].coord[1] == i)
3111 max_random = this_proj -> coord -> totcoord[2];
3115 max_random = this_proj -> modelfc -> mols[0][i].multiplicity;
3121 for (k=0; k<this_proj -> natomes; k++)
3123 if (this_proj ->
atoms[0][k].coord[
filter-1] == i)
3128 nran = g_strdup_printf (
"atom(s)");
3139 str = g_strdup_printf (
"%s randomly <i>n</i> <b>fragment(s)</b> in all fragments, <i>n</i>= ", act[
csearch ->
action - 3]);
3143 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);
3147 str = g_strdup_printf (
"%s randomly <i>n</i> <b>%s</b> coordinations, <i>n</i>= ", act[
csearch ->
action - 3], nran);
3154 str = g_strdup_printf (
"%s randomly <i>n</i> <b>%s</b> %s, <i>n</i>= ", act[
csearch ->
action - 3], nran, obj[0]);
3158 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);
3161 if (nran) g_free (nran);
3166 str = g_strdup_printf (
" with <i>n</i><sub>max</sub> = <b>%d</b>",
max_random);
3183 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win ->
msd[
atom_to_edit]);
3187 str = g_strdup_printf (
"Set MSD<sub>max</sub> for ...");
3194 if (this_proj -> modelgl -> atom_win -> msd_all[-h-1] > 0.0)
3196 if (
object &&
filter > 2)
3198 str = g_strdup_printf (
"MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[-h-1]);
3202 str = g_strdup_printf (
"For all: MSD<sub>max</sub>= %f", this_proj -> modelgl -> atom_win -> msd_all[-h-1]);
3209 if (
object &&
filter > 2)
3235G_MODULE_EXPORT
void to_edit_coords (GtkCellRenderer * cell, GtkCellEditable * editable, gchar * path_string, gpointer data)
3251G_MODULE_EXPORT
void markup_action_renderer (GtkCellRendererCombo * cell, GtkCellEditable * editable, gchar * path_string, gpointer data)
3253 GtkComboBox * combo = GTK_COMBO_BOX(editable);
3254 GList * cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(combo));
3255 if (cell_list && cell_list -> data)
3257 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell_list -> data,
"markup", 0, NULL);
3286 v = this_proj -> modelgl -> atom_win ->
msd[0];
3291 this_proj -> modelgl -> atom_win ->
msd[j] = v;
3296 this_proj -> modelgl -> atom_win -> msd_all[j] = v;
3316 atom_search * asearch = this_proj -> modelgl -> search_widg[dat ->
c];
3317 if (gtk_tree_model_get_iter (
model, iter,
path))
3319 gtk_tree_model_get (
model, iter,
IDCOL, & i, -1);
3320 gtk_tree_store_set (GTK_TREE_STORE(
model), iter, dat ->
b, asearch -> int_b, -1);
3326 else if (asearch ->
object)
3350 csearch = this_proj -> modelgl -> search_widg[dat ->
c];
3355 GtkWidget * win = gtk_dialog_new ();
3356 gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW(this_proj -> modelgl -> atom_win -> win));
3357 gtk_window_set_resizable (GTK_WINDOW (win), FALSE);
3358 gchar * str = g_strdup_printf (
"Maximum Mean Square Displacement");
3359 gtk_window_set_title (GTK_WINDOW(win), str);
3361 gtk_window_set_modal (GTK_WINDOW (win), TRUE);
3366 str = g_strdup_printf (
"MSD<sub>max</sub> for all object(s) = ");
3370 str = g_strdup_printf (
"[Å<sup>2</sup>]");
3382 k = (
csearch -> pointer[0].c == 5) ? 1 : 2;
3383 if (this_proj -> modelgl -> atom_win -> to_be_inserted[k])
3386 for (i=0; i<
csearch -> in_selection; i++)
csearch -> todo[i] = j;
3391 k = this_proj -> modelgl -> anim -> last ->
img ->
step;
3402 for (i=0; i<this_proj -> natomes; i++)
3413 j = ! this_proj ->
atoms[k][i].label[0];
3426 k = this_proj -> modelgl -> anim -> last ->
img ->
step;
3429 j = ! this_proj ->
atoms[k][0].pick[0];
3441 j = (
csearch -> set_for_all < 0) ? 0 : 1;
3446 switch (abs(
csearch -> set_for_all))
3524G_MODULE_EXPORT
void move_up_down (GtkTreeModel * tree_model, GtkTreePath *
path, gpointer data)
3532 int * old_todo =
duplicate_int (asearch -> in_selection, asearch -> todo);
3534 obja -> next = this_proj -> modelgl -> atom_win -> to_be_inserted[2] -> next;
3535 g_free (this_proj -> modelgl -> atom_win -> to_be_inserted[2]);
3537 valid = gtk_tree_model_get_iter_first (tree_model, & iter);
3541 gtk_tree_model_get (tree_model, & iter, 0, & i, -1);
3544 while (objc ->
id != i) objc = objc -> next;
3550 objb = this_proj -> modelgl -> atom_win -> to_be_inserted[2];
3555 objb -> next -> prev = objb;
3556 objb = objb -> next;
3559 asearch -> todo[j] = old_todo[i];
3562 valid = gtk_tree_model_iter_next (tree_model, & iter);
3566 valid = gtk_tree_model_get_iter_first (tree_model, & iter);
3569 gtk_list_store_set (GTK_LIST_STORE(tree_model), & iter,
IDCOL, i+1, 1, g_strdup_printf (
"%d", i+1), -1);
3571 valid = gtk_tree_model_iter_next (tree_model, & iter);
3587 GtkTreeViewColumn * atom_col[5];
3588 GtkCellRenderer * atom_cell[5];
3589 gchar *
ctitle[6][5]={{
"Object",
"Name",
"Label",
"Pick",
" "},
3590 {
"Object",
"Name",
"Label",
"Move",
" "},
3591 {
"Object",
"Name",
"Label",
"Replace",
"By"},
3592 {
"Object",
"Name",
"Label",
"Remove",
" "},
3593 {
"Object",
"Name",
"Insert",
"Position",
"Occupancy"},
3594 {
"Object",
"Name",
"Label",
"Translate",
"Max. MSD"}};
3595 gchar * ctype[3][5]={{
"text",
"text",
"active",
"active",
"text"},
3596 {
"text",
"text",
"active",
"text",
"text"},
3597 {
"text",
"text",
"active",
"active",
"text"}};
3600 if (asearch ->
action ==
INSERT && asearch -> pointer[0].
c == 7) j ++;
3602 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},
3603 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT},
3604 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_INT}};
3607 asearch -> obj_model = gtk_list_store_newv (8, coltype[k]);
3611 asearch ->
atom_model = gtk_tree_store_newv (8, coltype[k]);
3619 asearch -> atom_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(asearch -> obj_model));
3623 asearch -> atom_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(asearch ->
atom_model));
3626 for (i=0; i<4+j; i++)
3631 atom_cell[i] = gtk_cell_renderer_text_new ();
3634 g_object_set (atom_cell[i],
"editable", TRUE, NULL);
3635 g_signal_connect (G_OBJECT(atom_cell[i]),
"editing-started", G_CALLBACK(
to_edit_coords), & asearch -> pointer[i-3]);
3641 atom_cell[i] = gtk_cell_renderer_toggle_new ();
3642 g_signal_connect (G_OBJECT(atom_cell[i]),
"toggled", G_CALLBACK(
select_atom), & asearch -> pointer[i-2]);
3647 atom_cell[i] = gtk_cell_renderer_combo_new ();
3649 g_object_set (atom_cell[i],
"model",
model,
"text-column", 0,
"has-entry", FALSE,
"editable", TRUE, NULL);
3650 g_object_unref (
model);
3651 g_signal_connect (G_OBJECT(atom_cell[i]),
"editing-started", G_CALLBACK(
markup_action_renderer), & asearch -> pointer[i-4]);
3652 g_signal_connect (G_OBJECT(atom_cell[i]),
"changed", G_CALLBACK(
changed_action_renderer), & asearch -> pointer[i-4]);
3654 gtk_cell_renderer_set_fixed_size (atom_cell[i], -1, 25);
3656 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);
3657 if (toggle && ! asearch -> passivating)
3659 gtk_tree_view_column_set_clickable (atom_col[i], TRUE);
3660 g_signal_connect (G_OBJECT(atom_col[i]),
"clicked", G_CALLBACK(
select_all_atoms), & asearch -> pointer[l-2]);
3662 gtk_tree_view_append_column(GTK_TREE_VIEW(asearch -> atom_tree), atom_col[i]);
3663 gtk_tree_view_column_set_alignment (atom_col[i], 0.5);
3664 gtk_tree_view_column_set_cell_data_func (atom_col[i], atom_cell[i],
search_set_visible, GINT_TO_POINTER(l), NULL);
3666 if (asearch -> pointer[0].
c == 7)
3668 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);
3669 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(asearch -> atom_tree), TRUE);
3671 return asearch -> atom_tree;
3690 tsize = (asearch -> mode || asearch -> passivating) ? this_proj -> nspec : this_proj -> natomes;
3693 tsize = (asearch -> mode || asearch -> passivating) ? this_proj -> coord -> cmax+1 : this_proj -> natomes;
3696 if (asearch -> mode || asearch -> passivating)
3698 tsize = this_proj -> coord -> totcoord[
filter -1];
3702 tsize = (
object &&
filter > 2) ? this_proj -> coord -> totcoord[
filter -1] : this_proj -> natomes;
3719 asearch -> todo =
allocint (tsize);
3720 asearch -> todo_size = tsize;
3733 if (asearch -> todo) g_free (asearch -> todo);
3736 switch (asearch ->
action)
3739 if (this_proj -> modelgl -> atom_win -> to_be_moved[0])
3741 object = this_proj -> modelgl -> atom_win -> to_be_moved[0];
3742 while (
object -> next)
3744 object =
object -> next;
3745 g_free (
object -> prev);
3748 this_proj -> modelgl -> atom_win -> to_be_moved[0] = NULL;
3752 if (this_proj -> modelgl -> atom_win -> to_be_moved[1])
3754 object = this_proj -> modelgl -> atom_win -> to_be_moved[1];
3755 while (
object -> next)
3757 object =
object -> next;
3758 g_free (
object -> prev);
3761 this_proj -> modelgl -> atom_win -> to_be_moved[1] = NULL;
3763 g_free (this_proj -> modelgl -> atom_win ->
msd);
3764 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (asearch -> todo_size);
3767 if (this_proj -> modelgl -> atom_win -> to_be_inserted[0])
3769 object = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
3770 while (
object -> next)
3772 object =
object -> next;
3773 g_free (
object -> prev);
3776 this_proj -> modelgl -> atom_win -> to_be_inserted[0] = NULL;
3778 asearch -> in_selection = 0;
3800 if (this_proj -> modelgl -> atom_win && clean_msd)
3802 g_free (this_proj -> modelgl -> atom_win -> msd_all);
3803 this_proj -> modelgl -> atom_win -> msd_all =
allocfloat (
val);
3809 int i = (asearch -> pointer[0].c == 3) ? 0 : 1;
3810 if (this_proj -> modelgl -> atom_win)
3812 if (this_proj -> modelgl -> atom_win -> win && this_proj -> modelgl -> atom_win -> replace_nodes[i])
3814 g_free (this_proj -> modelgl -> atom_win -> replace_nodes[i]);
3816 this_proj -> modelgl -> atom_win -> replace_nodes[i] = g_malloc0(
val*
sizeof*this_proj -> modelgl -> atom_win -> replace_nodes[i]);
3832 int i = gtk_combo_box_get_active (box);
3833 asearch -> spec = i;
3845 set_atom (GTK_ENTRY(asearch -> entry_a), asearch);
3861 asearch ->
filter = gtk_combo_box_get_active (box);
3866 if (
object &&
filter > 2)
3868 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> atom_box), 0);
3887 GtkTreeViewColumn * rot_c;
3893 was_object = ((! asearch -> mode && asearch ->
object > 1) || (asearch -> mode && asearch ->
object)) ? 1 : 0;
3894 asearch ->
object = gtk_combo_box_get_active (box);
3896 object = ((! asearch -> mode && asearch ->
object > 1) || (asearch -> mode && asearch ->
object)) ? 1 : 0;
3897 if ((! asearch -> mode && (asearch ->
object == 1 || asearch ->
object == 3)) || (asearch -> mode && asearch ->
object))
3899 if (! asearch -> mode) asearch -> passivating = TRUE;
3905 asearch -> passivating = FALSE;
3906 if (((! asearch -> mode && asearch ->
object == 2) || (asearch -> mode && asearch ->
object)) &&
filter > 2)
3920 was_object = (asearch -> object) ? 1 : 0;
3921 asearch ->
object = gtk_combo_box_get_active (box);
3923 object = (asearch -> object) ? 1 : 0;
3932 rot_c = gtk_tree_view_get_column (GTK_TREE_VIEW(asearch -> atom_tree), 4);
3933 gtk_tree_view_remove_column (GTK_TREE_VIEW(asearch -> atom_tree), rot_c);
3938 gtk_combo_box_text_remove ((GtkComboBoxText *)asearch -> filter_box, 0);
3941 GtkCellRenderer * rot = gtk_cell_renderer_toggle_new ();
3942 g_signal_connect (G_OBJECT(rot),
"toggled", G_CALLBACK(
select_atom), & asearch -> pointer[2]);
3944 rot_c = gtk_tree_view_column_new_with_attributes (
"Rotate", rot,
"active", i, NULL);
3945 gtk_tree_view_column_set_clickable (rot_c, TRUE);
3946 g_signal_connect (G_OBJECT(rot_c),
"clicked", G_CALLBACK(
select_all_atoms), & asearch -> pointer[2]);
3947 gtk_tree_view_column_set_alignment (rot_c, 0.5);
3948 gtk_tree_view_insert_column (GTK_TREE_VIEW(asearch -> atom_tree), rot_c, i-1);
3953 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> filter_box), 0);
3966 int i = 8 - asearch ->
action;
3967 GtkCellRenderer * num = gtk_cell_renderer_text_new ();
3968 g_object_set (num,
"editable", TRUE, NULL);
3969 g_signal_connect (G_OBJECT(num),
"editing-started", G_CALLBACK(
to_edit_coords), & asearch -> pointer[0]);
3970 GtkTreeViewColumn * num_c = gtk_tree_view_column_new_with_attributes (
"Number", num,
"text", i, NULL);
3971 gtk_tree_view_column_set_cell_data_func (num_c, num,
search_set_visible, GINT_TO_POINTER(i), NULL);
3972 gtk_tree_view_append_column(GTK_TREE_VIEW(asearch -> atom_tree), num_c);
3987 asearch -> mode = gtk_combo_box_get_active (box);
3990 if (! asearch -> mode)
3992 GtkTreeViewColumn * num_c;
3993 num_c = gtk_tree_view_get_column (GTK_TREE_VIEW(asearch -> atom_tree), 8 - asearch ->
action);
3994 gtk_tree_view_remove_column (GTK_TREE_VIEW(asearch -> atom_tree), num_c);
4001 if (this_proj -> natomes >= 10000)
4003 if (asearch -> object_box)
4005 if (asearch -> mode)
4007 gtk_combo_box_text_remove ((GtkComboBoxText *)asearch -> object_box, 3);
4008 gtk_combo_box_text_remove ((GtkComboBoxText *)asearch -> object_box, 1);
4012 gtk_combo_box_text_insert ((GtkComboBoxText *)asearch -> object_box, 1, NULL,
"Atom(s): all");
4019 gtk_combo_box_text_remove_all ((GtkComboBoxText *)asearch -> object_box);
4037 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> object_box), 0);
4054 asearch -> search_digit = (int)v;
4055 if (asearch -> search_digit <= 0)
4057 asearch -> search_digit --;
4081 GtkWidget * fixed = gtk_fixed_new ();
4083 gtk_widget_set_size_request (combo, 175, -1);
4084 gtk_fixed_put (GTK_FIXED(fixed), combo, 0, 0);
4099 widg =
bbox (too_box,
"\t Atom species: ");
4100 gtk_widget_set_size_request (widg, 200, -1);
4102 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> entry_a, FALSE, FALSE, 0);
4104 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> img_a, FALSE, FALSE, 5);
4105 widg =
bbox (too_box,
"\t Atom Id: ");
4106 gtk_widget_set_size_request (widg, 200, -1);
4108 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> entry_b, FALSE, FALSE, 0);
4110 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, widg, asearch -> img_b, FALSE, FALSE, 5);
4115 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, asearch -> but_a, FALSE, FALSE, 75);
4134 i = (nats < 10000) ? 1 : 0;
4135 j = (asearch ->
action == 5) ? 300 : -1;
4136 GtkWidget * selection =
create_layout (j, 390 + (! i)*60 - i*100);
4138 GtkWidget *
hbox, * vvbox;
4140 if (asearch ->
action != 5)
4157 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> object_box), asearch ->
object);
4159 gchar * filters[5]={
"Chemical species",
"Total coordination",
"Partial coordination",
"Fragment",
"Molecule"};
4161 if (this_proj -> modelgl -> adv_bonding[0])
combo_text_append (asearch -> filter_box, filters[3]);
4162 if (this_proj -> modelgl -> adv_bonding[1])
combo_text_append (asearch -> filter_box, filters[4]);
4163 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> filter_box), asearch ->
filter);
4168 gtk_combo_box_set_active (GTK_COMBO_BOX(asearch -> atom_box), asearch -> spec);
4170 g_signal_connect (G_OBJECT (asearch -> object_box),
"changed", G_CALLBACK(
set_object_changed), asearch);
4171 g_signal_connect (G_OBJECT (asearch -> filter_box),
"changed", G_CALLBACK(
set_filter_changed), asearch);
4172 g_signal_connect (G_OBJECT (asearch -> atom_box),
"changed", G_CALLBACK(
set_spec_changed), asearch);
4174 if (asearch ->
action < 2)
4180 add_box_child_start (GTK_ORIENTATION_VERTICAL, asearch -> info[0], asearch -> id_box, FALSE, FALSE, 0);
4196 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, asearch -> id_box, entry, FALSE, FALSE, 0);
4200 if (asearch ->
action < 2)
4202 lab =
markup_label(
"\t<b>The number of atoms in the model is too large</b>\n"
4203 "\t\t<b>to display and browse the entire list !</b>\n"
4204 "\t<b>You need to search for object(s) manually:</b>", -1, -1, 0.5, 0.5);
4208 lab =
markup_label(
"<b>The number of atoms in the model is too large to display and browse the entire list !</b>\n"
4209 "\t\t\t\t<b>You need to search for object(s) manually:</b>", -1, -1, 0.5, 0.5);
4227 markup_label(
"The search must be performed using species and/or ID.\n"
4228 "Use the filters above to define the object(s) of the search", -1, -1, 0.5, 0.5), FALSE, FALSE, 5);
4234 GtkWidget * scrollsets =
create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
4235 i = (asearch ->
action < 2) ? 0 : 1;
4236 j = (asearch ->
action < 2) ? 1 : 0;
4237 if (asearch ->
action < 2)
4239 gtk_widget_set_size_request (scrollsets, 400+i*100, 270);
4243 gtk_widget_set_size_request (scrollsets, 400+i*100, 290-i*120);
4245 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
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
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
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