234 {
235 std::vector<G4String> reactant;
236 std::vector<G4String> product;
237 G4double reactionRate = -1;
238
239 G4bool reservoir = false;
240
241 if (type == "VI") {
242 reservoir = true;
243 }
244
245 ReadReaction(reactionString, reactant, product, reactionRate);
246
247 if (!reactant.empty() && (reactionRate <= 0)) {
248 G4ExceptionDescription exception;
249 exception << "Null or negative reaction rate: "
250 << "reaction will not be registered!";
251 G4Exception("ParserChemReaction::AddReaction", "parchem04",
252 JustWarning, exception);
253 return;
254 }
255
256 G4double concentration;
257
258 if (reservoir && (reactant.size() >= 2)) {
262
264
265 if (concentration != -1) {
266 reactionRate *= concentration;
267 reactant[0].append("(B)");
269 reactionRate, type);
270 }
274
276
277 if (concentration != -1) {
278 reactionRate *= concentration;
279 reactant[1].append("(B)");
281 reactionRate, type);
282 }
283 } else if (reactant[1] == "NoneM") {
284
286 } else {
287 G4ExceptionDescription exception;
288 exception << "Missing or unsuitable square brackets:\n"
289 << "reaction will not be registered.\n"
290 << "Verify the writing of chemical reactions!";
291 G4Exception("ParserChemReaction::AddReaction", "parchem05",
292 JustWarning, exception);
293 }
294 } else if (reactant.size() >= 2) {
297 && (reactant[1] != "NoneM")) {
299 } else if (reactant[1] == "NoneM") {
300 G4ExceptionDescription exception;
301 exception << "Unsuitable reaction type: "
302 << "reaction will not be registered.\n"
303 << "For first-order reaction, use reaction type 6.";
304 G4Exception("ParserChemReaction::AddReaction", "parchem06",
305 JustWarning, exception);
306 } else {
307 G4ExceptionDescription exception;
308 exception << "Unsuitable square brackets: "
309 << "reaction will not be registered.\n"
310 << "Verify the writing of chemical reactions!";
311 G4Exception("ParserChemReaction::AddReaction", "parchem07",
312 JustWarning, exception);
313 }
314 }
315}
static void ReadReaction(const G4String &reactionString, std::vector< G4String > &reactant, std::vector< G4String > &product, G4double &reactionRate)
G4double GetScavengerConcentration(const G4String &name)
static void ReplaceString(G4String &aString, const G4String &from, const G4String &to)
void ImplementReaction(const G4String &reactant1, const G4String &reactant2, const std::vector< G4String > &product, const G4double &reactionRate, const G4String &type)