Пример #1
0
void gui_analysis_dialog(void)
{
gpointer dialog;
GtkWidget *window, *combo, *label;
GtkWidget *frame, *main_hbox, *main_vbox, *hbox, *vbox;
GtkWidget *gui_menu_calc, *gui_vbox_rdf;
GSList *list, *item;
GList *match_list=NULL, *calc_list=NULL;
struct model_pak *model;
struct analysis_pak *analysis;

/* checks and setup */
model = sysenv.active_model;
if (!model)
  return;
if (!model->animation)
  return;
if (analysis_init(model))
  return;

analysis = model->analysis;

/* create new dialog */
dialog = dialog_request(MD_ANALYSIS, "MD analysis", NULL, NULL, model);
if (!dialog)
  return;
window = dialog_window(dialog);

/* --- main box */
main_hbox = gtk_hbox_new(TRUE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), main_hbox, TRUE, TRUE, 0);

/* --- left pane */
main_vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_hbox), main_vbox, TRUE, TRUE, 0);

/* --- analysis dialogs are specific to the active model when initiated */
frame = gtk_frame_new("Model");
gtk_box_pack_start(GTK_BOX(main_vbox), frame, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING);
hbox = gtk_hbox_new(TRUE, PANEL_SPACING);
gtk_container_add(GTK_CONTAINER(frame), hbox);
label = gtk_label_new(model->basename);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);

/* --- calculation menu */
frame = gtk_frame_new("Calculate");
gtk_box_pack_start(GTK_BOX(main_vbox), frame, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING);
vbox = gtk_vbox_new(TRUE, PANEL_SPACING);
gtk_container_add(GTK_CONTAINER(frame), vbox);

/* --- menu items */
if (g_file_test(model->gulp.trj_file, G_FILE_TEST_EXISTS))
  {
  calc_list = g_list_prepend(calc_list, "Potential E");
  calc_list = g_list_prepend(calc_list, "Kinetic E");
  calc_list = g_list_prepend(calc_list, "Temperature");
  calc_list = g_list_prepend(calc_list, "VACF");
  }
else
  {
  calc_list = g_list_prepend(calc_list, "Measurements");
  }
calc_list = g_list_prepend(calc_list, "RDF");
calc_list = g_list_prepend(calc_list, "Pair count");
gui_menu_calc = gui_pulldown_new("Perform ", calc_list, FALSE, vbox);
dialog_child_set(dialog, "gui_menu_calc", gui_menu_calc);

/* --- right pane */
gui_vbox_rdf = gtk_vbox_new(FALSE, 0);
dialog_child_set(dialog, "gui_vbox_rdf", gui_vbox_rdf);
gtk_box_pack_start(GTK_BOX(main_hbox), gui_vbox_rdf, TRUE, TRUE, 0);

/* --- interval setup */
frame = gtk_frame_new("Analysis Interval");
gtk_box_pack_start(GTK_BOX(gui_vbox_rdf), frame, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING);
vbox = gtk_vbox_new(TRUE, PANEL_SPACING);
gtk_container_add(GTK_CONTAINER(frame), vbox);

/* TODO - some warning about the RDF being valid only for < L/2? */
/* see Allan & Tildesley pg 199 */
gui_direct_spin("Start", &analysis->start, 0.0, 10.0*model->rmax, 0.1, NULL, NULL, vbox);
gui_direct_spin("Stop", &analysis->stop, 0.1, 10.0*model->rmax, 0.1, NULL, NULL, vbox);
gui_direct_spin("Step", &analysis->step, 0.1, model->rmax, 0.1, NULL, NULL, vbox);

/* --- RDF atom setup */
frame = gtk_frame_new("Analysis Atoms");
gtk_box_pack_start(GTK_BOX(gui_vbox_rdf), frame, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING);
vbox = gtk_vbox_new(TRUE, PANEL_SPACING);
gtk_container_add(GTK_CONTAINER(frame), vbox);

/* setup unique element label list */
list = find_unique(LABEL, model);
match_list = g_list_append(match_list, "Any");
for (item=list ; item  ; item=g_slist_next(item))
  {
  match_list = g_list_append(match_list, item->data);
  }
g_slist_free(list);

/* match 1 */
combo = gtk_combo_new();
gtk_combo_set_popdown_strings(GTK_COMBO(combo), match_list);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(combo)->entry), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), combo, TRUE, TRUE, 0);
g_signal_connect(GTK_OBJECT(GTK_COMBO(combo)->entry), "changed",
                 GTK_SIGNAL_FUNC(md_atom_changed), (gpointer) &analysis->atom1);

/* match 2 */
combo = gtk_combo_new();
gtk_combo_set_popdown_strings(GTK_COMBO(combo), match_list);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(combo)->entry), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), combo, TRUE, TRUE, 0);
g_signal_connect(GTK_OBJECT(GTK_COMBO(combo)->entry), "changed",
                 GTK_SIGNAL_FUNC(md_atom_changed), (gpointer) &analysis->atom2);

/* terminating buttons */
gui_stock_button(GTK_STOCK_EXECUTE, exec_analysis_task, dialog,
                   GTK_DIALOG(window)->action_area);

gui_stock_button(GTK_STOCK_CLOSE, dialog_destroy, dialog,
                   GTK_DIALOG(window)->action_area);

gtk_widget_show_all(window);
}
Пример #2
0
void gui_host_page(GtkWidget *box, gpointer dialog)
{
gchar *titles[] = {" Service ", " Method ", " Available "};
GtkWidget *swin, *table, *label, *entry, *button;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;

table = gtk_table_new(3, 3, FALSE);
gtk_box_pack_start(GTK_BOX(box), table, FALSE, FALSE, 0);

label = gtk_label_new("Hostname");
gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1);
label = gtk_label_new("Username");
gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2);
/*
label = gtk_label_new("Password");
gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3);
*/

entry = gtk_entry_new();
gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1);
dialog_child_set(dialog, "host", entry);

entry = gtk_entry_new();
gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,1,2);
dialog_child_set(dialog, "user", entry);

/* TODO - leave this out until the security/privacy implications have been dealt with */
/*
entry = gtk_entry_new();
gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,2,3);
*/

button = gtk_button_new_with_label(" Connect ");
gtk_table_attach_defaults(GTK_TABLE(table),button,2,3,0,1);
g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gui_host_connect), dialog);

/* current connected host properties */
swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (swin),
                               GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(box), swin, TRUE, TRUE, 0);

host_ls = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
host_tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(host_ls));
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), host_tv);

renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(titles[0], renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(host_tv), column);
gtk_tree_view_column_set_expand(column, FALSE);

renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(titles[1], renderer, "text", 1, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(host_tv), column);
gtk_tree_view_column_set_expand(column, TRUE);
gtk_tree_view_column_set_clickable(column, TRUE);
g_signal_connect(GTK_OBJECT(column), "clicked", GTK_SIGNAL_FUNC(gui_job_method_change), dialog);

renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(titles[2], renderer, "text", 2, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(host_tv), column);
gtk_tree_view_column_set_expand(column, FALSE);
}
Пример #3
0
void siesta_animation_dialog(GtkWidget *w, struct model_pak *model)
{
    GList *list;
    GtkWidget *window, *box, *hbox, *hbox2, *vbox, *label, *hscale, *entry, *button, *spin;
    gpointer dialog;

    g_assert(model != NULL);

    /* don't recalculate modes if already done */
    if (!model->siesta.vibration_calc_complete)
        if (siesta_phonon_calc(model))
            return;

    /* request a dialog */
    dialog = dialog_request(100, "Vibrational viewer", NULL, NULL, model);
    if (!dialog)
        return;

    window = dialog_window(dialog);
    box = gtk_vbox_new(TRUE, 0);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), box);

    /* phonon selection */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, box);
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

    /* phonon frequency */
    label = gtk_label_new("Frequency  ");
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
    entry = gtk_entry_new_with_max_length(LINELEN);
    gtk_entry_set_text(GTK_ENTRY(entry), " ");
    gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
    gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
    dialog_child_set(dialog, "phonon_entry", entry);
    gui_button(" < ", gui_siesta_mode_prev, dialog, hbox, FF);
    gui_button(" > ", gui_siesta_mode_next, dialog, hbox, FF);

    /* phonon slider */
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
    hscale = gtk_hscale_new_with_range(1.0, model->siesta.num_animations, 1.0);
    gtk_box_pack_start(GTK_BOX(hbox), hscale, TRUE, TRUE, 0);
    dialog_child_set(dialog, "phonon_slider", hscale);
    g_signal_connect(GTK_OBJECT(hscale), "value_changed",
                     GTK_SIGNAL_FUNC(gui_siesta_slider_changed), dialog);

    /* phonon display options */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, box);
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
    button = new_check_button("Show eigenvectors", gui_siesta_mode_show, dialog, FALSE, hbox);
    dialog_child_set(dialog, "phonon_toggle", button);

    spin = new_spinner("Eigenvector scaling", 0.1, 9.9, 0.1, gui_siesta_mode_show, dialog, vbox);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 4.0);
    dialog_child_set(dialog, "phonon_scaling", spin);

    spin = new_spinner("Animation resolution", 5.0, 50.0, 1.0, NULL, NULL, vbox);
    dialog_child_set(dialog, "phonon_resolution", spin);

    /* phonon mode animation */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, box);

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
    label = gtk_label_new("Animate mode ");
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
    hbox2 = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_end(GTK_BOX(hbox), hbox2, FALSE, FALSE, 0);
    gui_icon_button("GDIS_PLAY", NULL, siesta_phonon_start, dialog, hbox2);
    gui_icon_button("GDIS_STOP", NULL, siesta_phonon_stop, dialog, hbox2);

    /* phonon mode movie generation */
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
    label = gtk_label_new("Create movie ");
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
    entry = gtk_entry_new_with_max_length(LINELEN);
    gtk_entry_set_text(GTK_ENTRY(entry), "movie_name");
    gtk_entry_set_editable(GTK_ENTRY(entry), TRUE);
    gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
    dialog_child_set(dialog, "phonon_movie_name", entry);

    /* movie type */
    list = NULL;
    list = g_list_append(list, "gif");
    list = g_list_append(list, "mpg");
    entry = gui_pulldown_new(NULL, list, FALSE, hbox);
    dialog_child_set(dialog, "phonon_movie_type", entry);
    gui_button_x(NULL, siesta_phonon_movie, dialog, hbox);

    /* init and display */
    gui_siesta_frequency_set(dialog);

    gtk_widget_show_all(window);
}