12 long fqmolec,
const std::vector<std::string>& fmolec_not,
13 const std::vector<double>& fweight_quan_molec,
double fpressure,
14 double ftemperature,
double fdensity)
15 : pressureh(fpressure),
17 molech(fqmolec, nullptr),
18 weight_quan_molech(fqmolec),
19 weight_mass_molech(fqmolec) {
20 mfunname(
"GasDef::GasDef(...many molecules...)");
23 for (
long k = 0; k < fqmolec; ++k) {
26 "No molecule with such notation: " << fmolec_not[k] <<
'\n',
29 mcerr <<
"cannot find molecule with notation " << fmolec_not[k]
30 <<
"\nIn particular, check the sequence of initialization\n";
36 for (
long n = 0; n < fqmolec; ++n) {
37 weight_quan_molech[n] = fweight_quan_molec[n];
39 s += weight_quan_molech[n];
43 for (
long n = 0; n < fqmolec; ++n) {
44 weight_quan_molech[n] /= s;
47 for (
long n = 0; n < fqmolec; ++n) {
48 weight_mass_molech[n] = weight_quan_molech[n] * molech[n]->A_total();
51 for (
long n = 0; n < fqmolec; ++n) {
52 s += weight_mass_molech[n];
56 for (
long n = 0; n < fqmolec; ++n) {
57 weight_mass_molech[n] /= s;
62 std::vector<std::string> fatom_not(1000);
63 std::vector<double> weight_qa(1000, 0.0);
64 for (
long k = 0; k < fqmolec; ++k) {
65 for (
long n = 0; n < molech[k]->qatom(); ++n) {
83 fatom_not[qat] = molech[k]->atom(n)->notation();
84 weight_qa[qat] = fweight_quan_molec[k] * molech[k]->qatom_ps(n);
93 for (
long n = 0; n < qmolech; ++n) {
94 sa += weight_quan_molech[n] * molech[n]->A_total();
95 sw += weight_quan_molech[n];
97 const double rydberg = k_Boltzmann * Avogadro;
98 fdensity = sa * fpressure / (rydberg * ftemperature * sw);
102 fdensity, ftemperature);
107 long fqmolec,
const std::vector<std::string>& fmolec_not,
108 const std::vector<double>& fweight_volume_molec,
109 double fpressure,
double ftemperature,
int ,
int ) {
111 mfunname(
"GasDef::GasDef(...many molecules... Waals)");
112 std::vector<const MoleculeDef*> amolec(fqmolec);
113 for (
long n = 0; n < fqmolec; ++n) {
116 "No molecule with such notation: " << fmolec_not[n] <<
'\n',
122 std::vector<double> fw(fqmolec);
125 for (
long n = 0; n < fqmolec; ++n) {
126 s += fweight_volume_molec[n];
129 for (
long n = 0; n < fqmolec; ++n) {
130 fw[n] = fweight_volume_molec[n] / s;
134 std::vector<double> fweight_quan_molec(fqmolec);
136 constexpr double rydberg = k_Boltzmann * Avogadro;
137 for (
long n = 0; n < fqmolec; ++n) {
141 fweight_quan_molec[n] = fw[n] * fpressure / (rydberg * ftemperature);
142 double ms = fweight_quan_molec[n] * amolec[n]->A_total();
148 double number_of_moles =
150 fpressure, s_not_single);
152 fweight_quan_molec[n] = number_of_moles;
153 double ms = fweight_quan_molec[n] * amolec[n]->A_total();
158 double density_t = mass_t;
159 *
this =
GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
160 fpressure, ftemperature, density_t);
172 const std::string& fmolec_not,
double fpressure,
173 double ftemperature,
int s1,
int s2) :
174 GasDef(fname, fnotation, 1, {fmolec_not}, {1.},
175 fpressure, ftemperature, s1, s2) {
180 const std::string& fmolec_not1,
double fweight_quan_molec1,
181 const std::string& fmolec_not2,
double fweight_quan_molec2,
182 double fpressure,
double ftemperature,
double fdensity) :
183 GasDef(fname, fnotation, 2, {fmolec_not1, fmolec_not2},
184 {fweight_quan_molec1, fweight_quan_molec2},
185 fpressure, ftemperature, fdensity) {
190 const std::string& fmolec_not1,
double fweight_volume_molec1,
191 const std::string& fmolec_not2,
double fweight_volume_molec2,
192 double fpressure,
double ftemperature,
int s1,
int s2) :
193 GasDef(fname, fnotation, 2, {fmolec_not1, fmolec_not2},
194 {fweight_volume_molec1, fweight_volume_molec2},
195 fpressure, ftemperature, s1, s2) {
200 const std::string& fmolec_not1,
double fweight_quan_molec1,
201 const std::string& fmolec_not2,
double fweight_quan_molec2,
202 const std::string& fmolec_not3,
double fweight_quan_molec3,
203 double fpressure,
double ftemperature,
double fdensity) :
204 GasDef(fname, fnotation, 3, {fmolec_not1, fmolec_not2, fmolec_not3},
205 {fweight_quan_molec1, fweight_quan_molec2, fweight_quan_molec3},
206 fpressure, ftemperature, fdensity) {
211 const std::string& fmolec_not1,
double fweight_volume_molec1,
212 const std::string& fmolec_not2,
double fweight_volume_molec2,
213 const std::string& fmolec_not3,
double fweight_volume_molec3,
214 double fpressure,
double ftemperature,
int s1,
int s2) :
215 GasDef(fname, fnotation, 3, {fmolec_not1, fmolec_not2, fmolec_not3},
216 {fweight_volume_molec1, fweight_volume_molec2, fweight_volume_molec3},
217 fpressure, ftemperature, s1, s2) {
222 const GasDef& gd,
double fpressure,
double ftemperature,
224 mfunname(
"GasDef::GasDef( another GasDef with different pres)");
225 long fqmolec = gd.
qmolec();
226 std::vector<std::string> fmolec_not(fqmolec);
227 std::vector<double> fweight_quan_molec(fqmolec);
228 for (
long n = 0; n < fqmolec; ++n) {
229 fmolec_not[n] = gd.
molec(n)->notation();
232 *
this =
GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
233 fpressure, ftemperature, fdensity);