MatGraphDB
Table of Contents
Introduction to MatGraphDB
To be written..
Installing
Installing via pip
pip install matgraphdb
Installing from github
git clone https://github.com/lllangWV/MatGraphDB.git
cd MatGraphDB
pip install -e .
Usage
Interacting with the materials database.
Initialize MatGraphDB
from matgraphdb import MatGraphDB
# Initialize MatGraphDB
mgdb = MatGraphDB(storage_path="MatGraphDB")
print(mgdb.summary())
Adding material properties
You can add any material to the database by either providing a structure or coords, species, and lattice, then using the create_material or create_materials function.
Any material add to the database gets indexed. This is stored in the id column.
from pymatgen.core import Structure
# Add material to the database
material_data_1 = {
"structure": structure,
"properties": {
"material_id": "mp-1",
"source": "example",
"thermal_conductivity": {"value": 2.5, "unit": "W/mK"},
},
}
# or by coords, species, lattice
material_data_2 = {
"coords": [[0, 0, 0], [0.5, 0.5, 0.5]],
"species": ["Mg", "O"],
"lattice": [[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
"properties": {
"material_id": "mp-2",
"source": "example_manual",
"band_gap": {"value": 1.2, "unit": "eV"},
},
}
result = mgdb.create_material(
coords=material_data_2["coords"],
species=material_data_2["species"],
lattice=material_data_2["lattice"],
properties=material_data_2["properties"],
)
# Add material by structure
db.create_material(
structure=material_data_1["structure"],
properties=material_data_1["properties"])
materials=[material_data_1,material_data_2]
# Add multiple materials
mgdb.create_materials(materials)
Reading Materials
To read materials from the database, you can use the read_materials function. This function takes in a columns parameter, which specifies the columns to read from the database. The filters parameter specifies the filters to apply to the database. This will only read the matched materials to memory.
materials = mgdb.read_materials(
columns=["material_id", "elements", "band_gap.value"],
filters=[pc.field("band_gap.value") == 1.2]
)
Updating Materials
To update materials in the database, you can use the update_materials function. For updates you must provide the id of the material you want to update. You can also provide the update_keys parameter to specify the columns to update on as well, this is usefull if you import an existing dataset from another database.
update_data = [
{
"id": 0,
"band_gap": {"value": 3.6, "unit": "eV"},
},
]
materials = mgdb.update_materials(update_data)
update_data = [
{
"material_id": "mp-1",
"band_gap": {"value": 3.6, "unit": "eV"},
},
]
materials = mgdb.update_materials(update_data, update_keys=["material_id"])
Deleting Materials
To delete materials from the database, you can use the delete_materials function. You can provide a list of ids to delete.
materials = mgdb.delete_materials(ids=[0])
Interacting with the graph database
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Authors
Logan Lang, Aldo Romero, Eduardo Hernandez,
Note: This project is in its initial stages. Features and APIs are subject to change. Please refer to the latest documentation and release notes for updates.
Metadata
Release files for matgraphdb 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| matgraphdb-0.3.0.tar.gz | 14.5 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| matgraphdb-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 MB
Release files / matgraphdb-0.3.0.tar.gz
| Download URL | matgraphdb-0.3.0.tar.gz |
|---|---|
| Size | 14.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1073d558b88b57ef6c563f0648cc524fcdeb7a181b0062dc0489d8ccb794104c
|
|
BLAKE2b-256 checksum How to use checksums |
afe07477f8a067d0f1b092b7a362da45b5d93d1f717226f35dd558193e14f8b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / matgraphdb-0.3.0-py3-none-any.whl
| Download URL | matgraphdb-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96924364e18f78a6b5345458ff643ee7cde2b8cde77874cebfceb28cbf2e1e65
|
|
BLAKE2b-256 checksum How to use checksums |
eec349c1174ecee3daaa7effcb2e16be2059c84418159288c85eafe13beb78e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Security for matgraphdb 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.