71 gchar * str = g_strdup_printf (
"Cell edition - %s: surface passivation", this_proj -> name);
74 this_proj -> modelgl -> search_widg[8] -> passivating = TRUE;
76 GtkWidget * scrollsets =
create_scroll (NULL, -1, -1, GTK_SHADOW_NONE);
79 gtk_widget_set_size_request (scrollsets, 760, 350);
81 GtkWidget * info =
markup_label (
"Select any object(s) <b>A</b> to be replaced when creating the slab, then select the object(s) <b>B</b> to insert in its place.\n"
82 "When cutting into the model any bond to <b>A</b> with the new surface, will be passivated by <b>B</b>", -1, -1, 0.5, 0.5);
85 if (! this_proj -> modelgl -> search_widg[8] -> in_selection)
87 gtk_combo_box_set_active (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[8] -> atom_box), 0);
88 set_filter_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[8] -> atom_box), this_proj -> modelgl -> search_widg[8]);
92 gtk_combo_box_set_active (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[8] -> atom_box), 0);
93 set_spec_changed (GTK_COMBO_BOX(this_proj -> modelgl -> search_widg[8] -> atom_box), this_proj -> modelgl -> search_widg[8]);
99 this_proj -> modelgl -> search_widg[8] -> passivating = FALSE;
111 this_proj -> modelgl -> cell_win -> slab_info =
destroy_this_widget (this_proj -> modelgl -> cell_win -> slab_info);
114 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> modelgl -> cell_win -> slab_info,
hbox, FALSE, FALSE, 5);
117 str = g_strdup_printf (
"<b>%f</b>", this_proj -> modelgl -> cell_win -> slab_vol);
122 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> modelgl -> cell_win -> slab_info,
hbox, FALSE, FALSE, 5);
124 str = g_strdup_printf (
"<b>%d</b>", this_proj -> modelgl -> cell_win -> slab_atoms);
128 for (i=0; i<this_proj -> nspec; i++)
131 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> modelgl -> cell_win -> slab_info,
hbox, FALSE, FALSE, 0);
132 str = g_strdup_printf (
"\t - %s atom(s) in slab: ", this_proj ->
chemistry ->
label[i]);
135 str = g_strdup_printf (
"<b>%d</b>", this_proj -> modelgl -> cell_win -> slab_lot[i]);
139 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> modelgl -> cell_win -> slab_info_box, this_proj -> modelgl -> cell_win -> slab_info, FALSE, FALSE, 0);
169 status = gtk_check_button_get_active (but);
171 status = gtk_toggle_button_get_active (but);
176 view -> cell_win -> slab_show =
status;
179 view -> cell_win -> slab_pbc =
status;
182 view -> cell_win -> slab_act =
status;
185 view -> cell_win -> slab_out =
status;
188 view -> cell_win -> slab_passivate =
status;
190 if (view -> cell_win -> slab_passivate)
194 view -> search_widg[8] ->
status = 2;
199 g_free (view -> search_widg[8]);
200 view -> search_widg[8] = NULL;
201 if (! view -> atom_win -> visible)
203 g_free (view -> atom_win);
204 view -> atom_win = NULL;
209 if (view -> cell_win -> slab_show)
211 view -> create_shaders[
SLABS] = TRUE;
230 gchar * option[6]={
"- Position the center of the slab: ",
231 "- Size of the slab: ",
232 "- Size of the slab: ",
233 "- Size of the slab: ",
234 "- Parallelepiped Angles: ",
235 "- Slab rotation: "};
275 i = gtk_combo_box_get_active (box);
286 show_the_widgets (this_proj -> modelgl -> cell_win -> slab_box[1+this_proj -> modelgl -> cell_win -> slab_type]);
289 if (this_proj -> modelgl -> cell_win -> slab_type)
312 gchar * options[4] = {
"Position",
"Size",
"Angles",
"Rotation"};
317 k = (! sid) ? j : (sid == 1 && j == 2) ? 3 : j;
320 gtk_combo_box_set_active (GTK_COMBO_BOX(combo), 0);
321 g_signal_connect (G_OBJECT (combo),
"changed", G_CALLBACK(
set_slab_option), this_proj);
337 for (i=0; i<3; i++)
hide_the_widgets (this_proj -> modelgl -> cell_win -> slab_hbox[i]);
338 this_proj -> modelgl -> cell_win -> slab_type = i = gtk_combo_box_get_active (box);
340 gtk_combo_box_set_active (GTK_COMBO_BOX(this_proj -> modelgl -> cell_win -> slab_param[i]), 0);
341 set_slab_option (GTK_COMBO_BOX(this_proj -> modelgl -> cell_win -> slab_param[i]), this_proj);
342 if (this_proj -> modelgl -> n_shaders[
SLABS][0])
344 this_proj -> modelgl -> create_shaders[
SLABS] = TRUE;
345 update (this_proj -> modelgl);
360 view -> cell_win -> slab_alpha = v;
361 if (view -> n_shaders[
SLABS][0])
363 view -> create_shaders[
SLABS] = TRUE;
378G_MODULE_EXPORT gboolean
scroll_set_slab_alpha (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data)
408 if (this_proj -> modelgl -> mode ==
EDITION)
411 double ** saved_c = NULL;
412 i = this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected;
413 if (i < this_proj -> natomes)
415 saved_c = g_malloc0 ((this_proj -> natomes - i)*
sizeof*saved_c);
417 for (j=0; j<this_proj -> natomes; j++)
422 saved_c[k][0] = this_proj ->
atoms[0][j].x;
423 saved_c[k][1] = this_proj ->
atoms[0][j].y;
424 saved_c[k][2] = this_proj ->
atoms[0][j].z;
429 g_free (this_proj -> modelgl -> saved_coord[1]);
430 this_proj -> modelgl -> saved_coord[1] = NULL;
433 this_proj -> modelgl -> saved_coord[1] = g_malloc0 ((this_proj -> natomes - i)*
sizeof*this_proj -> modelgl -> saved_coord[1]);
434 for (j=0; j<this_proj -> natomes - i; j++)
436 this_proj -> modelgl -> saved_coord[1][j] =
duplicate_double(3, saved_c[j]);
441 for (i=0; i<this_proj -> natomes; i++)
446 if (this_proj -> modelgl -> mode ==
EDITION)
448 this_proj -> modelgl -> baryc[1] =
get_bary (this_proj, 1);
476 if (this_proj -> modelgl -> cell_win -> slab_act)
invert_selection (this_proj);
478 this_proj -> modelgl -> create_shaders[
SLABS] = TRUE;
481 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
482 update (this_proj -> modelgl);
497 if (this_proj -> modelgl-> cell_win -> slab_atoms)
501 is_out = this_proj -> modelgl -> cell_win -> slab_out;
502 if (this_proj -> modelgl -> search_widg[8]) this_proj -> modelgl -> search_widg[8] -> passivating = FALSE;
503 gchar * infom[2] = {
"Cut and modify model ?\n This is irreversible !",
"Cut and create new project ?"};
504 if (
ask_yes_no(
"Cut", infom[is_out], GTK_MESSAGE_WARNING, this_proj -> modelgl -> cell_win -> win))
519 if (this_proj -> modelgl -> cell_win -> slab_act)
invert_selection (this_proj);
524 if (this_proj -> modelgl -> cell_win -> slab_passivate)
526 if (this_proj -> modelgl -> atom_win)
533 this_proj -> modelgl -> cell_win -> slab_passivate = FALSE;
535 this_proj -> modelgl -> cell_win -> slab_passivate = TRUE;
549 if (this_proj -> modelgl -> cell_win -> slab_passivate)
562 if (this_proj -> modelgl -> cell_win -> slab_passivate)
570 this_proj -> modelgl -> create_shaders[
SLABS] = TRUE;
571 update (this_proj -> modelgl);
575 active_glwin -> cell_win -> slab_type = this_proj -> modelgl -> cell_win ->slab_type;
576 active_glwin -> cell_win -> slab_pbc = this_proj -> modelgl -> cell_win ->slab_pbc;
577 active_glwin -> cell_win -> slab_act = this_proj -> modelgl -> cell_win -> slab_act;
579 for (i=0; i<21; i++)
active_glwin -> cell_win -> cparam[i] = this_proj -> modelgl -> cell_win -> cparam[i];
583 active_glwin -> search_widg[8] ->
object = this_proj -> modelgl -> search_widg[8] -> object;
585 active_glwin -> search_widg[8] -> in_selection = this_proj -> modelgl -> search_widg[8] -> in_selection;
586 active_glwin -> search_widg[8] -> todo_size = this_proj -> modelgl -> search_widg[8] -> todo_size;
590 tmp_a = this_proj -> modelgl -> atom_win -> to_be_inserted[3];
592 while (
tmp_a -> next)
637 this_proj -> modelgl -> create_shaders[
SLABS] = TRUE;
638 update (this_proj -> modelgl);
643 show_info (
"Nothing to passivate the bond(s) to be broken:\nDeactivate passivating or adjust option(s) properly !", 0, this_proj -> modelgl -> cell_win -> win);
648 show_info (
"The slab is empty, nothing to do !", 0, this_proj -> modelgl -> cell_win -> win);
663 i = (this_proj -> nspec > 3) ? 15 * (this_proj -> nspec - 3) : 0;
676 G_CALLBACK(
set_slab_property), & this_proj -> modelgl -> cell_win -> slab_pointer[0]), FALSE, FALSE, 20);
678 G_CALLBACK(
set_slab_property), & this_proj -> modelgl -> cell_win -> slab_pointer[1]), FALSE, FALSE, 0);
680 G_CALLBACK(
set_slab_property), & this_proj -> modelgl -> cell_win -> slab_pointer[2]), FALSE, FALSE, 20);
682 G_CALLBACK(
set_slab_property), & this_proj -> modelgl -> cell_win -> slab_pointer[3]), FALSE, FALSE, 0);
689 gchar * type[3] = {
"Parallelepiped",
"Cylinder",
"Sphere"};
691 gtk_combo_box_set_active (GTK_COMBO_BOX(combo), this_proj -> modelgl -> cell_win -> slab_type);
692 g_signal_connect (G_OBJECT (combo),
"changed", G_CALLBACK(
set_slab_type), this_proj);
699 GtkWidget * but =
check_button (
"Passivate surface", -1, -1, this_proj -> modelgl -> cell_win -> slab_passivate,
700 G_CALLBACK(
set_slab_property), & this_proj -> modelgl -> cell_win -> slab_pointer[4]);
704 widget_set_sensitive (this_proj -> modelgl -> cell_win -> passivate, this_proj -> modelgl -> cell_win -> slab_passivate);
705 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hox, this_proj -> modelgl -> cell_win -> passivate, FALSE, FALSE, 0);
712 add_box_child_start (GTK_ORIENTATION_VERTICAL,
vbox, this_proj -> modelgl -> cell_win -> slab_opts, FALSE, FALSE, 5);
715 this_proj -> modelgl -> cell_win -> slab_hbox[i] =
create_hbox (0);
716 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> modelgl -> cell_win -> slab_opts, this_proj -> modelgl -> cell_win -> slab_hbox[i], FALSE, FALSE, 5);
717 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_proj -> modelgl -> cell_win -> slab_hbox[i],
markup_label(
"- Select option to tweak: ", 200, -1, 0.0, 0.5), FALSE, FALSE, 0);
719 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_proj -> modelgl -> cell_win -> slab_hbox[i], this_proj -> modelgl -> cell_win -> slab_param[i], FALSE, FALSE, 5);
723 this_proj -> modelgl -> cell_win -> slab_box[i] =
prepare_slab_box (i, this_proj);
724 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> modelgl -> cell_win -> slab_opts, this_proj -> modelgl -> cell_win -> slab_box[i], FALSE, FALSE, 5);
737 this_proj -> modelgl -> cell_win -> slab_info_box =
create_vbox (
BSEP);
739 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox, this_proj -> modelgl -> cell_win -> slab_info_box, FALSE, FALSE, 5);
743 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
create_button (
"Select atom(s) in this slab !",
IMG_NONE, NULL, 100, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
select_this_slab), this_proj), FALSE, FALSE, 100);
745 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
create_button (
"Cut this slab now !",
IMG_NONE, NULL, 100, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
cut_this_slab), this_proj), FALSE, FALSE, 30);
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_atom_edition(gpointer data, gboolean visible)
prepare atom edition
atom_search * allocate_atom_search(int proj, int action, int searchid, int tsize)
allocate atom search data structure
Function declarations for the mode edition window.
GtkWidget * action_tab(int aid, project *this_proj)
create model edtion action tab
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 to_passivate_using_the_objects(project *this_proj, atom_search *asearch)
prepare passivation (delete of an object, then insert of another one at the same location)
G_MODULE_EXPORT void set_spec_changed(GtkComboBox *box, gpointer data)
change the search chemical species
void restore_ogl_selection(glwin *view)
restore a saved atom selection
void preserve_ogl_selection(glwin *view)
copy the atom selection, so that it can be re-used once the input assistant is closed.
GtkFileFilter * filter[NCFORMATS+1]
G_MODULE_EXPORT void set_slab_property(GtkToggleButton *but, gpointer data)
set slab property toggle callback GTK3
G_MODULE_EXPORT void set_slab_type(GtkComboBox *box, gpointer data)
change slab type
void invert_selection(project *this_proj)
invert atom(s) selection
void slab_alpha_has_changed(gpointer data, GLfloat v)
change slab opacity
G_MODULE_EXPORT void set_slab_option(GtkComboBox *box, gpointer data)
change slab option combo
G_MODULE_EXPORT void set_filter_changed(GtkComboBox *box, gpointer data)
change the search filter
G_MODULE_EXPORT gboolean scroll_set_slab_alpha(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
change slab opactiy callback - scoll
GtkWidget * cut_in_model(project *this_proj)
create the cut slab tab
G_MODULE_EXPORT void cut_this_slab(GtkButton *but, gpointer data)
cut this slab callback
void create_slab_info(project *this_proj)
create slab information widget
G_MODULE_EXPORT void setup_passivate(GtkButton *but, gpointer data)
passivate button callback
G_MODULE_EXPORT void select_this_slab(GtkButton *but, gpointer data)
select / unselect atom(s) in slab callback
GtkWidget * create_slab_param_combo(int sid, project *this_proj)
create slab parameters combo widget
G_MODULE_EXPORT void set_slab_alpha(GtkRange *range, gpointer data)
change slab opactiy callback - range
GtkWidget * prepare_slab_box(int sid, project *this_proj)
create slab parameters widget box
Function declarations for the cell edition window.
GtkWidget * create_cell_entries(project *this_proj, int i)
create the cell entry widgets
integer(kind=c_int) function chemistry()
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
void create_slab_lists(project *this_proj)
prepare slab(s) OpenGL rendering
void process_selected_atom(project *this_proj, glwin *view, int id, int ac, int se, int pi)
process selected atom
atom_in_selection * tmp_a
atom_in_selection * tmp_b
int * duplicate_int(int num, int *old_val)
copy a list of int
double * duplicate_double(int num, double *old_val)
copy a list of double
GMainLoop * Event_loop[5]
double * allocdouble(int val)
allocate a double * pointer
int * allocint(int val)
allocate an int * pointer
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
void opengl_project_changed(int id)
change the OpenGL project
void layout_add_widget(GtkWidget *layout, GtkWidget *child, int x_pos, int y_pos)
Add a GtkWidget in a GtkLayout.
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
G_MODULE_EXPORT void select_unselect_atoms(GtkWidget *widg, gpointer data)
select / unselect a type of atom(s) callback GTK3
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
GtkWidget * create_layout(int x, int y)
create a GtkLayout / GtkFixed widget
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
GtkWidget * create_hscale(float min, float max, float delta, float val, int pos, int round, int size, GCallback handler, GCallback scroll_handler, gpointer data)
create an horizontal scale GtkWidget
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
G_MODULE_EXPORT void edit_in_new_project(GtkWidget *widg, gpointer data)
create new project using selection callback GTK3
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
G_MODULE_EXPORT void remove_the_atoms(GtkWidget *widg, gpointer data)
remove selected atom(s) callback GTK3
void update(glwin *view)
update the rendering of the OpenGL window
void re_create_md_shaders(int nshaders, int shaders[nshaders], project *this_proj)
re-initialize some MD dependent OpenGL shaders
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
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 show_info(char *information, int val, GtkWidget *win)
add / show information message to widget
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
void active_project_changed(int id)
change the active project