Skip to content

Fix hill_formula Composition property #3086

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 3 commits into from
Jun 21, 2023

Conversation

amkrajewski
Copy link
Contributor

Summary

This PR fixes an error in the hill_formula property of the Composition object, which occurs in cases where C, H, and other element/s with symbol ordering alphabetically before H are present at the same time. In such a case, H should be placed directly after C, but this is not implemented nor tested in the current version.

  • Fixed the property to match the description.
  • Implemented additional tests.

Sidenote: @ml-evs This fix should help eliminate compatibility issues with the OPTIMADE chemical_formula_hill field (except for the presence/lack of empty spaces).

@janosh janosh added fix Bug fix PRs core Pymatgen core labels Jun 21, 2023
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

Nice work! Thanks for the detailed description and new tests! 👍

@janosh janosh merged commit fd0acd4 into materialsproject:master Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Pymatgen core fix Bug fix PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants