コード例 #1
0
/* TODO - separate widget from config so it can be re-used */
void gui_siesta_widget(GtkWidget *box, gpointer config)
{
    gchar *text;
    GSList *list, *list1;
    GtkWidget *notebook, *vbox, *hbox, *label, *textbox;
    GtkWidget *page, *left, *right;
    struct siesta_pak *siesta;

    g_assert(box != NULL);
    g_assert(config != NULL);

    siesta = config_data(config);

    /* true false (default) list */
    list1 = NULL;
    list1 = g_slist_prepend(list1, "False");
    list1 = g_slist_prepend(list1, "True");
    list1 = g_slist_prepend(list1, "");

    /* build widget */
    notebook = gtk_notebook_new();
    gtk_container_add(GTK_CONTAINER(box), notebook);

    /* file write page */
    page = gtk_vbox_new(FALSE, 0);
    label = gtk_label_new(" File I/O ");
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);


    vbox = gui_frame_vbox(NULL, FALSE, FALSE, page);
    gui_text_entry("System Label  ", &siesta->system_label, TRUE, TRUE, vbox);

    /*
    vbox = gui_frame_vbox("Mesh potential", FALSE, FALSE, page);
    gui_text_entry("Density of states ", &siesta->density_of_states, TRUE, FALSE, vbox);
    gui_text_entry("Density on mesh ", &siesta->density_on_mesh, TRUE, FALSE, vbox);
    gui_text_entry("Electrostatic pot on mesh ", &siesta->electrostatic_pot_on_mesh, TRUE, FALSE, vbox);
    */

    hbox = gui_frame_hbox(NULL, FALSE, FALSE, page);
    left = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), left, TRUE, TRUE, 0);
    right = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), right, TRUE, TRUE, 0);

    /* left */
    gui_pd_new("Use saved data", &siesta->use_saved_data, list1, left);
    gui_pd_new("Long output ", &siesta->long_output, list1, left);
    gui_pd_new("Write coordinates", &siesta->write_coor_step, list1, left);
    gui_pd_new("Write cerius coordinates", &siesta->write_coor_cerius, list1, left);
    gui_pd_new("Write xmol coordinates", &siesta->write_coor_xmol, list1, left);
    gui_pd_new("Write xmol animation", &siesta->write_md_xmol, list1, left);
    gui_pd_new("Write trajectory history", &siesta->write_md_history, list1, left);
    gui_pd_new("Write forces", &siesta->write_forces, list1, left);

    /* right */
    gui_pd_new("Write wavefunctions", &siesta->write_wavefunctions, list1, right);
    gui_pd_new("Write density matrix", &siesta->write_dm, list1, right);
    gui_pd_new("Write k points", &siesta->write_kpoints, list1, right);
    gui_pd_new("Write eigenvalues", &siesta->write_eigenvalues, list1, right);
    gui_pd_new("Write k bands", &siesta->write_kbands, list1, right);
    gui_pd_new("Write bands", &siesta->write_bands, list1, right);
    gui_pd_new("Write Mulliken population", &siesta->write_mullikenpop, list1, right);


    /* electronic page */

    page = gtk_vbox_new(FALSE, 0);
    label = gtk_label_new("Electronic");
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(page), hbox, TRUE, TRUE, 0);
    left = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), left, TRUE, TRUE, 0);
    right = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), right, TRUE, TRUE, 0);


    /* basis set */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);

    list = NULL;
    list = g_slist_prepend(list, "nonodes");
    list = g_slist_prepend(list, "nodes");
    list = g_slist_prepend(list, "splitgauss");
    list = g_slist_prepend(list, "split");
    list = g_slist_prepend(list, "");
    gui_pd_new("Basis type", &siesta->basis_type, list, vbox);
    g_slist_free(list);

    list = NULL;
    list = g_slist_prepend(list, "DZP");
    list = g_slist_prepend(list, "SZP");
    list = g_slist_prepend(list, "DZ");
    list = g_slist_prepend(list, "SZ");
    list = g_slist_prepend(list, "");
    gui_pd_new("Basis size", &siesta->basis_size, list, vbox);
    g_slist_free(list);

    /* custom zeta ie %block PAO.basis */
    /*
    gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
    gui_text_entry("Zeta level ", &siesta->custom_zeta, TRUE, FALSE, vbox);
    gui_text_entry("Polarisation level ", &siesta->custom_zeta_polarisation, TRUE, FALSE, vbox);
    */

    /* functional */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);
    list = NULL;
    list = g_slist_prepend(list, "LDA");
    list = g_slist_prepend(list, "GGA");
    list = g_slist_prepend(list, "");
    gui_pd_new("X-C functional", &siesta->xc_functional, list, vbox);
    g_slist_free(list);

    list = NULL;
    list = g_slist_prepend(list, "LYP");
    list = g_slist_prepend(list, "RPBE");
    list = g_slist_prepend(list, "revPBE");
    list = g_slist_prepend(list, "PBE");
    list = g_slist_prepend(list, "PW92");
    list = g_slist_prepend(list, "CA");
    list = g_slist_prepend(list, "");
    gui_pd_new("X-C authors", &siesta->xc_authors, list, vbox);
    g_slist_free(list);

    gui_pd_new("Harris functional", &siesta->harris_functional, list1, vbox);

    /* spin */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);
    gui_pd_new("Spin polarised", &siesta->spin_polarised, list1, vbox);
    gui_pd_new("Non co-linear spin", &siesta->non_collinear_spin, list1, vbox);
    gui_pd_new("Fixed spin", &siesta->fixed_spin, list1, vbox);

    list = NULL;
    list = g_slist_prepend(list, "0.5");
    list = g_slist_prepend(list, "1.0");
    list = g_slist_prepend(list, "1.5");
    list = g_slist_prepend(list, "2.0");
    list = g_slist_prepend(list, "");
    gui_pd_new("Total spin", &siesta->total_spin, list, vbox);
    g_slist_free(list);

    gui_pd_new("Single excitation", &siesta->single_excitation, list1, vbox);


    /* SCF options */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, right);

    gui_text_entry("Number of SCF cycles ", &siesta->no_of_cycles, TRUE, FALSE, vbox);
    gui_text_entry("Mixing weight ", &siesta->mixing_weight, TRUE, FALSE, vbox);
    gui_text_entry("Number of Pulay matrices ", &siesta->no_of_pulay_matrices, TRUE, FALSE, vbox);


    /* other options */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, right);
    gui_text_entry("Energy shift (Ryd)", &siesta->energy_shift, TRUE, FALSE, vbox);
    gui_text_entry("Split zeta norm", &siesta->split_zeta_norm, TRUE, FALSE, vbox);
    gui_text_entry("Mesh cutoff (Ryd)", &siesta->mesh_cutoff, TRUE, FALSE, vbox);
    gui_text_entry("kgrid cutoff ", &siesta->kgrid_cutoff, TRUE, FALSE, vbox);


    /* speed hacks left/right */
    /*
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(page), hbox, TRUE, TRUE, 0);
    left = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), left, TRUE, TRUE, 0);
    right = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), right, TRUE, TRUE, 0);
    */

    /* speed hacks */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);
    list = NULL;
    list = g_slist_prepend(list, "orderN");
    list = g_slist_prepend(list, "diagon");
    list = g_slist_prepend(list, "");
    gui_pd_new("Solution method", &siesta->solution_method, list, vbox);
    g_slist_free(list);

    /* NEW */
    list = NULL;
    list = g_slist_prepend(list, "MP");
    list = g_slist_prepend(list, "FD");
    list = g_slist_prepend(list, "");
    gui_pd_new("Occupation function", &siesta->occupation_function, list, vbox);
    g_slist_free(list);

    list = NULL;
    list = g_slist_prepend(list, "Files");
    list = g_slist_prepend(list, "Ordejon-Mauri");
    list = g_slist_prepend(list, "Kim");
    list = g_slist_prepend(list, "");
    gui_pd_new("Order N functional", &siesta->ordern_functional, list, vbox);
    g_slist_free(list);

    vbox = gui_frame_vbox(NULL, FALSE, FALSE, right);
    gui_text_entry("Electronic temperature", &siesta->electronic_temperature, TRUE, FALSE, vbox);
    gui_text_entry("Occupation MP order ", &siesta->occupation_mp_order, TRUE, FALSE, vbox);
    gui_text_entry("Order N iterations ", &siesta->ordern_iterations, TRUE, FALSE, vbox);
    gui_text_entry("Order N energy tolerance ", &siesta->ordern_energy_tolerance, TRUE, FALSE, vbox);
    gui_text_entry("Order N eta ", &siesta->ordern_eta, TRUE, FALSE, vbox);
    gui_text_entry("Order N eta_alpha ", &siesta->ordern_eta_alpha, TRUE, FALSE, vbox);
    gui_text_entry("Order N eta_beta ", &siesta->ordern_eta_beta, TRUE, FALSE, vbox);


    /* Run page */
    page = gtk_vbox_new(FALSE, 0);
    label = gtk_label_new("Geometric");
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);

    /* split pane */
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(page), hbox, TRUE, TRUE, 0);
    left = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), left, TRUE, TRUE, 0);
    right = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), right, TRUE, TRUE, 0);

    /* main setup */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);
    list = NULL;
    list = g_slist_prepend(list, "Phonon");
    list = g_slist_prepend(list, "FC");
    list = g_slist_prepend(list, "Anneal");
    list = g_slist_prepend(list, "NoseParrinelloRahman");
    list = g_slist_prepend(list, "ParrinelloRahman");
    list = g_slist_prepend(list, "Nose");
    list = g_slist_prepend(list, "Verlet");
    list = g_slist_prepend(list, "Broyden");
    list = g_slist_prepend(list, "CG");
    list = g_slist_prepend(list, "");
    gui_pd_new("Run type", &siesta->md_type_of_run, list, vbox);
    g_slist_free(list);

    gui_pd_new("Variable cell", &siesta->md_variable_cell, list1, vbox);

    /* MD steps */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);
    gui_text_entry("Initial time step ", &siesta->md_initial_time_step, TRUE, FALSE, vbox);
    gui_text_entry("Final time step ", &siesta->md_final_time_step, TRUE, FALSE, vbox);
    gui_text_entry("Length of time step ", &siesta->md_length_time_step, TRUE, FALSE, vbox);

    /* CG steps */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, left);
    gui_text_entry("Max CG steps", &siesta->md_num_cg_steps, TRUE, FALSE, vbox);
    gui_text_entry("Max CG displacement", &siesta->md_max_cg_displacement, TRUE, FALSE, vbox);
    gui_text_entry("Max force tolerance", &siesta->md_max_force_tol, TRUE, FALSE, vbox);
    gui_text_entry("Max stress tolerance", &siesta->md_max_stress_tol, TRUE, FALSE, vbox);

    /* temperature */
    vbox = gui_frame_vbox(NULL, FALSE, FALSE, right);
    gui_text_entry("Initial temperature ", &siesta->md_initial_temperature, TRUE, FALSE, vbox);
    gui_text_entry("Target temperature ", &siesta->md_target_temperature,TRUE, FALSE, vbox);
    gui_text_entry("Target pressure", &siesta->md_target_pressure, TRUE, FALSE, vbox);

//gui_text_entry("Number of Steps ", &siesta->number_of_steps, TRUE, FALSE, vbox);

    /* additional options */
    vbox = gui_frame_vbox("Target stress tensor", FALSE, FALSE, right);
    gui_text_entry("xx", &siesta->md_target_stress[0], TRUE, FALSE, vbox);
    gui_text_entry("yy", &siesta->md_target_stress[1], TRUE, FALSE, vbox);
    gui_text_entry("zz", &siesta->md_target_stress[2], TRUE, FALSE, vbox);
    gui_text_entry("xy", &siesta->md_target_stress[3], TRUE, FALSE, vbox);
    gui_text_entry("xz", &siesta->md_target_stress[4], TRUE, FALSE, vbox);
    gui_text_entry("yz", &siesta->md_target_stress[5], TRUE, FALSE, vbox);

//vbox = gui_frame_vbox("Differencing", FALSE, FALSE, geompage);
//gui_direct_spin("Finite Difference step size ", &siesta->finite_diff_step_size, 0.1, 10.0, 0.1, NULL, NULL, vbox);

    /* unprocessed lines */
    page = gtk_vbox_new(FALSE, 0);
    label = gtk_label_new (" Unprocessed ");
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);

    vbox = gui_frame_vbox(NULL, TRUE, TRUE, page);

    text = config_unparsed_get(config);

    /* FIXME - allowing this to be edited -> core dump */
    textbox = gui_text_window(&text, FALSE);

    gtk_box_pack_start(GTK_BOX(vbox), textbox, TRUE, TRUE, 0);


    /* cleanup */
    g_slist_free(list1);

    gui_relation_update(NULL);
}
コード例 #2
0
void gui_animate_dialog(void)
{
gpointer dialog;
GtkWidget *window, *main_vbox, *table, *vbox, *hbox;
GtkWidget *notebook, *page, *label, *entry, *scale;
GList *list;

/* prevent recording whilst in animation */
gui_mode_switch(FREE);

/* dialog setup */
dialog = dialog_request(ANIM, "Animation and Rendering", NULL, NULL, NULL);
if (!dialog)
  return;
window = dialog_window(dialog);
gtk_widget_set_size_request(window, 350, -1);

/* notebook frame */
main_vbox = gtk_vbox_new(FALSE, PANEL_SPACING);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), main_vbox);

/* create notebook */
vbox = gui_frame_vbox(NULL, FALSE, FALSE, main_vbox);
notebook = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(vbox),notebook,FALSE,TRUE,0);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), TRUE);

/* page */
page = gtk_vbox_new(FALSE, PANEL_SPACING);
label = gtk_label_new("Control");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);

vbox = gtk_vbox_new(FALSE, PANEL_SPACING);
gtk_box_pack_start(GTK_BOX(page),vbox,FALSE,FALSE,0);

/* format pulldown */
animate_phonons=FALSE;
list = NULL;
list = g_list_append(list, "Frames");
list = g_list_append(list, "Phonons");
hbox = gtk_hbox_new(FALSE, 0);
label = gtk_label_new("Display ");
gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
entry = gui_pulldown_new(NULL, list, 0, hbox);
g_list_free(list);
g_signal_connect(GTK_OBJECT(entry), "changed",
                 GTK_SIGNAL_FUNC(gui_animate_type_change), (gpointer) entry);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);

/* phonon options */
box_phonon_options = gtk_vbox_new(FALSE, PANEL_SPACING);
gtk_box_pack_start(GTK_BOX(vbox),box_phonon_options,FALSE,FALSE,0);

gui_direct_spin("Phonon scaling ", &sysenv.render.phonon_scaling,
                0.1, 9.9, 0.1, NULL, NULL, box_phonon_options);
gui_direct_spin("Phonon resolution ", &sysenv.render.phonon_resolution,
                10.0, 100.0, 1.0, NULL, NULL, box_phonon_options);

gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);


/* CURRENT - FPS */
gui_direct_spin("Apparent FPS for animation ", &gui_animate_fps, 1, 50, 1, NULL, NULL, vbox);

/* connectivity options */
gui_direct_check("Recalculate connectivity", &sysenv.render.connect_redo, NULL, NULL, vbox);

/*
gui_checkbox("Don't recalculate scale", NULL, vbox);
gui_checkbox("Loop", NULL, vbox);
*/

/* actions at start of each cycle */
/*
new_radio_group(0, vbox, FF);

button = add_radio_button("Confine atoms to PBC", (gpointer) atom_pbc, data);
if (data->anim_confine == PBC_CONFINE_ATOMS)
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);

button = add_radio_button("Confine mols to PBC", (gpointer) mol_pbc, data);
if (data->anim_confine == PBC_CONFINE_MOLS)
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);

button = add_radio_button("Cell confinement off", (gpointer) no_pbc, data);
if (data->anim_confine == PBC_CONFINE_NONE)
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
*/

/* page */
page = gtk_vbox_new(FALSE, PANEL_SPACING);
label = gtk_label_new("Render");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);

vbox = gtk_vbox_new(FALSE, PANEL_SPACING);
gtk_box_pack_start(GTK_BOX(page),vbox,FALSE,FALSE,0);

gui_direct_spin("Width", &sysenv.render.width, 100, 2000, 100, NULL, NULL, vbox);
gui_direct_spin("Height", &sysenv.render.height, 100, 2000, 100, NULL, NULL, vbox);

gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);

gui_direct_check("Shadowless", &sysenv.render.shadowless, NULL, NULL, vbox);
gui_direct_check("Create povray input then stop", &sysenv.render.no_povray_exec, NULL, NULL, vbox);
gui_direct_check("Cleanup temporary files", &sysenv.render.no_keep_tempfiles, NULL, NULL, vbox);

hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
gui_button("  Render  ", gui_animate_render, NULL, hbox, TF);

/* page */
page = gtk_vbox_new(FALSE, PANEL_SPACING);
label = gtk_label_new("Movie");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, label);

vbox = gtk_vbox_new(FALSE, PANEL_SPACING);
gtk_box_pack_start(GTK_BOX(page),vbox,FALSE,FALSE,0);

table = gtk_table_new(4, 4, FALSE);
gtk_box_pack_start(GTK_BOX(vbox),table,FALSE,FALSE,0);

/* name label */
label = gtk_label_new("Filename");
gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1);

/* name entry */
/*
entry = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry), sysenv.render.animate_file);
*/
entry = gui_text_entry(NULL, &sysenv.render.animate_file, TRUE, FALSE, NULL);
gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1);

/* format label */
label = gtk_label_new("Format");
gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2);

/* format pulldown */
list=NULL;
list = g_list_append(list, "mpg");
list = g_list_append(list, "mp4");
list = g_list_append(list, "flv");
list = g_list_append(list, "avi");
hbox = gtk_hbox_new(FALSE, 0);
entry_movie_type = gui_pulldown_new(NULL, list, 0, hbox);
g_list_free(list);
g_signal_connect(GTK_OBJECT(entry_movie_type), "changed",
                 GTK_SIGNAL_FUNC(gui_animate_movie_type_change), (gpointer) entry);
gtk_table_attach_defaults(GTK_TABLE(table),hbox,1,2,1,2);


/* update hook */
g_signal_connect(GTK_OBJECT(entry), "changed",
                 GTK_SIGNAL_FUNC(event_render_modify), (gpointer) entry);
g_object_set_data(G_OBJECT(entry), "id", (gpointer) ANIM_NAME);

hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
gui_button("  Create  ", gui_animate_movie, NULL, hbox, TF);

/* slider for current frame */
vbox = gui_frame_vbox(NULL, FALSE, FALSE, main_vbox);
scale = gtk_hscale_new_with_range(1.0, 100.0, 1.0);
gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_CONTINUOUS);
gtk_box_pack_start(GTK_BOX(vbox), scale, TRUE, TRUE, 0);
g_signal_connect(GTK_OBJECT(scale), "value_changed",
                 GTK_SIGNAL_FUNC(gui_animate_frame_select), NULL);

gtk_scale_set_draw_value(GTK_SCALE(scale), FALSE);

/* animation limits */
vbox = gui_frame_vbox(NULL, FALSE, FALSE, main_vbox);
gui_text_entry("First ", &entry_frame_start, TRUE, FALSE, vbox);
gui_text_entry("Last ", &entry_frame_stop, TRUE, FALSE, vbox);
gui_text_entry("Step ", &entry_frame_step, TRUE, FALSE, vbox);

/* control buttons */
hbox = gtk_hbox_new(TRUE, PANEL_SPACING);
gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);

gui_icon_button("GDIS_REWIND", NULL,
                  gui_animate_first, NULL,
                  hbox);

gui_icon_button("GDIS_STEP_BACKWARD", NULL,
                  gui_animate_back, NULL,
                  hbox);

gui_icon_button("GDIS_PLAY", NULL,
                  gui_animate_play, NULL,
                  hbox);

gui_icon_button("GDIS_PAUSE", NULL,
                   gui_animate_stop, NULL,
                  hbox);

gui_icon_button("GDIS_STEP_FORWARD", NULL,
                  gui_animate_next, NULL,
                  hbox);

gui_icon_button("GDIS_FASTFORWARD", NULL,
                  gui_animate_last, NULL,
                  hbox);

gui_stock_button(GTK_STOCK_HELP, gui_help_show, "Animation and Rendering", GTK_DIALOG(window)->action_area);

/* terminating button */
gui_stock_button(GTK_STOCK_CLOSE, dialog_destroy, dialog,
                   GTK_DIALOG(window)->action_area);

/* display the dialog */
gtk_widget_show_all(window);

gtk_widget_hide(box_phonon_options);
}
コード例 #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);
}