Installation#

Python version support#

Officially Python 3.9, 3.10, 3.11, 3.12, and 3.13.

Installing from PyPI#

pyscfad can be installed via pip from PyPI.

pip install pyscfad

Installing from source#

The source code of pyscfad can be obtained by cloning the Github repository.

cd $HOME
git clone https://github.com/fishjojo/pyscfad.git

The main part of pyscfad is pure Python. One can simply add the top directory of pyscfad to the environment variable PYTHONPATH.

export PYTHONPATH=$HOME/pyscfad:$PYTHONPATH

Alternatively, one can install pyscfad locally via pip by running the following command at the top directory of pyscfad.

cd $HOME/pyscfad
pip install -e .

Installing pyscfadlib#

pyscfadlib is the C extension to pyscfad that provides efficient gradient backpropagation implementations. Similarly, one can install pyscfadlib locally via pip.

cd $HOME/pyscfad/pyscfadlib
pip install -e .

Or one can manually compile the C code, and then add pyscfadlib to PYTHONPATH.

cd $HOME/pyscfad/pyscfadlib/pyscfadlib
mkdir build
cd build
cmake ..
make
export PYTHONPATH=$HOME/pyscfad/pyscfadlib:$PYTHONPATH

Note

For Mac with ARM64 architectures, one needs to set the environment variable CMAKE_OSX_ARCHITECTURES=arm64.

Dependencies#

pyscfad requires the following dependencies.

Package

supported versions

numpy

>=1.17

scipy

>=1.7

h5py

>=2.7

jax

>=0.4.14,<=0.4.35

jaxlib

>=0.4.14,<=0.4.35

pyscf

>=2.3.0

pyscfadlib

>=0.1.4

Note

Since jax version 0.4.36, the tracing machinery has been modified to eliminate data-dependent tracing, which conflicts with pyscfad’s flexibility. A comprehensive update to ensure compatibility with later jax versions may be introduced in the future pyscfad 0.2 release.