Fix the handling of association records in combination with induced association in PC-SAFT #264
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to @bbbursik for discovering the bug
The problem
in the existing code
#[serde(flatten)]
would invalidate the entire association record ifkappa_ab
andepsilon_k_ab
were not both given. This is a problem for an induced association mixture, where one component hasnb!=0
but no association parameters, because those are only adjusted to pure component properties. The mixture would then not be able to describe the induced association, because thenb
is essentially eliminated.The solution
kappa_ab
andepsilon_k_ab
are optional, so#[serde(flatten)]
will always be able to deserialize thePcSaftAssocationRecord
struct. Induced association is calculated properly if binary association parameters are present. If there are no binary parameters for a certain combination of molecules, combining rules are NOT used, instead the association energy is set to 0, effectively treating the molecules as non-associating (with each other).