pymatgen
pymatgen copied to clipboard
Possible bug with Gaussian smearing
The code might have an issue.
https://github.com/materialsproject/pymatgen/blob/4f906e3578cc20372ff4f12fcda9db3aaebec975/pymatgen/analysis/path_finder.py#L388
I used a Si CHGCAR and ran
from pymatgen.analysis.path_finder import StaticPotential
sp = StaticPotential(chgcar.structure, pot=chgcar.data['total'])
sp.gaussian_smear(r=2)
sp.get_v().shape
This should return an sp
where potential has the same dimensions as the original but instead give a smaller array.
Also just looking at the code I think something is wrong with how the number of required images are computed for skewed cells.
(There's also no tests for these classes)
I have a working solution for this kind of smearing in PyRho but might take a while until things are migrated here.
I just wanna create this issue for future reference. But maybe since testing is lacking we should just add a deprecation warning for now?
But maybe since testing is lacking we should just add a deprecation warning for now?
Deprecation warning is only for if we're going to remove the function. A general warning that it is untested would be useful; we should either add tests asap or remove though, untested code shouldn't be in pymatgen.
Thanks for reporting/noticing this.
I think the code has been migrated to pymatgen-diffusion. Can you check? If it is already there, I will just delete this code.
The pathfinder
in pymatgen diffusion is different from this pathfinder
and the code that I added to pymatgen-diffusion uses both pathfinders
but I cannot find anywhere in our codebase that uses this StaticPotential
that contains this incorrect Gaussian smearing implementation.