Response

class rhodent.response.BaseResponse(ksd, perturbation=None, calc_size=1)[source]

Object describing response; obtained from TDDFT calculation

Parameters:
  • ksd (KohnShamDecomposition | str) – KohnShamDecomposition object or filename

  • perturbation (PerturbationLike) – The perturbation that was present during the TDDFT calculation. None to mark it as an ne perturbation

  • calc_size (int) – Size of the calculation communicator

iterate_density_matrices_in_frequency(frequencies, derivative_order_s=[0], real=True, imag=True, log=None)[source]

Obtain density matrices at the given frequencies

Parameters:
  • frequencies (list[float] | ndarray[tuple[int, ...], dtype[float64]]) – Compute density matrices for these frequencies (or as close to them as possible). In eV

  • derivative_order_s (list[int]) – Compute density matrix derivatives of the following orders. 0 for plain density matrix and positive integers for derivatives

  • real (bool) – Calculate the Fourier transform of the real part of the density matrix

  • imag (bool) – Calculate the Fourier transform of the imaginary part of the density matrix

Yields:
  • Tuple (work, dm) on the root rank of the calculation communicator

  • work – An object representing the metadata (frequency) for the work done

  • dm – Density matrix for this frequency

Return type:

Generator[tuple[FrequencyDensityMatrixMetadata, DensityMatrix], None, None]

iterate_density_matrices_in_time(times, pulses, derivative_order_s=[0], real=True, imag=True, log=None)[source]

Obtain density matrices at the given times in response to the given pulses.

If the given pulse(s) differ from the perturbation that caused this response, then the pulse convolution trick is applied to obtain the response to the given pulse(s).

Parameters:
  • times (list[float] | ndarray[tuple[int, ...], dtype[float64]]) – Calculate density matrices for these times (or as close to them as possible). In as

  • pulses (Collection[Union[Perturbation, Laser, dict, None]]) – Calculate density matrices in response to these pulses

  • derivative_order_s (list[int]) – Calculate density matrix derivatives of the following orders. 0 for plain density matrix and positive integers for derivatives

  • real (bool) – Calculate the real part of density matrices

  • imag (bool) – Calculate the imaginary part of density matrices

  • log (Optional[Logger]) – Logger object

Yields:
  • Tuple (work, dm) on the root rank of the calculation communicator

  • work – An object representing the metadata (time and pulse) for the work done

  • dm – Density matrix for this time and pulse

Return type:

Generator[tuple[ConvolutionDensityMatrixMetadata, DensityMatrix], None, None]

property ksd: gpaw.lcaotddft.ksddecomposition.KohnShamDecomposition

Kohn-Sham decomposition object

property perturbation: Perturbation

The perturbation that caused this response

class rhodent.response.ResponseFromDensityMatrices(pulserho_fmt, ksd, perturbation=None, calc_size=1)[source]

Response from density matrices saved on 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 as

    • {tag} - Derivative tag, ‘’, ‘-Iomega’, or ‘-omega2’

    • {pulsefreq} - Pulse frequency in eV

    • {pulsefwhm} - Pulse FWHM in fs

  • ksd (KohnShamDecomposition | str) – KohnShamDecomposition object or filename

  • perturbation (PerturbationLike) – Perturbation that was present during time propagation

  • calc_size (int) – Size of the calculation communicator

class rhodent.response.ResponseFromFourierTransform(frho_fmt, ksd, perturbation=None, calc_size=1)[source]

Response from Fourier transform of density matrices save on disk

Parameters:
  • frho_fmt (str) –

    Formatting string for the density matrices in frequency space saved to disk.

    Example:

    • frho_fmt = ‘frho/w{freq:05.2f}-{reim}.npy’

    Accepts variables:

    • {freq} - Frequency in eV

    • {reim} - ‘Re’ or ‘Im’ for Fourier transform of real/imaginary part of density matrix

  • ksd (KohnShamDecomposition | str) – KohnShamDecomposition object or filename

  • perturbation (PerturbationLike) – Perturbation that was present during time propagation

  • calc_size (int) – Size of the calculation communicator

class rhodent.response.ResponseFromWaveFunctions(wfs_fname, ksd, perturbation=None, calc_size=1, stride_opts=None, stridet=1)[source]

Response from GPAW wave functions file

Parameters:
  • ksd (KohnShamDecomposition | str) – KohnShamDecomposition object or filename

  • wfs_fname (Path | str) – Filename of the GPAW wave functions file, written by WaveFunctionsWriter

  • perturbation (PerturbationLike) – Perturbation that was present during time propagation

  • calc_size (int) – Size of the calculation communicator