Skip to content

PAOFLOW

What is PAOFLOW?

PAOFLOW is a Python code that turns the output of a Quantum ESPRESSO (DFT) calculation into a tight-binding Hamiltonian built from projected atomic orbitals (PAO). From this Hamiltonian it quickly computes band structures, density of states, transport coefficients, Berry curvature, spin Hall conductivity and other properties on very dense k-point grids.

CPU only

PAOFLOW runs on CPU nodes only. Submit to the cpu_short or cpu_long partitions.

Base Environment

PAOFLOW is provided via the environment modules system. The module brings its own Python environment and loads Open MPI automatically.

Loading PAOFLOW

Load module

module load paoflow/3.0.1

Best Practice

Always verify the loaded modules:

module list

Expected output:

1) openmpi/4.1.7   2) paoflow/3.0.1

The module also sets PAOFLOW_HOME, the PAOFLOW folder that contains ready-to-run examples in examples/.

How a PAOFLOW calculation works

PAOFLOW does not run DFT itself. A calculation has two steps:

  1. Quantum ESPRESSO: run pw.x (scf), pw.x (nscf) and projwfc.x to produce the projections (see the Quantum ESPRESSO page).
  2. PAOFLOW: run a short Python script (main.py) that reads the QE output and computes the properties you ask for.

Example: Spin Hall Conductivity of Pt

This example uses example05 (Pt with spin-orbit coupling) from $PAOFLOW_HOME/examples/qe_examples/. The example already contains the QE inputs and the PAOFLOW script main.py.

Step 1: Prepare the input data (Quantum ESPRESSO)

prepare_pt.sh

Copy example and run QE

#!/bin/bash
#SBATCH --job-name=pt_prepare
#SBATCH --partition=cpu_short
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --output=pt_prepare_%j.out

module load qe/7.5-cpu
module load paoflow/3.0.1

# copy the example to your own directory
cp -r $PAOFLOW_HOME/examples/qe_examples/example05 pt_example
cd pt_example

srun --mpi=pmix pw.x -nk 4  -in scf.in  > scf.out
srun --mpi=pmix pw.x -nk 16 -in nscf.in > nscf.out
srun --mpi=pmix projwfc.x -nk 16 -in proj.in > proj.out

Submit job

sbatch prepare_pt.sh

Step 2: Use a finer k-point grid

The shipped main.py uses a small grid that finishes in seconds, which is too small to benefit from many ranks. Replace the contents of pt_example/main.py with the version below. The only change is the line interpolated_hamiltonian(nfft1=80, nfft2=80, nfft3=80), which makes PAOFLOW interpolate on an 80 x 80 x 80 k-point grid.

pt_example/main.py

Spin Hall conductivity on a fine grid

from PAOFLOW import PAOFLOW

def main():
  paoflow = PAOFLOW.PAOFLOW(savedir='pt.save')
  paoflow.read_atomic_proj_QE()
  paoflow.projectability()
  paoflow.pao_hamiltonian()
  paoflow.bands(ibrav=2, nk=2000)
  paoflow.topology(Berry=True, eff_mass=True, spin_Hall=True, spol=2, ipol=0, jpol=1)
  paoflow.interpolated_hamiltonian(nfft1=80, nfft2=80, nfft3=80)
  paoflow.pao_eigh()
  paoflow.gradient_and_momenta()
  paoflow.adaptive_smearing()
  paoflow.dos(do_pdos=False, emin=-8., emax=4.)
  paoflow.spin_Hall(emin=-8., emax=4., s_tensor=[[0,1,2]])
  paoflow.finish_execution()

if __name__== '__main__':
  main()

Step 3: Run PAOFLOW

paoflow_pt.sh

PAOFLOW job

#!/bin/bash
#SBATCH --job-name=PAOFLOW
#SBATCH --partition=cpu_short
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --mem-per-cpu=5G
#SBATCH --output=paoflow_%j.out

module load paoflow/3.0.1

cd pt_example
srun --mpi=pmix python main.py

The number of MPI ranks is set by --ntasks. Run the same script on 16 and on 128 ranks:

Submit job

sbatch paoflow_pt.sh                   # 16 ranks
sbatch --ntasks=128 paoflow_pt.sh      # 128 ranks

PAOFLOW detects the number of ranks automatically, and the results do not depend on it. Typical run times for this example:

MPI ranks Total CPU time
16 about 40 s
128 about 24 s

Launching with mpirun

mpirun can be used instead of srun, but it needs process binding switched off:

mpirun --bind-to none -n $SLURM_NTASKS python main.py

Checking Job Completion

Successful termination

grep "Total CPU time" paoflow_*.out

Each job writes its own output file. After running both jobs you will see one line per file:

paoflow_<16_rank_job_id>.out:Total CPU time =                           39.275 sec
paoflow_<128_rank_job_id>.out:Total CPU time =                          23.805 sec

The job IDs are the numbers sbatch printed when you submitted each job.

Output Files

Results are written to pt_example/output/.

File Description
shcEf_z_xy.dat Spin Hall conductivity
Omega_z_xy.dat Berry curvature
bands_0.dat Interpolated band structure
dosdk_0.dat Density of states
effmass_xy_0.dat Effective mass tensor

Other Examples

The same directory contains many more ready-to-run examples, for example:

Example Description
example01 Si: bands, DOS and transport
example04 Fe: anomalous Hall conductivity
example10 GaAs: transport with relaxation time

The full list is in $PAOFLOW_HOME/examples/README.

More Information

Documentation

PAOFLOW on GitHub:

https://github.com/marcobn/PAOFLOW