# Quick Start

The generic workflow of the simulation includes first the generation of the spin bath in the material, and second carrying the CCE dynamics calculations for the qubit interacting with this spin bath.

## Base Units

• All coupling constants are given in $$\mathrm{kHz}$$.

• Timesteps are in millisecond ($$\mathrm{ms}$$).

• Distances are in angstrom ($$\mathrm{A}$$).

• Gyromagnetic ratios are given in $$\mathrm{rad}\cdot\mathrm{ms}^{-1}\cdot\mathrm{G}^{-1}$$.

• Quadrupole constants are given in $$\mathrm{barn}$$ ($$10^{-28}\ \mathrm{m}^2$$).

• Magnetic field is given in Gauss ($$\mathrm{G}$$).

## Simple Example

The simplest example includes the following steps:

1. Generate the BathCell object. Here we use the interface with ase which can effortlessly generate unit cells of many materials. As an example, we import the diamond structure.

import numpy as np
import pycce as pc
from ase.build import bulk

cell = pc.BathCell.from_ase(bulk('C', 'diamond', cubic=True))

2. Using the BathCell object, generate spin bath of the most common isotopes in the material. Here we generate the spin bath of size 200 Angstrom and remove one carbon, where the spin of interest is located, from the diamond crystal lattice.

atoms = cell.gen_supercell(200, remove=('C', [0, 0, 0]))


This function returns the BathArray instance, which contains names of the bath spins in 'N', their coordinates in angstrom in 'xyz', empty arrays of hyperfine couplings in $$\mathrm{kHz}$$ in 'A', and quadrupole couplings in $$\mathrm{kHz}$$ in 'Q' namefields. The hyperfine couplings will be generated by Simulator in the next step. For alternative ways to define hyperfine couplings see Hamiltonian Parameters Input.

3. Setup the Simulator using the generated spin bath. The first required argument spin is the total spin of the central spin or the CenterArray instance, containing properties of the central spins. r_bath, r_dipole and order are convergence parameters (see the Tutorials for examples of convergence), magnetic_field is the external applied magnetic field along the z-axis, and pulses is the number of decoupling $$\pi$$ pulses in Carr-Purcell-Meiboom-Gill (CPMG) sequence or a more complicated sequence, set with Pulse objects.

calc = pc.Simulator(0.5, position=[0, 0, 0], bath=atoms, r_bath=40,
r_dipole=6, order=2, magnetic_field=500, pulses=1)


The hyperfine couplings are automatically generated at this step assuming point dipole-dipole interactions between central spin and bath spins.

4. Compute the coherence function of the qubit using .compute method of the Simulator object with conventional CCE.

time_points = np.linspace(0, 2, 101)
coherence = calc.compute(time_points)


This function outputs Numpy array with the same shape as the time_points and contains the coherence function computed at each time step. By default compute method uses the conventional CCE to compute the coherence function.

More detailed examples of PyCCE usage are available in the tutorials.