PAOFLOW.PAOFLOW#

Classes#

PAOFLOW

Post-processing engine for Pseudo-Atomic Orbital (PAO) electronic structure calculations.

Module Contents#

class PAOFLOW.PAOFLOW.PAOFLOW(workpath='./', outputdir='output', inputfile=None, savedir=None, model=None, npool=1, smearing=None, save_overlaps=False, acbn0=False, verbose=False, restart=False, dft='QE', header_style='color', unfold_kpoints=False)[source]#

Post-processing engine for Pseudo-Atomic Orbital (PAO) electronic structure calculations.

PAOFLOW reads the output of a plane-wave DFT code (Quantum ESPRESSO or VASP), projects the Bloch eigenstates onto a compact PAO basis, and exposes a high-level Python API for a broad range of electronic, topological, and transport properties. All heavy numerics are MPI-parallelised through mpi4py and optionally distributed across k-point pools to keep per-process memory bounded.

Typical workflow#

from PAOFLOW import PAOFLOW

pf = PAOFLOW(workpath='./', savedir='prefix.save', outputdir='output')
pf.projections()           # build PAO projections (or read_atomic_proj_QE)
pf.projectability()        # drop low-projectability bands
pf.pao_hamiltonian()       # construct H(R) and H(k) in the PAO basis
pf.interpolated_hamiltonian()  # Fourier-interpolate onto a denser k-grid
pf.pao_eigh()              # diagonalise → E(k), v(k)
pf.gradient_and_momenta()  # ∇_k H, momentum matrix
pf.dos()                   # density of states / projected DOS
pf.transport()             # Boltzmann transport tensors
pf.finish_execution()      # print timings and memory usage

Parameters (constructor)#

workpathstr, default './'

Path to the working directory.

outputdirstr, default 'output'

Name of the output sub-directory created under workpath. When this directory already contains BXSF files and no readable DFT data are available, PAOFLOW initializes for a PySKEAF-only calculation.

inputfilestr, optional

Path to an XML input file that configures the run.

savedirstr, optional

Path to the QE .save directory (required when not using inputfile).

modeldict, optional

Parameters for building the Hamiltonian from a tight-binding model instead of a DFT calculation. Must contain at least the key 'label'.

npoolint, default 1

Number of k-point pools. Increasing npool distributes k-point work across MPI ranks and reduces per-process memory.

smearingstr, optional

Global smearing type for BZ integration (None, 'm-p', or 'gauss').

save_overlapsbool, default False

Retain the wavefunction overlap matrices Sks in the DataController after Hamiltonian construction. Required for ACBN0.

acbn0bool, default False

Orthogonalise the PAO Hamiltonian using the ACBN0 procedure.

verbosebool, default False

Enable detailed debugging output.

restartbool, default False

Resume from a previously saved .json dump (see restart_dump()).

dftstr, default 'QE'

DFT back-end: 'QE' (Quantum ESPRESSO) or 'VASP'.

header_stylestr, default 'color'

header style 'color' (large banner) or 'minimal' (small title)

Key attributes#

data_controllerDataController

Central data store; all arrays (HRs, Hks, E_k, …) and scalar attributes live in its data_arrays and data_attributes dictionaries.

comm, rank, size : MPI communicator and process identifiers.

Methods — PAO Hamiltonian#

projections(**kw)

Compute PAO projections from pseudopotential or all-electron basis sets, replacing projwfc.x.

read_atomic_proj_QE()

Read pre-computed projections from QE’s atomic_proj.xml.

projectability(pthr, shift)

Identify and optionally shift low-projectability bands.

pao_hamiltonian(shift_type, insulator, write_binary, expand_wedge, symmetrize, …)

Build the real-space Hamiltonian H(R) (stored as HRs) and the k-space Hamiltonian H(k) (stored as Hks).

add_external_fields(Efield, Bfield, HubbardU)

Apply electric field, magnetic field, or Hubbard-U corrections to HRs.

write_Hamiltonian(fname)

Dump HRs in the Z2Pack format.

Methods — Hamiltonian manipulation#

interpolated_hamiltonian(nfft1, nfft2, nfft3, reshift_Ef)

Fourier-interpolate onto a denser k-grid via zero-padding, producing Hksp.

doubling_Hamiltonian(nx, ny, nz)

Double the supercell in one or more directions.

cutting_Hamiltonian(x, y, z)

Trim periodic images from HRs along selected axes.

adhoc_spin_orbit(naw, phi, theta, lambda_p, lambda_d, soc_strengh, soc_species)

Add phenomenological spin-orbit coupling to HRs without a DFT+SOC run.

Methods — Band structure and eigenvalues#

bands(ibrav, band_path, high_sym_points, spin_orbit, fname, nk)

Compute and write the band structure along a high-symmetry path.

pao_eigh(bval)

Diagonalise Hksp to obtain eigenvalues E_k and eigenvectors v_k.

gradient_and_momenta(band_curvature)

Compute ∇_k H (dHksp) and the momentum matrix pksp. Optionally compute the band-curvature tensor.

adaptive_smearing(smearing, afac, min_width, max_width)

Compute adaptive smearing widths deltakp for BZ integration (optional floor and cap).

effective_mass(emin, emax, ne)

Calculate effective mass tensor components along kx, ky, kz.

Methods — Spectral and spatial quantities#

dos(do_dos, do_pdos, delta, emin, emax, ne)

Total and projected density of states (supports adaptive smearing).

density(nr1, nr2, nr3)

Real-space electron density on a uniform grid.

fermi_surface(fermi_up, fermi_dw)

Extract the Fermi surface within an energy window.

pyskeaf(fermi_energy, num_interpolation, b_field, azimuthal, polar, …)

Calculate quantum-oscillation frequencies from SKEAF-compatible BXSF bands.

spin_texture(fermi_up, fermi_dw)

Map the spin expectation value ⟨S⟩ across the Fermi surface.

wave_function_projection(dimension)

Site-projected wave-function weights.

site_projected_bands(site_proj)

Band structure weighted by on-site probability density.

ipr(fname)

Inverse participation ratio (IPR) of PAO eigenstates.

doping(tmin, tmax, nt, delta, emin, emax, ne, doping_conc, core_electrons, fname)

Chemical potential as a function of carrier doping and temperature.

Methods — Topology and Berry physics#

topology(eff_mass, Berry, spin_Hall, spin_orbit, spol, ipol, jpol)

Berry curvature, effective mass, and spin Berry curvature along the k-path, including Z2 invariant support.

berry_phase(kspace_method, berry_path, high_sym_points, …)

Berry/Zak phase via the discretized product formula (Resta 1994).

anomalous_Hall(do_ac, emin, emax, fermi_up, fermi_dw, ne, delta, a_tensor)

Anomalous Hall conductivity (and optionally magnetic circular dichroism).

spin_Hall(twoD, do_ac, emin, emax, ne, delta, fermi_up, fermi_dw, s_tensor, …)

Spin Hall conductivity and spin circular dichroism.

rashba_edelstein(emin, emax, ne, temps, twoD, lt, st, …)

Rashba–Edelstein (inverse spin galvanic effect) tensor.

find_weyl_points(symmetrize, test_rad, search_grid)

Locate Weyl nodes in the BZ via Chern-number integration.

spin_operator(spin_orbit, sh_l, sh_j)

Build the spin operator matrix Sj in the PAO basis.

Methods — Transport#

transport(tmin, tmax, nt, emin, emax, ne, scattering_channels, …)

Boltzmann semi-classical transport tensors (conductivity, Seebeck, thermal conductivity) over a temperature and energy grid.

dielectric_tensor(delta, intrasmear, emin, emax, ne, d_tensor, degauss)

Frequency-dependent real and imaginary parts of the dielectric tensor.

jdos(delta, emin, emax, ne, jdos_smeartype)

Joint density of states.

Methods — Utilities#

print_data_keys()

Print all keys stored in the DataController dictionaries.

memory_check()

Estimate peak memory usage in GBytes.

restart_dump(fname_prefix)

Pickle the current DataController state for later resumption.

restart_load(fname_prefix)

Restore a previously pickled DataController state.

report_module_time(mname)

Print wall-clock time elapsed since the last timer reset.

finish_execution()

Print total run time and (if verbose) aggregate memory usage across ranks.

Notes

  • The DataController (self.data_controller) is the single source of truth for all intermediate results. Its data_arrays dict holds NumPy arrays (e.g. HRs, E_k, pksp); data_attributes holds scalar configuration values (e.g. nawf, nspin, nkpnts).

  • Each public method guards its core computation in a try/except block and calls self.report_exception on failure. Setting abort_on_exception = True in the DataController attributes causes the exception to be re-raised immediately.

  • MPI barriers are inserted automatically at the start and end of every timed module via report_module_time().

data_controller = None[source]#
gb_fudge_factor = 4.0[source]#
report_exception = None[source]#
print_data_keys()[source]#

Print’s out the keys do the data_controller dictionaries, “arrays” and “attributes”. Each stores the respective data required for the various calculation PAOFLOW can perform.

Arguments:

None

Returns:

None

comm[source]#
rank[source]#
size[source]#
report_module_time(mname)[source]#
restart_dump(fname_prefix='paoflow_dump')[source]#

Saves the necessary information to restart a PAOFLOW run from any step in calculation.

Arguments:

fname_prefix (str): Prefix of the filenames which will be written. Files are written to the directory housing the python script which instantiates PAOFLOW, unless otherwise specified in this argument.

Returns:

None

restart_load(fname_prefix='paoflow_dump')[source]#

Loads the previously dumped save files and populates the DataController with said data.

Arguments:

fname_prefix (str): Prefix of the filenames which will be written. Files are written to the directory housing the python script which instantiates PAOFLOW, unless otherwise specified in this argument.

Returns:

None

memory_check()[source]#

Estimate PAOFLOW’s memory requirements with a “fudge factor” defined above

Arguments:

None

Returns:

gbyte (float): Estimated number of Gigabytes required in memory for PAOFLOW to run.

finish_execution()[source]#

Finish the PAOFLOW execution. Print out run time and maximum memory usage

Arguments:

None

Returns:

None

projections(configuration=None, basispath=None, internal=None, pseudo_orbitals='auto', r_box=None, n_points=2000, save_basis=False, plain_overlap=False)[source]#

Calculate the projections on the atomic basis provided by the pseudopotential or on the all-electron internal basis sets. Replaces projwfc.

Parameters:
  • basispath (str, optional) – Directory containing the per-element BASIS/<elem>/*.dat files of the augmenting shells (the shipped all-electron tables or the BASIS_PS of paoflow-genbasis-ps). Without it the augmenting shells of 'standard', 'extended' and of a dict are generated at run time from the pseudopotentials of the run (UPF files for QE, POTCAR datasets for VASP): the shells the pseudopotential carries as pseudo-orbitals as stored, the others as eigenstates of the pseudo-atom in a box selected by the ghost filter of PAOFLOW.basis_gen (projection.radial_shell_basis). This is the route for VASP input, whose PAW datasets are read from potcar_dir (see the constructor).

  • configuration (dict, str, or None, optional) –

    How to build the projection basis:

    • 'minimal' — use the pseudo-atomic wavefunctions shipped in each species’ UPF file (smooth, matches the default QE projwfc behaviour). This is internal = False Spans the valence bands well; conduction states need “standard”, “extended” or an explicit configuration dict.

    • 'standard' — AE basis built from basispath: the minimal valence set augmented with (a) the next missing angular-momentum channel at nmax (e.g. 3D for Si) and (b) (n+1)L for each occupied shell — see PAOFLOW.inputs.basis_presets.standard_augmentation(). Provides a moderate set of conduction states without the full “extended” polarization.

    • 'extended' — AE basis built from basispath: the UPF valence shells plus a generous rule-based set of polarization shells (see PAOFLOW.inputs.basis_presets.extended_augmentation()).

    • dict — explicit per-element mapping {element: spec}. Each spec may be a list of shell labels (['3S', '3P', '4S'] — used verbatim) or a preset name string ('standard', 'extended' …) resolved for that element. This lets you ask for a curated preset on some species while hand-picking orbitals on others, e.g. {'Ga': 'standard', 'As': ['4S', '4P', '3D']}. Consumed by the AE-only builder. Backwards-compatible with previous releases.

    • None — keep whatever is already stored in arry['configuration'] (legacy behaviour).

  • internal (for backward compatibility only, not used)

  • pseudo_orbitals ({'auto', True, False}, optional) – Take the shells that the pseudopotential provides as pseudo-orbitals (PP_PSWFC of a UPF, bound reference states of a POTCAR dataset) from the pseudopotential and only the remaining shells of the configuration from the tables of basispath (or from the generator without it). 'auto' does so for ultrasoft / PAW pseudopotentials (the stored pseudo-orbitals are the only radial functions consistent with their augmented metric; all-electron tables project PAW semicore bands poorly) and keeps the pure table basis for norm-conserving ones; True / False force either choice (False with the generator route solves every shell in the box). Not with the 'minimal' preset (already the pseudo-orbital basis). With spin-orbit coupling the scalar pseudo-orbitals fill both j blocks (as the scalar tables do).

  • r_box (float, optional) – Generator route only: radius of the confining box of the radial solver (bohr), default min(r_max of the mesh, 10).

  • n_points (int, optional) – Generator route only: mesh size of the radial solver.

  • save_basis (bool, optional) – Generator route only: write the generated radial functions to outputdir/BASIS_PS/<elem>/<shell>.dat (the table format) for inspection.

  • plain_overlap (bool, optional) – Skip the augmented metric of ultrasoft / PAW pseudopotentials and project with the plain plane-wave overlap after re-orthonormalising the bands (the behaviour before October 2026, approximate: symmetry breaking at a few k-points, inflated projectabilities). A warning is printed whenever the plain overlap is used with augmented pseudopotentials, for this or any other reason.

read_atomic_proj_QE()[source]#

Read the wavefunctions and overlaps from atomic-proj.xml, written by Quantum Espresso in the .save directory specified in PAOFLOW’s constructos. They are saved to the DataController’s arrays dictionary with keys ‘U’ and ‘Sks’, respectively.

projectability(pthr=0.95, shift='auto')[source]#

Calculate the Projectability Matrix to determine how many states need to be shifted

Arguments:

pthr (float): The minimum allowed projectability for high projectability states shift (str or float): If ‘auto’ the shift will be automatic. Otherwise the shift will be the value of ‘shift’

Returns:

None

pao_hamiltonian(shift_type=1, insulator=False, write_binary=False, expand_wedge=True, symmetrize=False, thresh=1e-06, max_iter=16)[source]#

Construct the Tight Binding Hamiltonian Populates DataController with ‘HRs’, ‘Hks’ and ‘kq_wght’

Arguments:

shift_type (int): Shift type [ 0-(PRB 2016), 1-(PRB 2013), 2-No Shift ]

Returns:

None

minimal(first_band=None, R=False)[source]#
add_external_fields(Efield=[0.0], Bfield=[0.0], HubbardU=[0.0])[source]#

Add External Fields and Corrections to the Hamiltonian ‘HRs’

Arguments:

Efield (ndarray): 1D array of Efield values Bfield (ndarray): 1D array of Bfield values HubbardU (ndarray): 1D array of Hubbard Correctional values

Returns:

None

write_Hamiltonian(fname='hamiltonian.dat')[source]#

Write ‘HRs’ to file for use with Z2 Pack

Arguments:

fname (str): File name for the Hamiltonian in the Z2 Pack format

Returns:

None

save_sparse_hamiltonian(fname='sparse_hamiltonian.npz', bond_order=3, r_cut=None, magnitude_tol=1e-08)[source]#

Truncate the real-space Hamiltonian ‘HRs’ to a neighbour-shell cutoff and save it.

The archive holds the surviving matrix elements as a labelled bond list (atoms, species and orbital names per element) together with the geometry and run metadata needed by ‘load_sparse_hamiltonian’.

Arguments:

fname (str): File name for the sparse Hamiltonian archive (written to outputdir) bond_order (int): Keep bonds up to this neighbour shell (1 = nearest neighbours) r_cut (float): Explicit bond-length cutoff in Bohr, overriding bond_order magnitude_tol (float): Discard matrix elements smaller than this in every spin channel

Returns:

None

load_sparse_hamiltonian(fname='sparse_hamiltonian.npz')[source]#

Restore a run from an archive written by ‘save_sparse_hamiltonian’.

Rebuilds the dense ‘HRs’ from the stored bonds and repopulates the geometry, orbital map and FFT grids, so that subsequent steps (bands, dos, transport) proceed exactly as after ‘pao_hamiltonian’.

Works on an instance created with restart=True, which needs neither a ‘.save’ directory nor a model.

Arguments:

fname (str): File name of the sparse Hamiltonian archive

Returns:

None

bands(ibrav=None, band_path=None, high_sym_points=None, adhoc_SO=False, fname='bands', nk=500, write_QE_path=False)[source]#

Compute the electronic band structure

Arguments:

ibrav (int): Crystal structure (following the specifications of QE) band_path (str): A string representing the band path to follow high_sym_points (dictionary): A dictionary with symbols of high symmetry points as keys and length 3 numpy arrays containg the location of the symmetry points as values. adhoc_SO (bool): If True the calculation includes relativistic spin orbit coupling fname (str): File name for the band output nk (int): Number of k-points to include in the path (High Symmetry points are currently included twice, increasing nk) write_QE_path (bool): If True generates the kpath in tpiba to run QE bands

Returns:

None

adhoc_spin_orbit(naw=[1], phi=0.0, theta=0.0, lambda_p=[0.0], lambda_d=[0.0], lambda_f=[0.0], soc_strengh={}, soc_species=True, soc_shell_weights=None)[source]#

Include spin-orbit coupling

Arguments:

theta (float) : Spin orbit angle phi (float) : Spin orbit azimuthal angle soc_strengh(dict) : p and d orbitals SOC strengh for each species If soc_species = False lambda_p (list of floats) : p orbitals SOC strengh for each atom lambda_d (list of float) : d orbitals SOC strengh for each atom lambda_f (list of float) : f orbitals SOC strengh for each atom soc_shell_weights (dict, optional):

Per-shell SOC weights for the 'generic' builder (extended bases). Keyed by species symbol, value is a list of bool or float of the same length as arry['shells'][species]. None (default) uses the builder’s intrinsic 1/k**2 occurrence-index falloff for each l > 0 channel (valence weight 1, 1st augmentation 0.25, 2nd 0.111, …).

Returns:

None

j_to_lm_hamiltonian(shells=None, check_unitary=True)[source]#

Rotate the fully-relativistic Hamiltonian from the J basis to the lm basis.

Fully-relativistic QE calculations (dftSO=True) build the Hamiltonian in the coupled total-angular-momentum basis |j, m_j>. This rotates the real-space Hamiltonian ‘HRs’ into the QE real-spherical-harmonic (lm) basis, in the same [spin-up block][spin-down block] ordering produced by ‘adhoc_spin_orbit’, so the orbital character (s/p/d, m) becomes well defined and the orbital-resolved band routines can be used.

‘HRs’ and ‘Hks’ are transformed in place and the per-orbital ‘basis’ is rebuilt for the lm basis. Call after ‘pao_hamiltonian’ and before ‘bands’. Only s, p, d shells are implemented.

Arguments:
shells (list of int): Flat shell list (0=s, 1=p, 2=d) in the

Hamiltonian’s atom/shell order. None (default) builds it from ‘atoms’ and ‘shells’. Pass explicitly if the dimension check fails (e.g. a different atom/shell order or extra channels).

check_unitary (bool): Verify the transformation matrix is unitary.

Returns:

None

mirror_chern_number(nbnd_occ='auto', z2pack=True, is_lm=False, symprec=0.01, surface_kwargs=None, gap_check=True, auto_tighten=True, z2_fallback=True, verbose=True)[source]#

Mirror Chern number C_M of a 2D material (horizontal mirror sigma_h), using Z2Pack for the sector Chern numbers.

In the lm basis the horizontal mirror is the constant operator M_z = P_site (x) diag(eta_z) (x) diag(-i_up, +i_down); this rotates the Hamiltonian to the lm basis, auto-detects the sigma_h atom permutation from the relaxed coordinates, verifies [H(k), M_z] = 0, splits H into the +-i eigen-sectors and computes each sector’s Chern number, giving C_M = (C_{+i} - C_{-i})/2 and nu = C_M mod 2. A centrosymmetric layer with no sigma_h falls back to the Z2 index over half the BZ. Call after ‘pao_hamiltonian’ (fully-relativistic run); run serially. Requires the optional ‘z2pack’ and ‘tbmodels’ packages.

Arguments:

nbnd_occ (int|’auto’): number of occupied bands (‘auto’ = nelec). z2pack (bool): run the Z2Pack Chern step (else only write sectors). is_lm (bool): True if ‘HRs’ is already in the lm basis. symprec (float): sigma_h detection tolerance (fractional). surface_kwargs (dict): overrides for z2pack.surface.run (always win). gap_check (bool): report the min direct / indirect gap. auto_tighten (bool): tighten the Z2Pack sampling for a small direct

gap (< 0.20 eV), e.g. lower min_neighbour_dist / move_tol and densify the loops; only for keys not set in surface_kwargs.

z2_fallback (bool): compute Z2 when no sigma_h is found. verbose (bool): print progress.

Returns:
dict: sigma_h, glide, perm, z0, tau, residual, nawf, nocc, gap,

C_plus, C_minus, C_M, nu, nu_z2 (None where not computed).

wave_function_projection(dimension=3)[source]#

Marcio, can you write something here please? Please check the argument descriptions also, I half guessed.

Arguments:

dimension (int): Dimensionality of the system

Returns:

None

site_projected_bands(site_proj=[0])[source]#

This routine calculates the wavefunction square wheights to produce a site projected band structure.

Arguments:

site_proj (list of ints): Incides of the atomic site to project the bands

Returns:

None

doubling_Hamiltonian(nx, ny, nz)[source]#

Marcio, can you write something here please? Please check the argument descriptions also

Arguments:

nx (bool): Number of doubles in first dimension ny (bool): Number of doubles in second dimension nz (bool): Number of doubles in third dimension

Returns:

None

cutting_Hamiltonian(x=False, y=False, z=False)[source]#

Marcio, can you write something here please?

Arguments:

x (bool): If True, cut along the first dimension y (bool): If True, cut along the second dimension z (bool): If True, cut along the third dimension

Returns:

None

spin_operator(adhoc_SO=False, sh_l=None, sh_j=None)[source]#
Calculate the Spin Operator for calculations involving spin

Requires: None Yeilds: ‘Sj’

Arguments:

adhoc_SO (bool): If True the calculation includes relativistic spin orbit coupling fnscf (string): Filename for the QE nscf inputfile, from which to read shell data sh (list of ints): The Shell levels nl (list of ints): The Shell level occupations

Returns:

None

orbital_operator(adhoc_SO=False)[source]#
topology(eff_mass=False, Berry=False, spin_Hall=False, adhoc_SO=False, spol=None, ipol=None, jpol=None)[source]#

Calculate the Band Topology along the k-path ‘kq’

Arguments:

eff_mass (bool): If True calculate the Effective Mass Tensor Berry (bool): If True calculate the Berry Curvature spin_Hall (bool): If True calculate Spin Hall Conductivity adhoc_SO (bool): If True the calculation includes spin_orbit effects for topology. spol (int): Spin polarization ipol (int): In plane dimension 1 jpol (int): In plane dimension 2

Returns:

None

interpolated_hamiltonian(nfft1=0, nfft2=0, nfft3=0, reshift_Ef=False, free_HRs=True)[source]#

Calculate the interpolated Hamiltonian with the method of zero padding Populates DataController with ‘Hksp’.

Arguments:

nfft1 (int): Desired size of the interpolated Hamiltonian’s first dimension nfft2 (int): Desired size of the interpolated Hamiltonian’s second dimension nfft3 (int): Desired size of the interpolated Hamiltonian’s third dimension free_HRs (bool): Release ‘HRs’ once it has been interpolated. It is replicated

on every rank, so keeping it roughly doubles the peak footprint of this step. Set False only when calling ‘topology’ or ‘berry_phase’ afterwards without an intervening ‘pao_eigh’ (which frees it regardless).

Returns:

None

pao_eigh(bval=0)[source]#

Calculate the Eigen values and vectors of k-space Hamiltonian ‘Hksp’ Populates DataController with ‘E_k’ and ‘v_k’

Arguments:

bval (int): Top valence band number (nelec/2) to correctly shift Eigenvalues

Returns:

None

gradient_and_momenta(band_curvature=False, nonlocal_velocity=None, nonlocal_velocity_inject=None, nonlocal_velocity_sign=None, position_dipoles=None, position_dipole_level='full')[source]#

Calculate the gradient of the k-space Hamiltonian and momentum operator.

Arguments:

band_curvature (bool): also compute the band curvature. position_dipoles (bool or None): add the position dipoles of the PAO orbitals to the velocity operator, dHksp -= i[H, d(k)] (position_dipole_correction()), the term that completes the commutator i[H, r] when the position operator is no longer reduced to the orbital centres. None falls back to attr['position_dipoles'] (False if unset). position_dipole_level (str): 'full' (Löwdin-orthogonalised basis) or 'intra-atomic' (on-site blocks only). nonlocal_velocity, nonlocal_velocity_inject, nonlocal_velocity_sign: the non-local pseudopotential velocity correction was removed in October 2026 (it double counted V_NL, already inside the PAO Hamiltonian). Any value other than None/False raises ValueError pointing to position_dipoles.

Returns:

None

position_dipole_correction(*, level='full', q_max=20.0, n_q=600, pao_tol=0.001, inject=True)[source]#

Position dipoles of the PAO orbitals in the velocity operator.

Builds \(\mathbf d(\mathbf k)\) of the Löwdin-orthonormal PAO basis (PAOFLOW.hamiltonian.position_dipoles) on the FFT k-grid and adds \(-\,i[H(\mathbf k), \mathbf d(\mathbf k)]\) to arrays['dHksp'] (which is minus the velocity), so that the momenta of gradient_and_momenta() and everything built on them (dielectric_tensor(), anomalous_Hall(), spin_Hall(), …) carry the full commutator \(i[H, \mathbf r]\) instead of the orbital-centre approximation. Scalar-relativistic, ad-hoc spin-orbit and fully relativistic (j, m_j) bases are handled (position_dipoles_on_grid()).

Parameters:
  • level ({'full', 'intra-atomic'}, optional) – Löwdin-orthogonalised basis (default) or on-site blocks only.

  • q_max (optional) – Radial-table parameters.

  • n_q (optional) – Radial-table parameters.

  • pao_tol (optional) – Radial-table parameters.

  • inject (bool, optional) – False only builds the tables ('_PD_tables') without touching dHksp.

Returns:

Modifies arrays['dHksp'] in place; caches the tables under '_PD_tables' / '_PD_on_site' and the PAO catalog under '_NL_pao_catalog'.

Return type:

None

Notes

The PAO Hamiltonian already contains the non-local pseudopotential, so with the dipoles the commutator is complete (Si: 0.99–1.01 of the exact plane-wave \(\varepsilon\)). The former non-local correction, which double counted it (0.87 with both terms), was removed in October 2026.

adaptive_smearing(smearing='gauss', afac=None, min_width=None, max_width=None)[source]#

Calculate the Adaptive Smearing parameters Populates DataController with ‘deltakp’ and ‘deltakp2’

Arguments:

smearing (str): Smearing type (m-p and gauss) afac (float): Smearing control. Small values (<0.01) are equivalent to no smearing min_width (float): Lower bound of the widths in eV (None, the default: no floor). The

Yates widths vanish at the band extrema and are tiny on flat bands; a state narrower than the energy grid of a later dos(), doping() or transport() call drops out of the sums, so a floor at or above that grid spacing restores the count

max_width (float): Upper bound of the widths in eV (None, the default: no cap)

Returns:

None

dos(do_dos=True, do_pdos=True, delta=0.01, emin=-10.0, emax=2.0, ne=1000)[source]#
Calculate the Density of States and Projected Density of States

If Adaptive Smearing has been performed, the Adaptive DoS will be calculated

Arguments:

do_dos (bool): Perform Density of States calculation do_pdos (bool): Perform Projected Density of States calculation delta (float): The gaussian width emin (float): The minimum energy in the range to be computed emax (float): The maximum energy in the range to be computed ne (int): The number of points to place in the range [emin,emax]

Returns:

None

density(nr1=48, nr2=48, nr3=48)[source]#

Calculate the Electron Density in real space

Arguments:

nr1,nr2,nr3: real space grid

Returns:

None

trim_non_projectable_bands()[source]#
fermi_surface(fermi_up=1.0, fermi_dw=-1.0)[source]#

Calculate the Fermi Surface

Arguments:

fermi_up (float): The upper limit of the occupied energy range fermi_dw (float): The lower limit of the occupied energy range

Returns:

None

pyskeaf(fermi_energy=0.0, num_interpolation=100, b_field='non_principal', azimuthal=0.0, polar=0.0, num_angles=1, minimum_frequency=0.0, frequency_tolerance=0.01, orbit_tolerance=0.05, allow_wall_orbits=True, bands='all', verbose=False, n_jobs=1, angle_timeout=None, **unknown_options)[source]#

Calculate quantum-oscillation frequencies with pyskeaf.

Use single-band, SKEAF-compatible BXSF files created by fermi_surface(), or initialize PAOFLOW with only outputdir when existing BXSF files are already present there. Custom files may be selected by their extensionless names.

Parameters:
  • fermi_energy (float, tuple of float, or list of float, default 0.0) – Fermi energy in eV. A scalar runs one energy. A Python tuple or list supplies the explicit energies to scan. Values are converted to Rydberg internally.

  • num_interpolation (int, default 100) – Number of interpolated points per reciprocal-cell side.

  • b_field ({'b1', 'b2', 'b3', 'non_principal', 'rotation'}) – Magnetic-field direction. Two-element azimuthal and polar values automatically select 'rotation'.

  • azimuthal (float or pair of float) – Azimuthal (theta) and polar (phi) angles in degrees. Scalars select one orientation; pairs define the endpoints of a rotation.

  • polar (float or pair of float) – Azimuthal (theta) and polar (phi) angles in degrees. Scalars select one orientation; pairs define the endpoints of a rotation.

  • num_angles (int, default 1) – Number of equally spaced orientations in a rotation. Scalar angles always imply one orientation.

  • minimum_frequency (float, default 0.0) – Minimum reported extremal frequency in kT.

  • frequency_tolerance (float, default 0.01) – Maximum fractional frequency difference used when averaging.

  • orbit_tolerance (float, default 0.05) – Maximum fractional reciprocal-cell distance used when averaging.

  • allow_wall_orbits (bool, default True) – Include extrema close to supercell walls.

  • bands ('all', int, str, or sequence, default 'all') – 'all' selects every Fermi_surf_band_*.bxsf file. Integers select standard PAOFLOW band suffixes. Strings select custom BXSF stems, with the .bxsf extension optional.

  • verbose (bool, default False) – Also write short, long, and orbit-outline diagnostic files. The physical qo_EF_<energy>_freqvsangle_*.out files are always written.

  • n_jobs (int, default 1) – Number of parallel worker processes used for the angle sweep. Ignored under MPI, which distributes angles across ranks instead. Capped at the available cores otherwise.

  • angle_timeout (float or None, default None) – Seconds allowed for any single angle when n_jobs exceeds 1. None waits indefinitely. Set it above the expected per-angle runtime to turn a stalled worker into a TimeoutError instead of an unbounded hang.

Returns:

Per-energy, per-band calculation or skip results, ordered first by Fermi energy and then by the selected bands.

Return type:

list of PAOFLOW.pyskeaf.runner.BXSFRun

spin_texture(fermi_up=1.0, fermi_dw=-1.0)[source]#

Calculate the Spin Texture

Arguments:

fermi_up (float): The upper limit of the occupied energy range fermi_dw (float): The lower limit of the occupied energy range

Returns:

None

berry_curvature(spin_Hall=False, orbital_Hall=False, spol=None, ipol=None, jpol=None)[source]#

Calculate the Berry Curvature along the k-path ‘kq’

Arguments:

curvature (string) : A string with the Hall effect to be calculated. Charge, spin or orbital. spol (int): Spin polarization ipol (int): In plane dimension 1 jpol (int): In plane dimension 2

Returns:

None

spin_Hall(twoD=False, do_ac=False, emin=-1.0, emax=1.0, ne=501, delta=0.05, fermi_up=1.0, fermi_dw=-1.0, s_tensor=None, shc_proj=None)[source]#
Calculate the Spin Hall Conductivity

Currently this module does not possess the “spin_orbit” capability of do_topology, because I(Frank) do not know what this modification entails. Thus, do_spin_orbit defaults to False here. If anybody needs the spin_orbit capability here, please contact me and we’ll sort it out.

Arguments:

twoD (bool): True to output in 2D units of Ohm^-1, neglecting the sample height in the z direction do_ac (bool): True to calculate the Spic Circular Dichroism emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments delta (float) : small imaginary part added to the eigenvalue difference fermi_up (float): The upper limit of the occupied energy range fermi_dw (float): The lower limit of the occupied energy range s_tensor (list): List of tensor elements to calculate (e.g. To calculate xxx and zxy use [[0,0,0],[0,1,2]])

Returns:

None

orbital_texture(fermi_up=1.0, fermi_dw=-1.0)[source]#

Calculate the Orbital Texture

Arguments:

fermi_up (float): The upper limit of the occupied energy range fermi_dw (float): The lower limit of the occupied energy range

Returns:

None

orbital_Hall(twoD=False, do_ac=False, emin=-1.0, emax=1.0, ne=501, delta=0.05, fermi_up=1.0, fermi_dw=-1.0, o_tensor=None, ohc_proj=None)[source]#

Calculate the Orbital Hall Conductivity

Arguments:

twoD (bool): True to output in 2D units of Ohm^-1, neglecting the sample height in the z direction do_ac (bool): True to calculate the Orbital Circular Dichroism emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments delta (float) : small imaginary part added to the eigenvalue difference fermi_up (float): The upper limit of the occupied energy range fermi_dw (float): The lower limit of the occupied energy range o_tensor (list): List of tensor elements to calculate (e.g. To calculate xxx and zxy use [[0,0,0],[0,1,2]])

Returns:

None

conductivity(delta=0.01, emin=-10.0, emax=2.0, ne=1000, cond_tensor=None)[source]#
rashba_edelstein(emin=-2, emax=2, ne=500, delta=0.05, temps=0.0, reg=1e-30, twoD=False, lt=1.0, st=1.0, write_to_file=True, intra_band=False, spin=True, orbital=False, ree_tensor=None, ree_proj=None)[source]#

Calculate the Rashba-Edelstein tensor

Arguments:

emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments in [emin,emax] delta (float) : small imaginary part added to the eigenvalue difference temps (float): Smearing temperature in eV reg (float): The regularization number that is applicable only for materials with band gap (in the order of 1e-30) twoD (bool): set True for two dimnesional materials lt (float): The lattice height of the twoD structure (in cm) st (float): The structure ‘effectivce’ thickness of the twoD structure (in cm) write_to_file (bool): Set True to write tensors to file intra_band (bool): Set True to calculate intra-band contributions spin (bool): Set True to include spin in the calculation. If True, ‘Sj’ will be calculated if not already present in the DataController orbital (bool): Set True to include orbital contributions in the calculation. If True, ‘L’ will be calculated if not already present in the DataController ree_tensor (list): List of tensor elements to calculate (e.g. To calculate xxx and zxy use [[0,0,0],[0,1,2]])

Returns:

None

anomalous_Hall(do_ac=False, emin=-1.0, emax=1.0, fermi_up=1.0, fermi_dw=-1.0, ne=501, delta=0.05, a_tensor=None)[source]#

Calculate the Anomalous Hall Conductivity

Arguments:

do_ac (bool): True to calculate the Magnetic Circular Dichroism emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments delta (float) : small imaginary part added to the eigenvalue difference fermi_up (float): The upper limit of the occupied energy range fermi_dw (float): The lower limit of the occupied energy range a_tensor (list): List of tensor elements to calculate (e.g. To calculate xx and yz use [[0,0],[1,2]])

Returns:

None

effective_mass(emin=-1.0, emax=1.0, ne=1000)[source]#

Calculate effective mass components for kx,ky and kz

Arguments:

tmin (float): The minimum temperature in the range tmax (float): The maximum temperature in the range nt (float): The number of temperature increments emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments

Returns:

None

doping(tmin=300, tmax=300, nt=1, delta=0.01, emin=-1.0, emax=1.0, ne=1000, doping_conc=None, core_electrons=0.0, fname='doping_')[source]#

Calculate the chemical potential that corresponds to specified doping for different temperatures

Arguments:

tmin (float): The minimum temperature in the range tmax (float): The maximum temperature in the range nt (float): The number of temperature increments emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments doping_conc(float): The amount of doping in 1/cm^3. Positive value for p type and negative value for n type core_electrons(float): The number of core electrons in a system. Adding this to integrated dos allows for integration over a narrower energy window fname (str): Prefix for the filename containg Doping vs Temperature

Returns:

None

transport(tmin=300.0, tmax=300.0, nt=1, emin=-2.0, emax=2.0, ne=500, scattering_channels=[], scattering_weights=[], tau_dict=None, do_hall=False, write_to_file=True, save_tensors=False)[source]#

Calculate the Transport Properties

Arguments:

tmin (float): The minimum temperature in the range tmax (float): The maximum temperature in the range nt (float): The number of temperatures to evaluate in [tmin,tmax] emin (float): The minimum energy in the range emax (float): The maximum energy in the range ne (float): The number of energy increments in [emin,emax] fit (bool): fit paoflow output to experiments scattering_channels (list): Built-in model names, TauModel objects and/or

ScatteringChannel objects (PAOFLOW.boltzmann.scattering_channels, e.g. TransportSpectralChannel.from_npz(‘output/eliashberg.npz’) for electron-phonon scattering in metals, ResidualResistivity, FermiLiquidRate), combined by Matthiessen’s rule

scattering_weights (list): List of coefficients weighting components of the harmonic sum when computing tau tau_dict (dict): Parameters of the built-in models; a dict passed here replaces any

stored one (None keeps it)

do_hall (bool): Set True to calculate hall coefficient write_to_file (bool): Set True to write tensors to file save_tensors (bool): Set True to save the tensors into the data controller

Returns:

None

dielectric_tensor(delta=0.1, intrasmear=0.05, emin=0.0, emax=10.0, ne=501, d_tensor=None, degauss=0.1, emissivity=False, emis_angles=(0.0, 30.0, 60.0), emis_ntheta=90, emis_temperature=300.0, intraband=True)[source]#

Compute the frequency-dependent dielectric tensor.

Evaluates \(\varepsilon_{\alpha\beta}(\omega) = \varepsilon_1 + i\varepsilon_2\) in the independent-particle (RPA, no local-field) approximation using the Drude-Lorentz form of Quantum ESPRESSO’s epsilon.x (Calandra & Mauri / QE manual, epsilon.x user guide, eq. 8):

  • Interband (\(n \neq n'\)): prefactor \(8\pi e^2/(\Omega N_k m^2)\).

  • Intraband / Drude (metals only): prefactor \(4\pi e^2/(\Omega N_k m^2)\), i.e. one half of the interband prefactor. PAOFLOW applies a single common normalization built for the interband case and rescales the intraband contribution internally by 1/2 — see response/do_epsilon.py.

Outputs (written by data_controller):

  • epsi_<a><b>.dat — \(\varepsilon_2(\omega)\) (imag part)

  • epsr_<a><b>.dat — \(\varepsilon_1(\omega)\) (real part)

  • ieps_<a><b>.dat — \(\varepsilon(i\omega)\), the Kramers-Kronig transform onto the imaginary frequency axis

  • eels_<a><b>.dat — \(-\mathrm{Im}\,\varepsilon^{-1}(\omega)\), electron energy-loss function. Only written for diagonal pairs (ipol == jpol); the EELS = \(\varepsilon_2/(\varepsilon_1^2+\varepsilon_2^2)\) formula is not physically meaningful for off-diagonal components.

  • nref_<a><a>.dat, kref_<a><a>.dat — real (refractive index) and imaginary (extinction coefficient) parts of the complex refractive index \(\tilde n = n + i\kappa\), with \(\tilde n^2 = \varepsilon\). Diagonal pairs only (Option A: per principal axis; off-diagonal complex permittivity requires tensor diagonalisation).

  • alpha_<a><a>.dat — absorption coefficient \(\alpha = 2\omega\kappa/c\) (1/m). Diagonal pairs only.

  • refl_<a><a>.dat — normal-incidence reflectivity \(R = ((n-1)^2+\kappa^2)/((n+1)^2+\kappa^2)\). Diagonal pairs only.

Emissivity (written only when emissivity=True, diagonal pairs):

  • refl_th<deg>_<a><a>.dat — Fresnel directional reflectivity \(R(\theta, \omega)\), polarization-averaged over s and p waves, at each incidence angle in emis_angles.

  • emis_th<deg>_<a><a>.dat — directional emissivity \(\varepsilon(\theta, \omega) = 1 - R(\theta, \omega)\) (Kirchhoff’s law, opaque medium).

  • emish_<a><a>.dat — spectral hemispherical emissivity \(\varepsilon(\omega) = 2\int_0^{\pi/2}\varepsilon(\theta,\omega) \cos\theta\sin\theta\,d\theta\).

  • emist_<a><a>.dat — total hemispherical emissivity \(\varepsilon(T)\), the Planck-weighted spectral average, as a two-column (temperature, emissivity) file.

On rank 0 the f-sum-rule plasmon frequency \(\omega_p = \sqrt{(2/\pi)\int_0^{\omega_{\max}}\omega\varepsilon_2 d\omega}\) is printed per diagonal component and can be compared against the equivalent value from epsilon.x.

Parameters:
  • delta (float, optional) – Interband broadening \(\Gamma\) (eV). QE input intersmear. Default 0.1.

  • intrasmear (float, optional) – Intraband Drude broadening \(\eta\) (eV). QE input intrasmear. Default 0.05.

  • intraband (bool, optional) – Include the intraband (Drude) term of metals (default True). False gives the interband dielectric function, to be combined with an ab initio (extended) Drude term (PAOFLOW.response.drude.extended_drude_dielectric()).

  • emin (float, optional) – Frequency window (eV).

  • emax (float, optional) – Frequency window (eV).

  • ne (int, optional) – Number of frequency samples in [emin, emax].

  • d_tensor (list or {'all', 'diag', 'offdiag'}, optional) – Tensor components to compute. 'diag' -> [[0,0],[1,1],[2,2]], 'offdiag' -> the six off-diagonal pairs, or pass an explicit list such as [[0,0],[1,2]]. Default (None): 'diag'.

  • degauss (float, optional) – Fermi-Dirac smearing width (eV) used to evaluate occupations and (for metals) the Drude \(-\partial f/\partial E\) delta-function approximation. Should match the QE SCF/NSCF smearing for direct benchmarks.

  • emissivity (bool, optional) – If True, additionally compute the Fresnel directional reflectivity, spectral hemispherical emissivity, and total hemispherical emissivity from the diagonal complex refractive index (see Outputs). Default False.

  • emis_angles (sequence of float, optional) – Incidence angles (degrees, relative to the surface normal) at which the directional reflectivity/emissivity are tabulated. Only used when emissivity=True. Default (0, 30, 60).

  • emis_ntheta (int, optional) – Number of polar-angle samples in \([0, \pi/2]\) for the hemispherical integral. Only used when emissivity=True. Default 90.

  • emis_temperature (float or sequence of float, optional) –

    Temperature(s) in kelvin at which the Planck-weighted total hemispherical emissivity is evaluated. Only used when emissivity=True. Default 300 K.

    Note

    The total emissivity integral is taken over the supplied [emin, emax] grid only. The Planck weight peaks near \(k_B T\), so for a meaningful \(\varepsilon(T)\) the window should start near zero and resolve the thermally relevant low-energy range; otherwise the truncated integral underestimates \(\varepsilon(T)\).

Returns:

Files are written through data_controller.

Return type:

None

Notes

Benchmarked against epsilon.x on Si (insulator) and Al fcc (metal); see examples/qe_examples/example15_Si_epsilon and example17_Al_epsilon. Plasmon frequencies agree to within a few percent on a converged 16x16x16 k-grid.

Adaptive interband broadening (Yates et al., Phys. Rev. B 75, 195121 (2007)): if adaptive_smearing() has been called before this method (so the per-\((k,n,m)\) widths deltakp2 are present), the fixed scalar delta broadening is replaced by the local \(\eta_{nm}(\mathbf{k}) = \alpha\, |\nabla_k(E_n-E_m)|\,\delta k\) in the interband Lorentzian. The width is floored by attr['adaptive_smearing_floor'] (default: the frequency-grid spacing (emax-emin)/(ne-1)) so every Lorentzian is at least one bin wide – this removes single-point divergences where bands are locally parallel while keeping sharp van Hove singularities. Raise the floor (e.g. to the fixed delta) for a smoother, purely additive broadening. The fixed-smearing path is used otherwise. Example:

pf.gradient_and_momenta()
pf.adaptive_smearing(smearing='gauss')   # builds deltakp/deltakp2
pf.dielectric_tensor(d_tensor='diag')    # uses adaptive eta_nm
nonlinear_optics(nk, emin=0.0, emax=4.0, ne=401, eta=0.05, shift_current=True, injection_current=True, second_harmonic=True, components='all', scissor=0.0, temperature=0.0, fermi_energy=None, smearing='gauss', adaptive_smearing=None, degeneracy_tol=0.01, twoD=False, slab_height=None, orbital_positions=None, nelec=None, kblock=128, hopping_cutoff=None, shg_bin=None, position_dipoles=False, symmetry=True)[source]#

Second-order optical responses: shift and injection currents, second-harmonic generation.

Evaluates, on a uniform nk grid interpolated from the real-space PAO Hamiltonian HRs (Wigner-Seitz interpolation, no stored k-grid tensors), the band energies, the interband position matrix \(r^a_{nm} = -i v^a_{nm}/\omega_{nm}\), its generalized derivative \(r^b_{nm;a}\) (sum rule over all PAO bands, exact in the tight-binding approximation) and the velocity differences, and from them

  • the shift current \(\sigma^{abc}(\omega)\) (normal, T-even) and the magnetic shift current (T-odd), \(J^a = \sigma^{abc}E^b(\omega)E^c(-\omega)\) (+ \(\sigma_M^{abc}\,\mathrm{Im}[E^bE^{c*}]\));

  • the injection currents \(dJ^a/dt = \eta_M^{abc}\mathrm{Re}[E^bE^{c*}] + \eta_C^{abc}\mathrm{Im}[E^bE^{c*}]\) (magnetic, T-odd; circular, T-even);

  • the SHG susceptibility \(\chi^{abc}(-2\omega;\omega,\omega)\), \(P^a(2\omega) = \epsilon_0\chi^{abc}E^bE^c\), in the low-frequency convergent form of Chen et al. (2022) (Rashkeev 1998 / Wang 2017 with the T-odd term).

Call it after pao_hamiltonian() (and add_external_fields()) and before interpolated_hamiltonian() or pao_eigh(), which release HRs.

Outputs (written by data_controller, two columns: photon energy (eV), value):

  • shift_<abc>.dat, shiftm_<abc>.dat – \(\mu\)A/V2 (2D: nm \(\mu\)A/V2);

  • injectc_<abc>.dat, injectm_<abc>.dat – A V-2 s-1 (2D: nm A V-2 s-1);

  • shgr_<abc>.dat, shgi_<abc>.dat, shga_<abc>.dat – Re, Im and \(|\chi|\) in pm/V (2D: pm2/V).

With nspin = 2 the files hold the sum of the two channels and _0 / _1 suffixed copies hold each channel.

Parameters:
  • nk (sequence of int) – Dense k-grid (n1, n2, n3) ((n1, n2, 1) for 2D).

  • emin (float, float, int) – Photon-energy grid (eV).

  • emax (float, float, int) – Photon-energy grid (eV).

  • ne (float, float, int) – Photon-energy grid (eV).

  • eta (float) – Width of the \(\delta\) functions (shift, injection) and imaginary part added to every SHG resonance denominator (eV).

  • shift_current (bool) – Responses to compute.

  • injection_current (bool) – Responses to compute.

  • second_harmonic (bool) – Responses to compute.

  • components (‘all’, ‘diag’, or sequence of 'abc' strings / index triples) – Tensor components (a: current or polarisation direction; b, c: fields).

  • scissor (float) – Rigid shift of the conduction bands (eV) in the resonance energies and in the explicit \(1/\omega_{mn}\) factors; the matrix elements keep the DFT eigenvectors.

  • temperature (float) – Electronic temperature (K); 0 gives step occupations (nelec / spin factor bands).

  • fermi_energy (float, optional) – Chemical potential (eV) for finite temperatures or metals (default: the mid-gap).

  • smearing ({'gauss', 'lorentz'}) – Shape of the \(\delta\) functions.

  • adaptive_smearing (float, optional) – Yates prefactor a of the per-pair widths \(a|\mathbf v_n - \mathbf v_m|\Delta k\), floored at eta.

  • degeneracy_tol (float) – Pairs closer than this (eV) are skipped in \(r\) and in the band sums (10 meV: the nearly degenerate pairs of DFT-derived Hamiltonians otherwise leak numerical asymmetries into symmetry-forbidden components).

  • twoD (bool) – Multiply the responses by the slab height (sheet responses).

  • slab_height (float, optional) – Height of the 2D cell (bohr; default \(|\mathbf a_3|\)).

  • orbital_positions (ndarray (nawf, 3), optional) – Orbital centres in crystal coordinates (default: from the PAO basis, or from the model’s tau and naw).

  • nelec (float, optional) – Electrons per cell (default attr['nelec']).

  • kblock (int) – k-points per block.

  • hopping_cutoff (float, optional) – Drop real-space cells with max |H(n)| below it (eV).

  • shg_bin (float, optional) – Bin of the SHG transition-energy histograms (eV; default eta / 5).

  • position_dipoles (bool or {'full', 'intra-atomic'}, optional) – Go beyond the tight-binding position operator: the Löwdin position dipoles of the PAO basis (position_dipole_operator(), internal projections, scalar-relativistic) enter \(r\) and \(r_{;a}\). True is the 'full' level. Default False (tight-binding approximation).

  • symmetry (bool or array_like, optional) – Reduce the dense grid to its irreducible wedge with the point-group operations of the crystal and symmetrise the tensors once at the end (exact for the covariant integrands; GaAs: 24 times fewer k-points). True uses the operations read from Quantum ESPRESSO (arrays['sym_rot'], the time-reversal-combined ones excluded) and does nothing when they are absent (models, VASP); an array (nops, 3, 3) of Cartesian matrices is accepted instead (they must be lattice symmetries). False runs the full grid.

Returns:

The spectra ('energy_ev', 'components', 'shift', 'shiftm', 'injectc', 'injectm', 'shg') summed over the spin channels, and the run metadata ('nocc', 'gap_ev', 'direct_gap_ev', …); None on failure when abort_on_exception is off.

Return type:

dict

Notes

Units and conventions follow PAOFLOW.response.nonlinear_optics; see docs/internals/nonlinear-optics.md for the formulas, the sign of the curvature term in the sum rule, the histogram scheme of the SHG and the validation on GaAs and tight-binding models.

jdos(delta=0.1, emin=0.0, emax=10.0, ne=501, jdos_smeartype='gauss')[source]#

Calculate the Dielectric Tensor

Arguments:

delta (float): broadening parameter in eV emin (float): The minimum value of energy emax (float): The maximum value of energy ne (float): Number of energy values between emin and emax jdos_smeartype: ‘gauss’ or “lorentz”

Returns:

None

find_weyl_points(symmetrize=None, test_rad=0.01, search_grid=[8, 8, 8])[source]#
ipr(fname='ipr')[source]#

Compute the inverse partiticipation ratio (IPR) from PAO eigenstates

\[\text{IPR}_{nk} = \frac{\sum_n |v_{nk}|^4}{(\sum_n |v_{nk}|^2)^2}\]

where n is the band index and k the k-point

The final shape is (nspin,nkpts,nbands,3), where the last axis gives: 0 as the k-point coordinate, 1 the band energy, and 2 the inverse partition ratio

The result in saved to a ipr.npy file. To open the file one should use: ipr = np.load(‘ipr.npy’)

berry_phase(kspace_method='path', berry_path=None, high_sym_points=None, kpath_funct=None, nk1=100, nk2=100, closed=True, method='berry', sub=None, occupied=True, kradius=None, kcenter=[0.0, 0.0, 0.0], kxlim=(-0.5, 0.5), kylim=(-0.5, 0.5), eigvals=False, fname='berry_phase', contin=False)[source]#

Compute the Berry phase using the discretized formula. See R. Resta, Rev. Mod. Phys. 66, 899 (1994) and R. Resta, J. Phys.: Condens. Matter 22, 123201 (2010)

Arguments:
kspace_method (str): method used to sample the BZ:

*’path’: 1D path along the BZ; *’track’: 1D path along x direction for several points in the y direction; *’circle’: circular path around a k-point, given center and radius; *’square’: retangular region with nk1 points along x and nk2 points along y. Region defined given x and y start and end points or full BZ.

berry_path (str): A string representing the band path to follow. The first and last k-point must not be the same. berry_high_sym_points (dictionary): A dictionary with symbols of high symmetry points as keys and length 3 numpy arrays containg the location of the symmetry points as values. nk (int): Number of k-points to include in the path closed (bool, optional): whether or not to include the connection of the last and first points in the loop method (str, {‘berry’,’zak’}): ‘berry’ returns the usual berry phase. ‘zak’ includes the Zak phase for 1D systems which takes into account the Bloch factor exp(-iG.r) accumulated over a Brillouin zone. See J. Zak, Phys. Rev. Lett. 62, 2747 (1989)

sub (None or list of int, optional): index of selected bands to calculate the Berry phase occupied (bool, optional): calculate the Berry phase over all occupied bands (if set to True, sub is set to None) kxlim (tuple, float): start and end points in x direction for sampling the BZ, used when kspace_method=’square’ . kylim (tuple, float): start and end points in y direction for sampling the BZ, used when kspace_method=’square’ . eigvals (bool, optional): write overlap matrix eigenvalues eigvecs (bool, optional): write overlap matrix eigenvectors save_prd (bool, optional): save overlap matrix fname (str, optional): filename to save the berry phase results contin (bool, optional): make berry phase continuous by fixing 2pi shifts

Returns:

Berry/Zak phase

phonon_setup(supercell_matrix, primitive_matrix=None, displacement_distance=0.01, q_mesh=None, q_path=None)[source]#

Initialise the phonopy interface (Stage 0: structure bridge).

Converts the PAOFLOW structure into a phonopy unit cell, stores the phonon configuration on the DataController and creates the phonopy.Phonopy object reused by subsequent phonon stages.

Arguments:
supercell_matrix: Supercell used for the finite-displacement

force constants. Accepts a scalar (isotropic diagonal), a length-3 sequence (anisotropic diagonal) or a 3x3 matrix.

primitive_matrix (optional): Primitive-cell transformation passed

to phonopy. May be None, 'auto' or a 3x3 matrix.

displacement_distance (float): Atomic displacement amplitude in

Angstrom used to generate displaced supercells.

q_mesh (optional): Default q-point mesh for DOS / thermal

properties (used in later stages).

q_path (optional): Default q-point path for the phonon dispersion

(used in later stages).

Returns:

None

phonons(supercell_matrix=None, primitive_matrix=None, displacement_distance=None, forces=None, phonon_dir='phonon', pp_dir=None, prefix=None, kgrid=None, ibrav=None, hubbard_file=None, hubbard_card=None, nac=False, born_file=None, born=None, dielectric=None, q_path=None, q_labels=None, q_npoints=101, mesh=None, do_bands=True, do_dos=True, do_thermal=False, t_min=0.0, t_max=1000.0, t_step=10.0, units='THz', fname='phonon')[source]#

Harmonic phonons via phonopy finite displacements (Stage 1).

The routine operates in two phases:

  1. Generate (forces=None): build the phonopy object, create the displaced supercells and write a complete, ready-to-run Quantum ESPRESSO pw.x SCF input for each one (<outputdir>/<phonon_dir>/supercell-NNN.in). Run pw.x on every input, then call this method again with forces=....

  2. Analyse (forces provided): assemble the second-order force constants and compute the requested harmonic properties.

Arguments:
supercell_matrix: Supercell for the finite displacements (scalar,

length-3 or 3x3). Required on the first call; reused afterwards.

primitive_matrix (optional): phonopy primitive transformation

(None -> identity, 'auto' or a 3x3 matrix).

displacement_distance (float, optional): Displacement amplitude in

Bohr (default 0.01).

forces: Force source for the analysis phase. None -> only

write the displaced-supercell inputs; 'qe' -> harvest forces from supercell-NNN.out in phonon_dir; a path string -> ingest an external FORCE_SETS; an array (ndisp, natoms, 3) (Ry/au) -> use directly.

phonon_dir (str): Sub-directory (under outputdir) for the

displaced supercells and FORCE_SETS.

pp_dir (str, optional): Pseudopotential directory written into the

QE inputs (default: the DFT .save path).

prefix (str, optional): QE prefix for the supercell runs. kgrid (optional): Explicit Monkhorst-Pack grid for the supercell

(default: unit-cell grid scaled by the supercell multiplicity).

ibrav (int, optional): Quantum ESPRESSO Bravais lattice index used

to derive the default high-symmetry dispersion path when q_path is None (the QE .save does not record it).

hubbard_file (str, optional): Path to a pw.x input whose

new-style HUBBARD card is read and appended to every displaced-supercell input so the forces reflect the DFT+U electronic structure. Only on-site U (manifold) parameters are kept; intersite V lines (cell-specific atom indices) are dropped.

hubbard_card (str, optional): Explicit HUBBARD card text

(overrides hubbard_file).

nac (bool): Apply the non-analytical term correction (LO-TO

splitting near Gamma). Requires born_file or both born and dielectric.

born_file (str, optional): Path to a phonopy BORN file with the

dielectric tensor and Born effective charges; takes precedence over born/dielectric when given.

born (array_like, optional): Born effective charges

(natom_prim, 3, 3) in units of the elementary charge.

dielectric (array_like, optional): (3, 3) high-frequency

dielectric tensor.

q_path (optional): Dispersion path as a sequence of segments in

fractional reciprocal coordinates; None -> path derived from ibrav (or automatic seekpath path if ibrav is unset).

q_labels (optional): Tick labels matching q_path. q_npoints (int): q-points per path segment. mesh (optional): q-mesh for DOS / thermal properties (default

[20, 20, 20]).

do_bands, do_dos, do_thermal (bool): Properties to compute. t_min, t_max, t_step (float): Temperature grid (K) for thermal

properties.

units (str): Frequency units for outputs, 'THz' or 'cm-1'. fname (str): Output filename prefix.

Returns:

None

born_charges(supercell_matrix=None, primitive_matrix=None, method='dfpt', forces=None, phonon_dir='phonon', pp_dir=None, prefix=None, outdir=None, kgrid=None, field_strength=0.001, nberrycyc=3, hubbard_file=None, hubbard_card=None, enforce_sum_rule=True, symmetrize=True)[source]#

Born effective charges and epsilon_inf (Stage 2b).

Computes the macroscopic Born effective charge tensors and the high-frequency (clamped-ion) dielectric tensor, and writes a phonopy BORN file usable by phonons() (nac=True, born_file=...) for the LO-TO splitting. Two back-ends are available:

  • method='dfpt' (default): a single Gamma-point ph.x run (epsil=.true., trans=.false.) gives both tensors directly. Fast and accurate, but unavailable for DFT+U / hybrid functionals.

  • method='field': finite electric-field (lelfield) runs on the primitive cell (central differences of forces and polarization). Slower, but works whenever ph.x cannot be used.

The routine operates in two phases:

  1. Generate (forces=None): build the phonopy object and write the QE input(s). For method='dfpt' this is a single ph_epsil.in; for method='field' it is seven primitive-cell field-*.in SCF inputs. Run QE on the input(s), then re-call with forces='qe'.

  2. Analyse (forces='qe'): parse the results, impose the acoustic sum rule, symmetrize, and write the BORN file.

Arguments:
supercell_matrix: Supercell used to build the phonopy object (only

the primitive cell is used here); reused from a previous phonon call when omitted.

primitive_matrix (optional): phonopy primitive transformation. method (str): 'dfpt' (ph.x) or 'field' (lelfield). forces: None -> write the QE input(s) only; 'qe' -> harvest

the QE output(s) and write BORN.

phonon_dir (str): Sub-directory (under outputdir) for the QE

runs and the BORN file.

pp_dir (str, optional): Pseudopotential directory (method='field'

QE inputs).

prefix (str, optional): QE prefix. For method='dfpt' this

defaults to the DFT .save prefix so ph.x reuses the existing self-consistent save.

outdir (str, optional): QE outdir for method='dfpt' (default:

the directory containing the DFT .save).

kgrid (optional): Monkhorst-Pack grid for the primitive cell

(method='field'; default: the unit-cell grid).

field_strength (float): efield_cart magnitude in QE atomic units

(method='field'; 1 a.u. = 36.3609e10 V/m).

nberrycyc (int): Berry-phase cycles per SCF step (method='field'). hubbard_file (str, optional): Path to a pw.x input whose

new-style HUBBARD card is appended to the method='field' QE inputs (on-site U only; intersite V dropped). The method='dfpt' route instead reuses the Hubbard setup stored in the existing .save.

hubbard_card (str, optional): Explicit HUBBARD card text

(overrides hubbard_file).

enforce_sum_rule (bool): Impose sum_k Z*_k = 0. symmetrize (bool): Symmetrize the Born and dielectric tensors.

Returns:

None

ir_spectrum(supercell_matrix=None, primitive_matrix=None, forces='qe', phonon_dir='phonon', born_file=None, born=None, dielectric=None, freq_min=None, freq_max=None, npoints=2000, gamma=4.0, units='cm-1', fname='phonon')[source]#

Infrared spectrum from Born charges and zone-centre eigenvectors (Stage 3).

For each zone-centre mode the mode effective charge vector Zbar_v,a = sum_k,b Z*_k,a,b e_v,k,b / sqrt(M_k) is formed from the Born effective charges, the (mass-weighted) Gamma-point eigenvectors and the atomic masses; the IR intensity is I_v = sum_a |Zbar_v,a|^2. A Lorentzian broadening of each mode yields the continuous spectrum. The transverse-optical eigenvectors at exactly Gamma are used, so the non-analytical (LO-TO) correction is not required.

The harmonic force constants are rebuilt deterministically from the displaced-supercell forces (as in phonons()), and the Born charges are taken from born/born_file or from a preceding born_charges() call.

Arguments:
supercell_matrix: Supercell used to build the phonopy object;

reused from a previous phonon call when omitted.

primitive_matrix (optional): phonopy primitive transformation. forces: Force source for the harmonic force constants, as in

phonons() ('qe' -> harvest supercell-NNN.out; a path -> ingest FORCE_SETS; an array -> use directly).

phonon_dir (str): Sub-directory (under outputdir) with the

displaced supercells / FORCE_SETS and the BORN file.

born_file (str, optional): Path to a phonopy BORN file with the

Born effective charges; takes precedence over born.

born (array_like, optional): Born effective charges

(natom_prim, 3, 3) in units of the elementary charge.

dielectric (array_like, optional): (3, 3) high-frequency

dielectric tensor (read alongside born_file; unused by the oscillator strengths).

freq_min, freq_max (float, optional): Frequency-axis limits of the

broadened spectrum (in units).

npoints (int): Number of points on the broadened-spectrum grid. gamma (float): Lorentzian full width at half maximum (in units). units (str): Frequency units for outputs, 'cm-1' or 'THz'. fname (str): Output filename prefix; writes <fname>_ir_modes.dat

and <fname>_ir_spectrum.dat.

Returns:

None

raman_spectrum(supercell_matrix=None, primitive_matrix=None, forces='qe', phonon_dir='phonon', raman_dir='raman', delta=0.05, nbnd=None, basispath=None, configuration='extended', pthr=0.95, position_dipoles=True, nfft=None, e_static=0.05, method='static', lifetime=0.1, e_window=None, e_ne=None, dielectric_callback=None, laser_nm=None, temperature=300.0, freq_min=None, freq_max=None, npoints=2000, gamma=4.0, units='cm-1', fname='phonon', generate=None)[source]#

Raman spectrum by finite differences of the dielectric tensor (Stage 4).

Two flavours, selected with method:

  • 'static' (default) – non-resonant (Placzek) Raman from the finite-difference derivative of the static dielectric tensor (omega -> 0). The Raman tensor is real.

  • 'resonance' – resonance Raman from the derivative of the complex dielectric tensor evaluated at the laser frequency omega_L (set by laser_nm). In the independent-particle limit this is the Albrecht A+B sum (Franck-Condon and Herzberg-Teller captured together, since the finite difference differentiates the transition energies and the transition dipoles), with resonance enhancement as omega_L approaches the interband transitions. The Raman tensor is complex and intensities use 45|a|^2 + 7 gamma^2.

Two-phase workflow (identical for both flavours):

  • generate – displace the primitive cell by +/-delta along each optical zone-centre eigenvector and write a ready-to-run pw.x SCF input per displacement under <raman_dir>/mode-NNN-{plus,minus}/<prefix>.scf.in. Run these SCF calculations (any tool); no NSCF/projwfc are needed.

  • analyse – for every displaced cell run the PAOFLOW optical pipeline (internal projections -> dielectric tensor) to obtain the dielectric tensor (static, or at omega_L for resonance), build the Raman tensor R^v = (eps(+delta) - eps(-delta)) / (2 delta) per mode, and form the orientationally-averaged (powder) Stokes intensities.

The phase is chosen automatically (generate=None): analyse when every displaced-cell SCF save is present, otherwise generate. Pass generate=True/False to force a phase.

Arguments:
supercell_matrix, primitive_matrix: As in phonons(); reused

from a previous call when omitted.

forces: Force source for the harmonic force constants, as in

phonons() (used to obtain the zone-centre eigenvectors).

phonon_dir (str): Sub-directory with the displaced supercells /

FORCE_SETS.

raman_dir (str): Sub-directory for the displaced primitive cells and

their dielectric outputs.

delta (float): Mass-weighted normal-coordinate displacement

amplitude (Bohr*sqrt(amu) convention; the same value is used to finite-difference).

nbnd (int, optional): Bands for the displaced SCF inputs (empty

states are needed for the optical response).

basispath (str, optional): Pseudo-atomic basis directory for the

internal PAO projections in the analyse phase.

configuration (str): PAO basis configuration (default 'extended'). pthr (float): Projectability threshold for the analyse phase. position_dipoles (bool): Add the PAO position dipoles to the velocity

operator of the dielectric tensor (recommended; replaces the former non-local velocity correction).

nfft (tuple, optional): Double-grid interpolation (n1, n2, n3). e_static (float): Upper energy (eV) of the 2-point grid used to read

the static dielectric tensor (epsilon_1 at omega -> 0; method='static' only).

method (str): 'static' (non-resonant), 'resonance' (at the

laser frequency), or 'all' (both, harvested from a single optics run per displaced cell; the static spectrum is written to <fname>_static_raman_*.dat and each laser to <fname>_<nm>nm_raman_*.dat).

lifetime (float): Lorentzian lifetime broadening (eV) of the complex

dielectric tensor in the resonance case (the delta of dielectric_tensor()); keeps the response finite on resonance.

e_window (float, optional): Upper energy (eV) of the per-cell

dielectric grid in the resonance case (default: just above the largest laser energy).

e_ne (int, optional): Number of grid points for the per-cell

dielectric grid in the resonance case (default: chosen so the spacing resolves lifetime).

dielectric_callback (callable, optional): ``f(savedir, workpath) ->

ndarray`` returning the dielectric tensor of a displaced cell – (3, 3) for method='static' or (len(laser_nm), 3, 3) (complex) for method='resonance'. Overrides the built-in PAO pipeline.

laser_nm (float or sequence, optional): Excitation wavelength(s) in

nm. Required for method='resonance' (sets omega_L and enables the (omega_L - omega_v)^4 prefactor). A sequence produces one spectrum per wavelength (a Raman excitation profile), each written to <fname>_<nm>nm_raman_*.dat.

temperature (float): Temperature (K) for the Bose (n+1) factor. freq_min, freq_max, npoints, gamma, units, fname: Spectrum grid and

output options, as in ir_spectrum(). Writes <fname>_raman_modes.dat and <fname>_raman_spectrum.dat.

Returns:

None

vibrational_dielectric(supercell_matrix=None, primitive_matrix=None, forces='qe', phonon_dir='phonon', born_file=None, born=None, dielectric=None, gamma=4.0, freq_min=None, freq_max=None, npoints=2000, units='cm-1', emit_ev=True, emissivity=False, emis_angles=(0.0,), emis_ntheta=64, emis_temperature=(300.0,), outdir='vibdielectric', fname='phonon')[source]#

Vibrational (ionic) dielectric function eps(omega) (Stage 5).

The polar zone-centre phonons add a lattice resonance to the electronic high-frequency dielectric tensor eps_inf:

eps_ab(w) = eps_inf_ab
    + (e^2 / (eps0 m_u V)) * sum_v Zbar_v,a Zbar_v,b
                                  / (w_v^2 - w^2 - i w gamma_v),

where Zbar_v,a = sum_k,b Z*_k,a,b e_v,k,b / sqrt(M_k) is the mode effective charge vector (as in ir_spectrum()) and S_v,ab = Zbar_v,a Zbar_v,b the mode-oscillator-strength tensor. The static limit eps(0) = eps_inf + sum_v S_v / w_v^2 (generalized Lyddane-Sachs-Teller) and, for a polar crystal, a reststrahlen band (Re eps < 0 between w_TO and w_LO) follow directly. Acoustic modes carry no dipole and do not contribute.

The harmonic force constants are rebuilt from the displaced-supercell forces (as in phonons()); the Born charges and eps_inf are taken from born/dielectric/born_file or from a preceding born_charges() call.

Arguments:
supercell_matrix, primitive_matrix: As in phonons(); reused

from a previous call when omitted.

forces: Force source for the harmonic force constants, as in

phonons() ('qe' -> harvest supercell-NNN.out; a path -> ingest FORCE_SETS; an array -> use directly).

phonon_dir (str): Sub-directory (under outputdir) with the

displaced supercells / FORCE_SETS and the BORN file.

born_file (str, optional): Path to a phonopy BORN file providing

the Born charges and eps_inf.

born (array_like, optional): Born effective charges

(natom_prim, 3, 3) in units of the elementary charge.

dielectric (array_like, optional): (3, 3) high-frequency

dielectric tensor eps_inf.

gamma (float or array_like): Phonon linewidth(s) used as the

Lorentzian damping (in units); a scalar broadens every mode equally, an array gives a per-mode width.

freq_min, freq_max (float, optional): Frequency-axis limits (in

units); defaults span 0 to just above the highest LO mode so the reststrahlen band is captured.

npoints (int): Number of points on the frequency grid. units (str): Frequency units for inputs/outputs, 'cm-1' or

'THz'.

emit_ev (bool): Write the per-component eps{r,i}_<ab>.dat files

with the frequency axis in eV (so they plot directly with GPAO.plot_optical()); otherwise in units.

emissivity (bool): Also derive the reststrahlen (phonon) emissivity

from eps(omega) via the Fresnel/Kirchhoff helpers in PAOFLOW.response.do_epsilon and write it under outdir (directional refl_th*/emis_th*, spectral hemispherical emish_* and Planck-weighted total emist_*).

emis_angles (array_like): Incidence angles (degrees) for the

directional reflectivity/emissivity.

emis_ntheta (int): Polar-angle samples for the hemispherical

integral.

emis_temperature (float or array_like): Temperature(s) (K) for the

total hemispherical emissivity.

outdir (str): Sub-directory (under outputdir) for the

per-component dielectric files.

fname (str): Output basename; writes

<fname>_vibdielectric_static.dat and the per-component eps{r,i}/eels/refl_<ab>.dat files under outdir.

Returns:

None

quasi_harmonic(supercell_matrix=None, primitive_matrix=None, displacement_distance=None, nvolumes=5, strain=0.02, forces=None, qha_dir='qha', pp_dir=None, prefix=None, kgrid=None, hubbard_card=None, hubbard_file=None, mesh=None, t_min=0.0, t_max=1000.0, t_step=10.0, eos='vinet', pressure=0.0, ibrav=None, q_path=None, q_labels=None, q_npoints=101, gruneisen_band=True, gruneisen_cutoff=None, units='THz', fname='qha')[source]#

Quasi-harmonic approximation over an isotropic volume scan (Stage 4).

Combines the static DFT energy E(V) with the harmonic vibrational free energy F_vib(T, V) sampled at nvolumes isotropically strained cells to obtain the temperature-dependent equilibrium volume, thermal expansion, bulk modulus, Gibbs free energy, constant-pressure heat capacity and thermodynamic Gruneisen parameter.

The routine operates in two phases:

  1. Generate (forces=None): build the strained cells and write, under <outputdir>/<qha_dir>/vol-NN/, a static unit-cell SCF input (scf.in, for E(V)) and the phonopy displaced supercells (supercell-NNN.in, for the phonons). Run pw.x on every input, then re-call with forces='qe'.

  2. Analyse (forces='qe'): harvest the energies and forces, build the force constants and thermal properties at each volume, and run the QHA.

Arguments:
supercell_matrix: Supercell for the finite displacements (scalar,

length-3 or 3x3). Required on the first call; reused afterwards.

primitive_matrix (optional): phonopy primitive transformation. displacement_distance (float, optional): Displacement amplitude in

Bohr (default 0.01).

nvolumes (int): Number of sampled volumes, 5 (default) or 3.

5 uses the full equation-of-state QHA (phonopy.PhonopyQHA); 3 uses a parabolic F(V; T) fit (a four-parameter EOS needs at least four points).

strain (float): Maximum linear strain of the scan; the volumes span

omega * (1 +/- strain)**3 (default 0.02).

forces: None -> write the QE inputs only; 'qe' -> harvest the

scf.out / supercell-NNN.out files and run the QHA.

qha_dir (str): Sub-directory (under outputdir) holding the

per-volume vol-NN directories.

pp_dir (str, optional): Pseudopotential directory written into the

QE inputs (default: the DFT .save path).

prefix (str, optional): QE prefix for the supercell runs. kgrid (optional): Explicit Monkhorst-Pack grid for the supercells

(default: the unit-cell grid scaled by the supercell size).

hubbard_file (str, optional): pw.x input whose new-style

HUBBARD card is appended to every QE input (on-site U only; intersite V dropped).

hubbard_card (str, optional): Explicit HUBBARD card text

(overrides hubbard_file).

mesh (optional): q-mesh for the per-volume thermal properties

(default [20, 20, 20]).

t_min, t_max, t_step (float): Temperature grid (K). eos (str): Equation of state for the nvolumes=5 route,

'vinet' (default), 'birch_murnaghan' or 'murnaghan'.

pressure (float): External pressure (GPa) added as a pV term. ibrav (int, optional): Quantum ESPRESSO Bravais lattice index used to

derive the default q-path for the mode-Grueneisen dispersion.

q_path (optional): Explicit dispersion path (segments in fractional

reciprocal coordinates) for the mode-Grueneisen band; None derives it from ibrav.

q_labels (optional): Tick labels matching q_path. q_npoints (int): q-points per path segment for the Grueneisen band. gruneisen_band (bool): Also compute the mode-Grueneisen parameters

along the q-path (dispersion), written to <fname>_gruneisen_band.dat.

gruneisen_cutoff (float, optional): Frequency cutoff (in units)

below which the acoustic 1/omega**2 divergence of the mode Grueneisen parameter is masked near Gamma; None uses 1% of the maximum frequency, 0 disables the masking.

units (str): Frequency units for the Grueneisen-band frequencies,

'THz' (default) or 'cm-1'.

fname (str): Output filename prefix; writes <fname>_ev.dat,

<fname>_volume.dat, <fname>_thermal_expansion.dat, <fname>_bulk_modulus.dat, <fname>_gibbs.dat, <fname>_heat_capacity.dat, <fname>_gruneisen.dat and (when enabled) <fname>_gruneisen_band.dat.

Returns:

None

arpes(experiment, self_energy=None, ispin=0, basis=None)[source]#

ARPES intensity map of the PAO Hamiltonian (PAOFLOW.arpes).

Photoemission matrix elements of the PAO Bloch states with a plane-wave final state (chinook formalism, Day et al. 2019), the spectral function with an optional band-resolved self-energy, the Fermi factor and the resolution. Call after projections and pao_hamiltonian.

Arguments:
experiment (PAOFLOW.arpes.ArpesExperiment): Photon energy, work function,

inner potential, temperature, polarisation, energy window, momentum mesh or path, resolution, radial-function choice.

self_energy (optional): None (bare bands), a constant -i Gamma, a

PAOFLOW.arpes.GridSelfEnergy, an array (N, nb, nw) or a callable f(w, energies, kpoints, bands) such as PAOFLOW.elphon.self_energy.TabulatedSelfEnergy of a Fan-Migdal run.

ispin (int): Spin channel of HRs. basis (optional): A prepared PhotoemissionBasis (e.g. with slab depths or

cross sections); default built from the projection basis.

Returns:

PAOFLOW.arpes.IntensityMap: Raw and broadened intensities, the window bands and their matrix-element weights; save writes an .npz file.

electron_phonon(supercell_matrix=None, displacement_distance=0.06, forces=None, elphon_dir='elphon', pp_dir=None, prefix=None, kgrid=None, hubbard_file=None, hubbard_card=None, configuration='standard', basispath=None, nbnd=None, is_plusminus='auto', displacement_mode='symmetry', pthr=0.95, shift_type=1, project_good_subspace=True)[source]#

Electron-phonon coupling via finite differences of the PAO H (Stage S7).

Builds the electron-phonon matrix elements by finite-differencing the PAO Hamiltonian with respect to atomic displacements (frozen phonon in a supercell), reusing the projection / pao_hamiltonian pipeline and the phonon module’s supercell machinery.

The routine is two-phase:

  1. Generate (forces=None): initialise the phonon supercell, displace every atom of the reference primitive cell by +/- displacement_distance along x, y and z, and write one static pw.x SCF input per displaced supercell under <outputdir>/<elphon_dir>/ (plus the reference supercell.in and a displacements.json manifest). The displacement set is reduced by the crystal symmetry (via phonopy), so only the inequivalent displacements are computed (a single one for fcc metals). Each displaced run gets a unique prefix so its .save survives, and nbnd is sized to the PAO projection basis of configuration. Run pw.x on each, then re-call with forces='qe'.

  2. Analyse (forces='qe'): rebuild the PAO Hamiltonian of every displaced supercell and central-difference to dV = dH/du (stored on the controller as elphon_dV). The g_mn^v(k, q) assembly and the derived properties land in the next stage.

Arguments:
supercell_matrix: Supercell for the displacements (scalar, length-3

or 3x3). Required on the first call; reused afterwards.

displacement_distance (float): Displacement amplitude in Bohr

(default 0.06).

forces: None -> write the displaced-supercell inputs; 'qe' ->

harvest and build dV.

elphon_dir (str): Sub-directory (under outputdir) for the

displaced supercells and the manifest.

pp_dir (str, optional): Pseudopotential directory written into the QE

inputs (default: the DFT .save path).

prefix (str, optional): Base QE prefix for the supercell runs

(each displacement appends _dispNNN).

kgrid (optional): Explicit Monkhorst-Pack grid for the supercells

(default: the unit-cell grid scaled by the supercell size).

hubbard_file (str, optional): pw.x input whose new-style

HUBBARD card is appended to every input (on-site U only).

hubbard_card (str, optional): Explicit HUBBARD card text

(overrides hubbard_file).

configuration (str): PAO basis configuration ('minimal',

'standard' or 'extended') that sizes nbnd and drives the analyse-phase projections.

basispath (str, optional): Local PAO basis directory used by the

analyse-phase projections.

nbnd (int, optional): Explicit band count for the displaced-supercell

SCF inputs (default: the PAO basis size for configuration).

is_plusminus ({‘auto’, True, False}): Passed to phonopy’s

displacement generation. 'auto' (default) keeps the symmetry-minimal set and takes forward differences against the reference supercell; True adds the explicit - for central differences.

displacement_mode ({‘symmetry’, ‘cartesian’}): 'symmetry'

(default) uses phonopy’s symmetry-reduced displacements (the full Cartesian tensor is reconstructed by the symmetry expansion); 'cartesian' displaces every reference-cell atom explicitly along x, y and z (full Cartesian derivative directly, more runs).

pthr (float): Projectability threshold for the analyse phase. shift_type (int): Hamiltonian shift scheme for the analyse phase.

Returns:

None

linear_response(response='shc', gamma=0.01, twoD=False, t_odd=False, full_chi2=False, intraband=False, interband=False, s_tensor=None, a_tensor=None, eminH=-1.0, emaxH=1.0, esize=200)[source]#
Calculate various linear response tensors:
  1. Spin Hall conductivity tensors

  2. Rashba-Edelstein effect tensors

  3. Charge conductivity tensors

  4. Anomolous Hall effect tensors

All of above tensors can be computed for both magnetic(broken time-reversible symmetry) and nonmagnetic systems.

Arguments:
response (string) :

response to be calculated; Acceptable strings: ‘shc’, ‘ahc’, ‘ree’, ‘cond’

gamma (float):

spectral broadening to be used

t_odd (boolean):

If True, tensor components that is odd under time-reversible symmetry will be calculated

full_chi2 (boolean):

If True, Gamma dependent Eqn. (2) will be used to compute the tensor. Refer tutorial03 for equation reference.

intraband (boolean) :

If True, only intraband contribution <nk|oper|nk> will be calculated

interband (boolean) :

If True, only interband contribution <nk|oper|mk> (for n not equal to m) will be calculated

s_tensor (nested list):
List of tensor elements to calculate for SHE

Ex: To calculate xxx and zxy use [[0,0,0],[2,0,1]]) first index = spin polarization second index = spin current third index = applied electric field

a_tensor (nested list):
List of tensor elements to calculate for REE/AHE/Conductivity

Ex: [[1,2],[0,1]] firs index: direction of the response second index: direction of of applied electric field

twoD (bool):

True to output in 2D units of Ohm^-1, neglecting the sample height in the z direction

eminH (float):

The minimum energy in the range

emaxH (float):

The maximum energy in the range

esize (int):

The number of energy increments

Returns:

None