Subversion Repositories wimsdev

Rev

Rev 12963 | Rev 13325 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12963 Rev 13121
Line 7... Line 7...
7
#include <iostream>
7
#include <iostream>
8
#include <vector>
8
#include <vector>
9
#include <string>
9
#include <string>
10
#include <map>
10
#include <map>
11
 
11
 
12
#define VERSION "2.11"
12
#define VERSION "2.14"
13
 
13
 
14
/* Constante d'Avogadro, recommandée par CODATA, 2006 */
14
/* Constante d'Avogadro, recommandée par CODATA, 2006 */
15
#define Avogadro 6.022141e+23
15
#define Avogadro 6.022141e+23
16
 
16
 
17
/* Charge élémentaire, voir wikipedia, 2007 */
17
/* Charge élémentaire, voir wikipedia, 2007 */
18
#define Electron 1.602176e-19
18
#define Electron 1.602176e-19
19
 
19
 
20
/* Constante de Boltzmann, voir Wikipedia, 2007 */
20
/* Constante de Boltzmann, voir Wikipedia, 2007 */
21
#define Kb 1.3806e-23
21
#define Kb 1.3806e-23
22
 
22
 
23
/* D'où la constante de Faraday */
23
/* D'où la constante de Faraday */
24
#define Faraday (Avogadro * Electron)
24
#define Faraday (Avogadro * Electron)
25
 
25
 
26
/* D'où la constante des Gaz parfaits 8.314 J.K^-1.mol^-1 */
26
/* D'où la constante des Gaz parfaits 8.314 J.K^-1.mol^-1 */
27
#define R (Kb * Avogadro)
27
#define R (Kb * Avogadro)
28
 
28
 
29
/* Température de référence pour les réactions chimiques, 25°C */
29
/* Température de référence pour les réactions chimiques, 25°C */
30
#define T0 (273.15+25)
30
#define T0 (273.15+25)
31
 
31
 
32
/* MINVAL est une valeur impossible tant pour un potentiel standard */
32
/* MINVAL est une valeur impossible tant pour un potentiel standard */
33
/* que pour une constante d'équilibre                               */
33
/* que pour une constante d'équilibre                               */
34
#define MINVAL -999
34
#define MINVAL -999
35
 
35
 
36
typedef struct {
36
typedef struct {
37
  int Zed;
37
  int Zed;
38
  char symb[4];
38
  char symb[4];
Line 118... Line 118...
118
  };
118
  };
119
};
119
};
120
 
120
 
121
typedef enum { aqueous, aqueous_explicit, gas, liquid, sol } moltype;
121
typedef enum { aqueous, aqueous_explicit, gas, liquid, sol } moltype;
122
 
122
 
123
extern const char* moltypeStr[]; /* les chaînes aq, g,s */
123
extern const char* moltypeStr[]; /* les chaînes aq, g,s */
124
 
124
 
125
class Membre;
125
class Membre;
126
 
126
 
127
class Molec{
127
class Molec{
128
  AtomeListe * al;
128
  AtomeListe * al;
Line 219... Line 219...
219
 
219
 
220
class Chemeq{
220
class Chemeq{
221
  Membre * gauche, * droit;
221
  Membre * gauche, * droit;
222
  std::string cste;
222
  std::string cste;
223
  long double val;
223
  long double val;
-
 
224
  bool equ; /* false by default, true when an equilibrium must be rendered with \doubleharpoons */
224
public:
225
public:
225
  Chemeq(Membre * g, Membre * d) : gauche (g), droit(d), val(MINVAL){};
226
 Chemeq(Membre * g, Membre * d, bool equilibrium = false) :
-
 
227
  gauche (g), droit(d), val(MINVAL), equ(equilibrium) {
-
 
228
  };
226
  const Membre * membredroit()const{return droit;};
229
  const Membre * membredroit()const{return droit;};
227
  const Membre * membregauche()const{return gauche;};
230
  const Membre * membregauche()const{return gauche;};
-
 
231
  const bool is_equilibrium() const {return equ;};
228
  void addChemeq(const Chemeq *);
232
  void addChemeq(const Chemeq *);
229
  void subChemeq(const Chemeq *);
233
  void subChemeq(const Chemeq *);
230
  void simplifie(bool tri);
234
  void simplifie(bool tri);
231
  void numerote(){gauche->numerote(); droit->numerote();};
235
  void numerote(){gauche->numerote(); droit->numerote();};
232
  void triage(){gauche->triage(); droit->triage();};
236
  void triage(){gauche->triage(); droit->triage();};
233
  /* ajuste le coefficient pour qu'il y ait 1 mol du premier réactif */
237
  /* ajuste le coefficient pour qu'il y ait 1 mol du premier réactif */
234
  void coeff1();
238
  void coeff1();
235
  /* mutiplie par la fraction num/den */
239
  /* mutiplie par la fraction num/den */
236
  void multiply(int num, int den);
240
  void multiply(int num, int den);
237
  fraction nbelectron()const{return gauche->nbelectron()-droit->nbelectron();};
241
  fraction nbelectron()const{return gauche->nbelectron()-droit->nbelectron();};
238
  /* renvoie val ou nbelectron()*Faraday*val */
242
  /* renvoie val ou nbelectron()*Faraday*val */