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

pymatgen API update breaks DefectsGenerator #68

Closed
alikhamze opened this issue May 10, 2024 · 3 comments
Closed

pymatgen API update breaks DefectsGenerator #68

alikhamze opened this issue May 10, 2024 · 3 comments

Comments

@alikhamze
Copy link

Hello,

I am using Python 3.11, doped 2.4.1, and pymatgen 2024.5.1.

I was following the Defects Generation tutorial, but instantiating a DefectsGenerator object fails.
This occurs due to a breaking change in pymatgen's API (not sure when it was introduced), which updated the Lattice.get_points_in_sphere() function to return a Tuple instead of a List. When the doped.utils.supercells.get_min_image_distance() function is called, the .sort() called in Line 80 of supercells.py fails because Tuple has no sort() function.

Potentials fixes:

  1. Update doped.utils.supercells.get_min_image_distance() to use Lattice.get_points_in_sphere_old(), but there's no guarantee for how long pymatgen will retain the old version of the function.
  2. Change the .sort() in line 80 of supercells.py to use sorted() instead.
  3. Change the tuple returned by Lattice.get_points_in_sphere() to a list using list().

Thanks!

@kavanase
Copy link
Member

Hi @alikhamze!

Thanks for such a detailed – it's very much appreciated!

Yes I noticed some changes in the pymatgen typing recently and had fixed issues with failing tests (4886aa0, materialsproject/pymatgen#3705), but had been waiting to make a new doped release as I thought these issues were mainly related to typing and didn't actually break parts of the code, and was waiting for some updates in other codes to be released so that all tests would pass.
So this issue was fixed in 4886aa0, but not contained in a doped release yet.

Anyway I've added a fix for the minor typing-related test failures due to other dependencies, and just released the latest version of doped (2.4.2) which avoids this issue. It should be pip installable in around 2 hours!
https://pypi.org/project/doped

Please reopen this issue if this doesn't solve it 😃

@kavanase
Copy link
Member

Just to confirm @alikhamze, there was a delay in the new version being released over the weekend due to a memory issue caused by a pytest update, but all sorted now. New version 2.4.2 now live: https://pypi.org/project/doped/

@alikhamze
Copy link
Author

Thanks so much for the very quick response! I've upgraded to the new release. 🙌

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