# and destruction of the selected species fout.write("* ;\n* " + spec + " production\n* ;\n") for el in roplist: fout.write(el) fout.write("* ;\n* " + spec + " destruction\n* ;\n") for el in rodlist: fout.write(el) # add parameters of production and destruction to list of parameters paramlist = paramlist + paramplist + paramdlist defparamlist = defparamlist + defparamplist + defparamdlist # write list of new parameters and the definitions of the new parameters # to the output file with headers fout.write("""* ; * *************************************************** * ; * ; PARAMETER\n""") facsimile_funcs.listblock(paramlist,fout) fout.write("""\n* ; * *************************************************** * ; * ; DEFINITION OF THE PARAMETERS\n""") for item in defparamlist: fout.write(item) # close files and end program fin.close() fout.close() print "\n--- output written to", filename, "---"
# add reactants to list of species if not there for spec in eq[1]: if spec not in speclist and spec != "": speclist.append(spec) # add products to list of species if not there for spec in eq[2]: if spec not in speclist and spec != "": speclist.append(spec) # calculates number of species and reactions nspec = str(len(speclist)) nreac = str(len(mechanism)) # write the number of species and reactions to the output file # write the list of species to the output file fout.write("---------------------------\n") fout.write("n. species: " + nspec + "\n") fout.write("n. reactions: " + nreac + "\n") fout.write("---------------------------\n") facsimile_funcs.listblock(speclist,fout) # close files and end program # output to console the number of species and reactions fin.close() fout.close() print "\nn. species:", nspec print "n. reactions:", nreac print "\n--- output written to", filename, "---"