This repository contains Jupyter notebooks (in Markdown .md
format),
which demonstrate the use of the open-source libraries like
qmckl
, numgrid
, trexio
and xcfun
via their Python APIs.
It takes advantage of the high-performance optimization of the underlying libraries
(C, C++, Rust) and their native compatibility with Python.
qmckl_numgrid.md
- Load some quantum chemistry data including molecular geometry and basis set information stored in the trexio file format via the
qmckl
context - Set up a grid for molecular integrals via the
numgrid
library using the pre-processed data from theqmckl
context - Compute atomic orbital (AO) values on a grid via the high-performance
qmckl
routines - Calculate the AO overlap matrix (via the
qmckl_dgemm
or NumPy matrix multiplication routines) - Compute density matrix using the molecular orbital (MO) coefficients from the context
- Calculate numerically the number of electrons and compare it with the exact value from the context
- Compute density values on a grid (required for the DFT)
- Set up the exchange-correlation functional via the
xcfun
library - Compute energy and XC potential values on a grid (via the
xcfun
) - Calculate numerically the XC energy contribution
- Load some quantum chemistry data including molecular geometry and basis set information stored in the trexio file format via the
-
python3
(>= 3.6) -
jupyter
-
jupytext
(to convert notebooks from the Markdown.md
format into.ipynb
notebook) -
numpy
(>= 1.19.3) -
trexio
(Python API installation:pip install trexio
) -
numgrid
(Python API installation:pip install numgrid
)
Note: we recommend to use virtual environments to avoid compatibility issues and to improve reproducibility. For more details, see the corresponding part of the Python documentation.
To obtain a local copy of the .ipynb
files:
- Clone the repository
jupytext --to notebook qmckl_numgrid.md
jupyter notebook qmckl_numgrid.ipynb
In some cases, it may happen that the Jupyter kernels in the activated virtual environment
(e.g. myvenv
) still point to the system-wide python binaries and not to the environment ones.
This will result in ImportError
when importing custom packages in the notebook cell.
In order to avoid this, the myvenv
has to be installed as an additional kernel.
This requires ipykernel
python package, which usually comes together with the Jupyter installation. If this is not the case, run pip install ipykernel
.
You can install myvenv
as a kernel by executing the following command:
python3 -m ipykernel install --user --name=myvenv
Now you can launch a Jupyter notebook. Once it is open, make sure that your virtual environment is selected as the current kernel. If this is not the case, try this:
- Press the
Kernel
button in the navigation panel - In the output list of options select
Change kernel
- Find the name of your virtual environment (e.g.
myvenv
) in the list and select it
To uninstall the kernel named myvenv
, execute the following command:
jupyter kernelspec uninstall myvenv