atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
debugio.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: 'debugio.c'
24*
25* Contains:
26*
27
28 - Some debugging and printing functions
29
30*
31* List of functions:
32
33 void debugiocurve (project * this_proj, gboolean win, int rid, int cid, gchar * iost);
34 void debug_lattice_info (project * this_proj, gchar * iost);
35 void debugioproj (project * this_proj, gchar * iost);
36 void debug_chemical_information (project * this_proj);
37
38*/
39
40#include "global.h"
41#include "project.h"
42
54void debugiocurve (project * this_proj, gboolean win, int rid, int cid, gchar * iost)
55{
56 g_debug (" ");
57 g_debug ("IODEBUG: %s: pid= %d, rid= %d, cid= %d", iost, this_proj -> id, rid, cid);
58 g_debug ("IODEBUG: %s: ndata= %d", iost, this_proj -> curves[rid][cid] -> ndata);
59 if (this_proj -> curves[rid][cid] -> data[0] == NULL)
60 {
61 g_debug ("IODEBUG: %s: data[0] == NULL", iost);
62 }
63 g_debug ("IODEBUG: %s: x[0]= %f", iost, this_proj -> curves[rid][cid] -> data[0][0]);
64 g_debug ("IODEBUG: %s: y[0]= %f", iost, this_proj -> curves[rid][cid] -> data[1][0]);
65 g_debug ("IODEBUG: %s: x[ndata-1]= %f", iost, this_proj -> curves[rid][cid] -> data[0][this_proj -> curves[rid][cid] -> ndata - 1]);
66 g_debug ("IODEBUG: %s: y[ndata-1]= %f", iost, this_proj -> curves[rid][cid] -> data[1][this_proj -> curves[rid][cid] -> ndata - 1]);
67 if (win)
68 {
69 g_debug ("IODEBUG: %s: cmax[0]= %f, cmax[1]= %f", iost,
70 this_proj -> curves[rid][cid] -> cmax[0], this_proj -> curves[rid][cid] -> cmax[1]);
71 g_debug ("IODEBUG: %s: name= %s", iost, this_proj -> curves[rid][cid] -> name);
72 g_debug ("IODEBUG: %s: show_title= %d", iost, this_proj -> curves[rid][cid] -> show_title);
73 g_debug ("IODEBUG: %s: default_title= %d", iost, this_proj -> curves[rid][cid] -> default_title);
74 g_debug ("IODEBUG: %s: title= %s", iost, this_proj -> curves[rid][cid] -> title);
75 g_debug ("IODEBUG: %s: title_font= %s", iost, this_proj -> curves[rid][cid] -> title_font);
76 g_debug ("IODEBUG: %s: title_pos[0]= %f, title_pos[1]= %f", iost,
77 this_proj -> curves[rid][cid] -> title_pos[0], this_proj -> curves[rid][cid] -> title_pos[1]);
78 g_debug ("IODEBUG: %s: title.red= %f, title.green= %f, title.blue= %f", iost,
79 this_proj -> curves[rid][cid] -> title_color.red,
80 this_proj -> curves[rid][cid] -> title_color.green,
81 this_proj -> curves[rid][cid] -> title_color.blue);
82 // Axis
83 g_debug ("IODEBUG: %s: axmin[0]= %f, axmin[1]= %f", iost,
84 this_proj -> curves[rid][cid] -> axmin[0], this_proj -> curves[rid][cid] -> axmin[1]);
85 g_debug ("IODEBUG: %s: axmax[0]= %f, axmax[1]= %f", iost,
86 this_proj -> curves[rid][cid] -> axmax[0], this_proj -> curves[rid][cid] -> axmax[1]);
87 g_debug ("IODEBUG: %s: x_axis_title= %s", iost, this_proj -> curves[rid][cid] -> axis_title[0]);
88 g_debug ("IODEBUG: %s: x_axis_title_font= %s", iost, this_proj -> curves[rid][cid] -> axis_title_font[0]);
89 g_debug ("IODEBUG: %s: x_axis_title_pos[0]= %d, x_axis_title_pos[1]= %d", iost,
90 this_proj -> curves[rid][cid] -> axis_title_x[0], this_proj -> curves[rid][cid] -> axis_title_y[0]);
91 g_debug ("IODEBUG: %s: y_axis_title= %s", iost, this_proj -> curves[rid][cid] -> axis_title[1]);
92 g_debug ("IODEBUG: %s: y_axis_title_font= %s", iost, this_proj -> curves[rid][cid] -> axis_title_font[1]);
93 g_debug ("IODEBUG: %s: y_axis_title_pos[0]= %d, y_axis_title_pos[1]= %d", iost,
94 this_proj -> curves[rid][cid] -> axis_title_x[1], this_proj -> curves[rid][cid] -> axis_title_y[1]);
95 g_debug ("IODEBUG: %s: scale[0]= %d, scale[1]= %d", iost,
96 this_proj -> curves[rid][cid] -> scale[0], this_proj -> curves[rid][cid] -> scale[1]);
97 g_debug ("IODEBUG: %s: x_axis_defaut_title= %d", iost, this_proj -> curves[rid][cid] -> axis_defaut_title[0]);
98 g_debug ("IODEBUG: %s: y_axis_defaut_title= %d", iost, this_proj -> curves[rid][cid] -> axis_defaut_title[1]);
99 g_debug ("IODEBUG: %s: grid[0]= %d, grid[1]= %d", iost,
100 this_proj -> curves[rid][cid] -> show_grid[0], this_proj -> curves[rid][cid] -> show_grid[1]);
101 g_debug ("IODEBUG: %s: show_axis[0]= %d, show_axis[1]= %d", iost,
102 this_proj -> curves[rid][cid] -> show_axis[0], this_proj -> curves[rid][cid] -> show_axis[1]);
103 g_debug ("IODEBUG: %s: autoscale[0]= %d, autoscale[1]= %d", iost,
104 this_proj -> curves[rid][cid] -> autoscale[0], this_proj -> curves[rid][cid] -> autoscale[1]);
105 g_debug ("IODEBUG: %s: majt[0]= %f, majt[1]= %f", iost,
106 this_proj -> curves[rid][cid] -> majt[0], this_proj -> curves[rid][cid] -> majt[1]);
107 g_debug ("IODEBUG: %s: mint[0]= %d, mint[1]= %d", iost,
108 this_proj -> curves[rid][cid] -> mint[0], this_proj -> curves[rid][cid] -> mint[1]);
109 g_debug ("IODEBUG: %s: ticks_io[0]= %d, ticks_io[1]= %d", iost,
110 this_proj -> curves[rid][cid] -> ticks_io[0], this_proj -> curves[rid][cid] -> ticks_io[1]);
111 g_debug ("IODEBUG: %s: ticks_pos[0]= %d, ticks_pos[1]= %d", iost,
112 this_proj -> curves[rid][cid] -> ticks_pos[0], this_proj -> curves[rid][cid] -> ticks_pos[1]);
113 g_debug ("IODEBUG: %s: majt_size[0]= %d, majt_size[1]= %d", iost,
114 this_proj -> curves[rid][cid] -> majt_size[0], this_proj -> curves[rid][cid] -> majt_size[1]);
115 g_debug ("IODEBUG: %s: mint_size[0]= %d, mint_size[1]= %d", iost,
116 this_proj -> curves[rid][cid] -> mint_size[0], this_proj -> curves[rid][cid] -> mint_size[1]);
117 g_debug ("IODEBUG: %s: labels_pos[0]= %d, labels_pos[1]= %d", iost,
118 this_proj -> curves[rid][cid] -> labels_pos[0], this_proj -> curves[rid][cid] -> labels_pos[1]);
119 g_debug ("IODEBUG: %s: labels_digit[0]= %d, labels_digit[1]= %d", iost,
120 this_proj -> curves[rid][cid] -> labels_digit[0], this_proj -> curves[rid][cid] -> labels_digit[1]);
121 g_debug ("IODEBUG: %s: labels_font[0]= %s, labels_font[1]= %s", iost,
122 this_proj -> curves[rid][cid] -> labels_font[0], this_proj -> curves[rid][cid] -> labels_font[1]);
123 g_debug ("IODEBUG: %s: labels_angle[0]= %f, labels_angle[1]= %f", iost,
124 this_proj -> curves[rid][cid] -> labels_angle[0], this_proj -> curves[rid][cid] -> labels_angle[1]);
125 g_debug ("IODEBUG: %s: labels_shift_x[0]= %d, labels_shift_y[0]= %d", iost,
126 this_proj -> curves[rid][cid] -> labels_shift_x[0], this_proj -> curves[rid][cid] -> labels_shift_y[0]);
127 g_debug ("IODEBUG: %s: labels_shift_x[1]= %d, labels_shift_y[1]= %d", iost,
128 this_proj -> curves[rid][cid] -> labels_shift_x[1], this_proj -> curves[rid][cid] -> labels_shift_y[1]);
129 // Legend
130 g_debug ("IODEBUG: %s: show_legend= %d", iost, this_proj -> curves[rid][cid] -> show_legend);
131 g_debug ("IODEBUG: %s: legend_pos[0]= %f, legend_pos[1]= %f", iost,
132 this_proj -> curves[rid][cid] -> legend_pos[0], this_proj -> curves[rid][cid] -> legend_pos[1]);
133 g_debug ("IODEBUG: %s: legend_font= %s", iost, this_proj -> curves[rid][cid] -> legend_font);
134 g_debug ("IODEBUG: %s: legend.red= %f, legend.green= %f, legend.blue= %f", iost,
135 this_proj -> curves[rid][cid] -> legend_color.red,
136 this_proj -> curves[rid][cid] -> legend_color.green,
137 this_proj -> curves[rid][cid] -> legend_color.blue);
138 g_debug ("IODEBUG: %s: show_legend_box= %d", iost, this_proj -> curves[rid][cid] -> show_legend_box);
139 g_debug ("IODEBUG: %s: legend_box_dash= %d", iost, this_proj -> curves[rid][cid] -> legend_box_dash);
140 g_debug ("IODEBUG: %s: legend_box_thickness= %f", iost, this_proj -> curves[rid][cid] -> legend_box_thickness);
141 g_debug ("IODEBUG: %s: legend_box.red= %f, legend_box.green= %f, legend_box.blue= %f", iost,
142 this_proj -> curves[rid][cid] -> legend_box_color.red,
143 this_proj -> curves[rid][cid] -> legend_box_color.green,
144 this_proj -> curves[rid][cid] -> legend_box_color.blue);
145 // Frame
146 g_debug ("IODEBUG: %s: show_frame= %d", iost, this_proj -> curves[rid][cid] -> show_frame);
147 g_debug ("IODEBUG: %s: frame_type= %d", iost, this_proj -> curves[rid][cid] -> frame_type);
148 g_debug ("IODEBUG: %s: frame_dash= %d", iost, this_proj -> curves[rid][cid] -> frame_dash);
149 g_debug ("IODEBUG: %s: frame_thickness= %f", iost, this_proj -> curves[rid][cid] -> frame_thickness);
150 g_debug ("IODEBUG: %s: frame.red= %f, frame.green= %f, frame.blue= %f", iost,
151 this_proj -> curves[rid][cid] -> frame_color.red,
152 this_proj -> curves[rid][cid] -> frame_color.green,
153 this_proj -> curves[rid][cid] -> frame_color.blue);
154 g_debug ("IODEBUG: %s: frame.xmin= %f, frame.xmax= %f", iost,
155 this_proj -> curves[rid][cid] -> frame_pos[0][0], this_proj -> curves[rid][cid] -> frame_pos[0][1]);
156 g_debug ("IODEBUG: %s: frame.ymin= %f, frame.ymax= %f", iost,
157 this_proj -> curves[rid][cid] -> frame_pos[1][0], this_proj -> curves[rid][cid] -> frame_pos[1][1]);
158 // Data
159 g_debug ("IODEBUG: %s: backc.red= %f, backc.green= %f, backc.blue= %f", iost,
160 this_proj -> curves[rid][cid] -> backcolor.red,
161 this_proj -> curves[rid][cid] -> backcolor.green,
162 this_proj -> curves[rid][cid] -> backcolor.blue);
163 g_debug ("IODEBUG: %s: legend_font= %s", iost, this_proj -> curves[rid][cid] -> legend_font);
164 if (this_proj -> curves[rid][cid] -> cfile != NULL)
165 {
166 g_debug ("IODEBUG: %s: cfile= %s", iost, this_proj -> curves[rid][cid] -> cfile);
167 }
168 }
169 else
170 {
171 g_debug ("IODEBUG: %s: No curve window", iost);
172 }
173}
174
183void debug_lattice_info (project * this_proj, gchar * iost)
184{
185 g_debug ("IODEBUG::%s:: lattice debug", iost);
186 cell_info * debug_cell = & this_proj -> cell;
187 g_debug ("IODEBUG::%s:: pbc= %d, frac= %d, ltype= %d", iost, debug_cell -> pbc, debug_cell -> frac, debug_cell -> ltype);
188 g_debug ("IODEBUG::%s:: npt= %d, has_a_box= %d, crystal= %d", iost, debug_cell -> npt, debug_cell -> has_a_box, debug_cell -> crystal);
189 g_debug ("IODEBUG::%s:: volumec= %f, density= %f", iost, debug_cell -> volume, debug_cell -> density);
190 g_debug ("IODEBUG::%s:: cextra[0]= %d, cextra[1]= %d, cextra[2]= %d", iost, debug_cell -> cextra[0], debug_cell -> cextra[1], debug_cell -> cextra[2]);
191 if (debug_cell -> box)
192 {
193 box_info * debug_box = debug_cell -> box;
194 int i;
195 for (i=0; i<2; i++) g_debug ("IODEBUG::%s:: i= %d, param[%d][0]= %f, param[%d][1]= %f, param[%d][2]= %f", iost, i, i, debug_box -> param[i][0], i, debug_box -> param[i][1], i, debug_box -> param[i][2]);
196 for (i=0; i<3; i++) g_debug ("IODEBUG::%s:: i= %d, vect[%d][0]= %f, vect[%d][1]= %f, vect[%d][2]= %f", iost, i, i, debug_box -> vect[i][0], i, debug_box -> vect[i][1], i, debug_box -> vect[i][2]);
197 for (i=0; i<3; i++) g_debug ("IODEBUG::%s:: i= %d, rvect[%d][0]= %f, rvect[%d][1]= %f, rvect[%d][2]= %f", iost, i, i, debug_box -> rvect[i][0], i, debug_box -> rvect[i][1], i, debug_box -> rvect[i][2]);
198 }
199}
200
209void debugioproj (project * this_proj, gchar * iost)
210{
211 int i, j;
212
213 g_debug ("IODEBUG::%s: name= %s", iost, this_proj -> name);
214 if (this_proj -> coordfile != NULL)
215 {
216 g_debug ("IODEBUG::%s: coordfile= %s", iost, this_proj -> coordfile);
217 g_debug ("IODEBUG::%s: tfile= %d", iost, this_proj -> tfile);
218 }
219 if (this_proj -> bondfile != NULL)
220 {
221 g_debug ("IODEBUG::%s: bondfile= %s", iost, this_proj -> bondfile);
222 }
223 g_debug ("IODEBUG::%s: newproj= %d", iost, this_proj -> newproj);
224 g_debug ("IODEBUG::%s: pbc= %d", iost, this_proj -> cell.pbc);
225 g_debug ("IODEBUG::%s: frac= %d", iost, this_proj -> cell.frac);
226 g_debug ("IODEBUG::%s: run= %d", iost, this_proj -> run);
227 g_debug ("IODEBUG::%s: dmtx= %d", iost, this_proj -> dmtx);
228 g_debug ("IODEBUG::%s: nspec= %d", iost, this_proj -> nspec);
229 g_debug ("IODEBUG::%s: natomes= %d", iost, this_proj -> natomes);
230 g_debug ("IODEBUG::%s: steps= %d", iost, this_proj -> steps);
231 g_debug ("IODEBUG::%s: grtotcutoff= %f", iost, this_proj -> chemistry -> grtotcutoff);
232 g_debug ("IODEBUG::%s: cvect[0][0]= %f, cvect[0][1]= %f, cvect[0][2]= %f",
233 iost, this_proj -> cell.box[0].vect[0][0], this_proj -> cell.box[0].vect[0][1], this_proj -> cell.box[0].vect[0][2]);
234 g_debug ("IODEBUG::%s: cvect[1][0]= %f, cvect[1][1]= %f, cvect[1][2]= %f",
235 iost, this_proj -> cell.box[0].vect[1][0], this_proj -> cell.box[0].vect[1][1], this_proj -> cell.box[0].vect[1][2]);
236 g_debug ("IODEBUG::%s: cvect[2][0]= %f, cvect[2][1]= %f, cvect[2][2]= %f",
237 iost, this_proj -> cell.box[0].vect[2][0], this_proj -> cell.box[0].vect[2][1], this_proj -> cell.box[0].vect[2][2]);
238 g_debug ("IODEBUG::%s: langles[0]= %f, langles[1]= %f, langles[2]= %f", iost,
239 this_proj -> cell.box[0].param[1][0], this_proj -> cell.box[0].param[1][1], this_proj -> cell.box[0].param[1][2]);
240 g_debug ("IODEBUG::%s: vmod[0]= %f, vmod[1]= %f, vmod[2]= %f", iost,
241 this_proj -> cell.box[0].param[0][0], this_proj -> cell.box[0].param[0][1], this_proj -> cell.box[0].param[0][2]);
242 for (i=0; i<NGRAPHS; i++)
243 {
244 g_debug ("IODEBUG::%s: i= %d, num_delta[i]= %d", iost, i, this_proj -> num_delta[i]);
245 g_debug ("IODEBUG::%s: i= %d, delta[i]= %f", iost, i, this_proj -> delta[i]);
246 g_debug ("IODEBUG::%s: i= %d, min[i]= %f", iost, i, this_proj -> min[i]);
247 g_debug ("IODEBUG::%s: i= %d, max[i]= %f", iost, i, this_proj -> max[i]);
248 }
249 for (i=0; i<NGRAPHS; i++)
250 {
251 g_debug ("IODEBUG::%s: i= %d, visok[i]= %d", iost, i, this_proj -> visok[i]);
252 g_debug ("IODEBUG::%s: i= %d, initok[i]= %d", iost, i, this_proj -> initok[i]);
253 }
254 if (this_proj -> natomes != 0 && this_proj -> nspec != 0)
255 {
256 for (i=0; i<this_proj -> steps; i++)
257 {
258 g_debug ("IODEBUG::%s: proj.atom[%d][%d].x= %f, proj.atom[%d][%d].x= %f",
259 iost, i, 0, this_proj -> atoms[i][0].x, i, this_proj -> natomes-1, this_proj -> atoms[i][this_proj -> natomes - 1].x);
260 g_debug ("IODEBUG::%s: proj.atom[%d][%d].y= %f, proj.atom[%d][%d].y= %f",
261 iost, i, 0, this_proj -> atoms[i][0].y, i, this_proj -> natomes - 1, this_proj -> atoms[i][this_proj -> natomes - 1].y);
262 g_debug ("IODEBUG::%s: proj.atom[%d][%d].z= %f, proj.atom[%d][%d].z= %f",
263 iost, i, 0, this_proj -> atoms[i][0].z, i, this_proj -> natomes - 1, this_proj -> atoms[i][this_proj -> natomes - 1].z);
264 }
265 for (i=0; i<this_proj -> nspec; i++)
266 {
267 g_debug ("IODEBUG::%s: i= %d, nsps[i]= %d", iost, i, this_proj -> chemistry -> nsps[i]);
268 g_debug ("IODEBUG::%s: i= %d, atid[i]= %d", iost, i, (int)this_proj -> chemistry -> chem_prop[CHEM_Z][i]);
269 g_debug ("IODEBUG::%s: i= %d, mass[i]= %f", iost, i, this_proj -> chemistry -> chem_prop[CHEM_M][i]);
270 g_debug ("IODEBUG::%s: i= %d, rad[i]= %f", iost, i, this_proj -> chemistry -> chem_prop[CHEM_R][i]);
271 }
272 for (i=0; i<this_proj -> nspec; i++)
273 {
274 for (j=0; j<this_proj -> nspec; j++)
275 {
276 g_debug ("IODEBUG::%s: i= %d, j= %d, cutoffs[i][j]= %f", iost, i, j, this_proj -> chemistry -> cutoffs[i][j]);
277 }
278 }
279 }
280 debug_lattice_info (this_proj, iost);
281}
282
291{
292 g_debug ("Number of species: %d", this_proj -> nspec);
293 int i;
294 for (i=0; i<this_proj -> nspec; i++)
295 {
296 g_debug ("Spec= %d, label= %s, element= %s ", i+1,
297 this_proj -> chemistry -> label[i],
298 this_proj -> chemistry -> element[i]);
299 g_debug (" nsps[%d]= %d, formula[%d]= %d",
300 i+1, this_proj -> chemistry -> nsps[i], i+1, this_proj -> chemistry -> formula[i]);
301 }
302 g_debug ("Number of atoms: %d", this_proj -> natomes);
303 for (i=0; i<this_proj -> natomes; i++)
304 {
305 g_debug (" at= %d, lot[%d]= %d", i+1, i+1, this_proj -> atoms[0][i].sp);
306 }
307}
308
integer(kind=c_int) function chemistry()
Definition chemistry.F90:22
gchar * param[2]
double scale(double axe)
find appropriate major tick spacing based on axis length
Definition curve.c:204
void show_frame(cairo_t *cd, int tf, int da, int res[2], double ti, double x[2], double y[2], ColRGBA dcol)
draw frame
Definition frame.c:81
GtkWidget * majt
Definition tab-4.c:103
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
const gchar * default_title(int ax, int c)
default title string
Definition title.c:54
void show_legend(cairo_t *cr, project *this_proj, int rid, int cid)
draw legend
Definition legend.c:56
void show_title(cairo_t *cr, project *this_proj, int rid, int cid)
draw title
Definition title.c:107
int atoms[NUM_STYLES][2]
void debugioproj(project *this_proj, gchar *iost)
debug project info
Definition debugio.c:209
void debugiocurve(project *this_proj, gboolean win, int rid, int cid, gchar *iost)
debug and print some info about the curves in a project
Definition debugio.c:54
void debug_chemical_information(project *this_proj)
debug chemical data info
Definition debugio.c:290
void debug_lattice_info(project *this_proj, gchar *iost)
debug lattice data
Definition debugio.c:183
Global variable declarations Global convenience function declarations Global data structure defin...
#define NGRAPHS
#define CHEM_R
Definition global.h:299
#define CHEM_M
Definition global.h:298
#define min(a, b)
Definition global.h:81
#define CHEM_Z
Definition global.h:297
#define max(a, b)
Definition global.h:80
void autoscale(gpointer data)
autoscale callback
Definition m_curve.c:100
double z
Definition ogl_draw.c:57
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
Function declarations for reading atomes project file Function declarations for saving atomes proje...
GtkWidget * axis_title_font
Definition tab-4.c:102
GtkWidget * show_grid
Definition tab-4.c:98
GtkWidget * axis_title
Definition tab-4.c:101
GtkWidget * show_axis
Definition tab-4.c:97
int element
Definition w_periodic.c:61