Writers

Density writer

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

Calculate density contributions

Parameters:

collector (ResultsCollector) – ResultsCollector object

property common_arrays: dict[str, ndarray[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[int64]] | 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.write_density(out_fname, atoms, data, comment=None)[source]

Calculate density contribution and save in Gaussian cube file format.

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

  • comment (Optional[str]) – Comment line in the cube 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[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[int64]] | 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.

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[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[int64]] | int | float]

Dictionary of eigenvalues and limits.

Transition contribution map writer

class rhodent.writers.tcm.DipoleWriter(collector, only_one_pulse)[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[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[int64]] | 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.

DOS Writer

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

Write the broadened DOS to a text file.

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

  • energies (list[float] | ndarray[tuple[int, ...], dtype[float64]]) – Array of energies in units of eV.

  • dos (list[float] | ndarray[tuple[int, ...], dtype[float64]]) – Array of DOS corresponding to the energies.

  • sigma (float) – Gaussian broadening width in units of eV.

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

rhodent.writers.dos.write_partial_density_of_states(out_fname, energies, pdos, atom_projections, sigma, zerofermi=False)[source]

Write the broadened PDOS to a text file.

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

  • energies (list[float] | ndarray[tuple[int, ...], dtype[float64]]) – Array of energies in units of eV.

  • pdos (list[float] | ndarray[tuple[int, ...], dtype[float64]]) – Array of PDOS corresponding to the energies.

  • atom_projections (Sequence[Union[list[int], ndarray[tuple[int, ...], dtype[float64]]]]) – Atom projections.

  • sigma (float) – Gaussian broadening width in units of eV.

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

Collectors

Utility classes to group results by time, pulse, or frequency.

class rhodent.writers.writer.FrequencyResultsCollector(calc, calc_kwargs, exclude=[])[source]

Collect results in the frequency domain.

This class should work with the Fourier transform of the real part of density matrices.

The letter w is prepended to the suffix of the result keys to indicate an additional dimension of frequency.

Parameters:
  • calc (BaseObservableCalculator) – Calculator.

  • calc_kwargs (dict[str, Any]) – Keyword arguments passed to the icalculate function.

  • exclude (list[str]) – Keys that are excluded from collection

class rhodent.writers.writer.PulseConvolutionAverageResultsCollector(calc, calc_kwargs, exclude=[])[source]

Collect results after convolution with different pulses, average over times.

The letter p is prepended to the suffix of the result keys to indicate an additional dimension of pulse.

Parameters:
  • calc (BaseObservableCalculator) – Calculator.

  • calc_kwargs (dict[str, Any]) – Keyword arguments passed to the icalculate function.

  • exclude (list[str]) – Keys that are excluded from collection.

class rhodent.writers.writer.PulseConvolutionResultsCollector(calc, calc_kwargs, exclude=[])[source]

Collect results after convolution with different pulses.

The letters pt are prepended to the suffix of the result keys to indicate an additional dimension of pulse and time.

Parameters:
  • calc (BaseObservableCalculator) – Calculator.

  • calc_kwargs (dict[str, Any]) – Keyword arguments passed to the icalculate function.

  • exclude (list[str]) – Keys that are excluded from collection.

class rhodent.writers.writer.ResultsCollector(calc, calc_kwargs, resultkeys, additional_suffix, additional_dimension, exclude=[])[source]

Utility class to collect result arrays for different times, pulses, or frequencies.

Parameters:
  • resultkeys (ResultKeys) – Result keys to be collected.

  • additional_dimension (tuple[int, ...]) – Shape of additional dimension(s) due to the different times, frequencies, etc.

  • additional_suffix (str) – String prepended to the suffix if each key.

format_key(key)[source]

Add the new suffix to the key.

Parameters:

key (str) – Original result key.

Return type:

New result key with the added suffix.

class rhodent.writers.writer.TimeAverageResultsCollector(calc, calc_kwargs, exclude=[])[source]

Collect results and average over times.

Parameters:
  • calc (BaseObservableCalculator) – Calculator.

  • calc_kwargs (dict[str, Any]) – Keyword arguments passed to the icalculate function.

  • exclude (list[str]) – Keys that are excluded from collection.

class rhodent.writers.writer.TimeResultsCollector(calc, calc_kwargs, exclude=[])[source]

Collect results after convolution with different pulses.

The letter t is prepended to the suffix of the result keys to indicate an additional dimension of time.

Parameters:
  • calc (BaseObservableCalculator) – Calculator.

  • calc_kwargs (dict[str, Any]) – Keyword arguments passed to the icalculate function.

  • exclude (list[str]) – Keys that are excluded from collection.

class rhodent.writers.writer.Writer(collector)[source]
calculate_and_save_npz(out_fname, write_extra={})[source]

Calculate results on all ranks and save to npz file.

Parameters:

out_fname (str) – File name.

calculate_and_save_ulm(out_fname, write_extra={})[source]

Calculate results on all ranks and save to ULM file.

Parameters:

out_fname (str) – File name.

calculate_data()[source]

Calculate results on all ranks and return Result object.

Return type:

Retult object. Is empty on non-root ranks.

property common_arrays: dict[str, ndarray[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[int64]] | 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.

property icalculate_kwargs: dict

Keyword arguments to icalculate.

write_empty_arrays_ulm(writer)[source]

Add empty arrays in to the ULM file.

Parameters:

writer – Open ULM writer object.