Name | matgraphdb JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | Welcome to MatGraphDB, a powerful Python package designed to interface with primary and graph databases for advanced material analysis. |
upload_time | 2025-02-08 18:52:46 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2023 lllangWV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
materials
science
graph
database
python
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# MatGraphDB
## Table of Contents
- [Introduction to MatGraphDB](#introduction-to-matgraphdb)
- [Installing](#installing)
- [Usage](#usage)
- [Interacting with the materials database](#interacting-with-the-materials-database)
- [Interacting with the graph database](#interacting-with-the-graph-database)
- [Contributing](#contributing)
- [License](#license)
## Introduction to MatGraphDB
To be written..
## Installing
### Installing via pip
```bash
pip install matgraphdb
```
### Installing from github
```bash
git clone https://github.com/lllangWV/MatGraphDB.git
cd MatGraphDB
pip install -e .
```
## Usage
### Interacting with the materials database.
#### Initialize MatGraphDB
```python
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.
```python
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.
```python
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.
```python
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.
```python
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](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.*
Raw data
{
"_id": null,
"home_page": null,
"name": "matgraphdb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "materials, science, graph, database, python",
"author": null,
"author_email": "Logan Lang <lllang@mix.wvu.edu>",
"download_url": "https://files.pythonhosted.org/packages/af/e0/7477f8a067d0f1b092b7a362da45b5d93d1f717226f35dd558193e14f8b1/matgraphdb-0.3.0.tar.gz",
"platform": null,
"description": "# MatGraphDB\n\n\n\n## Table of Contents\n\n- [Introduction to MatGraphDB](#introduction-to-matgraphdb)\n- [Installing](#installing)\n- [Usage](#usage)\n - [Interacting with the materials database](#interacting-with-the-materials-database)\n - [Interacting with the graph database](#interacting-with-the-graph-database)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Introduction to MatGraphDB\nTo be written..\n\n## Installing\n\n### Installing via pip\n```bash\npip install matgraphdb\n```\n\n### Installing from github\n```bash\ngit clone https://github.com/lllangWV/MatGraphDB.git\ncd MatGraphDB\npip install -e .\n```\n\n\n\n## Usage\n\n### Interacting with the materials database.\n\n#### Initialize MatGraphDB\n```python\nfrom matgraphdb import MatGraphDB\n\n# Initialize MatGraphDB\nmgdb = MatGraphDB(storage_path=\"MatGraphDB\")\nprint(mgdb.summary())\n```\n\n#### Adding material properties\n\nYou 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. \n\nAny material add to the database gets indexed. This is stored in the `id` column.\n\n```python\nfrom pymatgen.core import Structure\n\n# Add material to the database\nmaterial_data_1 = {\n \"structure\": structure,\n \"properties\": {\n \"material_id\": \"mp-1\",\n \"source\": \"example\",\n \"thermal_conductivity\": {\"value\": 2.5, \"unit\": \"W/mK\"},\n },\n}\n\n# or by coords, species, lattice\nmaterial_data_2 = {\n \"coords\": [[0, 0, 0], [0.5, 0.5, 0.5]],\n \"species\": [\"Mg\", \"O\"],\n \"lattice\": [[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],\n \"properties\": {\n \"material_id\": \"mp-2\",\n \"source\": \"example_manual\",\n \"band_gap\": {\"value\": 1.2, \"unit\": \"eV\"},\n },\n}\n\nresult = mgdb.create_material(\n coords=material_data_2[\"coords\"],\n species=material_data_2[\"species\"],\n lattice=material_data_2[\"lattice\"],\n properties=material_data_2[\"properties\"],\n)\n# Add material by structure\ndb.create_material(\n structure=material_data_1[\"structure\"],\n properties=material_data_1[\"properties\"])\n\n\nmaterials=[material_data_1,material_data_2]\n\n# Add multiple materials\nmgdb.create_materials(materials)\n\n```\n\n#### Reading Materials\n \nTo 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.\n\n```python\nmaterials = mgdb.read_materials( \n columns=[\"material_id\", \"elements\", \"band_gap.value\"],\n filters=[pc.field(\"band_gap.value\") == 1.2]\n )\n```\n\n#### Updating Materials\n\nTo 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.\n\n```python\nupdate_data = [\n {\n \"id\": 0,\n \"band_gap\": {\"value\": 3.6, \"unit\": \"eV\"},\n },\n]\n\nmaterials = mgdb.update_materials(update_data)\n\n\nupdate_data = [\n {\n \"material_id\": \"mp-1\",\n \"band_gap\": {\"value\": 3.6, \"unit\": \"eV\"},\n },\n]\nmaterials = mgdb.update_materials(update_data, update_keys=[\"material_id\"])\n```\n\n#### Deleting Materials\n\nTo delete materials from the database, you can use the `delete_materials` function. You can provide a list of `ids` to delete.\n\n```python\nmaterials = mgdb.delete_materials(ids=[0])\n```\n\n### Interacting with the graph database\n\n\n\n\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on GitHub.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n\n## Authors\nLogan Lang,\nAldo Romero,\nEduardo Hernandez,\n\n\n---\n\n*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.*\n\n\n\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2023 lllangWV\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "Welcome to MatGraphDB, a powerful Python package designed to interface with primary and graph databases for advanced material analysis.",
"version": "0.3.0",
"project_urls": {
"Changelog": "https://github.com/romerogroup/MatGraphDB/CHANGELOG.md",
"Issues": "https://github.com/romerogroup/MatGraphDB/issues",
"Repository": "https://github.com/romerogroup/MatGraphDB"
},
"split_keywords": [
"materials",
" science",
" graph",
" database",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "eec349c1174ecee3daaa7effcb2e16be2059c84418159288c85eafe13beb78e3",
"md5": "2d92eab1c149a8b4e6307a88dd937292",
"sha256": "96924364e18f78a6b5345458ff643ee7cde2b8cde77874cebfceb28cbf2e1e65"
},
"downloads": -1,
"filename": "matgraphdb-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d92eab1c149a8b4e6307a88dd937292",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7644889,
"upload_time": "2025-02-08T18:52:43",
"upload_time_iso_8601": "2025-02-08T18:52:43.418281Z",
"url": "https://files.pythonhosted.org/packages/ee/c3/49c1174ecee3daaa7effcb2e16be2059c84418159288c85eafe13beb78e3/matgraphdb-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "afe07477f8a067d0f1b092b7a362da45b5d93d1f717226f35dd558193e14f8b1",
"md5": "06bd560b9fee0c4840ee1834d0ba91c7",
"sha256": "1073d558b88b57ef6c563f0648cc524fcdeb7a181b0062dc0489d8ccb794104c"
},
"downloads": -1,
"filename": "matgraphdb-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "06bd560b9fee0c4840ee1834d0ba91c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 14510140,
"upload_time": "2025-02-08T18:52:46",
"upload_time_iso_8601": "2025-02-08T18:52:46.778523Z",
"url": "https://files.pythonhosted.org/packages/af/e0/7477f8a067d0f1b092b7a362da45b5d93d1f717226f35dd558193e14f8b1/matgraphdb-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-08 18:52:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "romerogroup",
"github_project": "MatGraphDB",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "matgraphdb"
}