Writers

Density writer

class rhodent.writers.density.DensityWriter(collector)[source]

Calculate density contributions

Parameters:

collector (ResultsCollector) – ResultsCollector object

property common_arrays: dict[str, ndarray[Any, dtype[float64]] | int | float]

Dictionary of eigenvalues and limits

fill_ulm(writer, work, result)[source]

Fill one entry of the ULM file

Parameters:
  • writer – Open ULM writer object

  • work (WorkMetadata) – Metadata to current piece of data

  • result (Result) – Result containing the current observables

write_empty_arrays_ulm(writer)[source]

Add empty arrays in to the ULM file

Parameters:

writer – Open ULM writer object

rhodent.writers.density.calculate_and_save_by_filename(out_fname, **kwargs)[source]

Calculate density contributions

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices – Collection of density matrices in the time or frequency domain

  • gpw_file – Filename of ground state file

  • write_extra – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.density.calculate_and_save_npz(out_fname, density_matrices, gpw_file, write_extra={})[source]

Calculate density contributions

Densities are saved in a numpy archive

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (BaseDensityMatrices) – Collection of density matrices in the time or frequency domain

  • gpw_file (str) – Filename of ground state file

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.density.calculate_and_save_ulm(out_fname, density_matrices, gpw_file, write_extra={})[source]

Calculate density contributions

Densities are saved in an ULM file

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (BaseDensityMatrices) – Collection of density matrices in the time or frequency domain

  • gpw_file (str) – Filename of ground state file

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

Energy writer

class rhodent.writers.energy.EnergyWriter(collector, only_one_pulse)[source]

Calculate energy contributions

Parameters:

collector (ResultsCollector) – ResultsCollector object

property common_arrays: dict[str, ndarray[Any, dtype[float64]] | int | float]

Dictionary of eigenvalues and limits

fill_ulm(writer, work, result)[source]

Fill one entry of the ULM file

Parameters:
  • writer – Open ULM writer object

  • work (ConvolutionDensityMatrixMetadata) – Metadata to current piece of data

  • result (Result) – Result containing the current observables

write_empty_arrays_ulm(writer)[source]

Add empty arrays in to the ULM file

Parameters:

writer – Open ULM writer object

rhodent.writers.energy.calculate_and_save_by_filename(out_fname, **kwargs)[source]

Calculate energy contributions

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices – Collection of density matrices in the time or frequency domain

  • voronoi – Optional Voronoi weights object. If given, then the energy contributions are additonally projected according to the weights.

  • energies_occ – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma – Gaussian broadening width in eV for the broadened distributions.

  • write_extra – Dictionary of extra key-value pairs to write to the data file

  • save_matrix – Whether the electron-hole map matrix should be computed and saved

  • save_dist – Whether the transition energy distributions should be computed and saved

rhodent.writers.energy.calculate_and_save_npz(out_fname, density_matrices, voronoi, energies_occ, energies_unocc, sigma=None, write_extra={}, save_matrix=False, save_dist=False, only_one_pulse=True)[source]

Calculate energy contributions

Energies and contributions are saved in a numpy archive

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (ConvolutionDensityMatrices) – Collection of density matrices in the time or frequency domain

  • voronoi (VoronoiWeights | None) – Optional Voronoi weights object. If given, then the energy contributions are additonally projected according to the weights.

  • energies_occ (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma (Optional[float]) – Gaussian broadening width in eV for the broadened distributions.

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

  • save_matrix (bool) – Whether the electron-hole map matrix should be computed and saved

  • save_dist (bool) – Whether the transition energy distributions should be computed and saved

  • only_one_pulse (bool) – If False, group arrays by pulse

rhodent.writers.energy.calculate_and_save_ulm(out_fname, density_matrices, voronoi, energies_occ, energies_unocc, sigma=None, write_extra={}, save_matrix=False, save_dist=False)[source]

Calculate energy contributions

Energies and contributions are saved in an ULM file

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (ConvolutionDensityMatrices) – Collection of density matrices in the time or frequency domain

  • voronoi (VoronoiWeights | None) – Optional Voronoi weights object. If given, then the energy contributions are additonally projected according to the weights.

  • energies_occ (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma (Optional[float]) – Gaussian broadening width in eV for the broadened distributions.

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

  • save_matrix (bool) – Whether the electron-hole map matrix should be computed and saved

  • save_dist (bool) – Whether the transition energy distributions should be computed and saved

Hot-carriers writer

class rhodent.writers.hcdist.HotCarriersWriter(collector, only_one_pulse)[source]

Calculate hot-carrier totals, and optionally broadened hot-carrier energy distributions

Parameters:
  • collector (ResultsCollector) – ResultsCollector object

  • only_one_pulse (bool) – False if the resulting outputs should have one dimension corresponding to different pulses. True if there should be no such dimension. If True, then the calculator must only hold one pulse.

property common_arrays: dict[str, ndarray[Any, dtype[float64]] | int | float]

Dictionary of eigenvalues and limits

rhodent.writers.hcdist.calculate_hcdist_and_save_by_filename(out_fname, **kwargs)[source]

Calculate broadened hot-carrier energy distributions, optionally averaged over time

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices – Collection of density matrices in the time domain

  • voronoi – Optional Voronoi weights object. If given, then the hot-carrier distributions are additonally projected according to the weights.

  • energies_occ – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma – Gaussian broadening width in eV for the broadened distributions.

  • average_times – If true, an average over the given times will be taken. If false, then hot-carrier distributions are computed separately over the times, and each output is written separately for each time

rhodent.writers.hcdist.calculate_hcdist_and_save_dat(out_fname, density_matrices, voronoi=None, energies_occ=[], energies_unocc=[], *, sigma, average_times=True)[source]

Calculate broadened hot-carrier energy distributions, optionally averaged over time

HC distributions are saved in a text file

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (TimeDensityMatrices | ConvolutionDensityMatrices) – Collection of density matrices in the time domain

  • voronoi (Optional[VoronoiWeights]) – Optional Voronoi weights object. If given, then the hot-carrier distributions are additonally projected according to the weights.

  • energies_occ (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma (float) – Gaussian broadening width in eV for the broadened distributions.

  • average_times (bool) – If true, an average over the given times will be taken. If false, then hot-carrier distributions are computed separately over the times, and each output is written separately for each time

rhodent.writers.hcdist.calculate_hcdist_and_save_npz(out_fname, density_matrices, voronoi, energies_occ=[], energies_unocc=[], *, sigma, average_times=True)[source]

Calculate broadened hot-carrier energy distributions, optionally averaged over time

HC distributions are saved in a compressed numpy archive

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (TimeDensityMatrices | ConvolutionDensityMatrices) – Collection of density matrices in the time domain

  • voronoi (VoronoiWeights | None) – Optional Voronoi weights object. If given, then the hot-carrier distributions are additonally projected according to the weights.

  • energies_occ (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma (float) – Gaussian broadening width in eV for the broadened distributions.

  • average_times (bool) – If true, an average over the given times will be taken. If false, then hot-carrier distributions are computed separately over the times, and each output is written separately for each time

rhodent.writers.hcdist.calculate_hcsweeppulse_and_save_by_filename(out_fname, **kwargs)[source]

Calculate the number of generated hot carriers, projected on groups of atoms, for a list of pulses

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • density_matrices – Object that gives the density matrix in the time domain

  • voronoi – Voronoi weights object

rhodent.writers.hcdist.calculate_hcsweeppulse_and_save_dat(out_fname, density_matrices, voronoi)[source]

Calculate the number of generated hot carriers, projected on groups of atoms, for a list of pulses

HC distributions are saved in a text file

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • density_matrices (ConvolutionDensityMatrices) – Object that gives the density matrix in the time domain

  • voronoi (VoronoiWeights | None) – Voronoi weights object

rhodent.writers.hcdist.calculate_hcsweeppulse_and_save_npz(out_fname, density_matrices, voronoi)[source]

Calculate the number of generated hot carriers, projected on groups of atoms, for a list of pulses

HC distributions are saved in a text file

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • density_matrices (ConvolutionDensityMatrices) – Object that gives the density matrix in the time domain

  • voronoi (VoronoiWeights | None) – Voronoi weights object

rhodent.writers.hcdist.calculate_hcsweeptime_and_save_by_filename(out_fname, **kwargs)[source]

Calculate the number of generated hot carriers, projected on groups of atoms, for a list of times

The ground state including all unoccupied states and KohnShamDecomposition file are loaded. The delta-kick response density matrix in frequency space is loaded, convoluted with a pulse in frequency space, and inverse Fourier transformed to real time. Then number of generated HCs are computed for each of the atom projections.

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • density_matrices – Object that gives the density matrix in the time domain

  • voronoi – Voronoi weights object

rhodent.writers.hcdist.calculate_hcsweeptime_and_save_dat(out_fname, density_matrices, voronoi)[source]

Calculate the number of generated hot carriers, projected on groups of atoms, for a list of times

The ground state including all unoccupied states and KohnShamDecomposition file are loaded. The delta-kick response density matrix in frequency space is loaded, convoluted with a pulse in frequency space, and inverse Fourier transformed to real time. Then number of generated HCs are computed for each of the atom projections.

HC distributions are saved in a text file

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • density_matrices (TimeDensityMatrices | ConvolutionDensityMatrices) – Object that gives the density matrix in the time domain

  • voronoi (VoronoiWeights | None) – Voronoi weights object

rhodent.writers.hcdist.calculate_hcsweeptime_and_save_npz(out_fname, density_matrices, voronoi)[source]

Calculate the number of generated hot carriers, projected on groups of atoms, for a list of times

The ground state including all unoccupied states and KohnShamDecomposition file are loaded. The delta-kick response density matrix in frequency space is loaded, convoluted with a pulse in frequency space, and inverse Fourier transformed to real time. Then number of generated HCs are computed for each of the atom projections.

HC distributions are saved in a text file

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • density_matrices (TimeDensityMatrices | ConvolutionDensityMatrices) – Object that gives the density matrix in the time domain

  • voronoi (VoronoiWeights | None) – Voronoi weights object

Transition contribution map writer

class rhodent.writers.tcm.DipoleWriter(collector)[source]

Calculate dipole moment contributions, optionally broadened onto an energy grid as a transition contribution map

Parameters:

collector (ResultsCollector) – ResultsCollector object

property common_arrays: dict[str, ndarray[Any, dtype[float64]] | int | float]

Dictionary of eigenvalues and limits

fill_ulm(writer, work, result)[source]

Fill one entry of the ULM file

Parameters:
  • writer – Open ULM writer object

  • work (WorkMetadata) – Metadata to current piece of data

  • result (Result) – Result containing the current observables

write_empty_arrays_ulm(writer)[source]

Add empty arrays in to the ULM file

Parameters:

writer – Open ULM writer object

rhodent.writers.tcm.calculate_and_save_by_filename(out_fname, **kwargs)[source]

Calculate induced dipole moments and transition contribution maps

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices – Collection of density matrices in the time or frequency domain

  • voronoi – Optional Voronoi weights object. If given, then the dipole contributions are additonally projected according to the weights.

  • energies_occ – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma – Gaussian broadening width in eV for the broadened distributions.

  • write_extra – Dictionary of extra key-value pairs to write to the data file

  • save_matrix – Whether the transition energy distributions should be computed and saved

rhodent.writers.tcm.calculate_and_save_npz(out_fname, density_matrices, voronoi, energies_occ, energies_unocc, sigma=None, write_extra={}, save_matrix=False)[source]

Calculate induced dipole moments and transition contribution maps

Dipole moments and contributions are saved in a numpy archive

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (BaseDensityMatrices) – Collection of density matrices in the time or frequency domain

  • voronoi (VoronoiWeights | None) – Optional Voronoi weights object. If given, then the dipole contributions are additonally projected according to the weights.

  • energies_occ (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma (Optional[float]) – Gaussian broadening width in eV for the broadened distributions.

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

  • save_matrix (bool) – Whether the transition energy distributions should be computed and saved

rhodent.writers.tcm.calculate_and_save_ulm(out_fname, density_matrices, voronoi, energies_occ, energies_unocc, sigma=None, write_extra={}, save_matrix=False)[source]

Calculate induced dipole moments and transition contribution maps

Dipole moments and contributions are saved in an ULM file

Parameters:
  • out_fname (str) – File name of the resulting data file

  • density_matrices (BaseDensityMatrices) – Collection of density matrices in the time or frequency domain

  • voronoi (VoronoiWeights | None) – Optional Voronoi weights object. If given, then the dipole contributions are additonally projected according to the weights.

  • energies_occ (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for occupied levels (hole carriers). If given, hole distributions are computed and saved.

  • energies_unocc (list[float] | ndarray[Any, dtype[float64]]) – Energy grid in eV for unoccupied levels (excited electrons). If given, electron distributions are computed and saved.

  • sigma (Optional[float]) – Gaussian broadening width in eV for the broadened distributions.

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

  • save_matrix (bool) – Whether the transition energy distributions should be computed and saved

Pulse convolution writer

rhodent.writers.pulserho.calculate_pulserho_and_save(pulserho_fmt, density_matrices)[source]

Read density matrices in frequency space from disk, convolve with Gaussian laser pulse, and inverse Fourier transform to get a time domain response.

Save the pulse density matrces for selected times in the simulation Read density matrices in frequency space from disk

Parameters:
  • pulserho_fmt (str) –

    The pulserho_fmt is a formatting string for the density matrices saved to disk. Example:

    pulserho_fmt = ‘pulserho/t{time:09.1f}{tag}.npy’

  • density_matrices (ConvolutionDensityMatrices) – Object that gives the density matrix in the time domain

DOS Writer

rhodent.writers.dos.calculate_and_save_dat(out_fname, gpw_file, energies, sigma, zerofermi=False)[source]

Read eigenvalues from ground state and calculate broadened DOS

Save the broadened DOS in a text file

Parameters:
  • out_fname (str) – Filename of data file where data is to be saved

  • gpw_file (str) – Filename of GPAW ground state file

  • energies (list[float] | ndarray[Any, dtype[float64]]) – Array of energies (in eV) for which the broadened DOS is computed

  • sigma (float) – Gaussian broadening width in eV

  • zerofermi (bool) – True if energies are to be relative to Fermi level, False if relative to vacuum

PDOS Writer

rhodent.writers.pdos.calculate_and_save_by_filename(out_fname, **kwargs)[source]

Read eigenvalues and wave functions from ground state and calculate broadened PDOS

The PDOS is projected on each group of atoms in atom_projections

The file format of the resulting data file is inferred from the file name

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • voronoi – Voronoi weights calculator/reader

  • energies – Array of energies (in eV) for which the broadened DOS is computed

  • sigma – Gaussian broadening width in eV

  • gpw_file – Filename of GPAW ground state file

  • zerofermi – Eigenvalues relative to Fermi level if true, else relative to vacuum

rhodent.writers.pdos.calculate_and_save_dat(out_fname, voronoi, energies, sigma, gpw_file, zerofermi=False)[source]

Read eigenvalues and wave functions from ground state and calculate broadened PDOS

The PDOS is projected on each group of atoms in atom_projections

Save the broadened PDOS in a text file

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • voronoi (VoronoiWeights) – Voronoi weights calculator/reader

  • energies (list[float] | ndarray[Any, dtype[float64]]) – Array of energies (in eV) for which the broadened DOS is computed

  • sigma (float) – Gaussian broadening width in eV

  • gpw_file (str) – Filename of GPAW ground state file

  • zerofermi (bool) – Eigenvalues relative to Fermi level if true, else relative to vacuum

rhodent.writers.pdos.calculate_and_save_npz(out_fname, voronoi, energies, sigma, gpw_file, zerofermi=False, write_extra={}, write_extra_from_voronoi=False)[source]

Read eigenvalues and wave functions from ground state and calculate broadened PDOS

The PDOS is projected on each group of atoms in atom_projections

Save the broadened PDOS in a compressed numpy .npz archive

Parameters:
  • out_fname (str) – File name of data file where data is to be saved

  • voronoi (VoronoiWeights) – Voronoi weights calculator/reader

  • energies (list[float] | ndarray[Any, dtype[float64]]) – Array of energies (in eV) for which the broadened DOS is computed

  • sigma (float) – Gaussian broadening width in eV

  • gpw_file (str) – Filename of GPAW ground state file

  • zerofermi (bool) – Eigenvalues relative to Fermi level if true, else relative to vacuum

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the .npz file

  • write_extra_from_voronoi (bool) – If true, and voronoi is a ULM reader, extra key-value pairs are read from voronoi and written to the .npz file

Voronoi Writer

rhodent.writers.voronoi.calculate_and_save_LCAO_only_by_filename(out_fname, **kwargs)[source]

Save Voronoi weights in LCAO basis to file

The file format of the resulting file is inferred from the file name

Parameters:
  • out_fname (str) – File name of the voronoi weigths file

  • voronoi_lcao – Voronoi weights in LCAO basis object

  • write_extra – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.voronoi.calculate_and_save_by_filename(out_fname, **kwargs)[source]

Save Voronoi weights to file

The file format of the resulting file is inferred from the file name

Parameters:
  • out_fname (str) – File name of the voronoi weigths file

  • voronoi – Voronoi weights object

  • write_extra – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.voronoi.calculate_and_save_npz(out_fname, voronoi, write_extra={})[source]

Save Voronoi weights to numpy archive

Parameters:
  • out_fname (str) – File name of the voronoi weigths file

  • voronoi (VoronoiWeights) – Voronoi weights object

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.voronoi.calculate_and_save_npz_LCAO_only(out_fname, voronoi_lcao, write_extra={})[source]

Save Voronoi weights in LCAO basis to numpy archive

Parameters:
  • out_fname (str) – File name of the voronoi weigths file

  • voronoi_lcao (VoronoiLCAOWeightCalculator) – Voronoi weights in LCAO basis object

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.voronoi.calculate_and_save_ulm(out_fname, voronoi, write_extra={})[source]

Save Voronoi weights to ULM file

Parameters:
  • out_fname (str) – File name of the voronoi weigths file

  • voronoi (VoronoiWeights) – Voronoi weights object

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file

rhodent.writers.voronoi.calculate_and_save_ulm_LCAO_only(out_fname, voronoi_lcao, write_extra={})[source]

Save Voronoi weights in LCAO basis to ULM file

Parameters:
  • out_fname (str) – File name of the voronoi weigths file

  • voronoi_lcao (VoronoiLCAOWeightCalculator) – Voronoi weights in LCAO basis object

  • write_extra (dict[str, Any]) – Dictionary of extra key-value pairs to write to the data file