maxwelllink.tools package¶
- maxwelllink.tools.cosine_drive(amplitude_au=1.0, omega_au=0.1, phase_rad=0.0)[source]¶
Return a continuous cosine drive.
\[E(t) = A \cos(\omega t + \phi)\]- Parameters:
amplitude_au (float, default: 1.0) – Oscillation amplitude in atomic units.
omega_au (float, default: 0.1) – Angular frequency in atomic units.
phase_rad (float, default: 0.0) – Phase offset in radians.
- Returns:
A cosine drive suitable for steady-state excitation.
- Return type:
callable
- maxwelllink.tools.gaussian_enveloped_cosine(amplitude_au=1.0, t0_au=0.0, sigma_au=10.0, omega_au=0.1, phase_rad=0.0)[source]¶
Return a Gaussian-enveloped cosine drive.
\[E(t) = A \exp\left(-\frac{(t - t_0)^2}{2 \sigma^2}\right) \cos\bigl(\omega (t - t_0) + \phi\bigr)\]- Parameters:
amplitude_au (float, default: 1.0) – Peak field amplitude in atomic units.
t0_au (float, default: 0.0) – Temporal center of the pulse in atomic units.
sigma_au (float, default: 10.0) – Temporal sigma in atomic units.
omega_au (float, default: 0.1) – Angular frequency of the cosine wave in atomic units.
phase_rad (float, default: 0.0) – Phase of the cosine wave (radians).
- Returns:
A function
f(t_au)for use as a time-dependent electric field.- Return type:
callable
- maxwelllink.tools.gaussian_pulse(amplitude_au=1.0, t0_au=0.0, sigma_au=10.0)[source]¶
Return a Gaussian pulse drive.
\[E(t) = A \exp\left(-\frac{(t - t_0)^2}{2 \sigma^2}\right)\]- Parameters:
amplitude_au (float, default: 1.0) – Peak field amplitude in atomic units.
t0_au (float, default: 0.0) – Temporal center of the pulse in atomic units.
sigma_au (float, default: 10.0) – Temporal sigma in atomic units.
- Returns:
A function
f(t_au)that evaluates the Gaussian pulse att_au.- Return type:
callable
- maxwelllink.tools.ir_spectrum(x, dtfs, N=None, field_description='square', smooth_window_len=11)[source]¶
Compute an infrared spectrum from a dipole trajectory.
- Parameters:
x (numpy.ndarray) – Dipole moment trajectory.
dtfs (float) – Time step in femtoseconds.
N (int or None, optional) – Number of DCT points.
None(default) usesx.size. Values greater thanx.sizeresult in zero-padding.field_description ({'square', 'none'}, default: 'square') – Field prefactor passed to
fft(). Use'square'for dipole autocorrelation functions and'none'for velocity autocorrelations.smooth_window_len (int or None, optional) – Window length applied to smooth the spectrum.
Nonedisables smoothing. Default is 11.
- Returns:
numpy.ndarray – Frequencies in \(\text{cm}^{-1}\).
numpy.ndarray – Smoothed IR spectral intensities.
- Raises:
ValueError – If
field_descriptionis not'square'or'none'.
- maxwelllink.tools.lr_tddft_spectrum(energy_au, e_osc, e_cutoff_ev=30.0, linewidth=1e-2, w_step=1e-5)[source]¶
Construct an LR-TDDFT spectrum using Lorentzian broadening.
- Parameters:
energy_au (numpy.ndarray) – Excitation energies in atomic units.
e_osc (numpy.ndarray) – Oscillator strengths corresponding to
energy_au.e_cutoff_ev (float, default: 30.0) – Upper bound of the returned frequency grid in electron volts.
linewidth (float, default: 1e-2) – Lorentzian full width at half maximum in electron volts.
w_step (float, default: 1e-5) – Energy grid spacing in electron volts.
- Returns:
numpy.ndarray – Frequency grid in electron volts.
numpy.ndarray – Lorentzian-broadened spectrum.
- maxwelllink.tools.rt_tddft_spectrum(mu, dt_au, sp_form='absorption', e_start_ev=0.5, e_cutoff_ev=30.0, sigma=1e5, w_step=1e-5)[source]¶
Compute an RT-TDDFT spectrum via Pade-approximant Fourier transform.
- Parameters:
mu (numpy.ndarray) – Time-dependent dipole moment in atomic units.
dt_au (float) – Time step in atomic units.
sp_form ({'absorption', 'absolute'}, default: 'absorption') – Spectrum representation.
'absorption'returns-omega * Im(mu_tilde(omega));'absolute'returnsabs(mu_tilde(omega)).e_start_ev (float, default: 0.5) – Lower energy cutoff in electron volts.
e_cutoff_ev (float, default: 30.0) – Upper energy cutoff in electron volts.
sigma (float, default: 1e5) – Damping factor passed to
_pade().w_step (float, default: 1e-5) – Frequency grid spacing in atomic units used by
_pade().
- Returns:
numpy.ndarray – Frequency grid in electron volts.
numpy.ndarray – Spectrum on the selected grid with units determined by
sp_form.numpy.ndarray – Time grid in femtoseconds.
numpy.ndarray – Dipole moment trajectory (identical to the input
mu).