Building a MatGraphDB Example with MPNearHull Data¶
In this notebook, we demonstrate how to build a materials graph database using the MatGraphDB framework with the MPNearHull dataset.
The steps include:
Importing required libraries and setting up configuration paths.
Downloading and extracting the dataset (and raw materials data if needed).
Creating a MatGraphDB instance.
Initializing node generators.
Initializing edge generators.
Verifying the database setup.
Follow along and run each cell to see how the database is constructed.
Setup¶
[3]:
import os
import shutil
import zipfile
import gdown
# Get the data directory from the config. You can change this to your own data directory.
DATA_DIR = os.path.join("..","..","data","examples","01")
# Define the path to store the raw materials data.
MATERIALS_PATH = os.path.join(DATA_DIR, "material")
MATGRAPHDB_PATH = os.path.join(DATA_DIR, "MatGraphDB")
# Define the dataset URLs.
DATASET_URL = "https://drive.google.com/uc?id=1zSmEQbV8pNvjWdhFuCwOeoOzvfoS5XKP"
# Define the URL for the raw materials data.
RAW_DATASET_URL = "https://drive.google.com/uc?id=14guJqEK242XgRGEZA-zIrWyg4b-gX5zk" # (Not used below but available)
# # Define the path to store the raw materials data.
# RAW_DATASET_ZIP = os.path.join(config.data_dir, "raw", "MPNearHull_v0.0.1_raw.zip")
# # Define the path to store the dataset.
# DATASET_ZIP = os.path.join(config.data_dir, "datasets", "MPNearHull_v0.0.1.zip")
print("Library imports and paths are set.")
Library imports and paths are set.
Define Function for Downloading and Extracting Data¶
[ ]:
def download_raw_materials(mp_materials_path):
"""
Download and extract the raw materials data if it is not already present.
"""
if not os.path.exists(mp_materials_path):
os.makedirs(mp_materials_path, exist_ok=True)
print("Downloading raw materials data...")
raw_dataset_zip = os.path.join(mp_materials_path, "MPNearHull_v0.0.1_raw.zip")
# Note: Here we use DATASET_URL as in the original code.
gdown.download(DATASET_URL, output=raw_dataset_zip, quiet=False)
print("Extracting raw materials data...")
with zipfile.ZipFile(raw_dataset_zip, "r") as zip_ref:
zip_ref.extractall(mp_materials_path)
files=os.listdir(mp_materials_path)
os.remove(raw_dataset_zip)
mp_nearhull_path = os.path.join(mp_materials_path, "MPNearHull")
tmp_materials_path = os.path.join(mp_nearhull_path, "nodes", "material")
materials_files = os.listdir(tmp_materials_path)
for file in materials_files:
shutil.move(os.path.join(tmp_materials_path, file), os.path.join(mp_materials_path, file))
shutil.rmtree(mp_nearhull_path)
print("Raw materials data ready!")
# Optionally, download the raw materials data if you plan to initialize from raw files.
if not os.path.exists(MATERIALS_PATH):
download_raw_materials(MATERIALS_PATH)
else:
print("Raw materials data already exists.")
Downloading raw materials data...
Downloading...
From (original): https://drive.google.com/uc?id=1zSmEQbV8pNvjWdhFuCwOeoOzvfoS5XKP
From (redirected): https://drive.google.com/uc?id=1zSmEQbV8pNvjWdhFuCwOeoOzvfoS5XKP&confirm=t&uuid=5bcba796-ff8e-4bb3-bc09-39d3f1136dc1
To: c:\Users\lllang\Desktop\Current_Projects\MatGraphDB\examples\notebooks\materials\MPNearHull_v0.0.1_raw.zip
100%|██████████| 632M/632M [00:11<00:00, 53.6MB/s]
Extracting raw materials data...
Raw materials data ready!
Initialization¶
Initialize a Materials Store¶
[4]:
from matgraphdb import MaterialStore
materials_store = MaterialStore(storage_path=MATERIALS_PATH)
print(materials_store)
============================================================
NODE STORE SUMMARY
============================================================
Node type: material
• Number of nodes: 80643
• Number of features: 136
Storage path: ..\..\data\examples\01\material
############################################################
METADATA
############################################################
• class: MaterialStore
• class_module: matgraphdb.materials.nodes.materials
• node_type: material
• name_column: id
############################################################
NODE DETAILS
############################################################
Initialize a MatGraphDB Instance¶
[5]:
from matgraphdb import MatGraphDB
if not os.path.exists(MATGRAPHDB_PATH):
shutil.rmtree(MATGRAPHDB_PATH)
mdb = MatGraphDB(storage_path=MATGRAPHDB_PATH,materials_store=materials_store)
print(mdb)
============================================================
GRAPH DATABASE SUMMARY
============================================================
Name: MatGraphDB
Storage path: ..\..\data\examples\01\MatGraphDB
└── Repository structure:
├── nodes/ (..\..\data\examples\01\MatGraphDB\nodes)
├── edges/ (..\..\data\examples\01\MatGraphDB\edges)
├── edge_generators/ (..\..\data\examples\01\MatGraphDB\edge_generators)
├── node_generators/ (..\..\data\examples\01\MatGraphDB\node_generators)
└── graph/ (..\..\data\examples\01\MatGraphDB\graph)
############################################################
NODE DETAILS
############################################################
Total node types: 1
------------------------------------------------------------
• Node type: material
- Number of nodes: 80643
- Number of features: 136
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material
------------------------------------------------------------
############################################################
EDGE DETAILS
############################################################
Total edge types: 0
------------------------------------------------------------
############################################################
NODE GENERATOR DETAILS
############################################################
Total node generators: 0
------------------------------------------------------------
############################################################
EDGE GENERATOR DETAILS
############################################################
Total edge generators: 0
------------------------------------------------------------
Adding Nodes¶
In this section, we will add the nodes to the MatGraphDB instance. We will be using some of the built-in node generators to add the nodes to the MatGraphDB instance.
[6]:
from matgraphdb.materials.nodes import (
element, chemenv, crystal_system, magnetic_state,
oxidation_state, space_group, wyckoff, material_site, material_lattice
)
# Here we define the generator functions and arguments if they are needed.
# For instance, to get the materials sites and lattices, we need to pass the materials store to the generator function.
node_generators = [
{"generator_func": element},
{"generator_func": chemenv},
{"generator_func": crystal_system},
{"generator_func": magnetic_state},
{"generator_func": oxidation_state},
{"generator_func": space_group},
{"generator_func": wyckoff},
{
"generator_func": material_site,
"generator_args": {"material_store": mdb.node_stores["material"]},
},
{
"generator_func": material_lattice,
"generator_args": {"material_store": mdb.node_stores["material"]},
},
]
Now we can add the node generators to the MatGraphDB instance. When we add the generator, it will immediately execute and add the nodes to the database.
[7]:
# Add each node generator to the database.
for generator in node_generators:
generator_func = generator.get("generator_func")
generator_args = generator.get("generator_args", None)
print(f"Adding node generator: {generator_func.__name__}")
mdb.add_node_generator(generator_func=generator_func, generator_args=generator_args)
print("Node generators have been initialized.")
print(mdb)
Adding node generator: element
Adding node generator: chemenv
Adding node generator: crystal_system
Adding node generator: magnetic_state
Adding node generator: oxidation_state
Adding node generator: space_group
Adding node generator: wyckoff
Adding node generator: material_site
Adding node generator: material_lattice
Node generators have been initialized.
============================================================
GRAPH DATABASE SUMMARY
============================================================
Name: MatGraphDB
Storage path: ..\..\data\examples\01\MatGraphDB
└── Repository structure:
├── nodes/ (..\..\data\examples\01\MatGraphDB\nodes)
├── edges/ (..\..\data\examples\01\MatGraphDB\edges)
├── edge_generators/ (..\..\data\examples\01\MatGraphDB\edge_generators)
├── node_generators/ (..\..\data\examples\01\MatGraphDB\node_generators)
└── graph/ (..\..\data\examples\01\MatGraphDB\graph)
############################################################
NODE DETAILS
############################################################
Total node types: 10
------------------------------------------------------------
• Node type: material
- Number of nodes: 80643
- Number of features: 136
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material
------------------------------------------------------------
• Node type: element
- Number of nodes: 118
- Number of features: 99
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\element
------------------------------------------------------------
• Node type: chemenv
- Number of nodes: 67
- Number of features: 15
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
------------------------------------------------------------
• Node type: crystal_system
- Number of nodes: 7
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
------------------------------------------------------------
• Node type: magnetic_state
- Number of nodes: 5
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\magnetic_state
------------------------------------------------------------
• Node type: oxidation_state
- Number of nodes: 19
- Number of features: 3
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\oxidation_state
------------------------------------------------------------
• Node type: space_group
- Number of nodes: 230
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\space_group
------------------------------------------------------------
• Node type: wyckoff
- Number of nodes: 1380
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\wyckoff
------------------------------------------------------------
• Node type: material_site
- Number of nodes: 2545026
- Number of features: 15
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material_site
------------------------------------------------------------
• Node type: material_lattice
- Number of nodes: 80643
- Number of features: 12
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material_lattice
------------------------------------------------------------
############################################################
EDGE DETAILS
############################################################
Total edge types: 0
------------------------------------------------------------
############################################################
NODE GENERATOR DETAILS
############################################################
Total node generators: 9
------------------------------------------------------------
• Generator: element
Generator Args:
- generator_func: [<function element at 0x000001E1A2C82C10>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
- generator_name: ['element']
- id: [0]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
------------------------------------------------------------
• Generator: chemenv
Generator Args:
- generator_func: [<function chemenv at 0x000001E1A2C82D30>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\coordination_geometries.parquet']
- generator_name: ['chemenv']
- id: [1]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\coordination_geometries.parquet']
------------------------------------------------------------
• Generator: crystal_system
Generator Args:
- generator_func: [<function crystal_system at 0x000001E1A2C82E50>]
- generator_name: ['crystal_system']
- id: [2]
Generator Kwargs:
------------------------------------------------------------
• Generator: magnetic_state
Generator Args:
- generator_func: [<function magnetic_state at 0x000001E1A2C82F70>]
- generator_name: ['magnetic_state']
- id: [3]
Generator Kwargs:
------------------------------------------------------------
• Generator: oxidation_state
Generator Args:
- generator_func: [<function oxidation_state at 0x000001E1A2C8D0D0>]
- generator_name: ['oxidation_state']
- id: [4]
Generator Kwargs:
------------------------------------------------------------
• Generator: space_group
Generator Args:
- generator_func: [<function space_group at 0x000001E1A2C8D1F0>]
- generator_name: ['space_group']
- id: [5]
Generator Kwargs:
------------------------------------------------------------
• Generator: wyckoff
Generator Args:
- generator_func: [<function wyckoff at 0x000001E1A2C8D310>]
- generator_name: ['wyckoff']
- id: [6]
Generator Kwargs:
------------------------------------------------------------
• Generator: material_site
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- generator_func: [<function material_site at 0x000001E1C487D940>]
- generator_name: ['material_site']
- id: [7]
Generator Kwargs:
------------------------------------------------------------
• Generator: material_lattice
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- generator_func: [<function material_lattice at 0x000001E1C487D820>]
- generator_name: ['material_lattice']
- id: [8]
Generator Kwargs:
------------------------------------------------------------
############################################################
EDGE GENERATOR DETAILS
############################################################
Total edge generators: 0
------------------------------------------------------------
Adding Edges¶
In this section, we will add the edges to the MatGraphDB instance. We will be using some of the built-in edge generators to add the edges to the MatGraphDB instance.
[8]:
from matgraphdb.materials.edges import (
material_element_has,
material_lattice_has,
material_spg_has,
element_element_neighborsByGroupPeriod,
element_element_bonds,
element_oxiState_canOccur,
material_chemenv_containsSite,
material_crystalSystem_has,
element_chemenv_canOccur,
spg_crystalSystem_isApart,
)
# List of edge generator configurations.
edge_generators = [
{
"generator_func": element_element_neighborsByGroupPeriod,
"generator_args": {"element_store": mdb.node_stores["element"]},
},
{
"generator_func": element_oxiState_canOccur,
"generator_args": {
"element_store": mdb.node_stores["element"],
"oxiState_store": mdb.node_stores["oxidation_state"],
},
},
{
"generator_func": material_chemenv_containsSite,
"generator_args": {
"material_store": mdb.node_stores["material"],
"chemenv_store": mdb.node_stores["chemenv"],
},
},
{
"generator_func": material_crystalSystem_has,
"generator_args": {
"material_store": mdb.node_stores["material"],
"crystal_system_store": mdb.node_stores["crystal_system"],
},
},
{
"generator_func": material_element_has,
"generator_args": {
"material_store": mdb.node_stores["material"],
"element_store": mdb.node_stores["element"],
},
},
{
"generator_func": material_lattice_has,
"generator_args": {
"material_store": mdb.node_stores["material"],
"lattice_store": mdb.node_stores["material_lattice"],
},
},
{
"generator_func": material_spg_has,
"generator_args": {
"material_store": mdb.node_stores["material"],
"spg_store": mdb.node_stores["space_group"],
},
},
{
"generator_func": element_chemenv_canOccur,
"generator_args": {
"element_store": mdb.node_stores["element"],
"chemenv_store": mdb.node_stores["chemenv"],
"material_store": mdb.node_stores["material"],
},
},
{
"generator_func": spg_crystalSystem_isApart,
"generator_args": {
"spg_store": mdb.node_stores["space_group"],
"crystal_system_store": mdb.node_stores["crystal_system"],
},
},
{
"generator_func": element_element_bonds,
"generator_args": {
"element_store": mdb.node_stores["element"],
"material_store": mdb.node_stores["material"],
},
},
]
# Add each edge generator to the database and run them immediately.
for generator in edge_generators:
generator_func = generator.get("generator_func")
generator_args = generator.get("generator_args", None)
print(f"Adding edge generator: {generator_func.__name__}")
mdb.add_edge_generator(generator_func=generator_func, generator_args=generator_args, run_immediately=True)
print("Edge generators have been initialized.")
print(mdb)
Adding edge generator: element_element_neighborsByGroupPeriod
Adding edge generator: element_oxiState_canOccur
Adding edge generator: material_chemenv_containsSite
Adding edge generator: material_crystalSystem_has
Adding edge generator: material_element_has
Adding edge generator: material_lattice_has
Adding edge generator: material_spg_has
Adding edge generator: element_chemenv_canOccur
Adding edge generator: spg_crystalSystem_isApart
Adding edge generator: element_element_bonds
Edge generators have been initialized.
============================================================
GRAPH DATABASE SUMMARY
============================================================
Name: MatGraphDB
Storage path: ..\..\data\examples\01\MatGraphDB
└── Repository structure:
├── nodes/ (..\..\data\examples\01\MatGraphDB\nodes)
├── edges/ (..\..\data\examples\01\MatGraphDB\edges)
├── edge_generators/ (..\..\data\examples\01\MatGraphDB\edge_generators)
├── node_generators/ (..\..\data\examples\01\MatGraphDB\node_generators)
└── graph/ (..\..\data\examples\01\MatGraphDB\graph)
############################################################
NODE DETAILS
############################################################
Total node types: 10
------------------------------------------------------------
• Node type: material
- Number of nodes: 80643
- Number of features: 136
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material
------------------------------------------------------------
• Node type: element
- Number of nodes: 118
- Number of features: 99
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\element
------------------------------------------------------------
• Node type: chemenv
- Number of nodes: 67
- Number of features: 15
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
------------------------------------------------------------
• Node type: crystal_system
- Number of nodes: 7
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
------------------------------------------------------------
• Node type: magnetic_state
- Number of nodes: 5
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\magnetic_state
------------------------------------------------------------
• Node type: oxidation_state
- Number of nodes: 19
- Number of features: 3
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\oxidation_state
------------------------------------------------------------
• Node type: space_group
- Number of nodes: 230
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\space_group
------------------------------------------------------------
• Node type: wyckoff
- Number of nodes: 1380
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\wyckoff
------------------------------------------------------------
• Node type: material_site
- Number of nodes: 2545026
- Number of features: 15
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material_site
------------------------------------------------------------
• Node type: material_lattice
- Number of nodes: 80643
- Number of features: 12
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material_lattice
------------------------------------------------------------
############################################################
EDGE DETAILS
############################################################
Total edge types: 10
------------------------------------------------------------
• Edge type: element_element_neighborsByGroupPeriod
- Number of edges: 391
- Number of features: 14
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_element_neighborsByGroupPeriod
------------------------------------------------------------
• Edge type: element_oxiState_canOccur
- Number of edges: 162
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_oxiState_canOccur
------------------------------------------------------------
• Edge type: material_chemenv_containsSite
- Number of edges: 2542897
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_chemenv_containsSite
------------------------------------------------------------
• Edge type: material_crystalSystem_has
- Number of edges: 80643
- Number of features: 10
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_crystalSystem_has
------------------------------------------------------------
• Edge type: material_element_has
- Number of edges: 270902
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_element_has
------------------------------------------------------------
• Edge type: material_lattice_has
- Number of edges: 80643
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_lattice_has
------------------------------------------------------------
• Edge type: material_spg_has
- Number of edges: 80643
- Number of features: 10
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_spg_has
------------------------------------------------------------
• Edge type: element_chemenv_canOccur
- Number of edges: 270474
- Number of features: 7
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_chemenv_canOccur
------------------------------------------------------------
• Edge type: spg_crystalSystem_isApart
- Number of edges: 230
- Number of features: 7
- db_path: ..\..\data\examples\01\MatGraphDB\edges\spg_crystalSystem_isApart
------------------------------------------------------------
• Edge type: element_element_bonds
- Number of edges: 3069943
- Number of features: 7
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_element_bonds
------------------------------------------------------------
############################################################
NODE GENERATOR DETAILS
############################################################
Total node generators: 9
------------------------------------------------------------
• Generator: element
Generator Args:
- generator_func: [<function element at 0x000001E1A2C82C10>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
- generator_name: ['element']
- id: [0]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
------------------------------------------------------------
• Generator: chemenv
Generator Args:
- generator_func: [<function chemenv at 0x000001E1A2C82D30>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\coordination_geometries.parquet']
- generator_name: ['chemenv']
- id: [1]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\coordination_geometries.parquet']
------------------------------------------------------------
• Generator: crystal_system
Generator Args:
- generator_func: [<function crystal_system at 0x000001E1A2C82E50>]
- generator_name: ['crystal_system']
- id: [2]
Generator Kwargs:
------------------------------------------------------------
• Generator: magnetic_state
Generator Args:
- generator_func: [<function magnetic_state at 0x000001E1A2C82F70>]
- generator_name: ['magnetic_state']
- id: [3]
Generator Kwargs:
------------------------------------------------------------
• Generator: oxidation_state
Generator Args:
- generator_func: [<function oxidation_state at 0x000001E1A2C8D0D0>]
- generator_name: ['oxidation_state']
- id: [4]
Generator Kwargs:
------------------------------------------------------------
• Generator: space_group
Generator Args:
- generator_func: [<function space_group at 0x000001E1A2C8D1F0>]
- generator_name: ['space_group']
- id: [5]
Generator Kwargs:
------------------------------------------------------------
• Generator: wyckoff
Generator Args:
- generator_func: [<function wyckoff at 0x000001E1A2C8D310>]
- generator_name: ['wyckoff']
- id: [6]
Generator Kwargs:
------------------------------------------------------------
• Generator: material_site
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- generator_func: [<function material_site at 0x000001E1C487D940>]
- generator_name: ['material_site']
- id: [7]
Generator Kwargs:
------------------------------------------------------------
• Generator: material_lattice
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- generator_func: [<function material_lattice at 0x000001E1C487D820>]
- generator_name: ['material_lattice']
- id: [8]
Generator Kwargs:
------------------------------------------------------------
############################################################
EDGE GENERATOR DETAILS
############################################################
Total edge generators: 10
------------------------------------------------------------
• Generator: element_oxiState_canOccur
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- oxiState_store: ..\..\data\examples\01\MatGraphDB\nodes\oxidation_state
Generator Kwargs:
------------------------------------------------------------
• Generator: material_chemenv_containsSite
Generator Args:
- chemenv_store: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: material_crystalSystem_has
Generator Args:
- crystal_system_store: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: element_element_neighborsByGroupPeriod
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
Generator Kwargs:
------------------------------------------------------------
• Generator: material_element_has
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: material_lattice_has
Generator Args:
- lattice_store: ..\..\data\examples\01\MatGraphDB\nodes\material_lattice
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: material_spg_has
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- spg_store: ..\..\data\examples\01\MatGraphDB\nodes\space_group
Generator Kwargs:
------------------------------------------------------------
• Generator: element_chemenv_canOccur
Generator Args:
- chemenv_store: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: spg_crystalSystem_isApart
Generator Args:
- crystal_system_store: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
- spg_store: ..\..\data\examples\01\MatGraphDB\nodes\space_group
Generator Kwargs:
------------------------------------------------------------
• Generator: element_element_bonds
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
Verifying the Database¶
[9]:
print(mdb)
============================================================
GRAPH DATABASE SUMMARY
============================================================
Name: MatGraphDB
Storage path: ..\..\data\examples\01\MatGraphDB
└── Repository structure:
├── nodes/ (..\..\data\examples\01\MatGraphDB\nodes)
├── edges/ (..\..\data\examples\01\MatGraphDB\edges)
├── edge_generators/ (..\..\data\examples\01\MatGraphDB\edge_generators)
├── node_generators/ (..\..\data\examples\01\MatGraphDB\node_generators)
└── graph/ (..\..\data\examples\01\MatGraphDB\graph)
############################################################
NODE DETAILS
############################################################
Total node types: 10
------------------------------------------------------------
• Node type: material
- Number of nodes: 80643
- Number of features: 136
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material
------------------------------------------------------------
• Node type: element
- Number of nodes: 118
- Number of features: 99
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\element
------------------------------------------------------------
• Node type: chemenv
- Number of nodes: 67
- Number of features: 15
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
------------------------------------------------------------
• Node type: crystal_system
- Number of nodes: 7
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
------------------------------------------------------------
• Node type: magnetic_state
- Number of nodes: 5
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\magnetic_state
------------------------------------------------------------
• Node type: oxidation_state
- Number of nodes: 19
- Number of features: 3
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\oxidation_state
------------------------------------------------------------
• Node type: space_group
- Number of nodes: 230
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\space_group
------------------------------------------------------------
• Node type: wyckoff
- Number of nodes: 1380
- Number of features: 2
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\wyckoff
------------------------------------------------------------
• Node type: material_site
- Number of nodes: 2545026
- Number of features: 15
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material_site
------------------------------------------------------------
• Node type: material_lattice
- Number of nodes: 80643
- Number of features: 12
- db_path: ..\..\data\examples\01\MatGraphDB\nodes\material_lattice
------------------------------------------------------------
############################################################
EDGE DETAILS
############################################################
Total edge types: 10
------------------------------------------------------------
• Edge type: element_element_neighborsByGroupPeriod
- Number of edges: 391
- Number of features: 14
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_element_neighborsByGroupPeriod
------------------------------------------------------------
• Edge type: element_oxiState_canOccur
- Number of edges: 162
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_oxiState_canOccur
------------------------------------------------------------
• Edge type: material_chemenv_containsSite
- Number of edges: 2542897
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_chemenv_containsSite
------------------------------------------------------------
• Edge type: material_crystalSystem_has
- Number of edges: 80643
- Number of features: 10
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_crystalSystem_has
------------------------------------------------------------
• Edge type: material_element_has
- Number of edges: 270902
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_element_has
------------------------------------------------------------
• Edge type: material_lattice_has
- Number of edges: 80643
- Number of features: 8
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_lattice_has
------------------------------------------------------------
• Edge type: material_spg_has
- Number of edges: 80643
- Number of features: 10
- db_path: ..\..\data\examples\01\MatGraphDB\edges\material_spg_has
------------------------------------------------------------
• Edge type: element_chemenv_canOccur
- Number of edges: 270474
- Number of features: 7
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_chemenv_canOccur
------------------------------------------------------------
• Edge type: spg_crystalSystem_isApart
- Number of edges: 230
- Number of features: 7
- db_path: ..\..\data\examples\01\MatGraphDB\edges\spg_crystalSystem_isApart
------------------------------------------------------------
• Edge type: element_element_bonds
- Number of edges: 3069943
- Number of features: 7
- db_path: ..\..\data\examples\01\MatGraphDB\edges\element_element_bonds
------------------------------------------------------------
############################################################
NODE GENERATOR DETAILS
############################################################
Total node generators: 9
------------------------------------------------------------
• Generator: element
Generator Args:
- generator_func: [<function element at 0x000001E1A2C82C10>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
- generator_name: ['element']
- id: [0]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
------------------------------------------------------------
• Generator: chemenv
Generator Args:
- generator_func: [<function chemenv at 0x000001E1A2C82D30>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\coordination_geometries.parquet']
- generator_name: ['chemenv']
- id: [1]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\coordination_geometries.parquet']
------------------------------------------------------------
• Generator: crystal_system
Generator Args:
- generator_func: [<function crystal_system at 0x000001E1A2C82E50>]
- generator_name: ['crystal_system']
- id: [2]
Generator Kwargs:
------------------------------------------------------------
• Generator: magnetic_state
Generator Args:
- generator_func: [<function magnetic_state at 0x000001E1A2C82F70>]
- generator_name: ['magnetic_state']
- id: [3]
Generator Kwargs:
------------------------------------------------------------
• Generator: oxidation_state
Generator Args:
- generator_func: [<function oxidation_state at 0x000001E1A2C8D0D0>]
- generator_name: ['oxidation_state']
- id: [4]
Generator Kwargs:
------------------------------------------------------------
• Generator: space_group
Generator Args:
- generator_func: [<function space_group at 0x000001E1A2C8D1F0>]
- generator_name: ['space_group']
- id: [5]
Generator Kwargs:
------------------------------------------------------------
• Generator: wyckoff
Generator Args:
- generator_func: [<function wyckoff at 0x000001E1A2C8D310>]
- generator_name: ['wyckoff']
- id: [6]
Generator Kwargs:
------------------------------------------------------------
• Generator: material_site
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- generator_func: [<function material_site at 0x000001E1C487D940>]
- generator_name: ['material_site']
- id: [7]
Generator Kwargs:
------------------------------------------------------------
• Generator: material_lattice
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- generator_func: [<function material_lattice at 0x000001E1C487D820>]
- generator_name: ['material_lattice']
- id: [8]
Generator Kwargs:
------------------------------------------------------------
############################################################
EDGE GENERATOR DETAILS
############################################################
Total edge generators: 10
------------------------------------------------------------
• Generator: element_oxiState_canOccur
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- oxiState_store: ..\..\data\examples\01\MatGraphDB\nodes\oxidation_state
Generator Kwargs:
------------------------------------------------------------
• Generator: material_chemenv_containsSite
Generator Args:
- chemenv_store: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: material_crystalSystem_has
Generator Args:
- crystal_system_store: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: element_element_neighborsByGroupPeriod
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
Generator Kwargs:
------------------------------------------------------------
• Generator: material_element_has
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: material_lattice_has
Generator Args:
- lattice_store: ..\..\data\examples\01\MatGraphDB\nodes\material_lattice
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: material_spg_has
Generator Args:
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
- spg_store: ..\..\data\examples\01\MatGraphDB\nodes\space_group
Generator Kwargs:
------------------------------------------------------------
• Generator: element_chemenv_canOccur
Generator Args:
- chemenv_store: ..\..\data\examples\01\MatGraphDB\nodes\chemenv
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------
• Generator: spg_crystalSystem_isApart
Generator Args:
- crystal_system_store: ..\..\data\examples\01\MatGraphDB\nodes\crystal_system
- spg_store: ..\..\data\examples\01\MatGraphDB\nodes\space_group
Generator Kwargs:
------------------------------------------------------------
• Generator: element_element_bonds
Generator Args:
- element_store: ..\..\data\examples\01\MatGraphDB\nodes\element
- material_store: ..\..\data\examples\01\MatGraphDB\nodes\material
Generator Kwargs:
------------------------------------------------------------