File: chemistry.h

package info (click to toggle)
gnome-chemistry-utils 0.14.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,836 kB
  • ctags: 7,337
  • sloc: cpp: 72,977; sh: 11,381; xml: 6,304; makefile: 1,663; ansic: 1,061
file content (318 lines) | stat: -rw-r--r-- 9,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// -*- C -*-

/*
 * Gnome Chemisty Utils
 * chemistry.h
 *
 * Copyright (C) 2003-2011 Jean Bréfort <jean.brefort@normalesup.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */


/*! \mainpage
  \section intro Introduction
The Gnome Chemistry Utils Library provides some widgets and C++ classes related to chemistry.

Available widgets are:
- GcpFontSel: a font selector.
- GcuPeriodic: a periodic table of the elements.
- GcuComboPeriodic: a combo box with a dropdown periodic table widget.
- GcrCrystalViewer: a crystal structure viewer.
- GcuChem3DViewer: a 3D molecular structure viewer.
- GcuSpectrumViewer: a spectrum viewer.

The C++ classes are grouped in the gcu, gcugtk, gccv, gcr, and gcp namespaces.
A C interface exists to use some (not so many) of the functionalities offered
in these classes; the corresponding documentation is available in the
chemistry.h file.
*/

#ifndef GCU_CHEMISTRY_H
#define GCU_CHEMISTRY_H

/** \file
* C interface to the chemistry library.

To use this file, add the following line to your source file:
\code
#include <gcu/chemistry.h>
\endcode
*/

#ifdef  __cplusplus
extern "C" {
#endif

/**
The greatest atomic number known in this version of the Gnome Chemictry Utils
*/
#define MAX_ELT 116

/** gcu_spin_state
* gcu_spin_state describes the spin state of a central atom in a complex.
* Possible values are:
* - GCU_N_A_SPIN: unknown,
* - GCU_LOW_SPIN: low spin,
* - GCU_HIGH_SPIN: high spin.
*
*  This enumeration is used in the GcuAtomicRadius structure.
*/
enum gcu_spin_state
{
	GCU_N_A_SPIN,
	GCU_LOW_SPIN,
	GCU_HIGH_SPIN
};

/** gcu_radius_type
* gcu_radius_type describes the type of the atomic radius
* Possible values are:
* - GCU_RADIUS_UNKNOWN: unknown,.
* - GCU_ATOMIC: atomic radius,
* - GCU_IONIC: ionic radius,
* - GCU_METALLIC: metallic radius,
* - GCU_COVALENT: covalent radius,
* - GCU_VAN_DER_WAALS: van der Waals radius,
*
*  This enumeration is used in the GcuAtomicRadius structure.
*/
enum gcu_radius_type
{
	GCU_RADIUS_UNKNOWN,
	GCU_ATOMIC,
	GCU_IONIC,
	GCU_METALLIC,
	GCU_COVALENT,
	GCU_VAN_DER_WAALS
};

/** GcuValue
Structure used to store a numerical value.
*/
typedef struct
{
	/** The value. */
	double value;
	/** The precision (number of significative decimal figures). */
	int prec;
	/** The standard error (* 10^prec). */
	int delta;
} GcuValue;

/** GcuDimensionalValue
Structure used to store a dimensional value.
*/
typedef struct
{
	/** The value.*/
	double value;
	/** The precision (number of significative decimal figures).*/
	int prec;
	/** The standard error (* 10^prec). */
	int delta;
	/** The unit symbol.*/
	const char *unit;
} GcuDimensionalValue;

/** GcuAtomicRadius
* Structure used to describe an atomic radius.
*/
typedef struct
{
	/** The atomic number. */
	unsigned char Z;
	/** The radius type (unknown, ionic, metallic, covalent, or van der Waals).*/
	enum gcu_radius_type type;
	/** The radius value (the unit should always be pm). */
	GcuDimensionalValue value;
	/** The charge of the atom (or ion). */
	char charge;
	/** The scale name, e.g. "Pauling" or "Shannon". */
	char const* scale;
	/** the coordination number of the atom or -1 if unknown. */
	char cn;	//coordination number: -1: unspecified
	/** The spin state (unknown, low or high).*/
	enum gcu_spin_state spin;
} GcuAtomicRadius;

/*! GcuElectronegativity
Structure used to describe an electronegativity value.
*/
typedef struct
{
	/** The atomic number. */
	unsigned char Z;
	/*! The electronegativity value.*/
	GcuValue value;
	/** The scale name, e.g. "Pauling" or "Mulliken". */
	char const *scale;
} GcuElectronegativity;

/*! GcuIsotope
Structure used to describe an isotope
*/
typedef struct
{
	/** The nucleon number. */
	unsigned char A;
	/** The name of the isotope if any.*/
	char *name;
	/*! The terrestrial percent abundance.*/
	GcuValue abundance;
	/*! The mass of an atom in atomic units.*/
	GcuValue mass;
	/*! The spin of an atom multipiled by 2.*/
	char spin;
	/*! The decay modes as a comma separated list.*/
	char *decay_modes;
	/*! The decay period.*/
	GcuDimensionalValue decay_period;
} GcuIsotope;

/*!
\param Z: the atomic number of the element.

Retrieves the default color used for the element.
\return an array of three double values for the red, green and blue components of the color.
*/
const double* gcu_element_get_default_color (int Z);
/*!
gcu_element_get_symbol:
\param Z: the atomic number of the element.
\return the symbol of the element.
*/
const char* gcu_element_get_symbol (int Z);
/*!
\param Z: the atomic number of the element.
\return the name of the element in the current locale or in english if the current locale is not supported in the database.
*/
const char* gcu_element_get_name (int Z);
/*!
gcu_element_get_Z:
\param symbol: the symbol of the element (e.g. "C" ot "Pt").
\return the atomic number of the element.
*/
int gcu_element_get_Z (char* symbol);
/*!
\param radius: a pointer to a GcuAtomicRadius structure.

Before calling this function, most fields in the GcuAtomicRadius structure must be filled:
- Z: the atomic number, mandatory
- type: the type of the radius searched
- charge: the charge of the atom. 0 for all radii except ionic radii.
- cn: the coordination number or -1 if not significant
- spin: the spin state or GCU_N_A_SPIN if not significant
- scale: the name of the scale (e.g. "Pauling") or NULL

The programs searches a value corresponding to the fields having a non default value. If one is found
the other fields are given the corresponding values f the first match before returning.

\return TRUE if a radius has been found and FALSE if not.

*/
int gcu_element_get_radius (GcuAtomicRadius* radius);
/*!
\param en: a pointer to a GcuElectronegativity structure.

Before calling this function, the following fields in the GcuElectronegativity structure must be filled:
- Z: the atomic number, mandatory
- scale: the name of the scale (e.g. "Pauling") or NULL

The programs searches an electronegativity value for the element in the scale if given. If one is found
the value and the scale (if NULL on calling)  are given the corresponding values of the first match before returning.

\return TRUE if a match has been found and FALSE if not.
*/
int gcu_element_get_electronegativity (GcuElectronegativity* en);
/*!
\param Z: the atomic number.
\param N: the rank of the ionization.

The program searches for the Nth ionization energy value for the element and returns
it if found.

\return the ionization energy as a GcuDimensionalValue if known or NULL.
*/
GcuDimensionalValue const *gcu_element_get_ionization_energy (int Z, int N);
/*!
\param Z: the atomic number.
\param N: the rank of the extra electron.

For some elements, second and even third electron affinities have been estimated.
The program searches the Nth electron affinity value for the element and returns
it if found.
A value of 0 means that the anion is unstable in the gaseous phase and that no better
etimation is available.

\return the electronic affinity as a GcuDimensionalValue if known or NULL.
*/
GcuDimensionalValue const *gcu_element_get_electron_affinity (int Z, int N);
/*!
\param Z: the atomic number.

\return the atomic weight as a string without units which needs to be freed with a g_free() call.
*/
char *gcu_element_get_weight_as_string (int Z);
/*!
\param Z: the atomic number.

\return the electronic configuration as a pango markup.
*/
char const *gcu_element_get_electronic_configuration (int Z);
 /*!
\param Z: the atomic number of the element.

\return a pointer to the array of pointers to GcuAtomicRadius structures for all known radii for the element.
Last value in the array is NULL.
*/
const GcuAtomicRadius** gcu_element_get_radii (int Z);
/*!
\param Z: the atomic number of the element.

\return a pointer to the array of pointers to GcuElectronegativity structures for all known electronegativities for the element.
Last value in the array is NULL.
*/
const GcuElectronegativity** gcu_element_get_electronegativities (int Z);
/*!
\param name: name of a database to load such as "radii", "elecprops", "isotopes",
the first name is followed by a list of other database terminated by NULL.

Loads the listed databases.
*/
void gcu_element_load_databases (char const *name, ...);

/*!
\param value: the GcuValue to represent as a string.

\return the GcuValue as a string taking into account the precision and
incertitude
*/
char* gcu_value_get_string (GcuValue const *value);

/*!
\param value: the GcuDimensionalValue to represent as a string.

\return the GcuDimensionalValue as a string taking into account the precision and
incertitude
*/
char* gcu_dimensional_value_get_string (GcuDimensionalValue const *value);

#ifdef  __cplusplus
}	// extern "C"
#endif

#endif //GCU_CHEMISTRY_H