Skip to content

Add explanation for translation entropy constants #1077

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

Merged
merged 6 commits into from
Mar 19, 2025

Conversation

TyBalduf
Copy link
Contributor

@TyBalduf TyBalduf commented Aug 6, 2024

Worked out the constants following the expressions for translation entropy given (among other places) here

@marcelmbn
Copy link
Member

marcelmbn commented Aug 7, 2024

Would fix also #649 and #1052.

@marcelmbn marcelmbn added the documentation Improvements or additions to documentation label Aug 7, 2024
@TyBalduf
Copy link
Contributor Author

TyBalduf commented Aug 8, 2024

So I rewrote the translation entropy equation and it gives approximately the same result (free energy differs by ~10^-5 kcal/mol)

If I work out the equivalent of magic4 and magic5, they come out to:

  • magic4 = 2.2879 (previously 2.2869)
  • magic5 = 2.3149 (previously 2.3135)

As best I can tell, these must have been originally been worked out with slightly different definitions of the constants. Not all the constants used in xTB correspond to their exact current value. For example in thermo, these values are defined:

   real(wp),parameter :: R = 1.98726D0    ! GAS CONSTANT IN CALORIES/(MOLE*K) (should be 1.9872*04*)

@marcelmbn Not sure if this is an acceptable difference and tests should be updated or this is too large a change and we just stick with the current magic constants, just providing some documentation on how they were likely calculated.

@marcelmbn
Copy link
Member

marcelmbn commented Aug 9, 2024

Thanks for the correct implementation of the constant!

  1. Currently, the tests fail due to a ~10-5 value mismatch in the thermo unit tests, which is not very surprising.
  2. I've checked your point regarding the gas constant and came to the same result. The right way to do it would probably be to update all necessary constants (if necessary) to their most recent SotA value and then update the reference unit test results with the updated values. IMHO, there's no reason to stick with old fixed numbers based on slightly wrong fundamental constants. EDIT: Regarding the SotA fundamental constants: If we update them anyway, it is probably a good idea to give a reference for the value (paper, reference data collection, ...).
  3. Finally, we should move all constants from thermo.f90 into mctc/mctc_constants.f90 and just use them at the beginning of thermodyn. Moreover, I'd also delete the old code, i.e. magic4, magic5, s_tr_old, ... as people could still look it up in the git history and we don't need it in the active code base.

Thank you in advance for your work on this project!

@marcelmbn
Copy link
Member

@TyBalduf Just wanted to ping you again on this topic. We'd be very grateful if you find the time to update the related points in the code to the SotA standard you suggested, including the correct ab initio constants, so that we can integrate everything into the main branch. 😊
If you are no longer working on it, a short note would also be nice.

@TyBalduf
Copy link
Contributor Author

TyBalduf commented Oct 4, 2024

I've been a little preoccupied of late and won't have a chance to work on this too soon. I can probably get to it eventually, its mainly a matter of updating tests. But I'm not actively working on it so if someone else wanted to take this on, there wouldn't be conflicting work.

@thfroitzheim
Copy link
Contributor

I updated the necessary constants from CODATA 2018 to be consistent with mctc-lib and calculated all necessary quantities directly from the fundamental constants. The resulting corrections change by about 10e-5 but the new values are just more accurate. Therefore, I adapted the tests to the new values. Should now be ready.

@thfroitzheim thfroitzheim requested a review from marcelmbn March 13, 2025 22:46
Copy link
Member

@marcelmbn marcelmbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me besides the few questions regarding constant relationships.

src/thermo.f90 Outdated
Comment on lines 301 to 302
real(wp),parameter :: conv4 = 2.2868d0 ! approx R*ln(10)/2
real(wp),parameter :: conv5 = 2.3135d0 ! approx R*(ln[(kb/P°)*(2pi * kB * amutokg/h)^(3/2)] + 5/2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest deleting these lines as they should not be needed anymore.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we have to remove the full routine, which I did. I think it mainly calculates everything in wavenumbers and was never used in the code.

Comment on lines +223 to +227
! Alternative form:
! s_tr_old=magic4*(5.0_wp*log10(t)+3.0_wp*log10(molmass))-magic5
! with:
! magic4 = R*ln(10)/2 approx 2.2868d0
! magic5 = R*(ln[(kb/P°)*(2pi * kB * amutokg/h)^(3/2)] + 5/2) approx 2.3135d0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also delete these old legacy parts but might also be helpful for some point in the future where it possibly helps somebody in understanding the equations? I'd leave it up to you if we keep it or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep this to explain the formula above. It is not directly obvious and long-term we need to clean up the thermo routine anyway. Then it is nice to have as much information as possible.

Comment on lines 58 to 61
real(wp), public, parameter :: fstoau = 41.3413733365614_wp
real(wp), public, parameter :: autofs = 1.0_wp / fstoau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we replace these two lines with dependencies on the atomic_unit_of_time? Both represent a relation between units of time (SI vs atomic units)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Or the other way around would obviously also be possible)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this. I used the new value which comes from mctc-lib (our general goal should be to consistently use only mctc-lib values for all constants, as this will replace the internal mctc routines in xtb).

TyBalduf and others added 5 commits March 19, 2025 00:03

Unverified

This user has not yet uploaded their public signing key.
Signed-off-by: Ty Balduf <ty.balduf@schrodinger.com>
Signed-off-by: Ty Balduf <ty.balduf@schrodinger.com>
Signed-off-by: thfroitzheim <92028749+thfroitzheim@users.noreply.github.com>
Signed-off-by: Marcel Müller <marcel.mueller@thch.uni-bonn.de>
@marcelmbn marcelmbn merged commit 8165e41 into grimme-lab:main Mar 19, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hess and ohess don't support diatomic molecules? Translational entropy calculations
3 participants