PAOFLOW.pyskeaf.paoflow_adapter#

Adapter glue for embedding pyskeaf inside PAOFLOW.

PAOFLOW produces band energies on a regular k-grid in memory; this module lets a caller feed those arrays straight into PAOFLOW.pyskeaf.run_skeaf() without writing a BXSF file to disk first.

Two entry points are exposed:

Conventions#

SKEAF (and therefore pyskeaf) expects energies in Rydberg and reciprocal lattice vectors in a.u.⁻¹ without the 2π factor — the BXSF “General Grid” convention. PAOFLOW commonly works in eV and Å⁻¹ with the 2π factor (b = · a*). The energy_unit and recip_unit parameters of bxsf_from_arrays() handle the conversion.

Attributes#

Functions#

bxsf_from_arrays(energies, recip, fermi_energy, *[, ...])

Build a BXSFData from in-memory PAOFLOW arrays.

run_from_paoflow(energies, recip, fermi_energy, *, numint)

One-shot driver: PAOFLOW arrays → SKEAFResult.

run_from_paoflow_object(paoflow, band_index, *, numint)

Run pyskeaf on one band of a PAOFLOW data container.

Module Contents#

PAOFLOW.pyskeaf.paoflow_adapter.RYDBERG_IN_EV = 13.605693122994[source]#
PAOFLOW.pyskeaf.paoflow_adapter.bxsf_from_arrays(energies, recip, fermi_energy, *, energy_unit='Ry', recip_unit='au', fermi_unit=None, filename='paoflow_in_memory', origin=None, enforce_periodic_endpoint=True)[source]#

Build a BXSFData from in-memory PAOFLOW arrays.

Parameters:
  • energies (ndarray, shape (nx, ny, nz)) – Band energies on a regular k-grid spanning one reciprocal unit cell. SKEAF’s BXSF format requires the endpoint to be repeated so that E[-1, :, :] == E[0, :, :] along every axis. If enforce_periodic_endpoint is True (default) and an (nx,ny,nz) grid is given without that repetition (i.e. E.shape matches the k-grid one-to-one with no wrap-around), a wrap-around copy is appended along each axis. Pass an array that already repeats the endpoint and set this flag to False to skip the copy.

  • recip (ndarray, shape (3, 3)) – Reciprocal lattice vectors as rows; units selected by recip_unit.

  • fermi_energy (float) – Fermi energy in the units selected by fermi_unit (defaults to energy_unit).

  • energy_unit ({'Ry', 'Ha', 'eV'}, default 'Ry') – Unit of energies.

  • recip_unit ({'au', 'au_2pi', 'ang', 'ang_2pi'}, default 'au') – Unit of recip. See _to_recip_au_no2pi() for details. 'ang_2pi' (alias 'paoflow') is the typical PAOFLOW format.

  • fermi_unit (same options as energy_unit, optional) – Unit of fermi_energy. Defaults to energy_unit.

  • filename (str) – Informational tag stored on the BXSFData (used in output headers).

  • origin (sequence of 3 float, optional) – Origin of the k-grid in the same units as recip after conversion (defaults to (0, 0, 0); SKEAF requires the BXSF origin to be the Γ point).

  • enforce_periodic_endpoint (bool, default True) – See energies above.

Returns:

Ready to pass to PAOFLOW.pyskeaf.run_skeaf() or any other pyskeaf API.

Return type:

BXSFData

PAOFLOW.pyskeaf.paoflow_adapter.run_from_paoflow(energies, recip, fermi_energy, *, numint, theta=0.0, phi=0.0, hvd='n', energy_unit='Ry', recip_unit='au', fermi_unit=None, filename='paoflow_in_memory', output_dir=None, write_files=False, config_overrides=None)[source]#

One-shot driver: PAOFLOW arrays → SKEAFResult.

Builds a BXSFData in memory via bxsf_from_arrays(), then constructs a minimal PAOFLOW.pyskeaf.config.SkeafConfig (using hvd='n' by default with the explicit theta/phi) and calls PAOFLOW.pyskeaf.runner.run_skeaf().

For an angle sweep, populate config_overrides with {'hvd': 'r', 'theta_start': ..., 'theta_end': ..., 'phi_start': ..., 'phi_end': ..., 'num_rots': ...} (angles in radians, matching SkeafConfig).

Parameters:
PAOFLOW.pyskeaf.paoflow_adapter.run_from_paoflow_object(paoflow, band_index, *, numint, theta=0.0, phi=0.0, hvd='n', fermi_energy=None, energy_unit='eV', recip_unit='ang_2pi', **kwargs)[source]#

Run pyskeaf on one band of a PAOFLOW data container.

The paoflow argument is duck-typed: this function looks for an attribute or dict key named 'E_k' (or 'E_kn' / 'bands') of shape (..., n_bands) plus a reciprocal-lattice attribute named 'b_vectors' (or 'recip_lattice' / 'b_lattice'). If your PAOFLOW build uses different names, call bxsf_from_arrays() directly.

Parameters:
  • paoflow – An object or dict produced by PAOFLOW with the band-energy grid and reciprocal lattice attached. See above for the names searched.

  • band_index (int) – Which band (last axis of the energy array) to extract.

  • fermi_energy (float, optional) – Fermi energy in energy_unit. If None, looks for an 'E_F' / 'fermi' / 'fermi_energy' key on paoflow.

  • energy_unit – Defaults match the PAOFLOW convention (eV + Å⁻¹ with 2π).

  • recip_unit – Defaults match the PAOFLOW convention (eV + Å⁻¹ with 2π).

  • **kwargs – Passed through to run_from_paoflow().