PyCCE: A Python Package for CCE Simulations


PyCCE is an open source Python library to simulate the dynamics of a spin qubit interacting with a spin bath using the cluster-correlation expansion (CCE) method.


The PyCCE 1.0 has been released! Main changes from the previous version include:

  • Support for several central spins with the new class CenterArray!

    Check out a tutorial Multiple central spins on how to use the new class to study the decoherence of the hybrid qubit or entanglement of dipolarly coupled qubits.

  • Direct definition of the bath spin states with BathArray.state attribute.

    Check out the updated tutorial NV Center in Diamond to see how one can use this functionality to study the effect of spin polarization on Hahn-echo signal.

  • Expanded the control over pulse sequences.

    See documentation for Pulse class in Running the Simulations for details.

  • EXPERIMENTAL FEATURE. Added ability to define your own single particle Hamiltonian.

    See BathArray.h and Center.h in Spin Bath and Central spins respectively for further details.

  • Significant overhaul of computational expensive parts of the code with Numba. This makes the first run of PyCCE quite slow, but after compilation it should run observably faster.

  • Various bug fixes and QoL changes.

This is a major update. If you find any issues ot bugs, please let us know as soon as possible!

Known issues

  • Numba sometimes raises a warning about non-contiguous arrays. This is a lie.


The recommended way to install PyCCE is to use pip:

$ pip install pycce

Otherwise you can install PyCCE directly using the source code. First copy the repository to the desired folder:

$ git clone

Then, execute pip in the folder containing

$ pip install .

or run the python install command:

$ python install


The following modules are required to run PyCCE.

PyCCE inherently supports parallelization with the mpi4py package, which requires the installation of MPI. However, for serial implementation the mpi4py is not required.

How to cite

If you make use of PyCCE in a scientific publication, please cite the following paper:

Mykyta Onizhuk and Giulia Galli. “PyCCE: A Python Package for Cluster Correlation Expansion Simulations of Spin Qubit Dynamic” Adv. Theory Simul. 2021, 2100254