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.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/models/src/G4DNASmoluchowskiReactionModel.cc (Version 11.3.0) and /processes/electromagnetic/dna/models/src/G4DNASmoluchowskiReactionModel.cc (Version 10.3.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4DNASmoluchowskiReactionModel.cc 95948 2016-03-03 10:40:33Z gcosmo $
 26 //                                                 27 //
 27 #include "G4DNASmoluchowskiReactionModel.hh"       28 #include "G4DNASmoluchowskiReactionModel.hh"
 28 #include "Randomize.hh"                            29 #include "Randomize.hh"
 29 #include "G4Track.hh"                              30 #include "G4Track.hh"
 30 #include "G4DNAMolecularReactionTable.hh"          31 #include "G4DNAMolecularReactionTable.hh"
 31 #include "G4UnitsTable.hh"                         32 #include "G4UnitsTable.hh"
 32 #include "G4Molecule.hh"                           33 #include "G4Molecule.hh"
                                                   >>  34 //#include "G4Scheduler.hh"
 33 #include "G4Exp.hh"                                35 #include "G4Exp.hh"
 34                                                    36 
 35 G4DNASmoluchowskiReactionModel::G4DNASmoluchow <<  37 G4DNASmoluchowskiReactionModel::G4DNASmoluchowskiReactionModel() :
                                                   >>  38     G4VDNAReactionModel()
                                                   >>  39 {
                                                   >>  40   fReactionData = 0;
                                                   >>  41 }
 36                                                    42 
 37 G4DNASmoluchowskiReactionModel::~G4DNASmolucho <<  43 G4DNASmoluchowskiReactionModel::G4DNASmoluchowskiReactionModel(const G4DNASmoluchowskiReactionModel& __right) :
                                                   >>  44     G4VDNAReactionModel(__right)
                                                   >>  45 {
                                                   >>  46   fReactionData = 0;
                                                   >>  47 }
 38                                                    48 
 39 void G4DNASmoluchowskiReactionModel::Initialis <<  49 G4DNASmoluchowskiReactionModel& G4DNASmoluchowskiReactionModel::operator=(const G4DNASmoluchowskiReactionModel& right)
                                                   >>  50 {
                                                   >>  51   if (this == &right) return *this;
                                                   >>  52   fReactionData = 0;
                                                   >>  53   return *this;
                                                   >>  54 }
                                                   >>  55 
                                                   >>  56 G4DNASmoluchowskiReactionModel::~G4DNASmoluchowskiReactionModel()
                                                   >>  57 {
                                                   >>  58   fReactionData = 0;
                                                   >>  59 }
                                                   >>  60 
                                                   >>  61 void G4DNASmoluchowskiReactionModel::Initialise(G4MolecularConfiguration* __molecule,
 40                                                    62                                                 const G4Track&)
 41 {                                                  63 {
 42     fpReactionData = fpReactionTable->GetReact <<  64   fReactionData = fReactionTable->GetReactionData(__molecule);
 43 }                                                  65 }
 44                                                    66 
 45 void G4DNASmoluchowskiReactionModel::Initialis <<  67 void
                                                   >>  68 G4DNASmoluchowskiReactionModel::
                                                   >>  69 InitialiseToPrint(G4MolecularConfiguration* __molecule)
 46 {                                                  70 {
 47     fpReactionData = fpReactionTable->GetReact <<  71   fReactionData = fReactionTable->GetReactionData(__molecule);
 48 }                                                  72 }
 49                                                    73 
 50 G4double G4DNASmoluchowskiReactionModel::GetRe <<  74 G4double
 51                                                <<  75 G4DNASmoluchowskiReactionModel::GetReactionRadius(G4MolecularConfiguration* __mol1,
                                                   >>  76                                                   G4MolecularConfiguration* __mol2)
 52 {                                                  77 {
 53     G4double __output = fpReactionTable->GetRe <<  78   G4double __output = fReactionTable->GetReactionData(__mol1, __mol2)
 54     return __output;                           <<  79       ->GetEffectiveReactionRadius();
                                                   >>  80   return __output;
 55 }                                                  81 }
 56                                                    82 
 57 G4double G4DNASmoluchowskiReactionModel::GetRe <<  83 G4double G4DNASmoluchowskiReactionModel::GetReactionRadius(const G4int __i)
 58 {                                                  84 {
 59     G4double __output = (*fpReactionData)[__i] <<  85   G4double __output = (*fReactionData)[__i]->GetEffectiveReactionRadius();
 60     return __output;                           <<  86   return __output;
 61 }                                                  87 }
 62                                                    88 
 63 G4bool G4DNASmoluchowskiReactionModel::FindRea     89 G4bool G4DNASmoluchowskiReactionModel::FindReaction(const G4Track& __trackA,
 64                                                    90                                                     const G4Track& __trackB,
 65                                                <<  91                                                     const G4double __R,
 66                                                <<  92                                                     G4double& __r,
 67                                                    93                                                     const G4bool __alongStepReaction)
 68 {                                                  94 {
 69     const G4double R2 = __reactionRadius * __r <<  95   G4double postStepSeparation = 0;
 70     G4double postStepSeparation = 0.;          <<  96   bool do_break = false;
 71     bool do_break = false;                     <<  97   G4double R2 = __R * __R;
 72     int k = 0;                                 <<  98   int k = 0;
                                                   >>  99 
                                                   >> 100   for (; k < 3; k++)
                                                   >> 101   {
                                                   >> 102     postStepSeparation += std::pow(
                                                   >> 103         __trackA.GetPosition()[k] - __trackB.GetPosition()[k], 2);
 73                                                   104 
 74     for (; k < 3; ++k)                         << 105     if (postStepSeparation > R2)
 75     {                                             106     {
 76         postStepSeparation += std::pow(        << 107       do_break = true;
 77             __trackA.GetPosition()[k] - __trac << 108       break;
 78                                                << 
 79         if (postStepSeparation > R2)           << 
 80         {                                      << 
 81             do_break = true;                   << 
 82             break;                             << 
 83         }                                      << 
 84     }                                             109     }
                                                   >> 110   }
 85                                                   111 
 86     if (!do_break)                             << 112   if (do_break == false)
                                                   >> 113   {
                                                   >> 114     // The loop was not break
                                                   >> 115     // => __r^2 < __R^2
                                                   >> 116     __r = std::sqrt(postStepSeparation);
                                                   >> 117     return true;
                                                   >> 118   }
                                                   >> 119   else if (__alongStepReaction == true)
                                                   >> 120   {
                                                   >> 121     //G4cout << "alongStepReaction==true" << G4endl;
                                                   >> 122     //Along step cheack and
                                                   >> 123     // the loop has break
                                                   >> 124 
                                                   >> 125     // Continue loop
                                                   >> 126     for (; k < 3; k++)
 87     {                                             127     {
 88         // The loop was not break              << 128       postStepSeparation += std::pow(
 89         // => r^2 < R^2                        << 129           __trackA.GetPosition()[k] - __trackB.GetPosition()[k], 2);
 90         __separationDistance = std::sqrt(postS << 
 91         return true;                           << 
 92     }                                             130     }
 93     if (__alongStepReaction)                   << 131     // Use Green approach : the Brownian bridge
 94     {                                          << 132     __r = (postStepSeparation = std::sqrt(postStepSeparation));
 95         //Along step check and the loop has br << 133 
                                                   >> 134     G4Molecule* __moleculeA = GetMolecule(__trackA);
                                                   >> 135     G4Molecule* __moleculeB = GetMolecule(__trackB);
                                                   >> 136 
                                                   >> 137     G4double __D = __moleculeA->GetDiffusionCoefficient()
                                                   >> 138         + __moleculeB->GetDiffusionCoefficient();
                                                   >> 139 
                                                   >> 140     G4ThreeVector __preStepPositionA = __trackA.GetStep()->GetPreStepPoint()
                                                   >> 141         ->GetPosition();
                                                   >> 142     G4ThreeVector __preStepPositionB = __trackB.GetStep()->GetPreStepPoint()
                                                   >> 143         ->GetPosition();
 96                                                   144 
 97         // Continue loop                       << 145     if (__preStepPositionA == __trackA.GetPosition())
 98         for (; k < 3; ++k)                     << 146     {
 99         {                                      << 147       G4ExceptionDescription exceptionDescription;
100             postStepSeparation += std::pow(    << 148       exceptionDescription << "The molecule : " << __moleculeA->GetName();
101                 __trackA.GetPosition()[k] - __ << 149       exceptionDescription << " with track ID :" << __trackA.GetTrackID();
102         }                                      << 150       exceptionDescription << " did not move since the previous step." << G4endl;
103         // Use Green approach : the Brownian b << 151       exceptionDescription << "Current position : "
104         __separationDistance = (postStepSepara << 152                            << G4BestUnit(__trackA.GetPosition(), "Length")
105                                                << 153                            << G4endl;
106         auto pMoleculeA = GetMolecule(__trackA << 154       exceptionDescription << "Previous position : "
107         auto pMoleculeB = GetMolecule(__trackB << 155                            << G4BestUnit(__preStepPositionA, "Length") << G4endl;
108                                                << 156       G4Exception("G4DNASmoluchowskiReactionModel::FindReaction",
109         G4double D = pMoleculeA->GetDiffusionC << 157                   "G4DNASmoluchowskiReactionModel", FatalErrorInArgument,
110                      + pMoleculeB->GetDiffusio << 158                   exceptionDescription);
111                                                << 
112         const auto& preStepPositionA = __track << 
113         const auto& preStepPositionB = __track << 
114                                                << 
115         G4double preStepSeparation = (preStepP << 
116                                                << 
117         //===================================  << 
118         // Brownian bridge                     << 
119         G4double __probabiltyOfEncounter = G4E << 
120                                                << 
121                                                << 
122                                             ); << 
123         G4double __selectedPOE = G4UniformRand << 
124                                                << 
125         if (__selectedPOE <= __probabiltyOfEnc << 
126         {                                      << 
127             return true;                       << 
128         }                                      << 
129         //===================================  << 
130     }                                             159     }
131                                                   160 
132     return false;                              << 161     G4double __preStepSeparation =
                                                   >> 162         (__preStepPositionA - __preStepPositionB).mag();
                                                   >> 163 
                                                   >> 164     //===================================
                                                   >> 165     // Brownian bridge
                                                   >> 166 
                                                   >> 167 
                                                   >> 168 //    if(G4Scheduler::Instance()->GetTimeStep() != __trackB.GetStep()->GetDeltaTime())
                                                   >> 169 //    {
                                                   >> 170 //      G4cout << G4Scheduler::Instance()->GetTimeStep() << G4endl;
                                                   >> 171 //      G4cout << __trackB.GetStep()->GetDeltaTime() << G4endl;
                                                   >> 172 //      assert(G4Scheduler::Instance()->GetTimeStep() == __trackB.GetStep()->GetDeltaTime());
                                                   >> 173 //    }
                                                   >> 174 
                                                   >> 175     G4double __probabiltyOfEncounter = G4Exp(
                                                   >> 176         -(__preStepSeparation - __R) * (postStepSeparation - __R) / (__D
                                                   >> 177             * (__trackB.GetStep()->GetDeltaTime())));
                                                   >> 178     G4double __selectedPOE = G4UniformRand();
                                                   >> 179 
                                                   >> 180     if (__selectedPOE <= __probabiltyOfEncounter) return true;
                                                   >> 181     //===================================
                                                   >> 182   }
                                                   >> 183 
                                                   >> 184   return false;
133 }                                                 185 }
134                                                   186