Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::MoleculeDef Class Reference

#include <MoleculeDef.h>

+ Inheritance diagram for Heed::MoleculeDef:

Public Member Functions

const std::string & name () const
 
const std::string & notation () const
 
const std::vector< long > & qatom_ps () const
 
long qatom_ps (long n) const
 
long Z_total () const
 
double A_total () const
 
long tqatom () const
 
const std::shared_ptr< VanDerWaals > & vdw () const
 
 MoleculeDef ()
 
 MoleculeDef (const std::string &fname, const std::string &fnotation, long fqatom, const std::vector< std::string > &fatom_not, const std::vector< long > &fqatom_ps, std::shared_ptr< VanDerWaals > fvdw={})
 
 MoleculeDef (const std::string &fname, const std::string &fnotation, const std::string &fatom_not, long fqatom_ps, std::shared_ptr< VanDerWaals > fvdw={})
 
 MoleculeDef (const std::string &fname, const std::string &fnotation, const std::string &fatom_not1, long fqatom_ps1, const std::string &fatom_not2, long fqatom_ps2, std::shared_ptr< VanDerWaals > fvdw={})
 
 MoleculeDef (const std::string &fname, const std::string &fnotation, const std::string &fatom_not1, long fqatom_ps1, const std::string &fatom_not2, long fqatom_ps2, const std::string &fatom_not3, long fqatom_ps3, std::shared_ptr< VanDerWaals > fvdw={})
 
 ~MoleculeDef ()
 
void print (std::ostream &file, int l) const
 
void verify ()
 Check that there is no molecule with the same name in the container.
 
MoleculeDefcopy () const
 
- Public Member Functions inherited from Heed::AtomMixDef
 AtomMixDef ()=default
 Default constructor.
 
 AtomMixDef (unsigned long fqatom, const std::vector< std::string > &fatom_not, const std::vector< double > &fweight_quan)
 
 AtomMixDef (unsigned long fqatom, const std::vector< std::string > &fatom_not, const std::vector< long > &fweight_quan)
 
 AtomMixDef (const std::string &fatom_not)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3, const std::string &fatom_not4, double fweight_quan4)
 
void print (std::ostream &file, int l) const
 
long qatom () const
 
const std::vector< AtomDef * > & atom () const
 
AtomDefatom (long n) const
 
const std::vector< double > & weight_quan () const
 
const std::vector< double > & weight_mass () const
 
double weight_quan (long n) const
 
double weight_mass (long n) const
 
double Z_mean () const
 
double A_mean () const
 
double inv_A_mean () const
 
double mean_ratio_Z_to_A () const
 
double NumberOfElectronsInGram () const
 

Static Public Member Functions

static void printall (std::ostream &file)
 
static std::list< MoleculeDef * > & get_logbook ()
 
static const std::list< MoleculeDef * > & get_const_logbook ()
 
static MoleculeDefget_MoleculeDef (const std::string &fnotation)
 

Detailed Description

Definition of molecule as a mixture of atoms. Only the basic information: the name, the notation, the mean charge and atomic weight and the parameters of mixture class.

The principle of definitions of matters is the same as for atoms: a dictionary or a database. See details there. But the logbook is different, of course.

1998-2004 I. Smirnov

Definition at line 50 of file MoleculeDef.h.

Constructor & Destructor Documentation

◆ MoleculeDef() [1/5]

Heed::MoleculeDef::MoleculeDef ( )

Definition at line 62 of file MoleculeDef.cpp.

62 {
63 MoleculeDef::get_logbook().push_back(this);
64}
static std::list< MoleculeDef * > & get_logbook()

Referenced by copy().

◆ MoleculeDef() [2/5]

Heed::MoleculeDef::MoleculeDef ( const std::string &  fname,
const std::string &  fnotation,
long  fqatom,
const std::vector< std::string > &  fatom_not,
const std::vector< long > &  fqatom_ps,
std::shared_ptr< VanDerWaals fvdw = {} 
)

Definition at line 66 of file MoleculeDef.cpp.

70 : AtomMixDef(fqatom, fatom_not, fqatom_ps),
71 nameh(fname),
72 notationh(fnotation),
73 qatom_psh(fqatom_ps) {
74 mfunname("MoleculeDef::MoleculeDef(...)");
75 m_vdw = std::move(fvdw);
76 for (long n = 0; n < qatom(); n++) {
77 Z_totalh += qatom_psh[n] * atom(n)->Z();
78 A_totalh += qatom_psh[n] * atom(n)->A();
79 tqatomh += qatom_psh[n];
80 check_econd11(qatom_psh[n], <= 0, mcerr);
81 }
82 verify();
83 MoleculeDef::get_logbook().push_back(this);
84}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:155
#define mfunname(string)
Definition: FunNameStack.h:45
AtomMixDef()=default
Default constructor.
long qatom() const
Definition: AtomDef.h:133
const std::vector< AtomDef * > & atom() const
Definition: AtomDef.h:134
void verify()
Check that there is no molecule with the same name in the container.
#define mcerr
Definition: prstream.h:128

◆ MoleculeDef() [3/5]

Heed::MoleculeDef::MoleculeDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fatom_not,
long  fqatom_ps,
std::shared_ptr< VanDerWaals fvdw = {} 
)

Definition at line 87 of file MoleculeDef.cpp.

90 : AtomMixDef(fatom_not),
91 nameh(fname),
92 notationh(fnotation),
93 qatom_psh(1, fqatom_ps),
94 tqatomh(fqatom_ps) {
95 mfunname("MoleculeDef::MoleculeDef(...)");
96 m_vdw = std::move(fvdw);
97 Z_totalh = atom(0)->Z() * fqatom_ps;
98 A_totalh = atom(0)->A() * fqatom_ps;
99 verify();
100 MoleculeDef::get_logbook().push_back(this);
101}

◆ MoleculeDef() [4/5]

Heed::MoleculeDef::MoleculeDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fatom_not1,
long  fqatom_ps1,
const std::string &  fatom_not2,
long  fqatom_ps2,
std::shared_ptr< VanDerWaals fvdw = {} 
)

Definition at line 104 of file MoleculeDef.cpp.

108 : AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2),
109 nameh(fname),
110 notationh(fnotation),
111 qatom_psh(2) {
112 mfunname("MoleculeDef::MoleculeDef(...)");
113 m_vdw = std::move(fvdw);
114 qatom_psh[0] = fqatom_ps1;
115 qatom_psh[1] = fqatom_ps2;
116 for (long n = 0; n < qatom(); n++) {
117 check_econd11(qatom_psh[n], <= 0, mcerr);
118 Z_totalh += qatom_psh[n] * atom(n)->Z();
119 A_totalh += qatom_psh[n] * atom(n)->A();
120 tqatomh += qatom_psh[n];
121 }
122 verify();
123 MoleculeDef::get_logbook().push_back(this);
124}

◆ MoleculeDef() [5/5]

Heed::MoleculeDef::MoleculeDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fatom_not1,
long  fqatom_ps1,
const std::string &  fatom_not2,
long  fqatom_ps2,
const std::string &  fatom_not3,
long  fqatom_ps3,
std::shared_ptr< VanDerWaals fvdw = {} 
)

Definition at line 127 of file MoleculeDef.cpp.

132 : AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2, fatom_not3,
133 fqatom_ps3),
134 nameh(fname),
135 notationh(fnotation),
136 qatom_psh(3) {
137 mfunname("MoleculeDef::MoleculeDef(...)");
138 m_vdw = std::move(fvdw);
139 qatom_psh[0] = fqatom_ps1;
140 qatom_psh[1] = fqatom_ps2;
141 qatom_psh[2] = fqatom_ps3;
142 for (long n = 0; n < qatom(); n++) {
143 check_econd11(qatom_psh[n], <= 0, mcerr);
144 Z_totalh += qatom_psh[n] * atom(n)->Z();
145 A_totalh += qatom_psh[n] * atom(n)->A();
146 tqatomh += qatom_psh[n];
147 }
148 verify();
149 MoleculeDef::get_logbook().push_back(this);
150}

◆ ~MoleculeDef()

Heed::MoleculeDef::~MoleculeDef ( )

Definition at line 225 of file MoleculeDef.cpp.

225{ MoleculeDef::get_logbook().remove(this); }

Member Function Documentation

◆ A_total()

double Heed::MoleculeDef::A_total ( ) const
inline

Definition at line 71 of file MoleculeDef.h.

71{ return A_totalh; }

Referenced by Heed::operator<<().

◆ copy()

MoleculeDef * Heed::MoleculeDef::copy ( ) const
inline

Definition at line 106 of file MoleculeDef.h.

106{ return new MoleculeDef(*this); }

◆ get_const_logbook()

const std::list< MoleculeDef * > & Heed::MoleculeDef::get_const_logbook ( )
static

Initialize the logbook at the first request and keep it as internal static variable.

Definition at line 180 of file MoleculeDef.cpp.

180 {
182}

◆ get_logbook()

std::list< MoleculeDef * > & Heed::MoleculeDef::get_logbook ( )
static

Definition at line 175 of file MoleculeDef.cpp.

175 {
176 static std::list<MoleculeDef*> logbook;
177 return logbook;
178}

Referenced by get_const_logbook(), get_MoleculeDef(), MoleculeDef(), printall(), verify(), and ~MoleculeDef().

◆ get_MoleculeDef()

MoleculeDef * Heed::MoleculeDef::get_MoleculeDef ( const std::string &  fnotation)
static

Return the address of the molecule with this name. If there is no molecule with this notation, the function returns NULL but does not terminate the program as that for AtomDef. Be careful.

Definition at line 184 of file MoleculeDef.cpp.

184 {
185 for (auto molecule : MoleculeDef::get_logbook()) {
186 if (molecule->notation() == fnotation) return molecule;
187 }
188 return nullptr;
189}

Referenced by Heed::GasDef::GasDef().

◆ name()

const std::string & Heed::MoleculeDef::name ( ) const
inline

Definition at line 66 of file MoleculeDef.h.

66{ return nameh; }

Referenced by Heed::operator<<().

◆ notation()

const std::string & Heed::MoleculeDef::notation ( ) const
inline

Definition at line 67 of file MoleculeDef.h.

67{ return notationh; }

Referenced by Heed::operator<<().

◆ print()

void Heed::MoleculeDef::print ( std::ostream &  file,
int  l 
) const

Definition at line 152 of file MoleculeDef.cpp.

152 {
153 if (l > 0) file << (*this);
154}

◆ printall()

void Heed::MoleculeDef::printall ( std::ostream &  file)
static

Definition at line 156 of file MoleculeDef.cpp.

156 {
157 Ifile << "MoleculeDef::printall:\n";
158 for (auto molecule : MoleculeDef::get_logbook()) {
159 file << molecule;
160 }
161}
#define Ifile
Definition: prstream.h:195

◆ qatom_ps() [1/2]

const std::vector< long > & Heed::MoleculeDef::qatom_ps ( ) const
inline

Definition at line 68 of file MoleculeDef.h.

68{ return qatom_psh; }

Referenced by Heed::operator<<().

◆ qatom_ps() [2/2]

long Heed::MoleculeDef::qatom_ps ( long  n) const
inline

Definition at line 69 of file MoleculeDef.h.

69{ return qatom_psh[n]; }

◆ tqatom()

long Heed::MoleculeDef::tqatom ( ) const
inline

Definition at line 72 of file MoleculeDef.h.

72{ return tqatomh; }

Referenced by Heed::operator<<().

◆ vdw()

const std::shared_ptr< VanDerWaals > & Heed::MoleculeDef::vdw ( ) const
inline

Definition at line 73 of file MoleculeDef.h.

73{ return m_vdw; }

Referenced by Heed::operator<<().

◆ verify()

void Heed::MoleculeDef::verify ( )

Check that there is no molecule with the same name in the container.

Definition at line 163 of file MoleculeDef.cpp.

163 {
164 mfunnamep("void MoleculeDef::verify()");
165 if (nameh == "none" && notationh == "none") return;
166 for (auto molecule : MoleculeDef::get_logbook()) {
167 if (molecule->nameh != nameh && molecule->notationh != notationh) continue;
168 funnw.ehdr(mcerr);
169 mcerr << "cannot initialize two molecules with the same name or notation\n";
170 mcerr << "name=" << nameh << " notation=" << notationh << '\n';
171 spexit(mcerr);
172 }
173}
#define mfunnamep(string)
Definition: FunNameStack.h:49
#define spexit(stream)
Definition: FunNameStack.h:256

Referenced by MoleculeDef().

◆ Z_total()

long Heed::MoleculeDef::Z_total ( ) const
inline

Definition at line 70 of file MoleculeDef.h.

70{ return Z_totalh; }

Referenced by Heed::operator<<().


The documentation for this class was generated from the following files: