This should be a fairly small update that will have major improvements. Probably of interest to @Marcus-Keil and Johannes if they're running UCLCHEM a lot.
We should use Makerates to massively optimize rates.f90. We can sort the reaction list by type and then store the indices of each reaction type. Then the rates can be calculated together by index rather than using the massive loop and case statement in rates.f90.
Eg make a list of two body gas reactions called gasTwoBodyReacs then calculate all gas rates together:
rates(gasTwoBodyReacs)=alpha(gasTwoBodyReacs)*((temp/300)*beta(gasTwoBodyReacs))exp(-gamma(gasTwoBodyReacs)/temp)
That would be a massive speed up because array operations are much better optimized than loops. We'd have one list (or just start/end indices for sorted reactions) per reaction type and can calculate all of the reactions for a given type as one array operation.
It's worth branching the code, doing this and then testing the run time over 10 runs or so. I think we'd see a huge improvement.
This should be a fairly small update that will have major improvements. Probably of interest to @Marcus-Keil and Johannes if they're running UCLCHEM a lot.
We should use Makerates to massively optimize rates.f90. We can sort the reaction list by type and then store the indices of each reaction type. Then the rates can be calculated together by index rather than using the massive loop and case statement in rates.f90.
Eg make a list of two body gas reactions called gasTwoBodyReacs then calculate all gas rates together: rates(gasTwoBodyReacs)=alpha(gasTwoBodyReacs)*((temp/300)*beta(gasTwoBodyReacs))exp(-gamma(gasTwoBodyReacs)/temp)
That would be a massive speed up because array operations are much better optimized than loops. We'd have one list (or just start/end indices for sorted reactions) per reaction type and can calculate all of the reactions for a given type as one array operation.
It's worth branching the code, doing this and then testing the run time over 10 runs or so. I think we'd see a huge improvement.