atomes 1.3.2
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
callbacks.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2026 by CNRS and University of Strasbourg */
15
22
23/*
24* This file: 'callbacks.c'
25*
26* Contains:
27*
28
29 - General callbacks
30 - The functions to open and close files
31
32*
33* List of functions:
34
35 int signal_error (gchar * file, gchar * func, int error_line, int error_id);
36 int open_save (FILE * fp, int act, int wid, int pid, int aid, gchar * pfile);
37 int open_save_workspace (FILE * fp, int act);
38 int prep_chem_data ();
39 int to_read_trj_or_vas (int ff);
40 int read_npt_data ();
41 int open_coordinate_file (int id);
42
43 void quit_gtk ();
44 void update_error_trace (gchar * file, gchar * func, int trace_line);
45 void open_this_proj (gpointer data, gpointer user_data);
46 void run_project ();
47 void apply_project (gboolean showtools);
48 void open_this_isaacs_xml_file (gchar * profile, int ptoc, gboolean visible);
49 void to_read_pos ();
50 void check_read_sa ();
51 void update_sa_info (int sid);
52 void prepare_sp_box ();
53 void cell_data_from_pdb_ (float * a, float * b, float * c, float * alp, float * bet, float * gam);
54 void open_this_coordinate_file (int format, gchar * proj_name, gboolean main_reader);
55
56 G_MODULE_EXPORT void on_close_workspace (GtkWidget * widg, gpointer data);
57 G_MODULE_EXPORT void run_on_open_save_active (GtkNativeDialog * info, gint response_id, gpointer data);
58 G_MODULE_EXPORT void run_on_open_save_active (GtkDialog * info, gint response_id, gpointer data);
59 G_MODULE_EXPORT void on_open_save_activate (GtkWidget * widg, gpointer data);
60 G_MODULE_EXPORT void on_save_as_activate (GtkWidget * widg, gpointer data);
61 G_MODULE_EXPORT void run_on_isaacs_port (GtkNativeDialog * info, gint response_id, gpointer data);
62 G_MODULE_EXPORT void run_on_isaacs_port (GtkDialog * info, gint response_id, gpointer data);
63 G_MODULE_EXPORT void on_isaacs_port (GtkWidget * widg, gpointer data);
64 G_MODULE_EXPORT void update_sa (GtkEntry * res, gpointer data);
65 G_MODULE_EXPORT void changed_spec_combo (GtkComboBox * box, gpointer data);
66 G_MODULE_EXPORT void update_at_sp (GtkEntry * res, gpointer data);
67 G_MODULE_EXPORT void run_to_read_trj_or_vas (GtkDialog * dialog, gint response_id, gpointer data);
68 G_MODULE_EXPORT void run_read_npt_data (GtkNativeDialog * info, gint response_id, gpointer data);
69 G_MODULE_EXPORT void run_read_npt_data (GtkDialog * info, gint response_id, gpointer data);
70 G_MODULE_EXPORT void run_on_coord_port (GtkNativeDialog * info, gint response_id, gpointer data);
71 G_MODULE_EXPORT void run_on_coord_port (GtkDialog * info, gint response_id, gpointer data);
72 G_MODULE_EXPORT void on_coord_port (GtkWidget * widg, gpointer data);
73
74*/
75
76#include "global.h"
77#include "interface.h"
78#include "callbacks.h"
79#include "bind.h"
80#include "project.h"
81#include "workspace.h"
82#include "glwindow.h"
83#include "glview.h"
84#include "atom_edit.h"
85#include "cell_edit.h"
86#include "readers.h"
87
88char * coord_files[NCFORMATS+1] = {i18n("XYZ file"),
89 i18n("XYZ file - NPT"),
90 i18n("Chem3D file"),
91 i18n("CPMD trajectory"),
92 i18n("CPMD trajectory - NPT"),
93 i18n("VASP trajectory"),
94 i18n("VASP trajectory - NPT"),
95 i18n("PDB file"),
96 i18n("PDB file"),
97 i18n("Cryst. information (crystal build) - single configuration"),
98 i18n("Cryst. information (crystal build) - multiple configurations"),
99 i18n("Cryst. information (symmetry positions) - single configuration"),
100 i18n("DL-POLY HISTORY file"),
101 i18n("atomes Simple Chemical Library"),
102 i18n("ISAACS Project File")};
103
104char * coord_files_ext[NCFORMATS+1]={"xyz", "xyz", "c3d", "trj", "trj", "xdatcar", "xdatcar",
105 "pdb", "ent", "cif", "cif", "cif", "hist", "sml", "ipf"};
106
107#define OUT_FORMATS 3
108char * out_ext[OUT_FORMATS]={"xyz", "c3d", "sml"};
109
110char ** las;
111
112extern void simple_image_render();
113extern G_MODULE_EXPORT void on_edit_activate (GtkWidget * widg, gpointer data);
114extern gchar * substitute_string (gchar * init, gchar * o_motif, gchar * n_motif);
115extern const gchar * dfi[2];
116extern int open_cif_file (gchar * filename);
117extern int open_coord_file (gchar * filename, int fti);
118extern int open_history_file (gchar * filename);
119extern int open_cell_file (int format, gchar * filename);
120extern double get_z_from_periodic_table (gchar * lab);
121extern int write_sml (project * this_proj);
122
123#ifdef GTK4
124G_MODULE_EXPORT void run_on_coord_port (GtkNativeDialog * info, gint response_id, gpointer data);
125#else
126G_MODULE_EXPORT void run_on_coord_port (GtkDialog * info, gint response_id, gpointer data);
127#endif
128
137G_MODULE_EXPORT void on_close_workspace (GtkWidget * widg, gpointer data)
138{
139 int i, j;
140 gboolean close = FALSE;
141 j = GPOINTER_TO_INT (data);
142 if (j == 1)
143 {
144 close = ask_yes_no (_("Close workspace ?"), _("Are you sure ?"), GTK_MESSAGE_QUESTION, atomes_main_window);
145 }
146 else
147 {
148 close = TRUE;
149 }
150
151 if (close)
152 {
153 j = nprojects-1;
154 for (i=j; i>-1; i--)
155 {
156#ifdef DEBUG
157 g_debug ("CLOSING:: %d", i);
158#endif
159 on_close_activate (NULL, GINT_TO_POINTER(i));
160 }
161 }
162}
163
164gboolean save = TRUE;
165
168 { ERROR_PROJECT, i18n("project information")},
169 { ERROR_CURVE, i18n("curve(s) information")},
170 { ERROR_IMAGE, i18n("OpenGL information")},
171 { ERROR_ATOM_A, i18n("atom's data - A")},
172 { ERROR_ATOM_B, i18n("atom's data - B")},
173 { ERROR_UPDATE, i18n("updating project")},
174 { ERROR_NO_WAY, i18n("this should not happen")},
175 { ERROR_COORD, i18n("coordination data")},
176 { ERROR_RINGS, i18n("ring(s) data")},
177 { ERROR_CHAINS, i18n("chain(s) data")},
178 { ERROR_MOL, i18n("molecule(s) data")},
179 { ERROR_ANA, i18n("analysis data")},
180 { ERROR_QM, i18n("ab-initio data")},
181 { ERROR_FIELD, i18n("classical data")}};
182
193int signal_error (const char * file, const char * func, int error_line, int error_id)
194{
195 project_error -> error_file = g_strdup_printf("%s", file);
196 project_error -> error_func = g_strdup_printf("%s", func);
197 project_error -> error_line = error_line;
198 project_error -> error_signal = errors_messages[error_id-1];
199 return error_line;
200}
201
211void update_error_trace (const char * file, const char * func, int trace_line)
212{
213 gchar * intro = "<span font_desc=\"monospace 10\">\n";
214 gchar * file_part;
215 gchar * func_part;
216 gchar * line_part;
217 gchar * tab_part = NULL;
218 gchar * tmp_trace;
219 int i;
220 if (project_error -> trace_id)
221 {
222 tmp_trace = g_strdup_printf ("%s\n%s", project_error -> error_trace, intro);
223 g_free (project_error -> error_trace);
224 }
225 else
226 {
227 tmp_trace = g_strdup_printf ("%s", intro);
228 }
229 for (i=0; i<project_error -> trace_id+1; i++)
230 {
231 tab_part = (tab_part) ? g_strdup_printf ("%s\t\t", tab_part) : g_strdup_printf ("\t\t");
232 }
233 file_part = g_strdup_printf (_("File : %s\n"), file);
234 func_part = g_strdup_printf (_("Function: %s()\n"), func);
235 line_part = g_strdup_printf (_("Line : %d</span>"), trace_line);
236 project_error -> error_trace = g_strdup_printf ("%s%s%s%s%s%s%s", tmp_trace, tab_part, file_part, tab_part, func_part, tab_part, line_part);
237 g_free (tmp_trace);
238 g_free (tab_part);
239 g_free (file_part);
240 g_free (func_part);
241 g_free (line_part);
242 project_error -> trace_id ++;
243}
244
257int open_save (FILE * fp, int act, int wid, int pid, int aid, gchar * pfile)
258{
259 int j;
260 project_error = g_malloc0(sizeof*project_error);
261 gchar * tmp_err;
262 if (act == 0)
263 {
264 reading_input = TRUE;
265 j = open_project (fp, wid);
266 reading_input = FALSE;
267 if (j != OK)
268 {
269 tmp_err = g_strdup_printf ("%s", get_project_by_id (pid) -> name);
271 }
272 else
273 {
274 get_project_by_id (pid) -> projfile = g_strdup_printf ("%s", pfile);
276 {
279 }
280 else
281 {
284 {
285 active_project -> coordfile = g_strdup_printf ("%s", active_project -> projfile);
286 run_on_coord_port (NULL, GTK_RESPONSE_ACCEPT, GINT_TO_POINTER(1));
287 }
289 }
290 }
291 }
292 else
293 {
294 j = save_project (fp, get_project_by_id(pid), wid);
295 if (j == OK)
296 {
297 if (pfile != NULL) get_project_by_id(pid) -> projfile = g_strdup_printf ("%s", pfile);
298 }
299 else
300 {
301 tmp_err = g_strdup_printf ("%s", get_project_by_id(pid) -> name);
302 }
303 }
304 if (j != OK)
305 {
306 gchar * err;
307 if (pfile != NULL && ! wid)
308 {
309 err = g_strdup_printf (_("Impossible to %s project file: \n\n"
310 "\t\t%s\n\n"
311 "\tError %s %s\n"
312 "\tProject file version: <b>%1.1f</b>\n"),
313 (! act) ? _("open") : _("save"),
314 pfile,
315 (! act) ? _("reading") : _("saving"),
316 _(project_error -> error_signal.message),
318
319 }
320 else if (wid)
321 {
322 err = g_strdup_printf (_("Impossible to %s workspace file.\n"
323 "Error with project: \n\n"
324 "\t\t%s\n\n"
325 "\tError %s %s\n"
326 "\tProject file version: <b>%1.1f</b>\n"),
327 (! act) ? _("open") : _("save"),
328 tmp_err,
329 (! act) ? _("reading") : _("saving"),
330 _(project_error -> error_signal.message),
332 }
334 g_free (tmp_err);
335 g_free (err);
336 }
337 g_free (project_error);
338 project_error = NULL;
339 return j;
340}
341
347void quit_gtk ()
348{
350 {
351 // Update image for LibreOffice document
352 atomes_render_image = TRUE;
354 atomes_render_image = FALSE;
355 // Mandatory saving of the project file
356 FILE * fp = fopen (projfile, dfi[1]);
357 open_save (fp, 1, 1, 0, 0, NULL);
358 fclose (fp);
360 }
361 else
362 {
363 int i;
364 for (i=nprojects-1; i>=0; i--) to_close_this_project (i, get_project_by_id(i));
365 }
366 profree_ ();
367 g_application_quit (G_APPLICATION(atomes_app));
368}
369
378int open_save_workspace (FILE * fp, int act)
379{
380 int i, j, k, l;
381 gchar * ver;
382 /*PangoFontDescription * font_desc;
383 GtkTextBuffer * buffer;
384 GtkTextIter bStart;
385 GtkTextIter bEnd;*/
386
387 // First 2 lines for compatibility issues
388 if (act == 0)
389 {
390 if (fread (& i, sizeof(int), 1, fp) != 1) return 1;
391 ver = g_malloc0(i*sizeof*ver);
392 if (fread (ver, sizeof(char), i, fp) != i) return 1;
393 // test on ver for version ?
394 g_free (ver);
395 if (fread (& i, sizeof(int), 1, fp) != 1) return 1;
396 }
397 else
398 {
399 i = 1;
400 ver = g_strdup_printf ("%%\n%% Workspace file v-%1d.0\n%%\n", i);
401 i = strlen (ver);
402 if (fwrite (& i, sizeof(int), 1, fp) != 1) return 1;
403 if (fwrite (ver, sizeof(char), i, fp) != i) return 1;
404 g_free (ver);
405 i = 0;
406 for (j=0; j<nprojects; j++) if (get_project_by_id(j) -> natomes) i++;
407 if (fwrite (& i, sizeof(int), 1, fp) != 1) return 1;
408 }
409
410 if (i > 0)
411 {
412 for (j=0; j<i; j++)
413 {
414 k = activep;
415 if (act == 0)
416 {
417 init_project (FALSE);
418 l = open_save (fp, act, 1, j, k, NULL);
419 if (l != 0) return l;
420 }
421 else if (get_project_by_id(j) -> natomes)
422 {
423 l = open_save (fp, act, 1, j, k, NULL);
424 if (l != 0) return l;
425 }
426 }
427 return 0;
428 }
429 else
430 {
431 return -1;
432 }
433}
434
443void open_this_proj (gpointer data, gpointer user_data)
444{
445 FILE * fp = fopen (data, dfi[0]);
446 int pactive = activep;
447 init_project (FALSE);
448 reading_project = TRUE;
449 open_save (fp, 0, 0, activew, pactive, data);
450 reading_project = FALSE;
451 fclose (fp);
453}
454
456gboolean run_os;
457
458#ifdef GTK4
468G_MODULE_EXPORT void run_on_open_save_active (GtkNativeDialog * info, gint response_id, gpointer data)
469{
470 GListModel * projlist;
471 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
472#else
482G_MODULE_EXPORT void run_on_open_save_active (GtkDialog * info, gint response_id, gpointer data)
483{
484 GSList * projlist = NULL;
485 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
486#endif
487 FILE * fp = NULL;
488 gchar * err;
489 gboolean io = FALSE;
490 const gchar * mess[2]={i18n("reading"),i18n("saving")};
491 if (response_id == GTK_RESPONSE_ACCEPT)
492 {
493 if (osp.a == 0)
494 {
495 projlist = file_chooser_get_file_names (chooser);
496 }
497 else
498 {
500 }
501 if (osp.a > 1)
502 {
503 workspacefile = g_strdup_printf ("%s", projfile);
504 }
505 io = TRUE;
506 }
507 if (run_os)
508 {
509#ifdef GTK4
511#else
512 destroy_this_dialog (info);
513#endif
514 }
515 if (io)
516 {
517 if (osp.a > 0)
518 {
519 fp = fopen (projfile, dfi[osp.b]);
520 }
521 if (osp.a == 0)
522 {
523#ifdef GTK3
524 g_slist_foreach (projlist, open_this_proj, NULL);
525 g_slist_free (projlist);
526#else
527 int i;
528 for (i=0; i<g_list_model_get_n_items (projlist); i++)
529 {
530 GObject * obj = g_list_model_get_item (projlist, i);
531 open_this_proj (g_file_get_parse_name((GFile *)obj), NULL);
532 }
533 g_object_unref (projlist);
534#endif
535 }
536 else if (osp.a == 1)
537 {
538 open_save (fp, osp.a, 0, activew, osp.c, projfile);
539 }
540 else
541 {
542 int k = open_save_workspace (fp, osp.b);
543 if (k != 0)
544 {
545 err = g_strdup_printf (_("Error %s workspace file\n%s\n"), _(mess[osp.b]), projfile);
547 g_free (err);
548 }
549 }
550 if (osp.a > 0)
551 {
552 fclose (fp);
553 g_free (projfile);
554 }
555 }
556}
557
566G_MODULE_EXPORT void on_open_save_activate (GtkWidget * widg, gpointer data)
567{
568 int i, j, k;
569 gint action;
570#ifdef GTK4
571 GtkFileChooserNative * info;
572#else
573 GtkWidget * info;
574#endif
575 GtkFileChooser * chooser;
576 GtkFileFilter * filter1, * filter2;
577 const gchar * str[4]={i18n("Open Project File(s)"), i18n("Save Project File"), i18n("Open Workspace"), i18n("Save Workspace")};
578 const gchar * res[2]={i18n("Open"), i18n("Save")};
579 const gchar * file_name[2]={i18n("Project file (*.apf)"), i18n("Workspace file (*.awf)")};
580 const gchar * file_ext[2]={"*.apf", "*.awf"};
581 GtkFileChooserAction act[2]={GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_SAVE};
582 project * this_proj = get_project_by_id (activew);
583 int pactive = activep;
584 i = GPOINTER_TO_INT (data);
585 run_os = FALSE;
586 if (i == 1 || i == 3)
587 {
588 j = 1;
589 }
590 else
591 {
592 j = 0;
593 }
594 action = 0;
595 if (i == 2 && ! newspace)
596 {
597 show_info (_("A workspace is already open !"), 0, atomes_main_window);
598 }
599 else if (i == 3 && newspace)
600 {
601 show_warning (_("Empty workspace ... nothing to be saved\n"), atomes_main_window);
602 }
603 else if (i == 3)
604 {
605 for (k=0; k<nprojects; k++) if (get_project_by_id(k) -> natomes) action = 1;
606 if (! action)
607 {
608 show_warning (_("Workspace contains only empty projects ... nothing to be saved\n"), atomes_main_window);
609 }
610 }
611 else if (i == 1 && nprojects == 0)
612 {
613 show_warning (_("No project open ... nothing to be saved\n"), atomes_main_window);
614 }
615 else if (i == 1 && ! this_proj -> natomes)
616 {
617 show_warning (_("Empty project ... nothing to be saved\n"), atomes_main_window);
618 }
619 else
620 {
621 action = 1;
622 }
623
624 if (action)
625 {
626 if (nprojects == 0)
627 {
628 run_os = TRUE;
629 }
630 else
631 {
632 if (i == 1)
633 {
634 if (g_strcmp0(this_proj -> projfile, "(null)") == 0) this_proj -> projfile = NULL;
635 if (save && this_proj -> projfile != NULL)
636 {
637 run_os = FALSE;
638 projfile = g_strdup_printf ("%s", this_proj -> projfile);
639 }
640 else
641 {
642 run_os = TRUE;
643 projfile = NULL;
644 }
645 }
646 else if (i == 3)
647 {
648 if (g_strcmp0(workspacefile, "(null)") == 0) workspacefile = NULL;
649 if (save && workspacefile != NULL)
650 {
651 run_os = FALSE;
652 projfile = g_strdup_printf ("%s", workspacefile);
653 }
654 else
655 {
656 run_os = TRUE;
657 }
658 }
659 else
660 {
661 run_os = TRUE;
662 }
663 }
664
665 gchar * tmp_str;
666 if (i == 0)
667 {
668 tmp_str = g_strdup_printf (_("%s - New project"), _(str[i]));
669 }
670 else if (i == 1)
671 {
672 tmp_str = g_strdup_printf ("%s - %s", _(str[i]), prepare_for_title(this_proj -> name));
673 }
674 else
675 {
676 tmp_str = g_strdup_printf ("%s", _(str[i]));
677 }
678 info = create_file_chooser (tmp_str,
679 GTK_WINDOW(atomes_main_window),
680 act[j],
681 _(res[j]));
682 chooser = GTK_FILE_CHOOSER (info);
683 g_free (tmp_str);
684#ifdef GTK3
685 gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
686#endif
687 if (i == 1 || i == 3) gtk_file_chooser_set_create_folders (chooser, TRUE);
688 if (nprojects == 0 || i == 0)
689 {
691 if (i == 0)
692 {
693 gtk_file_chooser_set_select_multiple (chooser, TRUE);
694 }
695 }
696 else
697 {
698 if (i == 1)
699 {
700 if (projfile != NULL)
701 {
703 gtk_file_chooser_set_current_name (chooser, projfile);
704 }
705 else
706 {
707 if (! file_chooser_set_file_name (chooser, g_strdup_printf ("%s.apf", prepare_for_title(this_proj -> name)))) goto end;
708 }
709 }
710 else if (i == 3)
711 {
712 if (workspacefile != NULL)
713 {
715 gtk_file_chooser_set_current_name (chooser, g_strdup_printf ("%s", workspacefile));
716 }
717 else
718 {
719 if (! file_chooser_set_file_name (chooser, "New-Workspace.awf")) goto end;
720 }
721 }
722 }
723 filter1 = gtk_file_filter_new();
724 gtk_file_filter_set_name (GTK_FILE_FILTER(filter1), _(file_name[i/2]));
725 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter1), file_ext[i/2]);
726 gtk_file_chooser_add_filter (chooser, filter1);
727 filter2 = gtk_file_filter_new();
728 gtk_file_filter_set_name (GTK_FILE_FILTER(filter2), _("All files (*)"));
729 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter2), "*");
730 gtk_file_chooser_add_filter (chooser, filter2);
731 osp.a = i;
732 osp.b = j;
733 osp.c = pactive;
734 if (run_os)
735 {
736#ifdef GTK4
737 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_on_open_save_active), this_proj);
738#else
739 run_this_gtk_dialog (info, G_CALLBACK(run_on_open_save_active), this_proj);
740#endif
741 }
742 else
743 {
744#ifdef GTK4
745 run_on_open_save_active ((GtkNativeDialog *)info, GTK_RESPONSE_ACCEPT, this_proj);
746#else
747 run_on_open_save_active ((GtkDialog *)info, GTK_RESPONSE_ACCEPT, this_proj);
748#endif
749 }
750 }
753 end:;
754}
755
764G_MODULE_EXPORT void on_save_as_activate (GtkWidget * widg, gpointer data)
765{
766 save = FALSE;
767 on_open_save_activate (widg, data);
768 save = TRUE;
769}
770
777{
778 if (! active_project -> run)
779 {
780 if (! active_project -> analysis)
781 {
783 }
784 int i, j;
785 j = (active_cell -> npt) ? active_project -> steps : 1;
786 for (i=0; i<j; i++)
787 {
788 lattice_ (& j, & i,
789 active_cell -> box[i].vect,
790 active_cell -> box[i].param[0],
791 active_cell -> box[i].param[1],
792 & active_cell -> ltype,
793 & active_cell -> frac,
794 & active_cell -> pbc);
795 }
796 to_read_pos ();
797 prep_pos_ (& active_cell -> pbc, & active_cell -> frac);
798 active_project -> dmtx = FALSE;
799 active_project -> run = 1;
800 }
801 if (active_cell -> frac) active_cell -> frac = 0;
802}
803
811void apply_project (gboolean showtools)
812{
813 if (active_project -> natomes)
814 {
815 run_project ();
817 }
820}
821
831void open_this_isaacs_xml_file (gchar * profile, int ptoc, gboolean visible)
832{
833 if (! open_xml (profile))
834 {
835 active_project -> name = substitute_string (g_path_get_basename (profile), ".ipf", NULL);
836 on_edit_activate (NULL, GINT_TO_POINTER(3));
837 on_edit_activate (NULL, GINT_TO_POINTER(5));
839 frag_update = (active_project -> natomes > ATOM_LIMIT) ? 0 : 1;
840 mol_update = (frag_update) ? ((active_project -> steps > STEP_LIMIT) ? 0 : 1) : 0;
841 apply_project (TRUE);
844 }
845 else
846 {
848 }
849}
850
851#ifdef GTK4
861G_MODULE_EXPORT void run_on_isaacs_port (GtkNativeDialog * info, gint response_id, gpointer data)
862{
863 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
864#else
874G_MODULE_EXPORT void run_on_isaacs_port (GtkDialog * info, gint response_id, gpointer data)
875{
876 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
877#endif
878 if (response_id == GTK_RESPONSE_ACCEPT)
879 {
880 if (osp.a == 0 || nprojects == 0) init_project (TRUE);
882#ifdef GTK4
884#else
885 destroy_this_dialog (info);
886#endif
887 if (osp.a == 0)
888 {
890 }
891 else if (osp.a == 1)
892 {
894 if (write_xml (projfile) == 0)
895 {
896 show_error (_("Impossible to write the IPF file\n"), 0, atomes_main_window);
897 }
899 }
900 g_free (projfile);
901 }
902 else
903 {
904#ifdef GTK4
906#else
907 destroy_this_dialog (info);
908#endif
909 }
910}
911
920G_MODULE_EXPORT void on_isaacs_port (GtkWidget * widg, gpointer data)
921{
922 int i, j;
923 gboolean action;
924#ifdef GTK4
925 GtkFileChooserNative * info;
926#else
927 GtkWidget * info;
928#endif
929 GtkFileChooser * chooser;
930 GtkFileFilter * filter[2];
931 const gchar * file_ext[2]={"*.ipf", "*"};
932 const gchar * file_type[2]={i18n("IPF file (*.ipf)"), i18n("All files (*)")};
933 const gchar * str[2]={i18n("Import ISAACS Project File"), i18n("Export ISAACS Project File")};
934 const gchar * res[2]={i18n("Open"), i18n("Save")};
935 GtkFileChooserAction act[2]={GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_SAVE};
936 int pactive = activep;
937 i = GPOINTER_TO_INT (data);
938
939 action = (i && ! nprojects) ? ask_yes_no (_("Save an empty project ?"), _("Do you want to save an empty project ?"), GTK_MESSAGE_QUESTION, atomes_main_window) : TRUE;
940 if (action)
941 {
942 info = create_file_chooser (_(str[i]),
943 GTK_WINDOW(atomes_main_window),
944 act[i],
945 _(res[i]));
946 chooser = GTK_FILE_CHOOSER (info);
947#ifdef GTK3
948 gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
949#endif
950 if (i) gtk_file_chooser_set_create_folders (chooser, TRUE);
951 for (j=0; j<2; j++)
952 {
953 filter[j] = gtk_file_filter_new();
954 gtk_file_filter_set_name (GTK_FILE_FILTER(filter[j]), _(file_type[j]));
955 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter[j]), file_ext[j]);
956 gtk_file_chooser_add_filter (chooser, filter[j]);
957 }
959 osp.a = i;
960 osp.b = pactive;
961#ifdef GTK4
962 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_on_isaacs_port), NULL);
963#else
964 run_this_gtk_dialog (info, G_CALLBACK(run_on_isaacs_port), NULL);
965#endif
966 }
969}
970
977{
978 int i, j, k;
979 double * x, * y, * z;
980 double lat[3];
981
982 x = allocdouble (active_project -> steps*active_project -> natomes);
983 y = allocdouble (active_project -> steps*active_project -> natomes);
984 z = allocdouble (active_project -> steps*active_project -> natomes);
985 k = 0;
986 lat[0] = lat[1] = lat[2] = 0.0;
987 if (active_cell -> crystal)
988 {
989 for (i=0; i<3; i++)
990 {
991 for (j=0; j<3; j++) lat[i] -= active_box -> vect[j][i]/2.0;
992 }
993 }
994 for (i=0; i<active_project -> steps; i++)
995 {
996 for (j=0; j<active_project -> natomes; j++)
997 {
998 x[k] = active_project -> atoms[i][j].x + lat[0];
999 y[k] = active_project -> atoms[i][j].y + lat[1];
1000 z[k] = active_project -> atoms[i][j].z + lat[2];
1001 k ++;
1002 }
1003 }
1004 read_pos_ (x, y, z);
1005 g_free (x);
1006 x = NULL;
1007 g_free (y);
1008 y = NULL;
1009 g_free (z);
1010 z = NULL;
1011}
1012
1013GtkWidget * read_box;
1014GtkWidget * all_sp_box = NULL;
1015GtkWidget * sa_lab[2];
1016GtkWidget * sa_entry[2];
1017GtkWidget * read_this;
1019
1026{
1027 int i, j, k;
1028 i = j = 0;
1029 for (k=0; k<this_reader -> nspec; k++)
1030 {
1031 i += this_reader -> nsps[k];
1032 j += (this_reader -> label[k]) ? 1: 0;
1033 }
1034 if (i == this_reader -> natomes && j == this_reader -> nspec)
1035 {
1037 }
1038 else
1039 {
1041 }
1042}
1043
1051void update_sa_info (int sid)
1052{
1053 gchar * str = g_strdup_printf (_("Label of atomic spec. N° %d:"), sid+1);
1054 gtk_label_set_text (GTK_LABEL(sa_lab[0]), str);
1055 g_free (str);
1056 if (this_reader -> label[sid])
1057 {
1058 update_entry_text (GTK_ENTRY(sa_entry[0]), this_reader -> label[sid]);
1059 str = g_strdup_printf (_("Number of %s atom(s):"), this_reader -> label[sid]);
1060 }
1061 else
1062 {
1063 update_entry_text (GTK_ENTRY(sa_entry[0]), "");
1064 str = g_strdup_printf (_("Number of atom(s) for spec. N° %d:"), sid+1);
1065 }
1066 gtk_label_set_text (GTK_LABEL(sa_lab[1]), str);
1067 g_free (str);
1068 if (this_reader -> nsps[sid])
1069 {
1070 update_entry_int (GTK_ENTRY(sa_entry[1]), this_reader -> nsps[sid]);
1071 }
1072 else
1073 {
1074 update_entry_text (GTK_ENTRY(sa_entry[1]), "");
1075 }
1076 read_spec = sid;
1077}
1078
1087G_MODULE_EXPORT void update_sa (GtkEntry * res, gpointer data)
1088{
1089 int i, v;
1090 i = GPOINTER_TO_INT(data);
1091 const gchar * m = entry_get_text (res);
1092 if (i == 0)
1093 {
1094 if (this_reader -> label[read_spec]) g_free (this_reader -> label[read_spec]);
1095 this_reader -> label[read_spec] = NULL;
1096 this_reader -> label[read_spec] = g_strdup_printf ("%s", m);
1098 }
1099 else
1100 {
1101 v= (int)string_to_double ((gpointer)m);
1102 if (v > 0)
1103 {
1104 this_reader -> nsps[read_spec] = v;
1105 }
1107 }
1108 check_read_sa ();
1109}
1110
1119G_MODULE_EXPORT void changed_spec_combo (GtkComboBox * box, gpointer data)
1120{
1121 update_sa_info (combo_get_active ((GtkWidget *)box));
1122}
1123
1130{
1131 int i;
1132 if (all_sp_box)
1133 {
1134 for (i=0; i<2; i++)
1135 {
1138 }
1140 }
1143 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, read_box, all_sp_box, FALSE, FALSE, 20);
1144 GtkWidget * hbox;
1145 add_box_child_start (GTK_ORIENTATION_VERTICAL, all_sp_box, markup_label(_("Chemical species info:"), 200, -1, 0.5, 0.5), FALSE, FALSE, 0);
1146 hbox = create_hbox(0);
1147 add_box_child_start (GTK_ORIENTATION_VERTICAL, all_sp_box, hbox, FALSE, FALSE, 5);
1148 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(_("Species: "), 100, -1, 0.0, 0.5), FALSE, FALSE, 5);
1149 GtkWidget * combo;
1150 combo = create_combo ();
1151 gchar * str;
1152
1153 for (i=0; i<this_reader -> nspec; i++)
1154 {
1155 str = g_strdup_printf ("N°%d", i+1);
1156 gtk_combo_box_text_append_text ((GtkComboBoxText *)combo, str);
1157 g_free (str);
1158 }
1159 combo_set_active (combo, 0);
1160 g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK(changed_spec_combo), NULL);
1161 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, combo, FALSE, FALSE, 5);
1162 for (i=0; i<2; i++)
1163 {
1164 hbox = create_hbox(0);
1165 add_box_child_start (GTK_ORIENTATION_VERTICAL, all_sp_box, hbox, FALSE, FALSE, 5);
1166 sa_lab[i] = markup_label("", 250, -1, 0.0, 0.5);
1167 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sa_lab[i], FALSE, FALSE, 5);
1168 sa_entry[i] = create_entry (G_CALLBACK(update_sa), 100, 15, FALSE, GINT_TO_POINTER(i));
1169 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, sa_entry[i], FALSE, FALSE, 0);
1170 }
1172 update_sa_info (0);
1173}
1174
1183G_MODULE_EXPORT void update_at_sp (GtkEntry * res, gpointer data)
1184{
1185 int i, v;
1186 i = GPOINTER_TO_INT(data);
1187 const gchar * m = entry_get_text (res);
1188 gboolean up = FALSE;
1189 v = (int)string_to_double ((gpointer)m);
1190 if (i == 0)
1191 {
1192 this_reader -> natomes = (v > 0) ? v : 0;
1193 update_entry_int (res, this_reader -> natomes);
1194 }
1195 else
1196 {
1197 if (v != this_reader -> nspec)
1198 {
1199 this_reader -> nspec = (v > 0) ? v : 0;
1200 if (this_reader -> nspec)
1201 {
1202 if (this_reader -> nsps) g_free (this_reader -> nsps);
1203 this_reader -> nsps = allocint (v);
1204 if (this_reader -> z) g_free (this_reader -> z);
1205 this_reader -> z = allocdouble (v);
1206 if (this_reader -> label) g_free (this_reader -> label);
1207 this_reader -> label = g_malloc0(v*sizeof*this_reader -> label);
1208 }
1209 up = TRUE;
1210 }
1211 update_entry_int (res, this_reader -> nspec);
1212 }
1213 if (up) prepare_sp_box();
1214}
1215
1217
1224{
1225 int i;
1226 double z;
1227 for (i=0; i<this_reader -> nspec; i++)
1228 {
1229 z = get_z_from_periodic_table (this_reader -> label[i]);
1230 if (! z) return 0;
1231 this_reader -> z[i] = z;
1232 }
1233 return 1;
1234}
1235
1245G_MODULE_EXPORT void run_to_read_trj_or_vas (GtkDialog * dialog, gint response_id, gpointer data)
1246{
1247 int id = GPOINTER_TO_INT(data);
1248 switch (response_id)
1249 {
1250 case GTK_RESPONSE_APPLY:
1251 if (prep_chem_data())
1252 {
1253 reading_vas_trj = open_coord_file (active_project -> coordfile, id);
1254 }
1255 else
1256 {
1257 reading_vas_trj = 3;
1258 }
1259 break;
1260 default:
1261 reading_vas_trj = 3;
1262 break;
1263 }
1264 if (all_sp_box)
1265 {
1266 int i;
1267 for (i=0; i<2; i++)
1268 {
1271 }
1273 }
1274 destroy_this_dialog (dialog);
1275}
1276
1285{
1286 int i;
1287 gchar * rlabel[2]={i18n("Total number of atom(s):"), i18n("Number of chemical species:")};
1288 GtkWidget * dialog = dialogmodal (_("Reading CPMD / VASP trajectory"), GTK_WINDOW(atomes_main_window));
1289 read_this = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Apply"), GTK_RESPONSE_APPLY);
1290 GtkWidget * vbox = dialog_get_content_area (dialog);
1292 GtkWidget * rentry;
1293 GtkWidget * hbox;
1294 for (i=0; i<2; i++)
1295 {
1296 hbox = create_hbox(0);
1297 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 5);
1298 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(_(rlabel[i]), 200, -1, 0.0, 0.5), FALSE, FALSE, 5);
1299 rentry = create_entry (G_CALLBACK(update_at_sp), 100, 15, FALSE, GINT_TO_POINTER(i));
1300 update_entry_text (GTK_ENTRY(rentry), "");
1301 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, rentry, FALSE, FALSE, 5);
1302 }
1303 read_box = create_hbox(0);
1304 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, read_box, FALSE, FALSE, 5);
1305 run_this_gtk_dialog (dialog, G_CALLBACK(run_to_read_trj_or_vas), GINT_TO_POINTER(ff));
1306 return reading_vas_trj;
1307}
1308
1321void cell_data_from_pdb_ (float * a, float * b, float * c, float * alp, float * bet, float * gam)
1322{
1323 active_box -> param[0][0] = * a;
1324 active_box -> param[0][1] = * b;
1325 active_box -> param[0][2] = * c;
1326 active_box -> param[1][0] = * alp;
1327 active_box -> param[1][1] = * bet;
1328 active_box -> param[1][2] = * gam;
1329 // In a PDB file it is required to turn off PBC
1330 // The box usually barely encompass the molecule
1331 active_cell -> pbc = 0;
1332 active_cell -> ltype = 1;
1333}
1334
1336gchar * npt_file;
1337
1338#ifdef GTK4
1348G_MODULE_EXPORT void run_read_npt_data (GtkNativeDialog * info, gint response_id, gpointer data)
1349{
1350 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
1351#else
1361G_MODULE_EXPORT void run_read_npt_data (GtkDialog * info, gint response_id, gpointer data)
1362{
1363 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
1364#endif
1365 if (response_id == GTK_RESPONSE_ACCEPT)
1366 {
1368 npt_selection = iask (_("Please select the file format of the NPT cell data"), _("Select format:"), 6, atomes_main_window);
1369 }
1370 else
1371 {
1372 npt_selection = -1;
1373 }
1374#ifdef GTK4
1376#else
1377 destroy_this_dialog (info);
1378#endif
1379}
1380
1387{
1388 GtkFileFilter * filter[2];
1389#ifdef GTK4
1390 GtkFileChooserNative * info;
1391#else
1392 GtkWidget * info;
1393#endif
1394 info = create_file_chooser (_("Read cell data for NPT molecular dynamics"),
1395 GTK_WINDOW(atomes_main_window),
1396 GTK_FILE_CHOOSER_ACTION_OPEN,
1397 _("Open"));
1398 GtkFileChooser * chooser = GTK_FILE_CHOOSER(info);
1399 filter[0] = gtk_file_filter_new();
1400 gtk_file_filter_set_name (GTK_FILE_FILTER(filter[0]), _("DAT files (*.dat)"));
1401 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter[0]), "*.dat");
1402 gtk_file_chooser_add_filter (chooser, filter[0]);
1403 filter[1] = gtk_file_filter_new();
1404 gtk_file_filter_set_name (GTK_FILE_FILTER(filter[1]), _("All files (*)"));
1405 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter[1]), "*");
1406 gtk_file_chooser_add_filter (chooser, filter[1]);
1407 npt_file = NULL;
1408#ifdef GTK4
1409 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_read_npt_data), NULL);
1410#else
1411 run_this_gtk_dialog (info, G_CALLBACK(run_read_npt_data), NULL);
1412#endif
1413 return (npt_selection < 0) ? 0 : open_cell_file (npt_selection, npt_file);
1414}
1415
1424{
1425 struct timespec sta_time;
1426 struct timespec sto_time;
1427 int result;
1428 clock_gettime (CLOCK_MONOTONIC, & sta_time);
1429 this_reader = g_malloc0(sizeof*this_reader);
1430 // Set default message type to warning
1431 this_reader -> mid = 1;
1432 if (id == 7 || id == 8)
1433 {
1434 int length = strlen (active_project -> coordfile);
1435 result = read_pdb_ (active_project -> coordfile, & length);
1436 }
1437 else if (id < 3 || id > 8)
1438 {
1439 result = open_coord_file (active_project -> coordfile, id);
1440 }
1441 else
1442 {
1443 result = to_read_trj_or_vas (id);
1444 }
1445
1446 if (! result && (id == 1 || id == 4 || id == 6))
1447 {
1448 result = read_npt_data ();
1449 }
1450 clock_gettime (CLOCK_MONOTONIC, & sto_time);
1451 g_print ("Time to read atomic coordinates: %s\n", calculation_time(FALSE, get_calc_time (sta_time, sto_time)));
1452 if (this_reader)
1453 {
1455 {
1456 gchar * info = g_strdup_printf ("%s", this_reader -> info[0]);
1457 int i;
1458 for (i=1; i<this_reader -> msg; i++)
1459 {
1460 info = g_strdup_printf ("%s\n%s", info, this_reader -> info[i]);
1461 }
1462 switch (this_reader -> mid)
1463 {
1464 case 0:
1465 show_error (info, 0, atomes_main_window);
1466 break;
1467 case 1:
1469 break;
1470 }
1471 g_free (info);
1472 }
1473 if (this_reader)
1474 {
1475 if (this_reader -> info) g_free (this_reader -> info);
1476 if (this_reader -> z) g_free (this_reader -> z);
1477 if (this_reader -> nsps) g_free (this_reader -> nsps);
1478 if (this_reader -> dummy) g_free (this_reader -> dummy);
1479 if (this_reader -> label) g_free (this_reader -> label);
1480 if (this_reader -> object_list) g_free (this_reader -> object_list);
1481 if (this_reader -> u_atom_list) g_free (this_reader -> u_atom_list);
1482 if (this_reader -> coord) g_free (this_reader -> coord);
1483 if (this_reader -> lot) g_free (this_reader -> lot);
1484 if (this_reader -> sym_pos) g_free (this_reader -> sym_pos);
1485 if (this_reader -> wyckoff) g_free (this_reader -> wyckoff);
1486 if (this_reader -> occupancy) g_free (this_reader -> occupancy);
1487 if (this_reader -> disorder) g_free (this_reader -> disorder);
1488 if (this_reader -> multi) g_free (this_reader -> multi);
1489 if (this_reader -> lattice.sp_group) g_free (this_reader -> lattice.sp_group);
1490 if (this_reader -> lattice.box) g_free (this_reader -> lattice.box);
1491 g_free (this_reader);
1492 this_reader = NULL;
1493 }
1494 }
1495 switch (result)
1496 {
1497 case 1:
1498 show_error (_("Error loading atomic coordinates:\nfile does not exist"), 0, atomes_main_window);
1499 break;
1500 case 2:
1501 show_error (_("Error loading coordinates file: format not supported"), 0, atomes_main_window);
1502 break;
1503 case 3:
1504 show_error (_("Error at input: impossible to process input file data"), 0, atomes_main_window);
1505 break;
1506 default:
1507 if (id > 6 && id < 9)
1508 {
1509 clock_gettime (CLOCK_MONOTONIC, & sta_time);
1510 if (! prep_data_ ())
1511 {
1512 show_error (_("Error while parsing the chemical information\n"
1513 "please check carefully the coordinates file"), 0, atomes_main_window);
1514 result = 4;
1515 }
1516 clock_gettime (CLOCK_MONOTONIC, & sto_time);
1517 g_print ("Time to prepare data: %s\n", calculation_time(FALSE, get_calc_time (sta_time, sto_time)));
1518 }
1519 break;
1520 }
1521 return result;
1522}
1523
1524GtkFileFilter * filter[NCFORMATS+1];
1526
1536void open_this_coordinate_file (int format, gchar * proj_name, gboolean main_reader)
1537{
1538 // Extra for CIF files
1539 int ncc;
1540 gchar * cif_file_name;
1541 gchar * cif_proj_name;
1542 //
1543 active_project -> newproj = FALSE;
1544 clock_gettime (CLOCK_MONOTONIC, & start_time);
1545 if (open_coordinate_file (format) == 0)
1546 {
1547 clock_gettime (CLOCK_MONOTONIC, & stop_time);
1548 g_print ("Time to open coordinate file: %s\n", calculation_time(FALSE, get_calc_time (start_time, stop_time)));
1549 active_project -> tfile = format;
1550 if (proj_name)
1551 {
1552 active_project -> name = g_strdup_printf ("%s", proj_name);
1553 }
1554 else
1555 {
1556 gchar * str = g_path_get_basename (active_project -> coordfile);
1557 active_project -> name = g_strdup_printf ("%s", substitute_string (str, g_strdup_printf (".%s", coord_files_ext[format]), NULL));
1558 g_free (str);
1559 }
1560 on_edit_activate (NULL, GINT_TO_POINTER(0));
1561 if (format != 1 && format != 4 && format != 6 && format != 9 && format != 10 && format != 11 && format != 12) on_edit_activate (NULL, GINT_TO_POINTER(4));
1563 on_edit_activate (NULL, GINT_TO_POINTER(2));
1565 frag_update = (active_project -> natomes > ATOM_LIMIT) ? 0 : 1;
1566 mol_update = (frag_update) ? ((active_project -> steps > STEP_LIMIT) ? 0 : 1) : 0;
1567 chemistry_ ();
1568 apply_project (TRUE);
1571 {
1573 if (atomes_convert_file != NONE) run_on_coord_port (NULL, GTK_RESPONSE_ACCEPT, GINT_TO_POINTER(1));
1575 }
1576 else
1577 {
1578 if ((format == 9 || format == 10 || format == 11) && active_cell -> has_a_box)
1579 {
1580#ifdef GTK3
1581 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)active_glwin -> ogl_rep[0], TRUE);
1582 set_rep (active_glwin -> ogl_rep[0], & active_glwin -> colorp[0][0]);
1583 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)active_glwin -> ogl_clones[0], TRUE);
1584 widget_set_sensitive (active_glwin -> ogl_clones[0], active_glwin -> allbonds[1]);
1585 show_hide_clones (active_glwin -> ogl_clones[0], active_glwin);
1586#endif
1587 shift_it (vec3 (0.0, 0.0, 0.0), 1, activep);
1588 active_glwin -> wrapped = TRUE;
1589 }
1591 if ((format == 9 || format == 10) && cif_use_symmetry_positions)
1592 {
1593 gchar * file_name = g_strdup_printf ("%s", active_project -> coordfile);
1594 gchar * proj_name = g_strdup_printf (_("%s - symmetry position(s)"), active_project -> name);
1595 init_project (TRUE);
1596 active_project -> coordfile = g_strdup_printf ("%s", file_name);
1597 g_free (file_name);
1598 open_this_coordinate_file (11, proj_name, FALSE);
1599 g_free (proj_name);
1600 }
1601 else if (cif_cnftodo && main_reader)
1602 {
1603 gchar * cif_coordinates[3]={i18n("Standard CIF Cartesian coordinates"),
1604 i18n("mmCIF - x/y/z coordinates for each atom"),
1605 i18n("mmCIF - computed idealized coordinates")};
1606 // For Cartesian coordinates only, if multiple formats are found
1607 cif_file_name = g_strdup_printf ("%s", active_project -> coordfile);
1608 cif_proj_name = g_strdup_printf ("%s", active_project -> name);
1609 active_project -> name = g_strdup_printf ("%s - %s", cif_proj_name, (! cif_cnfkeys[0][0]) ? _(cif_coordinates[0]) : _(cif_coordinates[cif_cnfkeys[0][1]]));
1610 correct_this_window_title (active_glwin -> win, g_strdup_printf (_("%s - 3D view - [%s mode]"), active_project -> name, _(mode_name[active_glwin -> mode])));
1611 for (ncc=1; ncc < cif_cnfcart; ncc ++)
1612 {
1613 init_project (TRUE);
1614 active_project -> coordfile = g_strdup_printf ("%s", cif_file_name);
1615 active_project -> name = g_strdup_printf ("%s - %s", cif_proj_name, (! cif_cnfkeys[ncc][0]) ? _(cif_coordinates[0]) : _(cif_coordinates[cif_cnfkeys[ncc][1]]));
1616 open_this_coordinate_file (format, active_project -> name, FALSE);
1617 }
1618 g_free (cif_file_name);
1619 g_free (cif_proj_name);
1620 cif_cnfcart = 0;
1621 g_free (cif_cnfkeys);
1622 cif_cnfkeys = NULL;
1623 g_free (cif_cnftodo);
1624 cif_cnftodo = NULL;
1625 cif_cnfdone = 0;
1626 }
1627 }
1628 }
1629 else
1630 {
1632 }
1633}
1634
1635#ifdef GTK4
1645G_MODULE_EXPORT void run_on_coord_port (GtkNativeDialog * info, gint response_id, gpointer data)
1646{
1647 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
1648#else
1658G_MODULE_EXPORT void run_on_coord_port (GtkDialog * info, gint response_id, gpointer data)
1659{
1660 GtkFileChooser * chooser;
1661 if (info)
1662 {
1663 chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
1664 }
1665 else
1666 {
1667 // Convert
1668 }
1669#endif
1670 int i, j, k, l, m;
1671 GtkFileFilter * tmp;
1672 int format;
1673 int length;
1674 int car_to_au;
1675 i = GPOINTER_TO_INT(data);
1676 gchar * tmp_str;
1677 switch (response_id)
1678 {
1679 case GTK_RESPONSE_ACCEPT:
1680 if (info)
1681 {
1682 tmp = gtk_file_chooser_get_filter (chooser);
1683 active_project -> coordfile = file_chooser_get_file_name (chooser);
1684#ifdef GTK4
1686#else
1687 destroy_this_dialog (info);
1688#endif
1689 j = 0;
1690 while (tmp != filter[j]) j++;
1691 }
1692 else
1693 {
1695 active_project -> coordfile = g_strdup_printf ("%s-conv.%s", active_project -> coordfile, out_ext[j]);
1696 }
1697 if (i == 0)
1698 {
1699#ifdef OSX
1700 j = NCFORMATS;
1701#endif
1702 if (j == NCFORMATS)
1703 {
1704 j = iask (_("Please select the file format of the atomic coordinates"), _("Select format:"), 2, atomes_main_window);
1705 }
1706 open_this_coordinate_file (j, NULL, TRUE);
1707 }
1708 else
1709 {
1710 if (j < 2 && atomes_convert_file == NONE)
1711 {
1712 format = iask (_("Please select the format of the atomic coordinates"), _("Select format:"), 1, atomes_main_window);
1713 }
1714 else
1715 {
1716 format = 0;
1717 }
1718 active_cell -> frac = (format < 2) ? 0 : format - 1;
1719 car_to_au = (format == 1) ? 1 : 0;
1720 if (j < 2)
1721 {
1722 m = (active_cell -> npt) ? active_project -> steps : 1;
1723 for (l=0; l<m; l++)
1724 {
1725 lattice_ (& m, & l,
1726 active_cell -> box[l].vect,
1727 active_cell -> box[l].param[0],
1728 active_cell -> box[l].param[1],
1729 & active_cell -> ltype,
1730 & active_cell -> frac,
1731 & active_cell -> pbc);
1732 }
1733 to_read_pos ();
1734 length = strlen (active_project -> coordfile);
1735 for (l=1; l<active_project -> nspec+1; l++)
1736 {
1737 m = strlen(active_chem -> label[l-1]);
1738 send_label_ (& l, & m, active_chem -> label[l-1]);
1739 }
1740 }
1741 switch (j)
1742 {
1743 case 0:
1744 k = write_xyz_ (active_project -> coordfile, & length, & active_cell -> frac, & car_to_au);
1745 break;
1746 case 1:
1747 k = write_c3d_ (active_project -> coordfile, & length, & active_cell -> frac, & car_to_au);
1748 break;
1749 case 2:
1751 break;
1752 }
1753 if (k)
1754 {
1755 tmp_str = g_strdup_printf (_("Impossible to export the atomic coordinates\nError code: %d"), k);
1757 {
1758 show_error (tmp_str, 0, atomes_main_window);
1759 }
1760 else
1761 {
1762 g_print ("%s\n", tmp_str);
1763 }
1764 g_free (tmp_str);
1765 }
1767 }
1768 break;
1769 default:
1770 if (i == 0)
1771 {
1773 }
1774 if (info)
1775 {
1776#ifdef GTK4
1778#else
1779 destroy_this_dialog (info);
1780#endif
1781 }
1782 break;
1783 }
1784}
1785
1794G_MODULE_EXPORT void on_coord_port (GtkWidget * widg, gpointer data)
1795{
1796 int i, j;
1797#ifdef GTK4
1798 GtkFileChooserNative * info;
1799#else
1800 GtkWidget * info;
1801#endif
1802 GtkFileChooser * chooser;
1803 gchar * tmp_str;
1804 int num_files[2]={NCFORMATS, OUT_FORMATS};
1805 const gchar * str[2]= {i18n("Import atomic coordinates"), i18n("Export atomic coordinates")};
1806 const gchar * res[2]= {i18n("Open"), i18n("Save")};
1807 char * out_files[OUT_FORMATS] = {i18n("XYZ file"), i18n("Chem3D file"), i18n("atomes Simple Chemical Library")};
1808 GtkFileChooserAction act[2]={GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_SAVE};
1809 pactive = activep;
1810 i = GPOINTER_TO_INT (data);
1811
1812 if ((nprojects > 0 && get_project_by_id(activew) -> natomes) || i == 0)
1813 {
1814 if (i == 0)
1815 {
1816 init_project (TRUE);
1817 }
1818 else
1819 {
1821 }
1822 tmp_str = g_strdup_printf ("%s - %s", prepare_for_title(active_project -> name), _(str[i]));
1823 info = create_file_chooser (tmp_str,
1824 GTK_WINDOW(atomes_main_window),
1825 act[i],
1826 _(res[i]));
1827 g_free (tmp_str);
1828 chooser = GTK_FILE_CHOOSER(info);
1829 if (i) gtk_file_chooser_set_create_folders (chooser, TRUE);
1830#ifdef GTK3
1831 gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
1832#endif
1833 for (j=0; j<num_files[i]; j++)
1834 {
1835 filter[j] = gtk_file_filter_new();
1836 if (i == 0)
1837 {
1838 tmp_str = g_strdup_printf ("%s (*.%s)", _(coord_files[j]), coord_files_ext[j]);
1839 }
1840 else
1841 {
1842 tmp_str = g_strdup_printf ("%s (*.%s)", _(out_files[j]), out_ext[j]);
1843 }
1844 gtk_file_filter_set_name (GTK_FILE_FILTER(filter[j]), tmp_str);
1845 g_free (tmp_str);
1846 if (i == 0)
1847 {
1848 tmp_str = g_strdup_printf ("*.%s", coord_files_ext[j]);
1849 }
1850 else
1851 {
1852 tmp_str = g_strdup_printf ("*.%s", out_ext[j]);
1853 }
1854 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter[j]), tmp_str);
1855 gtk_file_chooser_add_filter (chooser, filter[j]);
1856 g_free (tmp_str);
1857 }
1858 if (i==0)
1859 {
1860 filter[j] = gtk_file_filter_new();
1861 gtk_file_filter_set_name (GTK_FILE_FILTER(filter[j]), _("All files (*)"));
1862 gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter[j]), "*");
1863 gtk_file_chooser_add_filter (chooser, filter[j]);
1864 }
1865 else
1866 {
1868 gtk_file_chooser_set_current_name (chooser, "coord.xyz");
1869 }
1870#ifdef GTK4
1871 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_on_coord_port), GINT_TO_POINTER(i));
1872#else
1873 run_this_gtk_dialog (info, G_CALLBACK(run_on_coord_port), GINT_TO_POINTER(i));
1874#endif
1875 }
1876 else
1877 {
1878 if (nprojects == 0)
1879 {
1880 show_warning (_("No project loaded ... nothing to be saved\n"), atomes_main_window);
1881 }
1882 else
1883 {
1884 tmp_str = g_strdup_printf (_("Project <b>%s</b> is empty ... nothing to be saved\n"),
1885 get_project_by_id(activew) -> name);
1887 g_free (tmp_str);
1888 }
1889 }
1890 activew = activep;
1892}
Function declarations for the mode edition window.
Binding to the Fortran90 subroutines.
void send_label_(int *, int *, char *)
void read_pos_(double *, double *, double *)
void prep_pos_(int *, int *)
void profree_()
int prep_data_()
int write_xyz_(char *, int *, int *, int *)
void lattice_(int *, int *, double[3][3], double[3], double[3], int *, int *, int *)
int chemistry_()
int write_c3d_(char *, int *, int *, int *)
int read_pdb_(char *, int *)
int open_coordinate_file(int id)
try to open coordinate file, type is based of id
Definition callbacks.c:1423
GtkWidget * read_box
Definition callbacks.c:1013
int open_coord_file(gchar *filename, int fti)
open atomic coordinates file
Definition read_coord.c:275
int signal_error(const char *file, const char *func, int error_line, int error_id)
Definition callbacks.c:193
int to_read_trj_or_vas(int ff)
reading CPMD/VASP trajectory - prepare the dialog
Definition callbacks.c:1284
void quit_gtk()
Leave the application.
Definition callbacks.c:347
G_MODULE_EXPORT void on_edit_activate(GtkWidget *widg, gpointer data)
create an edition dialog - prepare the dialog
Definition edit_menu.c:865
G_MODULE_EXPORT void run_read_npt_data(GtkDialog *info, gint response_id, gpointer data)
read NPT data associated with atomic coordinates: run the dialog GTK3 callback
Definition callbacks.c:1361
G_MODULE_EXPORT void changed_spec_combo(GtkComboBox *box, gpointer data)
reading CPMD/VASP trajectory, change the active species
Definition callbacks.c:1119
int read_npt_data()
read NPT data associated with atomic coordinates: setup the dialog
Definition callbacks.c:1386
int open_save_workspace(FILE *fp, int act)
open or save the active workspace
Definition callbacks.c:378
gchar * substitute_string(gchar *init, gchar *o_motif, gchar *n_motif)
substitute all patterns in string
Definition w_library.c:378
#define OUT_FORMATS
Definition callbacks.c:107
G_MODULE_EXPORT void run_on_open_save_active(GtkDialog *info, gint response_id, gpointer data)
open or save an atomes file - running the dialog
Definition callbacks.c:482
double get_z_from_periodic_table(gchar *lab)
get Z from atom label
Definition w_library.c:308
G_MODULE_EXPORT void on_close_workspace(GtkWidget *widg, gpointer data)
close the active workspace
Definition callbacks.c:137
tint osp
Definition callbacks.c:455
GtkWidget * all_sp_box
Definition callbacks.c:1014
atomes_error_signal errors_messages[]
Definition callbacks.c:167
G_MODULE_EXPORT void on_open_save_activate(GtkWidget *widg, gpointer data)
open or save an atomes file - prepare the dialog
Definition callbacks.c:566
G_MODULE_EXPORT void run_on_coord_port(GtkDialog *info, gint response_id, gpointer data)
export or import atomic coordinates: run dialog
Definition callbacks.c:1658
G_MODULE_EXPORT void run_on_isaacs_port(GtkDialog *info, gint response_id, gpointer data)
open or write ISAACS XML file - running the dialog
Definition callbacks.c:874
void simple_image_render()
simple direct rendering from command line
Definition image.c:241
char ** las
Definition callbacks.c:110
void apply_project(gboolean showtools)
get project ready for calculation and initialize the OpenGL window
Definition callbacks.c:811
int prep_chem_data()
prepare chemical data to read CPMD/VASP file
Definition callbacks.c:1223
G_MODULE_EXPORT void on_isaacs_port(GtkWidget *widg, gpointer data)
open or write ISAACS XML file - prepare the dialog
Definition callbacks.c:920
int open_history_file(gchar *filename)
void run_project()
send project data to Fortran90
Definition callbacks.c:776
void open_this_coordinate_file(int format, gchar *proj_name, gboolean main_reader)
open coordinate file format, if successful add to workspace
Definition callbacks.c:1536
int pactive
Definition callbacks.c:1525
GtkWidget * sa_entry[2]
Definition callbacks.c:1016
G_MODULE_EXPORT void run_to_read_trj_or_vas(GtkDialog *dialog, gint response_id, gpointer data)
reading CPMD/VASP trajectory: run the dialog
Definition callbacks.c:1245
void cell_data_from_pdb_(float *a, float *b, float *c, float *alp, float *bet, float *gam)
update cell parameters from the data in the PDB file
Definition callbacks.c:1321
int open_save(FILE *fp, int act, int wid, int pid, int aid, gchar *pfile)
open or save project file
Definition callbacks.c:257
GtkFileFilter * filter[NCFORMATS+1]
Definition callbacks.c:1524
atomes_error * project_error
Definition callbacks.c:166
int open_cif_file(gchar *filename)
G_MODULE_EXPORT void update_sa(GtkEntry *res, gpointer data)
reading CPMD/VASP trajectory, set the number of chemical species
Definition callbacks.c:1087
char * out_ext[OUT_FORMATS]
Definition callbacks.c:108
G_MODULE_EXPORT void on_coord_port(GtkWidget *widg, gpointer data)
export or import atomic coordinates: prepare dialog
Definition callbacks.c:1794
G_MODULE_EXPORT void on_save_as_activate(GtkWidget *widg, gpointer data)
open or save, choosing a file name
Definition callbacks.c:764
GtkWidget * read_this
Definition callbacks.c:1017
int reading_vas_trj
Definition callbacks.c:1216
void update_sa_info(int sid)
reading CPMD/VASP trajectory, update chemical species info
Definition callbacks.c:1051
int read_spec
Definition callbacks.c:1018
void prepare_sp_box()
eading CPMD/VASP trajectory, prepare the species combo box
Definition callbacks.c:1129
const gchar * dfi[2]
Definition main.c:105
int npt_selection
Definition callbacks.c:1335
gboolean save
Definition callbacks.c:164
G_MODULE_EXPORT void update_at_sp(GtkEntry *res, gpointer data)
reading CPMD/VASP trajectory, changing number of atomes or species
Definition callbacks.c:1183
void open_this_isaacs_xml_file(gchar *profile, int ptoc, gboolean visible)
open an ISAACS XML file
Definition callbacks.c:831
void update_error_trace(const char *file, const char *func, int trace_line)
Definition callbacks.c:211
void open_this_proj(gpointer data, gpointer user_data)
Open many projects, one at a time.
Definition callbacks.c:443
void to_read_pos()
send atomic coordinates to Fortran90
Definition callbacks.c:976
int open_cell_file(int format, gchar *filename)
open the file that contains the cell parameters
Definition read_npt.c:231
GtkWidget * sa_lab[2]
Definition callbacks.c:1015
gchar * npt_file
Definition callbacks.c:1336
gboolean run_os
Definition callbacks.c:456
void check_read_sa()
reading CPMD/VASP trajectory, testing parameters to active the read capabilty
Definition callbacks.c:1025
int write_sml(project *this_proj)
write SML file
Definition read_sml.c:241
Callback declarations for main window.
int occupancy(double occ, int cif_occ)
handle occupancy integer rouding
void shift_it(vec3_t shift, int refresh, int proj)
shift atomic coordinates
Definition cell_shift.c:206
Function declarations for the cell edition window.
void update_insert_combos()
update some GtkComboBox in the workspace if a project is removed
Definition close_p.c:65
void to_close_this_project(int to_activate, project *this_proj)
to close this project
Definition close_p.c:479
G_MODULE_EXPORT void on_close_activate(GtkWidget *widg, gpointer cdata)
signal to close a project
Definition close_p.c:503
color colorp[64]
gchar * param[2]
dummy_atom * dummy
Definition cpmd_atoms.c:73
int atoms[NUM_STYLES][2]
dint up
int multi
Definition dlp_init.c:121
FILE * fp
int atomes_convert_file
Definition global.c:197
gboolean reading_input
Definition global.c:186
int mol_update
Definition global.c:175
gchar * workspacefile
Definition global.c:159
gboolean newspace
Definition global.c:185
GtkWidget * atomes_main_window
Definition global.c:208
struct timespec start_time
Definition global.c:199
int activep
Definition global.c:162
gboolean silent_input
Definition global.c:192
int activew
Definition global.c:166
int nprojects
Definition global.c:161
int frag_update
Definition global.c:174
double * allocdouble(int val)
allocate a double * pointer
Definition global.c:447
gchar * calculation_time(gboolean modelv, double ctime)
get calculation time, human readable
Definition global.c:644
gchar * projfile
Definition global.c:144
gboolean atomes_render_image
Definition global.c:196
int * allocint(int val)
allocate an int * pointer
Definition global.c:302
gchar * mode_name[2]
Definition global.c:141
double get_calc_time(struct timespec start, struct timespec stop)
get calculation time in s
Definition global.c:631
#define i18n(String)
Definition global.c:80
struct timespec stop_time
Definition global.c:200
gboolean cif_use_symmetry_positions
Definition global.c:193
GtkWidget * curvetoolbox
Definition global.c:212
GtkApplication * atomes_app
Definition global.c:207
double string_to_double(gpointer string)
convert string to double
Definition global.c:612
gboolean atomes_from_libreoffice
Definition global.c:195
Global variable declarations Global convenience function declarations Global data structure defin...
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:533
void file_chooser_set_current_folder(GtkFileChooser *chooser)
set current folder in a GtkFilechooser
Definition gtk-misc.c:2358
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
Definition gtk-misc.c:935
#define ERROR_CHAINS
Definition global.h:308
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1401
glwin * active_glwin
Definition project.c:53
#define ATOM_LIMIT
atom number limit to compute fragment(s) and molecule(s) analysis automatically
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:552
#define ERROR_ATOM_B
Definition global.h:303
cell_info * active_cell
Definition project.c:50
#define ERROR_RW
Definition global.h:298
#define ERROR_UPDATE
Definition global.h:304
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:958
gchar * file_chooser_get_file_name(GtkFileChooser *chooser)
get a file name from a GtkFileChooser (single file selected)
Definition gtk-misc.c:2306
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:652
chemical_data * active_chem
Definition project.c:48
#define BSEP
Definition global.h:262
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:669
gboolean file_chooser_set_file_name(GtkFileChooser *chooser, gchar *filename)
set file name in a GtkFilechooser
Definition gtk-misc.c:2339
#define ERROR_CURVE
Definition global.h:300
#define NONE
Definition global.h:285
#define STEP_LIMIT
Definition global.h:295
#define ERROR_PROJECT
Definition global.h:299
#define ERROR_FIELD
box_info * active_box
Definition project.c:51
#define ERROR_IMAGE
Definition global.h:301
#define NCFORMATS
Definition global.h:334
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:1010
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:861
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
Definition gtk-misc.c:1672
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.
Definition gtk-misc.c:340
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:247
#define ERROR_RINGS
Definition global.h:307
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2235
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:849
char * coord_files_ext[NCFORMATS+1]
Definition callbacks.c:104
#define ERROR_ATOM_A
Definition global.h:302
#define OK
Definition global.h:297
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
void update_entry_text(GtkEntry *entry, gchar *text)
update the content of a GtkEntry as string
Definition gtk-misc.c:726
GSList * file_chooser_get_file_names(GtkFileChooser *chooser)
create a file list from files selected using a GtkFileChooser
Definition gtk-misc.c:2293
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
Definition tools.c:71
#define ERROR_COORD
Definition global.h:306
#define ERROR_MOL
Definition global.h:309
char * coord_files[NCFORMATS+1]
Definition callbacks.c:88
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:837
#define ERROR_ANA
Definition global.h:310
GtkWidget * create_file_chooser(const gchar *title, GtkWindow *parent, GtkFileChooserAction act, const gchar *act_name)
create a GtkFileChooser, utility to select file(s)
Definition gtk-misc.c:2393
project * active_project
Definition project.c:47
void initcutoffs(chemical_data *chem, int species)
initialize bond cutoffs
Definition bdcall.c:245
void destroy_this_native_dialog(GtkNativeDialog *dialog)
destroy a GtkNativeDialog
Definition gtk-misc.c:2254
#define ERROR_QM
Definition global.h:311
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
#define ERROR_NO_WAY
Definition global.h:305
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
action
Definition glview.h:197
G_MODULE_EXPORT void show_hide_clones(GSimpleAction *action, GVariant *state, gpointer data)
show/hide clones menu item callback
Definition m_clones.c:139
void prep_model(int p)
prepare, or display, the OpenGL model window
Definition glwindow.c:1498
Function declarations for the creation of the OpenGL window.
void init_project(gboolean alloc_box)
initialize a new project
Definition init_p.c:273
void init_atomes_analysis(project *this_proj, gboolean apply_defaults)
initialize analysis data structures for atomes
Definition initc.c:223
int iask(char *question, char *lab, int id, GtkWidget *win)
enter an integer value - prepare the dialog
Definition interface.c:620
void show_warning(char *warning, GtkWidget *win)
show warning
Definition interface.c:266
void show_info(char *information, int val, GtkWidget *win)
add / show information message to widget
Definition interface.c:240
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:299
void show_error_with_trace(gchar *error, atomes_error *this_error, int act, int val, GtkWidget *win)
show error message
Definition interface.c:328
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
Definition interface.c:420
Messaging function declarations.
void prep_calc_actions()
prepare analysis widgets
Definition update_p.c:59
integer(kind=c_int) function lattice(totl, lid, vectors, vmod, angles, lat, cfrac, apbc)
Definition lattice.F90:162
G_MODULE_EXPORT void set_rep(GtkWidget *widg, gpointer data)
change representation callback
Definition m_rep.c:600
double z
Definition ogl_draw.c:63
double y
Definition ogl_draw.c:63
double x
Definition ogl_draw.c:63
float project_file_version
Definition open_p.c:74
int open_project(FILE *fp, int wid)
open atomes project file
Definition open_p.c:308
Function declarations for reading atomes project file Function declarations for saving atomes proje...
int save_project(FILE *fp, project *this_proj, int wid)
save project to file
Definition save_p.c:153
void active_project_changed(int id)
change the active project
Definition update_p.c:220
gboolean reading_project
Definition read_curve.c:43
gboolean * cif_cnftodo
Definition read_cif.c:174
int cif_cnfdone
Definition read_cif.c:175
int cif_cnfcart
Definition read_cif.c:172
int ** cif_cnfkeys
Definition read_cif.c:173
coord_file * this_reader
Definition read_coord.c:74
int write_xml(const char *filetosave)
write XML file
gchar * open_xml(const char *filetoread)
Open ISAACS XML file.
Functions declaration to read atomic coordinates.
Definition glwin.h:350
Definition global.h:119
GtkFileFilter * filter1
Definition w_data.c:53
GtkFileFilter * filter2
Definition w_data.c:53
GtkWidget * res[2]
Definition w_encode.c:342
void add_project_to_workspace()
add project(s) to the workspace tree
Definition workspace.c:597
GtkWidget * hbox
Definition workspace.c:71
GtkWidget * vbox
Definition workspace.c:72
void correct_this_window_title(GtkWidget *win, gchar *str)
use new title for GtkWindow, providing it exists
Definition workspace.c:324
GtkWidget * lab
Definition workspace.c:73
Function declarations for workspace managment.