Changeset 962 for trunk/source/processes/hadronic/models/de_excitation/multifragmentation/src/G4StatMFMacroMultiplicity.cc
- Timestamp:
- Apr 6, 2009, 12:30:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/de_excitation/multifragmentation/src/G4StatMFMacroMultiplicity.cc
r819 r962 25 25 // 26 26 // 27 // $Id: G4StatMFMacroMultiplicity.cc,v 1. 5 2006/06/29 20:25:10 gunterExp $28 // GEANT4 tag $Name: $27 // $Id: G4StatMFMacroMultiplicity.cc,v 1.7 2008/11/19 14:33:31 vnivanch Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Hadronic Process: Nuclear De-excitations 31 31 // by V. Lara 32 32 // 33 // Modified: 34 // 25.07.08 I.Pshenichnov (in collaboration with Alexander Botvina and Igor 35 // Mishustin (FIAS, Frankfurt, INR, Moscow and Kurchatov Institute, 36 // Moscow, pshenich@fias.uni-frankfurt.de) additional checks in 37 // solver of equation for the chemical potential 33 38 34 39 #include "G4StatMFMacroMultiplicity.hh" … … 87 92 G4double fChemPb = this->operator()(ChemPb); 88 93 94 95 // Set the precision level for locating the root. 96 // If the root is inside this interval, then it's done! 97 G4double intervalWidth = 1.e-4; 98 89 99 // bracketing the solution 90 100 G4int iterations = 0; 91 while (fChemPa*fChemPb > 0.0 && iterations < 10 )101 while (fChemPa*fChemPb > 0.0 && iterations < 100) 92 102 { 93 103 if (std::abs(fChemPa) <= std::abs(fChemPb)) … … 95 105 ChemPa += 0.6*(ChemPa-ChemPb); 96 106 fChemPa = this->operator()(ChemPa); 107 iterations++; 97 108 } 98 109 else … … 100 111 ChemPb += 0.6*(ChemPb-ChemPa); 101 112 fChemPb = this->operator()(ChemPb); 113 iterations++; 102 114 } 103 115 } 104 if (fChemPa*fChemPb > 0.0) 116 117 if (fChemPa*fChemPb > 0.0) // the bracketing failed, complain 105 118 { 119 G4cerr <<"G4StatMFMacroMultiplicity:"<<" ChemPa="<<ChemPa<<" ChemPb="<<ChemPb<< G4endl; 120 G4cerr <<"G4StatMFMacroMultiplicity:"<<" fChemPa="<<fChemPa<<" fChemPb="<<fChemPb<< G4endl; 106 121 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroMultiplicity::CalcChemicalPotentialMu: I couldn't bracket the root."); 107 122 } 108 109 110 G4Solver<G4StatMFMacroMultiplicity> * theSolver = new G4Solver<G4StatMFMacroMultiplicity>(100, 1.e-4);123 else if (fChemPa*fChemPb < 0.0 && std::abs(ChemPa-ChemPb) > intervalWidth) // the bracketing was OK, try to locate the root 124 { 125 G4Solver<G4StatMFMacroMultiplicity> * theSolver = new G4Solver<G4StatMFMacroMultiplicity>(100,intervalWidth); 111 126 theSolver->SetIntervalLimits(ChemPa,ChemPb); 112 127 // if (!theSolver->Crenshaw(*this)) 113 128 if (!theSolver->Brent(*this)) 114 129 { 130 G4cerr <<"G4StatMFMacroMultiplicity:"<<" ChemPa="<<ChemPa<<" ChemPb="<<ChemPb<< G4endl; 131 G4cerr <<"G4StatMFMacroMultiplicity:"<<" fChemPa="<<fChemPa<<" fChemPb="<<fChemPb<< G4endl; 115 132 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroMultiplicity::CalcChemicalPotentialMu: I couldn't find the root."); 116 133 } 117 134 _ChemPotentialMu = theSolver->GetRoot(); 118 135 delete theSolver; 136 } 137 else // the root is within the interval, which is shorter then the precision level - all done 138 { 139 _ChemPotentialMu = ChemPa; 140 } 141 119 142 return _ChemPotentialMu; 120 143 }
Note: See TracChangeset
for help on using the changeset viewer.