source: trunk/source/processes/hadronic/models/de_excitation/multifragmentation/src/G4StatMFMacroChemicalPotential.cc @ 1340

Last change on this file since 1340 was 1340, checked in by garnier, 14 years ago

update ti head

File size: 5.5 KB
Line 
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.6 2008/07/25 11:20:47 vnivanch Exp $
28// GEANT4 tag $Name: geant4-09-03-ref-09 $
29//
30// Hadronic Process: Nuclear De-excitations
31// by V. Lara
32
33
34#include "G4StatMFMacroChemicalPotential.hh"
35
36// operators definitions
37G4StatMFMacroChemicalPotential & 
38G4StatMFMacroChemicalPotential::operator=(const G4StatMFMacroChemicalPotential & ) 
39{
40    throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator= meant to not be accessable");
41    return *this;
42}
43
44G4bool G4StatMFMacroChemicalPotential::operator==(const G4StatMFMacroChemicalPotential & ) const 
45{
46    throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::operator== meant to not be accessable");
47    return false;
48}
49
50
51G4bool 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
60G4double 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      G4cerr <<"G4StatMFMacroChemicalPotential:"<<" ChemPa="<<ChemPa<<" ChemPb="<<ChemPb<< G4endl;
98      G4cerr <<"G4StatMFMacroChemicalPotential:"<<" fChemPa="<<fChemPa<<" fChemPb="<<fChemPb<< G4endl;
99      throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroChemicalPotential::CalcChemicalPotentialNu: I couldn't find the root.");
100    }
101    _ChemPotentialNu = theSolver->GetRoot();
102    delete theSolver;
103    return _ChemPotentialNu;
104}
105
106
107
108G4double G4StatMFMacroChemicalPotential::CalcMeanZ(const G4double nu)
109{
110  std::vector<G4VStatMFMacroCluster*>::iterator i;
111  for (i= _theClusters->begin()+1; i != _theClusters->end(); ++i) 
112    { 
113      (*i)->CalcZARatio(nu);
114    }
115  CalcChemicalPotentialMu(nu);
116  // This is important, the Z over A ratio for proton and neutron depends on the
117  // chemical potential Mu, while for the first guess for Chemical potential mu
118  // some values of Z over A ratio. This is the reason for that.
119  (*_theClusters->begin())->CalcZARatio(nu);
120 
121  G4double MeanZ = 0.0;
122  G4int n = 1;
123  for (i = _theClusters->begin(); i != _theClusters->end(); ++i)
124    {
125      MeanZ += static_cast<G4double>(n++) *
126        (*i)->GetZARatio() *
127        (*i)->GetMeanMultiplicity(); 
128    }
129  return MeanZ;
130}
131
132
133void G4StatMFMacroChemicalPotential::CalcChemicalPotentialMu(const G4double nu)
134  //    Calculate Chemical potential \mu
135  // For that is necesary to calculate mean multiplicities
136{
137  G4StatMFMacroMultiplicity * theMultip = new
138    G4StatMFMacroMultiplicity(theA,_Kappa,_MeanTemperature,nu,_theClusters);
139 
140  _ChemPotentialMu = theMultip->CalcChemicalPotentialMu();
141  _MeanMultiplicity = theMultip->GetMeanMultiplicity();
142 
143  delete theMultip;
144 
145  return;
146 
147}
Note: See TracBrowser for help on using the repository browser.