Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4StatMFMacroChemicalPotential.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4StatMFMacroChemicalPotential.cc 100379 2016-10-19 15:05:35Z gcosmo $
28 //
29 // Hadronic Process: Nuclear De-excitations
30 // by V. Lara
31 
33 #include "G4PhysicalConstants.hh"
34 #include "G4Pow.hh"
35 
36 // operators definitions
39 {
40  throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator= meant to not be accessable");
41  return *this;
42 }
43 
45 {
46  throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator== meant to not be accessable");
47  return false;
48 }
49 
50 
52 {
53  throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator!= meant to not be accessable");
54  return true;
55 }
56 
58 // Calculate Chemical potential \nu
59 {
60  G4Pow* g4calc = G4Pow::GetInstance();
62 
63  // Initial value for _ChemPotentialNu
65  +2.0*CP*g4calc->Z23(theA))
67 
68  G4double ChemPa = _ChemPotentialNu;
69  G4double ChemPb = 0.5*_ChemPotentialNu;
70 
71  G4double fChemPa = this->operator()(ChemPa);
72  G4double fChemPb = this->operator()(ChemPb);
73 
74  if (fChemPa*fChemPb > 0.0) {
75  // bracketing the solution
76  if (fChemPa < 0.0) {
77  do {
78  ChemPb -= 1.5*std::abs(ChemPb-ChemPa);
79  fChemPb = this->operator()(ChemPb);
80  // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
81  } while (fChemPb < 0.0);
82  } else {
83  do {
84  ChemPb += 1.5*std::abs(ChemPb-ChemPa);
85  fChemPb = this->operator()(ChemPb);
86  // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
87  } while (fChemPb > 0.0);
88  }
89  }
90 
93  theSolver->SetIntervalLimits(ChemPa,ChemPb);
94  // if (!theSolver->Crenshaw(*this))
95  if (!theSolver->Brent(*this)){
96  G4cout <<"G4StatMFMacroChemicalPotential:"<<" ChemPa="<<ChemPa
97  <<" ChemPb="<<ChemPb<< G4endl;
98  G4cout <<"G4StatMFMacroChemicalPotential:"<<" fChemPa="<<fChemPa
99  <<" fChemPb="<<fChemPb<< G4endl;
100  throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::CalcChemicalPotentialNu: I couldn't find the root.");
101  }
102  _ChemPotentialNu = theSolver->GetRoot();
103  delete theSolver;
104  return _ChemPotentialNu;
105 }
106 
107 
108 
110 {
111  std::vector<G4VStatMFMacroCluster*>::iterator i;
112  for (i= _theClusters->begin()+1; i != _theClusters->end(); ++i)
113  {
114  (*i)->CalcZARatio(nu);
115  }
117  // This is important, the Z over A ratio for proton and neutron depends on the
118  // chemical potential Mu, while for the first guess for Chemical potential mu
119  // some values of Z over A ratio. This is the reason for that.
120  (*_theClusters->begin())->CalcZARatio(nu);
121 
122  G4double MeanZ = 0.0;
123  G4int n = 1;
124  for (i = _theClusters->begin(); i != _theClusters->end(); ++i)
125  {
126  MeanZ += (n++) * (*i)->GetZARatio() * (*i)->GetMeanMultiplicity();
127  }
128  return MeanZ;
129 }
130 
132 // Calculate Chemical potential \mu
133 // For that is necesary to calculate mean multiplicities
134 {
135  G4StatMFMacroMultiplicity * theMultip = new
137 
139  _MeanMultiplicity = theMultip->GetMeanMultiplicity();
140 
141  delete theMultip;
142 
143  return;
144 }
#define G4endl
Definition: G4ios.hh:61
static G4double GetCoulomb()
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
static G4Pow * GetInstance()
Definition: G4Pow.cc:57
G4double GetRoot(void) const
Definition: G4Solver.hh:77
G4double GetMeanMultiplicity(void) const
void SetIntervalLimits(const G4double Limit1, const G4double Limit2)
G4bool operator!=(const G4StatMFMacroChemicalPotential &right) const
int G4int
Definition: G4Types.hh:78
Definition: G4Pow.hh:56
G4GLOB_DLL std::ostream G4cout
Char_t n[5]
G4bool operator==(const G4StatMFMacroChemicalPotential &right) const
G4StatMFMacroChemicalPotential & operator=(const G4StatMFMacroChemicalPotential &right)
G4bool Brent(Function &theFunction)
std::vector< G4VStatMFMacroCluster * > * _theClusters
G4double Z23(G4int Z) const
Definition: G4Pow.hh:137
static G4double GetGamma0()