RMG-Java icon indicating copy to clipboard operation
RMG-Java copied to clipboard

NPE at jing.rxnSys.ReactionModelGenerator.writeRatesAndParameters

Open rwest opened this issue 14 years ago • 2 comments

In the log this happens immediately after (or during) the reporting of the results of a dassl simulation.

Exception in thread "main" java.lang.NullPointerException
    at jing.rxnSys.ReactionModelGenerator.writeRatesAndParameters(ReactionModelGenerator.java:2902)
    at jing.rxnSys.ReactionModelGenerator.writePDepNetworks(ReactionModelGenerator.java:2861)
    at jing.rxnSys.ReactionModelGenerator.modelGeneration(ReactionModelGenerator.java:1549)
    at RMG.main(RMG.java:57)

rwest avatar Jan 25 '11 15:01 rwest

The NPE corresponds to a PDepReaction's pDepRate variable.

If running a minimal RMG job with the following species in the input file, with WriteRestart turned on, the NPE is encountered:

C2HO6J(14687) (mol/cm3) 1 1 C 0 {4,S} {6,S} {5,S} {8,S} 2 C 0 {3,D} {4,S} {7,S} 3 O 0 {2,D} 4 O 0 {1,S} {2,S} 5 H 0 {1,S} 6 O 0 {1,S} {7,S} 7 O 0 {6,S} {2,S} 8 O 0 {9,S} {1,S} 9 O 1 {8,S}

Before RMG attempts to writeRatesAndParameters for each PDepReaction, it checks to ensure the PDepReaction is not null; some nonIncluded PDepReactions can in fact be null. What is happening in this NPE case is that both the forward and reverse PDepReaction exist, however the reverse PDepReaction has a null pDepRate. It is the pDepRate that RMG attempts to write to the Restart files, and thus throws the NPE when it finds a "null" instance.

MRH and JWA are not sure why this is occurring (a reversible PDepReaction not having a pDepRate for the reverse reaction). For the time being, MRH will add an additional restriction to the if statement controlling whether the writeRatesAndParameters function is called. However, I will not close the issue and will tag it with "3.4 or later" as the reason behind the NPE should be explored in the near future.

This commit is coming soon.

mrharper avatar Feb 16 '11 20:02 mrharper

Here is the commit relating to the discussion in the previous comment: https://github.com/GreenGroup/RMG-Java/commit/ad7beb611a24232ce4332f93d35b72d16a6bc529

MRH will now label it "3.4 or later" and move to the bottom of the priority list.

mrharper avatar Feb 16 '11 20:02 mrharper