PAOFLOW.transport.io.write_data#

Functions#

write_data(egrid, data, label, output_dir[, prefix, ...])

Write general data (e.g., conductance or DOS) into a single text file.

write_eigenchannels(data, ie, ik, vkpt, ...[, prefix, ...])

Write eigenchannel data to a compressed .npz file with metadata.

populate_real_space_hamiltonian(data_controller, ...)

Compute the real-space Hamiltonian (and optional overlap) blocks and store them

write_operator_xml(*, output_dir, filename[, ...])

Write operator data to XML file in the exact format produced by Fortran iotk library.

write_current_results(*, output_dir, bias_grid, currents)

Write current-vs-bias results to disk.

Module Contents#

PAOFLOW.transport.io.write_data.write_data(egrid, data, label, output_dir, prefix='', postfix='', precision=9, verbose=True)[source]#

Write general data (e.g., conductance or DOS) into a single text file.

Parameters:
  • egrid ((ne,) ndarray) – Energy grid.

  • data ((dim, ne) or (ne,) ndarray) – Data to write.

  • label (str) – Data type label used for header and filename (e.g., “conductance”, “doscond”).

  • output_dir (Path) – Directory to store the output files.

  • prefix (str) – Optional prefix to prepend to the filename.

  • postfix (str) – Optional postfix to append to the filename.

  • precision (int) – Number of decimal places to write.

  • verbose (bool) – Whether to print output file paths.

PAOFLOW.transport.io.write_data.write_eigenchannels(data, ie, ik, vkpt, transport_direction, output_dir, prefix='eigchn', overwrite=True, verbose=True)[source]#

Write eigenchannel data to a compressed .npz file with metadata.

Parameters:
  • data ((n, m) complex ndarray) – Eigenchannel matrix. Columns correspond to eigenchannels.

  • ie (int) – Energy index.

  • ik (int) – k-point index.

  • vkpt ((3,) float ndarray) – Coordinates of the k-point in crystal units.

  • transport_direction ({'x', 'y', 'z'}) – Direction of transport.

  • output_dir (Path) – Directory to write the output file.

  • prefix (str) – Prefix for the filename (default: “eigchn”).

  • overwrite (bool) – If True, overwrite existing file.

  • verbose (bool) – If True, print where the file was written.

Returns:

`filepath` – Path to the written file.

Return type:

Path

Notes

This uses .npz to store:
  • eigenchannel data

  • metadata: ie, ik, vkpt, dims, transport_direction

PAOFLOW.transport.io.write_data.populate_real_space_hamiltonian(data_controller, hk_data, do_overlap_transformation)[source]#

Compute the real-space Hamiltonian (and optional overlap) blocks and store them in the shared data store as HRs/SRs.

These in-memory arrays are what the transport pipeline consumes downstream. Serializing them to the .ham file (see write_internal_format_files()) is an independent, debug-only step that depends on the arrays populated here.

Parameters:
  • hk_data (Dict[str, np.ndarray]) –

    Dictionary containing:
    • ”Hk”: shape (nspin, nkpnts, dim, dim), Hamiltonian matrices

    • ”Sk” (optional): shape (dim, dim, nkpnts), Overlap matrices

    • ”ivr”: shape (nrtot, 3), R-vectors

  • do_overlap_transformation (bool) – If True and overlap matrices are provided, the overlap blocks are also computed.

Notes

The Cartesian k-points and weights used by the Fourier sum are read from the shared data store (vkpts_cartesian/wk), which is the single source of truth.

PAOFLOW.transport.io.write_data.write_operator_xml(*, output_dir, filename, operator_matrix=None, ivr=None, vr=None, grid=None, dimwann, dynamical, analyticity='', eunits='eV', nomega=None, iomg_s=None, iomg_e=None, nrtot=None)[source]#

Write operator data to XML file in the exact format produced by Fortran iotk library.

This function mimics the Fortran subroutine operator_write_aux exactly, including formatting, spacing, and element ordering.

PAOFLOW.transport.io.write_data.write_current_results(*, output_dir, bias_grid, currents)[source]#

Write current-vs-bias results to disk.

Parameters:
  • output_dir (str) – Directory where the output file is written.

  • postfix (str) – String appended to the default file name current.

  • bias_grid (NDArray[np.float64]) – Bias voltages in V, shape (nbias,).

  • currents (NDArray[np.float64]) – Current values aligned with bias_grid, shape (nbias,).

Returns:

Writes current{postfix}.dat with two columns V I using numpy.savetxt().

Return type:

None