maki Posted July 24, 2013 Share Posted July 24, 2013 Hi I have been trying to calculate microbial kinetics using custom rate law (script and script file). According to the support’s advice, I started to try it under simpler setting. I assumed that two kinds of aerobe utilized different electron donors. Kinetics settings were the same for paying attention to apply custom rate law of Aerobe-2. Custom rate law in script or script file was set based on the support’s advice as below. I also assumed that when ‘Acetate’ used by Aerobe-1 become below 0.0001, Aerobe-2 start the reaction. The bas file was converted to text file and attached. IF molality ("Acetate") < 0.0001 THEN 20 ELSE 40 20: rate = rate_con * biomass * FD * FA * TPF GOTO 60 40: rate = 0 60: RETURN rate In spite of various trials, the calculations stopped just before reaching 0.0001 in the concentration of 'Acetate' and never converged in all cases. How should I handle this problem concerning the custom rate law? In addition, when the React program with custom rate law in ‘script’ editor of the Reactants pane is closed, and opened again, equations of ‘script’ showed the irregular description and brought an error. Could you check the problem, too? Best regards, Maki Custom_rate_law_trial2.rea Acetate.txt Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted July 24, 2013 Share Posted July 24, 2013 Hi Maki, When I open your script none of the kinetic parameters (rate constant, initial biomass, etc.) for microbe-Aerobe-2 have been assigned a value. The program does not take values from microbe-Aerobe-1 by default, you need to set these. In section 5.2 of the GWB Reaction Modeling Guide, for example, the command "kinetic Quartz rate_law = My_scripts.bas rate_constant = 10^-16" is used to set the kinetic rate law, as well as the parameters which are used by the rate law. Also, I think part of the reason your rate law script doesn't work is because the values for FD, FA, and TPF are not defined. I think you need to write a script similar to the one that appears later in section 5.2 of the GWB Reaction Modeling Guide. I'm not sure what you mean by an irregular description in the Reactant pane. Can you clarify this? Thanks, Brian Farrell Aqueous Solutions LLC Quote Link to comment Share on other sites More sharing options...
maki Posted July 25, 2013 Author Share Posted July 25, 2013 Hi Brian, Thank you for your reply and letting me know the same phenomenon. You pointed out as below. > When I open your script none of the kinetic parameters (rate constant, initial biomass, etc.) for microbe-Aerobe-2 have been assigned a value. That phenomenon is just what I wanted to show you. This time, I attached four kinds of React file concerning custom rate law. 1. Crl01_ori.rea: The original file without using custom rate law. 2. Crl02_script.rea: The file set with script setting of custom rate law. 3. Crl03_command.rea: The file set with command of custom rate law. 4. Crl04_script_file.rea: The file set with script file of custom rate law. In addition above files, I attached the illustration of their explanation. I attached Crl02 I have already set the custom rate law using script editor. So, you can see the same phenomenon with previous post. When you try to carry out Crl02 again, please write the custom rate law script of the previous post in the Field variable script of script editor. When you try to carry out Crl04, please convert ‘.txt’, extension of my attached script file ‘Acetate.txt’, to ‘.bas’ for reading in React, and please select the bas file by yourself again, in the rate law setting on the Reactants pane. As you know, the directories in your computer and mine are different from each other. The results of my trial were as follows: Crl01 converged. Calculations of Crl02 and Crl03 didn’t start. Calculation of Crl04 file stopped just before the threshold set by custom rate law. I need your help about two problems I have. First: I would like to know how to make calculation of microbial kinetics with custom rate law converge. Even if I change parameters, values, and their possible combinations, the calculation stopped just before threshold set by custom rate law in all cases. For example, I tried to change species, threshold value, equation of rate in line 20, not 0 but 1e-20 in line 40, and so on. As you know, I have also tried other kinds of microbe. Second: If possible, I would like to practically use Crl02 or Crl03 because of needless to refer to an external file. I wonder that my inputs are incorrect in Crl02 and Crl03. Could you revise my inputs to improve Crl02 and Crl03? If my explanation is not enough yet, please let me know. Thank you for reading this long post and being patient with my English. Best regards, Maki Crl01_ori.rea Crl02_script.rea Crl03_command.rea Crl04_script_file.rea Acetate.txt Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted July 25, 2013 Share Posted July 25, 2013 Hi Maki, Thanks for the clarification. I see your problem with the field variable script editor and am trying to figure out whether it requires any special format. Regards, Brian Quote Link to comment Share on other sites More sharing options...
maki Posted July 26, 2013 Author Share Posted July 26, 2013 Hi Brian, Thank you for your consideration. It will be grateful if the two problems (convergence of calculation and the script editor) are fixed very soon. Best regards, Maki Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted July 29, 2013 Share Posted July 29, 2013 Hi Maki, I'm just working on the script editor for now. Regards, Brian Quote Link to comment Share on other sites More sharing options...
maki Posted August 7, 2013 Author Share Posted August 7, 2013 Hi Brian, Thank you for working on the problems. I would appreciate if you could let me know how things are coming along. Or, if you don’t mind, could you indicate a successful example including the microbial kinetics with custom rate law similar with my post? I would like to know whether it’s due to my input or not. Best regards, Maki Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted August 7, 2013 Share Posted August 7, 2013 Hi Maki, We've identified a problem with the script editor and with interpreting multi-line command line scripts. One of the programmers is working on fixing these. Script files work fine, so you test your custom rate laws using .bas files. As I mentioned earlier, I don't think Fd, FA, etc. mean anything in your script without being defined first. I'm sorry if the simple example I gave in a different thread confused you. It was only meant to describe the Eh threshold effect you were looking to model, not the complete rate law you would need. The example in Section 5.2 of the Reaction Modeling Guide contains variables like fd, fa, tpf (defined by the user) used to evaluate the custom rate law. FD, FA, and TPF are set to the current values of fd, fa, and tpf for plotting purposes. I think you should take a look at that example. Regards, Brian Quote Link to comment Share on other sites More sharing options...
maki Posted August 9, 2013 Author Share Posted August 9, 2013 Hi Brian, Thank you for your quick reply. According to your advice and the example in Section 5.2 of the Guide, I have carried out new trials like the attached file. Thanks to your kind explanation, the calculations came to be converged. However, unfortunately, biomass of Aerobe-2 doesn’t increase, yet. I’m a complete novice about the BASIC language. I have no idea whether my input is correct or not, and what is wrong concerning my custom rate law script. Could you check them? ------------- aff = QoverK * exp(-ATP_number * ATP_energy / (8.3143 * TK)) aff = aff^order1 IF (aff > 1.0) THEN aff=1.0 prod = 1.0 prodKd1 = KD prodKd2 = 1.0 prodKa1 = KA prodKa2 = 1.0 tpf = 1.0 - aff fd = prodKd2 / (prodKd1 + prodKd2)^PKD fa = prodKa2 / (prodKa1 + prodKa2)^PKA setgwbvar("TPF", tpf) setgwbvar("FD", fd) setgwbvar("FA", fa) setgwbvar("biomass", biom) biomass0 = 1.0 rate = rate_con * biomass * FD * FA * TPF IF (Deltat <= 0.0) THEN GOTO end_block rate0 = dndt0/(biomass0 * Wmass) rpave = (1.0-Theta)*rate0 + Theta*rprime biom = biomass0*exp((growth_yield*rpave-decay_con)*Deltat) IF biom < 0.0 THEN biom = 0.0 end_block: return rate * biomass * Wmass IF molality ("Acetate") < 0.0001 THEN 20 ELSE 40 20: rate = rate_con * biomass * FD * FA * TPF GOTO 60 40: rate = 0 60: RETURN rate ------------- Best regards, Maki Acetate_v3.txt Custom_rate_law_trial3.rea Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted August 13, 2013 Share Posted August 13, 2013 Hi Maki, I came up with something that appears to work. I copied the entire BASIC script for the microbial metabolism example. You can find this in the Gwb - src folder - ratelaw_example4.bas. Then, I replaced the line rprime = rate_con * (prod/denom) * tpf with IF molality("Acetate") < 0.0001 THEN rprime = rate_con * (prod/denom) * tpf IF molality("Acetate") > 0.0001 THEN rprime = 0* rate_con * (prod/denom) * tpf This looks like it's doing what you want it to (that is, the script inhibits the second microbe's metabolism until a threshold concentration is reached), but you should check to make sure. Hope this helps, Brian Quote Link to comment Share on other sites More sharing options...
maki Posted August 14, 2013 Author Share Posted August 14, 2013 Hi Brian, That is exactly what I looked for! Almost all the problems related with custom rate law have been solved and the task I have been working on will move forward. If the remaining problem (about the script editor of custom rate law) is fixed, could you let us know on this forum? Thank you for your kind support. Best regards, Maki Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.