13 if (l > 0) file << (*this);
17 Ifile <<
"AtomDef::printall:\n";
31 : nameh(fnameh), notationh(fnotationh), Zh(fZh), Ah(fAh) {
39 mfunnamep(
"double AtomDef::get_A(int fZ)");
43 if (an->el->Z() == fZ)
return an->el->A();
46 mcerr <<
"Atom is not found, Z=" << fZ <<
'\n';
52 mfunnamep(
"AtomDef* AtomDef::get_AtomDef(int fZ)");
56 if (an->el->Z() == fZ)
return an->el;
59 mcerr <<
"Atom is not found, Z=" << fZ <<
'\n';
66 if (nameh ==
"none" && notationh ==
"none")
return;
70 if (an->el->nameh == nameh || an->el->notationh == notationh) {
72 mcerr <<
"cannot initialize two atoms with the same name or notation\n";
73 mcerr <<
"name=" << nameh <<
" notation=" << notationh <<
'\n';
80 Ifile <<
"AtomDef: name=" << std::setw(10) << f.
name()
81 <<
" notation=" << std::setw(3) << f.
notation();
82 Ifile <<
" Z()=" << std::setw(3) << f.
Z()
83 <<
" A()/(gram/mole)=" << f.
A() / (gram / mole) <<
'\n';
100 if (an->el->notation() == fnotation)
return an->el;
111 weight_quanh(fqatom, 0.0),
112 weight_massh(fqatom, 0.0),
116 mean_ratio_Z_to_Ah(0.0) {
117 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
123 for (n = 0; n < qatomh; ++n) {
127 mcerr <<
"cannot find atom with notation " << fatom_not[n]
128 <<
"\nIn particular, check the sequence of initialization\n";
134 for (n = 0; n < qatomh; n++) {
135 weight_quanh[n] = fweight_quan[n];
137 s += weight_quanh[n];
141 for (n = 0; n < qatomh; n++) {
142 weight_quanh[n] /= s;
145 for (n = 0; n < qatomh; n++) {
146 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
149 for (n = 0; n < qatomh; n++) {
150 s += weight_massh[n];
154 for (n = 0; n < qatomh; n++) {
155 weight_massh[n] /= s;
158 for (n = 0; n < qatomh; n++) {
159 Z_meanh += atomh[n]->Z() * weight_quanh[n];
160 A_meanh += atomh[n]->A() * weight_quanh[n];
161 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
163 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
164 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
172 weight_quanh(fqatom, 0.0),
173 weight_massh(fqatom, 0.0),
177 mean_ratio_Z_to_Ah(0.0) {
178 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
184 for (n = 0; n < qatomh; ++n) {
188 mcerr <<
"cannot find atom with notation " << fatom_not[n]
189 <<
"\nIn particular, check the sequence of initialization\n";
196 for (n = 0; n < qatomh; n++) {
197 weight_quanh[n] = fweight_quan[n];
199 s += weight_quanh[n];
203 for (n = 0; n < qatomh; n++) {
204 weight_quanh[n] /= s;
207 for (n = 0; n < qatomh; n++) {
208 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
211 for (n = 0; n < qatomh; n++) {
212 s += weight_massh[n];
216 for (n = 0; n < qatomh; n++) {
217 weight_massh[n] /= s;
220 for (n = 0; n < qatomh; n++) {
221 Z_meanh += atomh[n]->Z() * weight_quanh[n];
222 A_meanh += atomh[n]->A() * weight_quanh[n];
223 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
225 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
226 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
239 mean_ratio_Z_to_Ah(0.0) {
240 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
244 mcerr <<
"cannot find atom with notation " << fatom_not
245 <<
"\nIn particular, check the sequence of initialization\n";
250 weight_quanh[0] = 1.0;
251 weight_massh[0] = 1.0;
253 Z_meanh += atomh[0]->Z();
254 A_meanh += atomh[0]->A();
255 inv_A_meanh += (1.0 / atomh[0]->A());
256 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
257 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
263 const String& fatom_not2,
double fweight_quan2)
271 mean_ratio_Z_to_Ah(0.0) {
272 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
274 fatom_not[0] = fatom_not1;
275 fatom_not[1] = fatom_not2;
278 for (n = 0; n < qatomh; ++n) {
282 mcerr <<
"cannot find atom with notation " << fatom_not[n]
283 <<
"\nIn particular, check the sequence of initialization\n";
288 weight_quanh[0] = fweight_quan1;
289 weight_quanh[1] = fweight_quan2;
291 for (n = 0; n < qatomh; n++) {
293 s += weight_quanh[n];
297 for (n = 0; n < qatomh; n++) {
298 weight_quanh[n] /= s;
301 for (n = 0; n < qatomh; n++) {
302 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
305 for (n = 0; n < qatomh; n++) {
306 s += weight_massh[n];
310 for (n = 0; n < qatomh; n++) {
311 weight_massh[n] /= s;
314 for (n = 0; n < qatomh; n++) {
315 Z_meanh += atomh[n]->Z() * weight_quanh[n];
316 A_meanh += atomh[n]->A() * weight_quanh[n];
317 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
319 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
320 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
326 const String& fatom_not2,
double fweight_quan2,
327 const String& fatom_not3,
double fweight_quan3)
335 mean_ratio_Z_to_Ah(0.0) {
337 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
339 fatom_not[0] = fatom_not1;
340 fatom_not[1] = fatom_not2;
341 fatom_not[2] = fatom_not3;
344 for (n = 0; n < qatomh; ++n) {
348 mcerr <<
"cannot find atom with notation " << fatom_not[n]
349 <<
"\nIn particular, check the sequence of initialization\n";
354 weight_quanh[0] = fweight_quan1;
355 weight_quanh[1] = fweight_quan2;
356 weight_quanh[2] = fweight_quan3;
358 for (n = 0; n < qatomh; n++) {
360 s += weight_quanh[n];
364 for (n = 0; n < qatomh; n++) {
365 weight_quanh[n] /= s;
368 for (n = 0; n < qatomh; n++) {
369 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
372 for (n = 0; n < qatomh; n++) {
373 s += weight_massh[n];
377 for (n = 0; n < qatomh; n++) {
378 weight_massh[n] /= s;
381 for (n = 0; n < qatomh; n++) {
382 Z_meanh += atomh[n]->Z() * weight_quanh[n];
383 A_meanh += atomh[n]->A() * weight_quanh[n];
384 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
386 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
387 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
393 const String& fatom_not2,
double fweight_quan2,
394 const String& fatom_not3,
double fweight_quan3,
395 const String& fatom_not4,
double fweight_quan4)
403 mean_ratio_Z_to_Ah(0.0) {
404 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
406 fatom_not[0] = fatom_not1;
407 fatom_not[1] = fatom_not2;
408 fatom_not[2] = fatom_not3;
409 fatom_not[3] = fatom_not4;
412 for (k = 0; k < qatomh; k++) {
416 mcerr <<
"cannot find atom with notation " << fatom_not[k]
417 <<
"\nIn particular, check the sequence of initialization\n";
422 weight_quanh[0] = fweight_quan1;
423 weight_quanh[1] = fweight_quan2;
424 weight_quanh[2] = fweight_quan3;
425 weight_quanh[3] = fweight_quan4;
427 for (n = 0; n < qatomh; n++) {
429 s += weight_quanh[n];
433 for (n = 0; n < qatomh; n++) {
434 weight_quanh[n] /= s;
437 for (n = 0; n < qatomh; n++) {
438 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
441 for (n = 0; n < qatomh; n++) {
442 s += weight_massh[n];
446 for (n = 0; n < qatomh; n++) {
447 weight_massh[n] /= s;
450 for (n = 0; n < qatomh; n++) {
451 Z_meanh += atomh[n]->Z() * weight_quanh[n];
452 A_meanh += atomh[n]->A() * weight_quanh[n];
453 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
455 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
456 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
460 if (l > 0) file << (*this);
465 "std::ostream& operator << (std::ostream& file, const AtomMixDef& f)");
466 Ifile <<
"AtomMixDef\n";
469 <<
" A_mean()/(gram/mole)=" << f.
A_mean() / (gram / mole) <<
'\n';
473 (gram / mole) <<
'\n';
479 for (
long n = 0; n < f.
qatom(); n++) {
480 Ifile <<
"n=" << n <<
" atom(n)->notation=" << f.
atom(n)->notation()
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
AbsListNode< T > * get_next_node(AbsListNode< T > *an) const
static AbsList< AtomDef * > & get_logbook(void)
const String & name(void) const
static AtomDef * get_AtomDef(const String &fnotation)
void print(std::ostream &file, int l=0) const
const String & notation(void) const
static void printall(std::ostream &file)
static const AbsList< AtomDef * > & get_const_logbook(void)
static double get_A(int fZ)
void print(std::ostream &file, int l) const
double NumberOfElectronsInGram(void) const
double A_mean(void) const
double inv_A_mean(void) const
double mean_ratio_Z_to_A(void) const
double Z_mean(void) const
const DynLinArr< PassivePtr< AtomDef > > & atom(void) const
const DynLinArr< double > & weight_quan(void) const
const DynLinArr< double > & weight_mass(void) const
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
const int max_poss_atom_z
#define Iprintn(file, name)