pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Group-subgroup relationship bugs in `SpaceGroup` and `PointGroup` class

Open kaueltzen opened this issue 1 year ago • 0 comments

Python version

3.10

Pymatgen version

master

Operating system version

No response

Current behavior

Hey, two remarks regarding the is_subgroup method of SpaceGroup:

First, the current implementation does not allow isomorphic group-subgroup relationships (same space group type) because of https://github.com/materialsproject/pymatgen/blob/02341828b94a001b4f3cbdae6b24eaeeb0df7d7d/src/pymatgen/symmetry/groups.py#L537 For example, I would expect the following code to not raise an error: assert SpaceGroup("P3").is_subgroup(SpaceGroup("P3")) The if j not in all_groups needs to be removed in the first iteration.

Second, the current implementation disregards klassengleiche group-supergroup relationships where the overall translational symmetry is increased, but not through centering. For example, I would expect this to not raise an error: assert SpaceGroup("Fm-3m").is_subgroup(SpaceGroup("Pm-3m"))

However, because of https://github.com/materialsproject/pymatgen/blob/02341828b94a001b4f3cbdae6b24eaeeb0df7d7d/src/pymatgen/symmetry/groups.py#L528 this returns False. I assume it is to save resources? I would either remove it completely (safest) or restrict it to certain cases, if possible(?).


Also, I had a look at the uncommented PointGroup subgroup test: https://github.com/materialsproject/pymatgen/blob/02341828b94a001b4f3cbdae6b24eaeeb0df7d7d/tests/symmetry/test_groups.py#L59 This test is failing because the -3 is defined along (111) in m-3m, but along (001) in -3m (therefore, the matrices are different). Generally, this affects all group-subgroup relationships if the groups are in crystal systems with different crystallographic directions / blickrichtungen. For example, this is also failing, assert PointGroup("2").is_subgroup(PointGroup("4")) because the rotation axis is along c in the tetragonal, but is notated along b in the monoclinic system (in this database). I would specify this in the warning https://github.com/materialsproject/pymatgen/blob/02341828b94a001b4f3cbdae6b24eaeeb0df7d7d/src/pymatgen/symmetry/groups.py#L79 In the future, it would probably be best to have a database similar to the maximal subgroup database of space group types.


If you agree, I can implement and test the SpaceGroup changes.

Expected Behavior

I would expect my code snippets from above to not raise an error.

Minimal example

No response

Relevant files to reproduce this bug

No response

kaueltzen avatar Jul 18 '24 14:07 kaueltzen