Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNAElectronHoleRecombination.cc
Go to the documentation of this file.
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 * G4DNAElectronHoleRecombination.cc
28 *
29 * Created on: Jun 17, 2015
30 * Author: mkaramit
31 *
32 */
33
35
38#include "G4Electron_aq.hh"
39#include "G4Exp.hh"
40#include "G4H2O.hh"
43#include "G4Molecule.hh"
44#include "G4MoleculeFinder.hh"
46#include "G4SystemOfUnits.hh"
47#include "G4VMoleculeCounter.hh"
48
49#include <memory>
50
51static G4double onsager_constant = e_squared / (4. * pi * epsilon0 * k_Boltzmann);
52
53//------------------------------------------------------------------------------
54
55// Parameterisation of dielectric constant vs temperature and density
56
58{
59 return 1. / (1. + 0.0012 / (density * density));
60}
61
62G4double A(G4double temperature)
63{
64 G4double temp_inverse = 1 / temperature;
65 return 0.7017
66 + 642.0 * temp_inverse
67 - 1.167e5 * temp_inverse * temp_inverse
68 + 9.190e6 * temp_inverse * temp_inverse * temp_inverse;
69}
70
71G4double B(G4double temperature)
72{
73 G4double temp_inverse = 1 / temperature;
74 return -2.71
75 + 275.4 * temp_inverse
76 + 0.3245e5 * temp_inverse * temp_inverse;
77}
78
80{
81 G4double temp_inverse = 1 / temp;
82
83 return 1.667
84 - 11.41 * temp_inverse
85 - 35260.0 * temp_inverse * temp_inverse;
86}
87
89{
90 return A(temp) - B(temp) - 3;
91}
92
94{
95 return B(temp) + 3;
96}
97
98G4double epsilon(G4double density, G4double temperature)
99{
100 return 1 + G4Exp(std::log(10.) *
101 (Y(density) *
102 (C(temperature) + (S(temperature) - 1) * std::log(density) / std::log(10.))
103 + D(temperature) + std::log(density) / std::log(10.)));
104}
105
106//------------------------------------------------------------------------------
107
114
116
118{
119 pParticleChange = &fParticleChange;
120 enableAtRestDoIt = true;
121 enableAlongStepDoIt = false;
122 enablePostStepDoIt = true;
123
125
127 // ie G4DNAElectronHoleRecombination uses a state class
128 // inheriting from G4ProcessState
129
130 fIsInitialized = false;
131 fProposesTimeStep = true;
132 fpMoleculeDensity = nullptr;
133
134 verboseLevel = 0;
135}
136
137//______________________________________________________________________________
138
141 const G4Step& /*stepData*/)
142{
143 fParticleChange.Initialize(track);
146 MakeReaction(track);
147 return &fParticleChange;
148}
149
150//______________________________________________________________________________
151
153{
155 G4VITProcess::fpState = std::make_shared<State>();
157}
158
159//______________________________________________________________________________
160
161void G4DNAElectronHoleRecombination::MakeReaction(const G4Track& track)
162{
163 fParticleChange.Initialize(track);
164 auto pState = fpState->GetState<State>();
165 G4double random = pState->fSampleProba;
166 std::vector<ReactantInfo>& reactants = pState->fReactants;
167
168 G4Track* pSelectedReactant = nullptr;
169
170 for (const auto& reactantInfo : reactants)
171 {
172 if (reactantInfo.fElectron->GetTrackStatus() != fAlive)
173 {
174 continue;
175 }
176 if (reactantInfo.fProbability > random)
177 {
178 pSelectedReactant = reactantInfo.fElectron;
179 }
180 break;
181 }
182
183 if (pSelectedReactant != nullptr)
184 {
185 if (G4VMoleculeCounter::Instance()->InUse())
186 {
188 RemoveAMoleculeAtTime(GetMolecule(track)->GetMolecularConfiguration(),
189 track.GetGlobalTime(),
190 &(track.GetPosition()));
191 }
192 GetMolecule(track)->ChangeConfigurationToLabel("H2Ovib");
193
194 if (G4VMoleculeCounter::Instance()->InUse())
195 {
197 AddAMoleculeAtTime(GetMolecule(track)->GetMolecularConfiguration(),
198 track.GetGlobalTime(),
199 &(track.GetPosition()));
200 }
201
202 // fParticleChange.ProposeTrackStatus(fStopAndKill);
203 fParticleChange.ProposeTrackStatus(fStopButAlive);
204
205 pSelectedReactant->SetTrackStatus(fStopAndKill);
206 // G4TrackList::Pop(pSelectedReactant);
207 // G4ITTrackHolder::Instance()->PushToKill(pSelectedReactant);
208 }
209 else
210 {
211 fParticleChange.ProposeTrackStatus(fStopButAlive);
212 }
213}
214
215//______________________________________________________________________________
216
217G4bool G4DNAElectronHoleRecombination::FindReactant(const G4Track& track)
218{
219 if (GetMolecule(track)->GetCharge() <= 0)
220 {
221 return false;
222 }
223
224 const auto pDensityTable =
226
227 G4double temperature = track.GetMaterial()->GetTemperature();
228 G4double density = (*pDensityTable)[track.GetMaterial()->GetIndex()] / (g / (1e-2 * m * 1e-2 * m * 1e-2 * m));
229 G4double eps = epsilon(density, temperature);
230
231 G4double onsagerRadius = onsager_constant * 1. / (temperature * eps);
232
234
235 auto pState = fpState->GetState<State>();
236 std::vector<ReactantInfo>& reactants = pState->fReactants;
237 pState->fSampleProba = G4UniformRand();
238
239 //Updated : Hoang Tran: added Octree finder
240 if(G4ChemicalMoleculeFinder::Instance()->IsOctreeUsed())
241 {
242 if(!G4ChemicalMoleculeFinder::Instance()->IsOctreeBuilt())
243 {
245 G4ChemicalMoleculeFinder::Instance()->SetOctreeBuilt(false);//rebuild
246 }
247 std::vector<std::pair<G4TrackList::iterator,G4double>> resultIndices;
248 resultIndices.clear();
249
250 G4ChemicalMoleculeFinder::Instance()->
251 FindNearest(track,
252 e_aq.GetMoleculeID(),
253 10. * onsagerRadius,
254 resultIndices,
255 true);
256
257 if(resultIndices.empty())
258 {
259 return false;
260 }
261 reactants.resize(resultIndices.size());
262 unsigned int i = 0;
263 for(auto& it : resultIndices)
264 {
265 reactants[i].fElectron = *(std::get<0>(it));
266 reactants[i].fDistance = (reactants[i].fElectron->GetPosition() -
267 track.GetPosition()).mag();
268 if (reactants[i].fDistance != 0)
269 {
270 reactants[i].fProbability = 1. - G4Exp(-onsagerRadius /
271 reactants[i].fDistance);
272 }
273 else
274 {
275 reactants[i].fProbability = 1.;
276 }
277 i++;
278 }
279 }
280 else
281 {
284 e_aq.GetMoleculeID(),
285 10. * onsagerRadius);
286
287 if (static_cast<int>(results) == 0 || results->GetSize() == 0)
288 {
289 return false;
290 }
291
292 results->Sort();
293 reactants.resize(results->GetSize());
294
295 for (size_t i = 0; !results->End(); results->Next(), ++i)
296 {
297 reactants[i].fElectron = results->GetItem<G4IT>()->GetTrack();
298 reactants[i].fDistance = std::sqrt(results->GetDistanceSqr());
299
300 if (reactants[i].fDistance != 0)
301 {
302 reactants[i].fProbability = 1. - G4Exp(-onsagerRadius / reactants[i].fDistance);
303 }
304 else
305 {
306 reactants[i].fProbability = 1.;
307 }
308 }
309 }
310 return reactants.empty() ? false : reactants[0].fProbability > pState->fSampleProba;
311}
312
313//______________________________________________________________________________
314
315G4bool
321
322//______________________________________________________________________________
323
325 G4double,
327{
328 if (FindReactant(track))
329 {
330 return 0.;
331 }
332
333 return DBL_MAX;
334}
335
336//______________________________________________________________________________
337
340{
341 if (FindReactant(track))
342 {
343 return 0.;
344 }
345 return DBL_MAX;
346}
347
349 const G4Step& step)
350{
351 return AtRestDoIt(track, step);
352}
#define BuildChemicalMoleculeFinder()
G4double epsilon(G4double density, G4double temperature)
G4double C(G4double temp)
G4double S(G4double temp)
G4double B(G4double temperature)
G4double D(G4double temp)
G4double Y(G4double density)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition G4Exp.hh:180
G4ForceCondition
#define State(X)
G4Molecule * GetMolecule(const G4Track &track)
Definition G4Molecule.cc:74
@ fElectromagnetic
@ fAlive
@ fStopAndKill
@ fStopButAlive
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
const G4double A[17]
#define G4UniformRand()
Definition Randomize.hh:52
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *condition) override
~G4DNAElectronHoleRecombination() override
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
G4bool IsApplicable(const G4ParticleDefinition &) override
G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &) override
G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition) override
static G4DNAMolecularMaterial * Instance()
const std::vector< G4double > * GetDensityTableFor(const G4Material *) const
Retrieve a table of volumetric mass densities (mass per unit volume) in the G4 unit system for chosen...
static G4Electron_aq * Definition()
static G4H2O * DefinitionIfExists()
Definition G4H2O.cc:80
G4KDTreeResultHandle FindNearestInRange(const T *point, G4int key, G4double)
static G4ITFinder * Instance()
Definition G4IT.hh:88
G4double GetTemperature() const
std::size_t GetIndex() const
void ChangeConfigurationToLabel(const G4String &label)
static G4OctreeFinder * Instance()
void Initialize(const G4Track &) override
void SetTrackStatus(const G4TrackStatus aTrackStatus)
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4Material * GetMaterial() const
void SetInstantiateProcessState(G4bool flag)
G4shared_ptr< G4ProcessState > fpState
virtual void ClearInteractionTimeLeft()
void StartTracking(G4Track *) override
virtual void ClearNumberOfInteractionLengthLeft()
G4bool fProposesTimeStep
Identical to G4VRestDiscreteProcess with dependency from G4VITProcess.
static G4VMoleculeCounter * Instance()
void ProposeTrackStatus(G4TrackStatus status)
G4bool enableAtRestDoIt
G4int verboseLevel
G4bool enableAlongStepDoIt
void SetProcessSubType(G4int)
virtual void StartTracking(G4Track *)
Definition G4VProcess.cc:87
G4bool enablePostStepDoIt
G4VParticleChange * pParticleChange
#define DBL_MAX
Definition templates.hh:62