Skip to content

Commit

Permalink
pin spglib and pymatgen versions to account for deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
esoteric-ephemera committed Aug 22, 2024
1 parent 9e053ea commit 82a2f4b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
5 changes: 1 addition & 4 deletions robocrys/condense/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@ def get_sym_inequiv_components(
components = deepcopy(components)

sym_inequiv_components = {}
if hasattr(symm_dset := spg_analyzer.get_symmetry_dataset(),"equivalent_atoms"):
equivalent_atoms = symm_dset.equivalent_atoms
else:
equivalent_atoms = symm_dset["equivalent_atoms"]
equivalent_atoms = spg_analyzer.get_symmetry_dataset().equivalent_atoms

for component in components:
sym_indices = frozenset(equivalent_atoms[x] for x in component["site_ids"])
Expand Down
5 changes: 1 addition & 4 deletions robocrys/condense/mineral.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@ def get_fingerprint_matches(
]

if match_n_sp:
if (n_elems := getattr(structure,"n_elems",None)) is None:
# backup legacy attr access
n_elems = getattr(structure,"ntypesp",None)
mineral_db = mineral_db[mineral_db["ntypesp"] == n_elems]
mineral_db = mineral_db[mineral_db["n_elems"] == structure.n_elems]

num_rows = mineral_db.shape[0]
max_n_matches = max_n_matches or num_rows
Expand Down
6 changes: 1 addition & 5 deletions robocrys/condense/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ def __init__(
self.site_fingerprints = get_site_fingerprints(bonded_structure.structure)

sga = SpacegroupAnalyzer(bonded_structure.structure, symprec=symprec)

if hasattr(symm_dset := sga.get_symmetry_dataset(),"equivalent_atoms"):
equivalent_sites = symm_dset.equivalent_atoms
else:
equivalent_sites = symm_dset["equivalent_atoms"]
equivalent_sites = sga.get_symmetry_dataset().equivalent_atoms

if use_symmetry_equivalent_sites:
self.equivalent_sites = list(equivalent_sites)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
test_suite="nose.collector",
packages=find_packages(),
install_requires=[
"spglib",
"spglib>=2.5.0",
"numpy",
"scipy",
"pymatgen",
"pymatgen>=2024.1.26",
"inflect",
"networkx",
"matminer>=0.9.2",
Expand Down

0 comments on commit 82a2f4b

Please sign in to comment.