Closed quinnreynolds closed 4 years ago
Another option is to use None, but that won't play nicely with arithmetic and logic so it would need some additional code to handle it explicitly as a special case. Not as pretty.
If you want the invalid values to infect all downstream calculations, why not just use numpy.nan
?
It's mainly because of the if eij < (self.ionisationenergy - dE)
conditional in the partition function and internal energy calculations for MonatomicSpecies. If ionisationenergy is numpy.inf
that check will pass, but if it's numpy.nan
it will fail all energy levels and the function will (incorrectly) return zero.
We could catch that with explicit code I suppose, but then we'd be be back to the same issue as with None
.
Addressed as of d497f2c4ad9637ed8d4771c25fd988dd29abf109. Closing.
At preset there is no standardised way to specify the ionisation or dissociation energy of a species in cases where they are either physically impossible (e.g. ionisation of H+) or otherwise unavailable for some reason (e.g. they are the highest ionisation state for which reliable data is available).
A standard is required because using arbitrary "false" values such as zero or negative numbers could interfere with the partition function calculation routines. Using numpy.inf in such cases would be a simple solution - calculations will proceed as expected, and it clearly indicates to users that it's a placeholder value.