[1]:
!pip install matgraphdb
!pip install ipykernel
Requirement already satisfied: matgraphdb in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (0.0.3)
Requirement already satisfied: pytest in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (8.3.4)
Requirement already satisfied: setuptools in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (75.1.0)
Requirement already satisfied: setuptools_scm in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (8.1.0)
Requirement already satisfied: python-dotenv in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (1.0.1)
Requirement already satisfied: numpy in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (1.26.4)
Requirement already satisfied: pandas in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (2.2.3)
Requirement already satisfied: scipy in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (1.13.1)
Requirement already satisfied: matplotlib in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (3.9.4)
Requirement already satisfied: seaborn in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (0.13.2)
Requirement already satisfied: pyyaml in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (6.0.2)
Requirement already satisfied: jupyterlab in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (4.3.3)
Requirement already satisfied: nglview in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (3.1.4)
Requirement already satisfied: ipywidgets in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (8.1.5)
Requirement already satisfied: pylint in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (3.3.2)
Requirement already satisfied: autopep8 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (2.3.1)
Requirement already satisfied: pymatgen in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (2024.8.9)
Requirement already satisfied: parquetdb in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (0.23.4)
Requirement already satisfied: variconfig in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matgraphdb) (0.0.3)
Requirement already satisfied: pycodestyle>=2.12.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from autopep8->matgraphdb) (2.12.1)
Requirement already satisfied: tomli in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from autopep8->matgraphdb) (2.2.1)
Requirement already satisfied: comm>=0.1.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipywidgets->matgraphdb) (0.2.2)
Requirement already satisfied: ipython>=6.1.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipywidgets->matgraphdb) (8.18.1)
Requirement already satisfied: traitlets>=4.3.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipywidgets->matgraphdb) (5.14.3)
Requirement already satisfied: widgetsnbextension~=4.0.12 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipywidgets->matgraphdb) (4.0.13)
Requirement already satisfied: jupyterlab-widgets~=3.0.12 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipywidgets->matgraphdb) (3.0.13)
Requirement already satisfied: async-lru>=1.0.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (2.0.4)
Requirement already satisfied: httpx>=0.25.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (0.28.1)
Requirement already satisfied: importlib-metadata>=4.8.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (8.5.0)
Requirement already satisfied: ipykernel>=6.5.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (6.29.5)
Requirement already satisfied: jinja2>=3.0.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (3.1.4)
Requirement already satisfied: jupyter-core in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (5.7.2)
Requirement already satisfied: jupyter-lsp>=2.0.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (2.2.5)
Requirement already satisfied: jupyter-server<3,>=2.4.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (2.14.2)
Requirement already satisfied: jupyterlab-server<3,>=2.27.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (2.27.3)
Requirement already satisfied: notebook-shim>=0.2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (0.2.4)
Requirement already satisfied: packaging in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (24.2)
Requirement already satisfied: tornado>=6.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab->matgraphdb) (6.4.2)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (1.3.0)
Requirement already satisfied: cycler>=0.10 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (4.55.3)
Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (1.4.7)
Requirement already satisfied: pillow>=8 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (11.0.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (3.2.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (2.9.0.post0)
Requirement already satisfied: importlib-resources>=3.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from matplotlib->matgraphdb) (6.4.5)
Requirement already satisfied: notebook>=7 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nglview->matgraphdb) (7.3.1)
Requirement already satisfied: pytz>=2020.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pandas->matgraphdb) (2024.2)
Requirement already satisfied: tzdata>=2022.7 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pandas->matgraphdb) (2024.2)
Requirement already satisfied: pyarrow in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (18.1.0)
Requirement already satisfied: beautifulsoup4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (4.12.3)
Requirement already satisfied: requests in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (2.32.3)
Requirement already satisfied: dill in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (0.3.9)
Requirement already satisfied: pathos in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (0.3.3)
Requirement already satisfied: dask in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (2024.8.0)
Requirement already satisfied: distributed in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from parquetdb->matgraphdb) (2024.8.0)
Requirement already satisfied: platformdirs>=2.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (4.3.6)
Requirement already satisfied: astroid<=3.4.0-dev0,>=3.3.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (3.3.6)
Requirement already satisfied: isort!=5.13.0,<6,>=4.2.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (5.13.2)
Requirement already satisfied: mccabe<0.8,>=0.6 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (0.7.0)
Requirement already satisfied: tomlkit>=0.10.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (0.13.2)
Requirement already satisfied: colorama>=0.4.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (0.4.6)
Requirement already satisfied: typing-extensions>=3.10.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pylint->matgraphdb) (4.12.2)
Requirement already satisfied: joblib>=1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (1.4.2)
Requirement already satisfied: monty>=2024.7.29 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (2024.10.21)
Requirement already satisfied: networkx>=2.2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (3.2.1)
Requirement already satisfied: palettable>=3.3.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (3.3.3)
Requirement already satisfied: plotly>=4.5.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (5.24.1)
Requirement already satisfied: pybtex>=0.24.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (0.24.0)
Requirement already satisfied: ruamel.yaml>=0.17.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (0.18.6)
Requirement already satisfied: spglib>=2.5.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (2.5.0)
Requirement already satisfied: sympy>=1.2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (1.13.2)
Requirement already satisfied: tabulate>=0.9 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (0.9.0)
Requirement already satisfied: tqdm>=4.60 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (4.67.1)
Requirement already satisfied: uncertainties>=3.1.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pymatgen->matgraphdb) (3.2.2)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pytest->matgraphdb) (1.2.2)
Requirement already satisfied: iniconfig in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pytest->matgraphdb) (2.0.0)
Requirement already satisfied: pluggy<2,>=1.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pytest->matgraphdb) (1.5.0)
Requirement already satisfied: toml in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from variconfig->matgraphdb) (0.10.2)
Requirement already satisfied: anyio in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (4.7.0)
Requirement already satisfied: certifi in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (2024.8.30)
Requirement already satisfied: httpcore==1.* in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (1.0.7)
Requirement already satisfied: idna in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (3.7)
Requirement already satisfied: h11<0.15,>=0.13 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from httpcore==1.*->httpx>=0.25.0->jupyterlab->matgraphdb) (0.14.0)
Requirement already satisfied: zipp>=3.20 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from importlib-metadata>=4.8.3->jupyterlab->matgraphdb) (3.21.0)
Requirement already satisfied: debugpy>=1.6.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (1.8.11)
Requirement already satisfied: jupyter-client>=6.1.12 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (8.6.3)
Requirement already satisfied: matplotlib-inline>=0.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (0.1.7)
Requirement already satisfied: nest-asyncio in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (1.6.0)
Requirement already satisfied: psutil in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (6.1.0)
Requirement already satisfied: pyzmq>=24 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (26.2.0)
Requirement already satisfied: decorator in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (5.1.1)
Requirement already satisfied: jedi>=0.16 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (0.19.2)
Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (3.0.48)
Requirement already satisfied: pygments>=2.4.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (2.18.0)
Requirement already satisfied: stack-data in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (0.6.3)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jinja2>=3.0.3->jupyterlab->matgraphdb) (2.1.3)
Requirement already satisfied: pywin32>=300 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-core->jupyterlab->matgraphdb) (308)
Requirement already satisfied: argon2-cffi>=21.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (23.1.0)
Requirement already satisfied: jupyter-events>=0.9.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.10.0)
Requirement already satisfied: jupyter-server-terminals>=0.4.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.5.3)
Requirement already satisfied: nbconvert>=6.4.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (7.16.4)
Requirement already satisfied: nbformat>=5.3.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (5.10.4)
Requirement already satisfied: overrides>=5.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (7.7.0)
Requirement already satisfied: prometheus-client>=0.9 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.21.1)
Requirement already satisfied: pywinpty>=2.0.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.0.14)
Requirement already satisfied: send2trash>=1.8.2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.8.3)
Requirement already satisfied: terminado>=0.8.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.18.1)
Requirement already satisfied: websocket-client>=1.7 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.8.0)
Requirement already satisfied: babel>=2.10 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (2.16.0)
Requirement already satisfied: json5>=0.9.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (0.10.0)
Requirement already satisfied: jsonschema>=4.18.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (4.23.0)
Requirement already satisfied: tenacity>=6.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from plotly>=4.5.0->pymatgen->matgraphdb) (9.0.0)
Requirement already satisfied: latexcodec>=1.0.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pybtex>=0.24.0->pymatgen->matgraphdb) (3.0.0)
Requirement already satisfied: six in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pybtex>=0.24.0->pymatgen->matgraphdb) (1.17.0)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from requests->parquetdb->matgraphdb) (3.3.2)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from requests->parquetdb->matgraphdb) (1.26.20)
Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ruamel.yaml>=0.17.0->pymatgen->matgraphdb) (0.2.12)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from sympy>=1.2->pymatgen->matgraphdb) (1.3.0)
Requirement already satisfied: soupsieve>1.2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from beautifulsoup4->parquetdb->matgraphdb) (2.6)
Requirement already satisfied: click>=8.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from dask->parquetdb->matgraphdb) (8.1.8)
Requirement already satisfied: cloudpickle>=1.5.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from dask->parquetdb->matgraphdb) (3.1.0)
Requirement already satisfied: fsspec>=2021.09.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from dask->parquetdb->matgraphdb) (2024.12.0)
Requirement already satisfied: partd>=1.4.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from dask->parquetdb->matgraphdb) (1.4.2)
Requirement already satisfied: toolz>=0.10.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from dask->parquetdb->matgraphdb) (1.0.0)
Requirement already satisfied: locket>=1.0.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from distributed->parquetdb->matgraphdb) (1.0.0)
Requirement already satisfied: msgpack>=1.0.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from distributed->parquetdb->matgraphdb) (1.1.0)
Requirement already satisfied: sortedcontainers>=2.0.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from distributed->parquetdb->matgraphdb) (2.4.0)
Requirement already satisfied: tblib>=1.6.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from distributed->parquetdb->matgraphdb) (3.0.0)
Requirement already satisfied: zict>=3.0.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from distributed->parquetdb->matgraphdb) (3.0.0)
Requirement already satisfied: ppft>=1.7.6.9 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pathos->parquetdb->matgraphdb) (1.7.6.9)
Requirement already satisfied: pox>=0.3.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pathos->parquetdb->matgraphdb) (0.3.5)
Requirement already satisfied: multiprocess>=0.70.17 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from pathos->parquetdb->matgraphdb) (0.70.17)
Requirement already satisfied: sniffio>=1.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from anyio->httpx>=0.25.0->jupyterlab->matgraphdb) (1.3.1)
Requirement already satisfied: argon2-cffi-bindings in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (21.2.0)
Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets->matgraphdb) (0.8.4)
Requirement already satisfied: attrs>=22.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (24.2.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (2024.10.1)
Requirement already satisfied: referencing>=0.28.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (0.35.1)
Requirement already satisfied: rpds-py>=0.7.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (0.22.3)
Requirement already satisfied: python-json-logger>=2.0.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (3.2.0)
Requirement already satisfied: rfc3339-validator in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.1.4)
Requirement already satisfied: rfc3986-validator>=0.1.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.1.1)
Requirement already satisfied: bleach!=5.0.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (6.2.0)
Requirement already satisfied: defusedxml in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.7.1)
Requirement already satisfied: jupyterlab-pygments in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.3.0)
Requirement already satisfied: mistune<4,>=2.0.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (3.0.2)
Requirement already satisfied: nbclient>=0.5.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.10.1)
Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.5.1)
Requirement already satisfied: tinycss2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.4.0)
Requirement already satisfied: fastjsonschema>=2.15 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from nbformat>=5.3.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.21.1)
Requirement already satisfied: wcwidth in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets->matgraphdb) (0.2.13)
Requirement already satisfied: executing>=1.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from stack-data->ipython>=6.1.0->ipywidgets->matgraphdb) (2.1.0)
Requirement already satisfied: asttokens>=2.1.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from stack-data->ipython>=6.1.0->ipywidgets->matgraphdb) (3.0.0)
Requirement already satisfied: pure-eval in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from stack-data->ipython>=6.1.0->ipywidgets->matgraphdb) (0.2.3)
Requirement already satisfied: webencodings in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.5.1)
Requirement already satisfied: fqdn in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.5.1)
Requirement already satisfied: isoduration in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (20.11.0)
Requirement already satisfied: jsonpointer>1.13 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (3.0.0)
Requirement already satisfied: uri-template in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.3.0)
Requirement already satisfied: webcolors>=24.6.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (24.11.1)
Requirement already satisfied: cffi>=1.0.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.17.1)
Requirement already satisfied: pycparser in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.22)
Requirement already satisfied: arrow>=0.15.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.3.0)
Requirement already satisfied: types-python-dateutil>=2.8.10 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.9.0.20241206)
Requirement already satisfied: ipykernel in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (6.29.5)
Requirement already satisfied: comm>=0.1.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (0.2.2)
Requirement already satisfied: debugpy>=1.6.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (1.8.11)
Requirement already satisfied: ipython>=7.23.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (8.18.1)
Requirement already satisfied: jupyter-client>=6.1.12 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (8.6.3)
Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (5.7.2)
Requirement already satisfied: matplotlib-inline>=0.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (0.1.7)
Requirement already satisfied: nest-asyncio in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (1.6.0)
Requirement already satisfied: packaging in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (24.2)
Requirement already satisfied: psutil in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (6.1.0)
Requirement already satisfied: pyzmq>=24 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (26.2.0)
Requirement already satisfied: tornado>=6.1 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (6.4.2)
Requirement already satisfied: traitlets>=5.4.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipykernel) (5.14.3)
Requirement already satisfied: decorator in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (5.1.1)
Requirement already satisfied: jedi>=0.16 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (0.19.2)
Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (3.0.48)
Requirement already satisfied: pygments>=2.4.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (2.18.0)
Requirement already satisfied: stack-data in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (0.6.3)
Requirement already satisfied: typing-extensions in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (4.12.2)
Requirement already satisfied: exceptiongroup in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (1.2.2)
Requirement already satisfied: colorama in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from ipython>=7.23.1->ipykernel) (0.4.6)
Requirement already satisfied: importlib-metadata>=4.8.3 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-client>=6.1.12->ipykernel) (8.5.0)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-client>=6.1.12->ipykernel) (2.9.0.post0)
Requirement already satisfied: platformdirs>=2.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (4.3.6)
Requirement already satisfied: pywin32>=300 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (308)
Requirement already satisfied: zipp>=3.20 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from importlib-metadata>=4.8.3->jupyter-client>=6.1.12->ipykernel) (3.21.0)
Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel) (0.8.4)
Requirement already satisfied: wcwidth in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=7.23.1->ipykernel) (0.2.13)
Requirement already satisfied: six>=1.5 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel) (1.17.0)
Requirement already satisfied: executing>=1.2.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.1.0)
Requirement already satisfied: asttokens>=2.1.0 in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (3.0.0)
Requirement already satisfied: pure-eval in c:\users\lllang\miniconda3\envs\matgraphdb_dev\lib\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (0.2.3)
03 - Graph Generators in MatGraphDB¶
In this notebook, we’ll learn how to:
Create node generator
Add the node generator to the graph
Create edge generator
Add the edge generator to the graph
Defining dependencies between generators
We’ll use the MatGraphDB
class from matgraphdb
to demonstrate these features. If you haven’t already installed matgraphdb
, run the previous cell.
1. Download example data¶
For this tutorial, we will start from example materials data. You can download the data by running the following cell. which downloads the data from the MatGraphDB GitHub repository.
[2]:
import os
from matgraphdb.utils.general_utils import download_test_data
save_path = "./test_data/materials"
if os.path.exists(save_path) and len(os.listdir(save_path)) > 0:
print(f"Data already exists in {save_path}")
file_path = os.path.join(save_path, "materials_0.parquet")
else:
file_path = download_test_data(save_path)
Data already exists in ./test_data/materials
Next, we can load the materials data into MatGraphDB
on initialization. We do this by providing a MaterialStore
instance to the materials_store
argument.
[3]:
import os
import shutil
from matgraphdb import MatGraphDB, MaterialStore
storage_path = "MatGraphDB"
if os.path.exists(storage_path):
shutil.rmtree(storage_path)
materials_dir = os.path.dirname(file_path)
material_store = MaterialStore(storage_path=materials_dir)
mdb = MatGraphDB(storage_path=storage_path, materials_store=material_store)
print("MatGraphDB initialized at:", storage_path)
print(mdb.summary())
MatGraphDB initialized at: MatGraphDB
============================================================
GRAPH DATABASE SUMMARY
============================================================
Name: MatGraphDB
Storage path: MatGraphDB
└── Repository structure:
├── nodes/ (MatGraphDB\nodes)
├── edges/ (MatGraphDB\edges)
├── edge_generators/ (MatGraphDB\edge_generators)
├── node_generators/ (MatGraphDB\node_generators)
└── graph/ (MatGraphDB\graph)
############################################################
NODE DETAILS
############################################################
Total node types: 1
------------------------------------------------------------
• Node type: materials
- Number of nodes: 1000
- Number of features: 136
- db_path: MatGraphDB\nodes\materials
------------------------------------------------------------
############################################################
EDGE DETAILS
############################################################
Total edge types: 0
------------------------------------------------------------
############################################################
NODE GENERATOR DETAILS
############################################################
Total node generators: 0
------------------------------------------------------------
############################################################
EDGE GENERATOR DETAILS
############################################################
Total edge generators: 0
------------------------------------------------------------
Generators¶
A Generator is a callable (function) that returns a PyArrow Table of either nodes or edges. By adding a generator to MatGraphDB
, you can:
Register the generator, so it can be re-run on demand.
Optionally specify arguments/kwargs to pass into the generator.
Automatically store the output in a NodeStore or EdgeStore with the same name as the generator function (or a custom name, if you prefer).
This is especially handy for generating nodes from external data sources or from computational routines.
In the following sections we will create custom node and edge generators. These can be create by wrapping existing functions with the node_generator
or edge_generator
decorators.
These can be imported like:
from matgraphdb import node_generator, edge_generator
Element Node Generator¶
1. Define the Generator¶
In our first example, we will create a node generator that creates element nodes.
As mentioned above to create a node generator, we will wrap an existing function with the node_generator
decorator. The function name will be the name of the node type.
@node_generator
def elements():
...
For this example, we will import an existing periodic table data from the matgraphdb
package. This is a dataframe with 118 rows representing 118 elements of the periodic table. We have also added some transformations to the data to make it more useful for our purposes.
[4]:
import pandas as pd
from matgraphdb import node_generator
from matgraphdb.utils.config import PKG_DIR
BASE_ELEMENT_FILE = os.path.join(
PKG_DIR, "utils", "chem_utils", "resources", "imputed_periodic_table_values.parquet"
)
# Define the generator with the @node_generator decorator
@node_generator
def elements(base_file=BASE_ELEMENT_FILE):
"""
Creates Element nodes from a local file (CSV or Parquet).
Returns a Pandas DataFrame (or PyArrow Table) with one row per element.
"""
try:
# Read the file
file_ext = os.path.splitext(base_file)[-1][
1:
].lower() # e.g. "parquet" or "csv"
if file_ext == "parquet":
df = pd.read_parquet(base_file)
elif file_ext == "csv":
df = pd.read_csv(base_file)
else:
raise ValueError("base_file must be a parquet or csv file")
# Apply some transformations
# Example transformations
df["oxidation_states"] = df["oxidation_states"].apply(
lambda x: x.replace("]", "").replace("[", "")
)
df["oxidation_states"] = df["oxidation_states"].apply(
lambda x: ",".join(x.split())
)
df["oxidation_states"] = df["oxidation_states"].apply(
lambda x: eval("[" + x + "]")
)
df["experimental_oxidation_states"] = df["experimental_oxidation_states"].apply(
lambda x: eval(x)
)
df["ionization_energies"] = df["ionization_energies"].apply(lambda x: eval(x))
except Exception as e:
print(f"Error reading element file: {e}")
return None
return df # Return the transformed dataframe
df = elements()
print(df)
long_name symbol abundance_universe abundance_solar \
0 Hydrogen H 7.500000e+01 7.500000e+01
1 Helium He 2.300000e+01 2.300000e+01
2 Lithium Li 6.000000e-07 6.000000e-09
3 Beryllium Be 1.000000e-07 1.000000e-08
4 Boron B 1.000000e-07 2.000000e-07
.. ... ... ... ...
113 Flerovium Fl 0.000000e+00 0.000000e+00
114 Moscovium Mc 0.000000e+00 0.000000e+00
115 Livermorium Lv 0.000000e+00 0.000000e+00
116 Tennessine Ts 0.000000e+00 0.000000e+00
117 Oganesson Og 0.000000e+00 0.000000e+00
abundance_meteor abundance_crust abundance_ocean abundance_human \
0 2.400000 1.500000e-01 1.100000e+01 1.000000e+01
1 0.000000 5.500000e-07 7.200000e-10 0.000000e+00
2 0.000170 1.700000e-03 1.800000e-05 3.000000e-06
3 0.000003 1.900000e-04 6.000000e-11 4.000000e-08
4 0.000160 8.600000e-04 4.400000e-04 7.000000e-05
.. ... ... ... ...
113 0.000000 0.000000e+00 0.000000e+00 0.000000e+00
114 0.000000 0.000000e+00 0.000000e+00 0.000000e+00
115 0.000000 0.000000e+00 0.000000e+00 0.000000e+00
116 0.000000 0.000000e+00 0.000000e+00 0.000000e+00
117 0.000000 0.000000e+00 0.000000e+00 0.000000e+00
adiabatic_index allotropes ... \
0 5-Jul Dihydrogen ...
1 3-May None ...
2 None None ...
3 None None ...
4 None Alpha Rhombohedral Boron, Beta Rhombohedral Bo... ...
.. ... ... ...
113 None None ...
114 None None ...
115 None None ...
116 None None ...
117 None None ...
is_halogen is_lanthanoid is_metal is_metalloid is_noble_gas \
0 False False False False False
1 False False False False True
2 False False True False False
3 False False True False False
4 False False False True False
.. ... ... ... ... ...
113 False False False False False
114 False False False False False
115 False False False False False
116 False False False False False
117 False False False False True
is_post_transition_metal is_quadrupolar is_rare_earth_metal \
0 False True False
1 False False False
2 False True False
3 False True False
4 False True False
.. ... ... ...
113 False False False
114 False False False
115 False False False
116 False False False
117 False False False
experimental_oxidation_states ionization_energies
0 [] [1312.0]
1 [] [2372.3, 5250.5]
2 [1] [520.2, 7298.1, 11815.0]
3 [2] [899.5, 1757.1, 14848.7, 21006.6]
4 [3] [800.6, 2427.1, 3659.7, 25025.8, 32826.7]
.. ... ...
113 [2] [832.2, 1600.0, 3370.0, 4400.0, 5850.0]
114 [3] [538.3, 1760.0, 2650.0, 4680.0, 5720.0]
115 [-2] [663.9, 1330.0, 2850.0, 3810.0, 6080.0]
116 [-1] [736.9, 1435.4, 2161.9, 4012.9, 5076.4]
117 [] [860.1, 1560.0]
[118 rows x 98 columns]
2. Add the Generator to the MatGraphDB¶
Now that we have defined the generator, we can add it to the MatGraphDB
instance. We do this by calling the add_node_generator
method. Here we give the function, the arguments, and the kwargs. We also have the option to run the generator immediately or later. Default is True.
The node generator will be stored in the node_generator_store
of the MatGraphDB
instance.
[5]:
mdb.add_node_generator(
generator_func=elements,
generator_args={},
generator_kwargs={"base_file": BASE_ELEMENT_FILE},
run_immediately=False, # We have the option to run the generator immediately or later. Default is True.
)
# Check the node generators in the MatGraphDB
print(mdb.node_generator_store)
============================================================
GENERATOR STORE SUMMARY
============================================================
• Number of generators: 1
Storage path: MatGraphDB\node_generators
############################################################
METADATA
############################################################
• class: GeneratorStore
• class_module: matgraphdb.core.generator_store
############################################################
GENERATOR DETAILS
############################################################
• Columns:
- generator_func
- generator_kwargs.base_file
- generator_name
- id
• Generator names:
- elements
Running a Node Generator Later¶
Now we can run the node generator with mdb.run_node_generator(generator_name)
.
[6]:
# Here we run the node generator. Notice how we do not need pass the arguments or kwargs, this information is stored in the node generator store.
# However, we can override the arguments or kwargs if we want to.
mdb.run_node_generator("elements")
[6]:
long_name | symbol | abundance_universe | abundance_solar | abundance_meteor | abundance_crust | abundance_ocean | abundance_human | adiabatic_index | allotropes | ... | is_halogen | is_lanthanoid | is_metal | is_metalloid | is_noble_gas | is_post_transition_metal | is_quadrupolar | is_rare_earth_metal | experimental_oxidation_states | ionization_energies | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Hydrogen | H | 7.500000e+01 | 7.500000e+01 | 2.400000 | 1.500000e-01 | 1.100000e+01 | 1.000000e+01 | 5-Jul | Dihydrogen | ... | False | False | False | False | False | False | True | False | [] | [1312.0] |
1 | Helium | He | 2.300000e+01 | 2.300000e+01 | 0.000000 | 5.500000e-07 | 7.200000e-10 | 0.000000e+00 | 3-May | None | ... | False | False | False | False | True | False | False | False | [] | [2372.3, 5250.5] |
2 | Lithium | Li | 6.000000e-07 | 6.000000e-09 | 0.000170 | 1.700000e-03 | 1.800000e-05 | 3.000000e-06 | None | None | ... | False | False | True | False | False | False | True | False | [1] | [520.2, 7298.1, 11815.0] |
3 | Beryllium | Be | 1.000000e-07 | 1.000000e-08 | 0.000003 | 1.900000e-04 | 6.000000e-11 | 4.000000e-08 | None | None | ... | False | False | True | False | False | False | True | False | [2] | [899.5, 1757.1, 14848.7, 21006.6] |
4 | Boron | B | 1.000000e-07 | 2.000000e-07 | 0.000160 | 8.600000e-04 | 4.400000e-04 | 7.000000e-05 | None | Alpha Rhombohedral Boron, Beta Rhombohedral Bo... | ... | False | False | False | True | False | False | True | False | [3] | [800.6, 2427.1, 3659.7, 25025.8, 32826.7] |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
113 | Flerovium | Fl | 0.000000e+00 | 0.000000e+00 | 0.000000 | 0.000000e+00 | 0.000000e+00 | 0.000000e+00 | None | None | ... | False | False | False | False | False | False | False | False | [2] | [832.2, 1600.0, 3370.0, 4400.0, 5850.0] |
114 | Moscovium | Mc | 0.000000e+00 | 0.000000e+00 | 0.000000 | 0.000000e+00 | 0.000000e+00 | 0.000000e+00 | None | None | ... | False | False | False | False | False | False | False | False | [3] | [538.3, 1760.0, 2650.0, 4680.0, 5720.0] |
115 | Livermorium | Lv | 0.000000e+00 | 0.000000e+00 | 0.000000 | 0.000000e+00 | 0.000000e+00 | 0.000000e+00 | None | None | ... | False | False | False | False | False | False | False | False | [-2] | [663.9, 1330.0, 2850.0, 3810.0, 6080.0] |
116 | Tennessine | Ts | 0.000000e+00 | 0.000000e+00 | 0.000000 | 0.000000e+00 | 0.000000e+00 | 0.000000e+00 | None | None | ... | False | False | False | False | False | False | False | False | [-1] | [736.9, 1435.4, 2161.9, 4012.9, 5076.4] |
117 | Oganesson | Og | 0.000000e+00 | 0.000000e+00 | 0.000000 | 0.000000e+00 | 0.000000e+00 | 0.000000e+00 | None | None | ... | False | False | False | False | True | False | False | False | [] | [860.1, 1560.0] |
118 rows × 98 columns
Lets check the node store for the elements.
[7]:
element_node_store = mdb.get_node_store("elements")
print(element_node_store)
============================================================
NODE STORE SUMMARY
============================================================
Node type: elements
• Number of nodes: 118
• Number of features: 99
Storage path: MatGraphDB\nodes\elements
############################################################
METADATA
############################################################
• class: NodeStore
• class_module: matgraphdb.core.nodes
• node_type: elements
• name_column: id
############################################################
NODE DETAILS
############################################################
• Columns:
- abundance_crust
- abundance_human
- abundance_meteor
- abundance_ocean
- abundance_solar
- abundance_universe
- adiabatic_index
- allotropes
- appearance
- atomic_mass
- atomic_number
- block
- boiling_point
- classifications_cas_number
- classifications_cid_number
- classifications_dot_hazard_class
- classifications_dot_numbers
- classifications_rtecs_number
- coefficient_of_linear_thermal_expansion
- conductivity_electric
- conductivity_thermal
- cpk_hex
- critical_pressure
- critical_temperature
- crystal_structure
- density_stp
- discovered_by
- discovered_location
- discovered_year
- electrical_resistivity
- electrical_type
- electron_affinity
- electron_configuration
- electron_configuration_semantic
- electronegativity_pauling
- energy_levels
- experimental_oxidation_states
- extended_group
- gas_phase
- group
- half_life
- hardness_brinell
- hardness_mohs
- hardness_vickers
- heat_fusion
- heat_molar
- heat_specific
- heat_vaporization
- id
- ionization_energies
- is_actinoid
- is_alkali
- is_alkaline
- is_chalcogen
- is_halogen
- is_lanthanoid
- is_metal
- is_metalloid
- is_noble_gas
- is_post_transition_metal
- is_quadrupolar
- is_rare_earth_metal
- isotopes_known
- isotopes_stable
- isotopic_abundances
- lattice_angles
- lattice_constants
- lifetime
- long_name
- magnetic_susceptibility_mass
- magnetic_susceptibility_molar
- magnetic_susceptibility_volume
- magnetic_type
- melting_point
- modulus_bulk
- modulus_shear
- modulus_young
- molar_volume
- neutron_cross_section
- neutron_mass_absorption
- oxidation_states
- period
- phase
- poisson_ratio
- quantum_numbers
- radius_calculated
- radius_covalent
- radius_empirical
- radius_vanderwaals
- refractive_index
- series
- source
- space_group_name
- space_group_number
- speed_of_sound
- summary
- superconduction_temperature
- symbol
- valence_electrons
Material-Element Edge Generator¶
1. Define the Generator¶
An edge generator is similar to a node generator but returns a PyArrow Table describing edges. Each generated edge must have at least these fields:
source_id
(int)source_type
(string)target_id
(int)target_type
(string)
Additionally, edge_generators must have the corresponding node_stores in the MatGraphDB
instance as an argument. This is to ensure that the ids of the nodes are valid and in the correct node store.
For edges we use the edge_generator
decorator.
[8]:
from matgraphdb import edge_generator
import pyarrow as pa
@edge_generator
def material_element_has(
material_store, element_store
): # We have the material_store and element_store as an argument
try:
connection_name = "has"
# We select only the necessary columns from the node stores
material_table = material_store.read_nodes(
columns=["id", "core.material_id", "core.elements"]
)
element_table = element_store.read_nodes(columns=["id", "symbol"])
# We rename for utility purposes
material_table = material_table.rename_columns(
{"id": "source_id", "core.material_id": "material_name"}
)
material_table = material_table.append_column(
"source_type", pa.array(["material"] * material_table.num_rows)
)
element_table = element_table.rename_columns({"id": "target_id"})
element_table = element_table.append_column(
"target_type", pa.array(["elements"] * element_table.num_rows)
)
# We convert the tables to pandas for easier manipulation
material_df = material_table.to_pandas()
element_df = element_table.to_pandas()
# We create a map of the element symbols to the target_id for quick lookup
element_target_id_map = {
row["symbol"]: row["target_id"] for _, row in element_df.iterrows()
}
# We create a dictionary to store the edge data
table_dict = {
"source_id": [],
"source_type": [],
"target_id": [],
"target_type": [],
"edge_type": [],
"name": [],
"weight": [],
}
# We iterate over the material nodes
for _, row in material_df.iterrows():
# We get the elements composing the material
elements = row["core.elements"]
source_id = row["source_id"]
material_name = row["material_name"]
if elements is None:
continue
# We iterate over the elements
for element in elements:
# We get the target_id for the element
target_id = element_target_id_map[element]
# We append the edge data to the dictionary. Here we could also define the reverse edge as well.
table_dict["source_id"].append(source_id)
table_dict["source_type"].append(material_store.node_type)
table_dict["target_id"].append(target_id)
table_dict["target_type"].append(element_store.node_type)
table_dict["edge_type"].append(connection_name)
name = f"{material_name}_{connection_name}_{element}"
table_dict["name"].append(name)
table_dict["weight"].append(1.0)
# edge_table = ParquetDB.construct_table(table_dict)
# logger.debug(
# f"Created material-element-has relationships. Shape: {edge_table.shape}"
# )
df = pd.DataFrame(table_dict)
except Exception as e:
print(f"Error creating material-element-has relationships: {e}")
return df
2. Add the Generator to the MatGraphDB¶
Now that we have defined the generator, we can add it to the MatGraphDB
instance. We do this by calling the add_edge_generator
method.
The edge generator will be stored in the edge_generator_store
of the MatGraphDB
instance.
[9]:
element_store = mdb.get_node_store("elements")
material_store = mdb.get_node_store("materials")
mdb.add_edge_generator(
generator_func=material_element_has,
generator_args={
"material_store": material_store,
"element_store": element_store,
},
generator_kwargs={},
run_immediately=True,
)
Lets check the edge generator store.
[10]:
print(mdb.edge_generator_store)
============================================================
GENERATOR STORE SUMMARY
============================================================
• Number of generators: 1
Storage path: MatGraphDB\edge_generators
############################################################
METADATA
############################################################
• class: GeneratorStore
• class_module: matgraphdb.core.generator_store
############################################################
GENERATOR DETAILS
############################################################
• Columns:
- generator_args.element_store
- generator_args.material_store
- generator_func
- generator_name
- id
• Generator names:
- material_element_has
Let’s check to see if the edge created the edges in the edge store.
[11]:
edge_store = mdb.get_edge_store("material_element_has")
print(edge_store)
============================================================
EDGE STORE SUMMARY
============================================================
Edge type: material_element_has
• Number of edges: 3348
• Number of features: 8
Storage path: MatGraphDB\edges\material_element_has
############################################################
METADATA
############################################################
• class: EdgeStore
• class_module: matgraphdb.core.edges
############################################################
EDGE DETAILS
############################################################
• Columns:
- edge_type
- id
- name
- source_id
- source_type
- target_id
- target_type
- weight
Updates to node stores.¶
By default, when node and edge generators are added their argument store dependencies are added to the MatGraphDB
instance. This means that when parent stores are updated, the geneator will run and update their corresponding stores.
These stores are stored in the MatGraphDB/generator_dependency.json
file.
[12]:
materials_df = mdb.read_materials(columns=["id"], ids=[0]).to_pandas()
print(materials_df)
mdb.delete_materials(ids=[0])
materials_df = mdb.read_materials(columns=["id"], ids=[0]).to_pandas()
print(materials_df)
id
0 0
2025-02-11 10:52:11 - matgraphdb.materials.nodes.materials - INFO - Deleting data [0]
2025-02-11 10:52:11 - matgraphdb.materials.nodes.materials - INFO - Data deleted successfully.
2025-02-11 10:52:11 - matgraphdb.core.graph_db - INFO - Running dependent generators: materials
2025-02-11 10:52:11 - matgraphdb.core.graph_db - INFO - Running dependent generator: material_element_has
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Removing existing edge store: material_element_has
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Removing edge store of type material_element_has
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Running dependent generators: material_element_has
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Creating edges of type 'material_element_has'
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Creating new EdgeStore for type: material_element_has
2025-02-11 10:52:12 - matgraphdb.core.edges - INFO - Successfully created edges
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Running dependent generators: material_element_has
2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Running dependent generators: material_element_has
2025-02-11 10:52:12 - matgraphdb.materials.core - INFO - Reading materials.
Empty DataFrame
Columns: [id]
Index: []
[13]:
edge_store = mdb.get_edge_store("material_element_has")
print(edge_store)
============================================================
EDGE STORE SUMMARY
============================================================
Edge type: material_element_has
• Number of edges: 3345
• Number of features: 8
Storage path: MatGraphDB\edges\material_element_has
############################################################
METADATA
############################################################
• class: EdgeStore
• class_module: matgraphdb.core.edges
############################################################
EDGE DETAILS
############################################################
• Columns:
- edge_type
- id
- name
- source_id
- source_type
- target_id
- target_type
- weight
[14]:
df = edge_store.read_edges().to_pandas()
print(df)
edge_type id name source_id source_type target_id \
0 has 0 mp-1222351_has_F 1 materials 8
1 has 1 mp-1222351_has_Fe 1 materials 25
2 has 2 mp-1222351_has_Li 1 materials 2
3 has 3 mp-651087_has_F 2 materials 8
4 has 4 mp-651087_has_Gd 2 materials 63
... ... ... ... ... ... ...
3340 has 3340 mp-2714707_has_Al 999 materials 12
3341 has 3341 mp-2714707_has_Na 999 materials 10
3342 has 3342 mp-2714707_has_O 999 materials 7
3343 has 3343 mp-2714707_has_S 999 materials 15
3344 has 3344 mp-2714707_has_Zn 999 materials 29
target_type weight
0 elements 1.0
1 elements 1.0
2 elements 1.0
3 elements 1.0
4 elements 1.0
... ... ...
3340 elements 1.0
3341 elements 1.0
3342 elements 1.0
3343 elements 1.0
3344 elements 1.0
[3345 rows x 8 columns]
[15]:
print(mdb)
============================================================
GRAPH DATABASE SUMMARY
============================================================
Name: MatGraphDB
Storage path: MatGraphDB
└── Repository structure:
├── nodes/ (MatGraphDB\nodes)
├── edges/ (MatGraphDB\edges)
├── edge_generators/ (MatGraphDB\edge_generators)
├── node_generators/ (MatGraphDB\node_generators)
└── graph/ (MatGraphDB\graph)
############################################################
NODE DETAILS
############################################################
Total node types: 2
------------------------------------------------------------
• Node type: materials
- Number of nodes: 999
- Number of features: 136
- Columns:
- bonding.cutoff_method.bond_connections
- bonding.electric_consistent.bond_connections
- bonding.electric_consistent.bond_orders
- bonding.geometric_consistent.bond_connections
- bonding.geometric_consistent.bond_orders
- bonding.geometric_electric_consistent.bond_connections
- bonding.geometric_electric_consistent.bond_orders
- chargemol.bond_connections
- chargemol.bond_orders
- chargemol.cubed_moments
- chargemol.fourth_moments
- chargemol.squared_moments
- chemenv.coordination_environments_multi_weight
- chemenv.coordination_multi_connections
- chemenv.coordination_multi_numbers
- core.atomic_numbers
- core.cartesian_coords
- core.density
- core.density_atomic
- core.elements
- core.energy_per_atom
- core.formula
- core.formula_pretty
- core.frac_coords
- core.is_gap_direct
- core.is_magnetic
- core.is_metal
- core.is_stable
- core.lattice
- core.material_id
- core.nelements
- core.nsites
- core.species
- core.volume
- dielectric.e_electronic
- dielectric.e_ij_max
- dielectric.e_ionic
- dielectric.e_total
- dielectric.n
- elasticity.compliance_tensor_ieee_format
- elasticity.compliance_tensor_raw
- elasticity.debye_temperature
- elasticity.elastic_tensor_ieee_format
- elasticity.elastic_tensor_raw
- elasticity.g_reuss
- elasticity.g_voigt
- elasticity.g_vrh
- elasticity.homogeneous_poisson
- elasticity.k_reuss
- elasticity.k_voigt
- elasticity.k_vrh
- elasticity.order
- elasticity.sound_velocity_acoustic
- elasticity.sound_velocity_longitudinal
- elasticity.sound_velocity_optical
- elasticity.sound_velocity_total
- elasticity.sound_velocity_transverse
- elasticity.state
- elasticity.thermal_conductivity_cahill
- elasticity.thermal_conductivity_clarke
- elasticity.universal_anisotropy
- elasticity.warnings
- elasticity.young_modulus
- electronic_structure.band_gap
- electronic_structure.cbm
- electronic_structure.dos_energy_up
- electronic_structure.efermi
- electronic_structure.vbm
- feature_vectors.element_fraction
- feature_vectors.element_property
- feature_vectors.sine_coulomb_matrix
- feature_vectors.xrd_pattern
- grain_boundaries.grain_boundaries
- has_props.absorption
- has_props.bandstructure
- has_props.charge_density
- has_props.chemenv
- has_props.dielectric
- has_props.dos
- has_props.elasticity
- has_props.electronic_structure
- has_props.eos
- has_props.grain_boundaries
- has_props.insertion_electrodes
- has_props.magnetism
- has_props.materials
- has_props.oxi_states
- has_props.phonon
- has_props.piezoelectric
- has_props.provenance
- has_props.substrates
- has_props.surface_properties
- has_props.thermo
- has_props.xas
- id
- magnetism.num_magnetic_sites
- magnetism.num_unique_magnetic_sites
- magnetism.ordering
- magnetism.total_magnetization
- magnetism.total_magnetization_normalized_vol
- magnetism.types_of_magnetic_species
- metadata.last_updated
- metadata.theoretical
- oxidation_states.method
- oxidation_states.possible_species
- oxidation_states.possible_valences
- structure.@class
- structure.@module
- structure.charge
- structure.lattice.a
- structure.lattice.alpha
- structure.lattice.b
- structure.lattice.beta
- structure.lattice.c
- structure.lattice.gamma
- structure.lattice.matrix
- structure.lattice.pbc
- structure.lattice.volume
- structure.sites
- surface_properties.shape_factor
- surface_properties.surface_anisotropy
- surface_properties.weighted_surface_energy
- surface_properties.weighted_surface_energy_EV_PER_ANG2
- surface_properties.weighted_work_function
- symmetry.crystal_system
- symmetry.number
- symmetry.point_group
- symmetry.symbol
- symmetry.symprec
- symmetry.version
- symmetry.wyckoffs
- thermo.decomposes_to
- thermo.energy_above_hull
- thermo.equilibrium_reaction_energy_per_atom
- thermo.formation_energy_per_atom
- thermo.uncorrected_energy_per_atom
- db_path: MatGraphDB\nodes\materials
------------------------------------------------------------
• Node type: elements
- Number of nodes: 118
- Number of features: 99
- Columns:
- abundance_crust
- abundance_human
- abundance_meteor
- abundance_ocean
- abundance_solar
- abundance_universe
- adiabatic_index
- allotropes
- appearance
- atomic_mass
- atomic_number
- block
- boiling_point
- classifications_cas_number
- classifications_cid_number
- classifications_dot_hazard_class
- classifications_dot_numbers
- classifications_rtecs_number
- coefficient_of_linear_thermal_expansion
- conductivity_electric
- conductivity_thermal
- cpk_hex
- critical_pressure
- critical_temperature
- crystal_structure
- density_stp
- discovered_by
- discovered_location
- discovered_year
- electrical_resistivity
- electrical_type
- electron_affinity
- electron_configuration
- electron_configuration_semantic
- electronegativity_pauling
- energy_levels
- experimental_oxidation_states
- extended_group
- gas_phase
- group
- half_life
- hardness_brinell
- hardness_mohs
- hardness_vickers
- heat_fusion
- heat_molar
- heat_specific
- heat_vaporization
- id
- ionization_energies
- is_actinoid
- is_alkali
- is_alkaline
- is_chalcogen
- is_halogen
- is_lanthanoid
- is_metal
- is_metalloid
- is_noble_gas
- is_post_transition_metal
- is_quadrupolar
- is_rare_earth_metal
- isotopes_known
- isotopes_stable
- isotopic_abundances
- lattice_angles
- lattice_constants
- lifetime
- long_name
- magnetic_susceptibility_mass
- magnetic_susceptibility_molar
- magnetic_susceptibility_volume
- magnetic_type
- melting_point
- modulus_bulk
- modulus_shear
- modulus_young
- molar_volume
- neutron_cross_section
- neutron_mass_absorption
- oxidation_states
- period
- phase
- poisson_ratio
- quantum_numbers
- radius_calculated
- radius_covalent
- radius_empirical
- radius_vanderwaals
- refractive_index
- series
- source
- space_group_name
- space_group_number
- speed_of_sound
- summary
- superconduction_temperature
- symbol
- valence_electrons
- db_path: MatGraphDB\nodes\elements
------------------------------------------------------------
############################################################
EDGE DETAILS
############################################################
Total edge types: 1
------------------------------------------------------------
• Edge type: material_element_has
- Number of edges: 3345
- Number of features: 8
- Columns:
- edge_type
- id
- name
- source_id
- source_type
- target_id
- target_type
- weight
- db_path: MatGraphDB\edges\material_element_has
------------------------------------------------------------
############################################################
NODE GENERATOR DETAILS
############################################################
Total node generators: 1
------------------------------------------------------------
• Generator: elements
Generator Args:
- generator_func: [<function wrapper at 0x00000273649D3790>]
- generator_kwargs.base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
- generator_name: ['elements']
- id: [0]
Generator Kwargs:
- base_file: ['C:\\Users\\lllang\\Desktop\\Current_Projects\\MatGraphDB\\matgraphdb\\utils\\chem_utils\\resources\\imputed_periodic_table_values.parquet']
------------------------------------------------------------
############################################################
EDGE GENERATOR DETAILS
############################################################
Total edge generators: 1
------------------------------------------------------------
• Generator: material_element_has
Generator Args:
- element_store: MatGraphDB\nodes\elements
- material_store: MatGraphDB\nodes\materials
Generator Kwargs:
------------------------------------------------------------
6. Summary¶
In this notebook, we showed how to define custom node and edge generators and showed how to run them.