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]);
181 if (asearch -> in_selection)
183 for (i=0; i<asearch -> todo_size; i++) asearch -> todo[i] = 0;
184 asearch -> in_selection = 0;
185 if (this_proj -> modelgl -> atom_win -> to_be_moved[sid])
187 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_moved[sid];
188 while (
object -> next)
190 object =
object -> next;
191 g_free (
object -> prev);
194 this_proj -> modelgl -> atom_win -> to_be_moved[sid] = NULL;
197 this_proj -> modelgl -> atom_win -> rebuilt[! sid] = TRUE;
198 this_proj -> modelgl -> atom_win -> rebuilt[sid] = FALSE;
212 int i, j, k, l, m, n, o, p;
218 int remove, extra, nmols;
219 int act = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
221 to_rem = tmp_rem = NULL;
222 to_add = tmp_add = NULL;
223 remove = extra = nmols = 0;
225 edit -> add_spec = 0;
226 if (this_proj -> nspec)
231 else if (! this_proj -> natomes)
233 edit -> coord = NULL;
236 gboolean passivate = FALSE;
239 if (this_proj -> modelgl -> cell_win)
241 if (this_proj -> modelgl -> cell_win -> slab_passivate) passivate = TRUE;
247 for (i=0; i<this_proj -> natomes; i++)
249 if (asearch -> todo[i])
253 tmp_rem -> next = g_malloc0(
sizeof*tmp_rem);
254 tmp_rem -> next -> prev = tmp_rem;
255 tmp_rem = tmp_rem -> next;
259 to_rem = g_malloc0(
sizeof*to_rem);
269 object = edit -> to_be_inserted[act];
277 if (asearch -> todo[j])
286 edit -> new_z =
allocdouble (edit -> coord -> species);
287 for (k=0; k<edit -> coord -> species; k++) edit -> new_z[k] = (
double)
object -> old_z[k];
288 o +=
object -> species;
290 asearch -> in_selection --;
294 tmp_list = object_list;
299 tmp_list -> next -> prev = tmp_list;
300 tmp_list = tmp_list -> next;
302 for (k=0; k<
object ->
atoms; k++)
306 tmp_add -> next = g_malloc0(
sizeof*tmp_add);
307 tmp_add -> next -> prev = tmp_add;
308 tmp_add = tmp_add -> next;
312 to_add = g_malloc0(
sizeof*to_add);
315 tmp_add ->
id = this_proj -> natomes + extra - remove;
316 l =
object -> at_list[k].sp;
317 tmp_add -> type =
find_spec_id (edit -> coord -> species,
object -> old_z[l], edit -> new_z);
318 tmp_add -> xyz[0] =
object -> at_list[k].x +
object -> baryc[0];
319 tmp_add -> xyz[1] =
object -> at_list[k].y +
object -> baryc[1];
320 tmp_add -> xyz[2] =
object -> at_list[k].z +
object -> baryc[2];
323 tmp_add -> coord[m] =
find_this_geo_id (m,
object -> coord,
object -> old_z,
object -> at_list[k].coord[m],
324 l, tmp_add -> type, edit -> coord, edit -> new_z);
327 for (m=2; m<4; m++) tmp_add -> coord[m] =
object -> at_list[k].coord[2] + i;
328 if (this_proj -> coord)
330 for (m=2; m<4; m++) tmp_add -> coord[m] += this_proj -> coord -> totcoord[m];
332 tmp_add -> numv =
object -> at_list[k].
numv;
335 tmp_add -> vois =
duplicate_int (
object -> at_list[k].numv,
object -> at_list[k].vois);
336 for (m=0; m<tmp_add -> numv; m++) tmp_add -> vois[m] += p + this_proj -> natomes;
337 sort (tmp_add ->numv, tmp_add -> vois);
341 i +=
object -> coord -> totcoord[2];
342 p +=
object ->
atoms;
347 object -> prev -> next =
object -> next;
348 object -> next -> prev =
object -> prev;
350 object =
object -> next;
355 object -> prev -> next = NULL;
364 edit -> to_be_inserted[act] =
object -> next;
365 object =
object -> next;
366 g_free (
object -> prev);
367 object -> prev = NULL;
371 g_free (edit -> to_be_inserted[act]);
372 edit -> to_be_inserted[act] = NULL;
379 object =
object -> next;
383 edit -> coord -> totcoord[2] += i;
384 edit -> add_spec = o;
390 g_debug (
"Project coord before insert:");
391 if (this_proj -> natomes)
397 g_debug (
" *** None *** ");
399 g_debug (
"Coord info after object insert:");
404 if (asearch ->
action ==
DISPL && remove == 0)
return -1;
406 if (asearch ->
action ==
REMOVE && remove == 0)
return -1;
408 if (asearch ->
action ==
REMOVE && remove > this_proj -> natomes)
return -1;
411 || (asearch -> passivating && asearch ->
filter < 3)
412 || (asearch ->
action ==
RANMOVE && asearch -> passivating && asearch ->
object < 2)
413 || (asearch ->
action ==
RANMOVE && ! asearch -> passivating && ! asearch ->
object))
415 this_proj -> modelgl ->
bonding = FALSE;
416 this_proj -> coord -> totcoord[3] = 0;
417 if (this_proj -> modelgl -> adv_bonding[1])
421 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[i] == 4 || this_proj -> modelgl -> anim -> last ->
img -> color_map[i] == 5)
425 if (this_proj -> modelgl -> color_styles[i*
ATOM_MAPS])
427 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> color_styles[i*
ATOM_MAPS], TRUE);
434 this_proj -> modelgl -> adv_bonding[1] = FALSE;
435 if (this_proj -> force_field[0])
437 g_free (this_proj -> force_field[0]);
438 this_proj -> force_field[0] = NULL;
442 if (this_proj -> modelgl -> custom_map)
444 g_free (this_proj -> modelgl -> custom_map);
445 this_proj -> modelgl -> custom_map = NULL;
450 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> color_styles[j], TRUE);
451 set_color_map (this_proj -> modelgl -> color_styles[j], & this_proj -> modelgl ->
colorp[j][0]);
460 if (this_proj -> analysis)
462 for (i=0 ; i<
NCALCS ; i++)
464 if (this_proj -> analysis[i])
466 this_proj -> analysis[i] -> calc_ok = FALSE;
472 if (this_proj -> modelgl -> rings)
474 this_proj -> modelgl -> rings = FALSE;
483 if (this_proj -> modelgl ->
chains)
492 if (asearch ->
action ==
REMOVE && remove == this_proj -> natomes)
498 atom * new_list = NULL;
499 atom * tmp_new = NULL;
504 if (this_proj -> natomes)
506 old_id =
allocint (this_proj -> natomes);
508 for (i=0; i<this_proj -> natomes; i++)
510 if (tmp_rem && tmp_rem ->
id == i)
518 tmp_new -> next -> prev = tmp_new;
519 tmp_new = tmp_new -> next;
528 if (tmp_rem -> next != NULL) tmp_rem = tmp_rem -> next;
536 tmp_new -> next -> prev = tmp_new;
537 tmp_new = tmp_new -> next;
558 if (old_id[tmp_new ->
id] > 0) i++;
559 tmp_new = tmp_new -> next;
567 j= this_proj -> nspec + edit -> add_spec;
568 tmpgeo[i] = g_malloc0(j*
sizeof*tmpgeo[i]);
571 tmpgeo[i][k] =
allocint (edit -> coord -> ntg[i][k]);
580 if (! passivate || old_id[j] > 0)
584 m = tmp_new -> coord[l];
585 if (m >= edit -> coord -> ntg[l][k])
587 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]);
592 tmp_new = tmp_new -> next;
601 i = edit -> coord -> totcoord[2];
602 j = this_proj -> coord -> totcoord[2];
606 showfrag[k] = this_proj -> modelgl -> anim -> last ->
img -> show_coord[2][k];
608 for (k=j; k<i; k++) showfrag[k] = TRUE;
615 tmpgeo[i] = g_malloc0(edit -> coord -> species*
sizeof*tmpgeo[i]);
616 for (j=0; j<edit -> coord -> species; j++)
618 tmpgeo[i][j] =
allocint (edit -> coord -> ntg[i][j]);
621 showfrag =
allocbool(edit -> coord -> totcoord[2]);
622 for (j=0; j<edit -> coord -> totcoord[2]; j++)
637 if (old_id[tmp_new ->
id] > 0 || asearch ->
action !=
REMOVE)
639 if (tmp_new ->
pick[0] || tmp_new ->
pick[1])
643 tmp_add -> next = g_malloc0(
sizeof*tmp_add);
644 tmp_add -> next -> prev = tmp_add;
645 tmp_add = tmp_add -> next;
649 to_add = g_malloc0(
sizeof*to_add);
652 for (j=0; j<2; j++) tmp_add ->
pick[j] = tmp_new ->
pick[j];
658 tmp_new = tmp_new -> next;
667 while (tmp_new -> next) tmp_new = tmp_new -> next;
673 tmp_new -> next = g_malloc0(
sizeof*tmp_new -> next);
674 tmp_new -> next -> prev = tmp_new;
675 tmp_new = tmp_new -> next;
679 new_list = g_malloc0(
sizeof*new_list);
682 tmp_new -> sp = tmp_add -> type;
683 tmp_new -> show[0] = tmp_new -> show[1] = TRUE;
684 tmp_new ->
x = tmp_add -> xyz[0];
685 tmp_new ->
y = tmp_add -> xyz[1];
686 tmp_new ->
z = tmp_add -> xyz[2];
687 for (i=0; i<4; i++) tmp_new -> coord[i] = tmp_add -> coord[i];
691 k = tmp_add -> coord[j];
695 tmp_new -> numv = tmp_add -> numv;
696 if (tmp_new -> numv) tmp_new -> vois =
duplicate_int (tmp_new -> numv, tmp_add -> vois);
699 tmp_add ->
pick[0] = TRUE;
700 tmp_add = tmp_add -> next;
707 i +=
object ->
bonds;
708 object =
object -> next;
712 object = object_list;
716 i +=
object ->
atoms;
717 j +=
object ->
bonds;
720 object =
object -> next;
721 g_free (
object -> prev);
732 if (this_proj -> natomes)
736 gboolean vis_stat =
opengl_project -> modelgl -> atom_win -> visible;
755 if (this_proj -> nspec)
757 g_free (this_proj ->
atoms[0]);
761 this_proj ->
atoms = g_malloc0(
sizeof*this_proj ->
atoms);
766 spid =
allocint (this_proj -> nspec + edit -> add_spec);
767 spdel =
allocint (this_proj -> nspec + edit -> add_spec);
769 this_proj ->
atoms[0] = g_malloc0(new_atoms*
sizeof*this_proj ->
atoms[0]);
774 if (asearch ->
action !=
REMOVE || old_id[tmp_new ->
id] > 0)
777 this_proj ->
atoms[0][i].id = i;
778 spid[this_proj ->
atoms[0][i].sp] ++;
779 atid[i] = this_proj ->
atoms[0][i].sp;
780 this_proj ->
atoms[0][i].pick[0] = this_proj ->
atoms[0][i].pick[1] = FALSE;
785 tmp_new = tmp_new -> next;
786 g_free (tmp_new -> prev);
794 if (old_id) g_free (old_id);
797 for (i=0; i<this_proj -> nspec + edit -> add_spec; i++)
810 if (rem_spec || edit -> add_spec)
812 int new_spec = this_proj -> nspec - rem_spec + edit -> add_spec;
815 for (j=0; j<this_proj -> nspec; j++)
819 newchem -> nsps[i] = this_proj ->
chemistry -> nsps[j];
820 newchem -> formula[i] = this_proj ->
chemistry -> formula[j];
821 newchem -> label[i] = g_strdup_printf (
"%s", this_proj ->
chemistry -> label[j]);
825 newchem -> chem_prop[k][i] = this_proj ->
chemistry -> chem_prop[k][j];
828 if (j < this_proj -> nspec-1)
831 for (l=j; l<this_proj -> nspec; l++)
835 newchem -> cutoffs[i][k] = newchem -> cutoffs[k][i] = this_proj ->
chemistry -> cutoffs[j][l];
840 newchem -> nsps[i] = spid[j];
844 j = (this_proj -> nspec) ? 1 : 0;
845 for (k=0; k<edit -> add_spec - j*rem_spec; k++)
847 l = this_proj -> nspec + k;
850 newchem -> nsps[i] = spid[l];
851 newchem -> formula[i] = 0;
852 newchem -> chem_prop[
CHEM_Z][i] = newchem -> chem_prop[
CHEM_X][i] = edit -> new_z[l];
853 m = (int)newchem -> chem_prop[
CHEM_Z][i];
860 newchem -> chem_prop[
CHEM_X][i] = newchem -> chem_prop[
CHEM_Z][i];
865 for (i=0; i<new_atoms; i++)
867 atid[i] -= spdel[atid[i]];
868 this_proj ->
atoms[0][i].sp = atid[i];
884 if (! this_proj -> natomes)
886 this_proj -> natomes = new_atoms;
891 this_proj -> natomes = new_atoms;
895 recover_opengl_data (this_proj, nmols, edit -> add_spec, rem_spec, spid, spdel, tmpgeo, showfrag);
903 if (this_proj -> natomes)
909 g_debug (
" *** None *** ");
913 g_free (edit -> new_z);
940 if (asearch -> recompute_bonding)
954 this_proj -> modelgl -> create_shaders[
PICKS] = TRUE;
955 this_proj -> modelgl -> create_shaders[
MDBOX] = TRUE;
956 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
957 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
961 while (tmp_add != NULL)
965 if (tmp_add ->
pick[i])
970 tmp_add = tmp_add -> next;
979 g_free (this_proj -> modelgl -> saved_coord[i]);
980 this_proj -> modelgl -> saved_coord[i] = NULL;
983 this_proj -> modelgl ->
was_moved = FALSE;
984 this_proj -> modelgl -> atom_win -> rebuilt[0] = FALSE;
985 this_proj -> modelgl -> atom_win -> rebuilt[1] = FALSE;
986 if (this_proj -> modelgl -> atom_win ->
msd) g_free (this_proj -> modelgl -> atom_win ->
msd);
987 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
988 if (this_proj -> modelgl -> atom_win -> msd_all) g_free (this_proj -> modelgl -> atom_win -> msd_all);
989 this_proj -> modelgl -> atom_win -> msd_all =
allocfloat (this_proj -> nspec);
990 for (i=0; i<2; i++)
clean_motion_search (this_proj, this_proj -> modelgl -> search_widg[2+4*i], i);
995 this_proj -> modelgl ->
was_moved = TRUE;
999 else if (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected)
1001 g_free (this_proj -> modelgl -> saved_coord[1]);
1003 this_proj -> modelgl -> baryc[1] =
get_bary (this_proj, 1);
1005 update (this_proj -> modelgl);
1007 update_menu_bar (this_proj -> modelgl);
1011 switch (asearch ->
action)
1044 if (this_proj -> modelgl -> search_widg[
INSERT] -> in_selection)
1046 allocate_todo (this_proj -> modelgl -> search_widg[i+2], this_proj -> modelgl -> search_widg[
INSERT] -> in_selection);
1047 atomic_object *
object = this_proj -> modelgl -> atom_win -> to_be_inserted[1];
1053 object =
object -> next;
1058 else if (this_proj -> modelgl -> search_widg[i+2] -> atom_tree)
1061 if ((j == 3 && ! this_proj -> modelgl -> adv_bonding[0]) || (j == 4 && ! this_proj -> modelgl -> adv_bonding[1]))
1063 combo_set_active (this_proj -> modelgl -> search_widg[i+2] -> filter_box, 0);
1064 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), this_proj -> modelgl -> search_widg[i+2]);
1068 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[i+2] -> filter_box), this_proj -> modelgl -> search_widg[i+2]);
1072 if ((i == 0 || i == 4) && this_proj -> modelgl -> search_widg[i+2] -> todo_size >=
GTK_LIMIT)
1077 if ((this_proj -> modelgl -> atom_win -> adv_bonding[0] && ! this_proj -> modelgl -> adv_bonding[0])
1078 || (this_proj -> modelgl -> atom_win -> adv_bonding[1] && ! this_proj -> modelgl -> adv_bonding[1]))
1085 if (this_proj -> modelgl -> search_widg[i+2] -> passivating)
1087 j = (this_proj -> modelgl -> search_widg[i+2] ->
object < 2) ? 3 : 2;
1091 j = (! this_proj -> modelgl -> search_widg[i+2] -> object) ? 3 : 2;
1093 if (GTK_IS_WIDGET(this_proj -> modelgl -> search_widg[i+2] -> filter_box))
1095 if (this_proj -> modelgl -> atom_win -> adv_bonding[1] && ! this_proj -> modelgl -> adv_bonding[1])
1097 gtk_combo_box_text_remove ((GtkComboBoxText *) this_proj -> modelgl -> search_widg[i+2] -> filter_box, j+1);
1099 if (this_proj -> modelgl -> atom_win -> adv_bonding[0] && ! this_proj -> modelgl -> adv_bonding[0])
1101 gtk_combo_box_text_remove ((GtkComboBoxText *) this_proj -> modelgl -> search_widg[i+2] -> filter_box, j);
1107 for (i=0 ;i<2; i++) this_proj -> modelgl -> atom_win -> adv_bonding[i] = this_proj -> modelgl -> adv_bonding[i];
1121 gchar * appl[3] = {
i18n(
"replaced"),
i18n(
"removed"),
i18n(
"inserted")};
1124 gboolean visible = (this_proj -> modelgl -> atom_win) ? this_proj -> modelgl -> atom_win -> visible : FALSE;
1138 str = g_strdup_printf (_(
"No atoms to be %s !"), _(appl[asearch ->
action-3]));
1143 if (asearch -> pointer[0].c == 8) l += asearch -> int_b - k;
1144 str = g_strdup_printf (_(
"%d atom(s) removed !\n%d atom(s) inserted !"), l, k);
1148 str = g_strdup_printf (_(
"%d atom(s) %s !"), k, _(appl[asearch ->
action-3]));
1152 if (this_proj -> modelgl -> atom_win -> win)
1154 show_info (str, 0, this_proj -> modelgl -> atom_win -> win);
1158 show_info (str, 0, this_proj -> modelgl -> win);
1166 if (this_proj -> modelgl -> atom_win)
1168 if (this_proj -> modelgl -> atom_win -> visible)
clean_all_trees (asearch, this_proj);
1169 if (this_proj -> modelgl -> atom_win ->
msd)
1171 g_free (this_proj -> modelgl -> atom_win ->
msd);
1172 this_proj -> modelgl -> atom_win ->
msd = NULL;
1174 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
1191 int i, j, k, l, m, n, o, p, q;
1196 int max_num, total_num;
1197 gboolean lets_do_this = (asearch ->
action ==
REMOVE || (asearch ->
action ==
REPLACE && this_proj -> modelgl -> atom_win -> to_be_inserted[0])) ? TRUE : FALSE;
1202 int num_elem = asearch -> todo_size;
1203 int * random_todo =
duplicate_int (num_elem, asearch -> todo);
1204 total_num = (asearch -> mode &&
filter > 2 && obj) ? this_proj -> coord -> totcoord[2] : this_proj -> natomes;
1205 g_free (asearch -> todo);
1207 if (asearch ->
action ==
REPLACE && this_proj -> modelgl -> atom_win -> to_be_inserted[0])
1209 tmp_oba = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
1212 while (tmp_oba -> next)
1214 tmp_oba = tmp_oba -> next;
1216 tmp_obb = tmp_obb -> next;
1218 g_free (this_proj -> modelgl -> atom_win -> to_be_inserted[0]);
1219 this_proj -> modelgl -> atom_win -> to_be_inserted[0] = NULL;
1222 asearch -> in_selection = 0;
1224 for (i=0; i<num_elem; i++)
1232 max_num = this_proj ->
chemistry -> nsps[i];
1235 for (j=0; j<this_proj -> natomes; j++)
1237 if (this_proj ->
atoms[0][j].numv == i) max_num ++;
1242 for (k=0; k<this_proj -> nspec; k++)
1244 j += this_proj -> coord -> ntg[1][k];
1248 for (m=0; m<k; m++) l += this_proj -> coord -> ntg[1][m];
1250 for (l=0; l<this_proj -> natomes; l++)
1252 if (this_proj ->
atoms[0][l].sp == k && this_proj ->
atoms[0][l].coord[1] == p) max_num ++;
1258 max_num = this_proj -> coord -> totcoord[2];
1262 for (l=0; l<this_proj -> natomes; l++)
1264 if (this_proj ->
atoms[0][l].coord[2] == i) max_num ++;
1269 molfc = & this_proj -> modelfc -> mols[0][i];
1272 max_num = molfc -> multiplicity;
1276 max_num = molfc -> natoms*molfc -> multiplicity;
1280 test = 1.0 / max_num;
1283 clock_t begin = clock();
1285 while (j < random_todo[i])
1288 for (m=0; m<total_num; m++)
1290 if (! asearch -> todo[m])
1295 n = this_proj ->
atoms[0][m].sp;
1301 if (n == i) doit = TRUE;
1304 if (this_proj ->
atoms[0][m].numv == i) doit = TRUE;
1307 o = this_proj ->
atoms[0][m].coord[1];
1308 for (q=0;q<n;q++) o += this_proj -> coord -> ntg[1][q];
1309 if (o == i) doit = TRUE;
1312 if (this_proj ->
atoms[0][m].coord[
filter-1] == i) doit = TRUE;
1323 for (n=0; n<molfc -> multiplicity; n++)
1325 if (molfc -> fragments[n] == m)
1335 o = (o+1)*max_num*m;
1337 if (prob >= (l-1)*test && prob < l*test)
1340 asearch -> todo[m] = 1;
1343 if (this_proj -> modelgl -> atom_win -> to_be_inserted[0] == NULL)
1346 tmp_obb = this_proj -> modelgl -> atom_win -> to_be_inserted[0];
1351 tmp_obb -> next -> prev = tmp_obb;
1352 tmp_obb = tmp_obb -> next;
1356 asearch -> in_selection ++;
1357 if (j == random_todo[i])
break;
1365 if (tmp_oba -> next != NULL) tmp_oba = tmp_oba -> next;
1370 if (random_todo) g_free (random_todo);
1371 int old_filter = asearch ->
filter;
1374 asearch ->
filter = old_filter;
1389 int i, j, k, l, m, n, o, p, q;
1390 gboolean taking_action = FALSE;
1393 taking_action = TRUE;
1398 if (asearch -> mode)
1400 for (l=0; l<asearch -> todo_size; l++)
1402 if (asearch -> todo[l]) i++;
1407 if (asearch -> todo[l]) j ++;
1412 if (asearch ->
pick[l] && asearch -> todo[l]) j ++;
1417 taking_action = TRUE;
1419 else if (asearch ->
action ==
REPLACE && i == j && i == asearch -> in_selection)
1421 taking_action = TRUE;
1426 m = (asearch -> pointer[0].c == 3) ? 0 : (asearch -> pointer[0].c == 5) ? 1 : 3;
1430 int * pass_todo = NULL;
1434 float * tmp_msd = NULL;
1435 if (asearch -> passivating)
1437 if (
object > 1 &&
filter > 2)
1439 pass_size = this_proj -> coord -> totcoord[
filter - 1];
1443 pass_size = this_proj -> natomes;
1448 switch (asearch ->
action)
1451 for (l=0; l<asearch -> todo_size; l++)
1453 if (asearch -> todo[l]) i ++;
1456 if (asearch -> todo[l])
1458 if (asearch -> passivating)
1465 for (n=0; n<this_proj -> natomes; n++)
1467 if (this_proj ->
atoms[0][n].sp == l)
1469 pass_todo[n] = asearch -> todo[l];
1475 for (n=0; n<this_proj -> natomes; n++)
1477 if (this_proj ->
atoms[0][n].numv == l)
1479 pass_todo[n] = asearch -> todo[l];
1485 for (n=0; n<this_proj -> natomes; n++)
1488 p = this_proj ->
atoms[0][n].sp;
1489 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1492 pass_todo[n] = asearch -> todo[l];
1498 for (n=0; n<this_proj -> natomes; n++)
1503 pass_todo[n] = asearch -> todo[l];
1515 for (n=0; n<this_proj -> natomes; n++)
1517 if (this_proj ->
atoms[0][n].numv == l)
1519 pass_todo[n] = asearch -> todo[l];
1521 if (! passivating_object)
1524 pao = passivating_object;
1529 pao -> next -> prev = pao;
1536 for (n=0; n<this_proj -> natomes; n++)
1539 p = this_proj ->
atoms[0][n].sp;
1540 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1543 pass_todo[n] = asearch -> todo[l];
1545 if (! passivating_object)
1548 pao = passivating_object;
1553 pao -> next -> prev = pao;
1560 for (n=0; n<this_proj -> coord -> totcoord[
filter -1]; n++)
1564 pass_todo[n] = asearch -> todo[l];
1566 if (! passivating_object)
1569 pao = passivating_object;
1574 pao -> next -> prev = pao;
1588 for (l=0; l<asearch -> todo_size; l++)
1590 if (asearch -> todo[l]) i ++;
1594 if (asearch -> todo[l])
1597 if (asearch -> passivating)
1602 for (n=0; n<this_proj -> natomes; n++)
1604 if (this_proj ->
atoms[0][n].sp == l)
1606 pass_todo[n] = asearch -> todo[l];
1607 if (! passivating_object)
1610 pao = passivating_object;
1617 pao -> next -> prev = pao;
1625 for (n=0; n<this_proj -> natomes; n++)
1627 if (this_proj ->
atoms[0][n].numv == l)
1629 pass_todo[n] = asearch -> todo[l];
1630 if (! passivating_object)
1633 pao = passivating_object;
1640 pao -> next -> prev = pao;
1648 for (n=0; n<this_proj -> natomes; n++)
1651 p = this_proj ->
atoms[0][n].sp;
1652 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1655 pass_todo[n] = asearch -> todo[l];
1656 if (! passivating_object)
1659 pao = passivating_object;
1666 pao -> next -> prev = pao;
1675 for (n=0; n<this_proj -> natomes; n++)
1680 pass_todo[n] = asearch -> todo[l];
1681 if (! passivating_object)
1684 pao = passivating_object;
1691 pao -> next -> prev = pao;
1700 pass_todo[l] = asearch -> todo[l];
1701 if (! passivating_object)
1704 pao = passivating_object;
1711 pao -> next -> prev = pao;
1724 for (l=0; l<asearch -> todo_size; l++)
1726 if (asearch -> todo[l])
1729 if (asearch -> passivating)
1734 for (n=0; n<this_proj -> natomes; n++)
1736 if (this_proj ->
atoms[0][n].sp == l)
1744 for (n=0; n<this_proj -> natomes; n++)
1746 if (this_proj ->
atoms[0][n].numv == l)
1754 for (n=0; n<this_proj -> natomes; n++)
1757 p = this_proj ->
atoms[0][n].sp;
1758 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1768 for (n=0; n<this_proj -> natomes; n++)
1790 for (l=0; l<asearch -> todo_size; l++)
1792 if (asearch -> passivating)
1794 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win -> msd_all[l] > 0.0)
1802 for (n=0; n<this_proj -> natomes; n++)
1804 if (this_proj ->
atoms[0][n].sp == l)
1806 pass_todo[n] = asearch -> todo[l];
1807 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1813 for (n=0; n<this_proj -> natomes; n++)
1815 if (this_proj ->
atoms[0][n].numv == l)
1817 pass_todo[n] = asearch -> todo[l];
1818 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1824 for (n=0; n<this_proj -> natomes; n++)
1827 p = this_proj ->
atoms[0][n].sp;
1828 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1831 pass_todo[n] = asearch -> todo[l];
1832 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1838 for (n=0; n<this_proj -> natomes; n++)
1843 pass_todo[n] = asearch -> todo[l];
1844 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1856 for (n=0; n<this_proj -> natomes; n++)
1858 if (this_proj ->
atoms[0][n].numv == l)
1860 pass_todo[n] = asearch -> todo[l];
1861 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1862 if (! passivating_object)
1865 pao = passivating_object;
1870 pao -> next -> prev = pao;
1878 for (n=0; n<this_proj -> natomes; n++)
1881 p = this_proj ->
atoms[0][n].sp;
1882 for (q=0; q<p; q++) o += this_proj -> coord -> ntg[1][q];
1885 pass_todo[n] = asearch -> todo[l];
1886 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1887 if (! passivating_object)
1890 pao = passivating_object;
1895 pao -> next -> prev = pao;
1903 for (n=0; n<this_proj -> coord -> totcoord[
filter -1]; n++)
1907 pass_todo[n] = asearch -> todo[l];
1909 tmp_msd[n] = this_proj -> modelgl -> atom_win -> msd_all[l];
1910 if (! passivating_object)
1913 pao = passivating_object;
1918 pao -> next -> prev = pao;
1928 else if (
object &&
filter > 2)
1930 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win -> msd_all[l] > 0.0) i ++;
1934 if (asearch -> todo[l] && this_proj -> modelgl -> atom_win ->
msd[l] > 0.0) i ++;
1941 taking_action = TRUE;
1945 if (asearch -> in_selection == i && i == j) taking_action = TRUE;
1949 asearch -> in_selection = i;
1950 if (i) taking_action = TRUE;
1952 if (asearch -> passivating && taking_action && editing)
1954 g_free (asearch -> todo);
1957 asearch -> todo_size = pass_size;
1958 asearch -> in_selection = k;
1959 switch (asearch ->
action)
1962 this_proj -> modelgl -> atom_win -> to_be_moved[0] = passivating_object;
1965 this_proj -> modelgl -> atom_win -> to_be_inserted[m] = passivating_object;
1968 if (this_proj -> modelgl -> atom_win ->
msd) g_free (this_proj -> modelgl -> atom_win ->
msd);
1969 this_proj -> modelgl -> atom_win ->
msd =
duplicate_float (this_proj -> natomes, tmp_msd);
1971 this_proj -> modelgl -> atom_win -> to_be_moved[1] = passivating_object;
1978 return taking_action;
1990 atom_search * bsearch = g_malloc0(
sizeof*bsearch);
1991 bsearch -> search_digit = asearch -> search_digit;
1995 bsearch -> mode = asearch -> mode;
1996 bsearch ->
object = asearch -> object;
1998 bsearch -> search_digit = asearch -> search_digit;
1999 bsearch -> spec_to_add = asearch -> spec_to_add;
2000 bsearch -> num_to_add = asearch -> num_to_add;
2001 bsearch -> in_selection = asearch -> in_selection;
2002 bsearch -> passivating = asearch -> passivating;
2003 bsearch -> was_selected = asearch -> was_selected;
2004 bsearch -> recompute_bonding = asearch -> recompute_bonding;
2005 bsearch -> set_for_all = asearch -> set_for_all;
2006 bsearch -> int_b = asearch -> int_b;
2010 bsearch -> todo_size = asearch -> todo_size;
2011 bsearch -> todo =
duplicate_int (bsearch -> todo_size, asearch -> todo);
2014 bsearch -> pointer[i].a = asearch -> pointer[i].a;
2015 bsearch -> pointer[i].b = asearch -> pointer[i].b;
2016 bsearch -> pointer[i].c = asearch -> pointer[i].c;
2040 if (this_search -> mode)
2054 if (this_proj -> modelgl -> atom_win -> visible)
2056 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);
2057 widget_set_sensitive (gtk_notebook_get_nth_page(GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook), 3), 1);
2064 show_info (_(
"Nothing to be done, check selection !"), 0, this_proj -> modelgl -> atom_win -> win);
2068 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)
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 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
#define GTK_LIMIT
maximum number of elements in GTK widgets like GtkTreeView, GtkTreeStore or similar rendering widgets...
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 init_atomes_analysis(project *this_proj, gboolean apply_defaults)
initialize analysis data structures for atomes
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