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,v 1.5 2006/06/29 20:24:53 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // Hadronic Process: Nuclear De-excitations |
---|
31 | // by V. Lara |
---|
32 | |
---|
33 | |
---|
34 | #include "G4StatMFMacroChemicalPotential.hh" |
---|
35 | |
---|
36 | // operators definitions |
---|
37 | G4StatMFMacroChemicalPotential & |
---|
38 | G4StatMFMacroChemicalPotential::operator=(const G4StatMFMacroChemicalPotential & ) |
---|
39 | { |
---|
40 | throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator= meant to not be accessable"); |
---|
41 | return *this; |
---|
42 | } |
---|
43 | |
---|
44 | G4bool G4StatMFMacroChemicalPotential::operator==(const G4StatMFMacroChemicalPotential & ) const |
---|
45 | { |
---|
46 | throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator== meant to not be accessable"); |
---|
47 | return false; |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | G4bool G4StatMFMacroChemicalPotential::operator!=(const G4StatMFMacroChemicalPotential & ) const |
---|
52 | { |
---|
53 | throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator!= meant to not be accessable"); |
---|
54 | return true; |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | G4double G4StatMFMacroChemicalPotential::CalcChemicalPotentialNu(void) |
---|
61 | // Calculate Chemical potential \nu |
---|
62 | { |
---|
63 | G4double CP = ((3./5.)*elm_coupling/G4StatMFParameters::Getr0())* |
---|
64 | (1.0-1.0/std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(),1.0/3.0)); |
---|
65 | |
---|
66 | // Initial value for _ChemPotentialNu |
---|
67 | _ChemPotentialNu = (theZ/theA)*(8.0*G4StatMFParameters::GetGamma0()+2.0*CP*std::pow(theA,2./3.)) - |
---|
68 | 4.0*G4StatMFParameters::GetGamma0(); |
---|
69 | |
---|
70 | |
---|
71 | G4double ChemPa = _ChemPotentialNu; |
---|
72 | G4double ChemPb = 0.5*_ChemPotentialNu; |
---|
73 | |
---|
74 | G4double fChemPa = this->operator()(ChemPa); |
---|
75 | G4double fChemPb = this->operator()(ChemPb); |
---|
76 | |
---|
77 | if (fChemPa*fChemPb > 0.0) { |
---|
78 | // bracketing the solution |
---|
79 | if (fChemPa < 0.0) { |
---|
80 | do { |
---|
81 | ChemPb -= 1.5*std::abs(ChemPb-ChemPa); |
---|
82 | fChemPb = this->operator()(ChemPb); |
---|
83 | } while (fChemPb < 0.0); |
---|
84 | } else { |
---|
85 | do { |
---|
86 | ChemPb += 1.5*std::abs(ChemPb-ChemPa); |
---|
87 | fChemPb = this->operator()(ChemPb); |
---|
88 | } while (fChemPb > 0.0); |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | G4Solver<G4StatMFMacroChemicalPotential> * theSolver = |
---|
93 | new G4Solver<G4StatMFMacroChemicalPotential>(100,1.e-4); |
---|
94 | theSolver->SetIntervalLimits(ChemPa,ChemPb); |
---|
95 | // if (!theSolver->Crenshaw(*this)) |
---|
96 | if (!theSolver->Brent(*this)) |
---|
97 | throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::CalcChemicalPotentialNu: I couldn't find the root."); |
---|
98 | _ChemPotentialNu = theSolver->GetRoot(); |
---|
99 | delete theSolver; |
---|
100 | return _ChemPotentialNu; |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | G4double G4StatMFMacroChemicalPotential::CalcMeanZ(const G4double nu) |
---|
106 | { |
---|
107 | std::vector<G4VStatMFMacroCluster*>::iterator i; |
---|
108 | for (i= _theClusters->begin()+1; i != _theClusters->end(); ++i) |
---|
109 | { |
---|
110 | (*i)->CalcZARatio(nu); |
---|
111 | } |
---|
112 | CalcChemicalPotentialMu(nu); |
---|
113 | // This is important, the Z over A ratio for proton and neutron depends on the |
---|
114 | // chemical potential Mu, while for the first guess for Chemical potential mu |
---|
115 | // some values of Z over A ratio. This is the reason for that. |
---|
116 | (*_theClusters->begin())->CalcZARatio(nu); |
---|
117 | |
---|
118 | G4double MeanZ = 0.0; |
---|
119 | G4int n = 1; |
---|
120 | for (i = _theClusters->begin(); i != _theClusters->end(); ++i) |
---|
121 | { |
---|
122 | MeanZ += static_cast<G4double>(n++) * |
---|
123 | (*i)->GetZARatio() * |
---|
124 | (*i)->GetMeanMultiplicity(); |
---|
125 | } |
---|
126 | return MeanZ; |
---|
127 | } |
---|
128 | |
---|
129 | |
---|
130 | void G4StatMFMacroChemicalPotential::CalcChemicalPotentialMu(const G4double nu) |
---|
131 | // Calculate Chemical potential \mu |
---|
132 | // For that is necesary to calculate mean multiplicities |
---|
133 | { |
---|
134 | G4StatMFMacroMultiplicity * theMultip = new |
---|
135 | G4StatMFMacroMultiplicity(theA,_Kappa,_MeanTemperature,nu,_theClusters); |
---|
136 | |
---|
137 | _ChemPotentialMu = theMultip->CalcChemicalPotentialMu(); |
---|
138 | _MeanMultiplicity = theMultip->GetMeanMultiplicity(); |
---|
139 | |
---|
140 | delete theMultip; |
---|
141 | |
---|
142 | return; |
---|
143 | |
---|
144 | } |
---|