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

ORM: Remove pymatgen version check in StructureData.set_pymatgen_structure #5777

Merged
merged 3 commits into from
Nov 17, 2022
Merged
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
10 changes: 1 addition & 9 deletions aiida/orm/nodes/data/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,6 @@ def set_pymatgen_structure(self, struct):
:raise ValueError: if there are partial occupancies together with spins.
"""

from pkg_resources import parse_version

def build_kind_name(species_and_occu):
"""
Build a kind name from a pymatgen Composition, including an additional ordinal if spin is included,
Expand Down Expand Up @@ -866,15 +864,9 @@ def build_kind_name(species_and_occu):
self.pbc = [True, True, True]
self.clear_kinds()

required_pmg_version = parse_version('2019.3.13')
current_pmg_version = parse_version(get_pymatgen_version())
for site in struct.sites:

# site.species property first introduced in pymatgen version 2019.3.13
if current_pmg_version < required_pmg_version:
species_and_occu = site.species_and_occu
else:
species_and_occu = site.species
species_and_occu = site.species

if 'kind_name' in site.properties:
kind_name = site.properties['kind_name']
Expand Down