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

Fix get_niggli_reduced_lattice if entering A1 case #3657

Merged

Conversation

packer-jp
Copy link
Contributor

@packer-jp packer-jp commented Feb 26, 2024

Summary

Major changes:

  • fix 1: I found a bug at pymatgen/core/lattice.py::Lattice::get_niggli_reduced_lattice.
    • After updating lattice parameters at A1, variables A, B, ... also need to be updated.
    • Otherwise, condition checking would be wrong at A2 or later.
    • Therefore, I added a line for updating A, B, C, E, N, Y.
      • This is not minimal, but the simplest I think.
    • Also, added a test that fails before the fix and succeeds after the fix.
      • Correct values were calculated by spglib.

Todos

If this is work in progress, what else needs to be done?

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install

@janosh janosh added fix Bug fix PRs symmetry Space groups and the like core Pymatgen core labels Feb 26, 2024
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.

thanks @packer-jp, esp. for including a new test right away! 👍

@janosh janosh enabled auto-merge (squash) February 26, 2024 12:14
@janosh janosh changed the title [WIP] Fixed get_niggli_reduced_lattice Fix get_niggli_reduced_lattice if entering A1 case Feb 26, 2024
@janosh janosh merged commit 3f07cc4 into materialsproject:master Feb 26, 2024
22 checks passed
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 symmetry Space groups and the like
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants