Fix Cryspy recalculation for wrapped Wyckoff coordinates#159
Fix Cryspy recalculation for wrapped Wyckoff coordinates#159AndrewSazonov merged 3 commits intomasterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #159 +/- ##
==========================================
- Coverage 88.31% 88.29% -0.03%
==========================================
Files 151 151
Lines 8698 8722 +24
Branches 891 895 +4
==========================================
+ Hits 7682 7701 +19
- Misses 722 725 +3
- Partials 294 296 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes a Cryspy recalculation edge case where freshly-created Cryspy dictionaries normalize fractional coordinates (e.g. -x → 1-x) and can mis-infer Wyckoff multiplicities, leading to incorrect multiplicities on subsequent recalculations. The PR updates newly created Cryspy dictionaries to match the EasyDiffraction Structure state (including restoring multiplicities from stored Wyckoff letters) and adds a regression test for the wrapped-coordinate case.
Changes:
- Update
CryspyCalculatorto re-sync freshly created Cryspy dictionaries with the current EasyDiffraction structure/experiment state. - Add Wyckoff-letter-based restoration of
atom_multiplicityin the Cryspy model sub-dictionary. - Add a regression unit test covering coordinate wrapping and multiplicity restoration; update one tutorial’s chosen minimizer.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/easydiffraction/analysis/calculators/cryspy.py |
Re-sync fresh Cryspy dictionaries with ED state and restore atom multiplicities from Wyckoff data. |
tests/unit/easydiffraction/analysis/calculators/test_cryspy.py |
Add regression test for wrapped coordinates causing incorrect multiplicity inference. |
docs/docs/tutorials/ed-15.py |
Change tutorial minimizer selection (lmfit → bumps) and split into a separate cell. |
docs/docs/tutorials/ed-15.ipynb |
Regenerated notebook content to reflect the updated tutorial script. |
Fresh Cryspy dictionary creation could wrap fractional coordinates such as
-xto1-x, causing special Wyckoff sites to be inferred as general positions with incorrect multiplicities. This madeed-6.pyplots diverge after fit 3 even though fitted parameters looked correct.The fix normalizes fresh Cryspy dictionaries from the EasyDiffraction structure state and restores atom multiplicities from stored Wyckoff labels. Added a regression test for the wrapped-coordinate case.