44 , fpScavengerMaterial(nullptr)
64 G4double V = LengthY * LengthX * LengthZ;
77 auto it = node.find(moleType);
82 G4double d = it->first->GetDiffusionCoefficient() / std::pow(LengthY, 2);
83 alpha = d * it->second;
86 G4cout << it->first->GetName() <<
" " << it->second
87 <<
" D : " << it->first->GetDiffusionCoefficient()
88 <<
" LengthY : " << LengthY <<
" PropensityFunction : " <<
alpha
110 if(typeANumber == 0 || typeBNumber == 0)
119 value = typeANumber * (typeBNumber - 1) * k;
123 value = typeANumber * typeBNumber * k;
128 G4cout <<
"G4DNAGillespieDirectMethod::PropensityFunction for : "
129 << ConfA->GetName() <<
"(" << typeANumber <<
") + "
130 << ConfB->GetName() <<
"(" << typeBNumber
131 <<
") : propensity : " << value
132 <<
" GetObservedReactionRateConstant : "
134 <<
" GetEffectiveReactionRadius : "
137 <<
" Index : " << index <<
G4endl;
143 G4cout <<
"G4DNAGillespieDirectMethod::PropensityFunction for : "
144 << ConfA->GetName() <<
"(" << typeANumber <<
") + "
145 << ConfB->GetName() <<
"(" << typeBNumber
146 <<
") : propensity : " << value
147 <<
" Time to Reaction : " <<
G4BestUnit(timeToReaction,
"Time")
148 <<
" k : " << k <<
" Index : " << index <<
G4endl;
162 for(; begin != end; begin++)
164 auto key = begin->first;
183 G4double alphaTotal = dAlpha0 + rAlpha0;
189 auto timeStep = ((1.0 / (alphaTotal)) * std::log(1.0 / r1)) +
fTimeStep;
192 G4cout <<
"r2 : " << r2 <<
" rAlpha0 : " << rAlpha0
193 <<
" dAlpha0 : " << dAlpha0 <<
" rAlpha0 / (dAlpha0 + rAlpha0) : "
194 << rAlpha0 / (dAlpha0 + rAlpha0) <<
G4endl;
196 if(r2 < rAlpha0 / alphaTotal)
200 G4cout <<
"=>>>>reaction at : " << timeStep <<
" timeStep : "
201 <<
G4BestUnit(((1.0 / alphaTotal) * std::log(1.0 / r1)),
"Time")
211 G4cout <<
"=>>>>jumping at : " << timeStep <<
" timeStep : "
212 <<
G4BestUnit(((1.0 / alphaTotal) * std::log(1.0 / r1)),
"Time")
216 auto dSelectedIter =
fJumpingDataMap.upper_bound(r2 * alphaTotal - rAlpha0);
218 std::make_unique<std::pair<MolType, Index>>(dSelectedIter->second);
236 for(
const auto& it : dataList)
243 alpha0 += propensity;
257 if(NeighboringVoxels.empty())
264 const auto conf = iter.
value();
270 for(
const auto& it_Neighbor : NeighboringVoxels)
272 alpha0 += propensity;
275 G4cout <<
"mole : " << conf->GetName()
277 <<
" propensity : " << propensity <<
" alpha0 : " << alpha0
283 G4cout <<
"DiffusiveJumping :alpha0 : " << alpha0 <<
G4endl;
294 const auto& it = node.find(type);
295 return (it != node.end()) ? (it->second) : 0;
307 numberOfScavenger = 0;
315 auto factor =
Avogadro * volumeOfNode;
316 numberOfScavenger = factor;
331 auto numberInInterg = (int) (std::floor(numberInDouble));
333 G4double change = numberInDouble - numberInInterg;
336 numberOfScavenger = numberInInterg;
340 numberOfScavenger = numberInInterg + 1;
static const G4double alpha
G4GLOB_DLL std::ostream G4cout
void CreateEvent(G4double time, Key index, Event::ReactionData *pReactionData)
~G4DNAGillespieDirectMethod()
G4DNAEventSet * fpEventSet
std::map< G4double, ReactionData * > fReactionDataMap
G4bool FindScavenging(const Index &index, MolType, G4double &)
G4double VolumeOfNode(const Index &index)
G4double DiffusiveJumping(const Index &index)
void SetEventSet(G4DNAEventSet *)
G4double PropensityFunction(const Index &index, ReactionData *data)
G4double ComputeNumberInNode(const Index &index, MolType type)
G4DNAMolecularReactionTable * fMolecularReactions
void SetTimeStep(const G4double &stepTime)
void CreateEvent(unsigned int key)
G4double Reaction(const Index &index)
std::map< G4double, JumpingData > fJumpingDataMap
G4DNAGillespieDirectMethod()
G4DNAScavengerMaterial * fpScavengerMaterial
void PrintVoxel(const Index &index)
std::vector< Index > FindNeighboringVoxels(const Index &index) const
G4Voxel::MapList & GetVoxelMapList(Key key)
const G4DNABoundingBox & GetBoundingBox() const
VoxelMap::iterator begin()
Index GetIndex(Key key) const
Reactant * GetReactant1() const
G4double GetEffectiveReactionRadius() const
Reactant * GetReactant2() const
G4double GetObservedReactionRateConstant() const
DataList GetVectorOfReactionData()
G4double GetNumberMoleculePerVolumeUnitForMaterialConf(MolType) const
G4double GetDiffusionCoefficient() const
static G4MoleculeTable * Instance()
G4ConfigurationIterator GetConfigurationIterator()
static G4Scheduler * Instance()
G4VScavengerMaterial * GetScavengerMaterial() const