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

Relax tolerances when testing HinderedRotor.get_enthalpy() #2457

Merged
merged 1 commit into from
Jun 7, 2023
Merged

Conversation

rwest
Copy link
Member

@rwest rwest commented Jun 7, 2023

Motivation or Problem

When testing HinderedRotor.get_enthalpy() method using a Fourier series potential in the quantum limit it calls get_enthalpy which, in the quantum limit, calls solve_schrodinger_equation, which calls scipy.linalg.eig_banded(H, lower=True, eigvals_only=True, overwrite_a_band=True), which apparently now gives a subtly different answer, and the unit test fails.

======================================================================
FAIL: Test the HinderedRotor.get_enthalpy() method using a Fourier series
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/RMG-Py/RMG-Py/rmgpy/statmech/torsionTest.py", line 292, in test_get_enthalpy_quantum_fourier
    self.assertAlmostEqual(h_exp, h_act, delta=1e-3 * h_exp)
AssertionError: 1367.5252765416 != 1368.9776611328125 within 1.3675252765416002 delta (1.4523845912124216 difference)

There's a lengthy discussion in #1682 trying to track down the possibility of a bug due to some gnarly numerical issues. In the end they increased the tolerance on a unit test.

Since nothing has changed recently relating to this code, except some C++ libraries on conda-forge that are used on the test runners, I propose taking the same approach, and relaxing the tolerance on the test. Maybe we're more accurate now than we used to be 🤷

Description of Changes

The tolerance in test_get_enthalpy_quantum_fourier was 0.1%. It's now 0.2%.

Testing and Reviewer Tips

There's a deep dive at #1682.
The unit tests now pass on this branch.

@rwest rwest marked this pull request as ready for review June 7, 2023 00:13
When testing HinderedRotor.get_enthalpy() method using a Fourier series potential
 in the quantum limit it calls get_enthalpy
 which in the quantum limit calls solve_schrodinger_equation
 which calls scipy.linalg.eig_banded(H, lower=True, eigvals_only=True, overwrite_a_band=True)

 There's a lengthy discussion in #1682
 trying to track down the possibility of a bug.
In the end they increased the tolerance on a test.

Since nothing has changed recently, except some C libraries etc. on conda-forge,
I propose taking the same approach, and relaxing
the tolerance
@rwest rwest enabled auto-merge June 7, 2023 01:32
@rwest rwest requested a review from mjohnson541 June 7, 2023 01:33
Copy link
Contributor

@mjohnson541 mjohnson541 left a comment

Choose a reason for hiding this comment

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

Yeah, I think this is fine.

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Merging #2457 (cd2b77a) into main (d57bb10) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2457      +/-   ##
==========================================
- Coverage   48.14%   48.12%   -0.03%     
==========================================
  Files         110      110              
  Lines       30629    30629              
  Branches     7989     7989              
==========================================
- Hits        14747    14739       -8     
- Misses      14353    14363      +10     
+ Partials     1529     1527       -2     

see 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rwest rwest merged commit e6a0040 into main Jun 7, 2023
@rwest rwest deleted the torsion branch June 7, 2023 03:54
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

Successfully merging this pull request may close these issues.

2 participants