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

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) –

    Formatting string for the density matrices saved to disk.

    Example:

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

    Accepts variables

    • {time} - Time in units of as.

    • {tag} - Derivative tag, '', '-Iomega', or '-omega2'.

    • {pulsefreq} - Pulse frequency in units of eV.

    • {pulsefwhm} - Pulse FWHM in units of fs.

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

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.

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

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) – Filename

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

Calculate results on all ranks and save to ULM file

Parameters:

out_fname (str) – Filename

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