15 if (l > 0) file << (*this);
19 Ifile <<
"AtomDef::printall:\n";
21 std::list<AtomDef*>::const_iterator it;
22 std::list<AtomDef*>::const_iterator end = logbook.end();
23 for (it = logbook.begin(); it != end; ++it) file << (*it);
32 : nameh(fnameh), notationh(fnotationh), Zh(fZh), Ah(fAh) {
40 mfunnamep(
"double AtomDef::get_A(int fZ)");
42 std::list<AtomDef*>::const_iterator it;
43 std::list<AtomDef*>::const_iterator end = logbook.end();
44 for (it = logbook.begin(); it != end; ++it) {
45 if ((*it)->Z() == fZ)
return (*it)->A();
48 mcerr <<
"Atom is not found, Z=" << fZ <<
'\n';
54 mfunnamep(
"AtomDef* AtomDef::get_AtomDef(int fZ)");
56 std::list<AtomDef*>::const_iterator it;
57 std::list<AtomDef*>::const_iterator end = logbook.end();
58 for (it = logbook.begin(); it != end; ++it) {
59 if ((*it)->Z() == fZ)
return *it;
62 mcerr <<
"Atom is not found, Z=" << fZ <<
'\n';
69 if (nameh ==
"none" && notationh ==
"none")
return;
71 std::list<AtomDef*>::const_iterator it;
72 std::list<AtomDef*>::const_iterator end = logbook.end();
73 for (it = logbook.begin(); it != end; ++it) {
74 if ((*it)->nameh == nameh || (*it)->notationh == notationh) {
76 mcerr <<
"cannot initialize two atoms with the same name or notation\n";
77 mcerr <<
"name=" << nameh <<
" notation=" << notationh <<
'\n';
84 Ifile <<
"AtomDef: name=" << std::setw(10) << f.
name()
85 <<
" notation=" << std::setw(3) << f.
notation();
86 Ifile <<
" Z()=" << std::setw(3) << f.
Z()
87 <<
" A()/(gram/mole)=" << f.
A() / (gram / mole) <<
'\n';
92 static std::list<AtomDef*> logbook;
102 std::list<AtomDef*>::const_iterator it;
103 std::list<AtomDef*>::const_iterator end = logbook.end();
104 for (it = logbook.begin(); it != end; ++it) {
105 if ((*it)->notation() == fnotation)
return *it;
113 const std::vector<std::string>& fatom_not,
114 const std::vector<double>& fweight_quan)
117 weight_quanh(fqatom, 0.0),
118 weight_massh(fqatom, 0.0),
122 mean_ratio_Z_to_Ah(0.0) {
123 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
128 for (
long n = 0; n < qatomh; ++n) {
132 mcerr <<
"cannot find atom with notation " << fatom_not[n]
133 <<
"\nIn particular, check the sequence of initialization\n";
139 for (
long n = 0; n < qatomh; n++) {
140 weight_quanh[n] = fweight_quan[n];
142 s += weight_quanh[n];
146 for (
long n = 0; n < qatomh; n++) {
147 weight_quanh[n] /= s;
150 for (
long n = 0; n < qatomh; n++) {
151 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
154 for (
long n = 0; n < qatomh; n++) {
155 s += weight_massh[n];
159 for (
long n = 0; n < qatomh; n++) {
160 weight_massh[n] /= s;
163 for (
long n = 0; n < qatomh; n++) {
164 Z_meanh += atomh[n]->Z() * weight_quanh[n];
165 A_meanh += atomh[n]->A() * weight_quanh[n];
166 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
168 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
169 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
173 const std::vector<std::string>& fatom_not,
174 const std::vector<long>& fweight_quan)
177 weight_quanh(fqatom, 0.0),
178 weight_massh(fqatom, 0.0),
182 mean_ratio_Z_to_Ah(0.0) {
183 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
188 for (
long n = 0; n < qatomh; ++n) {
192 mcerr <<
"cannot find atom with notation " << fatom_not[n]
193 <<
"\nIn particular, check the sequence of initialization\n";
199 for (
long n = 0; n < qatomh; n++) {
200 weight_quanh[n] = fweight_quan[n];
202 s += weight_quanh[n];
206 for (
long n = 0; n < qatomh; n++) {
207 weight_quanh[n] /= s;
210 for (
long n = 0; n < qatomh; n++) {
211 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
214 for (
long n = 0; n < qatomh; n++) {
215 s += weight_massh[n];
219 for (
long n = 0; n < qatomh; n++) {
220 weight_massh[n] /= s;
223 for (
long n = 0; n < qatomh; n++) {
224 Z_meanh += atomh[n]->Z() * weight_quanh[n];
225 A_meanh += atomh[n]->A() * weight_quanh[n];
226 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
228 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
229 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
241 mean_ratio_Z_to_Ah(0.0) {
242 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
246 mcerr <<
"cannot find atom with notation " << fatom_not
247 <<
"\nIn particular, check the sequence of initialization\n";
252 weight_quanh[0] = 1.0;
253 weight_massh[0] = 1.0;
255 Z_meanh += atomh[0]->Z();
256 A_meanh += atomh[0]->A();
257 inv_A_meanh += (1.0 / atomh[0]->A());
258 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
259 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
264 const std::string& fatom_not2,
double fweight_quan2)
272 mean_ratio_Z_to_Ah(0.0) {
273 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
274 std::vector<std::string> fatom_not(2);
275 fatom_not[0] = fatom_not1;
276 fatom_not[1] = fatom_not2;
278 for (
long 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 (
long n = 0; n < qatomh; n++) {
293 s += weight_quanh[n];
297 for (
long n = 0; n < qatomh; n++) {
298 weight_quanh[n] /= s;
301 for (
long n = 0; n < qatomh; n++) {
302 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
305 for (
long n = 0; n < qatomh; n++) {
306 s += weight_massh[n];
310 for (
long n = 0; n < qatomh; n++) {
311 weight_massh[n] /= s;
314 for (
long 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;
325 const std::string& fatom_not2,
double fweight_quan2,
326 const std::string& fatom_not3,
double fweight_quan3)
334 mean_ratio_Z_to_Ah(0.0) {
336 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
337 std::vector<std::string> fatom_not(3);
338 fatom_not[0] = fatom_not1;
339 fatom_not[1] = fatom_not2;
340 fatom_not[2] = fatom_not3;
342 for (
long n = 0; n < qatomh; ++n) {
346 mcerr <<
"cannot find atom with notation " << fatom_not[n]
347 <<
"\nIn particular, check the sequence of initialization\n";
352 weight_quanh[0] = fweight_quan1;
353 weight_quanh[1] = fweight_quan2;
354 weight_quanh[2] = fweight_quan3;
356 for (
long n = 0; n < qatomh; n++) {
358 s += weight_quanh[n];
362 for (
long n = 0; n < qatomh; n++) {
363 weight_quanh[n] /= s;
366 for (
long n = 0; n < qatomh; n++) {
367 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
370 for (
long n = 0; n < qatomh; n++) {
371 s += weight_massh[n];
375 for (
long n = 0; n < qatomh; n++) {
376 weight_massh[n] /= s;
379 for (
long n = 0; n < qatomh; n++) {
380 Z_meanh += atomh[n]->Z() * weight_quanh[n];
381 A_meanh += atomh[n]->A() * weight_quanh[n];
382 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
384 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
385 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
390 const std::string& fatom_not2,
double fweight_quan2,
391 const std::string& fatom_not3,
double fweight_quan3,
392 const std::string& fatom_not4,
double fweight_quan4)
400 mean_ratio_Z_to_Ah(0.0) {
401 mfunnamep(
"AtomMixDef::AtomMixDef(...)");
402 std::vector<std::string> fatom_not(4);
403 fatom_not[0] = fatom_not1;
404 fatom_not[1] = fatom_not2;
405 fatom_not[2] = fatom_not3;
406 fatom_not[3] = fatom_not4;
408 for (
long k = 0; k < qatomh; k++) {
412 mcerr <<
"cannot find atom with notation " << fatom_not[k]
413 <<
"\nIn particular, check the sequence of initialization\n";
418 weight_quanh[0] = fweight_quan1;
419 weight_quanh[1] = fweight_quan2;
420 weight_quanh[2] = fweight_quan3;
421 weight_quanh[3] = fweight_quan4;
423 for (
long n = 0; n < qatomh; n++) {
425 s += weight_quanh[n];
429 for (
long n = 0; n < qatomh; n++) {
430 weight_quanh[n] /= s;
433 for (
long n = 0; n < qatomh; n++) {
434 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
437 for (
long n = 0; n < qatomh; n++) {
438 s += weight_massh[n];
442 for (
long n = 0; n < qatomh; n++) {
443 weight_massh[n] /= s;
446 for (
long n = 0; n < qatomh; n++) {
447 Z_meanh += atomh[n]->Z() * weight_quanh[n];
448 A_meanh += atomh[n]->A() * weight_quanh[n];
449 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
451 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
452 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
456 if (l > 0) file << (*this);
461 "std::ostream& operator << (std::ostream& file, const AtomMixDef& f)");
462 Ifile <<
"AtomMixDef\n";
465 <<
" A_mean()/(gram/mole)=" << f.
A_mean() / (gram / mole) <<
'\n';
469 (gram / mole) <<
'\n';
475 for (
long n = 0; n < f.
qatom(); n++) {
476 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)
static std::list< AtomDef * > & get_logbook()
void verify()
Check that there is no atom with the same name in the container.
AtomDef()
Default constructor.
const std::string & name() const
void print(std::ostream &file, int l=0) const
static void printall(std::ostream &file)
Print all registered atoms.
const std::string & notation() const
static double get_A(int fZ)
static AtomDef * get_AtomDef(const std::string &fnotation)
static const std::list< AtomDef * > & get_const_logbook()
const std::vector< PassivePtr< AtomDef > > & atom() const
const std::vector< double > & weight_quan() const
void print(std::ostream &file, int l) const
const std::vector< double > & weight_mass() const
double mean_ratio_Z_to_A() const
AtomMixDef()
Default constructor.
double NumberOfElectronsInGram() const
double inv_A_mean() const
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
#define Iprintn(file, name)