atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
initc.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-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'initc.c'
24*
25* Contains:
26*
27
28 - Curve data buffer initialization
29
30*
31* List of functions:
32
33 void clean_curves_data (int calc, int start, int end);
34 void alloc_curves (int rid);
35 void initcwidgets ();
36 void prepostcalc (GtkWidget * widg, gboolean status, int run, int adv, double opc);
37
38*/
39
40#include "global.h"
41#include "callbacks.h"
42#include "project.h"
43
44extern void clean_this_curve_window (int cid, int rid);
45
55void clean_curves_data (int calc, int start, int end)
56{
57 int i;
58 for (i=start; i<end; i++)
59 {
60 if (active_project -> curves[calc])
61 {
63 }
64 }
65}
66
74void alloc_curves (int rid)
75{
76 int i;
77 if (active_project -> idcc[rid] != NULL)
78 {
79 g_free (active_project -> idcc[rid]);
80 active_project -> idcc[rid] = NULL;
81 }
82 active_project -> idcc[rid] = g_malloc0 (active_project -> numc[rid]*sizeof*active_project -> idcc[rid]);
83 if (active_project -> curves[rid] != NULL)
84 {
85 g_free (active_project -> curves[rid]);
86 active_project -> curves[rid] = NULL;
87 }
88 active_project -> curves[rid] = g_malloc (active_project -> numc[rid]*sizeof*active_project -> curves);
89 for (i = 0; i < active_project -> numc[rid]; i++)
90 {
91 active_project -> curves[rid][i] = g_malloc0 (sizeof*active_project -> curves[rid][i]);
92 active_project -> curves[rid][i] -> cfile = NULL;
93 active_project -> curves[rid][i] -> name = NULL;
94 active_project -> curves[rid][i] -> axis_title[0] = NULL;
95 active_project -> curves[rid][i] -> axis_title[1] = NULL;
96 }
97}
98
105{
106 int i, j;
107
108 j=active_project -> nspec;
109 active_project -> numc[GR] = 16+5*j*j;
110 active_project -> numc[SQ] = 8+4*j*j;
111 active_project -> numc[SK] = 8+4*j*j;
112 active_project -> numc[GK] = active_project -> numc[GR];
113 active_project -> numc[BD] = j*j;
114 active_project -> numc[AN] = j*j*j + j*j*j*j;
115 active_project -> numc[RI] = 20*(j+1);
116 active_project -> numc[CH] = j+1;
117 active_project -> numc[SP] = 0;
118 active_project -> numc[MS] = 0;
119 if (active_project -> steps > 1) active_project -> numc[MS] = 14*j+6;
120
121 if (j == 2)
122 {
123 active_project -> numc[GR] = active_project -> numc[GR] + 6;
124 active_project -> numc[SQ] = active_project -> numc[SQ] + 8;
125 active_project -> numc[SK] = active_project -> numc[SK] + 8;
126 active_project -> numc[GK] = active_project -> numc[GK] + 6;
127 }
128 active_project -> numwid = active_project -> numc[GR]
129 + active_project -> numc[SQ]
130 + active_project -> numc[SK]
131 + active_project -> numc[GK]
132 + active_project -> numc[BD]
133 + active_project -> numc[AN]
134 + active_project -> numc[RI]
135 + active_project -> numc[CH]
136 + active_project -> numc[MS];
137 for (i=0; i<NGRAPHS; i++)
138 {
139 if (i != SP) alloc_curves (i);
140 }
141}
142
154void prepostcalc (GtkWidget * widg, gboolean status, int run, int adv, double opc)
155{
156 //int i;
157// char * bar[2] = {"bond properties", "nearest neigbhors table"};
158// char * mess;
159 if (run < NGRAPHS && run > -1) active_project -> visok[run] = adv;
160 if (! status)
161 {
162#ifdef GTK3
163 if (widg != NULL) gdk_window_set_opacity (gtk_widget_get_window(widg), opc);
164#endif
165/* if (adv)
166 {
167 // bar[run]
168 mess = g_strdup_printf ("Please wait calculation in progress");
169 pop = show_popup (mess, widg);
170 g_free (mess);
171 mess = g_strdup_printf ("Computing");
172 //statusval = gtk_statusbar_push (statusbar, run, mess);
173 g_free (mess);
174 show_the_widgets (pop);
175 }*/
176 }
177 else
178 {
179 if (adv && run > -1)
180 {
181 //gtk_statusbar_remove (statusbar, run, statusval);
182 //destroy_this_widget(pop);
183 }
184#ifdef GTK3
185 if (widg != NULL) gdk_window_set_opacity (gtk_widget_get_window(widg), opc);
186#endif
187 }
188}
Callback declarations for main window.
Global variable declarations Global convenience function declarations Global data structure defin...
#define GR
Definition global.h:322
#define NGRAPHS
#define SQ
Definition global.h:323
#define RI
Definition global.h:328
#define BD
Definition global.h:326
#define AN
Definition global.h:327
#define MS
Definition global.h:331
#define SK
Definition global.h:324
#define GK
Definition global.h:325
#define SP
Definition global.h:330
project * active_project
Definition project.c:47
#define CH
Definition global.h:329
void initcwidgets()
initializing curve values
Definition initc.c:104
void alloc_curves(int rid)
allocating curve data
Definition initc.c:74
void prepostcalc(GtkWidget *widg, gboolean status, int run, int adv, double opc)
to just before and just after running a calculation
Definition initc.c:154
void clean_curves_data(int calc, int start, int end)
clean curve data on a range of curve id
Definition initc.c:55
void clean_this_curve_window(int cid, int rid)
free curve window data
Definition curve.c:338
Function declarations for reading atomes project file Function declarations for saving atomes proje...
GtkWidget * axis_title
Definition tab-4.c:101
int status
Definition w_advance.c:160