89 int i, j, k, l, m, n, o;
90 int ** n_part, ** o_part;
93 i = coord -> ntg[gid][new_sp];
97 for (l=0; l<obj -> species; l++)
99 if (obj -> partial_geo[old_sp][old_geo][l])
102 j += obj -> partial_geo[old_sp][old_geo][l];
111 if (coord -> geolist[gid][new_sp][l] == obj -> geolist[gid][old_sp][old_geo])
return l;
116 for (o=0; o<coord -> species; o++)
118 if (coord -> partial_geo[new_sp][l][o])
121 n += coord -> partial_geo[new_sp][l][o];
124 if (j == n && k == m)
132 for (n=0; n<coord -> species; n++)
134 if (coord -> partial_geo[new_sp][l][n])
136 n_part[m][0] = (int)new_z[n];
137 n_part[m][1] = coord -> partial_geo[new_sp][l][n];
143 for (n=0; n<obj -> species; n++)
145 if (obj -> partial_geo[old_sp][old_geo][n])
147 o_part[m][0] = old_z[n];
148 o_part[m][1] = obj -> partial_geo[old_sp][old_geo][n];
156 if (o_part[o][0] != n_part[o][0] || o_part[o][1] != n_part[o][1])
171 j = coord -> ntg[gid][new_sp];
174 coord -> geolist[gid][new_sp] = g_realloc (coord -> geolist[gid][new_sp], (j+1)*
sizeof*coord -> geolist[gid][new_sp]);
175 coord -> geolist[gid][new_sp][coord -> ntg[gid][new_sp]] = obj -> geolist[gid][old_sp][old_geo];
179 coord -> partial_geo[new_sp] = g_realloc (coord -> partial_geo[new_sp], (j+1)*
sizeof*coord -> partial_geo[new_sp]);
180 coord -> partial_geo[new_sp][j] =
allocint (coord -> species);
181 for (k=0; k<obj -> species; k++)
186 coord -> partial_geo[new_sp][j][l] = obj -> partial_geo[old_sp][old_geo][k];
190 coord -> ntg[gid][new_sp] ++;
191 coord -> totcoord[gid] ++;
211 int i, j, k, l, m, n, o;
212 int ** n_part, ** o_part;
215 i = coord -> ntg[gid][new_sp];
221 for (l=0; l<obj -> species; l++)
223 if (obj -> partial_geo[old_sp][old_geo][l])
226 j += obj -> partial_geo[old_sp][old_geo][l];
232 for (l=0; l<coord -> ntg[gid][new_sp]; l++)
237 if (coord -> geolist[0][new_sp][l] == obj -> geolist[0][old_sp][old_geo])
return l;
242 for (o=0; o<coord -> species; o++)
244 if (coord -> partial_geo[new_sp][l][o])
247 n += coord -> partial_geo[new_sp][l][o];
250 if (j == n && k == m)
258 for (n=0; n<coord -> species; n++)
260 if (coord -> partial_geo[new_sp][l][n])
262 n_part[m][0] = (int)new_z[n];
263 n_part[m][1] = coord -> partial_geo[new_sp][l][n];
269 for (n=0; n<obj -> species; n++)
271 if (obj -> partial_geo[old_sp][old_geo][n])
273 o_part[m][0] = old_z[n];
274 o_part[m][1] = obj -> partial_geo[old_sp][old_geo][n];
282 if (o_part[o][0] != n_part[o][0] || o_part[o][1] != n_part[o][1])
297 j = coord -> ntg[gid][new_sp];
298 coord -> geolist[gid][new_sp] = g_realloc (coord -> geolist[gid][new_sp], (j+1)*
sizeof*coord -> geolist[gid][new_sp]);
299 coord -> geolist[gid][new_sp][j] = obj -> geolist[gid][old_sp][old_geo];
302 coord -> partial_geo[new_sp] = g_realloc (coord -> partial_geo[new_sp], (j+1)*
sizeof*coord -> partial_geo[new_sp]);
303 coord -> partial_geo[new_sp][j] =
allocint (coord -> species);
304 for (k=0; k<obj -> species; k++)
309 coord -> partial_geo[new_sp][j][l] = obj -> partial_geo[old_sp][old_geo][k];
313 coord -> ntg[gid][new_sp] ++;
314 coord -> totcoord[gid] ++;
332 atomic_object * this_object, gboolean movtion, gboolean passivating)
335 int g, h, i, j, k, l, m, n;
337 int * new_z =
allocint (this_proj -> nspec);
341 int * nvois =
allocint (this_proj -> nspec);
342 if (passivating) new_old_id =
duplicate_int (this_proj -> natomes, old_id);
343 for (i=0; i<this_proj -> nspec; i++)
349 coord_info * new_coord = g_malloc0 (
sizeof*new_coord);
352 new_coord -> totcoord[i] = 1;
353 new_coord -> ntg[i] =
allocint (this_proj -> nspec);
354 for (j=0; j<this_proj -> nspec; j++) new_coord -> ntg[i][j] = 1;
355 new_coord -> geolist[i] =
allocdint (this_proj -> nspec, 1);
357 new_coord -> species = this_proj -> nspec;
358 new_coord -> partial_geo =
alloctint (this_proj -> nspec, 1, this_proj -> nspec);
359 g = (passivating) ? 2 : 1;
367 for (j=0; j<2; j++) new_coord -> geolist[j][i][0] = tmp_new -> numv;
368 k = tmp_new -> coord[1];
369 for (j=0; j<this_proj -> nspec; j++)
371 new_coord -> partial_geo[i][0][j] = this_proj -> coord -> partial_geo[i][k][j];
377 for (k=0; k<tmp_new -> numv; k++)
379 l = tmp_new -> vois[k];
380 if ((old_id[j] > 0 && old_id[l] < 0) || (old_id[j] < 0 && old_id[l] > 0))
384 if (! passivating || h)
386 m = this_proj ->
atoms[0][l].sp;
388 new_coord -> partial_geo[i][0][m] --;
389 for (n=0; n<2; n++) new_coord -> geolist[n][i][0] --;
396 for (k=0; k<this_proj -> nspec; k++) nvois[k]=0;
397 for (k=0; k<tmp_new -> numv; k++)
399 l = tmp_new -> vois[k];
400 m = this_object -> at_list[l].sp;
404 for (k=0; k<this_proj -> nspec; k++)
406 if (nvois[k] != new_coord -> partial_geo[i][0][k])
409 new_coord -> partial_geo[i][0][k] = nvois[k];
413 for (k=0; k<2; k++) new_coord -> geolist[k][i][0] = l;
418 if (passivating && ! h)
422 switch (this_proj -> modelgl -> search_widg[8] ->
filter)
431 l = tmp_new -> coord[1];
432 for (m=0; m<i; m++) l += this_proj -> coord -> ntg[1][m];
435 l = tmp_new -> coord[this_proj -> modelgl -> search_widg[8] ->
filter-1];
447 tmp_new -> coord[j] =
find_this_geo_id (j, new_coord, new_z, 0, i, i, this_object -> coord, old_z);
451 tmp_new -> coord[j] =
find_this_geo_id (j, new_coord, new_z, 0, i, i, this_proj -> modelgl -> atom_win -> coord, this_proj -> modelgl -> atom_win -> new_z);
457 tmp_new = tmp_new -> next;
459 if (passivating && ! h)
461 for (i=0; i<this_proj -> natomes; i++) old_id[i] = new_old_id[i];
465 if (this_object) g_free (old_z);
int find_this_geo_id(int gid, 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 is_this_a_new_geo(int gid, 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 ...
void check_coord_modification(project *this_proj, int *old_id, atom *new_list, atomic_object *this_object, gboolean movtion, gboolean passivating)
check atom coordination modification on edition