mp-pyrho is a Python library providing tools for re-gridding periodic volumetric quantum chemistry data (e.g., charge densities, COHP, ELFCAR) into a consistent, resolution-agnostic representation suitable for machine learning applications. It is currently at version 0.5.1 and is actively maintained with a regular release cadence.
pip install mp-pyrhoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `RhoGrid` object with a `pymatgen.core.Structure` and dummy 3D volumetric data. It then shows how to use the `regrid` method to standardize the resolution and the `featurize` method to generate a machine-learning-ready representation, either as a 1D vector or a 3D grid.
If your previous workflow relied on the 'com' centering, explicitly set `center_method='com'` in your `regrid()` and `featurize()` calls to maintain consistency: `rho_grid.regrid(..., center_method='com')`.
If you require the 3D grid output from `featurize()`, explicitly set `vectorize_grid=False`: `rho_grid.featurize(..., vectorize_grid=False)`.
Ensure your input `structure` and `grid_data` accurately represent a periodic system and that the `grid_data` aligns with the unit cell dimensions. Use `RhoGrid.from_file()` or `RhoGrid.from_directory()` for robust loading of standard VASP outputs.