Skip to content

Add properties to Structure and Molecule #3264

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

Merged
merged 17 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pymatgen/analysis/gb/grain.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(
oriented_unit_cell: Structure,
validate_proximity: bool = False,
coords_are_cartesian: bool = False,
properties: dict | None = None,
) -> None:
"""
Makes a GB structure, a structure object with additional information
Expand Down Expand Up @@ -109,6 +110,8 @@ def __init__(
that are less than 0.01 Ang apart. Defaults to False.
coords_are_cartesian (bool): Set to True if you are providing
coordinates in Cartesian coordinates. Defaults to False.
properties (dict): dictionary containing properties associated
with the whole GrainBoundary.
"""
self.oriented_unit_cell = oriented_unit_cell
self.rotation_axis = rotation_axis
Expand All @@ -125,6 +128,7 @@ def __init__(
validate_proximity=validate_proximity,
coords_are_cartesian=coords_are_cartesian,
site_properties=site_properties,
properties=properties,
)

def copy(self):
Expand Down
8 changes: 4 additions & 4 deletions pymatgen/analysis/magnetism/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,16 @@ def matches_ordering(self, other: Structure) -> bool:
b_positive = CollinearMagneticStructureAnalyzer(other, overwrite_magmom_mode="normalize", make_primitive=False)

b_negative = b_positive.structure.copy()
b_negative.add_site_property("magmom", np.multiply(-1, b_negative.site_properties["magmom"]))
b_negative.add_site_property("magmom", -np.array(b_negative.site_properties["magmom"]))

b_negative = CollinearMagneticStructureAnalyzer(
analyzer = CollinearMagneticStructureAnalyzer(
b_negative, overwrite_magmom_mode="normalize", make_primitive=False
)

b_positive = b_positive.get_structure_with_spin()
b_negative = b_negative.get_structure_with_spin()
analyzer = analyzer.get_structure_with_spin()

return a.matches(b_positive) or a.matches(b_negative)
return a.matches(b_positive) or a.matches(analyzer)

def __str__(self):
"""
Expand Down
Loading