Add get_magnetic_spacegroup_type_from_symmetry and introduce dataclass output in python interface#485
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #485 +/- ##
===========================================
+ Coverage 83.87% 83.90% +0.03%
===========================================
Files 25 25
Lines 8167 8184 +17
Branches 1702 1709 +7
===========================================
+ Hits 6850 6867 +17
Misses 1317 1317
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Can you also add spacegrouptype while you're at it? |
python/spglib/spglib.py
Outdated
| msg_type_list = _spglib.magnetic_spacegroup_type_from_symmetry( | ||
| rots, trans, timerev, latt, symprec | ||
| ) | ||
| _set_error_message() |
There was a problem hiding this comment.
We have started to make functions raise error, maybe we should make this function raise errors as well. For compatibility it should be gated by a kwarg and we should start encouraging users to set it and use pythonic try catch logics
| double(*lattice)[3]; | ||
| int num_operations; | ||
|
|
||
| SpglibMagneticSpacegroupType msg_type; |
There was a problem hiding this comment.
Can we start moving the type definitions next to where they are used? Can help with some optimizations and some readability by decluttering the variables and scoping the lifetimes
There was a problem hiding this comment.
Yes. Since we are free from some older compilers, my understanding is that we can start moving the location of type definitions
| lattice = (double(*)[3])PyArray_DATA(py_lattice); | ||
| num_operations = PyArray_DIMS(py_rotations)[0]; | ||
|
|
||
| msg_type = spg_get_magnetic_spacegroup_type_from_symmetry( |
There was a problem hiding this comment.
There are a few interfaces that do not properly set error when they fail. Can you check them?
There was a problem hiding this comment.
To clarify on the C side of the code in spglib.c. At least anything that is public on spglib.h should have some error setting.
LecrisUT
left a comment
There was a problem hiding this comment.
One more round of comments. Before the release we should migrate the other dict as well.
LecrisUT
left a comment
There was a problem hiding this comment.
Also don't forget to rebase. CI is not running right now.
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
6c2e2e6 to
9c28457
Compare
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
Co-authored-by: Cristian Le <[email protected]>
LecrisUT
left a comment
There was a problem hiding this comment.
LGTM. The commit history is a bit noisy, so use squash commit if you don't plan on interactively rebasing.
|
|
||
|
|
||
| @dataclasses.dataclass(eq=True, frozen=True) | ||
| class DictInterface(Mapping[str, "Any"]): |
There was a problem hiding this comment.
Did you find that@dataclass was needed for this?
There was a problem hiding this comment.
Yes, mypy seems to need it.
get_magnetic_spacegroup_type_from_symmetry in python interfaceget_magnetic_spacegroup_type_from_symmetry and introduce dataclass output in python interface
Closes #482