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

DiffusionAnalyzer will fail if there is no framework ions #342

Open
zhuyizhou opened this issue Mar 15, 2023 · 1 comment
Open

DiffusionAnalyzer will fail if there is no framework ions #342

zhuyizhou opened this issue Mar 15, 2023 · 1 comment

Comments

@zhuyizhou
Copy link

framework_indices = []
for i, site in enumerate(structure):
if site.specie.symbol == specie:
indices.append(i)
else:
framework_indices.append(i)
if self.disp.shape[1] < 2:
self.diffusivity = 0.0
self.conductivity = 0.0
self.diffusivity_components = np.array([0.0, 0.0, 0.0])
self.conductivity_components = np.array([0.0, 0.0, 0.0])
self.max_framework_displacement = 0
else:
framework_disp = self.disp[framework_indices]
drift = np.average(framework_disp, axis=0)[None, :, :]

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 drift would be a matrix filled with NAN, which leads to failure in the downstream.

This should a minor bug that is easy to fix.

@shyuep
Copy link
Contributor

shyuep commented Mar 15, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants