95#define APP_EXTENSION ".exe"
116gchar *
bs_styles[] = {
"ball&stick",
"balls&sticks",
"balls&stick",
"ball&sticks",
117 "ball_&_stick",
"balls_&_sticks",
"balls_&_stick",
"ball_&_sticks",
118 "ball_and_sticks",
"balls_and_sticks",
"balls_and_stick",
"ball_and_stick",
119 "ballsandsticks",
"ballsandstick",
"ballanddsticks",
"ballandstick",
120 "b&s",
"b_and_s",
"bs",
"b", NULL};
121gchar *
wi_styles[] = {
"wireframe",
"wireframes",
"wires",
"wire",
"wi",
"w", NULL};
122gchar *
co_styles[] = {
"covalent_radius",
"covalent",
"cov_rad",
"cov",
"co",
"cr", NULL};
123gchar *
io_styles[] = {
"ionic_radius",
"ionic_rad",
"ionic",
"ion",
"ir", NULL};
124gchar *
vw_styles[] = {
"vdw_radius",
"van_der_waals_radius",
"van_der_waals",
"vdw_radius",
"vdw_rad",
"vdw",
"vr", NULL};
125gchar *
cr_styles[] = {
"crystal",
"crystal_radius",
"in_crystal",
"in_crystal_radius",
"cryst",
"crystal_rad",
"cr", NULL};
126gchar *
sp_styles[] = {
"sphere",
"spheres",
"sph",
"sp",
"S", NULL};
127gchar *
cy_styles[] = {
"cylinder",
"cylinders",
"cyl",
"cy",
"c", NULL};
140 printf (_(
"\nUsage: atomes [OPTION]\n"
142 " atomes [OPTION] [FILE]\n"
143 " atomes [FILE1] [FILE2] ...\n"
144 " atomes [OPTION1] [FILE1] [OPTION2] [FILE2] ...\n\n"
145 "3D atomic-scale models analysis, creation/edition and post-processing tool\n\n"
147 " -v, --version version information\n"
148 " -h, --help display this help message\n\n"
149 "files, any number, in any order, in the following formats:\n\n"
150 " atomes workspace file : .awf\n"
151 " atomes project file : .apf\n"
152 " XYZ coordinates file : .xyz\n"
153 " Chem3D coordinates file : .c3d\n"
154 " CPMD trajectory : .trj\n"
155 " VASP trajectory : .xdatcar\n"
156 " PDB coordinates : .pdb, .ent\n"
157 " Crystallographic Information File : .cif\n"
158 " DL-POLY history file : .hist\n"
159 " atomes chemical library file (XML) : .sml\n"
160 " ISAACS project file : .ipf\n\n"
161 " alternatively specify the file format using:\n\n"
168 " -pdb [FILE], or, -ent [FILE]\n"
174 " atomes -pdb this.f file.awf -cif that.f *.xyz\n\n"
175 "Image rendering from the command line:\n\n"
176 "Usage: atomes [IMAGE_OPTIONS]\n"
177 " -p, --png, --render-png render image in PNG format\n"
178 " -j, --jpg, --render-jpg render image in JPEG format\n"
179 " -o, --output=[FILE] image file name\n"
180 " -W, --width=[XSIZE] image width\n"
181 " -H, --height=[YSIZE] image height\n"
182 " -s, --style=[STYLE] rendering style\n"
183 " -r, --rep=[REP] representation type\n"
184 " -b, --box=[STYLE] box style\n"
185 " -a, --axis=[STYLE] axis style\n"
186 " -e, --acolor=[MAP] atoms and bonds color map\n"
187 " -t, --pcolor=[MAP] ployhedra color map\n"
188 " -C, --box_color=[COLOR] box color\n"
189 " -G, --back_grad=[GRAD] background gradient type\n"
190 " -B, --back_color=[COLOR] background color\n"
191 " -D, --back_dir=[DIR] background gradient direction\n"
192 " -P, --back_pos=[POS] colors mixed position\n"
193 " -U, --grad_col_a=[COL] gradient initial color\n"
194 " -V, --grad_col_b=[COL] gradient final color\n\n"
196 " atomes --render-png --width=1920 -H 1024 --output=project.png project.apf -s ball_and_stick\n"
197 " atomes --jpg --style=vdw -r ortho -e pc -t pc file.xyz\n\n"
198 "Atomic coordinates conversion from the command line:\n\n"
199 "Usage: atomes [CONVERSION_OPTIONS]\n"
200 " -c, --convert=[FORMAT] conversion format\n\n"
202 " atomes --convert=xyz project.apf\n"
203 " atomes -c sml file.pdb\n\n"));
204 printf (
"%s", _(
"\nReport a bug to <"));
215 printf (
"%s", _(
"\n3D atomic scale model analysis, creation/edition and post-processing tool\n"));
217 printf (
"\nGTK+ version : %1d.%1d.%1d\n",
221 printf (
"Libavutil version : %2d.%2d.%3d\n",
222 LIBAVUTIL_VERSION_MAJOR,
223 LIBAVUTIL_VERSION_MINOR,
224 LIBAVUTIL_VERSION_MICRO);
225 printf (
"Libavformat version : %2d.%2d.%3d\n",
226 LIBAVFORMAT_VERSION_MAJOR,
227 LIBAVFORMAT_VERSION_MINOR,
228 LIBAVFORMAT_VERSION_MICRO);
229 printf (
"Libavcodec version : %2d.%2d.%3d\n",
230 LIBAVCODEC_VERSION_MAJOR,
231 LIBAVCODEC_VERSION_MINOR,
232 LIBAVCODEC_VERSION_MICRO);
233 printf (
"Libswscale version : %2d.%2d.%3d\n",
234 LIBSWSCALE_VERSION_MAJOR,
235 LIBSWSCALE_VERSION_MINOR,
236 LIBSWSCALE_VERSION_MICRO);
244 v_string =
"2005-05";
248 v_string =
"2008-05";
252 v_string =
"2011-07";
256 v_string =
"2013-07";
260 v_string =
"2015-11";
264 v_string =
"2018-11";
268 v_string =
"2020-11";
272 v_string =
"2021-11";
275 v_string =
"unknown";
278 printf (
"OpenMP version : %1.1f (%s)\n", v, v_string);
280 printf (
"FC Compiler : %s\n", FC);
281 printf (
"FC Compiler flags : %s\n", FCFLAGS);
282 printf (
"C Compiler : %s\n", CC);
283 printf (
"C Compiler flags : %s\n", CFLAGS);
285 printf (
"%s", _(
"\nReport a bug to <"));
300 gchar * aext = g_strdup_printf (
"%c%c%c%c", arg[len-4], arg[len-3], arg[len-2], arg[len-1]);
301 char * eext[17]={
".awf",
".apf",
".xyz",
"NULL",
".c3d",
".trj",
"NULL",
".car",
"NULL",
".pdb",
".ent",
".cif",
"NULL",
"NULL",
".hist",
".sml",
".ipf"};
302 for (i=0; i<17; i++)
if (g_strcmp0 (aext, eext[i]) == 0)
320 char * fext[17]={
"-awf",
"-apf",
" -xyz",
"NULL",
"-c3d",
"-trj",
"NULL",
"-xdatcar",
"NULL",
"-pdb",
"-ent",
"-cif",
"NULL",
"NULL",
"-hist",
"-sml",
"-ipf"};
323 gchar * str = g_ascii_strdown (arg, i);
326 if (g_strcmp0 (str, fext[j]) == 0)
349 while (* list != NULL)
351 if (g_strcmp0(* list,
string) == 0)
391 gchar * ortho_keys[] = {
"orthographic",
"ortho",
"o",
"0", NULL};
392 gchar * persp_keys[] = {
"perspective",
"persp",
"p",
"1", NULL};
436 gchar * sp_keys[] = {
"species",
"spec",
"sp",
"0", NULL};
437 gchar * pt_keys[] = {
"total_coordinations",
"total_coordination",
"total_coord",
"total",
"tc",
"t",
"1", NULL};
438 gchar * pc_keys[] = {
"partial_coordinations",
"partial_coordination",
"partial_coord",
"partial",
"pc",
"p",
"2", NULL};
439 gchar * fg_keys[] = {
"fragments",
"fragment",
"frag",
"fg",
"f",
"3", NULL};
440 gchar * mo_keys[] = {
"molecules",
"molecule",
"mol",
"mo",
"m",
"4", NULL};
459 const char *
color = color_string;
463 size_t len = strlen(
color);
464 if (len != 3 && len != 4 && len != 6 && len != 8)
470 int is_long = (len == 6 || len == 8) ? TRUE : FALSE;
471 float ratio = (is_long) ? 255.0 : 15.0;
472 int incr = (is_long) ? 2 : 1;
473 col = g_malloc0(
sizeof*
col);
479 if (is_long) buf[1] =
color[1];
480 col->red = strtol(buf, NULL, 16) / ratio;
481 buf[0] =
color[incr];
482 if (is_long) buf[1] =
color[incr+1];
483 col->green = strtol(buf, NULL, 16) / ratio;
484 buf[0] =
color[2*incr];
485 if (is_long) buf[1] =
color[2*incr+1];
486 col->blue = strtol(buf, NULL, 16) / ratio;
487 if (len == 4 || len == 8)
489 buf[0] =
color[3*incr];
490 if (is_long) buf[1] =
color[3*incr+1];
491 col->alpha = strtol(buf, NULL, 16) / ratio;
495 if (
col -> red < 0.0 || col -> red > 1.0 ||
496 col -> green < 0.0 || col -> green > 1.0 ||
497 col -> blue < 0.0 || col -> blue > 1.0 ||
498 col -> alpha < 0.0 || col -> alpha > 1.0)
515 gchar * no_keys[] = {
"none",
"no",
"n",
"0", NULL};
516 gchar * li_keys[] = {
"linear",
"lin",
"li",
"l",
"1", NULL};
517 gchar * ci_keys[] = {
"circular",
"circ",
"ci",
"c",
"2", NULL};
538 for (j=start; j<end; j++)
541 if (k > 0 && j < end-1)
557 argv[j] = argv[j+1] = g_strdup_printf (
" ");
574 setlocale (LC_ALL,
"");
575 setlocale (LC_NUMERIC,
"C");
576 bindtextdomain (
PACKAGE, PACKAGE_LOCALE);
578 bind_textdomain_codeset (
PACKAGE,
"UTF-8");
591 struct option atomes_options[] = {{
"help", no_argument, 0,
'h'},
592 {
"version", no_argument, 0,
'v'},
593 {
"libreoffice", no_argument, 0,
'l'},
594 {
"render-png", no_argument, 0,
'p'},
595 {
"png", no_argument, 0,
'p'},
596 {
"render-jpg", no_argument, 0,
'j'},
597 {
"jpg", no_argument, 0,
'j'},
598 {
"width", required_argument, 0,
'W'},
599 {
"height", required_argument, 0,
'H'},
600 {
"output", required_argument, 0,
'o'},
601 {
"style", required_argument, 0,
's'},
602 {
"atoms", required_argument, 0,
'e'},
603 {
"poly", required_argument, 0,
't'},
604 {
"axis", required_argument, 0,
'a'},
605 {
"box", required_argument, 0,
'b'},
606 {
"box_color", required_argument, 0,
'C'},
607 {
"back_color", required_argument, 0,
'B'},
608 {
"back_grad", required_argument, 0,
'G'},
609 {
"back_dir", required_argument, 0,
'D'},
610 {
"back_pos", required_argument, 0,
'P'},
611 {
"grad_col_a", required_argument, 0,
'U'},
612 {
"grad_col_b", required_argument, 0,
'V'},
613 {
"rep", required_argument, 0,
'r'},
614 {
"convert", required_argument, 0,
'c'},
621 gchar * image_x = NULL;
622 gchar * image_y = NULL;
635 while ((opt = getopt_long(argc, argv,
"hvlpjdW:H:o:s:a:b:c:r:e:t:B:C:G:D:P:U:V:", atomes_options, & index)) != -1)
654 img_opt += (index == -1) ? 1 : 0;
661 img_opt += (index == -1) ? 1 : 0;
680 img_opt += (index == -1) ? 1 : 0;
683 image_x = g_strdup_printf (
"%s", optarg);
685 img_opt += (index == -1) ? 1 : 0;
688 image_y = g_strdup_printf (
"%s", optarg);
690 img_opt += (index == -1) ? 1 : 0;
695 img_opt += (index == -1) ? 1 : 0;
700 img_opt += (index == -1) ? 1 : 0;
705 img_opt += (index == -1) ? 1 : 0;
710 img_opt += (index == -1) ? 1 : 0;
715 img_opt += (index == -1) ? 1 : 0;
720 img_opt += (index == -1) ? 1 : 0;
725 img_opt += (index == -1) ? 1 : 0;
728 if (isdigit(optarg[0]))
733 img_opt += (index == -1) ? 1 : 0;
739 img_opt += (index == -1) ? 1 : 0;
744 img_opt += (index == -1) ? 1 : 0;
749 img_opt += (index == -1) ? 1 : 0;
763 if (image_x || image_y)
785 for (i=optind; i<argc; i++)
799 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
802 ftmp -> file_name = g_strdup_printf (
"%s", argv[i]);
803 ftmp -> file_type = -j;
823 GtkWidget * splashi = (GtkWidget*) user_data;
838G_MODULE_EXPORT gboolean splashdraw (GtkWidget * widget, cairo_t * cr, gpointer data)
840 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
854 gtk_window_set_decorated (GTK_WINDOW (splash_window), FALSE);
858 gchar * backcol = g_strdup_printf (
"window#splash {\n"
860 " background-color: rgba(255, 255, 255, 0);}");
862 gtk_widget_set_name (splash_window,
"splash");
865 gtk_window_set_type_hint (GTK_WINDOW (splash_window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
866 gtk_window_set_position (GTK_WINDOW (splash_window), GTK_WIN_POS_CENTER_ALWAYS);
867 gtk_widget_set_app_paintable (splash_window, TRUE);
868 GdkScreen * screen = gtk_widget_get_screen (splash_window);
869 GdkVisual * visual = gdk_screen_get_rgba_visual (screen);
870 gtk_widget_set_visual (splash_window, visual);
872 g_signal_connect(G_OBJECT(splash_window),
"draw", G_CALLBACK(splashdraw), NULL);
876 gtk_window_set_transient_for ((GtkWindow *)splash_window, (GtkWindow *)
atomes_main_window);
878 return splash_window;
891 FILE *
fp = fopen (this_file,
dfi[0]);
897 gchar * err = g_strdup_printf (_(
"Error while reading workspace file\n%s\n"), this_file);
939 end = g_strdup_printf (
"%c", file_name[strlen(file_name)-1]);
940 if (g_strcmp0 (file_name,
"*") == 0 || g_strcmp0 (end,
"*") == 0)
942 if (g_strcmp0 (file_name,
"*") == 0)
944 filedir = g_strdup_printf (
"./");
948 filedir = g_strdup_printf (
"%c", file_name[0]);
949 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf (
"%s%c", filedir, file_name[i]);
952 hFind = FindFirstFile (filedir, & ffd);
953 if (hFind != INVALID_HANDLE_VALUE)
955 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
957 str = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
961 while (FindNextFile(hFind, &ffd) != 0)
963 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
965 str = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
973 d = opendir (filedir);
976 while ((dir = readdir(d)) != NULL)
978 if (dir -> d_type == DT_REG)
980 str = g_strdup_printf (
"%s/%s", filedir, dir -> d_name);
1000 end = g_strdup_printf (
"%c", file_name[strlen(file_name)-1]);
1001 if (g_strcmp0 (file_name,
"*") == 0 || g_strcmp0 (end,
"*") == 0)
1003 if (g_strcmp0 (file_name,
"*") == 0)
1005 filedir = g_strdup_printf (
"./");
1009 filedir = g_strdup_printf (
"%c", file_name[0]);
1010 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf (
"%s%c", filedir, file_name[i]);
1013 hFind = FindFirstFile (filedir, & ffd);
1014 if (hFind != INVALID_HANDLE_VALUE)
1016 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
1019 active_project -> coordfile = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
1022 while (FindNextFile(hFind, &ffd) != 0)
1024 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
1027 active_project -> coordfile = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
1034 d = opendir (filedir);
1037 while ((dir = readdir(d)) != NULL)
1039 if (dir -> d_type == DT_REG)
1042 active_project -> coordfile = g_strdup_printf (
"%s/%s", filedir, dir -> d_name);
1072static gboolean handle_open_file (
Instance *
object, GDBusMethodInvocation * invocation,
const gchar * arg_file, gpointer user_data)
1074 if (arg_file && strlen (arg_file) > 0)
1076 int len = strlen (arg_file);
1101static gboolean init_dbus_server ()
1103 GError * error = NULL;
1104 GDBusConnection * connection;
1105 GDBusInterfaceSkeleton * skeleton;
1108 connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, & error);
1111 g_printerr (
"D-Bus connection error : %s\n", error -> message);
1112 g_error_free (error);
1118 skeleton = G_DBUS_INTERFACE_SKELETON (interface);
1121 g_signal_connect (interface,
"handle-open-file", G_CALLBACK (handle_open_file), NULL);
1124 if (! g_dbus_interface_skeleton_export (skeleton, connection,
"/fr/ipcms/atomes/Instance", & error))
1126 g_printerr (
"D-Bus interface export error : %s\n", error -> message);
1127 g_error_free (error);
1133 GVariant * name_result = g_dbus_connection_call_sync (connection,
1134 "org.freedesktop.DBus",
1135 "/org/freedesktop/DBus",
1136 "org.freedesktop.DBus",
1138 g_variant_new (
"(su)",
"fr.ipcms.atomes.Instance", 4u),
1139 G_VARIANT_TYPE (
"(u)"),
1140 G_DBUS_CALL_FLAGS_NONE,
1145 g_printerr (
"D-Bus name reservation error : %s\n", error -> message);
1146 g_error_free (error);
1149 else if (name_result)
1152 g_variant_get (name_result,
"(u)", & reply);
1153 g_variant_unref (name_result);
1156 g_printerr (
"Impossible d'obtenir le nom D-Bus (code: %u)\n", reply);
1170static gboolean check_existing_instance ()
1172 gboolean sent = FALSE;
1173 if (!
flist)
return sent;
1175 GError * error = NULL;
1176 GDBusConnection * connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, & error);
1179 g_printerr (
"D-Bus connection error : %s\n", error -> message);
1180 g_error_free (error);
1184 if (!
flist)
return sent;
1190 GVariant * result = g_dbus_connection_call_sync (connection,
1191 "fr.ipcms.atomes.Instance",
1192 "/fr/ipcms/atomes/Instance",
1193 "fr.ipcms.atomes.Instance",
1195 g_variant_new (
"(s)", tmp ->
file_name),
1197 G_DBUS_CALL_FLAGS_NONE,
1204 g_printerr (
"D-Bus OpenFile error: %s\n", error -> message);
1205 g_error_free (error);
1210 g_variant_unref (result);
1216 g_object_unref (connection);
1221#define ATOMES_MUTEX_NAME "fr.ipcms.atomes.mutex"
1222#define ATOMES_PIPE_NAME "\\\\.\\pipe\\fr.ipcms.atomes.pipe"
1223#define ATOMES_PIPE_BUFSIZE 4096
1225HANDLE win32_mutex = NULL;
1232typedef struct OpenFileData OpenFileData;
1250static gboolean win32_open_file_idle (gpointer user_data)
1252 OpenFileData * ofd = (OpenFileData *) user_data;
1258 g_free (ofd -> file_name);
1274static gpointer win32_pipe_server_thread (gpointer user_data)
1278 HANDLE pipe = CreateNamedPipe (ATOMES_PIPE_NAME,
1279 PIPE_ACCESS_INBOUND,
1280 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
1281 PIPE_UNLIMITED_INSTANCES,
1282 ATOMES_PIPE_BUFSIZE,
1283 ATOMES_PIPE_BUFSIZE,
1285 if (pipe == INVALID_HANDLE_VALUE)
1287 g_printerr (
"CreateNamedPipe failed: %lu\n", GetLastError ());
1291 BOOL connected = ConnectNamedPipe(pipe, NULL);
1292 if (! connected && GetLastError() != ERROR_PIPE_CONNECTED)
1294 g_printerr (
"ConnectNamedPipe failed: %lu", GetLastError());
1298 else if (connected || GetLastError () == ERROR_PIPE_CONNECTED)
1300 char buf[ATOMES_PIPE_BUFSIZE];
1301 DWORD bytes_read = 0;
1302 BOOL ok = ReadFile (pipe, buf,
sizeof (buf) - 1, & bytes_read, NULL);
1303 if (ok && bytes_read > 0)
1305 buf[bytes_read] =
'\0';
1306 int len = (int) strlen (buf);
1310 OpenFileData * ofd = g_malloc0 (
sizeof * ofd);
1311 ofd -> file_type = file_type;
1312 ofd -> file_name = g_strdup (buf);
1313 g_idle_add (win32_open_file_idle, ofd);
1318 g_printerr (
"ReadFile failed: %lu", GetLastError());
1321 DisconnectNamedPipe(pipe);
1335static gboolean init_win32_server ()
1337 win32_mutex = CreateMutex (NULL, TRUE, ATOMES_MUTEX_NAME);
1338 if (win32_mutex == NULL)
1340 g_printerr (
"CreateMutex failed: %lu\n", GetLastError ());
1344 if (GetLastError () == ERROR_ALREADY_EXISTS)
1346 CloseHandle (win32_mutex);
1351 HANDLE thread = g_thread_new (
"atomes-pipe-server", win32_pipe_server_thread, NULL);
1354 CloseHandle (win32_mutex);
1373static gboolean check_existing_win32_instance ()
1375 if (!
flist)
return FALSE;
1377 HANDLE mutex = OpenMutex (MUTEX_ALL_ACCESS, FALSE, ATOMES_MUTEX_NAME);
1378 if (mutex == NULL)
return FALSE;
1380 gboolean sent = FALSE;
1384 HANDLE pipe = CreateFile (ATOMES_PIPE_NAME,
1392 if (pipe == INVALID_HANDLE_VALUE)
1394 g_printerr (
"CreateFile PIPE FAILED: %lu\n", GetLastError());
1397 DWORD len = (DWORD) strlen (tmp ->
file_name);
1400 BOOL ok = WriteFile (pipe, tmp ->
file_name, len, & written, NULL);
1404 g_printerr (
"WriteFile FAILED: %lu\n", GetLastError());
1408 g_printerr (
"WriteFile OK: %lu/%lu bytes\n", written, len);
1409 if (written == len) sent = TRUE;
1416 CloseHandle (mutex);
1436 setlocale (LC_NUMERIC,
"C");
1437 GtkSettings * default_settings = gtk_settings_get_default ();
1444 g_object_set (default_settings,
"gtk-button-images", TRUE, NULL);
1448 g_object_set (default_settings,
"gtk-key-theme-name",
"win32", NULL);
1457#ifdef MAC_INTEGRATION
1458 GtkosxApplication * ProgOSX;
1459 ProgOSX = g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
1460 gtkosx_application_set_use_quartz_accelerators (ProgOSX, FALSE);
1461 gtkosx_application_ready (ProgOSX);
1471 if (isplash == NULL)
1473 g_warning (_(
"Impossible to load the splash screen\n"));
1510#ifdef MAC_INTEGRATION
1511 g_object_unref (ProgOSX);
1522 GError * error = NULL;
1523 gchar * proc_dir = NULL;
1524 gchar * proc_path = NULL;
1525 const char * proc_name;
1527 proc_dir = g_build_filename (PACKAGE_PREFIX,
"bin", NULL);
1528 proc_name =
"atomes_startup_testing.exe";
1529 proc_path = g_build_filename (proc_dir, proc_name, NULL);
1531 proc_dir = g_build_filename (PACKAGE_LIBEXEC, NULL);
1532 proc_name =
"atomes_startup_testing";
1533 proc_path = g_build_filename (PACKAGE_LIBEXEC, proc_name, NULL);
1536 g_print (
"proc_dir= %s\n", proc_dir);
1537 g_print (
"proc_name= %s\n", proc_name);
1538 g_print (
"proc_path= %s\n", proc_path);
1542 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
1545 GSubprocessLauncher * proc_launch = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
1546 g_subprocess_launcher_set_cwd (proc_launch, proc_dir);
1547 GSubprocess * proc = g_subprocess_launcher_spawn (proc_launch, & error, proc_path, NULL);
1549 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
1555 g_printerr (
"error: %s\n", error -> message);
1556 g_clear_error (& error);
1558 g_subprocess_wait (proc, NULL, & error);
1559 int res = g_subprocess_get_exit_status (proc);
1561 g_debug (
"Exit status of atomes_startup_testing = %d",
res);
1563 g_object_unref (proc);
1566 g_object_unref (proc_launch);
1571 gchar * ogl_info = NULL;
1575 ogl_info = g_strdup_printf (_(
"Fatal error on OpenGL initialization: trying to adjust environment !"));
1578 ogl_info = g_strdup_printf (_(
"Impossible to initialize the OpenGL 3D rendering !"));
1581 ogl_info = g_strdup_printf (_(
"GDK visual must be modified to initialize the OpenGL context !"));
1588 g_print (
"%s\n", ogl_info);
1605 gboolean RUNC = FALSE;
1611 PACKAGE_PREFIX = g_win32_get_package_installation_directory_of_module (NULL);
1612 PACKAGE_LOCALE = g_build_filename (PACKAGE_PREFIX,
"locale", NULL);
1616 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
1617 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
1618 PACKAGE_CON = g_build_filename (PACKAGE_PREFIX,
"pixmaps/convert.png", NULL);
1619 PACKAGE_IMG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/image.png", NULL);
1620 PACKAGE_PDF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/pdf.png", NULL);
1621 PACKAGE_SVG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/svg.png", NULL);
1622 PACKAGE_EPS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/eps.png", NULL);
1623 PACKAGE_PNG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/png.png", NULL);
1624 PACKAGE_JPG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/jpg.png", NULL);
1625 PACKAGE_BMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bmp.png", NULL);
1626 PACKAGE_TIFF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/tiff.png", NULL);
1627 PACKAGE_VOID = g_build_filename (PACKAGE_PREFIX,
"pixmaps/void.png", NULL);
1628 PACKAGE_TD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/td.png", NULL);
1629 PACKAGE_MOL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/molecule.png", NULL);
1630 PACKAGE_OGL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/opengl.png", NULL);
1631 PACKAGE_OGLM = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
1632 PACKAGE_OGLC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
1633 PACKAGE_PRO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/prop.png", NULL);
1634 PACKAGE_SET = g_build_filename (PACKAGE_PREFIX,
"pixmaps/settings.png", NULL);
1635 PACKAGE_LOGO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo.png", NULL);
1636 PACKAGE_LAGPL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-agpl.png", NULL);
1637 PACKAGE_LABOUT = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-about.png", NULL);
1638 PACKAGE_DOTA = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-a.png", NULL);
1639 PACKAGE_DOTB = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-b.png", NULL);
1640 PACKAGE_DOTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-c.png", NULL);
1641 PACKAGE_DOTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-d.png", NULL);
1642 PACKAGE_DOTE = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-e.png", NULL);
1643 PACKAGE_DOTF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-f.png", NULL);
1644 PACKAGE_DOTG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-g.png", NULL);
1645 PACKAGE_DOTH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-h.png", NULL);
1646 PACKAGE_DFBD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/bd.png", NULL);
1647 PACKAGE_DFAN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/an.png", NULL);
1648 PACKAGE_DFDI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/di.png", NULL);
1649 PACKAGE_DFTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/td.png", NULL);
1650 PACKAGE_DFIN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/in.png", NULL);
1651 PACKAGE_SGCP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-P.png", NULL);
1652 PACKAGE_SGCI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-I.png", NULL);
1653 PACKAGE_SGCF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-F.png", NULL);
1654 PACKAGE_SGHP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Hexagonal.png", NULL);
1655 PACKAGE_SGTR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Trigonal-R.png", NULL);
1656 PACKAGE_SGTI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-I.png", NULL);
1657 PACKAGE_SGTP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-P.png", NULL);
1658 PACKAGE_SGOP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-P.png", NULL);
1659 PACKAGE_SGOI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-I.png", NULL);
1660 PACKAGE_SGOC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-C.png", NULL);
1661 PACKAGE_SGOF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-F.png", NULL);
1662 PACKAGE_SGMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-P.png", NULL);
1663 PACKAGE_SGMI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-I.png", NULL);
1664 PACKAGE_SGTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Triclinic.png", NULL);
1687 g_setenv (
"GSK_RENDERER",
"gl", TRUE);
1688 g_setenv (
"GDK_DEBUG",
"gl-prefer-gl", TRUE);
1693 g_setenv (
"GDK_RENDERER",
"ngl", TRUE);
1703 g_setenv (
"GSK_RENDERER",
"gl", TRUE);
1708 PWSTR localPath = NULL;
1709 HRESULT hr = SHGetKnownFolderPath (& FOLDERID_LocalAppData, 0, NULL, & localPath);
1712 fprintf (stderr, _(
"Error impossible to obtain the AppData\\Roaming (code 0x%08lx)\n%s"), hr);
1718 char appdata[MAX_PATH];
1719 wcstombs (appdata, localPath, MAX_PATH);
1720 CoTaskMemFree (localPath);
1726 struct passwd * pw = getpwuid(getuid());
1743 if (argc > 1 && check_existing_win32_instance ())
1747 if (! init_win32_server ())
1749 g_print (
"Init Win32 pipe server failed\n");
1753 if (argc > 1 && check_existing_instance ())
1759 if (! init_dbus_server ())
1761 g_print (
"Init D-BUS failed\n");
1768#if GLIB_MINOR_VERSION < 74
1769 atomes_app = gtk_application_new (g_strdup_printf (
"fr.ipcms.atomes.prog-%d", (
int)clock()), G_APPLICATION_FLAGS_NONE);
1771 atomes_app = gtk_application_new (g_strdup_printf (
"fr.ipcms.atomes.prog-%d", (
int)clock()), G_APPLICATION_DEFAULT_FLAGS);
1773 GError * error = NULL;
1774 g_application_register (G_APPLICATION(
atomes_app), NULL, & error);
1782 ReleaseMutex (win32_mutex);
1783 CloseHandle (win32_mutex);
Binding to the Fortran90 subroutines.
int open_save_workspace(FILE *fp, int act)
open or save the active workspace
void open_this_coordinate_file(int format, gchar *proj_name, gboolean main_reader)
open coordinate file format, if successful add to workspace
int open_save(FILE *fp, int act, int wid, int pid, int aid, gchar *pfile)
open or save project file
void open_this_isaacs_xml_file(gchar *profile, int ptoc, gboolean visible)
open an ISAACS XML file
Callback declarations for main window.
#define PACKAGE_BUGREPORT
Instance * instance_skeleton_new(void)
void instance_complete_open_file(Instance *object G_GNUC_UNUSED, GDBusMethodInvocation *invocation)
struct _Instance Instance
GtkWidget * atomes_main_window
gboolean atomes_render_image
int * allocint(int val)
allocate an int * pointer
gchar * ATOMES_CONFIG_DIR
GtkApplication * atomes_app
double string_to_double(gpointer string)
convert string to double
gboolean atomes_from_libreoffice
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * new_gtk_window()
create a new GtkWindow
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
void provide_gtk_css(gchar *css)
create a css provider based on the css data
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
ColRGBA * render_image_grad_color[2]
ColRGBA * render_image_box_color
ColRGBA * render_image_back_color
int * render_image_pixels
int render_image_back_grad
gboolean trigger_fragment_analysis
float render_image_back_pos
int render_image_back_dir
gchar * render_image_output
gboolean trigger_molecule_analysis
void init_project(gboolean alloc_box)
initialize a new project
void show_error(char *error, int val, GtkWidget *win)
show error message
Messaging function declarations.
int get_color_map_from_string(gchar *col_string)
retrieve color map from command line string
int get_rep_from_string(gchar *rep_string)
retrieve representation style from command line string
int main(int argc, char *argv[])
initialization of the atomes program
int check_opengl_rendering()
check the initialization parameters for an OpenGL context
int test_this_arg(gchar *arg)
test an argument from the command line
int get_box_axis_from_string(gchar *box_axis_string)
retrieve box or axis style from command line string
int get_file_format_from_string(gchar *file_format_string)
retrieve file format for convertion from command line string
GtkWidget * create_splash_window()
create splash screen window
void print_version()
print version information
ColRGBA * get_color_from_hexa_string(gchar *color_string)
convert Hexadecimal string to ColRGBA
void set_atomes_locale()
set locale
gboolean is_string_in_string_list(gchar *string, gchar **list)
check if a string is in a list of strings
int get_gradient_from_string(gchar *grad_string)
retrieve background gradient from command line string
void print_help()
print basic help
GtkWidget * create_main_window(GApplication *app)
create the main application window
gboolean destroy_func(gpointer user_data)
destroy splash screen
int parse_command_line(int argc, char *argv[])
test command line arguments
int test_this_ext(int len, gchar *arg)
test extension of an argument from the command line
G_MODULE_EXPORT void run_program(GApplication *app, gpointer data)
run the program
void open_this_data_file(int file_type, gchar *file_name)
open data file from the command line
int check_for_atomes_file_options(int start, int end, char *argv[])
retrieve the list of files to read from the command line leave out all other options
void read_this_file(int file_type, gchar *this_file)
read file from the command line
int get_style_from_string(gchar *style_string)
retrieve style from command line string
Data structure declarations for movie encoding Function declarations for movie encoding.
void set_atomes_preferences()
set software default parameters
Preference variable declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
Function declarations for workspace managment.