71 tmp_pick = tmp_pick -> next;
72 g_free (tmp_pick -> prev);
73 tmp_pick -> prev = NULL;
100 gboolean vis_stat =
opengl_project -> modelgl -> atom_win -> visible;
137 g_free (this_proj ->
atoms[0]);
182 if (asearch -> in_selection)
184 for (i=0; i<asearch -> todo_size; i++) asearch -> todo[i] = 0;
185 asearch -> in_selection = 0;
186 if (this_proj -> modelgl -> atom_win -> to_be_moved[sid])
188 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_moved[sid];
189 while (
object -> next)
191 object =
object -> next;
192 g_free (
object -> prev);
195 this_proj -> modelgl -> atom_win -> to_be_moved[sid] = NULL;
198 this_proj -> modelgl -> atom_win -> rebuilt[! sid] = TRUE;
199 this_proj -> modelgl -> atom_win -> rebuilt[sid] = FALSE;
213 int i, j, k, l, m, n, o, p;
219 int remove,
extra, nmols;
220 int act = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
222 to_rem = tmp_rem = NULL;
223 to_add = tmp_add = NULL;
224 remove =
extra = nmols = 0;
226 edit -> add_spec = 0;
227 if (this_proj -> nspec)
232 else if (! this_proj -> natomes)
234 edit -> coord = NULL;
237 gboolean passivate = FALSE;
240 if (this_proj -> modelgl -> cell_win)
242 if (this_proj -> modelgl -> cell_win -> slab_passivate) passivate = TRUE;
248 for (i=0; i<this_proj -> natomes; i++)
250 if (asearch -> todo[i])
254 tmp_rem -> next = g_malloc0 (
sizeof*tmp_rem);
255 tmp_rem -> next -> prev = tmp_rem;
256 tmp_rem = tmp_rem -> next;
260 to_rem = g_malloc0 (
sizeof*to_rem);
270 object = edit -> to_be_inserted[act];
278 if (asearch -> todo[j])
287 edit -> new_z =
allocdouble (edit -> coord -> species);
288 for (k=0; k<edit -> coord -> species; k++) edit -> new_z[k] = (
double)
object -> old_z[k];
289 o +=
object -> species;
291 asearch -> in_selection --;
295 tmp_list = object_list;
300 tmp_list -> next -> prev = tmp_list;
301 tmp_list = tmp_list -> next;
303 for (k=0; k<
object ->
atoms; k++)
307 tmp_add -> next = g_malloc0 (
sizeof*tmp_add);
308 tmp_add -> next -> prev = tmp_add;
309 tmp_add = tmp_add -> next;
313 to_add = g_malloc0 (
sizeof*to_add);
316 tmp_add ->
id = this_proj -> natomes +
extra - remove;
317 l =
object -> at_list[k].sp;
318 tmp_add -> type =
find_spec_id (edit -> coord -> species,
object -> old_z[l], edit -> new_z);
319 tmp_add -> xyz[0] =
object -> at_list[k].x +
object -> baryc[0];
320 tmp_add -> xyz[1] =
object -> at_list[k].y +
object -> baryc[1];
321 tmp_add -> xyz[2] =
object -> at_list[k].z +
object -> baryc[2];
324 tmp_add -> coord[m] =
find_this_geo_id (m,
object -> coord,
object -> old_z,
object -> at_list[k].coord[m],
325 l, tmp_add -> type, edit -> coord, edit -> new_z);
328 for (m=2; m<4; m++) tmp_add -> coord[m] =
object -> at_list[k].coord[2] + i;
329 if (this_proj -> coord)
331 for (m=2; m<4; m++) tmp_add -> coord[m] += this_proj -> coord -> totcoord[m];
333 tmp_add -> numv =
object -> at_list[k].
numv;
336 tmp_add -> vois =
duplicate_int (
object -> at_list[k].numv,
object -> at_list[k].vois);
337 for (m=0; m<tmp_add -> numv; m++) tmp_add -> vois[m] += p + this_proj -> natomes;
338 sort (tmp_add ->numv, tmp_add -> vois);
342 i +=
object -> coord -> totcoord[2];
343 p +=
object ->
atoms;
348 object -> prev -> next =
object -> next;
349 object -> next -> prev =
object -> prev;
351 object =
object -> next;
356 object -> prev -> next = NULL;
365 edit -> to_be_inserted[act] =
object -> next;
366 object =
object -> next;
367 g_free (
object -> prev);
368 object -> prev = NULL;
372 g_free (edit -> to_be_inserted[act]);
373 edit -> to_be_inserted[act] = NULL;
380 object =
object -> next;
384 edit -> coord -> totcoord[2] += i;
385 edit -> add_spec = o;
391 g_debug (
"Project coord before insert:");
392 if (this_proj -> natomes)
398 g_debug (
" *** None *** ");
400 g_debug (
"Coord info after object insert:");
405 if (asearch ->
action ==
DISPL && remove == 0)
return -1;
407 if (asearch ->
action ==
REMOVE && remove == 0)
return -1;
409 if (asearch ->
action ==
REMOVE && remove > this_proj -> natomes)
return -1;
412 || (asearch -> passivating && asearch ->
filter < 3)
413 || (asearch ->
action ==
RANMOVE && asearch -> passivating && asearch ->
object < 2)
414 || (asearch ->
action ==
RANMOVE && ! asearch -> passivating && ! asearch ->
object))
416 this_proj -> modelgl ->
bonding = FALSE;
417 this_proj -> coord -> totcoord[3] = 0;
418 if (this_proj -> modelgl -> adv_bonding[1])
422 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[i] == 4 || this_proj -> modelgl -> anim -> last ->
img -> color_map[i] == 5)
426 if (this_proj -> modelgl -> color_styles[i*
ATOM_MAPS])
428 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> color_styles[i*
ATOM_MAPS], TRUE);
435 this_proj -> modelgl -> adv_bonding[1] = FALSE;
436 if (this_proj -> force_field[0])
438 g_free (this_proj -> force_field[0]);
439 this_proj -> force_field[0] = NULL;
443 if (this_proj -> modelgl -> custom_map)
445 g_free (this_proj -> modelgl -> custom_map);
446 this_proj -> modelgl -> custom_map = NULL;
451 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> color_styles[j], TRUE);
452 set_color_map (this_proj -> modelgl -> color_styles[j], & this_proj -> modelgl ->
colorp[j][0]);
463 this_proj -> visok[i]=FALSE;
467 if (this_proj -> modelgl -> rings)
469 this_proj -> modelgl -> rings = FALSE;
478 if (this_proj -> modelgl ->
chains)
487 if (asearch ->
action ==
REMOVE && remove == this_proj -> natomes)
493 atom * new_list = NULL;
494 atom * tmp_new = NULL;
499 if (this_proj -> natomes)
501 old_id =
allocint (this_proj -> natomes);
503 for (i=0; i<this_proj -> natomes; i++)
505 if (tmp_rem && tmp_rem ->
id == i)
513 tmp_new -> next -> prev = tmp_new;
514 tmp_new = tmp_new -> next;
523 if (tmp_rem -> next != NULL) tmp_rem = tmp_rem -> next;
531 tmp_new -> next -> prev = tmp_new;
532 tmp_new = tmp_new -> next;
553 if (old_id[tmp_new ->
id] > 0) i++;
554 tmp_new = tmp_new -> next;
562 j= this_proj -> nspec + edit -> add_spec;
563 tmpgeo[i] = g_malloc (j*
sizeof*tmpgeo[i]);
566 tmpgeo[i][k] =
allocint (edit -> coord -> ntg[i][k]);
575 if (! passivate || old_id[j] > 0)
579 m = tmp_new -> coord[l];
580 if (m >= edit -> coord -> ntg[l][k])
582 g_warning (
"Error: at= %d, sp= %d, l= %d, geo_id= %d, edit -> coord -> ntg[%d][%d]= %d", j+1, k, l, m, l, k, edit -> coord -> ntg[l][k]);
587 tmp_new = tmp_new -> next;
596 i = edit -> coord -> totcoord[2];
597 j = this_proj -> coord -> totcoord[2];
601 showfrag[k] = this_proj -> modelgl -> anim -> last ->
img -> show_coord[2][k];
603 for (k=j; k<i; k++) showfrag[k] = TRUE;
610 tmpgeo[i] = g_malloc (edit -> coord -> species*
sizeof*tmpgeo[i]);
611 for (j=0; j<edit -> coord -> species; j++)
613 tmpgeo[i][j] =
allocint (edit -> coord -> ntg[i][j]);
616 showfrag =
allocbool(edit -> coord -> totcoord[2]);
617 for (j=0; j<edit -> coord -> totcoord[2]; j++)
632 if (old_id[tmp_new ->
id] > 0 || asearch ->
action !=
REMOVE)
634 if (tmp_new ->
pick[0] || tmp_new ->
pick[1])
638 tmp_add -> next = g_malloc0 (
sizeof*tmp_add);
639 tmp_add -> next -> prev = tmp_add;
640 tmp_add = tmp_add -> next;
644 to_add = g_malloc0 (
sizeof*to_add);
647 for (j=0; j<2; j++) tmp_add ->
pick[j] = tmp_new ->
pick[j];
653 tmp_new = tmp_new -> next;
662 while (tmp_new -> next) tmp_new = tmp_new -> next;
668 tmp_new -> next = g_malloc0 (
sizeof*tmp_new -> next);
669 tmp_new -> next -> prev = tmp_new;
670 tmp_new = tmp_new -> next;
674 new_list = g_malloc0 (
sizeof*new_list);
677 tmp_new -> sp = tmp_add -> type;
678 tmp_new -> show[0] = tmp_new -> show[1] = TRUE;
679 tmp_new ->
x = tmp_add -> xyz[0];
680 tmp_new ->
y = tmp_add -> xyz[1];
681 tmp_new ->
z = tmp_add -> xyz[2];
682 for (i=0; i<4; i++) tmp_new -> coord[i] = tmp_add -> coord[i];
686 k = tmp_add -> coord[j];
690 tmp_new -> numv = tmp_add -> numv;
691 if (tmp_new -> numv) tmp_new -> vois =
duplicate_int (tmp_new -> numv, tmp_add -> vois);
694 tmp_add ->
pick[0] = TRUE;
695 tmp_add = tmp_add -> next;
702 i +=
object ->
bonds;
703 object =
object -> next;
707 object = object_list;
711 i +=
object ->
atoms;
712 j +=
object ->
bonds;
715 object =
object -> next;
716 g_free (
object -> prev);
727 if (this_proj -> natomes)
731 gboolean vis_stat =
opengl_project -> modelgl -> atom_win -> visible;
750 if (this_proj -> nspec)
752 g_free (this_proj ->
atoms[0]);
756 this_proj ->
atoms = g_malloc0 (
sizeof*this_proj ->
atoms);
761 spid =
allocint (this_proj -> nspec + edit -> add_spec);
762 spdel =
allocint (this_proj -> nspec + edit -> add_spec);
764 this_proj ->
atoms[0] = g_malloc0 (new_atoms*
sizeof*this_proj ->
atoms[0]);
769 if (asearch ->
action !=
REMOVE || old_id[tmp_new ->
id] > 0)
772 this_proj ->
atoms[0][i].
id = i;
773 spid[this_proj ->
atoms[0][i].sp] ++;
774 atid[i] = this_proj ->
atoms[0][i].sp;
775 this_proj ->
atoms[0][i].pick[0] = this_proj ->
atoms[0][i].pick[1] = FALSE;
780 tmp_new = tmp_new -> next;
781 g_free (tmp_new -> prev);
789 if (old_id) g_free (old_id);
792 for (i=0; i<this_proj -> nspec + edit -> add_spec; i++)
805 if (rem_spec || edit -> add_spec)
807 int new_spec = this_proj -> nspec - rem_spec + edit -> add_spec;
810 for (j=0; j<this_proj -> nspec; j++)
814 newchem -> nsps[i] = this_proj ->
chemistry -> nsps[j];
815 newchem -> formula[i] = this_proj ->
chemistry -> formula[j];
820 newchem -> chem_prop[k][i] = this_proj ->
chemistry -> chem_prop[k][j];
823 if (j < this_proj -> nspec-1)
826 for (l=j; l<this_proj -> nspec; l++)
830 newchem -> cutoffs[i][k] = newchem -> cutoffs[k][i] = this_proj ->
chemistry -> cutoffs[j][l];
835 newchem -> nsps[i] = spid[j];
839 j = (this_proj -> nspec) ? 1 : 0;
840 for (k=0; k<edit -> add_spec - j*rem_spec; k++)
842 l = this_proj -> nspec + k;
845 newchem -> nsps[i] = spid[l];
846 newchem -> formula[i] = 0;
847 newchem -> chem_prop[
CHEM_Z][i] = newchem -> chem_prop[
CHEM_X][i] = edit -> new_z[l];
848 m = (int)newchem -> chem_prop[
CHEM_Z][i];
855 newchem -> chem_prop[
CHEM_X][i] = newchem -> chem_prop[
CHEM_Z][i];
860 for (i=0; i<new_atoms; i++)
862 atid[i] -= spdel[atid[i]];
863 this_proj ->
atoms[0][i].sp = atid[i];
879 if (! this_proj -> natomes)
881 this_proj -> natomes = new_atoms;
886 this_proj -> natomes = new_atoms;
890 recover_opengl_data (this_proj, nmols, edit -> add_spec, rem_spec, spid, spdel, tmpgeo, showfrag);
898 if (this_proj -> natomes)
904 g_debug (
" *** None *** ");
908 g_free (edit -> new_z);
928 if (asearch -> recompute_bonding)
942 this_proj -> modelgl -> create_shaders[
PICKS] = TRUE;
943 this_proj -> modelgl -> create_shaders[
MDBOX] = TRUE;
944 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
945 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
949 while (tmp_add != NULL)
953 if (tmp_add ->
pick[i])
958 tmp_add = tmp_add -> next;
967 g_free (this_proj -> modelgl -> saved_coord[i]);
968 this_proj -> modelgl -> saved_coord[i] = NULL;
971 this_proj -> modelgl ->
was_moved = FALSE;
972 this_proj -> modelgl -> atom_win -> rebuilt[0] = FALSE;
973 this_proj -> modelgl -> atom_win -> rebuilt[1] = FALSE;
974 if (this_proj -> modelgl -> atom_win ->
msd) g_free (this_proj -> modelgl -> atom_win ->
msd);
975 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
976 if (this_proj -> modelgl -> atom_win -> msd_all) g_free (this_proj -> modelgl -> atom_win -> msd_all);
977 this_proj -> modelgl -> atom_win -> msd_all =
allocfloat (this_proj -> nspec);
978 for (i=0; i<2; i++)
clean_motion_search (this_proj, this_proj -> modelgl -> search_widg[2+4*i], i);
983 this_proj -> modelgl ->
was_moved = TRUE;
987 else if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
989 g_free (this_proj -> modelgl -> saved_coord[1]);
991 this_proj -> modelgl -> baryc[1] =
get_bary (this_proj, 1);
993 update (this_proj -> modelgl);
995 update_menu_bar (this_proj -> modelgl);
999 switch (asearch ->
action)
1032 if (this_proj -> modelgl -> search_widg[
INSERT] -> in_selection)
1034 allocate_todo (this_proj -> modelgl -> search_widg[i+2], this_proj -> modelgl -> search_widg[
INSERT] -> in_selection);
1035 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_inserted[1];
1041 object =
object -> next;
1046 else if (this_proj -> modelgl -> search_widg[i+2] -> atom_tree)
1049 if ((j == 3 && ! this_proj -> modelgl -> adv_bonding[0]) || (j == 4 && ! this_proj -> modelgl -> adv_bonding[1]))
1051 combo_set_active (this_proj -> modelgl -> search_widg[i+2] -> filter_box, 0);
1052 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), this_proj -> modelgl -> search_widg[i+2]);
1056 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), this_proj -> modelgl -> search_widg[i+2]);
1060 if ((i == 0 || i == 4) && this_proj -> modelgl -> search_widg[i+2] -> todo_size >= 10000)
1065 if ((this_proj -> modelgl -> atom_win -> adv_bonding[0] && ! this_proj -> modelgl -> adv_bonding[0])
1066 || (this_proj -> modelgl -> atom_win -> adv_bonding[1] && ! this_proj -> modelgl -> adv_bonding[1]))
1073 if (this_proj -> modelgl -> search_widg[i+2] -> passivating)
1075 j = (this_proj -> modelgl -> search_widg[i+2] ->
object < 2) ? 3 : 2;
1079 j = (! this_proj -> modelgl -> search_widg[i+2] -> object) ? 3 : 2;
1081 if (GTK_IS_WIDGET(this_proj -> modelgl -> search_widg[i+2] -> filter_box))
1083 if (this_proj -> modelgl -> atom_win -> adv_bonding[1] && ! this_proj -> modelgl -> adv_bonding[1])
1085 gtk_combo_box_text_remove ((GtkComboBoxText *) this_proj -> modelgl -> search_widg[i+2] -> filter_box, j+1);
1087 if (this_proj -> modelgl -> atom_win -> adv_bonding[0] && ! this_proj -> modelgl -> adv_bonding[0])
1089 gtk_combo_box_text_remove ((GtkComboBoxText *) this_proj -> modelgl -> search_widg[i+2] -> filter_box, j);
1095 for (i=0 ;i<2; i++) this_proj -> modelgl -> atom_win -> adv_bonding[i] = this_proj -> modelgl -> adv_bonding[i];
1109 gchar * appl[3] = {
"replaced",
"removed",
"inserted"};
1112 gboolean visible = (this_proj -> modelgl -> atom_win) ? this_proj -> modelgl -> atom_win -> visible : FALSE;
1126 str = g_strdup_printf (
"No atoms to be %s !", appl[asearch ->
action-3]);
1131 if (asearch -> pointer[0].
c == 8) l += asearch -> int_b - k;
1132 str = g_strdup_printf (
"%d atom(s) removed !\n%d atom(s) inserted !", l, k);
1136 str = g_strdup_printf (
"%d atom(s) %s !", k, appl[asearch ->
action-3]);
1140 if (this_proj -> modelgl -> atom_win -> win)
1142 show_info (str, 0, this_proj -> modelgl -> atom_win -> win);
1146 show_info (str, 0, this_proj -> modelgl -> win);
1154 if (this_proj -> modelgl -> atom_win)
1156 if (this_proj -> modelgl -> atom_win -> visible)
clean_all_trees (asearch, this_proj);
1157 if (this_proj -> modelgl -> atom_win ->
msd)
1159 g_free (this_proj -> modelgl -> atom_win ->
msd);
1160 this_proj -> modelgl -> atom_win ->
msd = NULL;
1162 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
1179 int i, j, k, l, m, n, o, p, q;
1184 int max_num, total_num;
1185 gboolean lets_do_this = (asearch ->
action ==
REMOVE || (asearch ->
action ==
REPLACE && this_proj -> modelgl -> atom_win -> to_be_inserted[0])) ? TRUE : FALSE;
1190 int num_elem = asearch -> todo_size;
1191 int * random_todo =
duplicate_int (num_elem, asearch -> todo);
1192 total_num = (asearch -> mode &&
filter > 2 && obj) ? this_proj -> coord -> totcoord[2] : this_proj -> natomes;
1193 g_free (asearch -> todo);
1195 if (asearch ->
action ==
REPLACE && this_proj -> modelgl -> atom_win -> to_be_inserted[0])
1197 tmp_oba = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
1200 while (tmp_oba -> next)
1202 tmp_oba = tmp_oba -> next;
1204 tmp_obb = tmp_obb -> next;
1206 g_free (this_proj -> modelgl -> atom_win -> to_be_inserted[0]);
1207 this_proj -> modelgl -> atom_win -> to_be_inserted[0] = NULL;
1210 asearch -> in_selection = 0;
1212 for (i=0; i<num_elem; i++)
1220 max_num = this_proj ->
chemistry -> nsps[i];
1223 for (j=0; j<this_proj -> natomes; j++)
1225 if (this_proj ->
atoms[0][j].numv == i) max_num ++;
1230 for (k=0; k<this_proj -> nspec; k++)
1232 j += this_proj -> coord -> ntg[1][k];
1236 for (m=0; m<k; m++) l += this_proj -> coord -> ntg[1][m];
1238 for (l=0; l<this_proj -> natomes; l++)
1240 if (this_proj ->
atoms[0][l].sp == k && this_proj ->
atoms[0][l].coord[1] == p) max_num ++;
1246 max_num = this_proj -> coord -> totcoord[2];
1250 for (l=0; l<this_proj -> natomes; l++)
1252 if (this_proj ->
atoms[0][l].coord[2] == i) max_num ++;
1257 molfc = & this_proj -> modelfc -> mols[0][i];
1260 max_num = molfc -> multiplicity;
1264 max_num = molfc -> natoms*molfc -> multiplicity;
1268 test = 1.0 / max_num;
1271 clock_t begin = clock();
1273 while (j < random_todo[i])
1276 for (m=0; m<total_num; m++)
1278 if (! asearch -> todo[m])
1283 n = this_proj ->
atoms[0][m].sp;
1289 if (n == i) doit = TRUE;
1292 if (this_proj ->
atoms[0][m].numv == i) doit = TRUE;
1296 for (q=0;q<n;q++) o += this_proj -> coord -> ntg[1][q];
1297 if (o == i) doit = TRUE;
1300 if (this_proj ->
atoms[0][m].coord[
filter-1] == i) doit = TRUE;
1311 for (n=0; n<molfc -> multiplicity; n++)
1313 if (molfc -> fragments[n] == m)
1323 o = (o+1)*max_num*m;
1325 if (prob >= (l-1)*test && prob < l*test)
1328 asearch -> todo[m] = 1;
1331 if (this_proj -> modelgl -> atom_win -> to_be_inserted[0] == NULL)
1334 tmp_obb = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
1339 tmp_obb -> next -> prev = tmp_obb;
1340 tmp_obb = tmp_obb -> next;
1344 asearch -> in_selection ++;
1345 if (j == random_todo[i])
break;
1353 if (tmp_oba -> next != NULL) tmp_oba = tmp_oba -> next;
1358 if (random_todo) g_free (random_todo);
1359 int old_filter = asearch ->
filter;
1362 asearch ->
filter = old_filter;
1377 int i, j, k, l, m, n, o, p, q;
1378 gboolean taking_action = FALSE;
1381 taking_action = TRUE;
1386 if (asearch -> mode)
1388 for (l=0; l<asearch -> todo_size; l++)
1390 if (asearch -> todo[l]) i++;
1395 if (asearch -> todo[l]) j ++;
1400 if (asearch ->
pick[l] && asearch -> todo[l]) j ++;
1405 taking_action = TRUE;
1407 else if (asearch ->
action ==
REPLACE && i == j && i == asearch -> in_selection)
1409 taking_action = TRUE;
1414 m = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
1418 int * pass_todo = NULL;
1422 float * tmp_msd = NULL;
1423 if (asearch -> passivating)
1425 if (
object > 1 &&
filter > 2)
1427 pass_size = this_proj -> coord -> totcoord[
filter - 1];
1431 pass_size = this_proj -> natomes;
1436 switch (asearch ->
action)
1439 for (l=0; l<asearch -> todo_size; l++)
1441 if (asearch -> todo[l]) i ++;
1444 if (asearch -> todo[l])
1446 if (asearch -> passivating)
1453 for (n=0; n<this_proj -> natomes; n++)
1455 if (this_proj ->
atoms[0][n].sp == l)
1457 pass_todo[n] = asearch -> todo[l];
1463 for (n=0; n<this_proj -> natomes; n++)
1465 if (this_proj ->
atoms[0][n].numv == l)
1467 pass_todo[n] = asearch -> todo[l];
1473 for (n=0; n<this_proj -> natomes; n++)
1476 p = this_proj ->
atoms[0][n].sp;
1477 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1480 pass_todo[n] = asearch -> todo[l];
1486 for (n=0; n<this_proj -> natomes; n++)
1491 pass_todo[n] = asearch -> todo[l];
1503 for (n=0; n<this_proj -> natomes; n++)
1505 if (this_proj ->
atoms[0][n].numv == l)
1507 pass_todo[n] = asearch -> todo[l];
1509 if (! passivating_object)
1512 pao = passivating_object;
1517 pao -> next -> prev = pao;
1524 for (n=0; n<this_proj -> natomes; n++)
1527 p = this_proj ->
atoms[0][n].sp;
1528 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1531 pass_todo[n] = asearch -> todo[l];
1533 if (! passivating_object)
1536 pao = passivating_object;
1541 pao -> next -> prev = pao;
1548 for (n=0; n<this_proj -> coord -> totcoord[
filter -1]; n++)
1552 pass_todo[n] = asearch -> todo[l];
1554 if (! passivating_object)
1557 pao = passivating_object;
1562 pao -> next -> prev = pao;
1576 for (l=0; l<asearch -> todo_size; l++)
1578 if (asearch -> todo[l]) i ++;
1582 if (asearch -> todo[l])
1585 if (asearch -> passivating)
1590 for (n=0; n<this_proj -> natomes; n++)
1592 if (this_proj ->
atoms[0][n].sp == l)
1594 pass_todo[n] = asearch -> todo[l];
1595 if (! passivating_object)
1598 pao = passivating_object;
1605 pao -> next -> prev = pao;
1613 for (n=0; n<this_proj -> natomes; n++)
1615 if (this_proj ->
atoms[0][n].numv == l)
1617 pass_todo[n] = asearch -> todo[l];
1618 if (! passivating_object)
1621 pao = passivating_object;
1628 pao -> next -> prev = pao;
1636 for (n=0; n<this_proj -> natomes; n++)
1639 p = this_proj ->
atoms[0][n].sp;
1640 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1643 pass_todo[n] = asearch -> todo[l];
1644 if (! passivating_object)
1647 pao = passivating_object;
1654 pao -> next -> prev = pao;
1663 for (n=0; n<this_proj -> natomes; n++)
1668 pass_todo[n] = asearch -> todo[l];
1669 if (! passivating_object)
1672 pao = passivating_object;
1679 pao -> next -> prev = pao;
1688 pass_todo[l] = asearch -> todo[l];
1689 if (! passivating_object)
1692 pao = passivating_object;
1699 pao -> next -> prev = pao;
1712 for (l=0; l<asearch -> todo_size; l++)
1714 if (asearch -> todo[l])
1717 if (asearch -> passivating)
1722 for (n=0; n<this_proj -> natomes; n++)
1724 if (this_proj ->
atoms[0][n].sp == l)
1732 for (n=0; n<this_proj -> natomes; n++)
1734 if (this_proj ->
atoms[0][n].numv == l)
1742 for (n=0; n<this_proj -> natomes; n++)
1745 p = this_proj ->
atoms[0][n].sp;
1746 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1756 for (n=0; n<this_proj -> natomes; n++)
1778 for (l=0; l<asearch -> todo_size; l++)
1780 if (asearch -> passivating)
1782 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win -> msd_all[l] > 0.0)
1790 for (n=0; n<this_proj -> natomes; n++)
1792 if (this_proj ->
atoms[0][n].sp == l)
1794 pass_todo[n] = asearch -> todo[l];
1795 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1801 for (n=0; n<this_proj -> natomes; n++)
1803 if (this_proj ->
atoms[0][n].numv == l)
1805 pass_todo[n] = asearch -> todo[l];
1806 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1812 for (n=0; n<this_proj -> natomes; n++)
1815 p = this_proj ->
atoms[0][n].sp;
1816 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1819 pass_todo[n] = asearch -> todo[l];
1820 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1826 for (n=0; n<this_proj -> natomes; n++)
1831 pass_todo[n] = asearch -> todo[l];
1832 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1844 for (n=0; n<this_proj -> natomes; n++)
1846 if (this_proj ->
atoms[0][n].numv == l)
1848 pass_todo[n] = asearch -> todo[l];
1849 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1850 if (! passivating_object)
1853 pao = passivating_object;
1858 pao -> next -> prev = pao;
1866 for (n=0; n<this_proj -> natomes; n++)
1869 p = this_proj ->
atoms[0][n].sp;
1870 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1873 pass_todo[n] = asearch -> todo[l];
1874 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1875 if (! passivating_object)
1878 pao = passivating_object;
1883 pao -> next -> prev = pao;
1891 for (n=0; n<this_proj -> coord -> totcoord[
filter -1]; n++)
1895 pass_todo[n] = asearch -> todo[l];
1897 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1898 if (! passivating_object)
1901 pao = passivating_object;
1906 pao -> next -> prev = pao;
1916 else if (
object &&
filter > 2)
1918 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win -> msd_all[l] > 0.0) i ++;
1922 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win ->
msd[l] > 0.0) i ++;
1929 taking_action = TRUE;
1933 if (asearch -> in_selection == i && i == j) taking_action = TRUE;
1937 asearch -> in_selection = i;
1938 if (i) taking_action = TRUE;
1940 if (asearch -> passivating && taking_action && editing)
1942 g_free (asearch -> todo);
1945 asearch -> todo_size = pass_size;
1946 asearch -> in_selection = k;
1947 switch (asearch ->
action)
1950 this_proj -> modelgl -> atom_win -> to_be_moved[0] = passivating_object;
1953 this_proj -> modelgl -> atom_win -> to_be_inserted[m] = passivating_object;
1956 if (this_proj -> modelgl -> atom_win ->
msd) g_free (this_proj -> modelgl -> atom_win ->
msd);
1957 this_proj -> modelgl -> atom_win ->
msd =
duplicate_float (this_proj -> natomes, tmp_msd);
1959 this_proj -> modelgl -> atom_win -> to_be_moved[1] = passivating_object;
1966 return taking_action;
1978 atom_search * bsearch = g_malloc0 (
sizeof*bsearch);
1979 bsearch -> search_digit = asearch -> search_digit;
1983 bsearch -> mode = asearch -> mode;
1984 bsearch ->
object = asearch -> object;
1986 bsearch -> search_digit = asearch -> search_digit;
1987 bsearch -> spec_to_add = asearch -> spec_to_add;
1988 bsearch -> num_to_add = asearch -> num_to_add;
1989 bsearch -> in_selection = asearch -> in_selection;
1990 bsearch -> passivating = asearch -> passivating;
1991 bsearch -> was_selected = asearch -> was_selected;
1992 bsearch -> recompute_bonding = asearch -> recompute_bonding;
1993 bsearch -> set_for_all = asearch -> set_for_all;
1994 bsearch -> int_b = asearch -> int_b;
1998 bsearch -> todo_size = asearch -> todo_size;
1999 bsearch -> todo =
duplicate_int (bsearch -> todo_size, asearch -> todo);
2002 bsearch -> pointer[i].a = asearch -> pointer[i].a;
2003 bsearch -> pointer[i].b = asearch -> pointer[i].b;
2004 bsearch -> pointer[i].c = asearch -> pointer[i].c;
2028 if (this_search -> mode)
2042 if (this_proj -> modelgl -> atom_win -> visible)
2044 for (i=0; i<5; i++)
widget_set_sensitive (gtk_notebook_get_nth_page(GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook), i), this_proj -> natomes);
2045 widget_set_sensitive (gtk_notebook_get_nth_page(GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook), 3), 1);
2052 show_info (
"Nothing to be done, check selection !", 0, this_proj -> modelgl -> atom_win -> win);
2056 show_info (
"Nothing to be done, check selection and/or MSD !", 0, this_proj -> modelgl -> atom_win -> win);
int action_atoms_from_project(project *this_proj, atom_search *asearch, gboolean visible)
apply atom edition action to project (motion, remove, replace, insert, random move)
void setup_default_lights(project *this_proj, image *img)
initialize lightning for an image data structure
atom_search * duplicate_atom_search(atom_search *asearch)
duplicate atom search data structure
void free_dummies(dummy_atom *tmp_pick)
free atom dummy list
void apply_action(project *this_proj, atom_search *asearch)
apply edition action
gboolean do_we_have_objects_in_selection(project *this_proj, atom_search *asearch, gboolean editing)
check for object(s) in selection to apply action
void prepare_random_action(project *this_proj, atom_search *asearch)
prepare random action
void clean_motion_search(project *this_proj, atom_search *asearch, int sid)
clean atom search motion data
void clean_this_project(project *this_proj)
clean project data for the edition process
void clean_all_trees(atom_search *asearch, project *this_proj)
clean all tree models in the 'model edition' window
G_MODULE_EXPORT void take_action(GtkButton *but, gpointer data)
take edition action
GLdouble get_max_depth(GLdouble depth)
guess a reasonable maximum OpenGL window depth
void print_coord_info(project *this_proj, coord_info *coord)
print coordination info
coord_info * duplicate_coord_info(coord_info *old_coord)
duplicate coordination information data structure
void recover_opengl_data(project *this_proj, int nmols, int add, int rem, int *num, int *rec, int ***tmpgeo, gboolean *showfrag)
recover image pointer data and OpenGL window menu structure
void clean_other_window_after_edit(project *this_proj)
update other windows after model edition if required
Function declarations for the mode edition window.
chemical_data * duplicate_chemical_data(int spec, chemical_data *chem)
duplicate chemical data information
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
double ** save_coordinates(project *this_proj, int status)
save atomic coordinates
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
atom_search * remove_search
void add_bonds_to_list(int **new_bond_list, int nat, int nbd, atomic_object *object)
add object bond(s) list to overall bond(s) list
int find_this_geo_id(int id, coord_info *obj, int *old_z, int old_geo, int old_sp, int new_sp, coord_info *coord, double *new_z)
if required create a new geometry, stored in coord, for coordination type 'gid' and chemical species ...
int find_spec_id(int s, int z, double *list_z)
find species id based on Z
int search_for_new_spec(atom_edition *edit, atomic_object *object)
search for new chemical species
void add_bonds_to_project(project *this_proj, int removed, int nbd, int **new_bond_list)
add bond list to project bond list
void init_coordinates(project *this_proj, int status, gboolean win, gboolean init)
preserve atomic coordinates
void random_move(project *this_proj, atom_search *asearch)
random move
chemical_data * alloc_chem_data(int spec)
allocate chemistry data
void update_search_tree(atom_search *asearch)
update search tree
int get_asearch_num_objects(atom_search *asearch)
the number of type of object(s) in this atom search
void free_glwin_spec_data(project *this_proj, int spec)
free the memory used by the chemical species related data in a glwin data structure
void glwin_init_spec_data(project *this_proj, int nspec)
initialize the glwin chemical species related pointers
void re_populate_tree_search(atom_search *asearch)
re populate search tree after atom action if >= 10 000 atoms
int get_asearch_filter(atom_search *asearch)
get asearch filter
void prepare_opengl_menu_bar(glwin *view)
update the OpenGL window menu bar
void to_remove_this_list_of_objects(project *this_proj, atom_search *asearch)
prepaer to remove a list of object(s) from a project, one object after another.
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
gboolean * remove_bonds_from_project(project *this_proj, atomic_object *this_object, int *old_id, atom *new_list, gboolean remove, gboolean passivate)
remove bond(s) from project
void clean_picked_and_labelled(atom_search *asearch, gboolean clean_msd)
initialize atom search data buffers
atomic_object * duplicate_atomic_object(atomic_object *old_obj)
duplicate an insert object
vec3_t get_bary(project *this_proj, int status)
get barycenter of atomic coordinates
void check_coord_modification(project *this_proj, int old_id[], atom *new_list, atomic_object *this_object, gboolean movtion, gboolean passivating)
void allocate_todo(atom_search *asearch, int tsize)
allocate the selection list data buffer
void center_molecule(project *this_proj)
center atomic coordinates around (0,0,0)
atomic_object * get_atomic_object_by_origin(atomic_object *first, int oid, int aid)
get insert object from a list by id
void clean_coord_window(project *this_proj)
update the environment configuration window after edtion
G_MODULE_EXPORT void set_filter_changed(GtkComboBox *box, gpointer data)
change the search filter
G_MODULE_EXPORT void set_color_map(GtkWidget *widg, gpointer data)
set color map callback
Binding to the Fortran90 subroutines.
double set_radius_(int *, int *)
double set_neutron_(int *)
integer(kind=c_int) function bonding(scf, sbf, adv, bdist, bmin, delt_ij, sfil)
void initcwidgets()
initializing curve values
GtkFileFilter * filter[NCFORMATS+1]
integer function chains()
integer(kind=c_int) function chemistry()
void erase_curves(project *this_proj, int c)
free all curve(s) data
void hide_curves(project *this_proj, int c)
for project hide all curves for a calculation
Variable declarations for the curve widget Functions for interactions with the curve widget.
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
void process_selected_atom(project *this_proj, glwin *view, int id, int ac, int se, int pi)
process selected atom
int * duplicate_int(int num, int *old_val)
copy a list of int
float * duplicate_float(int num, float *old_val)
copy a list of float
int ** allocdint(int xal, int yal)
allocate an int ** pointer
double * duplicate_double(int num, double *old_val)
copy a list of double
gboolean * allocbool(int val)
allocate a gboolean * pointer
double * allocdouble(int val)
allocate a double * pointer
int * allocint(int val)
allocate an int * pointer
float * allocfloat(int val)
allocate a float * pointer
void update_chains_menus(glwin *view)
#define ATOM_LIMIT
atom number limit to compute fragment(s) and molecule(s) analysis automatically
element_data periodic_table_info[]
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
void clean_rings_data(int rid, glwin *view)
clean a ring type data for a glview
void opengl_project_changed(int id)
change the OpenGL project
G_MODULE_EXPORT void on_calc_bonds_released(GtkWidget *widg, gpointer data)
compute bonding properties
G_MODULE_EXPORT void label_unlabel_atoms(GtkWidget *widg, gpointer data)
label / unlabel a type of atom(s) callback GTK3
void clean_chains_data(glwin *view)
cleaning the OpenGL data related to chain statistics
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
G_MODULE_EXPORT void select_unselect_atoms(GtkWidget *widg, gpointer data)
select / unselect a type of atom(s) callback GTK3
void clean_volumes_data(glwin *view)
clean volume data
void initcutoffs(chemical_data *chem, int species)
initialize bond cutoffs
void update_rings_menus(glwin *view)
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 sort(int dim, int *tab)
sort, nim to max, a table by integer value
void re_create_md_shaders(int nshaders, int shaders[nshaders], project *this_proj)
re-initialize some MD dependent OpenGL shaders
atom * duplicate_atom(atom *at)
copy (partially) an atom data structure
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
shaders
The different types of shaders in the atomes program.
void init_curves_and_calc(project *this_proj)
for a project reset analysis, curves, data to not performed
void show_info(char *information, int val, GtkWidget *win)
add / show information message to widget
void prep_calc_actions()
prepare analysis widgets
integer(kind=c_int) function msd(dlt, ndts)
Preference variable declarations.
void active_project_changed(int id)
change the active project