Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kaueltzen
Copy link
Contributor

@kaueltzen kaueltzen commented Jul 19, 2024

Summary

Resolves #3937 .

SpaceGroup

  • enabled isomorphic group subgroup relationships, added test
  • Constrained
    if len(supergroup.symmetry_ops) < len(self.symmetry_ops):
    to non-klassengleiche group subgroup relationships so cases like assert SpaceGroup("Fm-3m").is_subgroup(SpaceGroup("Pm-3m")) pass, added test
  • fixed bug introduced by me in SpaceGroup changes #3859 (Apologies!) of wrong short Hermann Mauguin symbol computation for multiple trigonal groups
  • modified point_group entries of symm_data.json to be possible symbol attributes of PointGroup (also see comment below)

PointGroup

  • added crystal_system attribute to PointGroup
  • enabled init from other settings than in database and from full symbol, added test
  • added notes in docs that axes of PointGroup object may differ from given int_symbol in init / given space group symbol in from_space_group as currently only one setting per point group is available
  • added crystallographic direction issue check for is_subgroup of PointGroup -> a NotImplementedError is now raised if the blickrichtungen / crystallographic directions of the crystal systems of the two groups differ

…oup subgroup relationship would be possible (fr. crystal system), but cannot be checked currently due to crystallographic direction issue.
@kaueltzen kaueltzen marked this pull request as ready for review July 19, 2024 16:51
@kaueltzen kaueltzen changed the title [WIP] is_subgroup() modifications in SpaceGroup and PointGroup is_subgroup() modifications in SpaceGroup and PointGroup Jul 19, 2024
kaueltzen and others added 3 commits July 22, 2024 13:01
… added missing setting differences (trigonal groups), re-enabled SpaceGroup.is_subgroup shortcut with constraint of non-klassengleiche group subgroup relationship
@kaueltzen
Copy link
Contributor Author

Hey @shyuep @mkhorton @janosh this is ready to be reviewed.

Copy link
Member

@janosh janosh left a 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. "
Copy link
Member

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

Copy link
Contributor Author

@kaueltzen kaueltzen Aug 2, 2024

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))

Copy link
Contributor Author

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(
Copy link
Contributor Author

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:

Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @janosh , originally, i was hoping for input from you, @mkhorton or @shyuep . However, if there are no strong opinions on this, these changes can be merged.

@janosh janosh force-pushed the master branch 2 times, most recently from e3fbc67 to 41e6d99 Compare August 3, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Group-subgroup relationship bugs in SpaceGroup and PointGroup class
3 participants