materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.51k stars 862 forks source link

InterstitialGenerator Wrongly Counts Interstitial Sites Due to Overlapped Interstitials #2564

Closed JiQi535 closed 2 years ago

JiQi535 commented 2 years ago

Describe the bug The InterstitialGenerator can identify octahedral and tetrahedral interstitials, however, it overestimates the number of interstitial sites due to overlapping interstitials. _More than that, the method of create_saturated_interstitial_structure creates structures with overlapped interstitial sites._ The visualized saturated structure of BCC Ti with interstitial H atoms are shown below. The bug likely from the StructureMotifInterstitial class. While I haven't found the exact source of error from the complex codes, you can reproduce the problem by my example code below.

To Reproduce The error can be reproduced with the below codes:

from pymatgen.ext.matproj import MPRester
from pymatgen.analysis.defects.generators import InterstitialGenerator
from pymatgen.analysis.defects.core import create_saturated_interstitial_structure

mpr = MPRester()
Ti_mp73_Im3m_BCC = mpr.get_structure_by_material_id("mp-73")
IG = InterstitialGenerator(Ti_mp73_Im3m_BCC, "H")
Ti_mp73_Im3m_BCC_interH_saturated = create_saturated_interstitial_structure(IG.unique_defect_seq[0])
print("Found {} interstitals in {} with SG of {}".format(IG.unique_defect_seq[0].get_multiplicity(),Ti_mp73_Im3m_BCC.formula, Ti_mp73_Im3m_BCC.get_space_group_info()))

Expected behavior No overlapped interstitial sites.

Snapshot Screen Shot 2022-06-29 at 10 54 52 PM

Desktop (please complete the following information):

@mkhorton @janosh I'm not sure who should I quote here, so I'm asking Matthew and Janosh here to help to link to the right person. Thank you!

shyuep commented 2 years ago

The likely reason is the tolerance in symmetry finding. This can easily be solved with using Structure.merge_sites after you generate the interstitials. Or maybe refining the structure before you run the defect analysis.