  Understanding the quantum dynamics of spin defects and their coherence
properties requires accurate modeling of spin-spin interaction in solids and
molecules, for example by using spin Hamiltonians with parameters obtained from
first-principles calculations. We present a real-space approach based on
density functional theory for the calculation of spin-Hamiltonian parameters,
where only selected atoms are treated at the all-electron level, while the rest
of the system is described with the pseudopotential approximation. Our approach
permits calculations for systems containing more than 1000 atoms, as
demonstrated for defects in diamond and silicon carbide. We show that only a
small number of atoms surrounding the defect needs to be treated at the
all-electron level, in order to obtain an overall all-electron accuracy for
hyperfine and zero-field splitting tensors. We also present results for
coherence times, computed with the cluster correlation expansion method,
highlighting the importance of accurate spin-Hamiltonian parameters for
quantitative predictions of spin dynamics.
