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
- 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 filedensity_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 filedensity_matrices (
BaseDensityMatrices
) – Collection of density matrices in the time or frequency domaingpw_file (
str
) – Filename of ground state filewrite_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 filedensity_matrices (
BaseDensityMatrices
) – Collection of density matrices in the time or frequency domaingpw_file (
str
) – Filename of ground state filewrite_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
- 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 filedensity_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 filedensity_matrices (
ConvolutionDensityMatrices
) – Collection of density matrices in the time or frequency domainvoronoi (
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 filesave_matrix (
bool
) – Whether the electron-hole map matrix should be computed and savedsave_dist (
bool
) – Whether the transition energy distributions should be computed and savedonly_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 filedensity_matrices (
ConvolutionDensityMatrices
) – Collection of density matrices in the time or frequency domainvoronoi (
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 filesave_matrix (
bool
) – Whether the electron-hole map matrix should be computed and savedsave_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 objectonly_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.
- 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 filedensity_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 filedensity_matrices (
TimeDensityMatrices
|ConvolutionDensityMatrices
) – Collection of density matrices in the time domainvoronoi (
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 filedensity_matrices (
TimeDensityMatrices
|ConvolutionDensityMatrices
) – Collection of density matrices in the time domainvoronoi (
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 saveddensity_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 saveddensity_matrices (
ConvolutionDensityMatrices
) – Object that gives the density matrix in the time domainvoronoi (
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 saveddensity_matrices (
ConvolutionDensityMatrices
) – Object that gives the density matrix in the time domainvoronoi (
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 saveddensity_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 saveddensity_matrices (
TimeDensityMatrices
|ConvolutionDensityMatrices
) – Object that gives the density matrix in the time domainvoronoi (
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 saveddensity_matrices (
TimeDensityMatrices
|ConvolutionDensityMatrices
) – Object that gives the density matrix in the time domainvoronoi (
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
- 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 filedensity_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 filedensity_matrices (
BaseDensityMatrices
) – Collection of density matrices in the time or frequency domainvoronoi (
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 filesave_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 filedensity_matrices (
BaseDensityMatrices
) – Collection of density matrices in the time or frequency domainvoronoi (
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 filesave_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 savedgpw_file (
str
) – Filename of GPAW ground state fileenergies (
list
[float
] |ndarray
[Any
,dtype
[float64
]]) – Array of energies (in eV) for which the broadened DOS is computedsigma (
float
) – Gaussian broadening width in eVzerofermi (
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 savedvoronoi – 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 savedvoronoi (
VoronoiWeights
) – Voronoi weights calculator/readerenergies (
list
[float
] |ndarray
[Any
,dtype
[float64
]]) – Array of energies (in eV) for which the broadened DOS is computedsigma (
float
) – Gaussian broadening width in eVgpw_file (
str
) – Filename of GPAW ground state filezerofermi (
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 savedvoronoi (
VoronoiWeights
) – Voronoi weights calculator/readerenergies (
list
[float
] |ndarray
[Any
,dtype
[float64
]]) – Array of energies (in eV) for which the broadened DOS is computedsigma (
float
) – Gaussian broadening width in eVgpw_file (
str
) – Filename of GPAW ground state filezerofermi (
bool
) – Eigenvalues relative to Fermi level if true, else relative to vacuumwrite_extra (
dict
[str
,Any
]) – Dictionary of extra key-value pairs to write to the .npz filewrite_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 filevoronoi_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 filevoronoi – 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 filevoronoi (
VoronoiWeights
) – Voronoi weights objectwrite_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 filevoronoi_lcao (
VoronoiLCAOWeightCalculator
) – Voronoi weights in LCAO basis objectwrite_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 filevoronoi (
VoronoiWeights
) – Voronoi weights objectwrite_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 filevoronoi_lcao (
VoronoiLCAOWeightCalculator
) – Voronoi weights in LCAO basis objectwrite_extra (
dict
[str
,Any
]) – Dictionary of extra key-value pairs to write to the data file