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:
bxsf_from_arrays()— build aPAOFLOW.pyskeaf.io_bxsf.BXSFDatain memory from a NumPy energy array + reciprocal lattice, with optional unit conversion.run_from_paoflow()— convenience: build the BXSFData and immediately callPAOFLOW.pyskeaf.run_skeaf()for one band.
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 = 2π · a*). The energy_unit and recip_unit parameters of
bxsf_from_arrays() handle the conversion.
Attributes#
Functions#
|
Build a |
|
One-shot driver: PAOFLOW arrays → |
|
Run pyskeaf on one band of a PAOFLOW data container. |
Module Contents#
- 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
BXSFDatafrom 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. Ifenforce_periodic_endpointis True (default) and an(nx,ny,nz)grid is given without that repetition (i.e.E.shapematches 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 toenergy_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 offermi_energy. Defaults toenergy_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
recipafter conversion (defaults to (0, 0, 0); SKEAF requires the BXSF origin to be the Γ point).enforce_periodic_endpoint (bool, default True) – See
energiesabove.
- Returns:
Ready to pass to
PAOFLOW.pyskeaf.run_skeaf()or any other pyskeaf API.- Return type:
- 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
BXSFDatain memory viabxsf_from_arrays(), then constructs a minimalPAOFLOW.pyskeaf.config.SkeafConfig(usinghvd='n'by default with the explicittheta/phi) and callsPAOFLOW.pyskeaf.runner.run_skeaf().For an angle sweep, populate
config_overrideswith{'hvd': 'r', 'theta_start': ..., 'theta_end': ..., 'phi_start': ..., 'phi_end': ..., 'num_rots': ...}(angles in radians, matchingSkeafConfig).- Parameters:
energies – Forwarded to
bxsf_from_arrays().recip – Forwarded to
bxsf_from_arrays().fermi_energy – Forwarded to
bxsf_from_arrays().energy_unit – Forwarded to
bxsf_from_arrays().recip_unit – Forwarded to
bxsf_from_arrays().fermi_unit – Forwarded to
bxsf_from_arrays().filename – Forwarded to
bxsf_from_arrays().numint (int) – Interpolation density (passed through to SKEAF).
theta (float) – Field angles in radians. Used when
hvd in {'n', 'r'}.phi (float) – Field angles in radians. Used when
hvd in {'n', 'r'}.hvd ({'a', 'b', 'c', 'n', 'r'}) – H-vector selector; see
PAOFLOW.pyskeaf.geometry.set_field_angle().write_files – Forwarded to
PAOFLOW.pyskeaf.runner.run_skeaf(); default iswrite_files=False(in-memory only — typical for embedding).output_dir – Forwarded to
PAOFLOW.pyskeaf.runner.run_skeaf(); default iswrite_files=False(in-memory only — typical for embedding).config_overrides (dict, optional) – Field-name → value overrides applied to the
PAOFLOW.pyskeaf.config.SkeafConfiginstance before running (e.g.{'min_extfreq': 0.05, 'freq_same_frac': 0.005}).
- 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
paoflowargument 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, callbxsf_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 onpaoflow.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().