Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
+122 -85
View File
@@ -14,11 +14,48 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------*
12-06-2020, S.Incerti, W.G.Shin, tag emdna-V10-06-08
- Fixed coverity warning
10-06-2020, S.Incerti, W.G.Shin, tag emdna-V10-06-07
- Fixed coverity warnings
- Fix of IRT bug
(protection for the crash induced by empty reaction set)
28-05-2020, B.Morgan, tag emdna-V10-06-06
- Add missing G4analysismng module dependency to G4emdna-utils
20-05-20: W.G.Shin emdna-V10-06-05
- Revised displacement of OH radicals of B1A1 dissociation
based on momentum conservation in G4DNAWaterDissociationDisplacer class
- Added missing History
26-04-20: W.G.Shin emdna-V10-06-04
- Fixed coverity test
15-04-20: G.Cosmo emdna-V10-06-03
- G4MoleculeDefinition: copy constructor and assignment operator
are not allowed (as for G4ParticleDefinition). Now deleted.
19-02-20: W.G.Shin emdna-V10-06-02
- Fixed memory issue on G4DNAMolecularReactionTable
- Revised headeres of IRT classes
12-02-20: W.G.Shin emdna-V10-06-01
- Added protections floating point exception in G4DNAIRT class
10-01-20: W.G.Shin emdna-V10-06-00
- Added classes for IRT
- Added features in management classes for IRT (G4ITReaction,
G4ITModelProcessor ...)
- Added features in G4DNAMolecularReactionTable for GFDE
- Added molecules of Plante et al. (2017) (Oxygen, O2, O3, HO2)
15-11-19: G.Cosmo emdna-V10-05-11
- Fixed cases of implicit type conversions from size_t to G4int.
8-11-19: HT, tag emdna-V10-05-10
- Fixed the exception divide by zero of diffusionCoefficient in
- Fixed the exception divide by zero of diffusionCoefficient in
G4DNABrownianTransportation::AlongStepGetPhysicalInteractionLength
for the case of static molecules (DNA) (diffusionCoefficient = 0)
@@ -27,10 +64,10 @@ for the case of static molecules (DNA) (diffusionCoefficient = 0)
of external physical volume (meant for adapting external navigators)
19-10-19: WGS, SI, tag emdna-V10-05-08
- Added new model G4DNAELSEPAElasticModel
- Added new model G4DNAELSEPAElasticModel
11-10-19: WGS, SI, tag emdna-V10-05-07
- G4DNAOneStepThermalizationModel.* :
- G4DNAOneStepThermalizationModel.* :
added Kreipl and Meesungnoen amorphous ice models
- G4DNAWaterDissociationDisplacer* : updated
@@ -55,8 +92,8 @@ added Kreipl and Meesungnoen amorphous ice models
DEV-300 : G4DNAChemistryManager clarify pointer ownership
05-01-2019, HT, tag emdna-V10-05-00
- moved the checking position of track status
in G4ITStepProcessor::SetInitialStep()
- moved the checking position of track status
in G4ITStepProcessor::SetInitialStep()
01-09-2018, SI, tag emdna-V10-04-10
renamed tag
@@ -138,13 +175,13 @@ https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2084
- added tagging of atom. deexc. products in ionisation models.
11-05-2017, VI tag emdna-V10-03-17
- fix for gcc 7.1 warnings in G4DNACrossSectionDataSet.cc.
- fix for gcc 7.1 warnings in G4DNACrossSectionDataSet.cc.
10-05-2017, NL, MK, SI, tag emdna-V10-03-16
- fix for gcc 7.1 warnings in G4DNACrossSectionDataSet.cc.
- fix for gcc 7.1 warnings in G4DNACrossSectionDataSet.cc.
03-05-2017, SM, tag emdna-V10-03-15
- add the new G4DNADummyModel and allow the combination of G4VEmModel and G4VDNAModel in G4DNAModelInterface.
- add the new G4DNADummyModel and allow the combination of G4VEmModel and G4VDNAModel in G4DNAModelInterface.
27-04-2017, SM, tag emdna-V10-03-14
- correct small typo mistakes.
@@ -159,7 +196,7 @@ https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2084
- G4DNAMolecularMaterial: update doxygen doc
13-02-2017, MK, tag emdna-V10-03-10
- G4DNAMolecularMaterial:
- G4DNAMolecularMaterial:
remove newly introduced methods, add fatal exception if used
add doxygen documentation
@@ -188,10 +225,10 @@ https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2084
14-01-2017, MK, tag emdna-V10-02-37
- Prevent a crash when calling G4ITTrackingManager::EndTracking from
the UserTimeStepAction::PostTimeStepAction
- Add missing: G4ITTrackingManager* G4Scheduler::GetTrackingManager()
- Add missing: G4ITTrackingManager* G4Scheduler::GetTrackingManager()
28-12-2016, SI, tag emdna-V10-03-04
- extended upper energy limit of protons for
- extended upper energy limit of protons for
G4DNARuddIonisationExtendedModel
27-12-2016, SI, tag emdna-V10-03-03
@@ -214,20 +251,20 @@ G4DNARuddIonisationExtendedModel
- G4ManyFastLists.hh: iterator::GetTrackList() correct type returned
16-11-2016, MK, tag emdna-V10-02-34
- G4VMolecularDissociationDisplacer & G4DNAWaterDissociationDisplacer:
- G4VMolecularDissociationDisplacer & G4DNAWaterDissociationDisplacer:
displacement types can be thread shared
- G4TrackState: Move implementation of static function
- G4TrackState: Move implementation of static function
G4VTrackStateID::Create() to cc file - windows crash
15-11-2016, MK, tag emdna-V10-02-33
- G4VMolecularDissociationDisplacer.cc: add missing initializer
14-11-2016, MK, tag emdna-V10-02-32
- Separate def and impl of dissociation flag to prevent issue with
- Separate def and impl of dissociation flag to prevent issue with
windows platforms
14-11-2016, MK, tag emdna-V10-02-31
- G4DNAOneStepThermalizationModel.cc:
- G4DNAOneStepThermalizationModel.cc:
tag init constexpr factor with number rather than expression
14-11-2016, MK, tag emdna-V10-02-30
@@ -244,10 +281,10 @@ G4DNARuddIonisationExtendedModel
- Adds and use G4CTCounter
02-11-2016, MK, tag emdna-V10-02-27
- add G4VMoleculeCounter & enable using custom molecule counter
- add G4VMoleculeCounter & enable using custom molecule counter
- pass location information to molecule counter
- G4ITNavigator2: relocate voxelNavigator before every call to
computeStep & computeSafety
- G4ITNavigator2: relocate voxelNavigator before every call to
computeStep & computeSafety
07-08-2016, SI, tag emdna-V10-02-26
- added stationnary mode to sub-excitation electron processes
@@ -267,7 +304,7 @@ at init time
prevent erasing/rewriting data (use isInit)
- G4DNAChampionElasticModel.hh: rearrange declaration of attributes
- G4DNAChampionElasticModel.cc: move up if (isInitialised) { return; }
- G4DNAUeharaScreenedRutherfordElasticModel.cc: add exception at init time if
- G4DNAUeharaScreenedRutherfordElasticModel.cc: add exception at init time if
model used for another part than e-
1-06-2016, MK, tag emdna-V10-02-23
@@ -289,15 +326,15 @@ one of the previous tags
correct model and process names for solvation
12-05-2016, MK, tag emdna-V10-02-18
- G4DNAChampionElasticModel.hh:
- G4DNAChampionElasticModel.hh:
* GetKillBelowThreshold is deprecated
* Removed attributes: killBelowEnergy, lowEnergyLimit, highEnergyLimit,
* Removed attributes: killBelowEnergy, lowEnergyLimit, highEnergyLimit,
tableFile, tableData
* Method Theta(): remove G4ParticleDefinition * aParticleDefinition
- G4DNAUeharaScreenedRutherfordElasticModel.hh:
* SetKillBelowThreshold, GetKillBelowThreshold are depreceted
(use G4LowECapture or G4DNAElectronSolvatation)
* SelectHighEnergyLimit uses SetHighEnergyLimit instead and a warning is
* SelectHighEnergyLimit uses SetHighEnergyLimit instead and a warning is
emitted when used
* Removed attributes: killBelowEnergy, lowEnergyLimit, highEnergyLimit
- G4DNAChampionElasticModel.cc & G4DNAUeharaScreenedRutherfordElasticModel.cc:
@@ -313,7 +350,7 @@ correct model and process names for solvation
- G4DNATransformElectronModel.cc:
* Check verbose flag if a preprocessor flag is trigerred
* Remove call to G4Electron at initialization time
* Add check if(G4DNAChemistryManager::IsActivated()) then solvated electron
* Add check if(G4DNAChemistryManager::IsActivated()) then solvated electron
created; otherwise, the primary electron is killed
30-04-2016, MK, tag emdna-V10-02-17
@@ -321,7 +358,7 @@ correct model and process names for solvation
30-04-2016, MK, tag emdna-V10-02-16
- G4VUserChemistryList: remove a if statement
- G4MoleculeCounter: at initialization time, prevent creating entries for
- G4MoleculeCounter: at initialization time, prevent creating entries for
unregistered molecule definition
22-04-2016, MK, tag emdna-V10-02-15
@@ -329,7 +366,7 @@ correct model and process names for solvation
- G4DNASancheExcitationModel: remove warning when SANCHE_VERBOSE is OFF
22-04-2016, MK, tag emdna-V10-02-14
- G4DNAMeltonAttachmentModel, G4DNASancheExcitationModel:
- G4DNAMeltonAttachmentModel, G4DNASancheExcitationModel:
remove usage of internal energy boundaries
19-03-2016, SI, tag emdna-V10-02-13
@@ -375,11 +412,11 @@ by S. Okada (KEK, JP)
* G4MoleculeCounter: remove check of c++ version for unique_ptr/auto_ptr selection
16-12-2015, SI, tag emdna-V10-02-01
* Ionisation models : in SampleSecondaries:
* Ionisation models : in SampleSecondaries:
added protection on energy for interpolation method change
16-12-2015, SI, tag emdna-V10-02-00
* G4DNAIonElasticModel::SampleSecondaries: added protection on
* G4DNAIonElasticModel::SampleSecondaries: added protection on
energy
13-11-2015, MK, tag emdna-V10-01-55
@@ -420,14 +457,14 @@ is deleted
* G4FastList.icc: use typedef WatcherSet even when iterators are used
* G4ITModelProcessor: add RegisterModel, GetComputeTimeStep +
fComputeTimeStep & fComputeReaction flags
* G4DNAElectronHoleRecombination: enable using this model even when not
* G4DNAElectronHoleRecombination: enable using this model even when not
all dissociation products have been defined (they will just not be taken
into account)
* G4DNAMolecularReactionTable: delete reaction data when table is deleted
03-11-2015, MK, tag emdna-V10-01-47
* G4Scheduler: Update time before G4ITStepProcessor::DoIt
* G4ITStepProcessor::DoIt : reset leading tracks at the end of
* G4ITStepProcessor::DoIt : reset leading tracks at the end of
the call
03-11-2015, MK, tag emdna-V10-01-46
@@ -435,7 +472,7 @@ the call
* G4DNAOneStepSolvatationModel -> G4DNAOneStepThermalizationModel
Avoid placing products outside volume of the mother track
(causing navigator complains)
03-11-2015, MK, tag emdna-V10-01-45
* G4Serialize: Add definition in header for G4String
@@ -444,28 +481,28 @@ the call
* molecules: fix unit tests
* G4DNAElectronHoleRecombination: add missing check on G4MoleculeCounter::InUse
* G4MoleculeCounter: add a flag to check or not against scheduler time
* G4MoleculeTable: do not store G4MolecularConf anymore
* G4MoleculeTable: do not store G4MolecularConf anymore
-> G4MolecularConfMan is taking care of this
30-10-2015, MK, tag emdna-V10-01-43
* Bug solved in G4MoleculeCounter
* Bug solved in G4MoleculeCounter
and made compatible wih G4DNAElectronHoleRecombination (temporary)
* Unit tests corrected
* G4VITDiscreteProcess added
* G4ReactionTableMessenger added
* Intermediate update for 10.2 release
27-10-2015, MK, tag emdna-V10-01-42
* G4ITStepProcessor: clean dynamic_cast to G4VITProcess
26-10-2015, MK, tag emdna-V10-01-41
* Sanche model: try to solve std::vector out of bounds
23-10-2015, MK, tag emdna-V10-01-40
* remove all CLHEP::shared_ptr usage
23-10-2015, CV, SM, tag emdna-V10-01-39
* Addded base class G4VDNAPTBModel
* Addded base class G4VDNAPTBModel
28-09-2015, SI, tag emdna-V10-01-38
* updated ion selection in G4DNARuddIonisationExtendedModel.cc for Z>2
@@ -514,7 +551,7 @@ the call
* Molecule gun : place randomly in a box
15-07-2015, MK
- G4DNAAttachment, G4DNAChargeDecrease, G4DNADissociation,
- G4DNAAttachment, G4DNAChargeDecrease, G4DNADissociation,
G4DNAExcitation, G4DNAIonisation
* processes & models initialisation again
@@ -536,8 +573,8 @@ G4DNAExcitation, G4DNAIonisation
- G4ITLeadingTracks added
- G4ITSteppingVerbose added
- G4IosFlagsSaver added
- G4VITSteppingVerbose & G4ITSteppingVerbose added
* new UI command /chem/tracking/verbose 1,2,3 ...
- G4VITSteppingVerbose & G4ITSteppingVerbose added
* new UI command /chem/tracking/verbose 1,2,3 ...
- G4MoleculeDefinition:
::SetFormatedName added
::NewConfiguration methods added
@@ -545,12 +582,12 @@ G4DNAExcitation, G4DNAIonisation
::AddDecayChannel per G4MolecularConfiguration or conf label added
And replace ::AddDecayChannel for a molecule model
::Finalize added
- G4MolecularConfiguration:
- G4MolecularConfiguration:
* new configuration can be defined by labels
* Add Finalize method and add exception if attempt to modified
the G4MolecularConfiguration is done after finalization
- G4MolecularDissociationChannel & G4DNAMolecularReactionTable &
G4DNAMolecularEncounterStepper use G4MolecularConfiguration rather
- G4MolecularDissociationChannel & G4DNAMolecularReactionTable &
G4DNAMolecularEncounterStepper use G4MolecularConfiguration rather
than molecule models
- G4Molecule add constructor where only G4MolecularConfiguration is specified
- G4Scheduler : remove entirely track specification from this class
@@ -559,11 +596,11 @@ than molecule models
- G4DNAElectronHoleRecombination added
06-07-2015, Shogo Okada, SI, tag emdna-V10-01-22
- G4DNAEmfietzoglouIonisationModel: removed condition for
- G4DNAEmfietzoglouIonisationModel: removed condition for
fasterCode usage on shell selection.
26-06-2015, MK
- G4DNAIonElasticModel: modify "validated" to "activated" in
- G4DNAIonElasticModel: modify "validated" to "activated" in
warning message description
16-06-205, MK
@@ -593,7 +630,7 @@ fasterCode usage on shell selection.
17-05-2015, MK, tag emdna-V10-01-17
- G4DNABornIonisationModel1/2 & G4DNABornExcitationModel2: remove unused variables
- Correct sources.cmake
- Born headears: includes both model versions when proxy header is included
- Born headears: includes both model versions when proxy header is included
16-05-2015, MK, tag emdna-V10-01-16
- Add G4DNAEmfietzoglouExcitationModel
@@ -628,12 +665,12 @@ fasterCode usage on shell selection.
02-05-2015, MK
- Update G4TrackState & related classes
- G4DNABrownianTransportation:
+Add constructor & destructor to G4BrownianAction
- G4DNABrownianTransportation:
+Add constructor & destructor to G4BrownianAction
+comment useless method
- G4Scheduler:
+Add fStopTime+Watched times+PrintWhyDoYouStop method (code was existing before)
+remove fTmpEndTime
- G4Scheduler:
+Add fStopTime+Watched times+PrintWhyDoYouStop method (code was existing before)
+remove fTmpEndTime
+Add CanICarryOn
- add G4DNASmoluchowskiDiffusion *PRELIMINARY*
@@ -647,7 +684,7 @@ instead of a reference
12-02-2015, MK, tag emdna-V10-01-06
- G4ITReaction: Remove "gAll" introduced for testing
- G4ITModelProcessor: Remove "assert" introduced for testing
- G4ITTransportation: Remove extra parenthesis in the undef of PrepareState
- G4ITTransportation: Remove extra parenthesis in the undef of PrepareState
11-02-2015, MK, tag emdna-V10-01-05
- Fix reproductibility of the chemistry module
@@ -659,7 +696,7 @@ instead of a reference
14-12-2014, MK, tag emdna-V10-01-03
- BornIonisation: correct array cleaning
- ScreenRutherfordElastic: correct retrieval of water density
- ScreenRutherfordElastic: correct retrieval of water density
13-12-2014, SI, tag emdna-V10-01-02
- Added elastic model by H. Tran.
@@ -717,15 +754,15 @@ It slows the computation by forcing the Brownian particles to stop at the volume
21-11-2014, MK, tag emdna-V10-00-54
- Put back G4DNABrownianTransportation::fUseMaximumTimeBeforeReachingBoundary
to true as long as the small distances to boundaries sent back by the navigator
to true as long as the small distances to boundaries sent back by the navigator
are not understood
- Update G4ITNavigator2 to the G4Navigator of John
21-11-2014, MK, tag emdna-V10-00-53
- Attempt to solve the 'No track found' bug by using G4FastList and
- Attempt to solve the 'No track found' bug by using G4FastList and
G4ManyFastLists - A 'list watcher' is added
- G4DNABrownianTransportation::fUseMaximumTimeBeforeReachingBoundary
is false by default --> uses the random time computation for crossing
is false by default --> uses the random time computation for crossing
boundaries
20-11-2014, SI, tag emdna-V10-00-52
@@ -817,7 +854,7 @@ when the asked item is not found
05-06-2014 SI, tag emdna-V10-00-29
- added include of <deque> in G4DNAMillerGreenExcitationModel.hh
- updated G4DNAIonisation and G4DNARuddIonisationExtendModel for
- updated G4DNAIonisation and G4DNARuddIonisationExtendModel for
G4GenericIon usage
- requires G4EMLOW6.39
@@ -851,13 +888,13 @@ when the asked item is not found
Try to remove warnings
09.05.2014 S. Incerti, tag emdna-V10-00-20
Added Si to G4DNARuddIonisationExtendedModel
Added Si to G4DNARuddIonisationExtendedModel
on behalf of Z. Francis
G4EMLOW6.38 needed
07-04-2014 SI tag emdna-V10-00-19
Changed faster method interpolation in
G4DNABornIonisationModel
G4DNABornIonisationModel
04-04-2014 G.Cosmo tag emdna-V10-00-18
Removed problematic #define in G4TrackState.hh causing errors on
@@ -892,7 +929,7 @@ when the asked item is not found
(problem coming from having as a friend class a template argument)
02-04-2014 MK tag emdna-V10-00-09
- try to fix build error on windows platform
- try to fix build error on windows platform
01-04-2014 MK tag emdna-V10-00-08
- G4DNAChemistryManager.cc: remove a G4cout in destructor causing a crash in test60
@@ -916,7 +953,7 @@ when the asked item is not found
- Added several clear() to vectors for MT
17-03-2014 SI tag emdna-V10-00-02
- Modified G4DNAChampionElasticModel.cc to read
- Modified G4DNAChampionElasticModel.cc to read
high precision diff. cumulated cross section
to be used with G4EMLOW6.36
@@ -924,7 +961,7 @@ when the asked item is not found
- G4DNAMolecularMaterial: Remove unused variable
12-12-2013 M.K tag emdna-V10-00-00
- G4DNAMolecularMaterial is modified to prevent segmentation fault in case
- G4DNAMolecularMaterial is modified to prevent segmentation fault in case
a model is not created at initialisation time
21-11-2013 V.I. tag emdna-V09-06-22
@@ -950,7 +987,7 @@ when the asked item is not found
03-10-2013 M.K. tag emdna-V09-06-15
- Improve MT compatibility
- Enhance G4DNAChemistryManager to be the main interface used
- Enhance G4DNAChemistryManager to be the main interface used
by the user - stage 1
14-09-2013 M.Asai tag emdna-V09-06-14
@@ -972,7 +1009,7 @@ when the asked item is not found
25-06-2013 M.K. tag emdna-V09-06-09
G4MoleculeID: Rectify initialization
G4MoleculeCounter: Automatic switch between unique_ptr or
G4MoleculeCounter: Automatic switch between unique_ptr or
auto_ptr according to c++ std version
11-06-2013 G.Cosmo tag emdna-V09-06-08
@@ -993,7 +1030,7 @@ when the asked item is not found
*Fix warning compilation in G4KDMap for specific gcc version
24-05-2013 M.K. tag emdna-V09-06-04
* Track state class updated to fix compilation errors on mac
* Track state class updated to fix compilation errors on mac
but still not in usage
23-05-2013 M.K. tag emdna-V09-06-03
@@ -1008,15 +1045,15 @@ when the asked item is not found
* G4KDMap : pop out elements from map
22-05-2013 M.K. tag emdna-V09-06-00
* !!! MT !!!! Promoted to thread-global storage :
--> G4DNAGenericIonManager
* !!! MT !!!! Promoted to thread-global storage :
--> G4DNAGenericIonManager
--> G4DNAMolecularMaterial
--> G4DNAMolecularReactionTable
* G4KDMap added
* G4DNASmoluchowskiReactionModel : exception description enhanced
* G4ITTrackingInteractivity : "Initialize()" method added for simplify
* G4ITTrackingInteractivity : "Initialize()" method added for simplify
intialization of daughter classes
* G4DNAChemistryManager : AddEmptyLineInOuputFile method added
* G4DNAChemistryManager : AddEmptyLineInOuputFile method added
12-11-2012 M.K tag emdna-V09-05-35
Remove unnecessary abort() and exit(-1) previously introduced to avoid
@@ -1084,9 +1121,9 @@ when the asked item is not found
25.06.2012 M.K tag emdna-V09-05-21
Fix semantic warning related to forward declaration of G4ITNavigator_Lock
Modify molecule's name
21.06.2012 S.I tag emdna-V09-05-20
Update of electron elastic scattering low limit
Update of electron elastic scattering low limit
09.06.2012 M.K tag emdna-V09-05-19
Fixed shadowing
@@ -1204,7 +1241,7 @@ when the asked item is not found
Correct verbose in new models & process
18.11.2011 M.K tag emdna-V09-04-47
Fix uninitialized boolean variable (fWriteFile)
Fix uninitialized boolean variable (fWriteFile)
in G4DNAChemistryManager
18.11.2011 M.K tag emdna-V09-04-46
@@ -1258,7 +1295,7 @@ when the asked item is not found
03.11.2011 M.K. tag emdna-V09-04-37
Add G4ITStepManager fVerbose
Add dna includes in sources.cmake
01.11.2011 M.K. tag emdna-V09-04-36
Remove warnings on G4ITModelProcessor,
G4ITTransportation, G4TrackList on Windows
@@ -1270,7 +1307,7 @@ when the asked item is not found
31.10.2011 M.K tag emdna-V09-04-35
Remove obsolete G4Exception
Remove "friend class G4KDTree" in G4KDNode
Remove G4VITProcessor and all relatives
Remove G4VITProcessor and all relatives
Fix windows compilation errors & warnings
28.10.2011 M.K tag emdna-V09-04-34
@@ -1288,7 +1325,7 @@ when the asked item is not found
coverity errors.
26.10.2011 M.K tag emdna-V09-04-31
change std::shared_ptr to CLHEP::shared_ptr
change std::shared_ptr to CLHEP::shared_ptr
26.10.2011 M.K. tag emdna-V09-04-30
Memory leak fixes
@@ -1300,31 +1337,31 @@ when the asked item is not found
Add chemical processes
21.10.2011 M.K. tag emdna-V09-04-28
Same as emdna-V09-04-27 including models/ & processes/ from
Same as emdna-V09-04-27 including models/ & processes/ from
emdna-V09-04-24
21.10.2011 M.K. tag emdna-V09-04-27
CMake fixes from emdna-V09-04-24
21.10.2011 M.K. tag emdna-V09-04-26
Bug fixes and new dev from the previous tag
Bug fixes and new dev from the previous tag
21.10.2011 S. Incerti tag emdna-V09-04-25
Extension of ionisation by HZE proposed by Z. Francis
20.10.2011 M.K. tag emdna-V09-04-24
Bug fixes and new dev from the previous tag
07.10.2011 M.K. tag emdna-V09-04-23
First tag with "molecules" files
First tag with "molecules" files
07.10.2011 M.K. tag emdna-V09-04-22
Add molecules+management directory
First tag with "management" files
09.09.2011 G.Folger tag emdna-V09-04-21
utils/sources.cmake: remove reference to non-existant
G4DNAMoleculeManager.cc
utils/sources.cmake: remove reference to non-existant
G4DNAMoleculeManager.cc
05.09.2011 A. M. M. K., S. I., tag emdna-V09-04-20
Updated sources.make and CMakeLists.txt
@@ -1364,7 +1401,7 @@ when the asked item is not found
G4DNADingfelderChargeIncreaseModel
G4DNADingflederChargeDecreaseModel
in collaboration with Ziad F.
- This tag includes Alfonso's upgrade
- This tag includes Alfonso's upgrade
of ionisation classes for Auger e-
16.05.2011 A.Mantero, tag emdna-V09-04-09
@@ -104,20 +104,10 @@ public:
bool GetComputeTimeStep() const;
public:
void CalculateTimeStep(const G4Track*, G4double userMinTimeStep);
void DoCalculateStep();
void FindReaction(G4ITReactionSet* pReactionSet,
double currentStepTime,
double previousStepTime,
bool reachedUserStepTimeLimit);
const G4Track* GetTrack() const;
protected:
void SetTrack(const G4Track*);
void ExtractTimeStepperData();
G4double fTSTimeStep;
G4ITReactionSet* fReactionSet;
@@ -283,6 +283,10 @@ public:
return fReactionPerTime;
}
void SortByTime(){
fSortByTime = true;
}
protected:
void AddReaction(G4Track* track, G4ITReactionPtr reaction)
{
@@ -48,10 +48,12 @@
#include "globals.hh"
#include <memory>
#include <vector>
class G4ITReactionTable;
class G4ITReactionChange;
class G4Track;
class G4ITReactionSet;
struct G4ITType;
/**
@@ -79,6 +81,7 @@ public:
double /*currentStepTime*/,
bool /*reachedUserStepTimeLimit*/) = 0;
virtual std::vector<std::unique_ptr<G4ITReactionChange>> FindReaction(G4ITReactionSet*, const double, const double, const bool)=0;
virtual std::unique_ptr<G4ITReactionChange> MakeReaction(const G4Track&, const G4Track&) = 0;
virtual void SetReactionTable(const G4ITReactionTable*);
@@ -88,6 +88,7 @@ public:
inline virtual void Prepare() ;
virtual G4double CalculateStep(const G4Track&, const G4double&) = 0;
virtual G4double CalculateMinTimeStep(G4double, G4double) = 0;
inline G4TrackVectorHandle GetReactants();
inline virtual void ResetReactants()
@@ -100,6 +101,7 @@ public:
inline void SetReactionTable(const G4ITReactionTable*);
inline const G4ITReactionTable* GetReactionTable();
protected :
static G4ThreadLocal G4double fCurrentGlobalTime ;
static G4ThreadLocal G4double fUserMinTimeStep ;
@@ -113,33 +113,21 @@ G4double G4ITModelProcessor::CalculateMinTimeStep(G4double currentGlobalTime,
<< G4endl;
#endif
for (auto pTrack : *fpTrackContainer->GetMainList())
for (auto& pStepModel : fActiveModels)
{
if (pTrack == nullptr)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No track found.";
G4Exception("G4Scheduler::CalculateMinStep", "ITScheduler006",
FatalErrorInArgument, exceptionDescription);
continue;
fTSTimeStep =
pStepModel->GetTimeStepper()->CalculateMinTimeStep(
currentGlobalTime,
definedMinTimeStep);
fpActiveModelWithMinTimeStep = pStepModel;
if(fTSTimeStep == -1){
fpActiveModelWithMinTimeStep->GetReactionProcess()->Initialize();
if(fReactionSet->Empty()) return DBL_MAX;
auto fReactionSetInTime = fReactionSet->GetReactionsPerTime();
fTSTimeStep = fReactionSetInTime.begin()->get()->GetTime() - currentGlobalTime;
}
#ifdef DEBUG
G4cout << "*_* " << GetIT(track)->GetName()
<< " ID: " << track->GetTrackID()
<< " at time : " << track->GetGlobalTime()
<< G4endl;
#endif
G4TrackStatus trackStatus = pTrack->GetTrackStatus();
if (trackStatus == fStopAndKill || trackStatus == fStopButAlive)
{
continue;
}
CalculateTimeStep(pTrack, definedMinTimeStep);
// if MT mode at track level, this command should be displaced
ExtractTimeStepperData();
}
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
@@ -151,60 +139,6 @@ G4double G4ITModelProcessor::CalculateMinTimeStep(G4double currentGlobalTime,
return fTSTimeStep;
}
//_________________________________________________________________________
void G4ITModelProcessor::ExtractTimeStepperData()
{
if (fpTrack == nullptr)
{
CleanProcessor();
return;
}
for (auto pStepModel : fActiveModels)
{
if (pStepModel == nullptr)
{
continue;
}
auto pTimeStepper = pStepModel->GetTimeStepper();
G4double sampledMinTimeStep = pTimeStepper->GetSampledMinTimeStep();
G4TrackVectorHandle reactants = pTimeStepper->GetReactants();
if (sampledMinTimeStep < fTSTimeStep)
{
fpActiveModelWithMinTimeStep = pStepModel;
fTSTimeStep = sampledMinTimeStep;
//fReactingTracks.clear();
fReactionSet->CleanAllReaction();
if (reactants)
{
// fReactingTracks.insert(make_pair(track, reactants));
fReactionSet->AddReactions(fTSTimeStep,
const_cast<G4Track*>(fpTrack),
reactants);
pTimeStepper->ResetReactants();
}
}
else if (fTSTimeStep == sampledMinTimeStep && bool(reactants))
{
// fReactingTracks.insert(make_pair(track, reactants));
fReactionSet->AddReactions(fTSTimeStep,
const_cast<G4Track*>(fpTrack),
reactants);
pTimeStepper->ResetReactants();
}
else if (reactants)
{
pTimeStepper->ResetReactants();
}
}
CleanProcessor();
}
//______________________________________________________________________________
void G4ITModelProcessor::InitializeStepper(G4double currentGlobalTime,
@@ -232,42 +166,12 @@ void G4ITModelProcessor::InitializeStepper(G4double currentGlobalTime,
}
//______________________________________________________________________________
void G4ITModelProcessor::CalculateTimeStep(const G4Track* pTrack,
const G4double userMinTimeStep)
{
CleanProcessor();
if (pTrack == nullptr)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No track was passed to the method.";
G4Exception("G4ITModelProcessor::CalculateStep",
"ITModelProcessor004",
FatalErrorInArgument,
exceptionDescription);
}
SetTrack(pTrack);
fUserMinTimeStep = userMinTimeStep;
DoCalculateStep();
}
//______________________________________________________________________________
void G4ITModelProcessor::DoCalculateStep()
{
for (auto& pStepModel : fActiveModels)
{
pStepModel->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
}
}
//_________________________________________________________________________
void G4ITModelProcessor::ComputeTrackReaction(G4ITStepStatus fITStepStatus,
G4double fGlobalTime,
G4double currentTimeStep,
G4double previousTimeStep,
G4double /*previousTimeStep*/,
G4bool reachedUserTimeLimit,
G4double fTimeTolerance,
G4UserTimeStepAction* fpUserTimeStepAction,
@@ -277,20 +181,19 @@ fVerbose
#endif
)
{
// if (fReactingTracks.empty())
if (fReactionSet->Empty())
{
return;
}
if (fITStepStatus == eCollisionBetweenTracks)
// if(fInteractionStep == false)
{
// TODO
FindReaction(fReactionSet,
currentTimeStep,
previousTimeStep,
reachedUserTimeLimit);
G4VITReactionProcess* pReactionProcess = fpActiveModelWithMinTimeStep->GetReactionProcess();
fReactionInfo = pReactionProcess->FindReaction(fReactionSet,
currentTimeStep,
fGlobalTime,
reachedUserTimeLimit);
// TODO
// A ne faire uniquement si le temps choisis est celui calculé par le time stepper
// Sinon utiliser quelque chose comme : fModelProcessor->FindReaction(&fMainList);
@@ -340,7 +243,7 @@ fVerbose
#endif
G4Track* secondary = (*productsVector)[i]; //changes->GetSecondary(i);
fpTrackContainer->_PushTrack(secondary);
// fpTrackContainer->_PushTrack(secondary);
GetIT(secondary)->SetParentID(pTrackA->GetTrackID(),
pTrackB->GetTrackID());
@@ -443,83 +346,12 @@ fVerbose
fReactionInfo.clear();
}
fReactionSet->CleanAllReaction();
// fReactionSet->CleanAllReaction();
fpTrackContainer->MergeSecondariesWithMainList();
fpTrackContainer->KillTracks();
}
//______________________________________________________________________________
void G4ITModelProcessor::FindReaction(G4ITReactionSet* pReactionSet,
const double currentStepTime,
const double /*previousStepTime*/,
const bool reachedUserStepTimeLimit)
{
if (pReactionSet == nullptr || fActiveModels.empty())
{
return;
}
G4ITReactionPerTrackMap& reactionPerTrackMap = pReactionSet->GetReactionMap();
G4VITReactionProcess* pReactionProcess = fpActiveModelWithMinTimeStep->GetReactionProcess();
for (auto tracks_i = reactionPerTrackMap.begin();
tracks_i != reactionPerTrackMap.end();
tracks_i = reactionPerTrackMap.begin())
{
G4Track* pTrackA = tracks_i->first;
if (pTrackA->GetTrackStatus() == fStopAndKill)
{
continue;
}
G4ITReactionPerTrackPtr reactionPerTrack = tracks_i->second;
G4ITReactionList& reactionList = reactionPerTrack->GetReactionList();
assert(reactionList.begin() != reactionList.end());
for (auto it = reactionList.begin(); it != reactionList.end(); it = reactionList.begin())
{
G4ITReactionPtr reaction(*it);
G4Track* pTrackB = reaction->GetReactant(pTrackA);
if (pTrackB->GetTrackStatus() == fStopAndKill)
{
continue;
}
if (pTrackB == pTrackA)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The IT reaction process sent back a reaction between trackA and trackB. ";
exceptionDescription << "The problem is trackA == trackB";
G4Exception("G4ITModelProcessor::FindReaction",
"ITModelProcessor005",
FatalErrorInArgument,
exceptionDescription);
}
pReactionSet->SelectThisReaction(reaction);
if (pReactionProcess && pReactionProcess->TestReactibility(*pTrackA,
*pTrackB,
currentStepTime,
reachedUserStepTimeLimit))
{
auto pReactionChange = pReactionProcess->MakeReaction(*pTrackA, *pTrackB);
if (pReactionChange)
{
fReactionInfo.push_back(std::move(pReactionChange));
break;
}
}
}
}
//assert(G4ITReaction::gAll->empty() == true);
}
void G4ITModelProcessor::SetTrack(const G4Track* track)
{
fpTrack = track;
@@ -125,12 +125,12 @@ void G4ITStepProcessor::DoIt(double timeStep)
it--;
size_t initialSize = mainList->size();
// G4cout << "initialSize = " << initialSize << G4endl;
// G4cout << "initialSize = " << initialSize << G4endl;
for(size_t i = 0 ; i < initialSize ; ++i)
{
// G4cout << "i = " << i << G4endl;
// G4cout << "i = " << i << G4endl;
G4Track* track = *it;
if (!track)
@@ -326,7 +326,7 @@ void G4ITStepProcessor::DoStepping()
if(fpProcessInfo->MAXofPostStepLoops == 0 &&
fpProcessInfo->MAXofAlongStepLoops == 0
&& fpProcessInfo->MAXofAtRestLoops == 0)
{
{/*
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No process was found for particle :"
<< fpTrack->GetDefinition()->GetParticleName();
@@ -336,7 +336,7 @@ void G4ITStepProcessor::DoStepping()
exceptionDescription);
fpTrack->SetTrackStatus(fStopAndKill);
fpState->fStepStatus = fUndefined;
fpState->fStepStatus = fUndefined;*/
return;
}
@@ -75,12 +75,6 @@ public:
G4double tmin,
G4double maxEnergy);
//---
// kept for backward compatibility
inline void SetKillBelowThreshold (G4double threshold);
G4double GetKillBelowThreshold () { return killBelowEnergy; }
//---
inline void SelectStationary(G4bool input);
protected:
@@ -94,9 +88,6 @@ private:
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
G4double killBelowEnergy;
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
@@ -159,21 +150,5 @@ inline void G4DNACPA100ElasticModel::SelectStationary (G4bool input)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//---
// kept for backward compatibility
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNACPA100ElasticModel::SetKillBelowThreshold (G4double /*threshold*/)
{
G4ExceptionDescription errMsg;
errMsg << "*** WARNING : "
<< "G4DNACPA100ElasticModel::SetKillBelowThreshold"
<< "is deprecated, the kill threshold won't be taken into account";
G4Exception ("*** WARNING : G4DNACPA100ElasticModel::SetKillBelowThreshold DEPRECATED","",JustWarning,"") ;
}
#endif
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4DNAIRT.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#ifndef G4DNAIRT_HH_
#define G4DNAIRT_HH_
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4DNAMolecularReaction.hh"
#include "G4DNAMolecularReactionTable.hh"
#include "G4MoleculeTable.hh"
#include "G4VDNAReactionModel.hh"
#include "G4VITReactionProcess.hh"
#include "G4ITReactionTable.hh"
#include "G4ITTrackHolder.hh"
#include "G4ITReaction.hh"
#include "G4Molecule.hh"
#include "G4VITReactionProcess.hh"
#include "G4ParticleChange.hh"
#include "AddClone_def.hh"
#include <vector>
#include <map>
class G4DNAMolecularReactionTable;
class G4VDNAReactionModel;
class G4ErrorFunction;
class G4DNAIRT : public G4VITReactionProcess
{
public:
G4DNAIRT();
explicit G4DNAIRT(G4VDNAReactionModel*);
~G4DNAIRT() override;
G4DNAIRT(const G4DNAIRT& other) = delete;
G4DNAIRT& operator=(const G4DNAIRT& other) = delete;
G4bool TestReactibility(const G4Track&,
const G4Track&,
double ,
bool ) override;
std::vector<std::unique_ptr<G4ITReactionChange>> FindReaction(G4ITReactionSet*, const double, const double, const bool) override;
std::unique_ptr<G4ITReactionChange> MakeReaction(const G4Track&, const G4Track&) override;
void SetReactionModel(G4VDNAReactionModel*);
void Initialize() override;
void SpaceBinning();
void IRTSampling();
void Sampling(G4Track*);
G4double GetIndependentReactionTime(const G4MolecularConfiguration*, const G4MolecularConfiguration*, G4double);
G4int FindBin(G4int, G4double, G4double, G4double);
G4double SamplePDC(G4double , G4double );
protected:
const G4DNAMolecularReactionTable*& fMolReactionTable;
G4VDNAReactionModel* fpReactionModel;
private:
G4ITTrackHolder* fTrackHolder;
G4ITReactionSet* fReactionSet;
G4ErrorFunction* erfc;
std::map<G4int,std::map<G4int,std::map<G4int,std::vector<G4Track*>>>> spaceBinned;
G4double fRCutOff;
G4double timeMin;
G4double timeMax;
G4double fXMin, fYMin, fZMin;
G4double fXMax, fYMax, fZMax;
G4int fNx, fNy, fNz;
G4int xiniIndex, yiniIndex, ziniIndex;
G4int xendIndex, yendIndex, zendIndex;
};
#endif /* G4DNAIRT_HH_ */
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4DNAIRTMoleculeEncounterStepper.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#pragma once
#include "G4VITTimeStepComputer.hh"
#include "G4KDTreeResult.hh"
#include "G4ITReaction.hh"
#include "G4ITTrackHolder.hh"
class G4VDNAReactionModel;
class G4DNAMolecularReactionTable;
class G4MolecularConfiguration;
class G4Molecule;
/**
* Given a molecule G4DNAIRTMoleculeEncounterStepper will calculate for its possible reactants
* what will be the minimum encounter time and the associated molecules.*
*
* This model includes dynamical time steps as explained in
* "Computer-Aided Stochastic Modeling of the Radiolysis of Liquid Water",
* V. Michalik, M. Begusová, E. A. Bigildeev,
* Radiation Research, Vol. 149, No. 3 (Mar., 1998), pp. 224-236
*
*/
class G4DNAIRTMoleculeEncounterStepper : public G4VITTimeStepComputer
{
public:
G4DNAIRTMoleculeEncounterStepper();
virtual ~G4DNAIRTMoleculeEncounterStepper();
G4DNAIRTMoleculeEncounterStepper(const G4DNAIRTMoleculeEncounterStepper&) = delete;
G4DNAIRTMoleculeEncounterStepper& operator=(const G4DNAIRTMoleculeEncounterStepper&) = delete;
virtual void Prepare();
virtual G4double CalculateStep(const G4Track&, const G4double&);
virtual G4double CalculateMinTimeStep(G4double, G4double);
void SetReactionModel(G4VDNAReactionModel*);
G4VDNAReactionModel* GetReactionModel();
void SetVerbose(int);
// Final time returned when reaction is available in the reaction table = 1
// All details = 2
private:
void InitializeForNewTrack();
class Utils;
void CheckAndRecordResults(const Utils&,
#ifdef G4VERBOSE
const G4double reactionRange,
#endif
G4KDTreeResultHandle&);
G4bool fHasAlreadyReachedNullTime;
const G4DNAMolecularReactionTable*& fMolecularReactionTable;
G4VDNAReactionModel* fReactionModel;
G4ITReactionSet* fReactionSet;
G4ITTrackHolder* fpTrackContainer;
G4int fVerbose;
class Utils
{
public:
Utils(const G4Track& tA, const G4MolecularConfiguration* mB);
~Utils() = default;
G4double GetConstant() const
{
return fConstant;
}
const G4Track& fpTrackA;
const G4MolecularConfiguration* fpMoleculeB;
const G4Molecule* fpMoleculeA;
G4double fDA;
G4double fDB;
G4double fConstant;
};
};
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4DNAMolecularIRTModel.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#pragma once
#include <G4String.hh>
#include <G4VITStepModel.hh>
class G4DNAMolecularReactionTable;
class G4VDNAReactionModel;
class G4DNAMolecularIRTModel : public G4VITStepModel
{
public:
G4DNAMolecularIRTModel(const G4String& name = "DNAMolecularIRTModel");
G4DNAMolecularIRTModel(const G4String& name,
std::unique_ptr<G4VITTimeStepComputer> pTimeStepper,
std::unique_ptr<G4VITReactionProcess> pReactionProcess);
G4DNAMolecularIRTModel& operator=(const G4DNAMolecularIRTModel&) = delete;
G4DNAMolecularIRTModel(const G4DNAMolecularIRTModel&) = delete;
~G4DNAMolecularIRTModel() override;
void PrintInfo() override;
void Initialize() override;
void SetReactionModel(G4VDNAReactionModel*);
G4VDNAReactionModel* GetReactionModel();
protected:
const G4DNAMolecularReactionTable*& fMolecularReactionTable;
std::unique_ptr<G4VDNAReactionModel> fpReactionModel;
};
@@ -47,9 +47,11 @@
#pragma once
#include <G4VITReactionProcess.hh>
#include <vector>
class G4DNAMolecularReactionTable;
class G4VDNAReactionModel;
class G4ITReactionSet;
/**
* G4DNAMolecularReaction is the reaction process
@@ -72,6 +74,8 @@ public:
double currentStepTime,
bool userStepTimeLimit) override;
std::vector<std::unique_ptr<G4ITReactionChange>> FindReaction(G4ITReactionSet*,
const double, const double, const bool) override;
std::unique_ptr<G4ITReactionChange> MakeReaction(const G4Track&, const G4Track&) override;
void SetReactionModel(G4VDNAReactionModel*);
@@ -47,6 +47,8 @@
#include "G4VITTimeStepComputer.hh"
#include "G4KDTreeResult.hh"
#include "G4ITTrackHolder.hh"
#include "G4ITReaction.hh"
class G4VDNAReactionModel;
class G4DNAMolecularReactionTable;
@@ -75,6 +77,7 @@ public:
virtual void Prepare();
virtual G4double CalculateStep(const G4Track&, const G4double&);
virtual G4double CalculateMinTimeStep(G4double, G4double);
void SetReactionModel(G4VDNAReactionModel*);
G4VDNAReactionModel* GetReactionModel();
@@ -94,9 +97,10 @@ private:
G4KDTreeResultHandle&);
G4bool fHasAlreadyReachedNullTime;
const G4DNAMolecularReactionTable*& fMolecularReactionTable;
G4VDNAReactionModel* fReactionModel;
G4ITTrackHolder* fpTrackContainer;
G4ITReactionSet* fReactionSet;
G4int fVerbose;
class Utils
@@ -67,8 +67,11 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4DNAEmfietzoglouIonisationModel.hh
G4DNAELSEPAElasticModel.hh
G4DNAIonElasticModel.hh
G4DNAIRT.hh
G4DNAIRTMoleculeEncounterStepper.hh
G4DNAMeltonAttachmentModel.hh
G4DNAMillerGreenExcitationModel.hh
G4DNAMolecularIRTModel.hh
G4DNAMolecularReaction.hh
G4DNAMolecularStepByStepModel.hh
G4DNAMoleculeEncounterStepper.hh
@@ -119,8 +122,11 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4DNAEmfietzoglouExcitationModel.cc
G4DNAEmfietzoglouIonisationModel.cc
G4DNAIonElasticModel.cc
G4DNAIRT.cc
G4DNAIRTMoleculeEncounterStepper.cc
G4DNAMeltonAttachmentModel.cc
G4DNAMillerGreenExcitationModel.cc
G4DNAMolecularIRTModel.cc
G4DNAMolecularReaction.cc
G4DNAMolecularStepByStepModel.cc
G4DNAMoleculeEncounterStepper.cc
+540
View File
@@ -0,0 +1,540 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4DNAIRT.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4DNAIRT.hh"
#include "G4ErrorFunction.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
#include "G4DNAMolecularReactionTable.hh"
#include "G4MolecularConfiguration.hh"
#include "G4Molecule.hh"
#include "G4ITReactionChange.hh"
#include "G4ITTrackHolder.hh"
#include "G4ITReaction.hh"
#include "G4Scheduler.hh"
using namespace std;
G4DNAIRT::G4DNAIRT() :
G4VITReactionProcess(),
fMolReactionTable(reference_cast<const G4DNAMolecularReactionTable*>(fpReactionTable)),
fpReactionModel(nullptr),
fTrackHolder(G4ITTrackHolder::Instance()),
fReactionSet(0)
{
timeMin = G4Scheduler::Instance()->GetStartTime();
timeMax = G4Scheduler::Instance()->GetEndTime();
fXMin = 1e9*nm;
fYMin = 1e9*nm;
fZMin = 1e9*nm;
fXMax = 0e0*nm;
fYMax = 0e0*nm;
fZMax = 0e0*nm;
fNx = 0;
fNy = 0;
fNz = 0;
xiniIndex = 0, yiniIndex = 0, ziniIndex = 0;
xendIndex = 0, yendIndex = 0, zendIndex = 0;
fRCutOff =
1.45 * nm + 2 * std::sqrt(8*9.46e9*nm*nm/s * timeMax); // 95% confidence level
erfc = new G4ErrorFunction();
}
G4DNAIRT::G4DNAIRT(G4VDNAReactionModel* pReactionModel)
: G4DNAIRT()
{
fpReactionModel = pReactionModel;
}
G4DNAIRT::~G4DNAIRT()
{
delete erfc;
}
void G4DNAIRT::Initialize(){
fTrackHolder = G4ITTrackHolder::Instance();
fReactionSet = G4ITReactionSet::Instance();
fReactionSet->CleanAllReaction();
fReactionSet->SortByTime();
spaceBinned.clear();
timeMin = G4Scheduler::Instance()->GetStartTime();
timeMax = G4Scheduler::Instance()->GetEndTime();
xiniIndex = 0;
yiniIndex = 0;
ziniIndex = 0;
xendIndex = 0;
yendIndex = 0;
zendIndex = 0;
fXMin = 1e9*nm;
fYMin = 1e9*nm;
fZMin = 1e9*nm;
fXMax = 0e0*nm;
fYMax = 0e0*nm;
fZMax = 0e0*nm;
fNx = 0;
fNy = 0;
fNz = 0;
SpaceBinning(); // 1. binning the space
IRTSampling(); // 2. Sampling of the IRT
}
void G4DNAIRT::SpaceBinning(){
auto it_begin = fTrackHolder->GetMainList()->begin();
while(it_begin != fTrackHolder->GetMainList()->end()){
G4ThreeVector position = it_begin->GetPosition();
if ( fXMin > position.x() ) fXMin = position.x();
if ( fYMin > position.y() ) fYMin = position.y();
if ( fZMin > position.z() ) fZMin = position.z();
if ( fXMax < position.x() ) fXMax = position.x();
if ( fYMax < position.y() ) fYMax = position.y();
if ( fZMax < position.z() ) fZMax = position.z();
++it_begin;
}
fNx = G4int((fXMax-fXMin)/fRCutOff) == 0 ? 1 : G4int((fXMax-fXMin)/fRCutOff);
fNy = G4int((fYMax-fYMin)/fRCutOff) == 0 ? 1 : G4int((fYMax-fYMin)/fRCutOff);
fNz = G4int((fZMax-fZMin)/fRCutOff) == 0 ? 1 : G4int((fZMax-fZMin)/fRCutOff);
}
void G4DNAIRT::IRTSampling(){
auto it_begin = fTrackHolder->GetMainList()->begin();
while(it_begin != fTrackHolder->GetMainList()->end()){
G4int I = FindBin(fNx, fXMin, fXMax, it_begin->GetPosition().x());
G4int J = FindBin(fNy, fYMin, fYMax, it_begin->GetPosition().y());
G4int K = FindBin(fNz, fZMin, fZMax, it_begin->GetPosition().z());
spaceBinned[I][J][K].push_back(*it_begin);
Sampling(*it_begin);
++it_begin;
}
}
void G4DNAIRT::Sampling(G4Track* track){
G4Molecule* molA = G4Molecule::GetMolecule(track);
const G4MolecularConfiguration* molConfA = molA->GetMolecularConfiguration();
if(molConfA->GetDiffusionCoefficient() == 0) return;
const vector<const G4MolecularConfiguration*>* reactivesVector =
fMolReactionTable->CanReactWith(molConfA);
if(reactivesVector == nullptr) return;
G4double globalTime = G4Scheduler::Instance()->GetGlobalTime();
G4double minTime = timeMax;
xiniIndex = FindBin(fNx, fXMin, fXMax, track->GetPosition().x()-fRCutOff);
xendIndex = FindBin(fNx, fXMin, fXMax, track->GetPosition().x()+fRCutOff);
yiniIndex = FindBin(fNy, fYMin, fYMax, track->GetPosition().y()-fRCutOff);
yendIndex = FindBin(fNy, fYMin, fYMax, track->GetPosition().y()+fRCutOff);
ziniIndex = FindBin(fNz, fZMin, fZMax, track->GetPosition().z()-fRCutOff);
zendIndex = FindBin(fNz, fZMin, fZMax, track->GetPosition().z()+fRCutOff);
for ( int ii = xiniIndex; ii <= xendIndex; ii++ ) {
for ( int jj = yiniIndex; jj <= yendIndex; jj++ ) {
for ( int kk = ziniIndex; kk <= zendIndex; kk++ ) {
std::vector<G4Track*> spaceBin = spaceBinned[ii][jj][kk];
for ( int n = 0; n < (int)spaceBinned[ii][jj][kk].size(); n++ ) {
if(!spaceBin[n] || track == spaceBin[n]) continue;
if(spaceBin[n]->GetTrackStatus() == fStopButAlive) continue;
G4Molecule* molB = G4Molecule::GetMolecule(spaceBin[n]);
if(!molB) continue;
const G4MolecularConfiguration* molConfB = molB->GetMolecularConfiguration();
if(molConfB->GetDiffusionCoefficient() == 0) continue;
auto it = std::find(reactivesVector->begin(), reactivesVector->end(), molConfB);
if(it == reactivesVector->end()) continue;
G4ThreeVector orgPosB = spaceBin[n]->GetPosition();
G4double dt = track->GetGlobalTime() - spaceBin[n]->GetGlobalTime();
G4ThreeVector newPosB = orgPosB;
if(dt > 0){
G4double sigma, x, y, z;
G4double diffusionCoefficient = G4Molecule::GetMolecule(spaceBin[n])->GetDiffusionCoefficient();
sigma = std::sqrt(2.0 * diffusionCoefficient * dt);
x = G4RandGauss::shoot(0., 1.0)*sigma;
y = G4RandGauss::shoot(0., 1.0)*sigma;
z = G4RandGauss::shoot(0., 1.0)*sigma;
newPosB = orgPosB + G4ThreeVector(x,y,z);
}else if(dt < 0) continue;
G4double r0 = (newPosB - track->GetPosition()).mag();
G4double irt = GetIndependentReactionTime(molConfA,
molConfB,
r0);
if(irt>=0 && irt<timeMax - globalTime)
{
irt += globalTime;
if(irt < minTime) minTime = irt;
#ifdef DEBUG
G4cout<<irt<<'\t'<<molConfA->GetName()<<" "<<track->GetTrackID()<<'\t'<<molConfB->GetName()<<" "<<spaceBin[n]->GetTrackID()<<'\n';
#endif
fReactionSet->AddReaction(irt,track,spaceBin[n]);
}
}
spaceBin.clear();
}
}
}
// Scavenging & first order reactions
auto fReactionDatas = fMolReactionTable->GetReactionData(molConfA);
G4double index = -1;
for(size_t u=0; u<fReactionDatas->size();u++){
if((*fReactionDatas)[u]->GetReactant2()->GetDiffusionCoefficient() == 0){
G4double kObs = (*fReactionDatas)[u]->GetObservedReactionRateConstant();
G4double time = -(std::log(1.0 - G4UniformRand())/kObs) + globalTime;
if( time < minTime && time >= globalTime && time < timeMax){
minTime = time;
index = (int) u;
}
}
}
if(index != -1){
#ifdef DEBUG
G4cout<<"scavenged: "<<minTime<<'\t'<<molConfA->GetName()<<it_begin->GetTrackID()<<'\n';
#endif
G4Molecule* fakeMol = new G4Molecule((*fReactionDatas)[index]->GetReactant2());
G4Track* fakeTrack = fakeMol->BuildTrack(globalTime,track->GetPosition());
fTrackHolder->Push(fakeTrack);
fReactionSet->AddReaction(minTime, track, fakeTrack);
}
}
G4double G4DNAIRT::GetIndependentReactionTime(const G4MolecularConfiguration* molA, const G4MolecularConfiguration* molB, G4double distance) {
const auto pMoleculeA = molA;
const auto pMoleculeB = molB;
auto fReactionData = fMolReactionTable->GetReactionData(pMoleculeA, pMoleculeB);
G4int reactionType = fReactionData->GetReactionType();
G4double r0 = distance;
if(r0 == 0) r0 += 1e-3*nm;
G4double irt = -1 * ps;
G4double D = molA->GetDiffusionCoefficient() +
molB->GetDiffusionCoefficient();
G4double rc = fReactionData->GetOnsagerRadius();
if ( reactionType == 0){
G4double sigma = fReactionData->GetEffectiveReactionRadius();
if( rc != 0) r0 = -rc / (1-std::exp(rc/r0));
if(sigma > r0) return 0; // contact reaction
G4double Winf = sigma/r0;
G4double W = G4UniformRand();
if ( W < Winf ) irt = (0.25/D) * std::pow( (r0-sigma)/erfc->erfcInv(r0*W/sigma), 2 );
return irt;
}
else if ( reactionType == 1 ){
G4double sigma = fReactionData->GetReactionRadius();
G4double kact = fReactionData->GetActivationRateConstant();
G4double kdif = fReactionData->GetDiffusionRateConstant();
G4double kobs = fReactionData->GetObservedReactionRateConstant();
G4double a, b, Winf;
if ( rc == 0 ) {
a = 1/sigma * kact / kobs;
b = (r0 - sigma) / 2;
} else {
G4double v = kact/Avogadro/(4*CLHEP::pi*pow(sigma,2) * exp(-rc / sigma));
G4double alpha = v+rc*D/(pow(sigma,2)*(1-exp(-rc/sigma)));
a = 4*pow(sigma,2)*alpha/(D*pow(rc,2))*pow(sinh(rc/(2*sigma)),2);
b = rc/4*(cosh(rc/(2*r0))/sinh(rc/(2*r0))-cosh(rc/(2*sigma))/sinh(rc/(2*sigma)));
r0 = -rc/(1-std::exp(rc/r0));
sigma = fReactionData->GetEffectiveReactionRadius();
}
if(sigma > r0){
if(fReactionData->GetProbability() > G4UniformRand()) return 0;
else return irt;
}
Winf = sigma / r0 * kobs / kdif;
if(Winf > G4UniformRand()) irt = SamplePDC(a,b)/D;
return irt;
}
return -1 * ps;
}
G4int G4DNAIRT::FindBin(G4int n, G4double xmin, G4double xmax, G4double value) {
G4int bin = -1;
if ( value <= xmin )
bin = 0; //1;
else if ( value >= xmax) //!(xmax < value) ) //value >= xmax )
bin = n-1; //n;
else
bin = G4int( n * ( value - xmin )/( xmax - xmin ) ); //bin = 1 + G4int( n * ( value - xmin )/( xmax - xmin ) );
if ( bin < 0 ) bin = 0;
if ( bin >= n ) bin = n-1;
return bin;
}
G4double G4DNAIRT::SamplePDC(G4double a, G4double b) {
G4double p = 2.0 * std::sqrt(2.0*b/a);
G4double q = 2.0 / std::sqrt(2.0*b/a);
G4double M = max(1.0/(a*a),3.0*b/a);
G4double X, U, lambdax;
G4int ntrials = 0;
while(1) {
// Generate X
U = G4UniformRand();
if ( U < p/(p + q * M) ) X = pow(U * (p + q * M) / 2, 2);
else X = pow(2/((1-U)*(p+q*M)/M),2);
U = G4UniformRand();
lambdax = std::exp(-b*b/X) * ( 1.0 - a * std::sqrt(CLHEP::pi * X) * erfc->erfcx(b/std::sqrt(X) + a*std::sqrt(X)));
if ((X <= 2.0*b/a && U <= lambdax) ||
(X >= 2.0*b/a && U*M/X <= lambdax)) break;
ntrials++;
if ( ntrials > 10000 ){
G4cout<<"Totally rejected"<<'\n';
return -1.0;
}
}
return X;
}
std::unique_ptr<G4ITReactionChange> G4DNAIRT::MakeReaction(const G4Track& trackA,
const G4Track& trackB)
{
std::unique_ptr<G4ITReactionChange> pChanges(new G4ITReactionChange());
pChanges->Initialize(trackA, trackB);
const auto pMoleculeA = GetMolecule(trackA)->GetMolecularConfiguration();
const auto pMoleculeB = GetMolecule(trackB)->GetMolecularConfiguration();
const auto pReactionData = fMolReactionTable->GetReactionData(pMoleculeA, pMoleculeB);
G4double globalTime = G4Scheduler::Instance()->GetGlobalTime();
G4double effectiveReactionRadius = pReactionData->GetEffectiveReactionRadius();
const G4double D1 = pMoleculeA->GetDiffusionCoefficient();
const G4double D2 = pMoleculeB->GetDiffusionCoefficient();
G4ThreeVector r1 = trackA.GetPosition();
G4ThreeVector r2 = trackB.GetPosition();
if(r1 == r2) r2 += G4ThreeVector(0,0,1e-3*nm);
G4ThreeVector S1 = r1 - r2;
G4double r0 = S1.mag();
S1.setMag(effectiveReactionRadius);
G4double dt = globalTime - trackA.GetGlobalTime();
if(dt != 0){
G4double s12 = 2.0 * D1 * dt;
G4double s22 = 2.0 * D2 * dt;
if(s12 == 0) r2 = r1;
else if(s22 == 0) r1 = r2;
else{
G4double alpha = effectiveReactionRadius * r0 / (2*(D1 + D2)*dt);
G4ThreeVector S2 = (r1 + (s12 / s22)*r2) + G4ThreeVector(G4RandGauss::shoot(0, s12 + s22 * s22 / s12),
G4RandGauss::shoot(0, s12 + s22 * s22 / s12),
G4RandGauss::shoot(0, s12 + s22 * s22 / s12));
S1.setPhi(rad * G4UniformRand() * 2.0 * CLHEP::pi);
S1.setTheta(rad * std::acos(1.0 + 1./alpha * std::log(1.0 - G4UniformRand() * (1 - std::exp(-2.0 * alpha)))));
r1 = (D1 * S1 + D2 * S2) / (D1 + D2);
r2 = D2 * (S2 - S1) / (D1 + D2);
}
}
auto pTrackA = const_cast<G4Track*>(pChanges->GetTrackA());
auto pTrackB = const_cast<G4Track*>(pChanges->GetTrackB());
pTrackA->SetPosition(r1);
pTrackB->SetPosition(r2);
pTrackA->SetGlobalTime(globalTime);
pTrackB->SetGlobalTime(globalTime);
pTrackA->SetTrackStatus(fStopButAlive);
pTrackB->SetTrackStatus(fStopButAlive);
const G4int nbProducts = pReactionData->GetNbProducts();
if(nbProducts){
const G4double sqrD1 = D1 == 0. ? 0. : std::sqrt(D1);
const G4double sqrD2 = D2 == 0. ? 0. : std::sqrt(D2);
const G4double inv_numerator = 1./(sqrD1 + sqrD2);
const G4ThreeVector reactionSite = sqrD2 * inv_numerator * trackA.GetPosition()
+ sqrD1 * inv_numerator * trackB.GetPosition();
std::vector<G4ThreeVector> position;
if(nbProducts == 1){
position.push_back(reactionSite);
}else if(nbProducts == 2){
position.push_back(trackA.GetPosition());
position.push_back(trackB.GetPosition());
}else if (nbProducts == 3){
position.push_back(reactionSite);
position.push_back(trackA.GetPosition());
position.push_back(trackB.GetPosition());
}
for(G4int u = 0; u < nbProducts; u++){
auto product = new G4Molecule(pReactionData->GetProduct(u));
auto productTrack = product->BuildTrack(globalTime,
position[u]);
productTrack->SetTrackStatus(fAlive);
fTrackHolder->Push(productTrack);
pChanges->AddSecondary(productTrack);
G4int I = FindBin(fNx, fXMin, fXMax, position[u].x());
G4int J = FindBin(fNy, fYMin, fYMax, position[u].y());
G4int K = FindBin(fNz, fZMin, fZMax, position[u].z());
spaceBinned[I][J][K].push_back(productTrack);
Sampling(productTrack);
}
}
fTrackHolder->MergeSecondariesWithMainList();
pChanges->KillParents(true);
return pChanges;
}
std::vector<std::unique_ptr<G4ITReactionChange>> G4DNAIRT::FindReaction(
G4ITReactionSet* pReactionSet,
const double /*currentStepTime*/,
const double fGlobalTime,
const bool /*reachedUserStepTimeLimit*/)
{
std::vector<std::unique_ptr<G4ITReactionChange>> fReactionInfo;
fReactionInfo.clear();
if (pReactionSet == nullptr)
{
return fReactionInfo;
}
auto fReactionsetInTime = pReactionSet->GetReactionsPerTime();
assert(fReactionsetInTime.begin() != fReactionsetInTime.end());
auto it_begin = fReactionsetInTime.begin();
while(it_begin != fReactionsetInTime.end())
{
G4double irt = it_begin->get()->GetTime();
if(fGlobalTime < irt) break;
pReactionSet->SelectThisReaction(*it_begin);
G4Track* pTrackA = it_begin->get()->GetReactants().first;
G4Track* pTrackB = it_begin->get()->GetReactants().second;
auto pReactionChange = MakeReaction(*pTrackA, *pTrackB);
if(pReactionChange){
fReactionInfo.push_back(std::move(pReactionChange));
}
fReactionsetInTime = pReactionSet->GetReactionsPerTime();
it_begin = fReactionsetInTime.begin();
}
return fReactionInfo;
}
G4bool G4DNAIRT::TestReactibility(const G4Track& /*trackA*/,
const G4Track& /*trackB*/,
double /*currentStepTime*/,
bool /*userStepTimeLimit*/) /*const*/
{
return true;
}
void G4DNAIRT::SetReactionModel(G4VDNAReactionModel* model)
{
fpReactionModel = model;
}
@@ -0,0 +1,483 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4DNAIRTMoleculeEncounterStepper.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4DNAIRTMoleculeEncounterStepper.hh"
#include "G4VDNAReactionModel.hh"
#include "G4DNAMolecularReactionTable.hh"
#include "G4H2O.hh"
#include "G4memory.hh"
#include "G4UnitsTable.hh"
#include "G4MoleculeFinder.hh"
#include "G4MolecularConfiguration.hh"
#include "G4Scheduler.hh"
#include "G4ITReaction.hh"
using namespace std;
using namespace CLHEP;
//#define DEBUG_MEM
#ifdef DEBUG_MEM
#include "G4MemStat.hh"
using namespace G4MemStat;
#endif
G4DNAIRTMoleculeEncounterStepper::Utils::Utils(const G4Track& tA,
const G4MolecularConfiguration* pMoleculeB)
: fpTrackA(tA)
, fpMoleculeB(pMoleculeB)
{
fpMoleculeA = GetMolecule(tA);
fDA = fpMoleculeA->GetDiffusionCoefficient();
fDB = fpMoleculeB->GetDiffusionCoefficient();
fConstant = 8 * (fDA + fDB + 2 * sqrt(fDA * fDB));
}
G4DNAIRTMoleculeEncounterStepper::G4DNAIRTMoleculeEncounterStepper()
: G4VITTimeStepComputer()
, fHasAlreadyReachedNullTime(false)
, fMolecularReactionTable(reference_cast<const G4DNAMolecularReactionTable*>(fpReactionTable))
, fReactionModel(nullptr)
, fVerbose(0)
{
fpTrackContainer = G4ITTrackHolder::Instance();
fReactionSet = G4ITReactionSet::Instance();
}
G4DNAIRTMoleculeEncounterStepper::~G4DNAIRTMoleculeEncounterStepper() = default;
void G4DNAIRTMoleculeEncounterStepper::Prepare()
{
fSampledMinTimeStep = DBL_MAX;
if(G4Scheduler::Instance()->GetGlobalTime() == G4Scheduler::Instance()->GetStartTime()){
G4VITTimeStepComputer::Prepare();
G4MoleculeFinder::Instance()->UpdatePositionMap();
}
}
void G4DNAIRTMoleculeEncounterStepper::InitializeForNewTrack()
{
if (fReactants)
{
fReactants.reset();
}
fSampledMinTimeStep = DBL_MAX;
fHasAlreadyReachedNullTime = false;
}
template<typename T>
inline bool IsInf(T value)
{
return std::numeric_limits<T>::has_infinity
&& value == std::numeric_limits<T>::infinity();
}
G4double
G4DNAIRTMoleculeEncounterStepper::CalculateStep(const G4Track& trackA,
const G4double& userMinTimeStep)
{
auto pMoleculeA = GetMolecule(trackA);
InitializeForNewTrack();
fUserMinTimeStep = userMinTimeStep;
#ifdef G4VERBOSE
if (fVerbose)
{
G4cout
<< "_______________________________________________________________________"
<< G4endl;
G4cout << "G4DNAMoleculeEncounterStepper::CalculateStep" << G4endl;
G4cout << "Check done for molecule : " << pMoleculeA->GetName()
<< " (" << trackA.GetTrackID() << ") "
<< G4endl;
}
#endif
//__________________________________________________________________
// Retrieve general informations for making reactions
auto pMolConfA = pMoleculeA->GetMolecularConfiguration();
const auto pReactantList = fMolecularReactionTable->CanReactWith(pMolConfA);
if (!pReactantList)
{
#ifdef G4VERBOSE
// DEBUG
if (fVerbose > 1)
{
G4cout << "!!!!!!!!!!!!!!!!!!!!" << G4endl;
G4cout << "!!! WARNING" << G4endl;
G4cout << "G4MoleculeEncounterStepper::CalculateStep will return infinity "
"for the reaction because the molecule "
<< pMoleculeA->GetName()
<< " does not have any reactants given in the reaction table."
<< G4endl;
G4cout << "!!!!!!!!!!!!!!!!!!!!" << G4endl;
}
#endif
return DBL_MAX;
}
G4int nbReactives = pReactantList->size();
if (nbReactives == 0)
{
#ifdef G4VERBOSE
// DEBUG
if (fVerbose)
{
// TODO replace with the warning mode of G4Exception
G4cout << "!!!!!!!!!!!!!!!!!!!!" << G4endl;
G4cout << "!!! WARNING" << G4endl;
G4cout << "G4MoleculeEncounterStepper::CalculateStep will return infinity "
"for the reaction because the molecule "
<< pMoleculeA->GetName()
<< " does not have any reactants given in the reaction table."
<< "This message can also result from a wrong implementation of the reaction table."
<< G4endl;
G4cout << "!!!!!!!!!!!!!!!!!!!!" << G4endl;
}
#endif
return DBL_MAX;
}
fReactants.reset(new vector<G4Track*>());
fReactionModel->Initialise(pMolConfA, trackA);
//__________________________________________________________________
// Start looping on possible reactants
for (G4int i = 0; i < nbReactives; i++)
{
auto pMoleculeB = (*pReactantList)[i];
//______________________________________________________________
// Retrieve reaction range
const G4double R = fReactionModel->GetReactionRadius(i);
//______________________________________________________________
// Use KdTree algorithm to find closest reactants
G4KDTreeResultHandle resultsNearest(
G4MoleculeFinder::Instance()->FindNearest(pMoleculeA,
pMoleculeB->GetMoleculeID()));
if (resultsNearest == 0) continue;
G4double r2 = resultsNearest->GetDistanceSqr();
Utils utils(trackA, pMoleculeB);
if (r2 <= R * R) // ==> Record in range
{
// Entering in this condition may due to the fact that molecules are very close
// to each other
// Therefore, if we only take the nearby reactant into account, it might have already
// reacted. Instead, we will take all possible reactants that satisfy the condition r<R
if (fHasAlreadyReachedNullTime == false)
{
fReactants->clear();
fHasAlreadyReachedNullTime = true;
}
fSampledMinTimeStep = 0.;
G4KDTreeResultHandle resultsInRange(
G4MoleculeFinder::Instance()->FindNearestInRange(pMoleculeA,
pMoleculeB->GetMoleculeID(),
R));
CheckAndRecordResults(utils,
#ifdef G4VERBOSE
R,
#endif
resultsInRange);
}
else
{
G4double r = sqrt(r2);
G4double tempMinET = pow(r - R, 2) / utils.fConstant;
// constant = 16 * (fDA + fDB + 2*sqrt(fDA*fDB))
if (tempMinET <= fSampledMinTimeStep)
{
if (fUserMinTimeStep < DBL_MAX/*IsInf(fUserMinTimeStep) == false*/
&& tempMinET <= fUserMinTimeStep) // ==> Record in range
{
if (fSampledMinTimeStep > fUserMinTimeStep)
{
fReactants->clear();
}
fSampledMinTimeStep = fUserMinTimeStep;
G4double range = R + sqrt(fUserMinTimeStep*utils.fConstant);
G4KDTreeResultHandle resultsInRange(
G4MoleculeFinder::Instance()->
FindNearestInRange(pMoleculeA,
pMoleculeB->GetMoleculeID(),
range));
CheckAndRecordResults(utils,
#ifdef G4VERBOSE
range,
#endif
resultsInRange);
}
else // ==> Record nearest
{
if (tempMinET < fSampledMinTimeStep)
// to avoid cases where fSampledMinTimeStep == tempMinET
{
fSampledMinTimeStep = tempMinET;
fReactants->clear();
}
CheckAndRecordResults(utils,
#ifdef G4VERBOSE
R,
#endif
resultsNearest);
}
}
}
}
#ifdef G4VERBOSE
if (fVerbose)
{
G4cout << "G4MoleculeEncounterStepper::CalculateStep will finally return :"
<< G4BestUnit(fSampledMinTimeStep, "Time") << G4endl;
if (fVerbose > 1)
{
G4cout << "Selected reactants for trackA: " << pMoleculeA->GetName()
<< " (" << trackA.GetTrackID() << ") are: ";
vector<G4Track*>::iterator it;
for (it = fReactants->begin(); it != fReactants->end(); it++)
{
G4Track* trackB = *it;
G4cout << GetMolecule(trackB)->GetName() << " ("
<< trackB->GetTrackID() << ") \t ";
}
G4cout << G4endl;
}
}
#endif
return fSampledMinTimeStep;
}
void G4DNAIRTMoleculeEncounterStepper::CheckAndRecordResults(const Utils& utils,
#ifdef G4VERBOSE
const G4double R,
#endif
G4KDTreeResultHandle& results)
{
if (results == 0)
{
#ifdef G4VERBOSE
if (fVerbose > 1)
{
G4cout << "No molecule " << utils.fpMoleculeB->GetName()
<< " found to react with " << utils.fpMoleculeA->GetName()
<< G4endl;
}
#endif
return;
}
for (results->Rewind(); !results->End(); results->Next())
{
G4IT* reactiveB = results->GetItem<G4IT>();
if (reactiveB == 0)
{
continue;
}
G4Track *trackB = reactiveB->GetTrack();
if (trackB == 0)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The reactant B found using the MoleculeFinder does not have a valid "
"track attached to it. If this is done on purpose, please do "
"not record this molecule in the MoleculeFinder."
<< G4endl;
G4Exception("G4DNAMoleculeEncounterStepper::RetrieveResults",
"MoleculeEncounterStepper001", FatalErrorInArgument,
exceptionDescription);
continue;
}
if (trackB->GetTrackStatus() != fAlive)
{
continue;
}
if (trackB == &utils.fpTrackA)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "A track is reacting with itself (which is impossible) ie fpTrackA == trackB"
<< G4endl;
exceptionDescription << "Molecule A (and B) is of type : "
<< utils.fpMoleculeA->GetName() << " with trackID : "
<< utils.fpTrackA.GetTrackID() << G4endl;
G4Exception("G4DNAMoleculeEncounterStepper::RetrieveResults",
"MoleculeEncounterStepper003", FatalErrorInArgument,
exceptionDescription);
}
if (fabs(trackB->GetGlobalTime() - utils.fpTrackA.GetGlobalTime())
> utils.fpTrackA.GetGlobalTime() * (1 - 1 / 100))
{
// DEBUG
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The interacting tracks are not synchronized in time" << G4endl;
exceptionDescription
<< "trackB->GetGlobalTime() != fpTrackA.GetGlobalTime()" << G4endl;
exceptionDescription << "fpTrackA : trackID : " << utils.fpTrackA.GetTrackID()
<< "\t Name :" << utils.fpMoleculeA->GetName()
<< "\t fpTrackA->GetGlobalTime() = "
<< G4BestUnit(utils.fpTrackA.GetGlobalTime(), "Time") << G4endl;
exceptionDescription << "trackB : trackID : " << trackB->GetTrackID()
<< "\t Name :" << utils.fpMoleculeB->GetName()
<< "\t trackB->GetGlobalTime() = "
<< G4BestUnit(trackB->GetGlobalTime(), "Time") << G4endl;
G4Exception("G4DNAMoleculeEncounterStepper::RetrieveResults",
"MoleculeEncounterStepper004", FatalErrorInArgument,
exceptionDescription);
}
#ifdef G4VERBOSE
if (fVerbose > 1)
{
G4double r2 = results->GetDistanceSqr();
G4cout << "\t ************************************************** " << G4endl;
G4cout << "\t Reaction between "
<< utils.fpMoleculeA->GetName() << " (" << utils.fpTrackA.GetTrackID() << ") "
<< " & " << utils.fpMoleculeB->GetName() << " (" << trackB->GetTrackID() << "), "
<< "Interaction Range = "
<< G4BestUnit(R, "Length") << G4endl;
G4cout << "\t Real distance between reactants = "
<< G4BestUnit((utils.fpTrackA.GetPosition() - trackB->GetPosition()).mag(), "Length") << G4endl;
G4cout << "\t Distance between reactants calculated by nearest neighbor algorithm = "
<< G4BestUnit(sqrt(r2), "Length") << G4endl;
}
#endif
fReactants->push_back(trackB);
}
}
void G4DNAIRTMoleculeEncounterStepper::SetReactionModel(G4VDNAReactionModel* pReactionModel)
{
fReactionModel = pReactionModel;
}
G4VDNAReactionModel* G4DNAIRTMoleculeEncounterStepper::GetReactionModel()
{
return fReactionModel;
}
void G4DNAIRTMoleculeEncounterStepper::SetVerbose(int flag)
{
fVerbose = flag;
}
G4double G4DNAIRTMoleculeEncounterStepper::CalculateMinTimeStep(G4double currentGlobalTime, G4double definedMinTimeStep){
G4bool start = true;
G4bool active = false;
fUserMinTimeStep = definedMinTimeStep;
if(fReactionSet->Empty()){
if(currentGlobalTime == G4Scheduler::Instance()->GetStartTime()){
for (auto pTrack : *fpTrackContainer->GetMainList())
{
if (pTrack == nullptr)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No track found.";
G4Exception("G4Scheduler::CalculateMinStep", "ITScheduler006",
FatalErrorInArgument, exceptionDescription);
continue;
}
G4TrackStatus trackStatus = pTrack->GetTrackStatus();
if (trackStatus == fStopAndKill || trackStatus == fStopButAlive)
{
start = false;
continue;
}
active = true;
}
if(start == true){
return -1;
}else if(active == false){
G4Scheduler::Instance()->Stop();
return fSampledMinTimeStep;
}else{
return fSampledMinTimeStep;
}
}else{
for (auto pTrack : *fpTrackContainer->GetMainList())
{
pTrack->SetGlobalTime(G4Scheduler::Instance()->GetEndTime());
}
return fSampledMinTimeStep;
}
}
auto fReactionSetInTime = fReactionSet->GetReactionsPerTime();
fSampledMinTimeStep = fReactionSetInTime.begin()->get()->GetTime() - currentGlobalTime;
return fSampledMinTimeStep;
}
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4DNAMolecularIRTModel.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include <globals.hh>
#include <G4DNAMolecularReactionTable.hh>
#include <G4DNAMolecularIRTModel.hh>
#include <G4DNASmoluchowskiReactionModel.hh>
#include <G4ExceptionSeverity.hh>
#include <G4Molecule.hh>
#include <G4ReferenceCast.hh>
#include "G4DNAIRT.hh"
#include "G4DNAIRTMoleculeEncounterStepper.hh"
G4DNAMolecularIRTModel::G4DNAMolecularIRTModel(const G4String& name)
: G4DNAMolecularIRTModel(name,
std::unique_ptr<G4DNAIRTMoleculeEncounterStepper>(new G4DNAIRTMoleculeEncounterStepper()),
std::unique_ptr<G4DNAIRT>(new G4DNAIRT()))
{
}
G4DNAMolecularIRTModel::G4DNAMolecularIRTModel(const G4String& name,
std::unique_ptr<G4VITTimeStepComputer> pTimeStepper,
std::unique_ptr<G4VITReactionProcess> pReactionProcess)
: G4VITStepModel(std::move(pTimeStepper),
std::move(pReactionProcess),
name)
, fMolecularReactionTable(reference_cast<const G4DNAMolecularReactionTable*>(fpReactionTable))
{
fType1 = G4Molecule::ITType();
fType2 = G4Molecule::ITType();
}
G4DNAMolecularIRTModel::~G4DNAMolecularIRTModel() = default;
void G4DNAMolecularIRTModel::Initialize()
{
if(fpReactionTable == nullptr)
{
SetReactionTable(G4DNAMolecularReactionTable::GetReactionTable());
}
if(!fpReactionModel)
{
fpReactionModel.reset(new G4DNASmoluchowskiReactionModel());
}
fpReactionModel->SetReactionTable((const G4DNAMolecularReactionTable*) fpReactionTable);
((G4DNAIRT*) fpReactionProcess.get())->SetReactionModel(fpReactionModel.get());
((G4DNAIRTMoleculeEncounterStepper*) fpTimeStepper.get())->SetReactionModel(fpReactionModel.get());
G4VITStepModel::Initialize();
}
void G4DNAMolecularIRTModel::PrintInfo()
{
#ifdef G4VERBOSE
G4cout << fName << " will be used" << G4endl;
#endif
}
void G4DNAMolecularIRTModel::SetReactionModel(G4VDNAReactionModel* pReactionModel)
{
fpReactionModel.reset(pReactionModel);
}
G4VDNAReactionModel* G4DNAMolecularIRTModel::GetReactionModel()
{
return fpReactionModel.get();
}
@@ -42,6 +42,9 @@
#include "G4Molecule.hh"
#include "G4MoleculeFinder.hh"
#include "G4ITReactionChange.hh"
#include "G4ITReaction.hh"
#include "G4ITTrackHolder.hh"
G4DNAMolecularReaction::G4DNAMolecularReaction()
: G4VITReactionProcess()
@@ -108,6 +111,8 @@ std::unique_ptr<G4ITReactionChange> G4DNAMolecularReaction::MakeReaction(const G
pProductTrack->SetTrackStatus(fAlive);
G4ITTrackHolder::Instance()->Push(pProductTrack);
pChanges->AddSecondary(pProductTrack);
G4MoleculeFinder::Instance()->Push(pProductTrack);
}
@@ -121,3 +126,73 @@ void G4DNAMolecularReaction::SetReactionModel(G4VDNAReactionModel* pReactionMode
{
fpReactionModel = pReactionModel;
}
std::vector<std::unique_ptr<G4ITReactionChange>> G4DNAMolecularReaction::FindReaction(
G4ITReactionSet* pReactionSet,
const double currentStepTime,
const double /*fGlobalTime*/,
const bool reachedUserStepTimeLimit)
{
std::vector<std::unique_ptr<G4ITReactionChange>> fReactionInfo;
fReactionInfo.clear();
if (pReactionSet == nullptr)
{
return fReactionInfo;
}
G4ITReactionPerTrackMap& reactionPerTrackMap = pReactionSet->GetReactionMap();
for (auto tracks_i = reactionPerTrackMap.begin();
tracks_i != reactionPerTrackMap.end();
tracks_i = reactionPerTrackMap.begin())
{
G4Track* pTrackA = tracks_i->first;
if (pTrackA->GetTrackStatus() == fStopAndKill)
{
continue;
}
G4ITReactionPerTrackPtr reactionPerTrack = tracks_i->second;
G4ITReactionList& reactionList = reactionPerTrack->GetReactionList();
assert(reactionList.begin() != reactionList.end());
for (auto it = reactionList.begin(); it != reactionList.end(); it = reactionList.begin())
{
G4ITReactionPtr reaction(*it);
G4Track* pTrackB = reaction->GetReactant(pTrackA);
if (pTrackB->GetTrackStatus() == fStopAndKill)
{
continue;
}
if (pTrackB == pTrackA)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The IT reaction process sent back a reaction between trackA and trackB. ";
exceptionDescription << "The problem is trackA == trackB";
G4Exception("G4ITModelProcessor::FindReaction",
"ITModelProcessor005",
FatalErrorInArgument,
exceptionDescription);
}
pReactionSet->SelectThisReaction(reaction);
if (TestReactibility(*pTrackA, *pTrackB, currentStepTime, reachedUserStepTimeLimit))
{
auto pReactionChange = MakeReaction(*pTrackA, *pTrackB);
if (pReactionChange)
{
fReactionInfo.push_back(std::move(pReactionChange));
break;
}
}
}
}
pReactionSet->CleanAllReaction();
return fReactionInfo;
}
@@ -72,6 +72,8 @@ G4DNAMoleculeEncounterStepper::G4DNAMoleculeEncounterStepper()
, fReactionModel(nullptr)
, fVerbose(0)
{
fpTrackContainer = G4ITTrackHolder::Instance();
fReactionSet = G4ITReactionSet::Instance();
}
G4DNAMoleculeEncounterStepper::~G4DNAMoleculeEncounterStepper() = default;
@@ -401,6 +403,7 @@ void G4DNAMoleculeEncounterStepper::CheckAndRecordResults(const Utils& utils,
#ifdef G4VERBOSE
if (fVerbose > 1)
{
G4double r2 = results->GetDistanceSqr();
G4cout << "\t ************************************************** " << G4endl;
G4cout << "\t Reaction between "
@@ -412,6 +415,7 @@ void G4DNAMoleculeEncounterStepper::CheckAndRecordResults(const Utils& utils,
<< G4BestUnit((utils.fpTrackA.GetPosition() - trackB->GetPosition()).mag(), "Length") << G4endl;
G4cout << "\t Distance between reactants calculated by nearest neighbor algorithm = "
<< G4BestUnit(sqrt(r2), "Length") << G4endl;
}
#endif
@@ -433,3 +437,55 @@ void G4DNAMoleculeEncounterStepper::SetVerbose(int flag)
{
fVerbose = flag;
}
G4double G4DNAMoleculeEncounterStepper::CalculateMinTimeStep(G4double /*currentGlobalTime*/, G4double definedMinTimeStep){
G4double fTSTimeStep = DBL_MAX;
for (auto pTrack : *fpTrackContainer->GetMainList())
{
if (pTrack == nullptr)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No track found.";
G4Exception("G4Scheduler::CalculateMinStep", "ITScheduler006",
FatalErrorInArgument, exceptionDescription);
continue;
}
G4TrackStatus trackStatus = pTrack->GetTrackStatus();
if (trackStatus == fStopAndKill || trackStatus == fStopButAlive)
{
continue;
}
G4double sampledMinTimeStep = CalculateStep(*pTrack, definedMinTimeStep);
G4TrackVectorHandle reactants = GetReactants();
if (sampledMinTimeStep < fTSTimeStep)
{
fTSTimeStep = sampledMinTimeStep;
fReactionSet->CleanAllReaction();
if (reactants)
{
fReactionSet->AddReactions(fTSTimeStep,
const_cast<G4Track*>(pTrack),
reactants);
ResetReactants();
}
}
else if (fTSTimeStep == sampledMinTimeStep && bool(reactants))
{
fReactionSet->AddReactions(fTSTimeStep,
const_cast<G4Track*>(pTrack),
reactants);
ResetReactants();
}
else if (reactants)
{
ResetReactants();
}
}
return fTSTimeStep;
}
@@ -591,7 +591,7 @@ ScreenedRutherfordRandomizeCosTheta(G4double k,
}
// ***** Alternative method using cumulative probability
if (fasterCode)
else
{
//
@@ -651,7 +651,7 @@ ScreenedRutherfordRandomizeCosTheta(G4double k,
*/
}
return 0.;
//return 0.;
}
@@ -516,7 +516,7 @@ BrennerZaiderRandomizeCosTheta(G4double k)
*/
}
return 0.;
//return 0.;
}
@@ -647,5 +647,5 @@ ScreenedRutherfordRandomizeCosTheta(G4double k,
*/
}
return 0.;
//return 0.;
}
@@ -89,6 +89,9 @@ public:
virtual ~G4MoleculeDefinition();
G4MoleculeDefinition(const G4MoleculeDefinition&) = delete;
G4MoleculeDefinition& operator=(const G4MoleculeDefinition&) = delete;
// Set the electronic configuration at ground level
void SetLevelOccupation(G4int,
G4int eNb = 2);
@@ -174,10 +177,6 @@ public:
protected:
G4MoleculeDefinition();
G4MoleculeDefinition(const G4MoleculeDefinition&);
private:
const G4MoleculeDefinition & operator=(const G4MoleculeDefinition &right);
private:
G4int fCharge;
@@ -279,42 +279,6 @@ G4MoleculeDefinition::GetDecayChannels(const G4MolecularConfiguration* conf)
return 0;
}
//___________________________________________________________________________
// Protected
//___________________________________________________________________________
G4MoleculeDefinition::G4MoleculeDefinition(const G4MoleculeDefinition& right) :
G4ParticleDefinition((const G4ParticleDefinition &) right),
fDiffusionCoefficient(right.fDiffusionCoefficient),
fAtomsNb(right.fAtomsNb),
fVanDerVaalsRadius(right.fVanDerVaalsRadius)
{
if (right.fElectronOccupancy != 0)
{
fElectronOccupancy = new G4ElectronOccupancy(*(right.fElectronOccupancy));
}
else fElectronOccupancy = 0;
if (right.fDecayTable != 0)
{
fDecayTable = new G4MolecularDissociationTable(*(right.fDecayTable));
}
else fDecayTable = 0;
fCharge = right.fCharge;
}
//___________________________________________________________________________
const G4MoleculeDefinition&
G4MoleculeDefinition::operator=(const G4MoleculeDefinition &right)
{
if (this != &right)
{
}
return *this;
}
//___________________________________________________________________________
void G4MoleculeDefinition::Finalize()
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4FakeMolecule.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#ifndef G4FakeMolecule_h
#define G4FakeMolecule_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4MoleculeDefinition.hh"
// ######################################################################
// ### FakeMolecule ###
// ######################################################################
class G4FakeMolecule : public G4MoleculeDefinition
{
private:
static /*G4ThreadLocal*/ G4FakeMolecule* theInstance;
G4FakeMolecule() {}
virtual ~G4FakeMolecule() {}
public:
static G4FakeMolecule* Definition();
};
#endif
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4HO2.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#ifndef G4HO2_h
#define G4HO2_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4MoleculeDefinition.hh"
// ######################################################################
// ### HYDROPEROXIDE ###
// ######################################################################
class G4HO2 : public G4MoleculeDefinition
{
private:
static /*G4ThreadLocal*/ G4HO2* theInstance;
G4HO2() {}
virtual ~G4HO2() {}
public:
static G4HO2* Definition();
};
#endif
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4O2.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#ifndef G4O2_h
#define G4O2_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4MoleculeDefinition.hh"
// ######################################################################
// ### OXYGEN ###
// ######################################################################
class G4O2 : public G4MoleculeDefinition
{
private:
static /*G4ThreadLocal*/ G4O2* theInstance;
G4O2() {}
virtual ~G4O2() {}
public:
static G4O2* Definition();
};
#endif
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4O3.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#ifndef G4O3_h
#define G4O3_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4MoleculeDefinition.hh"
// ######################################################################
// ### OZONE ###
// ######################################################################
class G4O3 : public G4MoleculeDefinition
{
private:
static /*G4ThreadLocal*/ G4O3* theInstance;
G4O3() {}
virtual ~G4O3() {}
public:
static G4O3* Definition();
};
#endif
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4Oxygen.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#ifndef G4Oxygen_h
#define G4Oxygen_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4MoleculeDefinition.hh"
// ######################################################################
// ### Oxygen ###
// ######################################################################
class G4Oxygen : public G4MoleculeDefinition
{
private:
static /*G4ThreadLocal*/ G4Oxygen* theInstance;
G4Oxygen() {}
virtual ~G4Oxygen() {}
public:
static G4Oxygen* Definition();
};
#endif
@@ -34,21 +34,31 @@ include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4emdna-moltypes
HEADERS
G4Electron_aq.hh
G4FakeMolecule.hh
G4H2.hh
G4H2O2.hh
G4H2O.hh
G4H3O.hh
G4HO2.hh
G4Hydrogen.hh
G4O2.hh
G4O3.hh
G4OH.hh
G4Oxygen.hh
G4DNAMolecule.hh
SOURCES
G4Electron_aq.cc
G4FakeMolecule.cc
G4H2.cc
G4H2O2.cc
G4H2O.cc
G4H3O.cc
G4HO2.cc
G4Hydrogen.cc
G4O2.cc
G4O3.cc
G4OH.cc
G4Oxygen.cc
G4DNAMolecule.cc
GRANULAR_DEPENDENCIES
G4geometrymng
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4FakeMolecule.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4FakeMolecule.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### FakeMolecule ###
// ######################################################################
G4FakeMolecule* G4FakeMolecule::theInstance = 0;
G4FakeMolecule* G4FakeMolecule::Definition()
{
if (theInstance != 0) return theInstance;
const G4String name = "None";
// search in particle table]
G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* anInstance = pTable->FindParticle(name);
// G4ParticleDefinition* anInstance = 0;
if (anInstance == 0)
{
const G4String formatedName = "None";
// create molecule
//
// G4MoleculeDefinition(const G4String& name,
// G4double mass,
// G4double diffCoeff,
// G4int charge = 0,
// G4int electronicLevels = 0,
// G4double radius = -1,
// G4int atomsNumber = -1,
// G4double lifetime = -1,
// G4String aType = "",
// G4FakeParticleID ID = G4FakeParticleID::Create()
// );
G4double mass = 0 * g / Avogadro * c_squared;
anInstance = new G4MoleculeDefinition(name, mass, 0 * (m * m / s), 0, 0,
0 * angstrom, 0);
((G4MoleculeDefinition*) anInstance)->SetLevelOccupation(0); // Set 2 electrons on 1 single occupancy
((G4MoleculeDefinition*) anInstance)->SetFormatedName(formatedName);
}
theInstance = reinterpret_cast<G4FakeMolecule*>(anInstance);
return theInstance;
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4HO2.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4HO2.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### HO2 ###
// ######################################################################
G4HO2* G4HO2::theInstance = 0;
G4HO2* G4HO2::Definition()
{
if (theInstance != 0) return theInstance;
const G4String name = "HO_2";
// search in particle table]
G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* anInstance = pTable->FindParticle(name);
if (anInstance == 0)
{
const G4String formatedName = "HO_{2}";
// create molecule
//
// G4MoleculeDefinition(const G4String& name,
// G4double mass,
// G4double diffCoeff,
// G4int charge = 0,
// G4int electronicLevels = 0,
// G4double radius = -1,
// G4int atomsNumber = -1,
// G4double lifetime = -1,
// G4String aType = "",
// G4FakeParticleID ID = G4FakeParticleID::Create()
// );
G4double mass = 33.0034 * g / Avogadro * c_squared;
anInstance = new G4MoleculeDefinition(name, mass, 2.3e-9 * (m * m / s), 0, 0,
2.1 * angstrom, 3);
((G4MoleculeDefinition*) anInstance)->SetLevelOccupation(0); // Set 2 electrons on 1 single occupancy
((G4MoleculeDefinition*) anInstance)->SetFormatedName(formatedName);
}
theInstance = reinterpret_cast<G4HO2*>(anInstance);
return theInstance;
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4O2.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4O2.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### Oxygen molecule ###
// ######################################################################
G4O2* G4O2::theInstance = 0;
G4O2* G4O2::Definition()
{
if (theInstance != 0) return theInstance;
const G4String name = "O_2";
// search in particle table]
G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* anInstance = pTable->FindParticle(name);
if (anInstance == 0)
{
const G4String formatedName = "O_{2}";
// create molecule
//
// G4MoleculeDefinition(const G4String& name,
// G4double mass,
// G4double diffCoeff,
// G4int charge = 0,
// G4int electronicLevels = 0,
// G4double radius = -1,
// G4int atomsNumber = -1,
// G4double lifetime = -1,
// G4String aType = "",
// G4FakeParticleID ID = G4FakeParticleID::Create()
// );
G4double mass = 31.99546 * g / Avogadro * c_squared;
anInstance = new G4MoleculeDefinition(name, mass, 2.4e-9 * (m * m / s), 0, 0,
1.7 * angstrom, 2);
((G4MoleculeDefinition*) anInstance)->SetLevelOccupation(0); // not implemented
((G4MoleculeDefinition*) anInstance)->SetFormatedName(formatedName);
}
theInstance = reinterpret_cast<G4O2*>(anInstance);
return theInstance;
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/*
* G4O3.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4O3.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### Ozone ###
// ######################################################################
G4O3* G4O3::theInstance = 0;
G4O3* G4O3::Definition()
{
if (theInstance != 0) return theInstance;
const G4String name = "O_3";
// search in particle table]
G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* anInstance = pTable->FindParticle(name);
if (anInstance == 0)
{
const G4String formatedName = "O_{3}";
// create molecule
//
// G4MoleculeDefinition(const G4String& name,
// G4double mass,
// G4double diffCoeff,
// G4int charge = 0,
// G4int electronicLevels = 0,
// G4double radius = -1,
// G4int atomsNumber = -1,
// G4double lifetime = -1,
// G4String aType = "",
// G4FakeParticleID ID = G4FakeParticleID::Create()
// );
G4double mass = 47.99319 * g / Avogadro * c_squared;
anInstance = new G4MoleculeDefinition(name, mass, 2.0e-9 * (m * m / s), 0, 0,
2.0 * angstrom, 3);
((G4MoleculeDefinition*) anInstance)->SetLevelOccupation(0); // Set 2 electrons on 1 single occupancy
((G4MoleculeDefinition*) anInstance)->SetFormatedName(formatedName);
}
theInstance = reinterpret_cast<G4O3*>(anInstance);
return theInstance;
}
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4Oxygen.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
#include "G4Oxygen.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### Oxygen ###
// ######################################################################
G4Oxygen* G4Oxygen::theInstance = 0;
G4Oxygen* G4Oxygen::Definition()
{
if (theInstance != 0) return theInstance;
const G4String name = "O";
// search in particle table]
G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* anInstance = pTable->FindParticle(name);
// G4ParticleDefinition* anInstance = 0;
if (anInstance == 0)
{
const G4String formatedName = "O";
// create molecule
//
// G4MoleculeDefinition(const G4String& name,
// G4double mass,
// G4double diffCoeff,
// G4int charge = 0,
// G4int electronicLevels = 0,
// G4double radius = -1,
// G4int atomsNumber = -1,
// G4double lifetime = -1,
// G4String aType = "",
// G4FakeParticleID ID = G4FakeParticleID::Create()
// );
G4double mass = 15.99773 * g / Avogadro * c_squared;
anInstance = new G4MoleculeDefinition(name, mass, 2.0e-9 * (m * m / s), 0, 0,
2.0 * angstrom, 1);
((G4MoleculeDefinition*) anInstance)->SetLevelOccupation(0); // Set 2 electrons on 1 single occupancy
((G4MoleculeDefinition*) anInstance)->SetFormatedName(formatedName);
}
theInstance = reinterpret_cast<G4Oxygen*>(anInstance);
return theInstance;
}
@@ -391,11 +391,19 @@ GetProductsDisplacement(const G4MolecularDissociationChannel* pDecayChannel) con
auto pProduct = pDecayChannel->GetProduct(i);
if (pProduct->GetDefinition() == G4H2::Definition())
{
theProductDisplacementVector[i] = -2. / 18. * RandDirection;
// In the paper of Kreipl (2009)
// theProductDisplacementVector[i] = -2. / 18. * RandDirection;
// Based on momentum conservation
theProductDisplacementVector[i] = -16. / 18. * RandDirection;
}
else if (pProduct->GetDefinition() == G4OH::Definition())
{
G4ThreeVector OxygenDisplacement = +16. / 18. * RandDirection;
// In the paper of Kreipl (2009)
// G4ThreeVector OxygenDisplacement = +16. / 18. * RandDirection;
// Based on momentum conservation
G4ThreeVector OxygenDisplacement = +2. / 18. * RandDirection;
G4double OHRMSDisplacement = 1.1 * nanometer;
auto OHDisplacement =
@@ -89,9 +89,21 @@ public:
void SetObservedReactionRateConstant(G4double rate);
G4double GetObservedReactionRateConstant() const;
G4double GetActivationRateConstant() const;
G4double GetDiffusionRateConstant() const;
void SetReactionRadius(G4double radius);
G4double GetReactionRadius() const;
G4double GetEffectiveReactionRadius() const;
void SetEffectiveReactionRadius(G4double radius);
G4double GetEffectiveReactionRadius() const;
G4double GetOnsagerRadius() const;
void SetProbability(G4double prob);
G4double GetProbability() const;
void SetReactionType(G4int type);
G4int GetReactionType() const;
void SetReactant1(Reactant* reactive);
void SetReactant2(Reactant* reactive);
@@ -137,9 +149,19 @@ protected:
G4DNAMolecularReactionData();
Reactant* fpReactant1;
Reactant* fpReactant2;
G4double fObservedReactionRate;
G4double fActivationRate;
G4double fDiffusionRate;
G4double fOnsagerRadius;
G4double fReactionRadius;
G4double fEffectiveReactionRadius;
G4double fProbability;
G4int fType;
ReactionProducts fProducts;
RateParam fRateParam;
int fReactionID;
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ErrorFunction.hh
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
/*
Extracted from http://ab-initio.mit.edu/Faddeeva
Steven G. Johnson, October 2012.
Copyright © 2012 Massachusetts Institute of Technology
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
*/
#ifndef G4ERRORFUNCTION_HH_
#define G4ERRORFUNCTION_HH_
#include "globals.hh"
#include <vector>
class G4ErrorFunction {
public:
G4ErrorFunction();
virtual ~G4ErrorFunction();
static G4double NormQuantile(G4double x);
static G4double erfcx_y100(G4double x);
static G4double erfcx(G4double x);
static G4double erfc(G4double x);
static G4double erfcInv(G4double x);
static G4double erfcWxy(G4double c, G4double x, G4double y);
static G4double Lambda(G4double x, G4double beta, G4double alpha);
};
#endif /* G4ERRORFUNCTION_HH_ */
@@ -65,6 +65,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-utils
G4DNARevertProbability.hh
G4DNAWaterExcitationStructure.hh
G4DNAWaterIonisationStructure.hh
G4ErrorFunction.hh
G4MoleculeGun.hh
G4MoleculeGunMessenger.hh
G4ReactionTableMessenger.hh
@@ -89,6 +90,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-utils
G4DNAPTBIonisationStructure.cc
G4DNAWaterExcitationStructure.cc
G4DNAWaterIonisationStructure.cc
G4ErrorFunction.cc
G4MoleculeGun.cc
G4MoleculeGunMessenger.cc
G4ReactionTableMessenger.cc
@@ -98,6 +100,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-utils
G4VPhysChemIO.cc
G4PhysChemIO.cc
GRANULAR_DEPENDENCIES
G4analysismng
G4baryons
G4bosons
G4cuts
@@ -57,7 +57,13 @@ G4DNAMolecularReactionData::G4DNAMolecularReactionData()
: fpReactant1(nullptr)
, fpReactant2(nullptr)
, fObservedReactionRate(0.)
, fActivationRate(0.)
, fDiffusionRate(0.)
, fOnsagerRadius(0.)
, fReactionRadius(0.)
, fEffectiveReactionRadius(0.)
, fProbability(0.)
, fType(0)
, fReactionID(0)
{
}
@@ -68,7 +74,13 @@ G4DNAMolecularReactionData::G4DNAMolecularReactionData(G4double reactionRate,
: fpReactant1(pReactant1)
, fpReactant2(pReactant2)
, fObservedReactionRate(reactionRate)
, fActivationRate(0.)
, fDiffusionRate(0.)
, fOnsagerRadius(0.)
, fReactionRadius(0.)
, fEffectiveReactionRadius(0.)
, fProbability(0.)
, fType(0)
, fReactionID(0)
{
ComputeEffectiveRadius();
@@ -80,7 +92,13 @@ G4DNAMolecularReactionData::G4DNAMolecularReactionData(G4double reactionRate,
: fpReactant1(nullptr)
, fpReactant2(nullptr)
, fObservedReactionRate(reactionRate)
, fActivationRate(0.)
, fDiffusionRate(0.)
, fOnsagerRadius(0.)
, fReactionRadius(0.)
, fEffectiveReactionRadius(0.)
, fProbability(0.)
, fType(0)
, fReactionID(0)
{
SetReactant1(reactant1);
@@ -108,6 +126,12 @@ void G4DNAMolecularReactionData::ComputeEffectiveRadius()
+ fpReactant2->GetDiffusionCoefficient();
fEffectiveReactionRadius = fObservedReactionRate / (4. * CLHEP::pi * sumDiffCoeff * CLHEP::Avogadro);
}
fReactionID = 0;
fReactionRadius = fEffectiveReactionRadius;
fOnsagerRadius = (fpReactant1->GetCharge() * fpReactant2->GetCharge())/(4*pi*epsilon0*k_Boltzmann) / (293.15 * 80.1) ;
fProbability = 1;
}
int G4DNAMolecularReactionData::GetReactionID() const
@@ -202,9 +226,25 @@ G4double G4DNAMolecularReactionData::GetObservedReactionRateConstant() const
return fObservedReactionRate;
}
G4double G4DNAMolecularReactionData::GetEffectiveReactionRadius() const
G4double G4DNAMolecularReactionData::GetActivationRateConstant() const
{
return fEffectiveReactionRadius;
return fActivationRate;
}
G4double G4DNAMolecularReactionData::GetDiffusionRateConstant() const
{
return fDiffusionRate;
}
void G4DNAMolecularReactionData::SetReactionRadius(G4double radius)
{
fReactionRadius = radius;
fEffectiveReactionRadius = -fOnsagerRadius / (1-exp(fOnsagerRadius / fReactionRadius));
}
G4double G4DNAMolecularReactionData::GetReactionRadius() const
{
return fReactionRadius;
}
void G4DNAMolecularReactionData::SetEffectiveReactionRadius(G4double radius)
@@ -212,6 +252,66 @@ void G4DNAMolecularReactionData::SetEffectiveReactionRadius(G4double radius)
fEffectiveReactionRadius = radius;
}
G4double G4DNAMolecularReactionData::GetEffectiveReactionRadius() const
{
return fEffectiveReactionRadius;
}
G4double G4DNAMolecularReactionData::GetOnsagerRadius() const
{
return fOnsagerRadius;
}
G4double G4DNAMolecularReactionData::GetProbability() const
{
return fProbability;
}
void G4DNAMolecularReactionData::SetProbability(G4double prob)
{
fProbability = prob;
}
void G4DNAMolecularReactionData::SetReactionType(G4int type)
{
G4double sumDiffCoeff = 0.;
if(type == 1)
{
sumDiffCoeff = fpReactant1->GetDiffusionCoefficient() +
fpReactant2->GetDiffusionCoefficient();
fReactionRadius = fpReactant1->GetVanDerVaalsRadius() +
fpReactant2->GetVanDerVaalsRadius();
G4double Rs = 0.29 * nm;
if(fOnsagerRadius == 0) // Type II
{
fEffectiveReactionRadius = fReactionRadius;
fDiffusionRate = 4 * pi * sumDiffCoeff * fReactionRadius * Avogadro;
if (fpReactant1 == fpReactant2) fDiffusionRate/=2;
fActivationRate = fDiffusionRate * fObservedReactionRate / (fDiffusionRate - fObservedReactionRate);
fProbability = Rs / (Rs + (fDiffusionRate / fActivationRate) * (fReactionRadius + Rs));
}else{ // Type IV
fEffectiveReactionRadius = -fOnsagerRadius/(1-exp(fOnsagerRadius/fReactionRadius));
fDiffusionRate = 4 * pi * sumDiffCoeff * fEffectiveReactionRadius * Avogadro;
if (fpReactant1 == fpReactant2) fDiffusionRate/=2;
fActivationRate = fDiffusionRate * fObservedReactionRate / (fDiffusionRate - fObservedReactionRate);
fProbability = Rs / (Rs + (fDiffusionRate / fActivationRate) * (fEffectiveReactionRadius + Rs));
}
}
fType = type;
}
G4int G4DNAMolecularReactionData::GetReactionType() const
{
return fType;
}
void G4DNAMolecularReactionData::AddProduct(const G4String& molecule)
{
fProducts.push_back(G4MoleculeTable::Instance()->GetConfiguration(molecule));
@@ -0,0 +1,605 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ErrorFunction.cc
*
* Created on: Jul 23, 2019
* Author: W. G. Shin
* J. Ramos-Mendez and B. Faddegon
*/
/*
Extracted from http://ab-initio.mit.edu/Faddeeva
Steven G. Johnson, October 2012.
Copyright © 2012 Massachusetts Institute of Technology
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
*/
#include "G4ErrorFunction.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include <vector>
G4ErrorFunction::G4ErrorFunction() {;}
G4ErrorFunction::~G4ErrorFunction() {;}
G4double G4ErrorFunction::erfcx_y100(G4double y100)
{
switch ((int) y100) {
case 0: {
G4double t = 2*y100 - 1;
return 0.70878032454106438663e-3 + (0.71234091047026302958e-3 + (0.35779077297597742384e-5 + (0.17403143962587937815e-7 + (0.81710660047307788845e-10 + (0.36885022360434957634e-12 + 0.15917038551111111111e-14 * t) * t) * t) * t) * t) * t;
}
case 1: {
G4double t = 2*y100 - 3;
return 0.21479143208285144230e-2 + (0.72686402367379996033e-3 + (0.36843175430938995552e-5 + (0.18071841272149201685e-7 + (0.85496449296040325555e-10 + (0.38852037518534291510e-12 + 0.16868473576888888889e-14 * t) * t) * t) * t) * t) * t;
}
case 2: {
G4double t = 2*y100 - 5;
return 0.36165255935630175090e-2 + (0.74182092323555510862e-3 + (0.37948319957528242260e-5 + (0.18771627021793087350e-7 + (0.89484715122415089123e-10 + (0.40935858517772440862e-12 + 0.17872061464888888889e-14 * t) * t) * t) * t) * t) * t;
}
case 3: {
G4double t = 2*y100 - 7;
return 0.51154983860031979264e-2 + (0.75722840734791660540e-3 + (0.39096425726735703941e-5 + (0.19504168704300468210e-7 + (0.93687503063178993915e-10 + (0.43143925959079664747e-12 + 0.18939926435555555556e-14 * t) * t) * t) * t) * t) * t;
}
case 4: {
G4double t = 2*y100 - 9;
return 0.66457513172673049824e-2 + (0.77310406054447454920e-3 + (0.40289510589399439385e-5 + (0.20271233238288381092e-7 + (0.98117631321709100264e-10 + (0.45484207406017752971e-12 + 0.20076352213333333333e-14 * t) * t) * t) * t) * t) * t;
}
case 5: {
G4double t = 2*y100 - 11;
return 0.82082389970241207883e-2 + (0.78946629611881710721e-3 + (0.41529701552622656574e-5 + (0.21074693344544655714e-7 + (0.10278874108587317989e-9 + (0.47965201390613339638e-12 + 0.21285907413333333333e-14 * t) * t) * t) * t) * t) * t;
}
case 6: {
G4double t = 2*y100 - 13;
return 0.98039537275352193165e-2 + (0.80633440108342840956e-3 + (0.42819241329736982942e-5 + (0.21916534346907168612e-7 + (0.10771535136565470914e-9 + (0.50595972623692822410e-12 + 0.22573462684444444444e-14 * t) * t) * t) * t) * t) * t;
}
case 7: {
G4double t = 2*y100 - 15;
return 0.11433927298290302370e-1 + (0.82372858383196561209e-3 + (0.44160495311765438816e-5 + (0.22798861426211986056e-7 + (0.11291291745879239736e-9 + (0.53386189365816880454e-12 + 0.23944209546666666667e-14 * t) * t) * t) * t) * t) * t;
}
case 8: {
G4double t = 2*y100 - 17;
return 0.13099232878814653979e-1 + (0.84167002467906968214e-3 + (0.45555958988457506002e-5 + (0.23723907357214175198e-7 + (0.11839789326602695603e-9 + (0.56346163067550237877e-12 + 0.25403679644444444444e-14 * t) * t) * t) * t) * t) * t;
}
case 9: {
G4double t = 2*y100 - 19;
return 0.14800987015587535621e-1 + (0.86018092946345943214e-3 + (0.47008265848816866105e-5 + (0.24694040760197315333e-7 + (0.12418779768752299093e-9 + (0.59486890370320261949e-12 + 0.26957764568888888889e-14 * t) * t) * t) * t) * t) * t;
}
case 10: {
G4double t = 2*y100 - 21;
return 0.16540351739394069380e-1 + (0.87928458641241463952e-3 + (0.48520195793001753903e-5 + (0.25711774900881709176e-7 + (0.13030128534230822419e-9 + (0.62820097586874779402e-12 + 0.28612737351111111111e-14 * t) * t) * t) * t) * t) * t;
}
case 11: {
G4double t = 2*y100 - 23;
return 0.18318536789842392647e-1 + (0.89900542647891721692e-3 + (0.50094684089553365810e-5 + (0.26779777074218070482e-7 + (0.13675822186304615566e-9 + (0.66358287745352705725e-12 + 0.30375273884444444444e-14 * t) * t) * t) * t) * t) * t;
}
case 12: {
G4double t = 2*y100 - 25;
return 0.20136801964214276775e-1 + (0.91936908737673676012e-3 + (0.51734830914104276820e-5 + (0.27900878609710432673e-7 + (0.14357976402809042257e-9 + (0.70114790311043728387e-12 + 0.32252476000000000000e-14 * t) * t) * t) * t) * t) * t;
}
case 13: {
G4double t = 2*y100 - 27;
return 0.21996459598282740954e-1 + (0.94040248155366777784e-3 + (0.53443911508041164739e-5 + (0.29078085538049374673e-7 + (0.15078844500329731137e-9 + (0.74103813647499204269e-12 + 0.34251892320000000000e-14 * t) * t) * t) * t) * t) * t;
}
case 14: {
G4double t = 2*y100 - 29;
return 0.23898877187226319502e-1 + (0.96213386835900177540e-3 + (0.55225386998049012752e-5 + (0.30314589961047687059e-7 + (0.15840826497296335264e-9 + (0.78340500472414454395e-12 + 0.36381553564444444445e-14 * t) * t) * t) * t) * t) * t;
}
case 15: {
G4double t = 2*y100 - 31;
return 0.25845480155298518485e-1 + (0.98459293067820123389e-3 + (0.57082915920051843672e-5 + (0.31613782169164830118e-7 + (0.16646478745529630813e-9 + (0.82840985928785407942e-12 + 0.38649975768888888890e-14 * t) * t) * t) * t) * t) * t;
}
case 16: {
G4double t = 2*y100 - 33;
return 0.27837754783474696598e-1 + (0.10078108563256892757e-2 + (0.59020366493792212221e-5 + (0.32979263553246520417e-7 + (0.17498524159268458073e-9 + (0.87622459124842525110e-12 + 0.41066206488888888890e-14 * t) * t) * t) * t) * t) * t;
}
case 17: {
G4double t = 2*y100 - 35;
return 0.29877251304899307550e-1 + (0.10318204245057349310e-2 + (0.61041829697162055093e-5 + (0.34414860359542720579e-7 + (0.18399863072934089607e-9 + (0.92703227366365046533e-12 + 0.43639844053333333334e-14 * t) * t) * t) * t) * t) * t;
}
case 18: {
G4double t = 2*y100 - 37;
return 0.31965587178596443475e-1 + (0.10566560976716574401e-2 + (0.63151633192414586770e-5 + (0.35924638339521924242e-7 + (0.19353584758781174038e-9 + (0.98102783859889264382e-12 + 0.46381060817777777779e-14 * t) * t) * t) * t) * t) * t;
}
case 19: {
G4double t = 2*y100 - 39;
return 0.34104450552588334840e-1 + (0.10823541191350532574e-2 + (0.65354356159553934436e-5 + (0.37512918348533521149e-7 + (0.20362979635817883229e-9 + (0.10384187833037282363e-11 + 0.49300625262222222221e-14 * t) * t) * t) * t) * t) * t;
}
case 20: {
G4double t = 2*y100 - 41;
return 0.36295603928292425716e-1 + (0.11089526167995268200e-2 + (0.67654845095518363577e-5 + (0.39184292949913591646e-7 + (0.21431552202133775150e-9 + (0.10994259106646731797e-11 + 0.52409949102222222221e-14 * t) * t) * t) * t) * t) * t;
}
case 21: {
G4double t = 2*y100 - 43;
return 0.38540888038840509795e-1 + (0.11364917134175420009e-2 + (0.70058230641246312003e-5 + (0.40943644083718586939e-7 + (0.22563034723692881631e-9 + (0.11642841011361992885e-11 + 0.55721092871111111110e-14 * t) * t) * t) * t) * t) * t;
}
case 22: {
G4double t = 2*y100 - 45;
return 0.40842225954785960651e-1 + (0.11650136437945673891e-2 + (0.72569945502343006619e-5 + (0.42796161861855042273e-7 + (0.23761401711005024162e-9 + (0.12332431172381557035e-11 + 0.59246802364444444445e-14 * t) * t) * t) * t) * t) * t;
}
case 23: {
G4double t = 2*y100 - 47;
return 0.43201627431540222422e-1 + (0.11945628793917272199e-2 + (0.75195743532849206263e-5 + (0.44747364553960993492e-7 + (0.25030885216472953674e-9 + (0.13065684400300476484e-11 + 0.63000532853333333334e-14 * t) * t) * t) * t) * t) * t;
}
case 24: {
G4double t = 2*y100 - 49;
return 0.45621193513810471438e-1 + (0.12251862608067529503e-2 + (0.77941720055551920319e-5 + (0.46803119830954460212e-7 + (0.26375990983978426273e-9 + (0.13845421370977119765e-11 + 0.66996477404444444445e-14 * t) * t) * t) * t) * t) * t;
}
case 25: {
G4double t = 2*y100 - 51;
return 0.48103121413299865517e-1 + (0.12569331386432195113e-2 + (0.80814333496367673980e-5 + (0.48969667335682018324e-7 + (0.27801515481905748484e-9 + (0.14674637611609884208e-11 + 0.71249589351111111110e-14 * t) * t) * t) * t) * t) * t;
}
case 26: {
G4double t = 2*y100 - 53;
return 0.50649709676983338501e-1 + (0.12898555233099055810e-2 + (0.83820428414568799654e-5 + (0.51253642652551838659e-7 + (0.29312563849675507232e-9 + (0.15556512782814827846e-11 + 0.75775607822222222221e-14 * t) * t) * t) * t) * t) * t;
}
case 27: {
G4double t = 2*y100 - 55;
return 0.53263363664388864181e-1 + (0.13240082443256975769e-2 + (0.86967260015007658418e-5 + (0.53662102750396795566e-7 + (0.30914568786634796807e-9 + (0.16494420240828493176e-11 + 0.80591079644444444445e-14 * t) * t) * t) * t) * t) * t;
}
case 28: {
G4double t = 2*y100 - 57;
return 0.55946601353500013794e-1 + (0.13594491197408190706e-2 + (0.90262520233016380987e-5 + (0.56202552975056695376e-7 + (0.32613310410503135996e-9 + (0.17491936862246367398e-11 + 0.85713381688888888890e-14 * t) * t) * t) * t) * t) * t;
}
case 29: {
G4double t = 2*y100 - 59;
return 0.58702059496154081813e-1 + (0.13962391363223647892e-2 + (0.93714365487312784270e-5 + (0.58882975670265286526e-7 + (0.34414937110591753387e-9 + (0.18552853109751857859e-11 + 0.91160736711111111110e-14 * t) * t) * t) * t) * t) * t;
}
case 30: {
G4double t = 2*y100 - 61;
return 0.61532500145144778048e-1 + (0.14344426411912015247e-2 + (0.97331446201016809696e-5 + (0.61711860507347175097e-7 + (0.36325987418295300221e-9 + (0.19681183310134518232e-11 + 0.96952238400000000000e-14 * t) * t) * t) * t) * t) * t;
}
case 31: {
G4double t = 2*y100 - 63;
return 0.64440817576653297993e-1 + (0.14741275456383131151e-2 + (0.10112293819576437838e-4 + (0.64698236605933246196e-7 + (0.38353412915303665586e-9 + (0.20881176114385120186e-11 + 0.10310784480000000000e-13 * t) * t) * t) * t) * t) * t;
}
case 32: {
G4double t = 2*y100 - 65;
return 0.67430045633130393282e-1 + (0.15153655418916540370e-2 + (0.10509857606888328667e-4 + (0.67851706529363332855e-7 + (0.40504602194811140006e-9 + (0.22157325110542534469e-11 + 0.10964842115555555556e-13 * t) * t) * t) * t) * t) * t;
}
case 33: {
G4double t = 2*y100 - 67;
return 0.70503365513338850709e-1 + (0.15582323336495709827e-2 + (0.10926868866865231089e-4 + (0.71182482239613507542e-7 + (0.42787405890153386710e-9 + (0.23514379522274416437e-11 + 0.11659571751111111111e-13 * t) * t) * t) * t) * t) * t;
}
case 34: {
G4double t = 2*y100 - 69;
return 0.73664114037944596353e-1 + (0.16028078812438820413e-2 + (0.11364423678778207991e-4 + (0.74701423097423182009e-7 + (0.45210162777476488324e-9 + (0.24957355004088569134e-11 + 0.12397238257777777778e-13 * t) * t) * t) * t) * t) * t;
}
case 35: {
G4double t = 2*y100 - 71;
return 0.76915792420819562379e-1 + (0.16491766623447889354e-2 + (0.11823685320041302169e-4 + (0.78420075993781544386e-7 + (0.47781726956916478925e-9 + (0.26491544403815724749e-11 + 0.13180196462222222222e-13 * t) * t) * t) * t) * t) * t;
}
case 36: {
G4double t = 2*y100 - 73;
return 0.80262075578094612819e-1 + (0.16974279491709504117e-2 + (0.12305888517309891674e-4 + (0.82350717698979042290e-7 + (0.50511496109857113929e-9 + (0.28122528497626897696e-11 + 0.14010889635555555556e-13 * t) * t) * t) * t) * t) * t;
}
case 37: {
G4double t = 2*y100 - 75;
return 0.83706822008980357446e-1 + (0.17476561032212656962e-2 + (0.12812343958540763368e-4 + (0.86506399515036435592e-7 + (0.53409440823869467453e-9 + (0.29856186620887555043e-11 + 0.14891851591111111111e-13 * t) * t) * t) * t) * t) * t;
}
case 38: {
G4double t = 2*y100 - 77;
return 0.87254084284461718231e-1 + (0.17999608886001962327e-2 + (0.13344443080089492218e-4 + (0.90900994316429008631e-7 + (0.56486134972616465316e-9 + (0.31698707080033956934e-11 + 0.15825697795555555556e-13 * t) * t) * t) * t) * t) * t;
}
case 39: {
G4double t = 2*y100 - 79;
return 0.90908120182172748487e-1 + (0.18544478050657699758e-2 + (0.13903663143426120077e-4 + (0.95549246062549906177e-7 + (0.59752787125242054315e-9 + (0.33656597366099099413e-11 + 0.16815130613333333333e-13 * t) * t) * t) * t) * t) * t;
}
case 40: {
G4double t = 2*y100 - 81;
return 0.94673404508075481121e-1 + (0.19112284419887303347e-2 + (0.14491572616545004930e-4 + (0.10046682186333613697e-6 + (0.63221272959791000515e-9 + (0.35736693975589130818e-11 + 0.17862931591111111111e-13 * t) * t) * t) * t) * t) * t;
}
case 41: {
G4double t = 2*y100 - 83;
return 0.98554641648004456555e-1 + (0.19704208544725622126e-2 + (0.15109836875625443935e-4 + (0.10567036667675984067e-6 + (0.66904168640019354565e-9 + (0.37946171850824333014e-11 + 0.18971959040000000000e-13 * t) * t) * t) * t) * t) * t;
}
case 42: {
G4double t = 2*y100 - 85;
return 0.10255677889470089531e0 + (0.20321499629472857418e-2 + (0.15760224242962179564e-4 + (0.11117756071353507391e-6 + (0.70814785110097658502e-9 + (0.40292553276632563925e-11 + 0.20145143075555555556e-13 * t) * t) * t) * t) * t) * t;
}
case 43: {
G4double t = 2*y100 - 87;
return 0.10668502059865093318e0 + (0.20965479776148731610e-2 + (0.16444612377624983565e-4 + (0.11700717962026152749e-6 + (0.74967203250938418991e-9 + (0.42783716186085922176e-11 + 0.21385479360000000000e-13 * t) * t) * t) * t) * t) * t;
}
case 44: {
G4double t = 2*y100 - 89;
return 0.11094484319386444474e0 + (0.21637548491908170841e-2 + (0.17164995035719657111e-4 + (0.12317915750735938089e-6 + (0.79376309831499633734e-9 + (0.45427901763106353914e-11 + 0.22696025653333333333e-13 * t) * t) * t) * t) * t) * t;
}
case 45: {
G4double t = 2*y100 - 91;
return 0.11534201115268804714e0 + (0.22339187474546420375e-2 + (0.17923489217504226813e-4 + (0.12971465288245997681e-6 + (0.84057834180389073587e-9 + (0.48233721206418027227e-11 + 0.24079890062222222222e-13 * t) * t) * t) * t) * t) * t;
}
case 46: {
G4double t = 2*y100 - 93;
return 0.11988259392684094740e0 + (0.23071965691918689601e-2 + (0.18722342718958935446e-4 + (0.13663611754337957520e-6 + (0.89028385488493287005e-9 + (0.51210161569225846701e-11 + 0.25540227111111111111e-13 * t) * t) * t) * t) * t) * t;
}
case 47: {
G4double t = 2*y100 - 95;
return 0.12457298393509812907e0 + (0.23837544771809575380e-2 + (0.19563942105711612475e-4 + (0.14396736847739470782e-6 + (0.94305490646459247016e-9 + (0.54366590583134218096e-11 + 0.27080225920000000000e-13 * t) * t) * t) * t) * t) * t;
}
case 48: {
G4double t = 2*y100 - 97;
return 0.12941991566142438816e0 + (0.24637684719508859484e-2 + (0.20450821127475879816e-4 + (0.15173366280523906622e-6 + (0.99907632506389027739e-9 + (0.57712760311351625221e-11 + 0.28703099555555555556e-13 * t) * t) * t) * t) * t) * t;
}
case 49: {
G4double t = 2*y100 - 99;
return 0.13443048593088696613e0 + (0.25474249981080823877e-2 + (0.21385669591362915223e-4 + (0.15996177579900443030e-6 + (0.10585428844575134013e-8 + (0.61258809536787882989e-11 + 0.30412080142222222222e-13 * t) * t) * t) * t) * t) * t;
}
case 50: {
G4double t = 2*y100 - 101;
return 0.13961217543434561353e0 + (0.26349215871051761416e-2 + (0.22371342712572567744e-4 + (0.16868008199296822247e-6 + (0.11216596910444996246e-8 + (0.65015264753090890662e-11 + 0.32210394506666666666e-13 * t) * t) * t) * t) * t) * t;
}
case 51: {
G4double t = 2*y100 - 103;
return 0.14497287157673800690e0 + (0.27264675383982439814e-2 + (0.23410870961050950197e-4 + (0.17791863939526376477e-6 + (0.11886425714330958106e-8 + (0.68993039665054288034e-11 + 0.34101266222222222221e-13 * t) * t) * t) * t) * t) * t;
}
case 52: {
G4double t = 2*y100 - 105;
return 0.15052089272774618151e0 + (0.28222846410136238008e-2 + (0.24507470422713397006e-4 + (0.18770927679626136909e-6 + (0.12597184587583370712e-8 + (0.73203433049229821618e-11 + 0.36087889048888888890e-13 * t) * t) * t) * t) * t) * t;
}
case 53: {
G4double t = 2*y100 - 107;
return 0.15626501395774612325e0 + (0.29226079376196624949e-2 + (0.25664553693768450545e-4 + (0.19808568415654461964e-6 + (0.13351257759815557897e-8 + (0.77658124891046760667e-11 + 0.38173420035555555555e-13 * t) * t) * t) * t) * t) * t;
}
case 54: {
G4double t = 2*y100 - 109;
return 0.16221449434620737567e0 + (0.30276865332726475672e-2 + (0.26885741326534564336e-4 + (0.20908350604346384143e-6 + (0.14151148144240728728e-8 + (0.82369170665974313027e-11 + 0.40360957457777777779e-13 * t) * t) * t) * t) * t) * t;
}
case 55: {
G4double t = 2*y100 - 111;
return 0.16837910595412130659e0 + (0.31377844510793082301e-2 + (0.28174873844911175026e-4 + (0.22074043807045782387e-6 + (0.14999481055996090039e-8 + (0.87348993661930809254e-11 + 0.42653528977777777779e-13 * t) * t) * t) * t) * t) * t;
}
case 56: {
G4double t = 2*y100 - 113;
return 0.17476916455659369953e0 + (0.32531815370903068316e-2 + (0.29536024347344364074e-4 + (0.23309632627767074202e-6 + (0.15899007843582444846e-8 + (0.92610375235427359475e-11 + 0.45054073102222222221e-13 * t) * t) * t) * t) * t) * t;
}
case 57: {
G4double t = 2*y100 - 115;
return 0.18139556223643701364e0 + (0.33741744168096996041e-2 + (0.30973511714709500836e-4 + (0.24619326937592290996e-6 + (0.16852609412267750744e-8 + (0.98166442942854895573e-11 + 0.47565418097777777779e-13 * t) * t) * t) * t) * t) * t;
}
case 58: {
G4double t = 2*y100 - 117;
return 0.18826980194443664549e0 + (0.35010775057740317997e-2 + (0.32491914440014267480e-4 + (0.26007572375886319028e-6 + (0.17863299617388376116e-8 + (0.10403065638343878679e-10 + 0.50190265831111111110e-13 * t) * t) * t) * t) * t) * t;
}
case 59: {
G4double t = 2*y100 - 119;
return 0.19540403413693967350e0 + (0.36342240767211326315e-2 + (0.34096085096200907289e-4 + (0.27479061117017637474e-6 + (0.18934228504790032826e-8 + (0.11021679075323598664e-10 + 0.52931171733333333334e-13 * t) * t) * t) * t) * t) * t;
}
case 60: {
G4double t = 2*y100 - 121;
return 0.20281109560651886959e0 + (0.37739673859323597060e-2 + (0.35791165457592409054e-4 + (0.29038742889416172404e-6 + (0.20068685374849001770e-8 + (0.11673891799578381999e-10 + 0.55790523093333333334e-13 * t) * t) * t) * t) * t) * t;
}
case 61: {
G4double t = 2*y100 - 123;
return 0.21050455062669334978e0 + (0.39206818613925652425e-2 + (0.37582602289680101704e-4 + (0.30691836231886877385e-6 + (0.21270101645763677824e-8 + (0.12361138551062899455e-10 + 0.58770520160000000000e-13 * t) * t) * t) * t) * t) * t;
}
case 62: {
G4double t = 2*y100 - 125;
return 0.21849873453703332479e0 + (0.40747643554689586041e-2 + (0.39476163820986711501e-4 + (0.32443839970139918836e-6 + (0.22542053491518680200e-8 + (0.13084879235290858490e-10 + 0.61873153262222222221e-13 * t) * t) * t) * t) * t) * t;
}
case 63: {
G4double t = 2*y100 - 127;
return 0.22680879990043229327e0 + (0.42366354648628516935e-2 + (0.41477956909656896779e-4 + (0.34300544894502810002e-6 + (0.23888264229264067658e-8 + (0.13846596292818514601e-10 + 0.65100183751111111110e-13 * t) * t) * t) * t) * t) * t;
}
case 64: {
G4double t = 2*y100 - 129;
return 0.23545076536988703937e0 + (0.44067409206365170888e-2 + (0.43594444916224700881e-4 + (0.36268045617760415178e-6 + (0.25312606430853202748e-8 + (0.14647791812837903061e-10 + 0.68453122631111111110e-13 * t) * t) * t) * t) * t) * t;
}
case 65: {
G4double t = 2*y100 - 131;
return 0.24444156740777432838e0 + (0.45855530511605787178e-2 + (0.45832466292683085475e-4 + (0.38352752590033030472e-6 + (0.26819103733055603460e-8 + (0.15489984390884756993e-10 + 0.71933206364444444445e-13 * t) * t) * t) * t) * t) * t;
}
case 66: {
G4double t = 2*y100 - 133;
return 0.25379911500634264643e0 + (0.47735723208650032167e-2 + (0.48199253896534185372e-4 + (0.40561404245564732314e-6 + (0.28411932320871165585e-8 + (0.16374705736458320149e-10 + 0.75541379822222222221e-13 * t) * t) * t) * t) * t) * t;
}
case 67: {
G4double t = 2*y100 - 135;
return 0.26354234756393613032e0 + (0.49713289477083781266e-2 + (0.50702455036930367504e-4 + (0.42901079254268185722e-6 + (0.30095422058900481753e-8 + (0.17303497025347342498e-10 + 0.79278273368888888890e-13 * t) * t) * t) * t) * t) * t;
}
case 68: {
G4double t = 2*y100 - 137;
return 0.27369129607732343398e0 + (0.51793846023052643767e-2 + (0.53350152258326602629e-4 + (0.45379208848865015485e-6 + (0.31874057245814381257e-8 + (0.18277905010245111046e-10 + 0.83144182364444444445e-13 * t) * t) * t) * t) * t) * t;
}
case 69: {
G4double t = 2*y100 - 139;
return 0.28426714781640316172e0 + (0.53983341916695141966e-2 + (0.56150884865255810638e-4 + (0.48003589196494734238e-6 + (0.33752476967570796349e-8 + (0.19299477888083469086e-10 + 0.87139049137777777779e-13 * t) * t) * t) * t) * t) * t;
}
case 70: {
G4double t = 2*y100 - 141;
return 0.29529231465348519920e0 + (0.56288077305420795663e-2 + (0.59113671189913307427e-4 + (0.50782393781744840482e-6 + (0.35735475025851713168e-8 + (0.20369760937017070382e-10 + 0.91262442613333333334e-13 * t) * t) * t) * t) * t) * t;
}
case 71: {
G4double t = 2*y100 - 143;
return 0.30679050522528838613e0 + (0.58714723032745403331e-2 + (0.62248031602197686791e-4 + (0.53724185766200945789e-6 + (0.37827999418960232678e-8 + (0.21490291930444538307e-10 + 0.95513539182222222221e-13 * t) * t) * t) * t) * t) * t;
}
case 72: {
G4double t = 2*y100 - 145;
return 0.31878680111173319425e0 + (0.61270341192339103514e-2 + (0.65564012259707640976e-4 + (0.56837930287837738996e-6 + (0.40035151353392378882e-8 + (0.22662596341239294792e-10 + 0.99891109760000000000e-13 * t) * t) * t) * t) * t) * t;
}
case 73: {
G4double t = 2*y100 - 147;
return 0.33130773722152622027e0 + (0.63962406646798080903e-2 + (0.69072209592942396666e-4 + (0.60133006661885941812e-6 + (0.42362183765883466691e-8 + (0.23888182347073698382e-10 + 0.10439349811555555556e-12 * t) * t) * t) * t) * t) * t;
}
case 74: {
G4double t = 2*y100 - 149;
return 0.34438138658041336523e0 + (0.66798829540414007258e-2 + (0.72783795518603561144e-4 + (0.63619220443228800680e-6 + (0.44814499336514453364e-8 + (0.25168535651285475274e-10 + 0.10901861383111111111e-12 * t) * t) * t) * t) * t) * t;
}
case 75: {
G4double t = 2*y100 - 151;
return 0.35803744972380175583e0 + (0.69787978834882685031e-2 + (0.76710543371454822497e-4 + (0.67306815308917386747e-6 + (0.47397647975845228205e-8 + (0.26505114141143050509e-10 + 0.11376390933333333333e-12 * t) * t) * t) * t) * t) * t;
}
case 76: {
G4double t = 2*y100 - 153;
return 0.37230734890119724188e0 + (0.72938706896461381003e-2 + (0.80864854542670714092e-4 + (0.71206484718062688779e-6 + (0.50117323769745883805e-8 + (0.27899342394100074165e-10 + 0.11862637614222222222e-12 * t) * t) * t) * t) * t) * t;
}
case 77: {
G4double t = 2*y100 - 155;
return 0.38722432730555448223e0 + (0.76260375162549802745e-2 + (0.85259785810004603848e-4 + (0.75329383305171327677e-6 + (0.52979361368388119355e-8 + (0.29352606054164086709e-10 + 0.12360253370666666667e-12 * t) * t) * t) * t) * t) * t;
}
case 78: {
G4double t = 2*y100 - 157;
return 0.40282355354616940667e0 + (0.79762880915029728079e-2 + (0.89909077342438246452e-4 + (0.79687137961956194579e-6 + (0.55989731807360403195e-8 + (0.30866246101464869050e-10 + 0.12868841946666666667e-12 * t) * t) * t) * t) * t) * t;
}
case 79: {
G4double t = 2*y100 - 159;
return 0.41914223158913787649e0 + (0.83456685186950463538e-2 + (0.94827181359250161335e-4 + (0.84291858561783141014e-6 + (0.59154537751083485684e-8 + (0.32441553034347469291e-10 + 0.13387957943111111111e-12 * t) * t) * t) * t) * t) * t;
}
case 80: {
G4double t = 2*y100 - 161;
return 0.43621971639463786896e0 + (0.87352841828289495773e-2 + (0.10002929142066799966e-3 + (0.89156148280219880024e-6 + (0.62480008150788597147e-8 + (0.34079760983458878910e-10 + 0.13917107176888888889e-12 * t) * t) * t) * t) * t) * t;
}
case 81: {
G4double t = 2*y100 - 163;
return 0.45409763548534330981e0 + (0.91463027755548240654e-2 + (0.10553137232446167258e-3 + (0.94293113464638623798e-6 + (0.65972492312219959885e-8 + (0.35782041795476563662e-10 + 0.14455745872000000000e-12 * t) * t) * t) * t) * t) * t;
}
case 82: {
G4double t = 2*y100 - 165;
return 0.47282001668512331468e0 + (0.95799574408860463394e-2 + (0.11135019058000067469e-3 + (0.99716373005509038080e-6 + (0.69638453369956970347e-8 + (0.37549499088161345850e-10 + 0.15003280712888888889e-12 * t) * t) * t) * t) * t) * t;
}
case 83: {
G4double t = 2*y100 - 167;
return 0.49243342227179841649e0 + (0.10037550043909497071e-1 + (0.11750334542845234952e-3 + (0.10544006716188967172e-5 + (0.73484461168242224872e-8 + (0.39383162326435752965e-10 + 0.15559069118222222222e-12 * t) * t) * t) * t) * t) * t;
}
case 84: {
G4double t = 2*y100 - 169;
return 0.51298708979209258326e0 + (0.10520454564612427224e-1 + (0.12400930037494996655e-3 + (0.11147886579371265246e-5 + (0.77517184550568711454e-8 + (0.41283980931872622611e-10 + 0.16122419680000000000e-12 * t) * t) * t) * t) * t) * t;
}
case 85: {
G4double t = 2*y100 - 171;
return 0.53453307979101369843e0 + (0.11030120618800726938e-1 + (0.13088741519572269581e-3 + (0.11784797595374515432e-5 + (0.81743383063044825400e-8 + (0.43252818449517081051e-10 + 0.16692592640000000000e-12 * t) * t) * t) * t) * t) * t;
}
case 86: {
G4double t = 2*y100 - 173;
return 0.55712643071169299478e0 + (0.11568077107929735233e-1 + (0.13815797838036651289e-3 + (0.12456314879260904558e-5 + (0.86169898078969313597e-8 + (0.45290446811539652525e-10 + 0.17268801084444444444e-12 * t) * t) * t) * t) * t) * t;
}
case 87: {
G4double t = 2*y100 - 175;
return 0.58082532122519320968e0 + (0.12135935999503877077e-1 + (0.14584223996665838559e-3 + (0.13164068573095710742e-5 + (0.90803643355106020163e-8 + (0.47397540713124619155e-10 + 0.17850211608888888889e-12 * t) * t) * t) * t) * t) * t;
}
case 88: {
G4double t = 2*y100 - 177;
return 0.60569124025293375554e0 + (0.12735396239525550361e-1 + (0.15396244472258863344e-3 + (0.13909744385382818253e-5 + (0.95651595032306228245e-8 + (0.49574672127669041550e-10 + 0.18435945564444444444e-12 * t) * t) * t) * t) * t) * t;
}
case 89: {
G4double t = 2*y100 - 179;
return 0.63178916494715716894e0 + (0.13368247798287030927e-1 + (0.16254186562762076141e-3 + (0.14695084048334056083e-5 + (0.10072078109604152350e-7 + (0.51822304995680707483e-10 + 0.19025081422222222222e-12 * t) * t) * t) * t) * t) * t;
}
case 90: {
G4double t = 2*y100 - 181;
return 0.65918774689725319200e0 + (0.14036375850601992063e-1 + (0.17160483760259706354e-3 + (0.15521885688723188371e-5 + (0.10601827031535280590e-7 + (0.54140790105837520499e-10 + 0.19616655146666666667e-12 * t) * t) * t) * t) * t) * t;
}
case 91: {
G4double t = 2*y100 - 183;
return 0.68795950683174433822e0 + (0.14741765091365869084e-1 + (0.18117679143520433835e-3 + (0.16392004108230585213e-5 + (0.11155116068018043001e-7 + (0.56530360194925690374e-10 + 0.20209663662222222222e-12 * t) * t) * t) * t) * t) * t;
}
case 92: {
G4double t = 2*y100 - 185;
return 0.71818103808729967036e0 + (0.15486504187117112279e-1 + (0.19128428784550923217e-3 + (0.17307350969359975848e-5 + (0.11732656736113607751e-7 + (0.58991125287563833603e-10 + 0.20803065333333333333e-12 * t) * t) * t) * t) * t) * t;
}
case 93: {
G4double t = 2*y100 - 187;
return 0.74993321911726254661e0 + (0.16272790364044783382e-1 + (0.20195505163377912645e-3 + (0.18269894883203346953e-5 + (0.12335161021630225535e-7 + (0.61523068312169087227e-10 + 0.21395783431111111111e-12 * t) * t) * t) * t) * t) * t;
}
case 94: {
G4double t = 2*y100 - 189;
return 0.78330143531283492729e0 + (0.17102934132652429240e-1 + (0.21321800585063327041e-3 + (0.19281661395543913713e-5 + (0.12963340087354341574e-7 + (0.64126040998066348872e-10 + 0.21986708942222222222e-12 * t) * t) * t) * t) * t) * t;
}
case 95: {
G4double t = 2*y100 - 191;
return 0.81837581041023811832e0 + (0.17979364149044223802e-1 + (0.22510330592753129006e-3 + (0.20344732868018175389e-5 + (0.13617902941839949718e-7 + (0.66799760083972474642e-10 + 0.22574701262222222222e-12 * t) * t) * t) * t) * t) * t;
}
case 96: {
G4double t = 2*y100 - 193;
return 0.85525144775685126237e0 + (0.18904632212547561026e-1 + (0.23764237370371255638e-3 + (0.21461248251306387979e-5 + (0.14299555071870523786e-7 + (0.69543803864694171934e-10 + 0.23158593688888888889e-12 * t) * t) * t) * t) * t) * t;
}
case 97: {
G4double t = 2*y100 - 195;
return 0.89402868170849933734e0 + (0.19881418399127202569e-1 + (0.25086793128395995798e-3 + (0.22633402747585233180e-5 + (0.15008997042116532283e-7 + (0.72357609075043941261e-10 + 0.23737194737777777778e-12 * t) * t) * t) * t) * t) * t;
}
case 98: {
G4double t = 2*y100 - 197;
return 0.93481333942870796363e0 + (0.20912536329780368893e-1 + (0.26481403465998477969e-3 + (0.23863447359754921676e-5 + (0.15746923065472184451e-7 + (0.75240468141720143653e-10 + 0.24309291271111111111e-12 * t) * t) * t) * t) * t) * t;
}
case 99: {
G4double t = 2*y100 - 199;
return 0.97771701335885035464e0 + (0.22000938572830479551e-1 + (0.27951610702682383001e-3 + (0.25153688325245314530e-5 + (0.16514019547822821453e-7 + (0.78191526829368231251e-10 + 0.24873652355555555556e-12 * t) * t) * t) * t) * t) * t;
}
}
// we only get here if y = 1, i.e. |x| < 4*eps, in which case
// erfcx is within 1e-15 of 1..
return 1.0;
}
G4double G4ErrorFunction::NormQuantile(G4double p)
{
G4double a0 = 3.3871328727963666080e0;
G4double a1 = 1.3314166789178437745e+2;
G4double a2 = 1.9715909503065514427e+3;
G4double a3 = 1.3731693765509461125e+4;
G4double a4 = 4.5921953931549871457e+4;
G4double a5 = 6.7265770927008700853e+4;
G4double a6 = 3.3430575583588128105e+4;
G4double a7 = 2.5090809287301226727e+3;
G4double b1 = 4.2313330701600911252e+1;
G4double b2 = 6.8718700749205790830e+2;
G4double b3 = 5.3941960214247511077e+3;
G4double b4 = 2.1213794301586595867e+4;
G4double b5 = 3.9307895800092710610e+4;
G4double b6 = 2.8729085735721942674e+4;
G4double b7 = 5.2264952788528545610e+3;
G4double c0 = 1.42343711074968357734e0;
G4double c1 = 4.63033784615654529590e0;
G4double c2 = 5.76949722146069140550e0;
G4double c3 = 3.64784832476320460504e0;
G4double c4 = 1.27045825245236838258e0;
G4double c5 = 2.41780725177450611770e-1;
G4double c6 = 2.27238449892691845833e-2;
G4double c7 = 7.74545014278341407640e-4;
G4double d1 = 2.05319162663775882187e0;
G4double d2 = 1.67638483018380384940e0;
G4double d3 = 6.89767334985100004550e-1;
G4double d4 = 1.48103976427480074590e-1;
G4double d5 = 1.51986665636164571966e-2;
G4double d6 = 5.47593808499534494600e-4;
G4double d7 = 1.05075007164441684324e-9;
G4double e0 = 6.65790464350110377720e0;
G4double e1 = 5.46378491116411436990e0;
G4double e2 = 1.78482653991729133580e0;
G4double e3 = 2.96560571828504891230e-1;
G4double e4 = 2.65321895265761230930e-2;
G4double e5 = 1.24266094738807843860e-3;
G4double e6 = 2.71155556874348757815e-5;
G4double e7 = 2.01033439929228813265e-7;
G4double f1 = 5.99832206555887937690e-1;
G4double f2 = 1.36929880922735805310e-1;
G4double f3 = 1.48753612908506148525e-2;
G4double f4 = 7.86869131145613259100e-4;
G4double f5 = 1.84631831751005468180e-5;
G4double f6 = 1.42151175831644588870e-7;
G4double f7 = 2.04426310338993978564e-15;
G4double split1 = 0.425;
G4double split2=5.;
G4double konst1=0.180625;
G4double konst2=1.6;
G4double q, r, quantile;
q=p-0.5;
if (std::abs(q)<split1) {
r=konst1-q*q;
quantile = q* (((((((a7 * r + a6) * r + a5) * r + a4) * r + a3)
* r + a2) * r + a1) * r + a0) /
(((((((b7 * r + b6) * r + b5) * r + b4) * r + b3)
* r + b2) * r + b1) * r + 1.);
} else {
if(q<0) r=p;
else r=1-p;
//error case
if (r<=0)
quantile=0;
else {
r=std::sqrt(-std::log(r));
if (r<=split2) {
r=r-konst2;
quantile=(((((((c7 * r + c6) * r + c5) * r + c4) * r + c3)
* r + c2) * r + c1) * r + c0) /
(((((((d7 * r + d6) * r + d5) * r + d4) * r + d3)
* r + d2) * r + d1) * r + 1);
} else{
r=r-split2;
quantile=(((((((e7 * r + e6) * r + e5) * r + e4) * r + e3)
* r + e2) * r + e1) * r + e0) /
(((((((f7 * r + f6) * r + f5) * r + f4) * r + f3)
* r + f2) * r + f1) * r + 1);
}
if (q<0) quantile=-quantile;
}
}
return quantile;
}
G4double G4ErrorFunction::erfcx(G4double x)
{
if (x >= 0) {
if (x > 50) { // continued-fraction expansion is faster
const G4double ispi = 1./std::sqrt(CLHEP::pi); //0.56418958354775628694807945156; // 1 / sqrt(pi)
if (x > 5e7) // 1-term expansion, important to avoid overflow
return ispi / x;
/* 5-term expansion (rely on compiler for CSE), simplified from:
ispi / (x+0.5/(x+1/(x+1.5/(x+2/x)))) */
return ispi*((x*x) * (x*x+4.5) + 2) / (x * ((x*x) * (x*x+5) + 3.75));
}
return erfcx_y100(400/(4+x));
}
else
return x < -26.7 ? HUGE_VAL : (x < -6.1 ? 2*std::exp(x*x)
: 2*std::exp(x*x) - erfcx_y100(400/(4-x)));
}
G4double G4ErrorFunction::erfc(G4double x) {
return 1.0 - std::erf(x);
}
G4double G4ErrorFunction::erfcWxy(G4double c, G4double x, G4double y) {
return c * ( erfc(x) - std::exp(-x*x) * erfcx(x+y) );
}
G4double G4ErrorFunction::Lambda(G4double x, G4double beta, G4double alphatilde) {
return std::exp(-beta*beta/x) * ( 1.0 - alphatilde * std::sqrt(CLHEP::pi * x) * erfcx(beta/std::sqrt(x) + alphatilde*std::sqrt(x)));
}
G4double G4ErrorFunction::erfcInv(G4double x) {
return - 0.70710678118654752440 * NormQuantile( 0.5 * x);
}