Tools for re-griding periodic volumetric quantum chemistry data for machine-learning purposes.
Actively maintained. Last release 5 weeks ago. A safe choice.
pip install mp-pyrhomp-pyrho
Installation
pip install mp-pyrho
Tools for re-griding volumetric quantum chemistry data for machine-learning purposes.
If you use this package in your research, please cite the following:
Shen, J.-X., Munro, J. M., Horton, M. K., Huck, P., Dwaraknath, S., & Persson, K. A. (2022).
A representation-independent electronic charge density database for crystalline materials.
Sci Data, 9(661), 1–7. doi: 10.1038/s41597-022-01746-z
Regridding data using PyRho
The PGrid Class
The PGrid object is defined by an N-dimensional numpy array grid_data and a N lattice vector given as a matrix lattice. The input array is a scalar field that is defined on a regularly spaced set of grid points starting at the origin. For example, you can construct a periodic field as follows:
import numpy as np
from pyrho.pgrid import PGrid
from pyrho.vis.scatter import get_scatter_plot
def func(X, Y):
return np.sin(X) * np.cos(2 * Y)
a = np.linspace(0, np.pi, 27, endpoint=False)
b = np.linspace(0, np.pi, 28, endpoint=False)
X, Y = np.meshgrid(a, b, indexing="ij")
data = func(X, Y)
pg2d = PGrid(grid_data=data, lattice=[[np.pi, 0], [0, np.pi]])
The data can be examined using the helper plotting function which supports up to 3-D.
import matplotlib as mpl
mpl.rc("image", cmap="viridis")
get_scatter_plot(pg2d.grid_data, pg2d.lattice, marker_size=40)

The period data in the PGrid object must be fixed-scaled so if you half the number of points in the domain, the range of the data will stay the same. This is different from how the charge density is stored in codes like VASP where the values at each point change based on the number of grid points used to store the data.


