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

Fixed Failing Abinit tests #1106

Closed
wants to merge 4 commits into from
Closed

Conversation

jmmshn
Copy link
Contributor

@jmmshn jmmshn commented Jan 21, 2025

Summary

The abinit tests are failing due to a float point comparison that gave the following error:
["The variable 'tsmear' is different in the two files:\n - this file: '0.0036749322175665 Ha'\n - other file: '0.0036749322175655 Ha'"]

This is being patched upstream
abinit/abipy@dc6d097

but I have added bypass here for now.

There is a _get_differences_tol function that mimic what the updated function is suppose to do but implemented differently to avoid other updates in abipy.
Once the abipy is bumped we can remove this helper function in the tests.

Also changed AIMS EOS test to allow for a 1e-4 tolerance.

["The variable 'tsmear' is different in the two files:\n - this file:
'0.0036749322175665 Ha'\n - other file: '0.0036749322175655 Ha'"]
@JaGeo
Copy link
Member

JaGeo commented Jan 21, 2025

@jmmshn Thank you for working on this. Could you build on the discussion here? #1095

@jmmshn jmmshn force-pushed the jmmshn/abi branch 3 times, most recently from 5ae5d16 to 8ca3834 Compare January 21, 2025 23:55
@jmmshn jmmshn marked this pull request as ready for review January 22, 2025 03:01
@JaGeo
Copy link
Member

JaGeo commented Jan 22, 2025

@jmmshn Thank you! My only concern is that fractional coordinates are not checked anymore. Maybe, you can take a look at @VicTrqt solution here and make the structure test stricter: https://github.com/VicTrqt/atomate2/blob/784709d95db0515fc63dce6a2dfa4bab1bb81da9/tests/abinit/conftest.py#L395

@jmmshn
Copy link
Contributor Author

jmmshn commented Jan 22, 2025

@JaGeo , my thinking (feel free to push back) is that see any direct usage of all_close or any kind of fractional coordinate checking has an implicit dependence on the atom order which again relies on comparison of exact floating point values.

If we want to "fuzzy" check structure we need some kind of actual fingerprinting --- short of that I think composition + volume will have to be good enough for now.

@JaGeo
Copy link
Member

JaGeo commented Jan 22, 2025

@jmmshn I understand. However, I think this would leave the structure generation untested which I find dangerous.

I think we already have a solution for the problem here.

def check_poscar(ref_path: Path) -> None:

@jmmshn
Copy link
Contributor Author

jmmshn commented Jan 22, 2025

I think we already have a solution for the problem here.

Ooo this works I was not aware of this.

@JaGeo
Copy link
Member

JaGeo commented Jan 22, 2025

I think we already have a solution for the problem here.

Ooo this works I was not aware of this.

So far, there hasn't been an indication for me that it doesn't 😅. In any case safer than not comparing at all.

@JaGeo
Copy link
Member

JaGeo commented Jan 22, 2025

@jmmshn could you maybe extract the comparison function for structures to a common testing module, import it from there to vasp.py and the abinit tests? Then, I would be happy to merge.

@VicTrqt
Copy link
Contributor

VicTrqt commented Jan 23, 2025

Hello @JaGeo and @jmmshn ,
Thanks a lot for looking into this as well.
My fix does not account for a shuffling of the atom order and it is a good idea to include it indeed. After discussing with @gpetretto , we don't see any reason not to adapt and use check_poscar. We also think it would be better to keep my check on the dict abivars, except for the key xred (the fractional coordinates). Since we are allowing a shuffling of the atoms, it also needs to be adapted to allow a shuffling of znucl (which element) and typat (the ordering of the elements in the coordinates). As this is more ABINIT related, I will modify it and then you can include it in this PR if this is okay with you (or I will open a new one depending on the time).
Regarding the fix in Abipy mentioned at the beginning abinit/abipy@dc6d097 for the floating point comparison, it would be nice to avoid too many version releases since, depending on the review, my open SHG PR might require modifications in Abipy as well...

@VicTrqt
Copy link
Contributor

VicTrqt commented Jan 23, 2025

  • I adapted check_poscar here. Feel free to modify it and put it in the common testing module as suggested.
  • I implemented a small check on the type of elements and their number of atoms here
  • So the final ABINIT check looks like this. I can open a new PR for it if needed, but it might as well be part of this PR by copying it.

@JaGeo
Copy link
Member

JaGeo commented Jan 23, 2025

@VicTrqt maybe open a pull request and i will merge this. Then, this is fixed and we close this one here.

@VicTrqt
Copy link
Contributor

VicTrqt commented Jan 23, 2025

Here it is #1108 .
I also copied the rest of the fixes implemented by @jmmshn.

@JaGeo
Copy link
Member

JaGeo commented Jan 23, 2025

Closing this as it is fixed in #1108

@JaGeo JaGeo closed this Jan 23, 2025
@JaGeo
Copy link
Member

JaGeo commented Jan 23, 2025

Thank you both @jmmshn and @VicTrqt !!

@jmmshn
Copy link
Contributor Author

jmmshn commented Jan 23, 2025

Thanks @VicTrqt, @JaGeo I couldn't get to it yesterday but thanks for pushing this through the finish line!

@JaGeo
Copy link
Member

JaGeo commented Jan 23, 2025

@jmmshn thanks and don't worry! I also only was able to review and not do it myself 😉

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.

3 participants