`ElectricFields.AbstractCarrier`

— Type`AbstractCarrier`

Any carrier, of any dimensionality.

`ElectricFields.ConstantField`

— Type`ConstantField(tmax, E₀)`

The field amplitude of a constant field is defined as

\[F(t) = \begin{cases} E_0, & 0 \leq t \leq t_{\textrm{max}}, \\ 0, & \textrm{else}, \end{cases} \implies A(t) = \begin{cases} -E_0t, & 0 \leq t \leq t_{\textrm{max}}, \\ A(t_{\textrm{max}}), & t_{\textrm{max}} < t, \\ 0, & \textrm{else}. \end{cases}\]

Since the vector potential is non-zero at the end of the pulse, this is a *non-propagating* field, i.e. it does not correspond to a freely propagating pulse. It however corresponds to the field in an idealized capacitor, i.e. two plates of opposite charge.

**Example**

```
julia> @field(F) do
I₀ = 1e13u"W/cm^2"
tmax = 3.0u"fs"
kind = :constant
end
Constant field of
- 124.0241 jiffies = 3.0000 fs duration, and
- E₀ = 1.6880e-02 au = 8.6802 GV m^-1
```

`ElectricFields.Cos²Envelope`

— Type`Cos²Envelope`

\[f(t) = \begin{cases} \cos^2 \left(\frac{\pi t}{cT}\right), & -1 \leq t/(cT) \leq 1,\\ 0, & \textrm{else}, \end{cases}\]

where $c$ is the number of cycles from zero to zero of the $\cos^2$ envelope and $T$ the period time.

Required parameters:

`λ|T|f|ν|ω|ħω`

,`cycles`

,`env=:cos² | env=:cos2`

.

`ElectricFields.DelayedField`

— Type`DelayedField(a, t₀)`

Represents a delayed copy of `a`

, that appears at time `t₀`

instead of at `0`

, i.e. `t₀>0`

implies the field comes *later*.

**Examples**

```
julia> @field(A) do
I₀ = 1.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> delay(A, 1u"fs")
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
– delayed by 41.3414 jiffies = 1.0000 fs
julia> delay(A, 1.0)
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
– delayed by 1.0000 jiffies = 24.1888 as
julia> delay(A, π*u"rad")
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
– delayed by 1.0000 jiffies = 24.1888 as
```

`ElectricFields.EllipticalCarrier`

— Type`EllipticalCarrier`

An elliptically polarized field (of which circularly and linearly polarized are special cases) is given in the canonical coordinate system as

\[\vec{C}(t) = \frac{1}{\sqrt{1+\xi^2}} \bmat{\xi\cos\theta\\0\\\sin\theta}, \quad \theta \defd \omega t + \phi,\]

i.e. with the principal axis of the ellipse along $z$.

`ElectricFields.FixedCarrier`

— Type`FixedCarrier <: LinearCarrier`

The carrier is fixed in the sense that the instantaneous frequency is constant throughout the pulse, i.e. no chirp/dispersion:

\[\Im\{\exp[\im(\omega t + \phi)]\} = \sin(\omega t + \phi).\]

`ElectricFields.GaussianEnvelope`

— Type`GaussianEnvelope`

A Gaussian pulse is given by

\[f(t) = \exp\left(-\frac{t^2}{2\sigma^2}\right),\]

where the standard deviation $σ$ is related to the FWHM duration τ of the intensity envelope as

\[\sigma = \frac{\tau}{2\sqrt{2\ln 2}}.\]

Since we define all fields in terms of the vector potential $A(t)$, and the `instantaneous_intensity`

is given by $\abs{-\partial_t A(t)}^2$, we have to find a coefficient $α$ such that the field amplitude

\[F(t) \sim -\partial_t \exp(-\alpha t^2) \sin(\omega t + \phi)\]

has an *intensity envelope* with the desired FWHM; we do this iteratively in `gaussian_common!`

. This is mainly important for ultrashort pulses, since for long pulse durations we can approximate $\exp(-\alpha t^2) \sim 1$ such that only the carrier contributes to the time derivative.

Since a Gaussian never ends, we specify how many $σ$ we require; the resulting time window will be rounded up to an integer amount of cycles of the fundamental.

Required parameters:

`λ|T|f|ν|ω|ħω`

,`τ|σ`

,`σmax|tmax|Tmax`

,`env=:gauss`

(optional, since`GaussianEnvelope`

is the default envelope).

`ElectricFields.LinearCarrier`

— Type`LinearCarrier <: AbstractCarrier`

Any carrier which is one-dimensional, i.e. linearly polarized (by convention along $z$).

`ElectricFields.LinearField`

— Type`LinearField`

Linearly polarized field, i.e. the field amplitude is scalar. Consisting of a peak vector potential, a vector envelope, and a carrier, which has to be a `LinearCarrier`

.

**Examples**

```
julia> @field(A) do
I₀ = 1e14u"W/cm^2"
λ = 800.0u"nm"
τ = 6.2u"fs"
tmax = 20.0u"fs"
end
Linearly polarized field with
- I₀ = 2.8495e-03 au = 1.0e14 W cm^-2 =>
- E₀ = 5.3380e-02 au = 27.4492 GV m^-1
- A₀ = 0.9372 au
– a Fixed carrier @ λ = 800.0000 nm (T = 2.6685 fs, ω = 0.0570 Ha = 1.5498 eV, f = 374.7406 THz)
– and a Gaussian envelope of duration 6.2000 fs (intensity FWHM; ±8.11σ)
– and a bandwidth of 0.0108 Ha = 294.3469 meV ⟺ 71.1728 THz ⟺ 2871.2568 Bohr = 151.9404 nm
– Uₚ = 0.2196 Ha = 5.9759 eV => α = 16.4562 Bohr = 870.8242 pm
julia> @field(B) do
I₀ = 0.05
ω = 1.0
ramp = 1.0
flat = 3.0
env = :trapezoidal
end
Linearly polarized field with
- I₀ = 5.0000e-02 au = 1.7547226e15 W cm^-2 =>
- E₀ = 2.2361e-01 au = 114.9832 GV m^-1
- A₀ = 0.2236 au
– a Fixed carrier @ λ = 45.5634 nm (T = 151.9830 as, ω = 1.0000 Ha = 27.2114 eV, f = 6.5797 PHz)
– and a /1‾3‾1\ cycles trapezoidal envelope
– and a bandwidth of Inf Ha = Inf eV ⟺ Inf Hz ⟺ Inf Bohr = Inf m
– Uₚ = 0.0125 Ha = 340.1423 meV => α = 0.2236 Bohr = 11.8328 pm
```

`ElectricFields.LinearTransverseCarrier`

— Type`LinearTransverseCarrier`

The carrier is identical to `FixedCarrier`

, but explicitly in 3d, with the polarization taken along the $z$ axis:

\[\vec{C}(t) = \bmat{0\\0\\\sin(\omega t + \phi)}.\]

`ElectricFields.LinearTransverseField`

— TypeLinearTransverseField

Linearly polarized field, but explicitly in 3d, i.e the polarization vector is confined to a line in the plane that is perpendicular to the direction of propagation. If the propagation vector is not rotated, this plane is the $z-x$, with $z$ by convention being the principal polarization axis, and $y$ is the direction of propagation.

This is mostly used as a proxy, if one wants to calculate using a manifestly linearly polarized field in 3d. See also `LinearTransverseCarrier`

.

`ElectricFields.NegatedField`

— Type`NegatedField(a)`

Represents a field whose `vector_potential`

is the negative of that of `a`

.

**Example**

```
julia> @field(A) do
I₀ = 1.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> B = -A
ElectricFields.NegatedField{ElectricFields.LinearField{ElectricFields.FixedCarrier{Quantity{Float64, 𝐋, Unitful.FreeUnits{(Eₕ^-1, ħ, c), 𝐋, nothing}}, Quantity{Float64, 𝐓, Unitful.FreeUnits{(Eₕ^-1, ħ), 𝐓, nothing}}, Float64, Int64}, ElectricFields.GaussianEnvelope{Float64}, Float64}}(Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm)
julia> field_amplitude(A, 0.5)
0.008830294133325867
julia> field_amplitude(B, 0.5)
-0.008830294133325867
julia> field_amplitude(A-A, 0.5)
0.0
```

`ElectricFields.PaddedField`

— Type` PaddedField(field, a, b)`

Wrapper around any electric `field`

, padded with `a`

units of time before, and `b`

units of time after the ordinary `span`

of the field.

**Example**

```
julia> @field(A) do
I₀ = 1.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> B = PaddedField(A, 10.0, 30.0)
Padding before 10.0000 jiffies = 241.8884 as and after 30.0000 jiffies = 725.6653 as of
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> span(A), span(B)
(-6.0 .. 6.0, -16.0 .. 36.0)
```

`ElectricFields.Ramp`

— Type`Ramp(tmax, E₀, f, name)`

The field amplitude of a ramp is defined as

\[F(t) = \begin{cases} E_0f'(\tau), & 0 \leq t_{\textrm{max}}, \\ 0, \textrm{else}, \end{cases} \implies A(t) = \begin{cases} -E_0t_{\textrm{max}}f(\tau), & 0 \leq t \leq t_{\textrm{max}},\\ A(t_{\textrm{max}}), & t_{\textrm{max}} < t,\\ 0, & \textrm{else}, \end{cases} \quad \tau = \frac{t}{t_{\textrm{max}}}.\]

To define a new ramp, one thus only needs to define one function on the unit interval, $f(\tau)$ whose derivative $f'(\tau)$ rises from $0$ to $1$. Similar to `ConstantField`

, `Ramp`

is a *non-propagating* field, but is realizable in e.g. a capacitor.

Three kinds of ramps are predefined, `:linear_ramp`

, `:parabolic_ramp`

, `:sin²_ramp`

(with the alias `:sin2_ramp`

).

**Examples**

```
julia> @field(F) do
E₀ = 1.0
tmax = 4.0u"fs"
kind = :sin²_ramp
end
sin² up-ramp of
- 165.3655 jiffies = 4.0000 fs duration, and
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
julia> @field(F) do
E₀ = 1.0
tmax = 4.0u"fs"
kind = :linear_ramp
ramp = :down
end
Linear down-ramp of
- 165.3655 jiffies = 4.0000 fs duration, and
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
```

`ElectricFields.SumField`

— Type`SumField(a, b)`

The linear combination of two fields `a`

and `b`

.

**Example**

```
julia> @field(A) do
I₀ = 1.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> @field(B) do
I₀ = 0.5
T = 1.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 5.0000e-01 au = 1.7547226e16 W cm^-2 =>
- E₀ = 7.0711e-01 au = 363.6089 GV m^-1
- A₀ = 0.1125 au
– a Fixed carrier @ λ = 7.2516 nm (T = 24.1888 as, ω = 6.2832 Ha = 170.9742 eV, f = 41.3414 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±1.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 8.5598 Bohr = 452.9627 pm
– Uₚ = 0.0032 Ha = 86.1591 meV => α = 0.0179 Bohr = 947.8211 fm
julia> A+B
┌ Linearly polarized field with
│ - I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
│ - E₀ = 1.0000e+00 au = 514.2207 GV m^-1
│ - A₀ = 0.3183 au
│ – a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
│ – and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
│ – and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
│ – Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
⊕
│ Linearly polarized field with
│ - I₀ = 5.0000e-01 au = 1.7547226e16 W cm^-2 =>
│ - E₀ = 7.0711e-01 au = 363.6089 GV m^-1
│ - A₀ = 0.1125 au
│ – a Fixed carrier @ λ = 7.2516 nm (T = 24.1888 as, ω = 6.2832 Ha = 170.9742 eV, f = 41.3414 PHz)
│ – and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±1.00σ)
│ – and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 8.5598 Bohr = 452.9627 pm
└ – Uₚ = 0.0032 Ha = 86.1591 meV => α = 0.0179 Bohr = 947.8211 fm
```

`ElectricFields.TransverseCarrier`

— Type`TransverseCarrier <: AbstractCarrier`

Any carrier which is two-dimensional, i.e. polarized in the plane perpendicular to the direction of propagation.

`ElectricFields.TransverseField`

— Type`TransverseField`

Transversely polarized field, i.e the polarization vector is confined to the plane that is perpendicular to the direction of propagation. If the propagation vector is not rotated, this plane is the $z-x$, with $z$ by convention being the principal polarization axis, and $y$ is the direction of propagation.

The formal definition is

\[\vec{A}(t)\defd A_0 f(t) \Im\{\vec{J}\exp[\im(\omega t + \phi)]\},\]

using the complex-valued Jones vector $\vec{J}$, but in practice, we use a rotation matrix $\mat{R}$ and the Carriers give the amplitudes in the canonical, unrotated coordinate sytem:

\[\vec{A}(t) = A_0 f(t) \mat{R}\vec{C}(t).\]

**Examples**

```
julia> # Circularly polarized field
julia> @field(A) do
I₀ = 1e14u"W/cm^2"
λ = 800.0u"nm"
τ = 6.2u"fs"
tmax = 20.0u"fs"
ξ = 1.0
end
Transversely polarized field with
- I₀ = 2.8495e-03 au = 1.0e14 W cm^-2 =>
- E₀ = 5.3380e-02 au = 27.4492 GV m^-1
- A₀ = 0.9372 au
– a Elliptical carrier with ξ = 1.00 (RCP) @ λ = 800.0000 nm (T = 2.6685 fs, ω = 0.0570 Ha = 1.5498 eV, f = 374.7406 THz)
– and a Gaussian envelope of duration 6.2000 fs (intensity FWHM; ±8.11σ)
– and a bandwidth of 0.0108 Ha = 294.3469 meV ⟺ 71.1728 THz ⟺ 2871.2568 Bohr = 151.9404 nm
– Uₚ = 0.2196 Ha = 5.9759 eV => α = 16.4562 Bohr = 870.8242 pm
julia> # Linearly polarized field, but explicitly in 3D
julia> @field(B) do
I₀ = 1e14u"W/cm^2"
λ = 800.0u"nm"
τ = 6.2u"fs"
tmax = 20.0u"fs"
kind = :transverse
end
Transversely polarized field with
- I₀ = 2.8495e-03 au = 1.0e14 W cm^-2 =>
- E₀ = 5.3380e-02 au = 27.4492 GV m^-1
- A₀ = 0.9372 au
– a LinearTransverseCarrier: Fixed carrier @ λ = 800.0000 nm (T = 2.6685 fs, ω = 0.0570 Ha = 1.5498 eV, f = 374.7406 THz)
– and a Gaussian envelope of duration 6.2000 fs (intensity FWHM; ±8.11σ)
– and a bandwidth of 0.0108 Ha = 294.3469 meV ⟺ 71.1728 THz ⟺ 2871.2568 Bohr = 151.9404 nm
– Uₚ = 0.2196 Ha = 5.9759 eV => α = 16.4562 Bohr = 870.8242 pm
julia> # Linearly polarized field, rotated
julia> @field(C) do
I₀ = 1e14u"W/cm^2"
λ = 800.0u"nm"
τ = 6.2u"fs"
tmax = 20.0u"fs"
rotation = π/3, [0,0,1]
end
Transversely polarized field with
- I₀ = 2.8495e-03 au = 1.0e14 W cm^-2 =>
- E₀ = 5.3380e-02 au = 27.4492 GV m^-1
- A₀ = 0.9372 au
– a LinearTransverseCarrier: Fixed carrier @ λ = 800.0000 nm (T = 2.6685 fs, ω = 0.0570 Ha = 1.5498 eV, f = 374.7406 THz)
– a Gaussian envelope of duration 6.2000 fs (intensity FWHM; ±8.11σ)
– and a rotation of 0.33π about [0.000, 0.000, 1.000]
– and a bandwidth of 0.0108 Ha = 294.3469 meV ⟺ 71.1728 THz ⟺ 2871.2568 Bohr = 151.9404 nm
– Uₚ = 0.2196 Ha = 5.9759 eV => α = 16.4562 Bohr = 870.8242 pm
```

`ElectricFields.TrapezoidalEnvelope`

— Type`TrapezoidalEnvelope`

This is a very simple piecewise linear function:

\[f(t)= \begin{cases} r/r_{\textrm{up}}, & 0 \leq r < r_{\textrm{up}},\\ 1, & r_{\textrm{up}} \leq r < r_{\textrm{up}} + r_{\textrm{flat}}, \\ 1 - \frac{r-r_{\textrm{up}}-r_{\textrm{flat}}}{r_{\textrm{down}}}, & r_{\textrm{up}} + r_{\textrm{flat}} \leq r < r_{\textrm{up}} + r_{\textrm{flat}} + r_{\textrm{down}}, \\ 0, & \textrm{else}, \end{cases} \quad r \defd t/T,\]

where $T$ is the period time of the carrier.

Required parameters:

`λ|T|f|ν|ω|ħω`

,`ramp | (ramp_up & ramp_down)`

,`flat`

,`env=:trapezoidal | env=:tophat`

.

Beware that this envelope can introduce artifacts at the ends of the pulse, such that the electric field is non-vanishing, depending of e.g. the phase of the carrier.

`ElectricFields.TruncatedGaussianEnvelope`

— Type`TruncatedGaussianEnvelope`

Since a Gaussian function never ends, this envelope adds a soft truncation over a time interval:

\[f(t)= \begin{cases} \exp(-\alpha t^2), & \abs{t} \leq t_{\textrm{off}},\\ \exp\left\{ -\alpha\left[ t_{\textrm{off}} + \frac{2}{\pi}(t_{\textrm{max}} - t_{\textrm{off}}) \tan\left( \frac{\pi}{2} \frac{\abs{t} - t_{\textrm{off}}}{t_{\textrm{max}} - t_{\textrm{off}}} \right) \right]^2 \right\}, & t_{\textrm{off}} < \abs{t} \leq t_{\textrm{max}}, \\ 0, & t_{\textrm{max}} < \abs{t}. \end{cases}\]

This is Eq. (72) of

- Patchkovskii, S., & Muller, H. (2016). Simple, accurate, and efficient implementation of 1-electron atomic time-dependent Schrödinger equation in spherical coordinates. Computer Physics Communications, 199, 153–169. 10.1016/j.cpc.2015.10.014

Required parameters:

`λ|T|f|ν|ω|ħω`

,`τ|σ`

,`toff`

,`σmax|tmax|Tmax`

,

`env=:trunc_gauss`

.

Beyond this, everything else is the same as for `GaussianEnvelope`

.

`ElectricFields.WindowedField`

— Type`WindowedField(field, a, b)`

Wrapper around any electric `field`

, windowed such that it is zero outside the time interval `a..b`

.

**Example**

```
julia> @field(A) do
I₀ = 1.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> B = WindowedField(A, -3, 5)
Window from -3.0000 jiffies = -72.5665 as to 5.0000 jiffies = 120.9442 as of
Linearly polarized field with
- I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
- E₀ = 1.0000e+00 au = 514.2207 GV m^-1
- A₀ = 0.3183 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0253 Ha = 689.2724 meV => α = 0.1013 Bohr = 5.3617 pm
julia> span(A), span(B)
(-6.0 .. 6.0, -3.0 .. 5.0)
julia> field_amplitude(A, -4)
-0.6395632362683398
julia> field_amplitude(B, -4)
0.0
```

`ElectricFields.WrappedField`

— Type`WrappedField`

Wrapper around any electric `field`

`AbstractFFTs.fft`

— Method`fft(f::AbstractField, t::AbstractRange)`

Compute the FFT of the `field_amplitude`

of the field `f`

sampled on the uniform temporal grid `t`

.

`ElectricFields.amplitude`

— Function`amplitude(f)`

Return the peak amplitude of the field `f`

.

`ElectricFields.calc_params!`

— Method`calc_params!(field_params)`

This function performs the calculation of different quantities from the information provided.

`ElectricFields.carrier`

— Function`carrier(f)`

Return the carrier of the field `f`

.

`ElectricFields.continuity`

— Method`continuity(f)`

Return the pulse continuity, i.e. differentiability, of the field `f`

.

`ElectricFields.convolution`

— Method`convolution(f̂::Function, dc::DiracComb, ω)`

Evaluate the convolution between the function `f̂`

(assumed to be the Fourier transform of a function `f`

) with the `DiracComb`

`dc`

. This is used to implement the Fourier transform of a function product $f(t)g(t)$, where $g(t)$ is a sum of monochromatic waves:

\[f(t)g(t) \rightsquigarrow \frac{1}{\sqrt{2\pi}} (\hat{f}\star\hat{g})(\omega)\]

`ElectricFields.dimensions`

— Function`dimensions(f)`

Return the number of dimensions of the field `f`

. See also `polarization`

.

**Examples**

```
julia> @field(F) do
I₀ = 2.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 2.0000e+00 au = 7.0188904e16 W cm^-2 =>
- E₀ = 1.4142e+00 au = 727.2178 GV m^-1
- A₀ = 0.4502 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0507 Ha = 1.3785 eV => α = 0.1433 Bohr = 7.5826 pm
julia> dimensions(F)
1
julia> @field(F) do
I₀ = 2.0
T = 2.0
σ = 3.0
Tmax = 3.0
ξ = 1.0
end
Transversely polarized field with
- I₀ = 2.0000e+00 au = 7.0188904e16 W cm^-2 =>
- E₀ = 1.4142e+00 au = 727.2178 GV m^-1
- A₀ = 0.4502 au
– a Elliptical carrier with ξ = 1.00 (RCP) @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0507 Ha = 1.3785 eV => α = 0.1433 Bohr = 7.5826 pm
julia> dimensions(F)
3
```

`ElectricFields.duration`

— Method`duration(f)`

Return the pulse duration $\tau$ of the field `f`

.

`ElectricFields.envelope`

— Function`envelope(f)`

Return the envelope of the field `f`

.

`ElectricFields.fft_vector_potential`

— Method`fft_vector_potential(f::AbstractField, t::AbstractRange)`

Compute the FFT of the `vector_potential`

of the field `f`

sampled on the uniform temporal grid `t`

.

`ElectricFields.fftω`

— Method`fftω(t::AbstractRange)`

Return the angular frequency grid corresponding to uniform sampling in time with the tempolar grid `t`

.

`ElectricFields.field_amplitude`

— Method`field_amplitude(f, a, b)`

Compute the time integral of the field amplitude according to

\[\int_a^b\diff{t}F(t) = -[A(b) - A(a)],\]

where $A(t)$ is the `vector_potential`

.

`ElectricFields.field_amplitude`

— Method`field_amplitude(f, t)`

Compute the field amplitude from the `vector_potential`

$A(t)$ using automatic differentiation according to

\[F(t) = -\partial_t A(t).\]

`ElectricFields.field_amplitude_spectrum`

— Method`field_amplitude_spectrum(f::AbstractField, ω)`

Compute the analytic Fourier transform of the `field_amplitude`

of the field `f`

at the angular frequency `ω`

, using the Fourier identity

\[\vec{F}(t) = -\partial_t \vec{A}(t) \iff \hat{\vec{F}}(\omega) = -\im\omega \hat{\vec{A}}(\omega)\]

`ElectricFields.field_envelope`

— Method`field_envelope(f, t)`

Compute the field amplitude envelope as the square root of `field_envelope`

.

`ElectricFields.fluence`

— Method`fluence(f)`

Compute the fluence of the field `f`

, i.e.

\[\frac{1}{\hbar\omega} \int\diff{t} I(t),\]

where $I(t)$ is the `intensity`

envelope of the pulse.

`ElectricFields.free_oscillation_amplitude`

— Method`free_oscillation_amplitude(F)`

Compute the free oscillation amplitude of an electric field `F`

, i.e. the mean excursion length during one cycle of the field, defined as

\[\alpha \defd \frac{F}{\omega^2}\]

where `F`

is the peak amplitude, i.e. this is defined for one cycle of a monochrome field.

`ElectricFields.frequency`

— Method`frequency(f)`

Return the carrier frequency $f$ of the field `f`

.

`ElectricFields.gaussian_common!`

— Method`gaussian_common!(field_params, carrier[; Tmax_rounder, verbosity])`

Compute parameters common to Gaussian envelopes, i.e. `GaussianEnvelope`

and `TruncatedGaussianEnvelope`

; most importantly, given an intensity FWHM or σ, we need to figure out the coefficient $\alpha$ for the envelope of the vector potential $\exp(-\alpha t^2)$, such that the electric field amplitude and intensity have the desired durations. The optional function `Tmax_rounder`

determines if the envelop should be extended to encompass an integer amount of cycles of the `carrier`

(default).

`ElectricFields.instantaneous_intensity`

— Method`instantaneous_intensity(f, t)`

Compute the instantaneous intensity of the field `f`

as

\[I_i(t) = \abs{F(t)}^2 = \abs{-\partial_t A(t)}^2.\]

`ElectricFields.intensity`

— Function`intensity(f)`

Return the peak intensity of the field `f`

.

`ElectricFields.intensity`

— Method`intensity(f, t)`

Compute the intensity *envelope* of the field `f`

at time `t`

by applying `phase_shift`

to the `carrier`

and looking for the maximal `instantaneous_intensity`

.

`ElectricFields.keldysh`

— Method`keldysh(f, Iₚ)`

The Keldysh parameter relates the strength of a dynamic electric field to that of the binding potential of an atom. It is given by

\[\gamma = \sqrt{\frac{I_p}{2U_p}},\]

where $I_p$ is the ionization potential of the atom and $U_p$ is the ponderomotive potential of the dynamic field.

`ElectricFields.max_frequency`

— Method`max_frequency(f)`

Return the maximum carrier frequency $f$ in case of a composite field `f`

.

`ElectricFields.nfft`

— Method`nfft(y, ts...)`

Normalized FFT of `y`

with respect to the axes `ts`

. We use the symmetric normalization $(2\pi)^{-N/2}$ where $N$ is the number of dimensions.

`ElectricFields.nfft`

— Method`nfft(f::AbstractField, t::AbstractRange)`

Compute the symmetrically normalized FFT of the `field_amplitude`

of the field `f`

sampled on the uniform temporal grid `t`

.

`ElectricFields.nfft_vector_potential`

— Method`nfft_vector_potential(f::AbstractField, t::AbstractRange)`

Compute the symmetrically normalized FFT of the `vector_potential`

of the field `f`

sampled on the uniform temporal grid `t`

.

`ElectricFields.period`

— Method`period(f)`

Return the carrier period time $T$ of `f`

.

`ElectricFields.phase`

— Function`phase(c)`

Return the phase of the carrier `c`

.

`ElectricFields.phase_shift`

— Function`phase_shift(f, δϕ)`

Return a new field whose `carrier`

has been phase-shifted by `δϕ`

.

`ElectricFields.photon_energy`

— Method`photon_energy(f)`

Return the carrier photon energy $\hbar\omega$ of the field `f`

.

`ElectricFields.polarization`

— Function`polarization(f)`

Return the polarization kind of the field `f`

. See also `dimensions`

.

**Examples**

```
julia> @field(F) do
I₀ = 2.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 2.0000e+00 au = 7.0188904e16 W cm^-2 =>
- E₀ = 1.4142e+00 au = 727.2178 GV m^-1
- A₀ = 0.4502 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0507 Ha = 1.3785 eV => α = 0.1433 Bohr = 7.5826 pm
julia> polarization(F)
LinearPolarization()
julia> @field(F) do
I₀ = 2.0
T = 2.0
σ = 3.0
Tmax = 3.0
ξ = 1.0
end
Transversely polarized field with
- I₀ = 2.0000e+00 au = 7.0188904e16 W cm^-2 =>
- E₀ = 1.4142e+00 au = 727.2178 GV m^-1
- A₀ = 0.4502 au
– a Elliptical carrier with ξ = 1.00 (RCP) @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV, f = 20.6707 PHz)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
– and a bandwidth of 0.3925 Ha = 10.6797 eV ⟺ 2.5823 PHz ⟺ 34.2390 Bohr = 1.8119 nm
– Uₚ = 0.0507 Ha = 1.3785 eV => α = 0.1433 Bohr = 7.5826 pm
julia> polarization(F)
ArbitraryPolarization()
```

`ElectricFields.ponderomotive_potential`

— Method`ponderomotive_potential(f)`

Return the ponderomotive potential $U_p$, which is the cycle-average quiver energy of a free electron in an electromagnetic field `f`

. It is given by

\[U_p = \frac{e^2E_0^2}{4m\omega^2}=\frac{2e^2}{c\varepsilon_0m}\times\frac{I}{4\omega^2},\]

or, in atomic units,

\[U_p = \frac{I}{4\omega^2}.\]

`ElectricFields.span`

— Method`span(f)`

Return the end-points for the `envelope`

of the field `f`

.

`ElectricFields.spectrum`

— Method`spectrum(env::AbstractGaussianEnvelope)`

Gaussians belong to the Schwartz class, i.e. functions who, under Fourier transform, are mapped back to the same space. That is to say, the Fourier transform of a Gaussian is a Gaussian:

\[\exp(-\alpha t^2) \leftrightarrow \frac{1}{\sqrt{2\alpha}} \exp\left(-\frac{\omega^2}{4\alpha}\right).\]

Comparing with the above, we find that the spectral standard deviation

\[\Omega = \sqrt{2\alpha} = \frac{2\sqrt{\ln 2}}{\tau},\]

and the Gaussian function in the spectral domain is thus

\[E(\omega) = \frac{E_0\tau}{2\sqrt{\ln 2}} \exp\left[-\frac{(\omega\tau)^2}{8\ln2}\right].\]

`ElectricFields.steps`

— Function`steps(f[, fs])`

Return number of time steps for the field `f`

, optionally supplying a sampling frequency.

We construct the time axis such that the highest frequency component of the field is resolved. By the Nyquist sampling theorem, we need minimum $f_s>2f_{\textrm{max}}$, but to be on the safe side, we use, as default, $f_s=100f_{\textrm{max}}$. This also makes plots nicer.

If `fs<:Integer`

, the sampling frequency is computed as `fs/T`

, i.e. `fs`

steps per cycle.

`ElectricFields.test_field_parameters`

— Method`test_field_parameters(field_params, set)`

This function ensures that one and only one of "competing" quantities is specified.

`ElectricFields.time_bandwidth_product`

— Method`time_bandwidth_product(f)`

Return the time–bandwidth product of the field `f`

.

`ElectricFields.timeaxis`

— Function`ElectricFields.timeaxis`

— Method`timeaxis(f, (N,dt))`

Alternate interface that constructs the time axis with `N`

steps starting from `first(span(f))`

, with intervals of `dt`

.

`ElectricFields.vector_potential`

— Function`vector_potential(f, t)`

Compute the vector potential $\vec{A}(t)$ of the field `f`

.

`ElectricFields.vector_potential_spectrum`

— Function`vector_potential_spectrum(f::AbstractField, ω)`

Compute the analytic Fourier transform of the `vector_potential`

of the field `f`

at the angular frequency `ω`

.

`ElectricFields.wavelength`

— Method`wavelength(f)`

Return the carrier wavelength $\lambda$ of `f`

.

`ElectricFields.wavenumber`

— Method`wavenumber(f)`

Return the carrier wavenumber $\nu$ of the field `f`

.

`ElectricFields.@field`

— Macro`@field(name) do ... end`

Frontend macro for creating an electric field and storing it in the variable `name`

.

**Example**

```
julia> @field(F) do
I₀ = 2.0
T = 2.0
σ = 3.0
Tmax = 3.0
end
Linearly polarized field with
- I₀ = 2.0000e+00 au = 7.0188904e16 W cm⁻² =>
- E₀ = 1.4142e+00 au = 727.2178 GV m⁻¹
- A₀ = 0.4502 au
– a Fixed carrier @ λ = 14.5033 nm (T = 48.3777 as, ω = 3.1416 Ha = 85.4871 eV)
– and a Gaussian envelope of duration 170.8811 as (intensity FWHM; ±2.00σ)
```

`ElectricFields.@namespace!`

— Macro`@namespace!(exprs, params)`

This macro uses the dictionary `params`

as a "namespace", i.e. all symbols are assumed to be keys in this dictionary. We need to escape the generated expression tree to modify in the scope of the caller, not the global scope.