66 tmp_pick = tmp_pick -> next;
67 g_free (tmp_pick -> prev);
68 tmp_pick -> prev = NULL;
95 gboolean vis_stat =
opengl_project -> modelgl -> atom_win -> visible;
132 g_free (this_proj ->
atoms[0]);
177 if (asearch -> in_selection)
179 for (i=0; i<asearch -> todo_size; i++) asearch -> todo[i] = 0;
180 asearch -> in_selection = 0;
181 if (this_proj -> modelgl -> atom_win -> to_be_moved[sid])
183 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_moved[sid];
184 while (
object -> next)
186 object =
object -> next;
187 g_free (
object -> prev);
190 this_proj -> modelgl -> atom_win -> to_be_moved[sid] = NULL;
193 this_proj -> modelgl -> atom_win -> rebuilt[! sid] = TRUE;
194 this_proj -> modelgl -> atom_win -> rebuilt[sid] = FALSE;
208 int i, j, k, l, m, n, o, p;
214 int remove,
extra, nmols;
215 int act = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
217 to_rem = tmp_rem = NULL;
218 to_add = tmp_add = NULL;
219 remove =
extra = nmols = 0;
221 edit -> add_spec = 0;
222 if (this_proj -> nspec)
227 else if (! this_proj -> natomes)
229 edit -> coord = NULL;
231 gboolean passivate = FALSE;
234 if (this_proj -> modelgl -> cell_win)
236 if (this_proj -> modelgl -> cell_win -> slab_passivate) passivate = TRUE;
242 for (i=0; i<this_proj -> natomes; i++)
244 if (asearch -> todo[i])
248 tmp_rem -> next = g_malloc0 (
sizeof*tmp_rem);
249 tmp_rem -> next -> prev = tmp_rem;
250 tmp_rem = tmp_rem -> next;
254 to_rem = g_malloc0 (
sizeof*to_rem);
264 object = edit -> to_be_inserted[act];
272 if (asearch -> todo[j])
281 edit -> new_z =
allocdouble (edit -> coord -> species);
282 for (k=0; k<edit -> coord -> species; k++) edit -> new_z[k] = (
double)
object -> old_z[k];
283 o +=
object -> species;
285 asearch -> in_selection --;
289 tmp_list = object_list;
294 tmp_list -> next -> prev = tmp_list;
295 tmp_list = tmp_list -> next;
297 for (k=0; k<
object ->
atoms; k++)
301 tmp_add -> next = g_malloc0 (
sizeof*tmp_add);
302 tmp_add -> next -> prev = tmp_add;
303 tmp_add = tmp_add -> next;
307 to_add = g_malloc0 (
sizeof*to_add);
310 tmp_add ->
id = this_proj -> natomes +
extra - remove;
311 l =
object -> at_list[k].sp;
312 tmp_add -> type =
find_spec_id (edit -> coord -> species,
object -> old_z[l], edit -> new_z);
313 tmp_add -> xyz[0] =
object -> at_list[k].x +
object -> baryc[0];
314 tmp_add -> xyz[1] =
object -> at_list[k].y +
object -> baryc[1];
315 tmp_add -> xyz[2] =
object -> at_list[k].z +
object -> baryc[2];
318 tmp_add -> coord[m] =
find_this_geo_id (m,
object -> coord,
object -> old_z,
object -> at_list[k].coord[m],
319 l, tmp_add -> type, edit -> coord, edit -> new_z);
322 for (m=2; m<4; m++) tmp_add -> coord[m] =
object -> at_list[k].coord[2] + i;
323 if (this_proj -> coord)
325 for (m=2; m<4; m++) tmp_add -> coord[m] += this_proj -> coord -> totcoord[m];
327 tmp_add -> numv =
object -> at_list[k].
numv;
330 tmp_add -> vois =
duplicate_int (
object -> at_list[k].numv,
object -> at_list[k].vois);
331 for (m=0; m<tmp_add -> numv; m++) tmp_add -> vois[m] += p + this_proj -> natomes;
332 sort (tmp_add ->numv, tmp_add -> vois);
336 i +=
object -> coord -> totcoord[2];
337 p +=
object ->
atoms;
342 object -> prev -> next =
object -> next;
343 object -> next -> prev =
object -> prev;
345 object =
object -> next;
350 object -> prev -> next = NULL;
359 edit -> to_be_inserted[act] =
object -> next;
360 object =
object -> next;
361 g_free (
object -> prev);
362 object -> prev = NULL;
366 g_free (edit -> to_be_inserted[act]);
367 edit -> to_be_inserted[act] = NULL;
374 object =
object -> next;
378 edit -> coord -> totcoord[2] += i;
379 edit -> add_spec = o;
385 g_debug (
"Project coord before insert:");
386 if (this_proj -> natomes)
392 g_debug (
" *** None *** ");
394 g_debug (
"Coord info after object insert:");
399 if (asearch ->
action ==
DISPL && remove == 0)
return -1;
401 if (asearch ->
action ==
REMOVE && remove == 0)
return -1;
403 if (asearch ->
action ==
REMOVE && remove > this_proj -> natomes)
return -1;
406 || (asearch -> passivating && asearch ->
filter < 3)
407 || (asearch ->
action ==
RANMOVE && asearch -> passivating && asearch ->
object < 2)
408 || (asearch ->
action ==
RANMOVE && ! asearch -> passivating && ! asearch ->
object))
410 this_proj -> modelgl ->
bonding = FALSE;
411 this_proj -> coord -> totcoord[3] = 0;
412 if (this_proj -> modelgl -> adv_bonding[1])
416 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[i] == 4 || this_proj -> modelgl -> anim -> last ->
img -> color_map[i] == 5)
420 if (this_proj -> modelgl -> color_styles[i*
ATOM_MAPS])
422 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> color_styles[i*
ATOM_MAPS], TRUE);
429 this_proj -> modelgl -> adv_bonding[1] = FALSE;
430 if (this_proj -> force_field[0])
432 g_free (this_proj -> force_field[0]);
433 this_proj -> force_field[0] = NULL;
437 if (this_proj -> modelgl -> custom_map)
439 g_free (this_proj -> modelgl -> custom_map);
440 this_proj -> modelgl -> custom_map = NULL;
445 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> color_styles[j], TRUE);
446 set_color_map (this_proj -> modelgl -> color_styles[j], & this_proj -> modelgl ->
colorp[j][0]);
457 this_proj -> visok[i]=FALSE;
461 if (this_proj -> modelgl -> rings)
463 this_proj -> modelgl -> rings = FALSE;
472 if (this_proj -> modelgl ->
chains)
481 if (asearch ->
action ==
REMOVE && remove == this_proj -> natomes)
487 atom * new_list = NULL;
488 atom * tmp_new = NULL;
493 if (this_proj -> natomes)
495 old_id =
allocint (this_proj -> natomes);
497 for (i=0; i<this_proj -> natomes; i++)
499 if (tmp_rem && tmp_rem ->
id == i)
507 tmp_new -> next -> prev = tmp_new;
508 tmp_new = tmp_new -> next;
517 if (tmp_rem -> next != NULL) tmp_rem = tmp_rem -> next;
525 tmp_new -> next -> prev = tmp_new;
526 tmp_new = tmp_new -> next;
547 if (old_id[tmp_new ->
id] > 0) i++;
548 tmp_new = tmp_new -> next;
556 j= this_proj -> nspec + edit -> add_spec;
557 tmpgeo[i] = g_malloc (j*
sizeof*tmpgeo[i]);
560 tmpgeo[i][k] =
allocint (edit -> coord -> ntg[i][k]);
569 if (! passivate || old_id[j] > 0)
573 m = tmp_new -> coord[l];
574 if (m >= edit -> coord -> ntg[l][k])
576 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]);
581 tmp_new = tmp_new -> next;
590 i = edit -> coord -> totcoord[2];
591 j = this_proj -> coord -> totcoord[2];
595 showfrag[k] = this_proj -> modelgl -> anim -> last ->
img -> show_coord[2][k];
597 for (k=j; k<i; k++) showfrag[k] = TRUE;
604 tmpgeo[i] = g_malloc (edit -> coord -> species*
sizeof*tmpgeo[i]);
605 for (j=0; j<edit -> coord -> species; j++)
607 tmpgeo[i][j] =
allocint (edit -> coord -> ntg[i][j]);
610 showfrag =
allocbool(edit -> coord -> totcoord[2]);
611 for (j=0; j<edit -> coord -> totcoord[2]; j++)
626 if (old_id[tmp_new ->
id] > 0 || asearch ->
action !=
REMOVE)
628 if (tmp_new ->
pick[0] || tmp_new ->
pick[1])
632 tmp_add -> next = g_malloc0 (
sizeof*tmp_add);
633 tmp_add -> next -> prev = tmp_add;
634 tmp_add = tmp_add -> next;
638 to_add = g_malloc0 (
sizeof*to_add);
641 for (j=0; j<2; j++) tmp_add ->
pick[j] = tmp_new ->
pick[j];
647 tmp_new = tmp_new -> next;
656 while (tmp_new -> next) tmp_new = tmp_new -> next;
662 tmp_new -> next = g_malloc0 (
sizeof*tmp_new -> next);
663 tmp_new -> next -> prev = tmp_new;
664 tmp_new = tmp_new -> next;
668 new_list = g_malloc0 (
sizeof*new_list);
671 tmp_new -> sp = tmp_add -> type;
672 tmp_new -> show[0] = tmp_new -> show[1] = TRUE;
673 tmp_new ->
x = tmp_add -> xyz[0];
674 tmp_new ->
y = tmp_add -> xyz[1];
675 tmp_new ->
z = tmp_add -> xyz[2];
676 for (i=0; i<4; i++) tmp_new -> coord[i] = tmp_add -> coord[i];
680 k = tmp_add -> coord[j];
684 tmp_new -> numv = tmp_add -> numv;
685 if (tmp_new -> numv) tmp_new -> vois =
duplicate_int (tmp_new -> numv, tmp_add -> vois);
688 tmp_add ->
pick[0] = TRUE;
689 tmp_add = tmp_add -> next;
696 i +=
object ->
bonds;
697 object =
object -> next;
701 object = object_list;
705 i +=
object ->
atoms;
706 j +=
object ->
bonds;
709 object =
object -> next;
710 g_free (
object -> prev);
721 if (this_proj -> natomes)
725 gboolean vis_stat =
opengl_project -> modelgl -> atom_win -> visible;
744 if (this_proj -> nspec)
746 g_free (this_proj ->
atoms[0]);
750 this_proj ->
atoms = g_malloc0 (
sizeof*this_proj ->
atoms);
755 spid =
allocint (this_proj -> nspec + edit -> add_spec);
756 spdel =
allocint (this_proj -> nspec + edit -> add_spec);
758 this_proj ->
atoms[0] = g_malloc0 (new_atoms*
sizeof*this_proj ->
atoms[0]);
763 if (asearch ->
action !=
REMOVE || old_id[tmp_new ->
id] > 0)
766 this_proj ->
atoms[0][i].
id = i;
767 spid[this_proj ->
atoms[0][i].sp] ++;
768 atid[i] = this_proj ->
atoms[0][i].sp;
769 this_proj ->
atoms[0][i].pick[0] = this_proj ->
atoms[0][i].pick[1] = FALSE;
774 tmp_new = tmp_new -> next;
775 g_free (tmp_new -> prev);
783 if (old_id) g_free (old_id);
786 for (i=0; i<this_proj -> nspec + edit -> add_spec; i++)
799 if (rem_spec || edit -> add_spec)
801 int new_spec = this_proj -> nspec - rem_spec + edit -> add_spec;
804 for (j=0; j<this_proj -> nspec; j++)
808 newchem -> nsps[i] = this_proj ->
chemistry -> nsps[j];
809 newchem -> formula[i] = this_proj ->
chemistry -> formula[j];
814 newchem -> chem_prop[k][i] = this_proj ->
chemistry -> chem_prop[k][j];
817 if (j < this_proj -> nspec-1)
820 for (l=j; l<this_proj -> nspec; l++)
824 newchem -> cutoffs[i][k] = newchem -> cutoffs[k][i] = this_proj ->
chemistry -> cutoffs[j][l];
829 newchem -> nsps[i] = spid[j];
833 j = (this_proj -> nspec) ? 1 : 0;
834 for (k=0; k<edit -> add_spec - j*rem_spec; k++)
836 l = this_proj -> nspec + k;
839 newchem -> nsps[i] = spid[l];
840 newchem -> formula[i] = 0;
841 newchem -> chem_prop[
CHEM_Z][i] = newchem -> chem_prop[
CHEM_X][i] = edit -> new_z[l];
842 m = (int)newchem -> chem_prop[
CHEM_Z][i];
849 newchem -> chem_prop[
CHEM_X][i] = newchem -> chem_prop[
CHEM_Z][i];
854 for (i=0; i<new_atoms; i++)
856 atid[i] -= spdel[atid[i]];
857 this_proj ->
atoms[0][i].sp = atid[i];
873 if (! this_proj -> natomes)
875 this_proj -> natomes = new_atoms;
880 this_proj -> natomes = new_atoms;
884 recover_opengl_data (this_proj, nmols, edit -> add_spec, rem_spec, spid, spdel, tmpgeo, showfrag);
892 if (this_proj -> natomes)
898 g_debug (
" *** None *** ");
902 g_free (edit -> new_z);
922 if (asearch -> recompute_bonding)
936 this_proj -> modelgl -> create_shaders[
PICKS] = TRUE;
937 this_proj -> modelgl -> create_shaders[
MDBOX] = TRUE;
938 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
939 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
943 while (tmp_add != NULL)
947 if (tmp_add ->
pick[i])
952 tmp_add = tmp_add -> next;
961 g_free (this_proj -> modelgl -> saved_coord[i]);
962 this_proj -> modelgl -> saved_coord[i] = NULL;
965 this_proj -> modelgl ->
was_moved = FALSE;
966 this_proj -> modelgl -> atom_win -> rebuilt[0] = FALSE;
967 this_proj -> modelgl -> atom_win -> rebuilt[1] = FALSE;
968 if (this_proj -> modelgl -> atom_win ->
msd) g_free (this_proj -> modelgl -> atom_win ->
msd);
969 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
970 if (this_proj -> modelgl -> atom_win -> msd_all) g_free (this_proj -> modelgl -> atom_win -> msd_all);
971 this_proj -> modelgl -> atom_win -> msd_all =
allocfloat (this_proj -> nspec);
972 for (i=0; i<2; i++)
clean_motion_search (this_proj, this_proj -> modelgl -> search_widg[2+4*i], i);
977 this_proj -> modelgl ->
was_moved = TRUE;
981 else if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
983 g_free (this_proj -> modelgl -> saved_coord[1]);
985 this_proj -> modelgl -> baryc[1] =
get_bary (this_proj, 1);
987 update (this_proj -> modelgl);
989 update_menu_bar (this_proj -> modelgl);
993 switch (asearch ->
action)
1026 if (this_proj -> modelgl -> search_widg[
INSERT] -> in_selection)
1028 allocate_todo (this_proj -> modelgl -> search_widg[i+2], this_proj -> modelgl -> search_widg[
INSERT] -> in_selection);
1029 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_inserted[1];
1035 object =
object -> next;
1040 else if (this_proj -> modelgl -> search_widg[i+2] -> atom_tree)
1043 if ((j == 3 && ! this_proj -> modelgl -> adv_bonding[0]) || (j == 4 && ! this_proj -> modelgl -> adv_bonding[1]))
1045 gtk_combo_box_set_active (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), 0);
1046 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), this_proj -> modelgl -> search_widg[i+2]);
1050 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), this_proj -> modelgl -> search_widg[i+2]);
1054 if ((i == 0 || i == 4) && this_proj -> modelgl -> search_widg[i+2] -> todo_size >= 10000)
1059 if ((this_proj -> modelgl -> atom_win -> adv_bonding[0] && ! this_proj -> modelgl -> adv_bonding[0])
1060 || (this_proj -> modelgl -> atom_win -> adv_bonding[1] && ! this_proj -> modelgl -> adv_bonding[1]))
1067 if (this_proj -> modelgl -> search_widg[i+2] -> passivating)
1069 j = (this_proj -> modelgl -> search_widg[i+2] ->
object < 2) ? 3 : 2;
1073 j = (! this_proj -> modelgl -> search_widg[i+2] -> object) ? 3 : 2;
1075 if (GTK_IS_WIDGET(this_proj -> modelgl -> search_widg[i+2] -> filter_box))
1077 if (this_proj -> modelgl -> atom_win -> adv_bonding[1] && ! this_proj -> modelgl -> adv_bonding[1])
1079 gtk_combo_box_text_remove ((GtkComboBoxText *) this_proj -> modelgl -> search_widg[i+2] -> filter_box, j+1);
1081 if (this_proj -> modelgl -> atom_win -> adv_bonding[0] && ! this_proj -> modelgl -> adv_bonding[0])
1083 gtk_combo_box_text_remove ((GtkComboBoxText *) this_proj -> modelgl -> search_widg[i+2] -> filter_box, j);
1089 for (i=0 ;i<2; i++) this_proj -> modelgl -> atom_win -> adv_bonding[i] = this_proj -> modelgl -> adv_bonding[i];
1103 gchar * appl[3] = {
"replaced",
"removed",
"inserted"};
1106 gboolean visible = (this_proj -> modelgl -> atom_win) ? this_proj -> modelgl -> atom_win -> visible : FALSE;
1120 str = g_strdup_printf (
"No atoms to be %s !", appl[asearch ->
action-3]);
1125 if (asearch -> pointer[0].
c == 8) l += asearch -> int_b - k;
1126 str = g_strdup_printf (
"%d atom(s) removed !\n%d atom(s) inserted !", l, k);
1130 str = g_strdup_printf (
"%d atom(s) %s !", k, appl[asearch ->
action-3]);
1134 if (this_proj -> modelgl -> atom_win -> win)
1136 show_info (str, 0, this_proj -> modelgl -> atom_win -> win);
1140 show_info (str, 0, this_proj -> modelgl -> win);
1148 if (this_proj -> modelgl -> atom_win)
1150 if (this_proj -> modelgl -> atom_win -> visible)
clean_all_trees (asearch, this_proj);
1151 if (this_proj -> modelgl -> atom_win ->
msd)
1153 g_free (this_proj -> modelgl -> atom_win ->
msd);
1154 this_proj -> modelgl -> atom_win ->
msd = NULL;
1156 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
1173 int i, j, k, l, m, n, o, p, q;
1178 int max_num, total_num;
1179 gboolean lets_do_this = (asearch ->
action ==
REMOVE || (asearch ->
action ==
REPLACE && this_proj -> modelgl -> atom_win -> to_be_inserted[0])) ? TRUE : FALSE;
1184 int num_elem = asearch -> todo_size;
1185 int * random_todo =
duplicate_int (num_elem, asearch -> todo);
1186 total_num = (asearch -> mode &&
filter > 2 && obj) ? this_proj -> coord -> totcoord[2] : this_proj -> natomes;
1187 g_free (asearch -> todo);
1189 if (asearch ->
action ==
REPLACE && this_proj -> modelgl -> atom_win -> to_be_inserted[0])
1191 tmp_oba = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
1194 while (tmp_oba -> next)
1196 tmp_oba = tmp_oba -> next;
1198 tmp_obb = tmp_obb -> next;
1200 g_free (this_proj -> modelgl -> atom_win -> to_be_inserted[0]);
1201 this_proj -> modelgl -> atom_win -> to_be_inserted[0] = NULL;
1204 asearch -> in_selection = 0;
1206 for (i=0; i<num_elem; i++)
1214 max_num = this_proj ->
chemistry -> nsps[i];
1217 for (j=0; j<this_proj -> natomes; j++)
1219 if (this_proj ->
atoms[0][j].numv == i) max_num ++;
1224 for (k=0; k<this_proj -> nspec; k++)
1226 j += this_proj -> coord -> ntg[1][k];
1230 for (m=0; m<k; m++) l += this_proj -> coord -> ntg[1][m];
1232 for (l=0; l<this_proj -> natomes; l++)
1234 if (this_proj ->
atoms[0][l].sp == k && this_proj ->
atoms[0][l].coord[1] == p) max_num ++;
1240 max_num = this_proj -> coord -> totcoord[2];
1244 for (l=0; l<this_proj -> natomes; l++)
1246 if (this_proj ->
atoms[0][l].coord[2] == i) max_num ++;
1251 molfc = & this_proj -> modelfc -> mols[0][i];
1254 max_num = molfc -> multiplicity;
1258 max_num = molfc -> natoms*molfc -> multiplicity;
1262 test = 1.0 / max_num;
1265 clock_t begin = clock();
1267 while (j < random_todo[i])
1270 for (m=0; m<total_num; m++)
1272 if (! asearch -> todo[m])
1277 n = this_proj ->
atoms[0][m].sp;
1283 if (n == i) doit = TRUE;
1286 if (this_proj ->
atoms[0][m].numv == i) doit = TRUE;
1290 for (q=0;q<n;q++) o += this_proj -> coord -> ntg[1][q];
1291 if (o == i) doit = TRUE;
1294 if (this_proj ->
atoms[0][m].coord[
filter-1] == i) doit = TRUE;
1305 for (n=0; n<molfc -> multiplicity; n++)
1307 if (molfc -> fragments[n] == m)
1317 o = (o+1)*max_num*m;
1319 if (prob >= (l-1)*test && prob < l*test)
1322 asearch -> todo[m] = 1;
1325 if (this_proj -> modelgl -> atom_win -> to_be_inserted[0] == NULL)
1328 tmp_obb = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
1333 tmp_obb -> next -> prev = tmp_obb;
1334 tmp_obb = tmp_obb -> next;
1338 asearch -> in_selection ++;
1339 if (j == random_todo[i])
break;
1347 if (tmp_oba -> next != NULL) tmp_oba = tmp_oba -> next;
1352 if (random_todo) g_free (random_todo);
1353 int old_filter = asearch ->
filter;
1356 asearch ->
filter = old_filter;
1371 int i, j, k, l, m, n, o, p, q;
1372 gboolean taking_action = FALSE;
1375 taking_action = TRUE;
1380 if (asearch -> mode)
1382 for (l=0; l<asearch -> todo_size; l++)
1384 if (asearch -> todo[l]) i++;
1389 if (asearch -> todo[l]) j ++;
1394 if (asearch ->
pick[l] && asearch -> todo[l]) j ++;
1399 taking_action = TRUE;
1401 else if (asearch ->
action ==
REPLACE && i == j && i == asearch -> in_selection)
1403 taking_action = TRUE;
1408 m = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
1412 int * pass_todo = NULL;
1416 float * tmp_msd = NULL;
1417 if (asearch -> passivating)
1419 if (
object > 1 &&
filter > 2)
1421 pass_size = this_proj -> coord -> totcoord[
filter - 1];
1425 pass_size = this_proj -> natomes;
1430 switch (asearch ->
action)
1433 for (l=0; l<asearch -> todo_size; l++)
1435 if (asearch -> todo[l]) i ++;
1438 if (asearch -> todo[l])
1440 if (asearch -> passivating)
1447 for (n=0; n<this_proj -> natomes; n++)
1449 if (this_proj ->
atoms[0][n].sp == l)
1451 pass_todo[n] = asearch -> todo[l];
1457 for (n=0; n<this_proj -> natomes; n++)
1459 if (this_proj ->
atoms[0][n].numv == l)
1461 pass_todo[n] = asearch -> todo[l];
1467 for (n=0; n<this_proj -> natomes; n++)
1470 p = this_proj ->
atoms[0][n].sp;
1471 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1474 pass_todo[n] = asearch -> todo[l];
1480 for (n=0; n<this_proj -> natomes; n++)
1485 pass_todo[n] = asearch -> todo[l];
1497 for (n=0; n<this_proj -> natomes; n++)
1499 if (this_proj ->
atoms[0][n].numv == l)
1501 pass_todo[n] = asearch -> todo[l];
1503 if (! passivating_object)
1506 pao = passivating_object;
1511 pao -> next -> prev = pao;
1518 for (n=0; n<this_proj -> natomes; n++)
1521 p = this_proj ->
atoms[0][n].sp;
1522 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1525 pass_todo[n] = asearch -> todo[l];
1527 if (! passivating_object)
1530 pao = passivating_object;
1535 pao -> next -> prev = pao;
1542 for (n=0; n<this_proj -> coord -> totcoord[
filter -1]; n++)
1546 pass_todo[n] = asearch -> todo[l];
1548 if (! passivating_object)
1551 pao = passivating_object;
1556 pao -> next -> prev = pao;
1570 for (l=0; l<asearch -> todo_size; l++)
1572 if (asearch -> todo[l]) i ++;
1576 if (asearch -> todo[l])
1579 if (asearch -> passivating)
1584 for (n=0; n<this_proj -> natomes; n++)
1586 if (this_proj ->
atoms[0][n].sp == l)
1588 pass_todo[n] = asearch -> todo[l];
1589 if (! passivating_object)
1592 pao = passivating_object;
1599 pao -> next -> prev = pao;
1607 for (n=0; n<this_proj -> natomes; n++)
1609 if (this_proj ->
atoms[0][n].numv == l)
1611 pass_todo[n] = asearch -> todo[l];
1612 if (! passivating_object)
1615 pao = passivating_object;
1622 pao -> next -> prev = pao;
1630 for (n=0; n<this_proj -> natomes; n++)
1633 p = this_proj ->
atoms[0][n].sp;
1634 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1637 pass_todo[n] = asearch -> todo[l];
1638 if (! passivating_object)
1641 pao = passivating_object;
1648 pao -> next -> prev = pao;
1657 for (n=0; n<this_proj -> natomes; n++)
1662 pass_todo[n] = asearch -> todo[l];
1663 if (! passivating_object)
1666 pao = passivating_object;
1673 pao -> next -> prev = pao;
1682 pass_todo[l] = asearch -> todo[l];
1683 if (! passivating_object)
1686 pao = passivating_object;
1693 pao -> next -> prev = pao;
1706 for (l=0; l<asearch -> todo_size; l++)
1708 if (asearch -> todo[l])
1711 if (asearch -> passivating)
1716 for (n=0; n<this_proj -> natomes; n++)
1718 if (this_proj ->
atoms[0][n].sp == l)
1726 for (n=0; n<this_proj -> natomes; n++)
1728 if (this_proj ->
atoms[0][n].numv == l)
1736 for (n=0; n<this_proj -> natomes; n++)
1739 p = this_proj ->
atoms[0][n].sp;
1740 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1750 for (n=0; n<this_proj -> natomes; n++)
1772 for (l=0; l<asearch -> todo_size; l++)
1774 if (asearch -> passivating)
1776 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win -> msd_all[l] > 0.0)
1784 for (n=0; n<this_proj -> natomes; n++)
1786 if (this_proj ->
atoms[0][n].sp == l)
1788 pass_todo[n] = asearch -> todo[l];
1789 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1795 for (n=0; n<this_proj -> natomes; n++)
1797 if (this_proj ->
atoms[0][n].numv == l)
1799 pass_todo[n] = asearch -> todo[l];
1800 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1806 for (n=0; n<this_proj -> natomes; n++)
1809 p = this_proj ->
atoms[0][n].sp;
1810 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1813 pass_todo[n] = asearch -> todo[l];
1814 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1820 for (n=0; n<this_proj -> natomes; n++)
1825 pass_todo[n] = asearch -> todo[l];
1826 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1838 for (n=0; n<this_proj -> natomes; n++)
1840 if (this_proj ->
atoms[0][n].numv == l)
1842 pass_todo[n] = asearch -> todo[l];
1843 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1844 if (! passivating_object)
1847 pao = passivating_object;
1852 pao -> next -> prev = pao;
1860 for (n=0; n<this_proj -> natomes; n++)
1863 p = this_proj ->
atoms[0][n].sp;
1864 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1867 pass_todo[n] = asearch -> todo[l];
1868 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1869 if (! passivating_object)
1872 pao = passivating_object;
1877 pao -> next -> prev = pao;
1885 for (n=0; n<this_proj -> coord -> totcoord[
filter -1]; n++)
1889 pass_todo[n] = asearch -> todo[l];
1891 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1892 if (! passivating_object)
1895 pao = passivating_object;
1900 pao -> next -> prev = pao;
1910 else if (
object &&
filter > 2)
1912 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win -> msd_all[l] > 0.0) i ++;
1916 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win ->
msd[l] > 0.0) i ++;
1923 taking_action = TRUE;
1927 if (asearch -> in_selection == i && i == j) taking_action = TRUE;
1931 asearch -> in_selection = i;
1932 if (i) taking_action = TRUE;
1934 if (asearch -> passivating && taking_action && editing)
1936 g_free (asearch -> todo);
1939 asearch -> todo_size = pass_size;
1940 asearch -> in_selection = k;
1941 switch (asearch ->
action)
1944 this_proj -> modelgl -> atom_win -> to_be_moved[0] = passivating_object;
1947 this_proj -> modelgl -> atom_win -> to_be_inserted[m] = passivating_object;
1950 if (this_proj -> modelgl -> atom_win ->
msd) g_free (this_proj -> modelgl -> atom_win ->
msd);
1951 this_proj -> modelgl -> atom_win ->
msd =
duplicate_float (this_proj -> natomes, tmp_msd);
1953 this_proj -> modelgl -> atom_win -> to_be_moved[1] = passivating_object;
1960 return taking_action;
1972 atom_search * bsearch = g_malloc0 (
sizeof*bsearch);
1973 bsearch -> search_digit = asearch -> search_digit;
1977 bsearch -> mode = asearch -> mode;
1978 bsearch ->
object = asearch -> object;
1980 bsearch -> search_digit = asearch -> search_digit;
1981 bsearch -> spec_to_add = asearch -> spec_to_add;
1982 bsearch -> num_to_add = asearch -> num_to_add;
1983 bsearch -> in_selection = asearch -> in_selection;
1984 bsearch -> passivating = asearch -> passivating;
1985 bsearch -> was_selected = asearch -> was_selected;
1986 bsearch -> recompute_bonding = asearch -> recompute_bonding;
1987 bsearch -> set_for_all = asearch -> set_for_all;
1988 bsearch -> int_b = asearch -> int_b;
1992 bsearch -> todo_size = asearch -> todo_size;
1993 bsearch -> todo =
duplicate_int (bsearch -> todo_size, asearch -> todo);
1996 bsearch -> pointer[i].a = asearch -> pointer[i].a;
1997 bsearch -> pointer[i].b = asearch -> pointer[i].b;
1998 bsearch -> pointer[i].c = asearch -> pointer[i].c;
2022 if (this_search -> mode)
2036 if (this_proj -> modelgl -> atom_win -> visible)
2038 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);
2039 widget_set_sensitive (gtk_notebook_get_nth_page(GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook), 3), 1);
2046 show_info (
"Nothing to be done, check selection !", 0, this_proj -> modelgl -> atom_win -> win);
2050 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)
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
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
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 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)
void active_project_changed(int id)
change the active project