Skip to content

Niggli reduction before finding hall number from symmetry operations#589

Merged
atztogo merged 4 commits intospglib:developfrom
atztogo:fix-584
Jun 21, 2025
Merged

Niggli reduction before finding hall number from symmetry operations#589
atztogo merged 4 commits intospglib:developfrom
atztogo:fix-584

Conversation

@atztogo
Copy link
Copy Markdown
Collaborator

@atztogo atztogo commented Jun 20, 2025

Fix #584

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 20, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.46%. Comparing base (36a3938) to head (fcfd99e).
⚠️ Report is 26 commits behind head on develop.

Files with missing lines Patch % Lines
src/spglib.c 66.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #589      +/-   ##
===========================================
+ Coverage    74.33%   74.46%   +0.13%     
===========================================
  Files           26       26              
  Lines         7878     7887       +9     
  Branches      1633     1637       +4     
===========================================
+ Hits          5856     5873      +17     
+ Misses        1541     1532       -9     
- Partials       481      482       +1     
Flag Coverage Δ
c_api 69.42% <71.42%> (+0.75%) ⬆️
fortran_api 52.91% <71.42%> (+1.95%) ⬆️
python_api 67.20% <63.63%> (+0.12%) ⬆️
unit_tests 11.69% <0.00%> (-0.02%) ⬇️

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.

@atztogo atztogo requested a review from lan496 June 20, 2025 07:14
@atztogo
Copy link
Copy Markdown
Collaborator Author

atztogo commented Jun 20, 2025

Wrote a test in C. I suppose this is covered by CI. Am I correct, @LecrisUT?

Copy link
Copy Markdown
Collaborator

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

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

You can also put the tests in the python side. Eventually we will have to consolidate them, but until then I don't mind where they are.

@atztogo
Copy link
Copy Markdown
Collaborator Author

atztogo commented Jun 20, 2025

I found a critical bug in python interface.

_lattice = np.array(lattice, dtype="double", order="C")

This lattice has to be transposed. I think this as well, @lan496?

latt = np.array(lattice, dtype="double", order="C")

Should I be better to make another PR for this fix?

@LecrisUT
Copy link
Copy Markdown
Collaborator

LecrisUT commented Jun 20, 2025

I found a critical bug in python interface.

I did find some inconsistencies, where the transpose is done on the Cpp side. Don't remember which ones these are, but I will try to consolidate them in #579 and do them all in the cpp side.

Edit: Checked the cpp side. It's not transposed there either :/

@atztogo
Copy link
Copy Markdown
Collaborator Author

atztogo commented Jun 20, 2025

Don't remember which ones these are,

lattice = np.array(np.transpose(cell[0]), dtype="double", order="C")

In python, crystal structure is given in this format, but for get_spacegroup_type_from_symmetry, only lattice (basis vectors) is given, so this transpose has to be handled in that function without relying on _expand_cell function.

@atztogo
Copy link
Copy Markdown
Collaborator Author

atztogo commented Jun 20, 2025

How about making another PR for the fix of the python interface? If this way, we can first merge this PR after approval, then I will make the fix and its PR.

@LecrisUT
Copy link
Copy Markdown
Collaborator

LecrisUT commented Jun 20, 2025

How about making another PR for the fix of the python interface? If this way, we can first merge this PR after approval, then I will make the fix and its PR.

Of course. Do you think you can find a test where it breaks? Usually I make the test commit first and run the CI to confirm it actually breaks/covers the thing we are fixing (in this case I confirmed locally by reverting the commit).

@atztogo
Copy link
Copy Markdown
Collaborator Author

atztogo commented Jun 20, 2025

Do you think you can find a test where it breaks? Usually I make the test commit first and run the CI to confirm it actually breaks/covers the thing we are fixing (in this case I confirmed locally by reverting the commit).

I will try in this way.

@lan496
Copy link
Copy Markdown
Member

lan496 commented Jun 21, 2025

I found a critical bug in python interface.

@atztogo I think it is better to separate PR

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

@lan496
Copy link
Copy Markdown
Member

lan496 commented Jun 21, 2025

Do you think you can find a test where it breaks?

Possibly, get_spacegroup_type_from_symmetry with a hexagonal lattice will return an unexpected result

@atztogo atztogo merged commit e95d7a4 into spglib:develop Jun 21, 2025
48 of 49 checks passed
@atztogo atztogo deleted the fix-584 branch June 21, 2025 02:29
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.

spg_get_spacegroup_type_from_symmetry fails to find Fdd2 from non-standard primitive setting

3 participants