79{
81 InitializeForNewTrack();
84
85#ifdef G4VERBOSE
86 if(fVerbose != 0)
87 {
88 G4cout <<
"________________________________________________________________"
89 "_______"
91 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep" <<
G4endl;
92 G4cout <<
"Check done for molecule : " << pMoleculeA->GetName() <<
" ("
94 }
95#endif
96
97 auto pMolConfA = pMoleculeA->GetMolecularConfiguration();
98
99 const auto pReactantList = fMolecularReactionTable->
CanReactWith(pMolConfA);
100
101 if(pReactantList == nullptr)
102 {
103#ifdef G4VERBOSE
104 if(fVerbose > 1)
105 {
108 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will "
109 "return infinity "
110 "for the reaction because the molecule "
111 << pMoleculeA->GetName()
112 << " does not have any reactants given in the reaction table."
115 }
116#endif
118 }
119
120 G4int nbReactives = (
G4int)pReactantList->size();
121
122 if(nbReactives == 0)
123 {
124#ifdef G4VERBOSE
125
126 if(fVerbose != 0)
127 {
130 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will "
131 "return infinity "
132 "for the reaction because the molecule "
133 << pMoleculeA->GetName()
134 << " does not have any reactants given in the reaction table."
135 << "This message can also result from a wrong implementation of "
136 "the reaction table."
139 }
140#endif
142 }
143 fReactants = std::make_shared<vector<G4Track*>>();
144 fReactionModel->
Initialise(pMolConfA, trackA);
145 for(
G4int i = 0; i < nbReactives; ++i)
146 {
147 auto pMoleculeB = (*pReactantList)[i];
148 G4int key = pMoleculeB->GetMoleculeID();
149
150
152
153
155 std::vector<std::pair<G4TrackList::iterator, G4double>> resultIndices;
156 resultIndices.clear();
158 trackA, key, fRCutOff, resultIndices);
159
160 if(resultIndices.empty())
161 {
162 continue;
163 }
164 for(auto& it : resultIndices)
165 {
166 G4Track* pTrackB = *(std::get<0>(it));
167
168 if(pTrackB == &trackA)
169 {
170 continue;
171 }
172 if(pTrackB == nullptr)
173 {
175 exceptionDescription << "No trackB no valid";
177 "::CalculateStep()",
179 exceptionDescription);
180 }else
181 {
182 if(fCheckedTracks.find(pTrackB->
GetTrackID()) != fCheckedTracks.end())
183 {
184 continue;
185 }
186
187 Utils utils(trackA, *pTrackB);
188
190 auto pMolConfB = pMolB->GetMolecularConfiguration();
192 if(distance * distance < Reff * Reff)
193 {
194 auto reactionData =
197 {
199 {
200 if(!fHasAlreadyReachedNullTime)
201 {
203 fHasAlreadyReachedNullTime = true;
204 }
206 CheckAndRecordResults(utils);
207 }
208 }
209 }
210 else
211 {
212 G4double tempMinET = GetTimeToEncounter(trackA, *pTrackB);
214 {
215 continue;
216 }
218 {
219 continue;
220 }
223 CheckAndRecordResults(utils);
224 }
225 }
226 }
227 }
228
229#ifdef G4VERBOSE
230 if(fVerbose != 0)
231 {
232 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will finally "
233 "return :"
235
236 if(fVerbose > 1)
237 {
238 G4cout <<
"Selected reactants for trackA: " << pMoleculeA->GetName()
240
241 vector<G4Track*>::iterator it;
243 {
246 << ") \t ";
247 }
249 }
250 }
251#endif
253}
G4Molecule * GetMolecule(const G4Track &track)
G4GLOB_DLL std::ostream G4cout
Data * GetReactionData(Reactant *, Reactant *) const
const ReactantList * CanReactWith(Reactant *) const
static G4double GetRCutOff()
const G4String & GetName() const
static G4OctreeFinder * Instance()
void FindNearestInRange(const G4Track &track, const int &key, G4double R, std::vector< std::pair< typename CONTAINER::iterator, G4double > > &result, G4bool isSort=false) const
static G4Scheduler * Instance()
G4double GetGlobalTime() const
G4double GetStartTime() const
const G4ThreeVector & GetPosition() const
virtual void Initialise(const G4MolecularConfiguration *, const G4Track &)
virtual G4double GetReactionRadius(const G4MolecularConfiguration *, const G4MolecularConfiguration *)=0
static G4ThreadLocal G4double fUserMinTimeStep
G4double fSampledMinTimeStep