materialsvirtuallab / pymatgen-analysis-diffusion

This add-on to pymatgen provides tools for analyzing diffusion in materials.
https://guide.materialsvirtuallab.org/pymatgen-diffusion/
BSD 3-Clause "New" or "Revised" License
95 stars 56 forks source link

DiffusionAnalyzer will fail if there is no framework ions #342

Open zhuyizhou opened 1 year ago

zhuyizhou commented 1 year ago

https://github.com/materialsvirtuallab/pymatgen-analysis-diffusion/blob/5923fb59ec47698462c8b6092339768a542738fd/pymatgen/analysis/diffusion/analyzer.py#L229-L243

DiffusionAnalyzer will fail if there is no framework ions (namely if all ions are mobile)

Basically if framework_indices is an empty list. The first dimension of framework_disp would be 0. Then driftwould be a matrix filled with NAN, which leads to failure in the downstream.

This should a minor bug that is easy to fix.

shyuep commented 1 year ago

Can you put in a fix with a unittest and submit a PR? I think it is relatively simple to test if framework_indices: and then set the drift and displacement.