Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 27 #include "ChemistryWorld.hh" 28 29 #include "G4DNABoundingBox.hh" 30 #include "G4DNAMolecularReactionTable.hh" 31 #include "G4MoleculeTable.hh" 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 ChemistryWorld::ChemistryWorld() : G4VChemistr 35 { 36 fpChemWoldDir = std::make_unique<G4UIdirecto 37 fpChemWoldDir->SetGuidance("chemistry enviro 38 39 fpAddpH = std::make_unique<G4UIcmdWithADoubl 40 fpAddpH->SetGuidance("Add pH for water."); 41 fpAddpH->SetParameterName("pH", false); 42 fpAddpH->SetToBeBroadcasted(false); 43 44 fpAddScavengerName = std::make_unique<G4UIcm 45 fpAddScavengerName->SetToBeBroadcasted(false 46 47 fpTargetVolume = std::make_unique<G4UIcmdWit 48 fpTargetVolume->SetGuidance("Volume of water 49 fpTargetVolume->SetParameterName("Volume", f 50 fpTargetVolume->AvailableForStates(G4State_P 51 fpTargetVolume->SetToBeBroadcasted(false); 52 } 53 //....oooOO0OOooo........oooOO0OOooo........oo 54 55 void ChemistryWorld::ConstructChemistryBoundar 56 { 57 fHalfBox = 1.6 * um; // halfBox 58 std::initializer_list<G4double> l{fHalfBox, 59 fpChemistryBoundary = std::make_unique<G4DNA 60 } 61 //....oooOO0OOooo........oooOO0OOooo........oo 62 63 void ChemistryWorld::SetNewValue(G4UIcommand* 64 { 65 if (command == fpAddpH.get()) { 66 fpH = fpAddpH->GetNewDoubleValue(newValue) 67 ConstructChemistryComponents(); 68 } 69 else if (command == fpAddScavengerName.get() 70 std::istringstream iss(newValue); 71 G4String species; 72 iss >> species; 73 auto scavengerConf = G4MoleculeTable::Inst 74 G4double concentraion; 75 iss >> concentraion; 76 G4String unit; 77 iss >> unit; 78 if (unit == "M") { 79 G4double ConcentrationInM = concentraion 80 fpChemicalComponent[scavengerConf] = Con 81 } 82 else if (unit == "mM") { 83 G4double ConcentrationInM = concentraion 84 fpChemicalComponent[scavengerConf] = Con 85 } 86 else if (unit == "uM") { 87 G4double ConcentrationInM = concentraion 88 fpChemicalComponent[scavengerConf] = Con 89 } 90 else if (unit == "%") // only for O2 91 { 92 G4double ConcentrationInM = (concentraio 93 fpChemicalComponent[scavengerConf] = Con 94 } 95 else { 96 throw std::runtime_error("Unit should be 97 } 98 } 99 else if (command == fpTargetVolume.get()) { 100 fHalfBox = G4UIcmdWithADoubleAndUnit::GetN 101 std::initializer_list<G4double> l{fHalfBox 102 -fHalfBo 103 fpChemistryBoundary = std::make_unique<G4D 104 } 105 } 106 //....oooOO0OOooo........oooOO0OOooo........oo 107 108 void ChemistryWorld::ConstructChemistryCompone 109 { 110 auto O2 = G4MoleculeTable::Instance()->GetCo 111 auto H2O = G4MoleculeTable::Instance()->GetC 112 auto H3Op = G4MoleculeTable::Instance()->Get 113 auto OHm = G4MoleculeTable::Instance()->GetC 114 115 //////////////////////////////////////////// 116 // Water is defined from NIST material datab 117 // water 55.3 M, 9.9x10-8 M, and 9.9x10-8 M 118 // water density = 18.01528 g/mol * 55.3 M 119 // H3OpB density = 1 g/mol * 9.9x10-8 M 120 // OHmB density = 17.01528 g/mol * 9.9x10-8 121 // O2B density = 15.999 g/mol * 2.58e-4 M 122 //////////////////////////////////////////// 123 G4double pKw = 14; // at 25°C pK of water 124 G4double waterMolarity = 55.3 / (mole * lite 125 fpChemicalComponent[H2O] = waterMolarity; 126 127 G4double H3OpBMolarity = std::pow(10, -fpH) 128 fpChemicalComponent[H3Op] = H3OpBMolarity; 129 130 G4double OHmBMolarity = std::pow(10, -(pKw - 131 fpChemicalComponent[OHm] = OHmBMolarity; 132 // oxygen 133 G4double O2Molarity = (0. / 100) * 0.0013 / 134 fpChemicalComponent[O2] = O2Molarity; 135 } 136 //....oooOO0OOooo........oooOO0OOooo........oo 137