78{
80 InitializeForNewTrack();
83
84#ifdef G4VERBOSE
85 if(fVerbose != 0)
86 {
87 G4cout <<
"________________________________________________________________"
88 "_______"
90 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep" <<
G4endl;
91 G4cout <<
"Check done for molecule : " << pMoleculeA->GetName() <<
" ("
93 }
94#endif
95
96 auto pMolConfA = pMoleculeA->GetMolecularConfiguration();
97
98 const auto pReactantList = fMolecularReactionTable->
CanReactWith(pMolConfA);
99
100 if(pReactantList == nullptr)
101 {
102#ifdef G4VERBOSE
103 if(fVerbose > 1)
104 {
107 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will "
108 "return infinity "
109 "for the reaction because the molecule "
110 << pMoleculeA->GetName()
111 << " does not have any reactants given in the reaction table."
114 }
115#endif
117 }
118
119 auto nbReactives = (
G4int)pReactantList->size();
120
121 if(nbReactives == 0)
122 {
123#ifdef G4VERBOSE
124
125 if(fVerbose != 0)
126 {
129 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will "
130 "return infinity "
131 "for the reaction because the molecule "
132 << pMoleculeA->GetName()
133 << " does not have any reactants given in the reaction table."
134 << "This message can also result from a wrong implementation of "
135 "the reaction table."
138 }
139#endif
141 }
142 fReactants = std::make_shared<vector<G4Track*>>();
143 fReactionModel->
Initialise(pMolConfA, trackA);
144 for(
G4int i = 0; i < nbReactives; ++i)
145 {
146 auto pMoleculeB = (*pReactantList)[i];
147 G4int key = pMoleculeB->GetMoleculeID();
148
149
151
152
154 std::vector<std::pair<G4TrackList::iterator, G4double>> resultIndices;
155 resultIndices.clear();
157 trackA, key, fRCutOff, resultIndices);
158
159 if(resultIndices.empty())
160 {
161 continue;
162 }
163 for(auto& it : resultIndices)
164 {
165 G4Track* pTrackB = *(std::get<0>(it));
166
167 if(pTrackB == &trackA)
168 {
169 continue;
170 }
171 if(pTrackB == nullptr)
172 {
174 exceptionDescription << "No trackB no valid";
176 "::CalculateStep()",
178 exceptionDescription);
179 }else
180 {
181 if(fCheckedTracks.find(pTrackB->
GetTrackID()) != fCheckedTracks.end())
182 {
183 continue;
184 }
185
186 Utils utils(trackA, *pTrackB);
187
189 auto pMolConfB = pMolB->GetMolecularConfiguration();
191 if(distance * distance < Reff * Reff)
192 {
193 auto reactionData =
196 {
198 {
199 if(!fHasAlreadyReachedNullTime)
200 {
202 fHasAlreadyReachedNullTime = true;
203 }
205 CheckAndRecordResults(utils);
206 }
207 }
208 }
209 else
210 {
211 G4double tempMinET = GetTimeToEncounter(trackA, *pTrackB);
213 {
214 continue;
215 }
217 {
218 continue;
219 }
222 CheckAndRecordResults(utils);
223 }
224 }
225 }
226 }
227
228#ifdef G4VERBOSE
229 if(fVerbose != 0)
230 {
231 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will finally "
232 "return :"
234
235 if(fVerbose > 1)
236 {
237 G4cout <<
"Selected reactants for trackA: " << pMoleculeA->GetName()
239
240 vector<G4Track*>::iterator it;
242 {
245 << ") \t ";
246 }
248 }
249 }
250#endif
252}
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 override
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()
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