This example computes the SOC-induced zero-field splitting tensor for the neutral nickel-vacancy center in diamond using the Sternheimer approach.
compute_dso_pw.py: driver script fordecomp_mode="pw"compute_dso_band.py: driver script fordecomp_mode="band"qe_calculation/: Quantum ESPRESSO wavefunction, pseudopotential, and local-potential datareference/: reference JSON output and example logs
The driver reads:
qe_calculation/pwscf.save/data-file-schema.xmlqe_calculation/pwscf.save/wfcup1.datqe_calculation/pwscf.save/wfcdw1.datqe_calculation/pwscf.save/C.upfqe_calculation/pwscf.save/Ni.upfqe_calculation/potential_up.cubeqe_calculation/potential_dw.cube
For the Sternheimer workflow, the .cube local-potential files come from Quantum ESPRESSO. If higher numerical accuracy is needed, you may optionally patch the Quantum ESPRESSO cube writer in PP/src/cube.f90 and rebuild:
! original
WRITE(ounit,'(6E13.5)') (rho(i1,i2,i3),i3=1,nr3)
! higher-precision output
WRITE(ounit,'(6E23.15)') (rho(i1,i2,i3),i3=1,nr3)This change is optional, but it may improve the accuracy of calculations that use .cube local potentials.
From this directory, the two reference drivers are:
python compute_dso_pw.py
python compute_dso_band.pyFor scheduled runs on Slurm:
srun -n 4 -u python compute_dso_pw.py > dso_pw.out
srun -n 4 -u python compute_dso_band.py > dso_band.outThis Sternheimer workflow supports two decomposition modes:
decomp_mode="pw"for plane-wave decompositiondecomp_mode="band"for band decomposition
For band decomposition, the currently supported layouts are:
band_distribution="contiguous"band_distribution="block-cyclic"
The bundled compute_dso_band.py example uses decomp_mode="band" with the default contiguous band layout. A custom constructor call looks like:
dso = dso_sternheimer(
wfc_files,
pp_files,
v_local_files,
nbnd_occ,
v_local_batch_size=1,
decomp_mode="band",
band_distribution="contiguous",
)The reference/ directory includes GPU runs for both decomposition modes on 4 MPI ranks / 4 GPUs:
reference/ref_dso_pw.out:compute_dsowall time19.923608 sreference/ref_dso_band.out:compute_dsowall time10.699127 s
In these reference runs, band decomposition is about 1.86x faster than plane-wave decomposition, corresponding to about 46% lower wall time. This comparison is hardware- and workload-dependent, but it gives a useful baseline for this example.
The calculation writes:
dso_stern_pw.json: structured ZFS results, metadata, and timings fordecomp_mode="pw"dso_stern_band.json: structured ZFS results, metadata, and timings fordecomp_mode="band"
If you redirect standard output, dso_pw.out and dso_band.out will contain the console logs for the two runs.