Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong conversion of parameters for water in CPA #256

Closed
ianhbell opened this issue Feb 19, 2024 · 10 comments
Closed

Wrong conversion of parameters for water in CPA #256

ianhbell opened this issue Feb 19, 2024 · 10 comments

Comments

@ianhbell
Copy link
Contributor

Previously, the default units for epsilon_assoc were J/mol. In 8f3bb4a the default was changed to K, but the coefficients for water were not properly converted. epsilon_assoc was previously 16655.0 J/mol, and dividing by R of 8.314462618 J/mol/K should yield 2003.136073273521 K, but the value is instead 1700.3053894468114 K. Also the bond volume was changed, but it should not have been.

The consequence is different volumes, and very different pressures. See the previous value in #239 (comment) which I believe is the correct answer for volume from the previous version.

@longemen3000
Copy link
Member

sCPA (or CPA with radial_dist = :KG) seems to invoke the correct parameters (in CPA/sCPA/sCPA_assoc.csv). the ones in CPA/CPA_assoc.jl are the ones that are used with the :CS rdf

@ianhbell
Copy link
Contributor Author

The same script (that I linked in the initial post) gives different results in version 0.4.0 and 0.5.10, so the defaults must be getting crossed up. I see your point about CPA with CS versus CPA with KG, they have different parameter sets.

Related aside: the references for the sources of CPA and sCPA parameters are not provided.

@ianhbell
Copy link
Contributor Author

And 0.5.9 and 0.4.13 give the same results, so the bisection shows that 0.5.10 is the breaking change.

@longemen3000
Copy link
Member

can you give me an MVE? i can check that and fix the discrepancy that way

@ianhbell
Copy link
Contributor Author

With the script

using Clapeyron
using Unitful
using Pkg
println(Pkg.status("Clapeyron"))
water = Clapeyron.CPA(["Water"])
println(volume(water, 1e5u"Pa", 303.15u"K"))

I get:

⌃ [7c7805af] Clapeyron v0.5.9
Info Packages marked with ⌃ have new versions available and may be upgradable.
nothing
1.7915123921401366e-5 m³

and in the new version:

  [7c7805af] Clapeyron v0.5.10
nothing
1.8096728067736136e-5 m³

@ianhbell
Copy link
Contributor Author

It looks like a small difference, but it turns into an enormous difference in pressure

longemen3000 added a commit that referenced this issue Feb 21, 2024
@longemen3000
Copy link
Member

i checked, and the only difference was the water parameters. it is fixed in 6a8bb93

@ianhbell
Copy link
Contributor Author

Thanks for looking into it. I think you fixed the energy, but the volume should also not change, and it was previously 0.0692 and is now 0.0608

@ianhbell
Copy link
Contributor Author

Did you fix the volume parameters too? Otherwise this issue should not be closed

@longemen3000
Copy link
Member

Yes, the volume parameter was fixed too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants