467 j =
get_sg_num (GTK_COMBO_BOX(cbuilder -> sg_combo));
469 box_info * box = & cbuilder -> cell.box[0];
473 box ->
param[1][0] = 90.0;
474 box -> vect[0][1] = box -> vect[0][2] = 0.0;
475 box -> vect[2][0] = box -> vect[2][1] = 0.0;
479 box -> vect[0][1] = box -> vect[0][2] = 0.0;
480 box -> vect[1][0] = box -> vect[1][2] = 0.0;
481 box -> vect[2][0] = box -> vect[2][1] = 0.0;
489 if (cbuilder -> cell.sp_group -> name[0] ==
'R')
495 box ->
param[1][0] = box ->
param[1][1] = 90.0;
496 box ->
param[1][2] = 120.0;
498 box -> vect[1][1] = box -> vect[0][0];
499 box -> vect[0][1] = box -> vect[0][2] = 0.0;
500 box -> vect[1][0] = box -> vect[1][2] = 0.0;
504 box ->
param[1][0] = box ->
param[1][1] = 90.0;
505 box ->
param[1][2] = 120.0;
506 box -> vect[0][1] = box -> vect[0][2] = 0.0;
507 box -> vect[1][0] = box -> vect[1][2] = 0.0;
512 box -> vect[1][1] = box -> vect[2][2] = box -> vect[0][0];
513 box -> vect[0][1] = box -> vect[0][2] = 0.0;
514 box -> vect[1][0] = box -> vect[1][2] = 0.0;
515 box -> vect[2][0] = box -> vect[2][1] = 0.0;
520 if (cbuilder -> cell.ltype)
526 if (cbuilder -> ventry[i][j])
528 if (GTK_IS_WIDGET(cbuilder -> ventry[i][j]))
542 if (cbuilder -> bentry[i][j])
544 if (GTK_IS_WIDGET(cbuilder -> bentry[i][j]))
551 if (cbuilder -> bentry[0][1])
553 if (GTK_IS_WIDGET(cbuilder -> bentry[0][1]))
559 if (cbuilder -> bentry[0][2])
561 if (GTK_IS_WIDGET(cbuilder -> bentry[0][2]))
563 widget_set_sensitive (cbuilder -> bentry[0][2], (k > 5 || (k == 4 && cbuilder -> cell.sp_group -> name[0] ==
'R')) ? 0 : 1);
564 if (k > 5 || (k == 4 && cbuilder -> cell.sp_group -> name[0] ==
'R'))
update_entry_text (GTK_ENTRY(cbuilder -> bentry[0][2]),
"");
569 if (cbuilder -> bentry[1][i])
571 if (GTK_IS_WIDGET(cbuilder -> bentry[1][i]))
574 if (k == 4 && cbuilder -> cell.sp_group -> name[0] ==
'R')
639 GtkWidget * table = gtk_grid_new ();
644 for (j=0; j<3; j++, k++)
646 if (i < 2) cbuilder -> cell.box[0].param[i][j] = 0.0;
647 cbuilder -> cell.box[0].vect[i][j] = 0.0;
652 cbuilder -> cell.ltype = type;
653 if (cbuilder -> cell.ltype)
673 update_entry_double (GTK_ENTRY(cbuilder -> ventry[i-1][j-1]), cbuilder -> cell.box[0].vect[i-1][j-1]);
674 gtk_grid_attach (GTK_GRID (table), cbuilder -> ventry[i-1][j-1], j, i, 1, 1);
687 gtk_grid_attach (GTK_GRID (table),
markup_label(
" ", 20, -1, 0.5, 0.5), 0, i, 1, 1);
688 for (j=0; j<3; j++, k++)
690 gtk_grid_attach (GTK_GRID (table),
markup_label(
box_prop[i][j], -1, -1, 0.5, 0.5), j+1, i+2*i, 1, 1);
692 update_entry_double (GTK_ENTRY(cbuilder -> bentry[i][j]), cbuilder -> cell.box[0].param[i][j]);
693 gtk_grid_attach (GTK_GRID (table), cbuilder -> bentry[i][j], j+1, i+2*i+1, 1, 1);
1199 GtkWidget * info =
dialogmodal (
"Occupancy set-up", GTK_WINDOW(cbuilder -> win));
1202 gchar * boccup[5] = {
"<b>Random for the initial cell only</b>",
1203 "<b>Random cell by cell</b>",
1204 "<b>Completely random</b>",
1205 "<b>Successively</b>",
1206 "<b>Alternatively</b>"};
1207 gchar * occup[5] = {
"<i>Sites are filled randomly in the initial cell only,\n"
1208 " then the initial cell is simply replicated.</i>",
1209 "<i>Sites are filled randomly for each cell, cell by cell separately.</i>",
1210 "<i>Sites are filled randomly for the entire network,\n"
1211 " the final crystal is considered as a whole.</i>",
1212 "<i>Sites are filled successively: all object(s) A, then all object(s) B ... </i>",
1213 "<i>Sites are filled alternatively: object A, object B, object A ...</i>"};
1214 GtkWidget * occ_but[5];
1219 occp[i].
a = this_proj -> id;
1226 gtk_check_button_set_group ((GtkCheckButton *)occ_but[i], (GtkCheckButton *)occ_but[0]);
1235 occ_but[i] = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(occ_but[0]));
1239 if (i) g_signal_connect (G_OBJECT(occ_but[i]),
"toggled", G_CALLBACK(
toggle_occ), &
occp[i]);
1241 gtk_button_set_has_frame (GTK_BUTTON(occ_but[i]), FALSE);
1248 i = cbuilder -> occupancy;
1250 gtk_check_button_set_active (GTK_CHECK_BUTTON(occ_but[i]), TRUE);
1252 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(occ_but[i]), TRUE);
1256 add_box_child_start (GTK_ORIENTATION_VERTICAL,
vbox,
check_button (
"<b>Allow overlapping</b>", -1, 25, cbuilder -> overlapping, G_CALLBACK(
toggle_overlap), (gpointer)cbuilder), FALSE, FALSE, 0);
1259 gchar * overlap =
"<i>Instead of ensuring that sites are filled by a single object,\n"
1260 "this allows object(s) to share the same crystalline position. \n"
1261 "The option above describes how filled and empty positions alternate.</i>";
1279 gchar * str = (! this_proj -> natomes) ? g_strdup_printf (
"Crystal builder - %s", this_proj -> name) : g_strdup_printf (
"Crystal builder");
1281 GtkWidget * win =
create_win (str, this_proj -> modelgl -> win, FALSE, FALSE);
1291 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cbuilder -> bh_box, cbuilder -> bv_box[i], FALSE, FALSE, 0);
1301 gtk_combo_box_set_active (GTK_COMBO_BOX(cbuilder -> cs_combo), 0);
1302 gtk_widget_set_size_request (cbuilder -> cs_combo, 150, 25);
1304 g_signal_connect (G_OBJECT(cbuilder -> cs_combo),
"changed", G_CALLBACK(
set_cs), (gpointer)cbuilder);
1308 add_box_child_start (GTK_ORIENTATION_VERTICAL, cbuilder -> bv_box[0], cbuilder -> bl_box, FALSE, FALSE, 0);
1311 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cbuilder -> bl_box, cbuilder -> bl_combo, FALSE, FALSE, 0);
1316 cbuilder -> ltc_cons =
markup_label(str, 150, -1, 0.0, 0.5);
1318 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cbuilder -> ltc_box, cbuilder -> ltc_cons, FALSE, FALSE, 5);
1319 add_box_child_start (GTK_ORIENTATION_VERTICAL, cbuilder -> bv_box[0], cbuilder -> ltc_box, FALSE, FALSE, 5);
1329 cbuilder -> sg_combo = gtk_combo_box_new_with_model (
model);
1330 g_object_unref (
model);
1331 GtkCellRenderer * renderer = gtk_cell_renderer_combo_new ();
1332 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbuilder -> sg_combo), renderer, TRUE);
1333 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbuilder -> sg_combo), renderer,
"text", 0, NULL);
1334 g_signal_connect (G_OBJECT(cbuilder -> sg_combo),
"changed", G_CALLBACK(
set_sg), data);
1335 gtk_widget_set_size_request (cbuilder -> sg_combo, 150, 25);
1336 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cbuilder -> sg_box, cbuilder -> sg_combo, FALSE, FALSE, 0);
1337 gtk_combo_box_set_active (GTK_COMBO_BOX(cbuilder -> sg_combo), 0);
1338 GList * cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(cbuilder -> sg_combo));
1339 if (cell_list && cell_list -> data)
1341 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cbuilder -> sg_combo), cell_list -> data,
"markup", 0, NULL);
1349 cbuilder -> so_combo = gtk_combo_box_new_with_model (
model);
1350 g_object_unref (
model);
1351 renderer = gtk_cell_renderer_combo_new ();
1352 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbuilder -> so_combo), renderer, TRUE);
1353 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbuilder -> so_combo), renderer,
"text", 0, NULL);
1354 gtk_widget_set_size_request (cbuilder -> so_combo, 150, 25);
1355 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cbuilder -> so_box, cbuilder -> so_combo, FALSE, FALSE, 0);
1356 gtk_combo_box_set_active (GTK_COMBO_BOX(cbuilder -> so_combo), 0);
1358 g_signal_connect (G_OBJECT(cbuilder -> so_combo),
"changed", G_CALLBACK(
set_so), data);
1359 cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(cbuilder -> so_combo));
1360 if (cell_list && cell_list -> data)
1362 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cbuilder -> so_combo), cell_list -> data,
"markup", 0, NULL);
1367 cbuilder -> cell.cextra[i] = 1;
1370 cbuilder -> pointers[i][j].a = this_proj -> id;
1371 cbuilder -> pointers[i][j].b = i;
1372 cbuilder -> pointers[i][j].c = j;
1375 if (cbuilder -> cell.sp_group)
get_origin (cbuilder -> cell.sp_group);
1382 cbuilder -> la_combo = gtk_combo_box_new_with_model (lmodel);
1383 g_object_unref (lmodel);
1384 renderer = gtk_cell_renderer_combo_new ();
1385 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbuilder -> la_combo), renderer, TRUE);
1386 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbuilder -> la_combo), renderer,
"text", 0, NULL);
1387 gtk_widget_set_size_request (cbuilder -> la_combo, 150, 25);
1388 g_signal_connect (G_OBJECT(cbuilder -> la_combo),
"changed", G_CALLBACK(
set_lattice), data);
1390 gtk_combo_box_set_active (GTK_COMBO_BOX(cbuilder -> la_combo), 0);
1391 cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(cbuilder -> la_combo));
1392 if (cell_list && cell_list -> data)
1394 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cbuilder -> la_combo), cell_list -> data,
"markup", 0, NULL);
1405 GtkWidget * ax_cell[3];
1408 ax_cell[i] =
spin_button (G_CALLBACK(
add_cryst_cell), cbuilder -> cell.cextra[i], 1, 1000, 1, 0, 100, & cbuilder -> pointers[i][0]);
1409 str = g_strdup_printf (
"%s x ",
box_prop[0][i]);
1415 add_box_child_start (GTK_ORIENTATION_VERTICAL,
vbox,
check_button (
" Wrap all atoms in the unit cell after building", -1, -1, FALSE, G_CALLBACK(
set_wr), (gpointer)cbuilder), FALSE, FALSE, 10);
1416 add_box_child_start (GTK_ORIENTATION_VERTICAL,
vbox,
check_button (
" Show/hide clones after building", -1, -1, FALSE, G_CALLBACK(
set_shc), (gpointer)cbuilder), FALSE, FALSE, 0);
1423 gtk_widget_set_size_request (cbuilder -> add_combo, 110, -1);
1425 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
create_button (
"Occupancy",
IMG_STOCK,
DPROPERTIES, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
adjust_occupancy), this_proj), FALSE, FALSE, 5);
1432 cbuilder -> pbut =
create_button ((this_proj -> natomes) ?
"Build (new project)" :
"Build",
IMG_STOCK,
APPLY, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
apply_build), GINT_TO_POINTER(this_proj ->
id));