Skip to content

Commit

Permalink
Fall back on analyzing all sites in sulfide_type
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed May 18, 2022
1 parent bed0eb2 commit c330340
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pymatgen/analysis/structure_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,14 @@ def sulfide_type(structure):
if comp.is_element or s not in comp:
return None

finder = SpacegroupAnalyzer(structure, symprec=0.1)
symm_structure = finder.get_symmetrized_structure()
s_sites = [sites[0] for sites in symm_structure.equivalent_sites if sites[0].specie == s]
try:
finder = SpacegroupAnalyzer(structure, symprec=0.1)
symm_structure = finder.get_symmetrized_structure()
s_sites = [sites[0] for sites in symm_structure.equivalent_sites if sites[0].specie == s]
except Exception:
# Sometimes the symmetry analyzer fails for some tolerance or other issues. This is a fall back that simply
# analyzes all S sites.
s_sites = [site for site in structure if site.specie == s]

def process_site(site):

Expand Down

0 comments on commit c330340

Please sign in to comment.