Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4DNASmoluchowskiReactionModel.cc 70171 2013-05-24 13:34:18Z gcosmo $
|
||||
// $Id: G4DNASmoluchowskiReactionModel.cc 85244 2014-10-27 08:24:13Z gcosmo $
|
||||
//
|
||||
#include "G4DNASmoluchowskiReactionModel.hh"
|
||||
#include "Randomize.hh"
|
||||
@@ -31,123 +31,137 @@
|
||||
#include "G4DNAMolecularReactionTable.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
G4DNASmoluchowskiReactionModel::G4DNASmoluchowskiReactionModel() : G4VDNAReactionModel()
|
||||
G4DNASmoluchowskiReactionModel::G4DNASmoluchowskiReactionModel() :
|
||||
G4VDNAReactionModel()
|
||||
{
|
||||
fReactionData = 0 ;
|
||||
fReactionData = 0;
|
||||
}
|
||||
|
||||
G4DNASmoluchowskiReactionModel::G4DNASmoluchowskiReactionModel(const G4DNASmoluchowskiReactionModel& __right) :
|
||||
G4VDNAReactionModel(__right)
|
||||
{
|
||||
fReactionData = 0 ;
|
||||
fReactionData = 0;
|
||||
}
|
||||
|
||||
G4DNASmoluchowskiReactionModel& G4DNASmoluchowskiReactionModel::operator=(const G4DNASmoluchowskiReactionModel& right)
|
||||
{
|
||||
if(this == &right) return *this;
|
||||
fReactionData = 0;
|
||||
return *this;
|
||||
if (this == &right) return *this;
|
||||
fReactionData = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4DNASmoluchowskiReactionModel::~G4DNASmoluchowskiReactionModel()
|
||||
{
|
||||
fReactionData = 0 ;
|
||||
fReactionData = 0;
|
||||
}
|
||||
|
||||
void G4DNASmoluchowskiReactionModel::Initialise(const G4Molecule* __molecule, const G4Track&)
|
||||
void G4DNASmoluchowskiReactionModel::Initialise(const G4Molecule* __molecule,
|
||||
const G4Track&)
|
||||
{
|
||||
fReactionData = fReactionTable->GetReactionData(__molecule);
|
||||
fReactionData = fReactionTable->GetReactionData(__molecule);
|
||||
}
|
||||
|
||||
void G4DNASmoluchowskiReactionModel::InitialiseToPrint(const G4Molecule* __molecule)
|
||||
{
|
||||
fReactionData = fReactionTable->GetReactionData(__molecule);
|
||||
fReactionData = fReactionTable->GetReactionData(__molecule);
|
||||
}
|
||||
|
||||
G4double G4DNASmoluchowskiReactionModel::GetReactionRadius(const G4Molecule* mol1,
|
||||
const G4Molecule* mol2)
|
||||
const G4Molecule* mol2)
|
||||
{
|
||||
G4double __output = fReactionTable -> GetReactionData(mol1,mol2)->GetReducedReactionRadius();
|
||||
return __output ;
|
||||
G4double __output = fReactionTable->GetReactionData(mol1, mol2)
|
||||
->GetReducedReactionRadius();
|
||||
return __output;
|
||||
}
|
||||
|
||||
G4double G4DNASmoluchowskiReactionModel::GetReactionRadius(const G4int __i)
|
||||
{
|
||||
G4double __output = (*fReactionData)[__i] -> GetReducedReactionRadius();
|
||||
return __output ;
|
||||
G4double __output = (*fReactionData)[__i]->GetReducedReactionRadius();
|
||||
return __output;
|
||||
}
|
||||
|
||||
G4bool G4DNASmoluchowskiReactionModel::FindReaction(const G4Track& __trackA,
|
||||
const G4Track& __trackB,
|
||||
const G4double __R,
|
||||
G4double& __r,
|
||||
const G4bool __alongStepReaction)
|
||||
const G4Track& __trackB,
|
||||
const G4double __R,
|
||||
G4double& __r,
|
||||
const G4bool __alongStepReaction)
|
||||
{
|
||||
G4double __postStepSeparation = 0;
|
||||
bool __do_break = false ;
|
||||
G4double __R2 = __R*__R ;
|
||||
int k = 0 ;
|
||||
G4double __postStepSeparation = 0;
|
||||
bool __do_break = false;
|
||||
G4double __R2 = __R * __R;
|
||||
int k = 0;
|
||||
|
||||
for(; k < 3 ; k++)
|
||||
for (; k < 3; k++)
|
||||
{
|
||||
__postStepSeparation += std::pow(
|
||||
__trackA.GetPosition()[k] - __trackB.GetPosition()[k], 2);
|
||||
|
||||
if (__postStepSeparation > __R2)
|
||||
{
|
||||
__postStepSeparation += std::pow(__trackA.GetPosition()[k] - __trackB.GetPosition()[k],2);
|
||||
__do_break = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(__postStepSeparation > __R2)
|
||||
{
|
||||
__do_break = true ;
|
||||
break ;
|
||||
}
|
||||
if (__do_break == false)
|
||||
{
|
||||
// The loop was not break
|
||||
// => __r^2 < __R^2
|
||||
__r = std::sqrt(__postStepSeparation);
|
||||
return true;
|
||||
}
|
||||
else if (__alongStepReaction == true)
|
||||
{
|
||||
//G4cout << "alongStepReaction==true" << G4endl;
|
||||
//Along step cheack and
|
||||
// the loop has break
|
||||
|
||||
// Continue loop
|
||||
for (; k < 3; k++)
|
||||
{
|
||||
__postStepSeparation += std::pow(
|
||||
__trackA.GetPosition()[k] - __trackB.GetPosition()[k], 2);
|
||||
}
|
||||
// Use Green approach : the Brownian bridge
|
||||
__r = (__postStepSeparation = std::sqrt(__postStepSeparation));
|
||||
|
||||
G4Molecule* __moleculeA = GetMolecule(__trackA);
|
||||
G4Molecule* __moleculeB = GetMolecule(__trackB);
|
||||
|
||||
G4double __D = __moleculeA->GetDiffusionCoefficient()
|
||||
+ __moleculeB->GetDiffusionCoefficient();
|
||||
|
||||
G4ThreeVector __preStepPositionA = __trackA.GetStep()->GetPreStepPoint()
|
||||
->GetPosition();
|
||||
G4ThreeVector __preStepPositionB = __trackB.GetStep()->GetPreStepPoint()
|
||||
->GetPosition();
|
||||
|
||||
if (__preStepPositionA == __trackA.GetPosition())
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "The molecule : " << __moleculeA->GetName();
|
||||
exceptionDescription << " with track ID :" << __trackA.GetTrackID();
|
||||
exceptionDescription << " did not move since the previous step." << G4endl;
|
||||
exceptionDescription << "Current position : "
|
||||
<< G4BestUnit(__trackA.GetPosition(), "Length")
|
||||
<< G4endl;
|
||||
exceptionDescription << "Previous position : "
|
||||
<< G4BestUnit(__preStepPositionA, "Length") << G4endl;
|
||||
G4Exception("G4DNASmoluchowskiReactionModel::FindReaction",
|
||||
"G4DNASmoluchowskiReactionModel", FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
if(__do_break == false)
|
||||
{
|
||||
// The loop was not break
|
||||
// => __r^2 < __R^2
|
||||
__r = std::sqrt(__postStepSeparation);
|
||||
return true;
|
||||
}
|
||||
else if(__alongStepReaction == true)
|
||||
{
|
||||
//G4cout << "alongStepReaction==true" << G4endl;
|
||||
//Along step cheack and
|
||||
// the loop has break
|
||||
G4double __preStepSeparation =
|
||||
(__preStepPositionA - __preStepPositionB).mag();
|
||||
|
||||
// Continue loop
|
||||
for(; k < 3 ; k++)
|
||||
{
|
||||
__postStepSeparation += std::pow(__trackA.GetPosition()[k] - __trackB.GetPosition()[k],2);
|
||||
}
|
||||
// Use Green approach : the Brownian bridge
|
||||
__r = (__postStepSeparation = std::sqrt(__postStepSeparation) );
|
||||
G4double __probabiltyOfEncounter = std::exp(
|
||||
-(__preStepSeparation - __R) * (__postStepSeparation - __R) / (__D
|
||||
* (__trackB.GetStep()->GetDeltaTime())));
|
||||
G4double __selectedPOE = G4UniformRand();
|
||||
|
||||
G4Molecule* __moleculeA = GetMolecule(__trackA);
|
||||
G4Molecule* __moleculeB = GetMolecule(__trackB);
|
||||
if (__selectedPOE <= __probabiltyOfEncounter) return true;
|
||||
}
|
||||
|
||||
G4double __D = __moleculeA->GetDiffusionCoefficient() + __moleculeB->GetDiffusionCoefficient();
|
||||
|
||||
G4ThreeVector __preStepPositionA = __trackA.GetStep()->GetPreStepPoint() ->GetPosition();
|
||||
G4ThreeVector __preStepPositionB = __trackB.GetStep()->GetPreStepPoint() ->GetPosition();
|
||||
|
||||
if(__preStepPositionA == __trackA.GetPosition())
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription ;
|
||||
exceptionDescription << "The molecule : " << __moleculeA->GetName();
|
||||
exceptionDescription << " with track ID :" << __trackA.GetTrackID();
|
||||
exceptionDescription << " did not move since the previous step." << G4endl;
|
||||
exceptionDescription << "Current position : " << G4BestUnit(__trackA.GetPosition(),"Length") << G4endl;
|
||||
exceptionDescription << "Previous position : " << G4BestUnit(__preStepPositionA,"Length") << G4endl;
|
||||
G4Exception("G4DNASmoluchowskiReactionModel::FindReaction","G4DNASmoluchowskiReactionModel",
|
||||
FatalErrorInArgument,exceptionDescription);
|
||||
}
|
||||
|
||||
G4double __preStepSeparation = (__preStepPositionA - __preStepPositionB).mag();
|
||||
|
||||
G4double __probabiltyOfEncounter = std::exp(-(__preStepSeparation - __R)*(__postStepSeparation - __R)
|
||||
/ (__D* (__trackB.GetStep()->GetDeltaTime())));
|
||||
G4double __selectedPOE = G4UniformRand();
|
||||
|
||||
if(__selectedPOE<=__probabiltyOfEncounter) return true;
|
||||
}
|
||||
|
||||
return false ;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user