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

Periodic boundary condition is not considered in the interpolator of VolumetricData #3787

Open
goodwilling opened this issue Apr 28, 2024 · 1 comment
Labels

Comments

@goodwilling
Copy link

Python version

Python 3.11.4

Pymatgen version

pymatgen 2024.3.1

Operating system version

Windows 10

Current behavior

When I use the interpolation method implemented in pymatgen.io.common.VolumetricData, it is found that the results for valence charge density are slightly different compared to those by other methods like c2x. Moreover, the results become considerably different for all-electron charge density and the expected symmetry is broken.
In the source codes, it seems that periodic boundary condition (PBC) is not considered in the interpolator of VolumetricData as in the following, since in PBC the points of data are not from 0.0 to 1.0 in fractional coordinates.

https://github.com/materialsproject/pymatgen/blob/master/pymatgen/io/common.py#L77

  self.xpoints = np.linspace(0.0, 1.0, num=self.dim[0])
    self.ypoints = np.linspace(0.0, 1.0, num=self.dim[1])
    self.zpoints = np.linspace(0.0, 1.0, num=self.dim[2])
    self.interpolator = RegularGridInterpolator(
        (self.xpoints, self.ypoints, self.zpoints),
        self.data["total"],
        bounds_error=True,
    )

Expected Behavior

The interpolation results of electronic density charge should be the same as expected, in particular that the symmetry should not be broken.

Minimal example

No response

Relevant files to reproduce this bug

No response

@goodwilling
Copy link
Author

Using the following revision, expected interpolation results have been obtained.

    self.xpoints = np.linspace(0.0, (self.dim[0]-1)/self.dim[0], num=self.dim[0])
    self.ypoints = np.linspace(0.0, (self.dim[1]-1)/self.dim[1], num=self.dim[1])
    self.zpoints = np.linspace(0.0, (self.dim[2]-1)/self.dim[2], num=self.dim[2])

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

No branches or pull requests

1 participant