atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
calc_menu.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
21
22/*
23* This file: 'calc_menu.c'
24*
25* Contains:
26*
27
28 - The creation of the calculation dialogs
29
30*
31* List of functions:
32
33 gboolean test_gr (int rdf);
34 gboolean test_sq (int fdq);
35 gboolean test_bonds ();
36 gboolean test_rings ();
37 gboolean test_sph ();
38 gboolean test_msd ();
39 gboolean test_skt ();
40
41 void update_omega_max ();
42 void calc_sph (GtkWidget * vbox);
43 void calc_msd (GtkWidget * vbox, int cid);
44 void calc_rings (GtkWidget * vbox);
45 void calc_bonds (GtkWidget * vbox);
46 void add_advanced_options (int skq, dint skadv[2], GtkWidget * vbox);
47 void add_smoothing_options (int grsqk, GtkWidget * vbox);
48 void calc_gr_sq (GtkWidget * box, int id);
49 void add_remove_t_steps_q_vectors (int val, int calc);
50 void add_correlations_options (int cid);
51 void calc_sk_t (GtkWidget * box);
52
53 G_MODULE_EXPORT void set_max (GtkEntry * entry, gpointer data);
54 G_MODULE_EXPORT void set_delta (GtkEntry * entry, gpointer data);
55 G_MODULE_EXPORT void combox_tunit_changed (GtkComboBox * box, gpointer data);
56 G_MODULE_EXPORT void set_numa (GtkEntry * entry, gpointer data);
57 G_MODULE_EXPORT void combox_rings_changed (GtkComboBox * box, gpointer data);
58 G_MODULE_EXPORT void toggle_rings (GtkCheckButton * but, gpointer data);
59 G_MODULE_EXPORT void toggle_rings (GtkToggleButton * but, gpointer data);
60 G_MODULE_EXPORT void run_toggle_bond (GtkNativeDialog * info, gint response_id, gpointer data);
61 G_MODULE_EXPORT void run_toggle_bond (GtkDialog * info, gint response_id, gpointer data);
62 G_MODULE_EXPORT void toggle_bond (GtkCheckButton * Button, gpointer data);
63 G_MODULE_EXPORT void toggle_bond (GtkToggleButton * Button, gpointer data);
64 G_MODULE_EXPORT void expand_opt (GtkWidget * exp, gpointer data);
65 G_MODULE_EXPORT void set_advanced_sq (GtkEntry * entry, gpointer data);
66 G_MODULE_EXPORT void set_sfact (GtkEntry * entry, gpointer data);
67 G_MODULE_EXPORT void on_show_curve_toolbox (GtkWidget * widg, gpointer data);
68 G_MODULE_EXPORT void on_smoother_released (GtkButton * button, gpointer data);
69 G_MODULE_EXPORT void set_skt_step_id (GtkEntry * res, gpointer data);
70 G_MODULE_EXPORT void set_sqw_q_id (GtkEntry * res, gpointer data);
71 G_MODULE_EXPORT void set_t_q_spin (GtkSpinButton * res, gpointer data);
72 G_MODULE_EXPORT void set_correlations (GtkEntry * entry, gpointer data);
73 G_MODULE_EXPORT void toggle_skt_all (GtkCheckButton * but, gpointer data);
74 G_MODULE_EXPORT void toggle_skt_all (GtkToggleButton * but, gpointer data);
75 G_MODULE_EXPORT void run_on_calc_activate (GtkDialog * dial, gint response_id, gpointer data);
76 G_MODULE_EXPORT void on_calc_activate (GtkWidget * widg, gpointer data);
77
78 GtkWidget * calc_window (int i);
79 GtkWidget * combox_rings (gchar * str, int num, gchar * list_item[num], int id);
80 GtkWidget * hbox_note (int i, double val);
81
82*/
83
84#include "global.h"
85#include "callbacks.h"
86#include "interface.h"
87#include "preferences.h"
88#include "bind.h"
89#include "project.h"
90#include "workspace.h"
91
92extern G_MODULE_EXPORT void on_calc_gr_released (GtkWidget * widg, gpointer data);
93extern G_MODULE_EXPORT void on_calc_gq_released (GtkWidget * widg, gpointer data);
94extern G_MODULE_EXPORT void on_calc_sq_released (GtkWidget * widg, gpointer data);
95extern G_MODULE_EXPORT void on_calc_sk_released (GtkWidget * widg, gpointer data);
96extern G_MODULE_EXPORT void on_calc_skt_released (GtkWidget * widg, gpointer data);
97extern G_MODULE_EXPORT void on_calc_rings_released (GtkWidget * widg, gpointer data);
98extern G_MODULE_EXPORT void on_calc_chains_released (GtkWidget * widg, gpointer data);
99extern G_MODULE_EXPORT void on_calc_msd_released (GtkWidget * widg, gpointer data);
100extern G_MODULE_EXPORT void on_calc_sph_released (GtkWidget * widg, gpointer data);
101extern void dyna_parameters (GtkWidget * vbox, int cid);
102
103GtkWidget * calc_win = NULL;
104GtkWidget * ba_entry[2];
106
114GtkWidget * calc_window (int i)
115{
117 return calc_dialog;
118}
119
120void add_remove_t_steps_q_vectors (int val, int calc);
121
130G_MODULE_EXPORT void set_max (GtkEntry * entry, gpointer data)
131{
132 int c = GPOINTER_TO_INT(data);
133 const gchar * m = entry_get_text (entry);
134 double v = string_to_double ((gpointer)m);
135 if (v > 0.0 && v > active_project -> analysis[c] -> min)
136 {
137 if (active_project -> analysis[c] -> max != v)
138 {
139 active_project -> analysis[c] -> max = v;
140 if (c == SKT)
141 {
142 add_remove_t_steps_q_vectors (active_project -> sqw_n_data_sets, 1);
143 }
144 // Max has changed do something !?
145 }
146 }
147 update_entry_double (entry, active_project -> analysis[c] -> max);
148}
149
150GtkWidget * rings_box[2];
151GtkWidget * omega_max_hbox = NULL;
152GtkWidget * omega_max_info = NULL;
153
160{
161 gchar * freq_unit[5]={" THz", " THz", " MHz", " KHz", " Hz"};
162 gchar * str;
164 double delt = (preferences) ? tmp_delta_t[0]: active_project -> analysis[MSD] -> delta;
165 int num_delt = (preferences) ? tmp_num_delta[MSD-2] : active_project -> analysis[MSD] -> num_delta;
166 int t_unit = (preferences) ? (int)tmp_delta_t[1] : active_project -> tunit;
167 if ( delt > 0.0 && num_delt && t_unit > -1)
168 {
170 double omega_max = pi/(delt * num_delt);
171 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, omega_max_info, markup_label (_("&#969;<sub>max</sub> ="), 50, -1, 0.0, 0.5), FALSE, FALSE, 2);
172 str = g_strdup_printf ("%f", (t_unit == 1) ? omega_max : omega_max * 1000.0);
173 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, omega_max_info, markup_label (str, 100, -1, 1.0, 0.5), FALSE, FALSE, 0);
174 g_free (str);
175 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, omega_max_info, markup_label (freq_unit[t_unit], 50, -1, 0.0, 0.5), FALSE, FALSE, 0);
176 }
177 else
178 {
179 str = g_strdup_printf (_("Update step(s) between conf. and &#x3b4;t to evaluate &#969;<sub>max</sub>"));
180 omega_max_info = markup_label (str, -1, -1, 0.5, 0.5);
181 g_free (str);
182 }
183 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, omega_max_hbox, omega_max_info, FALSE, FALSE, 5);
185}
186
195G_MODULE_EXPORT void set_delta (GtkEntry * entry, gpointer data)
196{
197 int c = GPOINTER_TO_INT(data);
198 const gchar * m = entry_get_text (entry);
199 double v = string_to_double ((gpointer)m);
200 int i, j, k;
201 i = (int)v;
202 if (c == RIN)
203 {
204 if (preferences)
205 {
206 k = tmp_rsparam[2];
207 }
208 else
209 {
211 k = active_project -> rsparam[j][1];
212 }
213 }
214 else if (c == CHA)
215 {
216 k = (preferences) ? tmp_csparam[1] : active_project -> csparam[5];
217 }
218 else if (c > -1 && ! preferences)
219 {
220 k = active_project -> analysis[c] -> num_delta;
221 }
222 if (c < 0 && ! preferences)
223 {
224 if (v > 0.0)
225 {
226 if (active_project -> analysis[-c] -> delta != v)
227 {
228 active_project -> analysis[-c] -> delta = v;
229 }
230 }
231 }
232 else if (i > 0 && ! preferences)
233 {
234 if (c == RIN)
235 {
236 if (active_project -> rsparam[j][1] != i)
237 {
238 active_project -> rsparam[j][1] = i;
239 }
240 k = active_project -> rsparam[j][1] = i;
241 }
242 else if (c == CHA)
243 {
244 if (active_project -> csparam[5] != i)
245 {
246 active_project -> csparam[5] = i;
247 }
248 k = active_project -> csparam[5] = i;
249 }
250 else
251 {
252 if (active_project -> analysis[c] -> num_delta != i)
253 {
254 active_project -> analysis[c] -> num_delta = i;
255 }
256 k = active_project -> analysis[c] -> num_delta;
257 }
258 }
259 if (c < 0)
260 {
261 update_entry_double (entry, active_project -> analysis[-c] -> delta);
262 }
263 else
264 {
265 update_entry_int (entry, k);
266 }
268}
269
278G_MODULE_EXPORT void combox_tunit_changed (GtkComboBox * box, gpointer data)
279{
280 active_project -> tunit = combo_get_active ((GtkWidget *)box);
282}
283
291void calc_sph (GtkWidget * vbox)
292{
293 GtkWidget * hbox;
294 GtkWidget * entry;
295 hbox = create_hbox (0);
296 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
297 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label ( _("Maximum <b><i>l</i></b>, <i>l<sub>max</sub></i> &#x2208; [2-40]"), 200, -1, 0.0, 0.5), FALSE, FALSE, 0);
298 entry = create_entry (G_CALLBACK(set_delta), 100, 15, FALSE, (gpointer)GINT_TO_POINTER(SPH));
299 update_entry_int (GTK_ENTRY(entry), active_project -> analysis[SPH] -> num_delta);
300 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 0);
301}
302
311void calc_msd (GtkWidget * vbox, int cid)
312{
313 int i, j, k, l, m;
314 gchar * val_b[3]={i18n("Number of configurations:"),
315 i18n("\tTime step &#x3b4;t used during the dynamics:"),
316 i18n("\tNumber of step(s) between each configuration:")};
317 gchar * val_c[3]={i18n("Number of configurations:"),
318 i18n("Time step &#x3b4;t"),
319 i18n("Step(s) between conf.")};
320 GtkWidget * hbox;
321 GtkWidget * entry;
322 k = (cid == MSD) ? 15 : 0;
323 l = (cid == MSD) ? 350 : 150;
324 m = (cid == MSD) ? 0 : 5;
325 hbox = create_hbox (k);
326 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
327 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, gtk_label_new (_(val_b[0])), FALSE, FALSE, m);
328 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (g_strdup_printf ("<b>%d</b>",active_project -> steps), -1, 50, 0.5, 0.5), FALSE, FALSE, 10);
329 for (i=1; i<3; i++)
330 {
331 hbox = create_hbox (k);
332 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
333 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label ((cid == MSD) ? _(val_b[i]) : _(val_c[i]), l, -1, 0.0, 0.5), FALSE, FALSE, m);
334 if (i == 1)
335 {
336 entry = create_entry (G_CALLBACK(set_delta), 100, 15, FALSE, (gpointer)GINT_TO_POINTER(-MSD));
337 update_entry_double (GTK_ENTRY(entry), active_project -> analysis[MSD] -> delta);
338 }
339 else
340 {
341 entry = create_entry (G_CALLBACK(set_delta), 100, 15, FALSE, (gpointer)GINT_TO_POINTER(MSD));
342 update_entry_int (GTK_ENTRY(entry), active_project -> analysis[MSD] -> num_delta);
343 }
344 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 2*m);
345 if (i == 1)
346 {
347 GtkWidget * tcombo = create_combo ();
348 for (j=0; j<5 ; j++) combo_text_append (tcombo, untime[j]);
349 combo_set_active (tcombo, active_project -> tunit);
350 g_signal_connect(G_OBJECT(tcombo), "changed", G_CALLBACK(combox_tunit_changed), NULL);
351 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, tcombo, FALSE, FALSE, 0);
352 }
353 }
354}
355
364G_MODULE_EXPORT void set_numa (GtkEntry * entry, gpointer data)
365{
366 const gchar * m = entry_get_text (entry);
367 double v = string_to_double ((gpointer)m);
368 int i, j;
369 i = (int)v;
370 if (i > 0)
371 {
372 if (! search_type)
373 {
374 if (preferences)
375 {
376 tmp_rsparam[3] = i;
377 }
378 else
379 {
380 if (active_project -> rsearch[1] != i) active_project -> rsearch[1] = i;
381 j = active_project -> rsearch[1];
382 }
383 }
384 else
385 {
386 if (preferences)
387 {
388 tmp_csparam[2] = i;
389 }
390 else
391 {
392 if (active_project -> csearch != i) active_project -> csearch = i;
393 j = active_project -> csearch;
394 }
395 }
396 }
397 else
398 {
399 if (preferences)
400 {
401 j = (search_type) ? tmp_csparam[2] : tmp_rsparam[3];
402 }
403 else
404 {
405 j = (search_type) ? active_project -> csearch : active_project -> rsearch[1];
406 }
407 }
408 update_entry_int (entry, j);
409}
410
421GtkWidget * combox_rings (gchar * str, int num, gchar * list_item[num], int id)
422{
423 int i;
424 GtkWidget * hbox = create_hbox (0);
425 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
426 // GtkWidget * fixed = gtk_fixed_new ();
427 rings_box[id] = create_combo ();
428 gtk_widget_set_size_request (rings_box[id], 180, -1);
429 for (i=0; i<num; i++) combo_text_append (rings_box[id], _(list_item[i]));
430 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, rings_box[id], FALSE, FALSE, 10);
431
432 //gtk_fixed_put (GTK_FIXED(fixed), rings_box[id], -1, 5);
433
434 return hbox;
435}
436
437 GtkWidget * rings_entry[2];
438 GtkWidget * rings_check[4];
439
448G_MODULE_EXPORT void combox_rings_changed (GtkComboBox * box, gpointer data)
449{
450 int i, j;
451 int id = GPOINTER_TO_INT(data);
452 if (id == 0)
453 {
454 if (preferences)
455 {
456 tmp_rsparam[0] = combo_get_active ((GtkWidget *)box);
457 }
458 else
459 {
460 active_project -> rsearch[0] = combo_get_active ((GtkWidget *)box);
461 widget_set_sensitive (rings_box[1], (active_project -> rsearch[0]<0) ? 0 : 1);
462 combo_set_active (rings_box[1], active_project -> rsparam[active_project -> rsearch[0]][0]);
463 for (i=0; i<2; i++) widget_set_sensitive (rings_entry[i], (active_project -> rsearch[0]<0) ? 0 : 1);
464 for (i=0; i<3; i++) widget_set_sensitive (rings_check[i], (active_project -> rsearch[0]<0) ? 0 : 1);
465 update_entry_int (GTK_ENTRY(rings_entry[0]), active_project -> rsparam[active_project -> rsearch[0]][1]);
467 for (j=0; j<3; j++)
468 {
469 button_set_status (rings_check[j], active_project -> rsparam[i][j+2]);
470 }
471 }
472 }
473 else
474 {
475 if (search_type)
476 {
477 if (preferences)
478 {
479 tmp_csparam[0] = combo_get_active ((GtkWidget *)box);
480 }
481 else
482 {
483 active_project -> csparam[0] = combo_get_active ((GtkWidget *)box);
484 }
485 }
486 else
487 {
488 if (preferences)
489 {
490 tmp_rsparam[1] = combo_get_active ((GtkWidget *)box);
491 }
492 else
493 {
495 active_project -> rsparam[i][0] = combo_get_active ((GtkWidget *)box);
496 }
497 }
498 }
499}
500
501#ifdef GTK4
510G_MODULE_EXPORT void toggle_rings (GtkCheckButton * but, gpointer data)
511#else
520G_MODULE_EXPORT void toggle_rings (GtkToggleButton * but, gpointer data)
521#endif
522{
523 int oid = GPOINTER_TO_INT(data);
524 int i;
525 gboolean status;
526 status = button_get_status ((GtkWidget *)but);
527 switch (search_type)
528 {
529 case 0:
531 if (preferences)
532 {
533 tmp_rsparam[oid+4] = status;
534 }
535 else
536 {
537 active_project -> rsparam[i][oid+2] = status;
538 }
539 break;
540 case 1:
541 if (preferences)
542 {
543 tmp_csparam[oid+3] = status;
544 }
545 else
546 {
547 active_project -> csparam[oid+1] = status;
548 }
549 if (oid == 0 && status)
550 {
551 for (i=1; i<4; i++)
552 {
554 active_project -> csparam[i+1] = ! status;
555 }
556 }
557 else if (oid == 1 && status)
558 {
560 active_project -> csparam[1] = ! status;
561 }
562 else if (oid == 2 && status)
563 {
565 active_project -> csparam[2] = ! status;
566 }
567 break;
568 }
569}
570
578void calc_rings (GtkWidget * vbox)
579{
580 gchar * defs[6]={i18n("All Rings (No Rule)"),
581 i18n("King's [1, 3]"),
582 i18n("Guttman's [2]"),
583 i18n("Primitives [4, 5, 6]"),
584 i18n("Strongs [4, 5]")};
585 gchar * val_a[2]={i18n("Definition of ring to be used: "), i18n("Atom(s) to initiate the search from: ")};
586 gchar * val_b[2][2]={{i18n("<i><b>n</b><sub>max</sub></i> = maximum size for a ring <sup>*</sup>"),
587 i18n("Maximum number of rings of size <i><b>n</b></i> per MD step <sup>**</sup>")},
588 {i18n("<i><b>n</b><sub>max</sub></i> = maximum size for a chain <sup>*</sup>"),
589 i18n("Maximum number of chains of size <i><b>n</b></i> per MD step <sup>**</sup>")}};
590 gchar * val_c[2][4]={{i18n("Only search for ABAB rings"), i18n("No homopolar bonds in the rings (A-A, B-B ...) <sup>***</sup>"), i18n("No homopolar bonds in the connectivity matrix"), " "},
591 {i18n("Only search for AAAA chains"), i18n("Only search for ABAB chains"),
592 i18n("No homopolar bonds in the chains (A-A, B-B ...) <sup>***</sup>"), i18n("Only search for 1-(2)<sub>n</sub>-1 coordinated atom chains, ie. isolated chains.")}};
593 gchar * start[3]={"<sup>*</sup>", "<sup>**</sup>", "<sup>***</sup>"};
594 gchar * val_d[3]={i18n("in total number of nodes (or atoms)"),
595 i18n("value used for memory allocation = f(<i><b>n</b><sub>max</sub></i>, system studied)"),
596 i18n("but homopolar bonds can shorten the rings")};
597 gchar * val_e={i18n("<sub>[1] S. V. King. <i>Nature</i>, <b>213</b>:1112 (1967).</sub>\n"
598 "<sub>[2] L. Guttman. <i>J. Non-Cryst. Solids.</i>, <b>116</b>:145-147 (1990).</sub>\n"
599 "<sub>[3] D. S. Franzblau. <i>Phys. Rev. B</i>, <b>44</b>(10):4925-4930 (1991).</sub>\n"
600 "<sub>[4] K. Goetzke and H. J. Klein. <i>J. Non-Cryst. Solids.</i>, <b>127</b>:215-220 (1991).</sub>\n"
601 "<sub>[5] X. Yuan and A. N. Cormack. <i>Comp. Mat. Sci.</i>, <b>24</b>:343-360 (2002).</sub>\n"
602 "<sub>[6] F. Wooten. <i>Acta Cryst. A</i>, <b>58</b>(4):346-351 (2002).</sub>")};
603 gchar * list_node[(preferences) ? 2 : active_project -> nspec+1];
604 int i, j, k;
605
606 if (! search_type) add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, combox_rings (_(val_a[0]), 5, defs, 0), FALSE, FALSE, 5);
607
608 list_node[0] = g_strdup_printf (_("All"));
609 if (preferences)
610 {
611 list_node[1] = g_strdup_printf (_("Chemical Species"));
612 }
613 else
614 {
615 for (i=0; i<active_project -> nspec; i++) list_node[i+1] = g_strdup_printf ("%s", active_chem -> label[i]);
616 }
617
618 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, combox_rings (_(val_a[1]), (preferences) ? 2 : active_project -> nspec+1, list_node, 1), FALSE, FALSE, 5);
619
620 j = (preferences) ? tmp_rsparam[0] : active_project -> rsearch[0];
621 k = RIN + search_type;
622 GtkWidget * hbox;
623 for (i=0; i<2; i++)
624 {
625 hbox = create_hbox (0);
626 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
627 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (_(val_b[search_type][i]), 400, -1, 0.0, 0.5), FALSE, FALSE, 0);
628 if (i == 0)
629 {
630 rings_entry[i] = create_entry (G_CALLBACK(set_delta), 100, 15, FALSE, GINT_TO_POINTER(k));
631 if (preferences)
632 {
634 }
635 else
636 {
637 update_entry_int (GTK_ENTRY(rings_entry[i]), (search_type) ? active_project -> csparam[5] : active_project -> rsparam[j][1]);
638 }
639 }
640 else
641 {
642 rings_entry[i] = create_entry (G_CALLBACK(set_numa), 100, 15, FALSE, NULL);
643 if (preferences)
644 {
646 }
647 else
648 {
649 update_entry_int (GTK_ENTRY(rings_entry[i]), (search_type) ? active_project -> csearch : active_project -> rsearch[1]);
650 }
651 }
652 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, rings_entry[i], FALSE, FALSE, 0);
653 if (! search_type && j < 0 && ! preferences) widget_set_sensitive (rings_entry[i], 0);
654 }
655 gboolean status;
656 for (i=0; i<3+search_type; i++)
657 {
658 if (preferences)
659 {
660 status = (search_type) ? tmp_csparam[i+3] : tmp_rsparam[i+4];
661 }
662 else
663 {
664 status = (search_type) ? active_project -> csparam[i+1] : active_project -> rsparam[j][i+2];
665 }
666 rings_check[i] = check_button (_(val_c[search_type][i]), -1, 40, status, G_CALLBACK(toggle_rings), GINT_TO_POINTER(i));
667 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, rings_check[i], FALSE, FALSE, 0);
668 if (! preferences)
669 {
670 if (active_project -> nspec == 1) widget_set_sensitive (rings_check[i], 0);
671 if (! search_type && j < 0) widget_set_sensitive (rings_check[i], 0);
672 }
673 }
674 for (i=0; i<3; i++)
675 {
676 append_comments (vbox, start[i], _(val_d[i]));
677 }
678 if (! search_type)
679 {
680 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label (_(val_e), -1, -1, 0.0, 0.5), FALSE, FALSE, 5);
681 i = 0;
682 g_signal_connect(G_OBJECT(rings_box[0]), "changed", G_CALLBACK(combox_rings_changed), GINT_TO_POINTER(0));
684 widget_set_sensitive (rings_box[1], (preferences) ? 1 : (active_project -> rsearch[0]<0) ? 0 : 1);
685 }
686 i = 1;
687 g_signal_connect(G_OBJECT(rings_box[1]), "changed", G_CALLBACK(combox_rings_changed), GINT_TO_POINTER(i));
688 if (preferences)
689 {
691 }
692 else
693 {
694 combo_set_active (rings_box[1], (search_type) ? active_project -> csparam[0] : active_project -> rsparam[j][0]);
695 }
696}
697
698#ifdef GTK4
708G_MODULE_EXPORT void run_toggle_bond (GtkNativeDialog * info, gint response_id, gpointer data)
709{
710 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
711#else
721G_MODULE_EXPORT void run_toggle_bond (GtkDialog * info, gint response_id, gpointer data)
722{
723 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
724#endif
725 if (response_id == GTK_RESPONSE_ACCEPT)
726 {
727 active_project -> bondfile = file_chooser_get_file_name (chooser);
728 }
729 else
730 {
731 button_set_status (data, FALSE);
732 }
733#ifdef GTK4
735#else
736 destroy_this_dialog (info);
737#endif
738}
739
740#ifdef GTK4
749G_MODULE_EXPORT void toggle_bond (GtkCheckButton * Button, gpointer data)
750#else
759G_MODULE_EXPORT void toggle_bond (GtkToggleButton * Button, gpointer data)
760#endif
761{
762 int i = GPOINTER_TO_INT (data);
763 gboolean status = button_get_status ((GtkWidget *)Button);
764 if (i < 3)
765 {
766 active_project -> runc[i] = status;
767 if (i < 2) widget_set_sensitive (ba_entry[i], status);
768 if (i == 2) frag_update = mol_update = status;
769 }
770 else
771 {
772 if (status)
773 {
774 // To add = do not annoy me with that again !
775 show_info (_("The result of the nearest neighbors analysis\n"
776 "will be saved in a file that you may use afterwards.\n"), 0, MainWindow);
777#ifdef GTK4
778 GtkFileChooserNative * info;
779#else
780 GtkWidget * info;
781#endif
782 info = create_file_chooser (_("Save neighbors analysis in file"),
783 GTK_WINDOW(MainWindow),
784 GTK_FILE_CHOOSER_ACTION_SAVE,
785 _("Save"));
786 GtkFileChooser * chooser = GTK_FILE_CHOOSER(info);
787#ifdef GTK3
788 gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
789#endif
791 gtk_file_chooser_set_current_name (chooser, "neighbors.dat");
792#ifdef GTK4
793 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_toggle_bond), Button);
794#else
795 run_this_gtk_dialog (info, G_CALLBACK(run_toggle_bond), Button);
796#endif
797 }
798 else
799 {
800 active_project -> bondfile = NULL;
801 }
802 }
803}
804
812gboolean test_gr (int rdf)
813{
814 if (active_project -> analysis[rdf] -> num_delta < 2)
815 {
816 show_warning (_("You must specify a number of &#x3b4;r intevals >= 2\n"
817 "to discretize the real space between 0.0 and D<sub>max</sub>\n"), calc_win);
818 return FALSE;
819 }
820 else if (rdf == GDK && (active_project -> analysis[rdf] -> max > active_project -> analysis[SKD] -> max || active_project -> analysis[rdf] -> max <= active_project -> analysis[SKD] -> min))
821 {
822 show_warning (_("You must specify a maximum wave vector Q<sub>max</sub>[FFT]\n"
823 "for the FFT, with Q<sub>min</sub> < Q<sub>max</sub>[FFT] <= Q<sub>max</sub>"), calc_win);
824 return FALSE;
825 }
826 else
827 {
828 return TRUE;
829 }
830}
831
839gboolean test_sq (int fdq)
840{
841 if (active_project -> analysis[fdq] -> max <= active_project -> analysis[fdq] -> min)
842 {
843 show_warning (_("You must specify a maximum wave vector Q<sub>max</sub>\n"
844 "note that Q<sub>max</sub> must be > Q<sub>min</sub>"), calc_win);
845 return FALSE;
846 }
847 else if (active_project -> analysis[fdq] -> num_delta < 2)
848 {
849 show_warning (_("You must specify a number of &#x3b4;q intervals >= 2\n"
850 "to discretize the reciprocal space between 0.0 and Q<sub>max</sub>\n"), calc_win);
851 return FALSE;
852 }
853 else
854 {
855 return TRUE;
856 }
857}
858
864gboolean test_bonds ()
865{
866 if (active_project -> runc[0] && active_project -> analysis[BND] -> num_delta < 2)
867 {
868 show_warning (_("You must specify a number of &#x3b4;r intervals >= 2\n"
869 "to discretize the real space between\n"
870 "the shortest and the highest inter-atomic distances"), calc_win);
871 return FALSE;
872 }
873 if (active_project -> runc[1] && active_project -> analysis[ANG] -> num_delta < 2)
874 {
875 show_warning (_("You must specify a number of &#x3b4;&#x3b8; intervals >= 2\n"
876 "to discretize the angular space between 0 and 180°"), calc_win);
877 return FALSE;
878 }
879 return TRUE;
880}
881
887gboolean test_rings ()
888{
889 int i, j;
890 i = (search_type) ? active_project -> csparam[5] : active_project -> rsparam[active_project -> rsearch[0]][1];
891 j = (search_type) ? active_project -> csearch : active_project -> rsearch[1];
892 gchar * sobj[2]={i18n("ring"), i18n("chain")};
893 gchar * str;
894 if (i == 0)
895 {
896 str = g_strdup_printf (_("You must specify a maximum %s size > 1 for the search"), _(sobj[search_type]));
897 show_warning (str, calc_win);
898 g_free (str);
899 return FALSE;
900 }
901 if (j == 0)
902 {
903 str = g_strdup_printf (_("You must specify a number of %ss per size 'n' and per node\n"
904 "this value is used when allocating the memory to store the results\n"
905 "and depends on both the maximum %s size used in the search\n"
906 "and the system studied.\n"
907 "We recommend a value at least equal to 100.\n"
908 "If it appears that the value given is not big enough\n"
909 "(ex: more than 100 different %ss of size 'n' for a single node)\n"
910 "then the search will failed but the program will propose\n"
911 "you to initiate a new search using a higher value"),
912 sobj[search_type], sobj[search_type], sobj[search_type]);
913 show_warning (str, calc_win);
914 g_free (str);
915 return FALSE;
916 }
917 return TRUE;
918}
919
925gboolean test_sph ()
926{
927 if (active_project -> analysis[SPH] -> num_delta < 2 || active_project -> analysis[SPH] -> num_delta > 40)
928 {
929 show_warning (_("You must specify a number <i>l<sub>max</sub></i> &#x2208; [2-40]"), calc_win);
930 return FALSE;
931 }
932 else
933 {
934 return TRUE;
935 }
936}
937
943gboolean test_msd ()
944{
945 if(active_project -> steps > 1)
946 {
947 if (active_project -> analysis[MSD] -> delta < 1)
948 {
949 show_warning (_("You must specify the time step &#x3b4;t\n"
950 "used to integrate the Newton's equations\n"
951 "of motion during the molecular dynamics\n"), calc_win);
952 return FALSE;
953 }
954 if (active_project -> tunit < 0)
955 {
956 show_warning (_("You must specify the time unit\n"
957 "used to integrate the Newton's equations\n"
958 "of motion during the molecular dynamics\n"), calc_win);
959 return FALSE;
960 }
961 else
962 {
963 return TRUE;
964 }
965 }
966 else
967 {
968 if (active_project -> analysis[MSD] -> num_delta < 1)
969 {
970 show_warning (_("You must specify the number of steps\n"
971 "between each of the %d configurations\n"
972 "found for the molecular dynamics\n"), calc_win);
973 return FALSE;
974 }
975 else
976 {
977 return TRUE;
978 }
979 }
980}
981
987gboolean test_skt ()
988{
989 if (! test_sq(SKT)) return FALSE;
990 if (! test_msd()) return FALSE;
991 if (active_project -> sqw_freq > 0)
992 {
993 return TRUE;
994 }
995 else
996 {
997 show_warning (_("You must specify the number of frequency points\n"), calc_win);
998 return FALSE;
999 }
1000}
1001
1009void calc_bonds (GtkWidget * vbox)
1010{
1011 gchar * val_a[2]={i18n("Number of &#x3b4;r [D<sub>ij</sub>min-D<sub>ij</sub>max]"),
1012 i18n("Number of &#x3b4;&#x3b8; [0-180°]")};
1013 gchar * val_b[4]={i18n("First coordination sphere properties"),
1014 i18n("Bond and dihedral angles distribution"),
1015 i18n("Search for molecules and isolated fragments"),
1016 i18n("Output detailed results in text file")};
1017
1018 GtkWidget * hbox;
1019 int i;
1020 for (i=0; i<3; i++)
1021 {
1022 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox,
1023 check_button (_(val_b[i]), -1, 40, active_project -> runc[i], G_CALLBACK(toggle_bond), (gpointer)GINT_TO_POINTER(i)),
1024 FALSE, FALSE, 0);
1025 if (i < 2)
1026 {
1027 hbox = create_hbox (0);
1028 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
1029 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (_(val_a[i]), 200, -1, 0.0, 0.5), FALSE, FALSE, 0);
1030 ba_entry[i] = create_entry (G_CALLBACK(set_delta), 150, 15, FALSE, (gpointer)GINT_TO_POINTER(BND+i));
1031 update_entry_int (GTK_ENTRY(ba_entry[i]), active_project -> analysis[BND+i] -> num_delta);
1033 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, ba_entry[i], FALSE, FALSE, 0);
1034 }
1035 }
1036 GtkWidget * checkbd = check_button (val_b[i], -1, 40, FALSE, G_CALLBACK(toggle_bond), (gpointer)GINT_TO_POINTER(i));
1037 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, checkbd, FALSE, FALSE, 0);
1038 widget_set_sensitive (checkbd, 1);
1039}
1040
1049GtkWidget * hbox_note (int i, double val)
1050{
1051 gchar * note[3] = {"D<sub>max</sub> = ", "Q<sub>min</sub> = ", "Q<sub>max</sub> = "};
1052 gchar * unit[3] = {" &#xC5;", " &#xC5;<sup>-1</sup>", " &#xC5;<sup>-1</sup>"};
1053 gchar * str;
1054 GtkWidget * hbox = create_hbox (0);
1055 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (note[i], 50, -1, 0.0, 0.5), FALSE, FALSE, 5);
1056 str = g_strdup_printf ("%f", val);
1057 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (str, 100, -1, 1.0, 0.5), FALSE, FALSE, 0);
1058 g_free (str);
1059 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (unit[i], 50, -1, 0.0, 0.5), FALSE, FALSE, 0);
1060 return hbox;
1061}
1062
1063GtkWidget * avbox = NULL;
1064GtkWidget * smbox = NULL;
1067
1076G_MODULE_EXPORT void expand_opt (GtkWidget * exp, gpointer data)
1077{
1078 int i;
1079 i = GPOINTER_TO_INT(data);
1080 GtkExpander * expander = GTK_EXPANDER (exp);
1081 GtkWidget * wind = get_top_level (exp);
1082 gtk_window_set_resizable (GTK_WINDOW (wind), TRUE);
1083 if (gtk_expander_get_expanded (expander))
1084 {
1085 if (i == 1)
1086 {
1088 }
1089 else
1090 {
1092 }
1093 }
1094 else
1095 {
1096 if (i == 1)
1097 {
1099
1100 }
1101 else
1102 {
1104 }
1105 }
1106 gtk_widget_set_size_request (exp, -1, -1);
1107 gtk_window_set_resizable (GTK_WINDOW (wind), FALSE);
1108}
1109
1118G_MODULE_EXPORT void set_advanced_sq (GtkEntry * entry, gpointer data)
1119{
1120 dint * idc = (dint *)data;
1121 const gchar * m = entry_get_text (entry);
1122 double v = string_to_double ((gpointer)m);
1123 double qmin = active_project -> analysis[idc -> a] -> min;
1124 double qmax = active_project -> analysis[idc -> a] -> max;
1125 int idk = (idc -> a == SKD) ? 0 : 1;
1126 if (v != active_project -> sk_advanced[idk][idc -> b])
1127 {
1128 if (idc -> b == 0 && (v < 0.0 || v > 1.0))
1129 {
1130 show_warning (_("You must specify a probability between 0.0 and 1.0"), calc_win);
1131 }
1132 else if (idc -> b == 1 && (v < qmin || v > qmax))
1133 {
1134 show_warning (_("Q<sub>lim</sub> must be &#8805; Q<sub>min</sub> and &#8804; Q<sub>max</sub>"), calc_win);
1135 }
1136 else
1137 {
1138 active_project -> sk_advanced[idk][idc -> b] = v;
1139 }
1140 }
1141 update_entry_double (entry, active_project -> sk_advanced[idk][idc -> b]);
1142}
1143
1152G_MODULE_EXPORT void set_sfact (GtkEntry * entry, gpointer data)
1153{
1154 const gchar * m;
1155 int i = GPOINTER_TO_INT(data);
1156 m = entry_get_text (entry);
1157 double v = string_to_double ((gpointer)m);
1158 if (v <= 0.0 || v >= 1.0)
1159 {
1160 show_warning (_("The smoothing factor must be between 0.0 and 1.0"), calc_win);
1161 }
1162 else
1163 {
1164 active_project -> analysis[i] -> fact = v;
1165 }
1166 update_entry_double (entry, active_project -> analysis[i] -> fact);
1167}
1168
1177G_MODULE_EXPORT void on_show_curve_toolbox (GtkWidget * widg, gpointer data)
1178{
1180 {
1182 }
1183 else
1184 {
1186 }
1187}
1188
1197G_MODULE_EXPORT void on_smoother_released (GtkButton * button, gpointer data)
1198{
1199 int g, h, i, j, k, l, m;
1200
1201 l = GPOINTER_TO_INT(data);
1202 if (active_project -> analysis[l] -> calc_ok)
1203 {
1204 if (l == SKD || l == SKT)
1205 {
1206 xsk = duplicate_double(active_project -> analysis[l] -> curves[0] -> ndata, active_project -> analysis[l] -> curves[0] -> data[0]);
1207 }
1208 g = (l == SKT) ? (active_project -> skt_all_sets) ? active_project -> steps - active_project -> skt_corr_threshold : active_project -> skt_n_data_sets : 1;
1209 h = (l == SKT) ? active_project -> analysis[SKD] -> numc : 1;
1210 for (j=0; j<g; j++)
1211 {
1212 i = 1 + j*h;
1213 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1214 active_project -> analysis[l] -> curves[i-1] -> data[1],
1215 & active_project -> analysis[l] -> fact,
1216 & i,
1217 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1218 & l);
1219 i = i+2;
1220 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1221 active_project -> analysis[l] -> curves[i-1] -> data[1],
1222 & active_project -> analysis[l] -> fact,
1223 & i,
1224 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1225 & l);
1226 i = i+2;
1227 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1228 active_project -> analysis[l] -> curves[i-1] -> data[1],
1229 & active_project -> analysis[l] -> fact,
1230 & i,
1231 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1232 & l);
1233 i = i+2;
1234 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1235 active_project -> analysis[l] -> curves[i-1] -> data[1],
1236 & active_project -> analysis[l] -> fact,
1237 & i,
1238 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1239 & l);
1240 if (l ==GDR || l == GDK)
1241 {
1242 i = i+2;
1243 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1244 active_project -> analysis[l] -> curves[i-1] -> data[1],
1245 & active_project -> analysis[l] -> fact,
1246 & i,
1247 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1248 & l);
1249 i = i+2;
1250 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1251 active_project -> analysis[l] -> curves[i-1] -> data[1],
1252 & active_project -> analysis[l] -> fact,
1253 & i,
1254 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1255 & l);
1256 i = i+2;
1257 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1258 active_project -> analysis[l] -> curves[i-1] -> data[1],
1259 & active_project -> analysis[l] -> fact,
1260 & i,
1261 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1262 & l);
1263 i = i+2;
1264 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1265 active_project -> analysis[l] -> curves[i-1] -> data[1],
1266 & active_project -> analysis[l] -> fact,
1267 & i,
1268 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1269 & l);
1270 }
1271 for (k=0 ; k<active_project -> nspec ; k++)
1272 {
1273 for (m=0 ; m<active_project -> nspec ; m++)
1274 {
1275 i = i+2;
1276 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1277 active_project -> analysis[l] -> curves[i-1] -> data[1],
1278 & active_project -> analysis[l] -> fact,
1279 & i,
1280 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1281 & l);
1282 if (l == GDR || l == GDK)
1283 {
1284 i = i+2;
1285 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1286 active_project -> analysis[l] -> curves[i-1] -> data[1],
1287 & active_project -> analysis[l] -> fact,
1288 & i,
1289 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1290 & l);
1291 i = i+1;
1292 }
1293 }
1294 }
1295 if (l == SQD || l == SKD || l == SKT)
1296 {
1297 for (k=0 ; k<active_project -> nspec ; k++)
1298 {
1299 for (m=0 ; m<active_project -> nspec ; m++)
1300 {
1301 i = i+2;
1302 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1303 active_project -> analysis[l] -> curves[i-1] -> data[1],
1304 & active_project -> analysis[l] -> fact,
1305 & i,
1306 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1307 & l);
1308 }
1309 }
1310 }
1311 if (active_project -> nspec == 2)
1312 {
1313 m = 3;
1314 if (l == SQD || l == SKD || l == SKT) m = m+1;
1315 for (k=0 ; k<m; k++)
1316 {
1317 i = i+2;
1318 smooth_and_save_ (active_project -> analysis[l] -> curves[i-1] -> data[0],
1319 active_project -> analysis[l] -> curves[i-1] -> data[1],
1320 & active_project -> analysis[l] -> fact,
1321 & i,
1322 & active_project -> analysis[l] -> curves[i-1] -> ndata,
1323 & l);
1324 }
1325 }
1326 }
1327 if (l == SKD || l == SKT)
1328 {
1329 g_free (xsk);
1330 xsk = NULL;
1331 }
1332 fill_tool_model ();
1334 if (l == GDR || l == GDK)
1335 {
1336 for (i=0; i<4; i=i+3) update_after_calc (i);
1337 }
1338 else if (l == SQD || l == SKD)
1339 {
1340 for (i=1; i<3; i++) update_after_calc (i);
1341 }
1342 else
1343 {
1345 }
1346 }
1347 else
1348 {
1349 show_error (_("No data set(s) to be smoothed\n"), 0, calc_win);
1350 }
1351}
1352
1362void add_advanced_options (int skq, dint skadv[2], GtkWidget * vbox)
1363{
1364 gchar * adv_name[2]={i18n("Probability to keep wave\nvector <i>q</i> > Q<sub>lim</sub> &#x2208; [0.0-1.0]"),
1365 i18n("Q<sub>lim</sub> [&#xC5;<sup>-1</sup>] &#x2208; [Q<sub>min</sub>-Q<sub>max</sub>]")};
1366 GtkWidget * advanced_options = create_expander (_(" Advanced options"), NULL);
1367 gtk_widget_set_size_request (advanced_options, -1, 20);
1368 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, advanced_options, FALSE, TRUE, 10);
1369 avbox = create_vbox (5);
1370 GtkWidget * ahbox;
1371 GtkWidget * fixed;
1372 GtkWidget * aentry;
1373 int i, j;
1374 i = (skq == SKT) ? 1 : 0;
1375 for (j=0; j<2; j++)
1376 {
1377 ahbox = create_hbox (5);
1378 add_box_child_start (GTK_ORIENTATION_VERTICAL, avbox, ahbox, FALSE, FALSE, 5);
1379 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ahbox, markup_label (_(adv_name[j]), 175, -1, 0.0, 0.5), FALSE, FALSE, 5);
1380 aentry = create_entry (G_CALLBACK(set_advanced_sq), 100, 15, FALSE, & skadv[j]);
1381 update_entry_double (GTK_ENTRY(aentry), active_project -> sk_advanced[i][j]);
1382 fixed = gtk_fixed_new ();
1383 gtk_fixed_put (GTK_FIXED(fixed), aentry, 0.0, 0.0);
1384 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ahbox, fixed, FALSE, FALSE, 10);
1385 }
1386 g_signal_connect (G_OBJECT(advanced_options), "activate", G_CALLBACK(expand_opt), GINT_TO_POINTER(i));
1387 add_container_child (CONTAINER_EXP, advanced_options, avbox);
1388 show_the_widgets (advanced_options);
1389 widget_set_sensitive (advanced_options, 1);
1390}
1391
1400void add_smoothing_options (int grsqk, GtkWidget * vbox)
1401{
1402 GtkWidget * smooth_options = create_expander (_(" Gaussian data smoothing"), NULL);
1403 gtk_widget_set_size_request (smooth_options, -1, 20);
1404 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, smooth_options, FALSE, TRUE, 10);
1405 GtkWidget * avbox = create_vbox (5);
1406 GtkWidget * smbox = create_hbox (0);
1407 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, smbox, gtk_label_new(_("Factor [0.0-1.0]")), FALSE, FALSE, 0);
1408 GtkWidget * sentry = create_entry (G_CALLBACK(set_sfact), 100, 15, FALSE, GINT_TO_POINTER(grsqk));
1409 update_entry_double (GTK_ENTRY(sentry), active_project -> analysis[grsqk] -> fact);
1410 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, smbox, sentry, FALSE, TRUE, 10);
1411 GtkWidget * smooth = create_button (_("Smooth"), IMG_NONE, NULL, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(on_smoother_released), GINT_TO_POINTER(grsqk));
1412 g_signal_connect (G_OBJECT(smooth_options), "activate", G_CALLBACK(expand_opt), GINT_TO_POINTER(0));
1413 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, smbox, smooth, FALSE, FALSE, 0);
1414 add_box_child_start (GTK_ORIENTATION_VERTICAL, avbox, smbox, FALSE, FALSE, 5);
1415 add_container_child (CONTAINER_EXP, smooth_options, avbox);
1416 show_the_widgets (smooth_options);
1417 widget_set_sensitive (smooth_options, 1);
1418}
1419
1428void calc_gr_sq (GtkWidget * box, int id)
1429{
1430 gchar * val_a[4]={i18n("Number of &#x3b4;r steps"),
1431 i18n("Number of &#x3b4;q steps"),
1432 i18n("Number of &#x3b4;q steps"),
1433 i18n("Number of &#x3b4;r steps")};
1434 gchar * val_b[3]={i18n("Q<sub>max</sub> [&#xC5;<sup>-1</sup>]"),
1435 i18n("Q<sub>max</sub> [&#xC5;<sup>-1</sup>]"),
1436 i18n("Q<sub>max</sub> for the FFT [&#xC5;<sup>-1</sup>]")};
1437
1438 if (id == SKD)
1439 {
1440 skadv[0].a = skadv[1].a = SKD;
1441 skadv[0].b = 0;
1442 skadv[1].b = 1;
1443 }
1444 GtkWidget * vbox = create_vbox (5);
1445 add_box_child_start (GTK_ORIENTATION_VERTICAL, box, vbox, FALSE, FALSE, 0);
1446 GtkWidget * hbox = create_hbox (0);
1447 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
1448 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (_(val_a[id]), 150, -1, 0.0, 0.5), FALSE, FALSE, 10);
1449 GtkWidget * entry= create_entry (G_CALLBACK(set_delta), 100, 15, FALSE, GINT_TO_POINTER(id));
1450 update_entry_int (GTK_ENTRY(entry), active_project -> analysis[id] -> num_delta);
1451 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1452 if (id > GDR)
1453 {
1454 hbox = create_hbox (0);
1455 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
1456 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (_(val_b[id-1]), 150, -1, 0.0, 0.5), FALSE, FALSE, 10);
1457 GtkWidget * entry= create_entry (G_CALLBACK(set_max), 100, 15, FALSE, GINT_TO_POINTER(id));
1458 update_entry_double (GTK_ENTRY(entry), active_project -> analysis[id] -> max);
1459 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1460 }
1461
1462 if (id == GDR || id == GDK)
1463 {
1464 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox_note (0, active_project -> analysis[GDR] -> max), FALSE, FALSE, 0);
1465 }
1466 if (id == SQD)
1467 {
1468 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox_note (1, active_project -> analysis[SQD] -> min), FALSE, FALSE, 0);
1469 }
1470 if (id == SKD|| id == GDK)
1471 {
1472 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox_note (1, active_project -> analysis[SKD] -> min), FALSE, FALSE, 0);
1473 }
1474 if (id == GDK)
1475 {
1476 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox_note (2, active_project -> analysis[SKD] -> max), FALSE, FALSE, 0);
1477 }
1478 if (id == GDR || id == GDK)
1479 {
1480 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox,
1481 markup_label (_("D<sub>max</sub> is the maximum inter-atomic distance in the model"), -1, -1, 0.0, 0.5),
1482 FALSE, FALSE, 0);
1483 }
1484 if (id > 0)
1485 {
1486 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox,
1487 markup_label (_("Q<sub>min</sub> is the minimum wave vector for the model"), -1, -1, 0.0, 0.5),
1488 FALSE, FALSE, 0);
1489 }
1490 if (id == GDK)
1491 {
1492 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox,
1493 markup_label (_("Q<sub>max</sub> is the maximum wave vector to compute S(q)"), -1, -1, 0.0, 0.5),
1494 FALSE, FALSE, 0);
1495 }
1496
1497 vbox = create_vbox (BSEP);
1498 add_box_child_start (GTK_ORIENTATION_VERTICAL, box, vbox, FALSE, FALSE, 0);
1499
1500 if (id == SKD) add_advanced_options (SKD, skadv, vbox);
1501
1503}
1504
1505GtkWidget * skt_all_info = NULL;
1506GtkWidget * sktqw_vbox[2];
1507GtkWidget * sktqw_delta[2];
1508GtkWidget * t_q_vbox[2];
1509GtkWidget * skt_res_info;
1510
1519G_MODULE_EXPORT void set_skt_step_id (GtkEntry * res, gpointer data)
1520{
1521 int sid = GPOINTER_TO_INT (data);
1522 const gchar * m = entry_get_text (res);
1523 int v = (int) string_to_double ((gpointer)m);
1524 if (sid && sid < active_project -> skt_n_data_sets - 1)
1525 {
1526 if (v > active_project -> skt_step_id[sid-1] && v < active_project -> skt_step_id[sid+1]) active_project -> skt_step_id[sid] = v;
1527 }
1528 else if (sid)
1529 {
1530 if (v > active_project -> skt_step_id[sid-1]) active_project -> skt_step_id[sid] = v;
1531 }
1532 else if (! sid && active_project -> skt_n_data_sets > 1)
1533 {
1534 if (v < active_project -> skt_step_id[sid+1]) active_project -> skt_step_id[sid] = v;
1535 }
1536 update_entry_int (res, active_project -> skt_step_id[sid]);
1537}
1538
1547G_MODULE_EXPORT void set_sqw_q_id (GtkEntry * res, gpointer data)
1548{
1549 int sid = GPOINTER_TO_INT (data);
1550 const gchar * m = entry_get_text (res);
1551 double v = string_to_double ((gpointer)m);
1552 if (sid && sid < active_project -> sqw_n_data_sets - 1)
1553 {
1554 if (v > active_project -> sqw_q_id[sid-1] && v < active_project -> sqw_q_id[sid+1]) active_project -> sqw_q_id[sid] = v;
1555 }
1556 else if (sid)
1557 {
1558 if (v > active_project -> sqw_q_id[sid-1] && v <= active_project -> analysis[SKT] -> max) active_project -> sqw_q_id[sid] = v;
1559 }
1560 else if (! sid && active_project -> sqw_n_data_sets > 1)
1561 {
1562 if (v < active_project -> sqw_q_id[sid+1] && v >= active_project -> analysis[SKT] -> min) active_project -> sqw_q_id[sid] = v;
1563 }
1564 update_entry_double (res, active_project -> sqw_q_id[sid]);
1565}
1566
1576{
1577 t_q_vbox[calc] = destroy_this_widget (t_q_vbox[calc]);
1578 switch (calc)
1579 {
1580 case 0:
1581 if (active_project -> skt_step_id) g_free (active_project -> skt_step_id);
1582 active_project -> skt_step_id = NULL;
1583 break;
1584 case 1:
1585 if (active_project -> sqw_q_id) g_free (active_project -> sqw_q_id);
1586 active_project -> sqw_q_id = NULL;
1587 break;
1588 }
1589 if (val)
1590 {
1591 t_q_vbox[calc] = create_vbox(0);
1592 add_box_child_start (GTK_ORIENTATION_VERTICAL, sktqw_delta[calc], t_q_vbox[calc], FALSE, FALSE, 0);
1593 int delta_t;
1594 double delta_q;
1595 if (! calc)
1596 {
1597 active_project -> skt_n_data_sets = min (val, active_project -> steps - active_project -> skt_corr_threshold);
1598 delta_t = (active_project -> steps - active_project -> skt_corr_threshold) / active_project -> skt_n_data_sets;
1599 active_project -> skt_step_id = allocint (active_project -> skt_n_data_sets);
1600 }
1601 else
1602 {
1603 active_project -> sqw_n_data_sets = val;
1604 active_project -> sqw_q_id = allocdouble (active_project -> sqw_n_data_sets);
1605 delta_q = (active_project -> analysis[SKT] -> max - active_project -> analysis[SKT] -> min)/active_project -> sqw_n_data_sets;
1606
1607 }
1608 int i, j;
1609 GtkWidget * hbox;
1610 GtkWidget * entry;
1611 j = (! calc) ? active_project -> skt_n_data_sets : active_project -> sqw_n_data_sets;
1612 for (i=0; i<j; i++)
1613 {
1614 if (! calc)
1615 {
1616 active_project -> skt_step_id[i] = 1 + i*delta_t;
1617 }
1618 else
1619 {
1620 active_project -> sqw_q_id[i] = active_project -> analysis[SKT] -> min + i*delta_q;
1621 }
1622 hbox = create_hbox (0);
1623 add_box_child_start (GTK_ORIENTATION_VERTICAL, t_q_vbox[calc], hbox, FALSE, FALSE, 0);
1624 if (! calc)
1625 {
1626 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (g_strdup_printf("%d)\t&#x3b4;t= ", i+1), 150, -1, 0.75, 0.5), FALSE, FALSE, 10);
1627 entry = create_entry (G_CALLBACK(set_skt_step_id), 100, 15, FALSE, GINT_TO_POINTER(i));
1628 update_entry_int (GTK_ENTRY(entry), active_project -> skt_step_id[i]);
1629 }
1630 else
1631 {
1632 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (g_strdup_printf("%d)\tq= ", i+1), 150, -1, 0.75, 0.5), FALSE, FALSE, 10);
1633 entry = create_entry (G_CALLBACK(set_sqw_q_id), 100, 15, FALSE, GINT_TO_POINTER(i));
1634 update_entry_double (GTK_ENTRY(entry), active_project -> sqw_q_id[i]);
1635 }
1636 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1637 }
1639 }
1640}
1641
1650G_MODULE_EXPORT void set_t_q_spin (GtkSpinButton * res, gpointer data)
1651{
1652 if (! preferences) add_remove_t_steps_q_vectors (gtk_spin_button_get_value_as_int(res), GPOINTER_TO_INT(data));
1653}
1654
1663{
1664 sktqw_delta[cid] = create_vbox(0);
1665 t_q_vbox[cid] = NULL;
1666 add_box_child_start (GTK_ORIENTATION_VERTICAL, sktqw_vbox[cid], sktqw_delta[cid], FALSE, FALSE, 0);
1667 gchar * aco_info = g_strdup_printf ("%s", (! cid) ? _("Number of <b>&#x3b4;t</b> results to save") : _("Number of <b>q</b> vectors to analyze"));
1668 GtkWidget * hbox = create_hbox (0);
1669 add_box_child_start (GTK_ORIENTATION_VERTICAL, sktqw_delta[cid], hbox, FALSE, FALSE, 5);
1670 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (aco_info, 150, -1, 0.0, 0.5), FALSE, FALSE, 10);
1671 g_free (aco_info);
1672 int val, vbl;
1673 if (! cid)
1674 {
1675 val = (preferences) ? tmp_skt_n_sets : active_project -> skt_n_data_sets;
1676 vbl = (preferences) ? 100 : active_project -> steps-active_project -> skt_corr_threshold;
1677 }
1678 else
1679 {
1680 val = (preferences) ? tmp_sqw_n_sets : active_project -> sqw_n_data_sets;
1681 vbl = 100;
1682 }
1683 GtkWidget * spin = spin_button (G_CALLBACK(set_t_q_spin), val, 1.0, vbl, 1.0, 0, 100, GINT_TO_POINTER(cid));
1684 gtk_widget_set_size_request (spin, 25, -1);
1685 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, spin, FALSE, FALSE, 10);
1687}
1688
1697G_MODULE_EXPORT void set_correlations (GtkEntry * entry, gpointer data)
1698{
1699 const gchar * m;
1700 m = entry_get_text (entry);
1701 int v = (int) string_to_double ((gpointer)m);
1702 int pid = GPOINTER_TO_INT(data);
1703 switch (pid)
1704 {
1705 case 0:
1706 if (v <= 0 || v >= active_project -> steps-1)
1707 {
1708 show_warning (_("This value must be &#62; 0 and &#60; number of steps"), calc_win);
1709 }
1710 else
1711 {
1712 active_project -> skt_corr_threshold = v;
1713 gchar * str = g_strdup_printf (_("%d calculation results in total !"), active_project -> analysis[SKD] -> numc * (active_project -> steps - active_project -> skt_corr_threshold));
1715 skt_all_info = markup_label (str, -1, -1, 0.5, 0.5);
1716 g_free (str);
1717 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, skt_res_info, skt_all_info, FALSE, FALSE, 5);
1719 add_remove_t_steps_q_vectors (active_project -> skt_n_data_sets, 0);
1721 }
1722 update_entry_int (entry, active_project -> skt_corr_threshold);
1723 break;
1724 case 1:
1725 if (v <= 0)
1726 {
1727 show_warning (_("This value must be > 0"), calc_win);
1728 }
1729 else
1730 {
1731 if (preferences)
1732 {
1733 tmp_sqw_freq = v;
1734 }
1735 else
1736 {
1737 active_project -> sqw_freq = v;
1738 }
1739 }
1740 update_entry_int (entry, (preferences) ? tmp_sqw_freq : active_project -> sqw_freq);
1741 break;
1742 }
1743}
1744
1745#ifdef GTK4
1754G_MODULE_EXPORT void toggle_skt_all (GtkCheckButton * but, gpointer data)
1755#else
1764G_MODULE_EXPORT void toggle_skt_all (GtkToggleButton * but, gpointer data)
1765#endif
1766{
1767 gboolean status = button_get_status ((GtkWidget *)but);
1768 if (! preferences)
1769 {
1771 }
1772 else
1773 {
1775 }
1777 if (! preferences)
1778 {
1780 if (status)
1781 {
1783 if (active_project -> skt_step_id) g_free (active_project -> skt_step_id);
1784 active_project -> skt_step_id = NULL;
1785 active_project -> skt_n_data_sets = 1;
1786 active_project -> skt_step_id = allocint (1);
1787 active_project -> skt_step_id[0] = -1;
1788 }
1789 else
1790 {
1791 active_project -> skt_corr_threshold = (active_project -> steps < 20) ? 1 : 10;
1792 active_project -> skt_n_data_sets = min (5, active_project -> steps);
1793 add_remove_t_steps_q_vectors (active_project -> skt_n_data_sets, 0);
1795 }
1796 }
1797
1798}
1799
1807void calc_sk_t (GtkWidget * box)
1808{
1809 skadv[0].a = skadv[1].a = SKT;
1810 skadv[0].b = 0;
1811 skadv[1].b = 1;
1812
1813 GtkWidget * vbox = create_vbox (5);
1814 add_box_child_start (GTK_ORIENTATION_VERTICAL, box, vbox, FALSE, FALSE, 0);
1815 GtkWidget * hbox_skt = create_hbox (0);
1816 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox_skt, FALSE, FALSE, 5);
1817 GtkWidget * vbox_skt[2];
1818
1819 int i, j;
1820 j = (preferences) ? 1 : 2;
1821 for (i=0; i<j; i++)
1822 {
1823 vbox_skt[i] = create_vbox(BSEP);
1824 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox_skt, vbox_skt[i], FALSE, FALSE, 10);
1825 }
1826
1827 if (! preferences)
1828 {
1829 if (! active_project -> skt_step_id)
1830 {
1831 active_project -> skt_n_data_sets = default_skt_n_sets;
1832 }
1833 if (! active_project -> sqw_q_id)
1834 {
1835 active_project -> sqw_n_data_sets = default_sqw_n_sets;
1836 }
1837 }
1838
1839 GtkWidget * hbox = create_hbox (0);
1840 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox, FALSE, FALSE, 0);
1841
1842 gchar * str = g_strdup_printf ("%s", _("Number of &#x3b4;q steps"));
1843 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (str, 150, -1, 0.0, 0.5), FALSE, FALSE, 5);
1844 g_free (str);
1845 GtkWidget * entry = create_entry (G_CALLBACK(set_delta), 100, 15, FALSE, GINT_TO_POINTER(SKT));
1846 update_entry_int (GTK_ENTRY(entry), (preferences) ? tmp_num_delta[SKT-2] : active_project -> analysis[SKT] -> num_delta);
1847 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1848
1849 if (! preferences)
1850 {
1851 hbox = create_hbox (0);
1852 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox, FALSE, FALSE, 5);
1853 str = g_strdup_printf ("%s", _("Q<sub>max</sub> [&#xC5;<sup>-1</sup>]"));
1854 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (str, 150, -1, 0.0, 0.5), FALSE, FALSE, 5);
1855 g_free (str);
1856 entry= create_entry (G_CALLBACK(set_max), 100, 15, FALSE, GINT_TO_POINTER(SKT));
1857 update_entry_double (GTK_ENTRY(entry), active_project -> analysis[SKT] -> max);
1858 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1859
1860 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox_note (1, active_project -> analysis[SKT] -> min), FALSE, FALSE, 5);
1861 hbox = create_hbox (0);
1862 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox, FALSE, FALSE, 0);
1863 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox,
1864 markup_label (_("Q<sub>min</sub> is the minimum wave vector for the model"), -1, -1, 0.0, 0.5),
1865 FALSE, FALSE, 5);
1866
1867 hbox = create_hbox (0);
1868 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox, FALSE, FALSE, 5);
1869 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label ("&#x3b4;t<sub>min</sub>", 150, -1, 0.0, 0.5), FALSE, FALSE, 5);
1870 entry = create_entry (G_CALLBACK(set_correlations), 100, 15, FALSE, GINT_TO_POINTER(0));
1871 update_entry_int (GTK_ENTRY(entry), active_project -> skt_corr_threshold);
1872 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1873 hbox = create_hbox (0);
1874 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox, FALSE, FALSE, 0);
1875 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox,
1876 markup_label (_("&#x3b4;t<sub>min</sub> is the correlation threshold"), -1, -1, 0.0, 0.5),
1877 FALSE, FALSE, 5);
1878 }
1879
1880 if (! preferences)
1881 {
1882 calc_msd (vbox_skt[0], SKT);
1883 }
1884 else
1885 {
1886 dyna_parameters (vbox_skt[0], SKT-2);
1887 }
1888 hbox = create_hbox (0);
1889 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], hbox, FALSE, FALSE, 5);
1890 str = g_strdup_printf ("%s", _("&#969; points in [0.0, &#969;<sub>max</sub>]"));
1891 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label (str, 150, -1, 0.0, 0.5), FALSE, FALSE, 5);
1892 g_free (str);
1893 entry = create_entry (G_CALLBACK(set_correlations), 100, 15, FALSE, GINT_TO_POINTER(1));
1894 update_entry_int (GTK_ENTRY(entry), (preferences) ? tmp_sqw_freq : active_project -> sqw_freq);
1895 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, entry, FALSE, FALSE, 10);
1898 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[0], omega_max_hbox, FALSE, FALSE, 5);
1900 if (! preferences)
1901 {
1902 add_advanced_options (SKT, skadv, vbox_skt[0]);
1903 add_smoothing_options (SKT, vbox_skt[0]);
1904 }
1905 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[(preferences) ? 0 : 1], markup_label (_("<b>Results</b>"), -1, -1, 0.0, 0.5), FALSE, FALSE, (preferences) ? 10 : 0);
1906 GtkWidget * tbox = create_vbox(0);
1907 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[(preferences) ? 0 : 1], tbox, FALSE, FALSE, 5);
1908 add_box_child_start (GTK_ORIENTATION_VERTICAL, tbox, markup_label (_("<b>atomes</b> cannot yet display 3D results,"), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
1909 add_box_child_start (GTK_ORIENTATION_VERTICAL, tbox, markup_label (_("but we are working to add this feature !"), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
1910 add_box_child_start (GTK_ORIENTATION_VERTICAL, tbox, markup_label (_("For the time being you need to select"), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
1911 add_box_child_start (GTK_ORIENTATION_VERTICAL, tbox, markup_label (_("what to display using the 2D graph system:"), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
1912
1913 GtkWidget * notebook = gtk_notebook_new ();
1914#ifdef GTK4
1915 gtk_widget_set_vexpand (notebook, TRUE);
1916#endif
1917 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox_skt[(preferences) ? 0 : 1], notebook, TRUE, TRUE, (preferences) ? 10 : 5);
1918
1919 GtkWidget * nbox;
1920 GtkWidget * scroll;
1921 for (i=0; i<2; i++)
1922 {
1923 scroll = create_scroll (NULL, 200, (preferences) ? 100 : 350, GTK_SHADOW_NONE);
1924 nbox = create_vbox(BSEP);
1925 add_container_child (CONTAINER_SCR, scroll, nbox);
1926 if (! i)
1927 {
1928 add_box_child_start (GTK_ORIENTATION_VERTICAL, nbox, check_button(_("All <b>&#x3b4;t</b> correlated calculations"), -1, -1, FALSE, G_CALLBACK(toggle_skt_all), NULL), FALSE, FALSE, 5);
1929 if (! preferences)
1930 {
1931 str = g_strdup_printf (_("%d calculation results in total !"), active_project -> analysis[SKD] -> numc * (active_project -> steps - active_project -> skt_corr_threshold));
1932 skt_all_info = markup_label (str, -1, -1, 0.5, 0.5);
1933 g_free (str);
1935 add_box_child_start (GTK_ORIENTATION_VERTICAL, nbox, skt_res_info, FALSE, FALSE, 5);
1936 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, skt_res_info, skt_all_info, FALSE, FALSE, 5);
1937 }
1938 }
1939 sktqw_vbox[i] = create_vbox(0);
1940 add_box_child_start (GTK_ORIENTATION_VERTICAL, nbox, sktqw_vbox[i], FALSE, FALSE, 0);
1943 if (! preferences)
1944 {
1945 if (! i && ! active_project -> skt_all_sets)
1946 {
1947 add_remove_t_steps_q_vectors (active_project -> skt_n_data_sets, 0);
1948 }
1949 else if (i)
1950 {
1951 add_remove_t_steps_q_vectors (active_project -> sqw_n_data_sets, 1);
1952 }
1953 }
1955 gtk_notebook_append_page (GTK_NOTEBOOK(notebook), scroll,
1956 markup_label((! i) ? _("<b>Intermediate scattering</b>: F(q,&#x3b4;t)") : _("<b>Dynamic calculations</b>: S(q,&#969;)"), -1, -1, 0.0, 0.5));
1957 }
1958}
1959
1969G_MODULE_EXPORT void run_on_calc_activate (GtkDialog * dial, gint response_id, gpointer data)
1970{
1971 int i;
1972 int id = GPOINTER_TO_INT(data);
1973 switch (response_id)
1974 {
1975 case GTK_RESPONSE_APPLY:
1976 switch (id)
1977 {
1978 case GDR:
1979 if (test_gr (GDR)) on_calc_gr_released (calc_win, NULL);
1980 break;
1981 case SQD:
1982 if (test_sq (SQD)) on_calc_sq_released (calc_win, NULL);
1983 break;
1984 case SKD:
1985 if (test_sq (SKD)) on_calc_sk_released (calc_win, NULL);
1986 break;
1987 case GDK:
1988 if (test_gr (GDK)) on_calc_gq_released (calc_win, NULL);
1989 break;
1990 case BND:
1992 break;
1993 case RIN-1:
1994 if (test_rings ())
1995 {
1996 //show_the_widgets (spinner);
1997 //gtk_spinner_start (GTK_SPINNER(spinner));
1999 //gtk_spinner_stop (GTK_SPINNER(spinner));
2000 //hide_the_widgets (spinner);
2001 }
2002 break;
2003 case CHA-1:
2004 if (test_rings ())
2005 {
2006 //show_the_widgets (spinner);
2007 //gtk_spinner_start (GTK_SPINNER(spinner));
2009 //gtk_spinner_stop (GTK_SPINNER(spinner));
2010 //hide_the_widgets (spinner);
2011 }
2012 break;
2013 case SPH-1:
2014 if (test_sph ()) on_calc_sph_released (calc_win, NULL);
2015 break;
2016 case MSD-1:
2017 if (test_msd ()) on_calc_msd_released (calc_win, NULL);
2018 break;
2019 case SKT-1:
2020 if (test_skt ()) on_calc_skt_released (calc_win, NULL);
2021 default:
2022 break;
2023 }
2024 break;
2025 default:
2026 frag_update = mol_update = 0;
2027 for (i=0; i<3; i++) active_project -> runc[i] = FALSE;
2028 if (id == SKT-1)
2029 {
2033 }
2035 destroy_this_dialog (dial);
2037 break;
2038 }
2039}
2040
2049G_MODULE_EXPORT void on_calc_activate (GtkWidget * widg, gpointer data)
2050{
2051 int id = GPOINTER_TO_INT(data);
2052 calc_win = calc_window(id);
2053 GtkWidget * box = dialog_get_content_area (calc_win);
2054 gtk_box_set_homogeneous (GTK_BOX(box), FALSE);
2055 switch (id)
2056 {
2057 case BND:
2058 calc_bonds (box);
2059 break;
2060 case RIN-1:
2061 search_type = 0;
2062 calc_rings (box);
2063 break;
2064 case CHA-1:
2065 search_type = 1;
2066 calc_rings (box);
2067 break;
2068 case SPH-1:
2069 calc_sph (box);
2070 break;
2071 case MSD-1:
2072 calc_msd (box, MSD);
2073 break;
2074 case SKT-1:
2075 calc_sk_t (box);
2076 break;
2077 default:
2078 calc_gr_sq (box, id);
2079 break;
2080 }
2081
2082#ifndef GTK4
2083 gtk_window_set_icon (GTK_WINDOW (calc_win), gdk_pixbuf_new_from_file(graph_img[(id < ANG) ? id : id+1], NULL));
2084#endif
2085 GtkWidget * vbox = create_vbox (BSEP);
2086 gtk_widget_set_size_request (vbox, -1, 30);
2087 add_box_child_start (GTK_ORIENTATION_VERTICAL, box, vbox, FALSE, FALSE, 0);
2089}
Binding to the Fortran90 subroutines.
int smooth_and_save_(double *, double *, double *, int *, int *, int *)
gboolean test_sph()
is it safe to compute spherical harmonics ?
Definition calc_menu.c:925
void calc_bonds(GtkWidget *vbox)
creation of the bond calculation widgets
Definition calc_menu.c:1009
void update_omega_max()
update omega max information string
Definition calc_menu.c:159
GtkWidget * sktqw_vbox[2]
Definition calc_menu.c:1506
G_MODULE_EXPORT void combox_tunit_changed(GtkComboBox *box, gpointer data)
change time units
Definition calc_menu.c:278
G_MODULE_EXPORT void on_calc_msd_released(GtkWidget *widg, gpointer data)
compute MSD
Definition msdcall.c:168
G_MODULE_EXPORT void on_calc_skt_released(GtkWidget *widg, gpointer data)
callback to compute the dynamic structure factor analysis
Definition sktcall.c:326
void add_correlations_options(int cid)
add correlation(s) options to the S(k,t) calculation dialog
Definition calc_menu.c:1662
GtkWidget * omega_max_hbox
Definition calc_menu.c:151
GtkWidget * combox_rings(gchar *str, int num, gchar *list_item[num], int id)
create a combo box for the ring statistics calculation
Definition calc_menu.c:421
void add_remove_t_steps_q_vectors(int val, int calc)
add or remove t steps results to save
Definition calc_menu.c:1575
GtkWidget * rings_box[2]
Definition calc_menu.c:150
GtkWidget * smbox
Definition calc_menu.c:1064
G_MODULE_EXPORT void on_show_curve_toolbox(GtkWidget *widg, gpointer data)
show the curve toolboxes
Definition calc_menu.c:1177
G_MODULE_EXPORT void on_calc_rings_released(GtkWidget *widg, gpointer data)
compute ring statistics
Definition ringscall.c:426
int avsize
Definition calc_menu.c:1066
G_MODULE_EXPORT void toggle_bond(GtkToggleButton *Button, gpointer data)
activate bond properties detailed saving and prepare the dialog
Definition calc_menu.c:759
void add_smoothing_options(int grsqk, GtkWidget *vbox)
add gaussian smoothing options
Definition calc_menu.c:1400
GtkWidget * hbox_note(int i, double val)
foot note message box with some parameters
Definition calc_menu.c:1049
G_MODULE_EXPORT void combox_rings_changed(GtkComboBox *box, gpointer data)
change ring statistics calculation parameter
Definition calc_menu.c:448
gboolean test_sq(int fdq)
is it safe to compute s(q) ?
Definition calc_menu.c:839
void calc_sph(GtkWidget *vbox)
creation of the spherical harmonics calculation widgets
Definition calc_menu.c:291
G_MODULE_EXPORT void set_t_q_spin(GtkSpinButton *res, gpointer data)
set the number of t steps results to save - spin button
Definition calc_menu.c:1650
GtkWidget * rings_entry[2]
Definition calc_menu.c:437
G_MODULE_EXPORT void on_calc_chains_released(GtkWidget *widg, gpointer data)
compute chains statistics
Definition chainscall.c:304
gboolean test_rings()
is it safe to compute ring statistics ?
Definition calc_menu.c:887
GtkWidget * omega_max_info
Definition calc_menu.c:152
G_MODULE_EXPORT void run_on_calc_activate(GtkDialog *dial, gint response_id, gpointer data)
create a calculation dialog: run the dialog
Definition calc_menu.c:1969
gboolean test_skt()
is it safe to compute dynamic structure factors ?
Definition calc_menu.c:987
dint skadv[2]
Definition calc_menu.c:1065
G_MODULE_EXPORT void on_calc_gq_released(GtkWidget *widg, gpointer data)
compute g(k)
Definition grcall.c:316
GtkWidget * sktqw_delta[2]
Definition calc_menu.c:1507
void calc_msd(GtkWidget *vbox, int cid)
creation of the MSD calculation widgets
Definition calc_menu.c:311
gboolean test_bonds()
is it safe to compute bond properties ?
Definition calc_menu.c:864
G_MODULE_EXPORT void run_toggle_bond(GtkDialog *info, gint response_id, gpointer data)
bond properties detailed saving: run the dialog
Definition calc_menu.c:721
G_MODULE_EXPORT void on_calc_gr_released(GtkWidget *widg, gpointer data)
compute g(r)
Definition grcall.c:199
GtkWidget * ba_entry[2]
Definition calc_menu.c:104
GtkWidget * avbox
Definition calc_menu.c:1063
G_MODULE_EXPORT void on_calc_sph_released(GtkWidget *widg, gpointer data)
compute spherical harmonics
Definition spcall.c:192
G_MODULE_EXPORT void set_numa(GtkEntry *entry, gpointer data)
set the rings/chains statistics parameter NUMA
Definition calc_menu.c:364
G_MODULE_EXPORT void on_calc_activate(GtkWidget *widg, gpointer data)
create a calculation dialog - prepare the dialog
Definition calc_menu.c:2049
G_MODULE_EXPORT void set_skt_step_id(GtkEntry *res, gpointer data)
set "to be saved" step id
Definition calc_menu.c:1519
G_MODULE_EXPORT void set_correlations(GtkEntry *entry, gpointer data)
set the minimum number of correlated configuration to compute S(k,t)
Definition calc_menu.c:1697
G_MODULE_EXPORT void expand_opt(GtkWidget *exp, gpointer data)
open expander actions
Definition calc_menu.c:1076
G_MODULE_EXPORT void set_advanced_sq(GtkEntry *entry, gpointer data)
set a s(k) calculation parameter
Definition calc_menu.c:1118
G_MODULE_EXPORT void toggle_rings(GtkToggleButton *but, gpointer data)
toggle a rings statistics calculation parameter
Definition calc_menu.c:520
void dyna_parameters(GtkWidget *vbox, int cid)
create time related configuration widgets
GtkWidget * skt_res_info
Definition calc_menu.c:1509
gboolean test_gr(int rdf)
is it safe to compute g(r) ?
Definition calc_menu.c:812
GtkWidget * skt_all_info
Definition calc_menu.c:1505
G_MODULE_EXPORT void on_smoother_released(GtkButton *button, gpointer data)
smooth g(r), s(q), s(k) or g(k)
Definition calc_menu.c:1197
GtkWidget * rings_check[4]
Definition calc_menu.c:438
G_MODULE_EXPORT void set_sfact(GtkEntry *entry, gpointer data)
set the Gaussian smoothing factor
Definition calc_menu.c:1152
G_MODULE_EXPORT void on_calc_sk_released(GtkWidget *widg, gpointer data)
compute s(q) / s(k)
Definition sqcall.c:255
G_MODULE_EXPORT void on_calc_sq_released(GtkWidget *widg, gpointer data)
compute s(q) / s(k)
Definition sqcall.c:207
void calc_rings(GtkWidget *vbox)
creation of the rings statistics calculation widgets
Definition calc_menu.c:578
G_MODULE_EXPORT void set_delta(GtkEntry *entry, gpointer data)
set the number of delta between data points
Definition calc_menu.c:195
G_MODULE_EXPORT void set_sqw_q_id(GtkEntry *res, gpointer data)
set "to be saved" q vector
Definition calc_menu.c:1547
G_MODULE_EXPORT void set_max(GtkEntry *entry, gpointer data)
set a maximum value
Definition calc_menu.c:130
G_MODULE_EXPORT void toggle_skt_all(GtkToggleButton *but, gpointer data)
toggle the output of all s(k,t) data sets
Definition calc_menu.c:1764
int search_type
Definition calc_menu.c:105
gboolean test_msd()
is it safe to compute MSD ?
Definition calc_menu.c:943
void calc_gr_sq(GtkWidget *box, int id)
creation of the g(r) / s(q) / s(k) / g(k) calculation widgets
Definition calc_menu.c:1428
GtkWidget * calc_window(int i)
create a calculation window
Definition calc_menu.c:114
void calc_sk_t(GtkWidget *box)
creation of the s(k,t) calculation widgets
Definition calc_menu.c:1807
void add_advanced_options(int skq, dint skadv[2], GtkWidget *vbox)
add k-point selection advanced options
Definition calc_menu.c:1362
GtkWidget * t_q_vbox[2]
Definition calc_menu.c:1508
GtkWidget * calc_win
Definition calc_menu.c:103
Callback declarations for main window.
void fill_tool_model()
fill the tool window tree model
Definition tools.c:91
float val
Definition dlp_init.c:117
int mol_update
Definition global.c:175
double * duplicate_double(int num, double *old_val)
copy a list of double
Definition global.c:595
double pi
Definition global.c:202
double * xsk
Definition global.c:180
char * untime[5]
Definition global.c:153
int frag_update
Definition global.c:174
double * allocdouble(int val)
allocate a double * pointer
Definition global.c:446
GtkWidget * MainWindow
Definition global.c:207
int * allocint(int val)
allocate an int * pointer
Definition global.c:301
#define i18n(String)
Definition global.c:80
GtkWidget * curvetoolbox
Definition global.c:211
double string_to_double(gpointer string)
convert string to double
Definition global.c:611
GtkWidget * calc_dialog
Definition global.c:216
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * dialog_cancel_apply(gchar *title, GtkWidget *parent, gboolean resiz)
create a dialog modal offering a choice to apply something or not
Definition gtk-misc.c:616
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:533
#define SKT
Definition global.h:347
@ IMG_NONE
Definition global.h:276
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
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1401
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:688
void append_comments(GtkWidget *vbox, gchar *symbol, gchar *legend)
append comments to a vertical box
Definition gtk-misc.c:2048
#define SQD
Definition global.h:338
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:2139
gboolean is_the_widget_visible(GtkWidget *widg)
test if a GtkWidget exist, then return if it is visible or not
Definition gtk-misc.c:183
#define RIN
Definition global.h:343
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:958
gchar * graph_img[NCALCS]
Definition gui.c:106
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:261
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:669
#define SPH
Definition global.h:345
char * calc_name[]
Definition gui.c:112
void button_set_status(GtkWidget *button, int status)
set status of check / toggle button
Definition gtk-misc.c:1916
GtkWidget * spin_button(GCallback handler, double value, double start, double end, double step, int digits, int dim, gpointer data)
create a spin button
Definition gtk-misc.c:1877
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1937
G_MODULE_EXPORT void on_calc_bonds_released(GtkWidget *widg, gpointer data)
compute bonding properties
Definition bdcall.c:559
@ CONTAINER_EXP
Definition global.h:271
@ CONTAINER_SCR
Definition global.h:267
#define ANG
Definition global.h:342
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
Definition gtk-misc.c:1999
GtkWidget * get_top_level(GtkWidget *widg)
get the top level container, window, of a widget
Definition gtk-misc.c:2485
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
#define CHA
Definition global.h:344
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
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
#define SKD
Definition global.h:339
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:987
#define BND
Definition global.h:341
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
#define min(a, b)
Definition global.h:93
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:267
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
Definition gtk-misc.c:224
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:837
int button_get_status(GtkWidget *button)
get status of check / toggle button
Definition gtk-misc.c:1899
GtkWidget * create_expander(gchar *name, gchar *file_img)
create GtkExpander
Definition gtk-misc.c:2163
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
#define GDK
Definition global.h:340
project * active_project
Definition project.c:47
void destroy_this_native_dialog(GtkNativeDialog *dialog)
destroy a GtkNativeDialog
Definition gtk-misc.c:2254
#define MSD
Definition global.h:346
#define GDR
Definition global.h:337
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
#define max(a, b)
Definition global.h:92
gboolean spin(gpointer data)
spin
Definition w_spiner.c:56
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 update_after_calc(int calc)
update all curve plots in the workspace after a calculation
Definition interface.c:1110
Messaging function declarations.
int default_skt_n_sets
int * tmp_csparam
int * tmp_rsparam
int * tmp_num_delta
gboolean tmp_skt_sets
int default_sqw_n_sets
int tmp_skt_n_sets
int tmp_sqw_freq
int tmp_sqw_n_sets
double * tmp_delta_t
gboolean preferences
Preference variable declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
gboolean skt_all_sets
Definition glwin.h:350
Definition global.h:111
logical function smooth(tabtoliss, gtoliss, dimtoliss, sigmaliss)
Definition utils.F90:612
int status
Definition w_advance.c:173
GtkWidget * res[2]
Definition w_encode.c:342
atom_search * csearch
Definition w_search.c:2719
GtkWidget * hbox
Definition workspace.c:71
GtkWidget * vbox
Definition workspace.c:72
Function declarations for workspace managment.