Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    3 of 9 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.2%) to scientific vocabulary

Keywords from Contributors

materials-science materials materials-informatics interactive mongoengine marshmallow kong handsontable flask-mongoengine flasgger
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
Statistics
  • Stars: 40
  • Watchers: 8
  • Forks: 9
  • Open Issues: 5
  • Releases: 29
Created almost 6 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Citation Authors

README.md

mp-pyrho

📄 Full Documentation

Installation

pip install mp-pyrho

Tools for re-griding volumetric quantum chemistry data for machine-learning purposes.

.github/workflows/testing.yml codecov DOI

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:

```python import numpy as np from pyrho.pgrid import PGrid from pyrho.vis.scatter import getscatterplot

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.

```python import matplotlib as mpl

mpl.rc("image", cmap="viridis") getscatterplot(pg2d.griddata, pg2d.lattice, markersize=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.

The regridding capabilities allow the user to obtain the data in any arbitrary representation. For example, if we want to shift to the middle of the unit-cell and create a ((1,1), (1,-1)) super-cell, with a 30 by 32 grid, we can run:

python pg_2x = pg2d.get_transformed([[1, 1], [1, -1]], origin=[0.5, 0.5], grid_out=[30, 32]) get_scatter_plot(pg_2x.grid_data, pg_2x.lattice, skips=1, opacity=1, marker_size=10)

png

Up-sampling with Fourier interpolation

The up-sampling capabilities allow the user to exploit the periodicity of the data to obtain a higher-resolution grid. As an example, we can take a sparsely sampled periodic data in 1-D:

```python def func1(X): return np.sin(6 * X)

a = np.linspace(0, np.pi, 10, endpoint=False) data = func1(a)

pg1d = PGrid(griddata=data, lattice=[[np.pi]]) getscatterplot(pg1d.griddata, pg1d.lattice, marker_size=50) ```

png

This does not really resemble the np.sin(6*X) function we used to generate the data. However, if we use an up-sample factor of 8, we can obtain a more dense representation:

python pg1d_fine = pg1d.get_transformed( sc_mat=[[2]], grid_out=[ 200, ], up_sample=8, ) get_scatter_plot(pg1d_fine.grid_data, pg1d_fine.lattice, marker_size=10)

png

The ChargeDensity class

The ChargeDensity object can use the from_file construction method from pymatgen.io.vasp.outputs.Chgcar as shown below.

```python from pymatgen.io.vasp import Chgcar from pyrho.charge_density import ChargeDensity

cdenuc = ChargeDensity.fromfile( "../testfiles/CHGCAR.uc.vasp" ) cdensc = ChargeDensity.fromfile( "../testfiles/CHGCAR.sc1.vasp" ) chgcarsc = Chgcar.fromfile( "../testfiles/CHGCAR.sc1.vasp" ) cdentransformed = cdenuc.gettransformed( [[1, 1, 0], [1, -1, 0], [0, 0, 1]], gridout=cdensc.gridshape, upsample=2, )

```

The normalized_data property contains a dictionary keyed with the same keys as Chgcar.data (typically "total" and "diff" for spin charge densities). This quantity is the fixed scalar field that should remain fixed after the transformation.

```python data = cdenuc.normalizeddata["total"] print( f"The normalized charge density data is has a range of {data.min():0.3f} --> {data.max():0.3f} e-/Ang^3" )

```

The normalized charge density data is has a range of -0.188 --> 0.572 e-/Ang^3

Note that the PAW transformation sometimes results in negative charge densities.

```python transdata = cdentransformed.normalizeddata["total"] print( f"The transformed normalized charge density data is has a range of {transdata.min():0.3f} --> {trans_data.max():0.3f} e-/Ang^3" )

```

The transformed normalized charge density data is has a range of -0.188 --> 0.572 e-/Ang^3

```python scdata = cdensc.normalizeddata["total"] print( f"The reference normalized charge density data is has a range of {scdata.min():0.3f} --> {sc_data.max():0.3f} e-/Ang^3" )

```

The reference normalized charge density data is has a range of -0.188 --> 0.570 e-/Ang^3

Credits

Jimmy-Xuan Shen: Project lead

Wennie Wang: For naming the package

Owner

  • Name: Materials Project
  • Login: materialsproject
  • Kind: organization
  • Email: feedback@materialsproject.org
  • Location: 1 Cyclotron Rd, Berkeley CA 94720

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: mp-pyrho
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Jimmy-Xuan
    family-names: Shen
    email: jmmshn@gmail.com
    orcid: 'https://orcid.org/0000-0002-2743-7531'

GitHub Events

Total
  • Create event: 8
  • Issues event: 1
  • Release event: 1
  • Watch event: 2
  • Delete event: 8
  • Issue comment event: 11
  • Push event: 30
  • Pull request event: 14
  • Fork event: 2
Last Year
  • Create event: 8
  • Issues event: 1
  • Release event: 1
  • Watch event: 2
  • Delete event: 8
  • Issue comment event: 11
  • Push event: 30
  • Pull request event: 14
  • Fork event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 244
  • Total Committers: 9
  • Avg Commits per committer: 27.111
  • Development Distribution Score (DDS): 0.213
Past Year
  • Commits: 5
  • Committers: 2
  • Avg Commits per committer: 2.5
  • Development Distribution Score (DDS): 0.2
Top Committers
Name Email Commits
jmmshn j****n@g****m 192
dependabot[bot] 4****] 33
Shyam Dwaraknath s****d@l****v 5
Patrick Huck p****k@l****v 4
Jason Munro j****o@l****v 4
@jmmshn l****k@p****n 3
Seán Kavanagh 5****e 1
Matthew Horton m****n 1
materialsproject f****k@m****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 125
  • Average time to close issues: 10 days
  • Average time to close pull requests: 28 days
  • Total issue authors: 3
  • Total pull request authors: 6
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.88
  • Merged pull requests: 41
  • Bot issues: 0
  • Bot pull requests: 115
Past Year
  • Issues: 1
  • Pull requests: 15
  • Average time to close issues: N/A
  • Average time to close pull requests: 20 days
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.73
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 14
Top Authors
Issue Authors
  • Masonavic (1)
  • Andrew-S-Rosen (1)
  • sgbaird (1)
Pull Request Authors
  • dependabot[bot] (111)
  • jmmshn (7)
  • github-actions[bot] (4)
  • mat-elisee (1)
  • munrojm (1)
  • kavanase (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (115) python (83) github_actions (7)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 211,171 last-month
  • Total dependent packages: 3
  • Total dependent repositories: 1
  • Total versions: 23
  • Total maintainers: 1
pypi.org: mp-pyrho

Tools for re-griding periodic volumetric quantum chemistry data for machine-learning purposes.

  • Versions: 23
  • Dependent Packages: 3
  • Dependent Repositories: 1
  • Downloads: 211,171 Last month
Rankings
Dependent packages count: 3.1%
Average: 14.3%
Downloads: 18.1%
Dependent repos count: 21.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/checkout v2 composite
  • actions/setup-python v3 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/testing.yml actions
  • actions/cache v2 composite
  • actions/checkout v2.3.4 composite
  • actions/checkout v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
  • actions/setup-python v3 composite
  • actions/setup-python v2.2.2 composite
  • actions/upload-artifact v1 composite
  • codecov/codecov-action v1 composite
  • openjournals/openjournals-draft-action master composite
  • peaceiris/actions-gh-pages v3 composite
.github/workflows/update-precommit.yml actions
  • actions/checkout v2.3.4 composite
  • actions/setup-python v2.2.2 composite
  • peter-evans/create-pull-request v3 composite
pyproject.toml pypi
  • pymatgen >=2022.9.21