48{
50 {
52 }
54 {
55 std::istringstream iss(newValue);
56
58 iss >> speciesName;
59
61 iss >> marker;
62
63 if(marker != "[")
64 {
66 description <<
" marker : " << marker <<
G4endl;
67 G4Exception(
"G4MoleculeTableMessenger::SetNewValue",
69 }
70
72 iss >> speciesDefName;
73
74 iss >> marker;
75
77 if(marker == "|")
78 {
79 iss >> charge;
80 }
81 iss >> marker;
83 if(marker == "|")
84 {
85 iss >> diffusion_coefficient;
86 }
87 iss >> marker;
89 if(marker == "|")
90 {
91 iss >> VanDerVaalsRadius;
92 }
93
94 auto pConf =
96 if(pConf != nullptr)
97 {
98 pConf->UnFinalize();
99 if(VanDerVaalsRadius != 0)
100 {
101 pConf->SetVanDerVaalsRadius(VanDerVaalsRadius * nm);
102 }
103 if(diffusion_coefficient != 0)
104 {
105 pConf->SetDiffusionCoefficient(diffusion_coefficient * (m2 / s));
106 }
107 }
108 else
109 {
112 if(particleDef != nullptr)
113 {
114 auto molConf =
116 particleDef, charge);
117 if(molConf == nullptr)
118 {
120 description <<
"This molecule has not been defined" <<
G4endl;
121 G4Exception(
"G4MoleculeTableMessenger::SetNewValue",
123 }
124 molConf->UnFinalize();
125 if(VanDerVaalsRadius != 0)
126 {
127 molConf->SetVanDerVaalsRadius(VanDerVaalsRadius * nm);
128 }
129 if(diffusion_coefficient != 0)
130 {
131 molConf->SetDiffusionCoefficient(diffusion_coefficient * (m2 / s));
132 }
133
134 auto usedName = molConf->GetUserID();
135 if(usedName != "")
136 {
137 molConf->PrintState();
139 description << "This molecule has been defined by the name : "
140 << usedName <<
" . Please, use this name." <<
G4endl;
141 G4Exception(
"G4MoleculeTableMessenger::SetNewValue",
143 }
144 else
145 {
146 molConf->SetUserID(speciesName);
147 }
148 }
149 else
150 {
151 auto speciesDef =
153 diffusion_coefficient * (m * m / s),
154 charge, 1,
155 0,
156 VanDerVaalsRadius * nm);
157 G4bool alreadyCreated(
false);
159 speciesName, speciesDef, alreadyCreated);
160 }
161 }
162 }
163}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
static G4MolecularConfiguration * GetOrCreateMolecularConfiguration(const G4MoleculeDefinition *)
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *, const G4String &label)
static G4MolecularConfiguration * CreateMolecularConfiguration(const G4String &userIdentifier, const G4MoleculeDefinition *, bool &wasAlreadyCreated)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()