mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-11-03 20:54:09 +01:00
.. | ||
src | ||
test | ||
manual_install_qmckl.sh | ||
pyproject.toml | ||
README.md | ||
requirements.txt | ||
setup.py |
Python API of the QMCkl library
Requirements
setuptools
numpy
swig
(>= 4.0)
Manual installation
- Install the QMCkl library (see upstream instructions)
./manual_install_qmckl.sh
which should do the following- Copy the produced
_qmckl.so
andqmckl.py
files into your working directory and do not forget toimport qmckl
in your Python scripts
The second step executes the following under the hood:
./build_qmckl.sh
<c-compiler> -I/usr/include/python3.8 -c -fPIC qmckl_wrap.c
to compile the wrapper code into an object file using the<c-compiler>
(replace with your C compiler, e.g.gcc
) on your machine<c-compiler> -shared qmckl_wrap.o -lqmckl -o _qmckl.so
to produce the final C extension (this requires theqmckl
library to be installed and present in the linking paths together with all its dependencies liketrexio
)
Python-ic installation (recommended)
- Install the QMCkl library (see upstream instructions)
./pip_install_qmckl.sh
The last step runs ./build_qmckl.sh
, copies the result
into the qmckl/
directory and then runs
pip install .
to install the qmckl
Python
package in your environment.
SWIG pre-processing
Both aforementioned steps call build_qmckl.sh
script
which does the following pre-processing for SWIG
- Copy the latest
qmckl.h
file froninclude/
into thesrc/
directory python process_header.py
to generateqmckl_include.i
list of SWIG patternsswig -python -py3 -builtin -threads -o qmckl_wrap.c qmckl.i
to generate the SWIG wrapper code in C andqmckl.py
module in Python. Note: for this to work three files have to be present in the working directory:qmckl.i
,qmckl_include.i
andnumpy.i
.