Conversation
c402ca8 to
3dc1dd1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #301 +/- ##
========================================
Coverage 83.59% 83.59%
========================================
Files 24 24
Lines 8118 8118
Branches 1686 1693 +7
========================================
Hits 6786 6786
Misses 1332 1332
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
7cefe14 to
958eb41
Compare
a7895de to
22ffd64
Compare
| class Symmetry { | ||
| // TODO: Find better interface compatible with std::mdspan | ||
| std::array<double, 9> rotations; | ||
| std::array<double, 3> translations; | ||
| }; | ||
| class MagneticSymmetry : public Symmetry { | ||
| bool time_reversal; | ||
| }; |
There was a problem hiding this comment.
Should this be split into RotationSymmetry and TranslationSymmetry, or are there cases when both are simultaneously non-zero? Similarly with MagneticSymmetry -> TimeReversalSymmetry?
And there's also PointSymmetry that is a subset of these.
There was a problem hiding this comment.
Time reversal operation (prime operation) commutes with space group operation, so this inheritance would work, but I am not very sure, and not also sure if this is intuitive. @lan496 can consider in depth on this.
There was a problem hiding this comment.
If this class was used in implementing core algorithms, the split or reconsideration would be needed. But I think this is thin wrapper for C-API, so the current one looks good.
| class Spacegroup { | ||
| int number; | ||
| int hall_number; | ||
| std::string international_symbol; | ||
| std::string hall_symbol; | ||
| std::string schoenflies; | ||
| std::string pointgroup_international; | ||
| std::string pointgroup_schoenflies; | ||
| int arithmetic_crystal_class_number; | ||
| std::string arithmetic_crystal_class_symbol; | ||
| // TODO: Unclear what this is referencing | ||
| char choice[6]; | ||
| }; |
There was a problem hiding this comment.
Needs review if these are sufficient or overcomplete.
There was a problem hiding this comment.
Space group and space-group-type have different meanings in crystallography. So here SpacegroupType is more appropriate.
There was a problem hiding this comment.
Space group and space-group-type have different meanings in crystallography. So here SpacegroupType is more appropriate.
Good to know.
What about the contents of it? E.g. hall_number and hall_symbol should be linked right?
There was a problem hiding this comment.
Do you ask about one-to-one correspondance between hall_number and hall_symbol?
There was a problem hiding this comment.
Yes, among other things. What makes sense to group together, what is a different convention of another, etc. The info would still be accessible flat, e.g. soacegroup->hall_number(), but it should be stored in more organized containers.
There was a problem hiding this comment.
Hall number is not a proper word in crystallography, but we in spglib use it as the serial ID of the Hall symbol.
| // TODO: should it inherit/reference Spacegroup | ||
| class MagneticSpacegroup { | ||
| int number; | ||
| int type; | ||
| int uni_number; | ||
| int litvin_number; | ||
| std::string bns_number; | ||
| std::string og_number; | ||
| }; |
There was a problem hiding this comment.
Isn't the MagneticSpacegroup also a Spacegroup?
There was a problem hiding this comment.
Magnetic space group and space group are different groups and corresponding objects live in different spaces.
Similar to space group, MagneticSpacegroupType is more appropriate.
There was a problem hiding this comment.
But from what I see in SpglibMagneticDataset it also has a hall_number associated. So do all MagneticSpacegroupType have a SpacegroupType/hall_number/etc. associated with it?
There was a problem hiding this comment.
Hall symbols are defined for space group type with selected crystallographic settings. A subset of each magnetic space group (MSG) forms a space group, and the Hall symbol of the space group is useful information in MSG. But we have to remember that the MSG and the subset that forms space group in general don't have group-subgroup relation.
There was a problem hiding this comment.
Hmm, we could store it as a pointer on MSG, pointing to the SG
| // TODO: Combine/templetize | ||
| class Dataset { | ||
| std::vector<Symmetry> symmetries; | ||
| Spacegroup spacegroup; | ||
| // These are dependent on the input, should be moved to constructor? | ||
| std::array<double, 9> transformation_matrix; | ||
| std::array<double, 3> origin_shift; | ||
| // Smart reference to the input used | ||
| std::shared_ptr<Lattice> lattice; | ||
| }; | ||
| class MagneticDataset { | ||
| std::vector<MagneticSymmetry> symmetries; | ||
| MagneticSpacegroup spacegroup; | ||
| // These are dependent on the input, should be moved to constructor? | ||
| std::array<double, 9> transformation_matrix; | ||
| std::array<double, 3> origin_shift; | ||
| // Smart reference to the input used | ||
| std::shared_ptr<Lattice> lattice; | ||
| }; |
There was a problem hiding this comment.
I think for these we only need to store symmetries, spacegroup and lattice, what do you think?
There was a problem hiding this comment.
SpglibDataset provides multiple different kinds of information.
- Matrix representations of space group operations for input crystal structure
- Space group type including setting, choice, point group, crystal class, that are covered by
SpglibSpacegroupTypeand its associated information of the input crystal structure, Wyckoff positions, etc. - Crystal structure that standardizes the input crystal structure
- Transformation matrix (P, p) from the input structure to the conventional unit cell
- Primitive cell
Depending on purposes, most of these information are essential. All these were squashed in to the SpglibDataset just for convenience. Primitive cell information may not be necessary, although it was necessary at some stage in history.
There was a problem hiding this comment.
Indeed and most of them will be made available indirectly via getters. The dataset itself should only store the minimum distinguishable information.
E.g. transformation matrix can be derived from lattice and std_lattice/primitive_lattice/spacegrouptype
MagbeticDataset I am definitely missing stuff there.
So far it seems I should include std_lattice and primitive_lattice
As for interface, I should add:
- transformation matrices
- wyckoff positions
- equivalent atoms
Other things should be taken indirectly, e.g. hall_number through spacegroup (should be spacegroup_type here?)
There was a problem hiding this comment.
I think the transformation matrix is the most important information.
In crystallography, we usually don't think about Cartesian coordinates. However, std_lattice contains (1) change-of-basis (transformation) matrix, (2) rigid rotation in Cartesian coordinates, (3) removal of distortion. So in addition, std_rotation_matrix is necessary to relate them. primitive_lattice is an intermediate information and it is not standardized. Probably this information is rarely used. To make primitive cell, we can transform the input crystal structure using the transformation matrix, then we can apply a pre-defined transformation matrix to the primitive cell, https://spglib.readthedocs.io/en/stable/definition.html#transformation-to-the-primitive-cell. This is a cleaner approach.
The strong point of spglib is the feature of removing distortion. The way of the treatment of distortion is not unique, and is somehow implemented algorithmically not mathematically in spglib. These naive information are averaged out and pushed into each element of the dataset. Spglib pretends working properly, but no one knows its super details.
Signed-off-by: Cristian Le <[email protected]> Signed-off-by: Cristian Le <[email protected]>
Having this in parallel helps me figure out how to build the test fixtures