65 G4ThreadLocal std::ofstream* G4DNAChemistryManager::fpgOutput_tl = 0;
90 fpExcitationLevel = 0;
91 fpIonisationLevel = 0;
93 fpUserChemistryList = 0;
94 fMasterInitialized =
false;
101 fpSkipReactionsFromChemList =
105 fBuildPhysicsTable =
false;
106 fGeometryClosed =
false;
107 fPhysicsTableBuilt =
false;
108 fForceThreadReinitialization =
false;
109 fFileInitialized =
false;
111 fActiveChemistry =
false;
112 fSkipReactions =
false;
113 fResetCounterWhenRunEnds =
true;
151 if (fpIonisationLevel)
153 delete fpIonisationLevel;
154 fpIonisationLevel = 0;
157 if (fpExcitationLevel)
159 delete fpExcitationLevel;
160 fpExcitationLevel = 0;
162 if (fpUserChemistryList)
166 delete fpUserChemistryList;
175 fpUserChemistryList = 0;
177 if (fpChemDNADirectory)
179 delete fpChemDNADirectory;
180 fpChemDNADirectory = 0;
184 delete fpActivateChem;
192 if(fpSkipReactionsFromChemList)
194 delete fpSkipReactionsFromChemList;
195 fpSkipReactionsFromChemList = 0;
224 G4cout <<
"G4DNAChemistryManager already deleted" <<
G4endl;
234 G4cout <<
"G4DNAChemistryManager::Notify ---> received G4State_Quit"
242 fGeometryClosed =
true;
255 if (command == fpActivateChem)
259 else if (command == fpRunChem)
268 else if (command == fpSkipReactionsFromChemList)
270 fSkipReactions =
true;
272 else if(command == fpScaleForNewTemperature)
276 else if(command == fpInitChem)
285 if (command == fpActivateChem)
295 if (fActiveChemistry)
299 if (fMasterInitialized ==
false)
302 description <<
"Global components were not initialized.";
307 if (fpgThreadInitialized_tl == 0)
310 description <<
"Thread local components were not initialized.";
317 if(fResetCounterWhenRunEnds)
327 fBuildPhysicsTable = physicsTableToBuild;
369 if (fMasterInitialized ==
false)
373 G4cout <<
"G4DNAChemistryManager::InitializeMaster() is called" <<
G4endl;
380 if (fpUserChemistryList)
383 if(fSkipReactions ==
false)
392 fMasterInitialized =
true;
396 if (fActiveChemistry)
399 description <<
"No user chemistry list has been provided.";
400 G4Exception(
"G4DNAChemistryManager::InitializeMaster",
"NO_CHEM_LIST",
409 if (fpgThreadInitialized_tl == 0 || fForceThreadReinitialization ==
true)
411 if (fpUserChemistryList)
415 G4cout <<
"G4DNAChemistryManager::InitializeThread() is called"
419 if (fBuildPhysicsTable && fPhysicsTableBuilt ==
false)
423 G4cout <<
"G4DNAChemistryManager: Build the physics tables for "
429 if (fGeometryClosed ==
false)
433 G4cout <<
"G4DNAChemistryManager: Close geometry"
441 fGeometryClosed =
true;
444 fPhysicsTableBuilt =
true;
450 fpgThreadInitialized_tl =
new G4bool(
true);
455 description <<
"No user chemistry list has been provided.";
456 G4Exception(
"G4DNAChemistryManager::InitializeThread",
"NO_CHEM_LIST",
468 if (fpgOutput_tl == 0 || fWriteFile ==
false || fFileInitialized)
475 G4cout <<
"G4DNAChemistryManager::InitializeFile() is called"
479 *fpgOutput_tl << std::setprecision(6) << std::scientific;
480 *fpgOutput_tl << setw(11) <<
left <<
"#Parent ID" << setw(10) <<
"Molecule"
481 << setw(14) <<
"Elec Modif" << setw(13) <<
"Energy (eV)"
482 << setw(22) <<
"X pos of parent [nm]" << setw(22)
483 <<
"Y pos of parent [nm]" << setw(22) <<
"Z pos of parent [nm]"
484 << setw(14) <<
"X pos [nm]" << setw(14) <<
"Y pos [nm]"
485 << setw(14) <<
"Z pos [nm]" <<
G4endl<< setw(21) <<
"#"
486 << setw(13) <<
"1)io/ex=0/1"
489 << setw(13) <<
"2)level=0...5"
492 fFileInitialized =
true;
497 return Instance()->fActiveChemistry;
502 Instance()->fActiveChemistry = flag;
507 return fActiveChemistry;
512 fActiveChemistry = flag;
516 ios_base::openmode mode)
520 G4cout <<
"G4DNAChemistryManager: Write chemical stage into "
524 fpgOutput_tl =
new std::ofstream();
525 fpgOutput_tl->open(output.
data(), mode);
527 fFileInitialized =
false;
540 if (fpgOutput_tl == 0)
return;
542 if (fpgOutput_tl->is_open())
546 G4cout <<
"G4DNAChemistryManager: Close File" <<
G4endl;
548 fpgOutput_tl->close();
555 if (!fpExcitationLevel)
559 return fpExcitationLevel;
565 if (!fpIonisationLevel)
569 return fpIonisationLevel;
573 G4int electronicLevel,
574 const G4Track* theIncomingTrack)
582 switch (modification)
595 *fpgOutput_tl << setw(11) <<
left << theIncomingTrack->
GetTrackID()
596 << setw(10) <<
"H2O" <<
left << modification <<
internal
597 <<
":" <<
right << electronicLevel <<
left << setw(11) <<
""
598 << std::setprecision(2) << std::fixed << setw(13)
599 << energy /
eV << std::setprecision(6) << std::scientific
613 switch (modification)
616 H2O -> AddElectron(5,1);
619 H2O -> ExciteMolecule(4-electronicLevel);
622 H2O -> IonizeMolecule(4-electronicLevel);
629 H2OTrack -> SetParentID(theIncomingTrack->
GetTrackID());
631 H2OTrack -> SetKineticEnergy(0.);
646 *fpgOutput_tl << setw(11) << theIncomingTrack->
GetTrackID() << setw(10)
647 <<
"e_aq" << setw(14) << -1 << std::setprecision(2)
648 << std::fixed << setw(13)
650 << std::setprecision(6) << std::scientific << setw(22)
657 if (finalPosition != 0)
659 *fpgOutput_tl << setw(14) << (finalPosition->
x()) /
nanometer << setw(14)
660 << (finalPosition->
y()) /
nanometer << setw(14)
679 e_aqTrack -> SetTrackStatus(
fAlive);
680 e_aqTrack -> SetParentID(theIncomingTrack->
GetTrackID());
694 *fpgOutput_tl << setw(11) << parentID << setw(10) << molecule->
GetName()
695 << setw(14) << -1 << std::setprecision(2) << std::fixed
696 << setw(13) << -1 << std::setprecision(6) << std::scientific
697 << setw(22) << (position.
x()) /
nanometer << setw(22)
706 track -> SetTrackStatus(
fAlive);
707 track -> SetParentID(parentID);
718 const G4Track* theIncomingTrack)
724 *fpgOutput_tl << setw(11) << theIncomingTrack->
GetTrackID() << setw(10)
725 << molecule->
GetName() << setw(14) << -1
726 << std::setprecision(2) << std::fixed << setw(13)
728 << std::setprecision(6) << std::scientific << setw(22)
741 track -> SetTrackStatus(
fAlive);
742 track -> SetParentID(theIncomingTrack->
GetTrackID());
void WriteInto(const G4String &, std::ios_base::openmode mode=std::ios_base::out)
static G4VITTrackHolder * Instance()
void PushMoleculeAtParentTimeAndPlace(G4Molecule *&molecule, const G4Track *)
static void DeleteInstance()
virtual void ConstructReactionTable(G4DNAMolecularReactionTable *reactionTable)=0
static G4Electron_aq * Definition()
G4double ExcitationEnergy(G4int level)
static G4H2O * Definition()
static G4DNAMolecularReactionTable * Instance()
std::ostringstream G4ExceptionDescription
void CreateSolvatedElectron(const G4Track *, G4ThreeVector *finalPosition=0)
void ScaleReactionRateForNewTemperature(double temp_K)
const G4ThreeVector & GetPosition() const
virtual void Push(G4Track *)
void SetChemistryActivation(G4bool)
static G4String ConvertToString(G4bool boolVal)
static constexpr double nanometer
void AddEmptyLineInOuputFile()
void Finalize(G4MoleculeDefinition *)
G4bool IsChemistryActivated()
static G4Scheduler * Instance()
static G4bool GetNewBoolValue(const char *paramString)
static constexpr double picosecond
static G4double ConvertToDimensionedDouble(const char *st)
static G4DNAMolecularReactionTable * GetReactionTable()
G4DNAWaterExcitationStructure * GetExcitationLevel()
const G4String & GetName() const
bool IsPhysicsConstructor()
static void InitializeInstance()
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
virtual G4bool Notify(G4ApplicationState requestedState)
const XML_Char int const XML_Char * value
virtual void SetNewValue(G4UIcommand *, G4String)
void PushMolecule(G4Molecule *&molecule, double time, const G4ThreeVector &position, int parentID)
virtual void ConstructDissociationChannels()
static G4MoleculeTable * Instance()
static void DeleteManager()
static constexpr double eV
void SetGlobalTemperature(double temp_K)
static void DeleteInstance()
virtual ~G4DNAChemistryManager()
static void SetGlobalTemperature(G4double)
static G4bool IsActivated()
G4double GetGlobalTime() const
static G4GeometryManager * GetInstance()
G4bool IsMultithreadedApplication()
static G4VMoleculeCounter * Instance()
virtual G4String GetCurrentValue(G4UIcommand *command)
G4double IonisationEnergy(G4int level)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
const char * data() const
static G4DNAChemistryManager * Instance()
G4double energy(const ThreeVector &p, const G4double m)
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
virtual void ResetCounter()=0
static void DeleteInstance()
static void Activated(G4bool flag=true)
void OpenGeometry(G4VPhysicalVolume *vol=0)
void Gun(G4ITGun *, bool physicsTableToBuild=true)
void PrepareMolecularConfiguration()
virtual void ConstructTimeStepModel(G4DNAMolecularReactionTable *reactionTable)=0
static G4DNAChemistryManager * GetInstanceIfExists()
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
G4DNAWaterIonisationStructure * GetIonisationLevel()