Skip to content

Choose more intuitive orientation of Bravais lattice in magnetic space group#610

Merged
atztogo merged 2 commits intospglib:developfrom
atztogo:mag-braivas-orientation
Oct 27, 2025
Merged

Choose more intuitive orientation of Bravais lattice in magnetic space group#610
atztogo merged 2 commits intospglib:developfrom
atztogo:mag-braivas-orientation

Conversation

@atztogo
Copy link
Copy Markdown
Collaborator

@atztogo atztogo commented Oct 26, 2025

The Bravais lattice for a magnetic space group is chosen approximately randomly when symmetrically equivalent options exist. This can change the orientation of the input cell even if it is already standardized, which is non-intuitive. This PR addresses this issue by preserving the cell orientation when possible.

@atztogo atztogo requested a review from lan496 October 26, 2025 06:22
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.49%. Comparing base (b2d6545) to head (17db4f6).
⚠️ Report is 75 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #610      +/-   ##
===========================================
+ Coverage    74.48%   74.49%   +0.01%     
===========================================
  Files           26       26              
  Lines         7888     7894       +6     
  Branches      1634     1637       +3     
===========================================
+ Hits          5875     5881       +6     
  Misses        1534     1534              
  Partials       479      479              
Flag Coverage Δ
c_api 69.44% <100.00%> (+0.02%) ⬆️
fortran_api 52.95% <100.00%> (+0.03%) ⬆️
python_api 67.36% <100.00%> (+0.02%) ⬆️
unit_tests 11.68% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@lan496 lan496 left a comment

Choose a reason for hiding this comment

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

LGTM

Now I understand this PR's change keeps (tmat, origin_shift) in the normalizer of the MSG because ref_find_similar_bravais_lattice only tries operations in XSG or FSG or the MSG.

@LecrisUT
Copy link
Copy Markdown
Collaborator

Can we add a changelog entry?

Try to preserve the bravis cell orientation in magnetic space group
when there are symmetrically equivalent candidates.

Can we also link where the user would see the difference likein SpglibMagneticDataset or MagneticSpaceGroupType?

@atztogo
Copy link
Copy Markdown
Collaborator Author

atztogo commented Oct 26, 2025

Thanks @lan496 and @LecrisUT.

Does my commit 17db4f6 satisfy the comment by @LecrisUT?

@atztogo atztogo merged commit a925f83 into spglib:develop Oct 27, 2025
48 checks passed
@atztogo atztogo deleted the mag-braivas-orientation branch October 27, 2025 10:29
atztogo added a commit that referenced this pull request Nov 5, 2025
This PR is a simplified version of PR #610. A new test was added to
validate the changes of PR #610 since I had forgotten about it. Locally,
I verified that this test fails on the commit before #610.
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