-
Notifications
You must be signed in to change notification settings - Fork 876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is_subgroup()
modifications in SpaceGroup
and PointGroup
#3941
Conversation
…rning of SymmetryGroup.
…oup subgroup relationship would be possible (fr. crystal system), but cannot be checked currently due to crystallographic direction issue.
is_subgroup()
modifications in SpaceGroup
and PointGroup
is_subgroup()
modifications in SpaceGroup
and PointGroup
… added missing setting differences (trigonal groups), re-enabled SpaceGroup.is_subgroup shortcut with constraint of non-klassengleiche group subgroup relationship
…ntroduced by myself in materialsproject#3859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! thanks @kaueltzen. just a minor suggestion
@@ -88,7 +109,10 @@ def is_supergroup(self, subgroup: SymmetryGroup) -> bool: | |||
Returns: | |||
bool: True if this group is a supergroup of the supplied group. | |||
""" | |||
warnings.warn("This is not fully functional. Only trivial subsets are tested right now. ") | |||
warnings.warn( | |||
"This is not fully functional. Only trivial subsets are tested right now. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Only trivial (subsets->supergroup)...
maybe extract these duplicate messages into a trivial_group_warning
format string with a which_set
parameter that you fill with subgroup
/supergroup
in def is_(sub|super)group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I'm not sure what you mean @janosh . A function like this?
def trivial_group_warning(subgroup: str, supergroup: str) -> str:
return (
f"This is not fully functional. Only trivial subsets are tested right now."
f"This will not work if the crystallographic directions of subgroup "
f"{subgroup} and supergroup {supergroup} are different."
)
that is called in is_(sub|super)group
?
warnings.warn(trivial_group_warning(subgroup=self.symbol, supergroup=supergroup.symbol))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @janosh can you maybe elaborate on your comment from Aug 2? Thanks!
@@ -75,6 +77,11 @@ def remove_identity_from_full_hermann_mauguin(symbol: str) -> str: | |||
|
|||
SYMM_DATA["space_group_encoding"] = new_symm_data | |||
|
|||
for sg_symbol in SYMM_DATA["space_group_encoding"]: | |||
SYMM_DATA["space_group_encoding"][sg_symbol]["point_group"] = PointGroup.from_space_group( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I would like to have some more opinions on this: With the current changes, all "point_group"
entries in symm_data.json
and symm_ops.json
are possible symbols of PointGroup
. This means that the setting of a SpaceGroup
object and its point_group
attribute may be different, for example, "P-4m2" and "-42m" (as there is no "-4m2" setting of this point group in symm_data.json
currently.
Therefore, SpaceGroup
objects of the same point group always have the same point_group
attribute.
Also, this enables quick comparisons like https://github.com/kaueltzen/pymatgen/blob/e1ec53387a22012936afbf693fcd623a405db690/src/pymatgen/symmetry/groups.py#L584 but of course one could also agree on a "non-standard" point_group
attribute in agreement with the space group setting and adapt respective code snippets
if len(supergroup.symmetry_ops) < len(self.symmetry_ops) and PointGroup(supergroup.point_group).symbol != PointGroup(self.point_group).symbol:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still waiting on external input? looks like this PR went stale so maybe need to ping someone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e3fbc67
to
41e6d99
Compare
Signed-off-by: Katharina Ueltzen <94910364+kaueltzen@users.noreply.github.com>
Summary
Resolves #3937 .
SpaceGroup
pymatgen/src/pymatgen/symmetry/groups.py
Line 528 in 0234182
assert SpaceGroup("Fm-3m").is_subgroup(SpaceGroup("Pm-3m"))
pass, added testpoint_group
entries ofsymm_data.json
to be possiblesymbol
attributes ofPointGroup
(also see comment below)PointGroup
crystal_system
attribute toPointGroup
init
from other settings than in database and from full symbol, added testPointGroup
object may differ from givenint_symbol
ininit
/ given space group symbol infrom_space_group
as currently only one setting per point group is availableis_subgroup
ofPointGroup
-> aNotImplementedError
is now raised if the blickrichtungen / crystallographic directions of the crystal systems of the two groups differ