123{
125 InitializeForNewTrack();
127
128#ifdef G4VERBOSE
129 if (fVerbose)
130 {
132 << "_______________________________________________________________________"
134 G4cout <<
"G4DNAMoleculeEncounterStepper::CalculateStep" <<
G4endl;
135 G4cout <<
"Check done for molecule : " << pMoleculeA->GetName()
138 }
139#endif
140
141
142
143 auto pMolConfA = pMoleculeA->GetMolecularConfiguration();
144
145 const auto pReactantList = fMolecularReactionTable->
CanReactWith(pMolConfA);
146
147 if (!pReactantList)
148 {
149#ifdef G4VERBOSE
150
151 if (fVerbose > 1)
152 {
155 G4cout <<
"G4MoleculeEncounterStepper::CalculateStep will return infinity "
156 "for the reaction because the molecule "
157 << pMoleculeA->GetName()
158 << " does not have any reactants given in the reaction table."
161 }
162#endif
164 }
165
166 G4int nbReactives = (
G4int)pReactantList->size();
167
168 if (nbReactives == 0)
169 {
170#ifdef G4VERBOSE
171
172 if (fVerbose)
173 {
174
177 G4cout <<
"G4MoleculeEncounterStepper::CalculateStep will return infinity "
178 "for the reaction because the molecule "
179 << pMoleculeA->GetName()
180 << " does not have any reactants given in the reaction table."
181 << "This message can also result from a wrong implementation of the reaction table."
184 }
185#endif
187 }
188
190 fReactionModel->
Initialise(pMolConfA, trackA);
191
192
193
194 for (
G4int i = 0; i < nbReactives; i++)
195 {
196 auto pMoleculeB = (*pReactantList)[i];
197
198
199
201
202
203
206 pMoleculeB->GetMoleculeID()));
207
208 if (resultsNearest == 0) continue;
209
210 G4double r2 = resultsNearest->GetDistanceSqr();
211 Utils utils(trackA, pMoleculeB);
212
213 if (r2 <= R * R)
214 {
215
216
217
218
219
220 if (fHasAlreadyReachedNullTime == false)
221 {
223 fHasAlreadyReachedNullTime = true;
224 }
225
229 pMoleculeB->GetMoleculeID(),
230 R));
231 CheckAndRecordResults(utils,
232#ifdef G4VERBOSE
233 R,
234#endif
235 resultsInRange);
236 }
237 else
238 {
240 G4double tempMinET = pow(r - R, 2) / utils.fConstant;
241
242
244 {
247 {
249 {
251 }
252
254
256
259 FindNearestInRange(pMoleculeA,
260 pMoleculeB->GetMoleculeID(),
261 range));
262
263 CheckAndRecordResults(utils,
264#ifdef G4VERBOSE
265 range,
266#endif
267 resultsInRange);
268 }
269 else
270 {
272
273 {
276 }
277
278 CheckAndRecordResults(utils,
279#ifdef G4VERBOSE
280 R,
281#endif
282 resultsNearest);
283 }
284 }
285 }
286 }
287
288#ifdef G4VERBOSE
289 if (fVerbose)
290 {
291 G4cout <<
"G4MoleculeEncounterStepper::CalculateStep will finally return :"
293
294 if (fVerbose > 1)
295 {
296 G4cout <<
"Selected reactants for trackA: " << pMoleculeA->GetName()
298
299 vector<G4Track*>::iterator it;
301 {
305 }
307 }
308 }
309#endif
311}
G4Molecule * GetMolecule(const G4Track &track)
G4GLOB_DLL std::ostream G4cout
const ReactantList * CanReactWith(Reactant *) const
static G4ITFinder * Instance()
const G4String & GetName() const
virtual void Initialise(const G4MolecularConfiguration *, const G4Track &)
virtual G4double GetReactionRadius(const G4MolecularConfiguration *, const G4MolecularConfiguration *)=0
G4TrackVectorHandle fReactants
static G4ThreadLocal G4double fUserMinTimeStep
G4double fSampledMinTimeStep