schr.qed.field module

Photon field representation for QED simulations.

This module implements a finite-mode photon field with creation and annihilation operators in the Fock space representation.

class schr.qed.field.PhotonField(n_modes: int, frequencies: ~jax.Array, max_photons: int = 10, dtype: ~numpy.dtype = <class 'jax.numpy.complex64'>)[source]

Bases: Field

Finite-mode photon field in Fock space.

Represents a quantized electromagnetic field using a finite number of photon modes. Each mode is characterized by a frequency \(\omega\) and can be in various number states \(|n\rangle\).

The field is represented as a state vector in the truncated Fock space, where each mode can have 0 to max_photons photons.

n_modes

Number of photon modes.

max_photons

Maximum photon number per mode (truncation).

frequencies

Angular frequencies of each mode (\(\omega_i\)).

state

Current state vector in Fock space.

dtype

JAX dtype for the field.

annihilation_operator(mode: int) Array[source]

Get the annihilation operator \(a\) for a given mode.

The annihilation operator decreases the photon number in mode i: \(a_i |n_i\rangle = \sqrt{n_i} |n_i - 1\rangle\).

Parameters:

mode – Mode index (0 to n_modes-1).

Returns:

Matrix representation of the annihilation operator for this mode.

Raises:

ValueError – If mode index is out of range.

creation_operator(mode: int) Array[source]

Get the creation operator \(a^\dagger\) for a given mode.

The creation operator increases the photon number in mode i: \(a^\dagger_i |n_i\rangle = \sqrt{n_i + 1} |n_i + 1\rangle\).

Parameters:

mode – Mode index (0 to n_modes-1).

Returns:

Matrix representation of the creation operator for this mode.

Raises:

ValueError – If mode index is out of range.

expectation_photon_number(mode: int) float[source]

Compute expectation value of photon number in a mode.

Computes \(\langle\psi|\hat{n}_i|\psi\rangle\) where \(\hat{n}_i = a^\dagger_i a_i\).

Parameters:

mode – Mode index.

Returns:

Expected number of photons in the specified mode.

Raises:

NotImplementedError – For multi-mode expectation (not yet implemented).

get_state() Array[source]

Get the current state of the field.

Returns:

The field state as a JAX array.

hamiltonian(hbar: float = 1.0) Array[source]

Get the free-field Hamiltonian \(H = \sum_i \hbar\omega_i (a^\dagger_i a_i + 1/2)\).

Parameters:

hbar – Reduced Planck constant (default: 1.0).

Returns:

Matrix representation of the field Hamiltonian.

Note

For multi-mode fields, this returns the sum over all modes. The zero-point energy (1/2) is included.

number_operator(mode: int) Array[source]

Get the number operator \(\hat{n} = a^\dagger a\) for a given mode.

Parameters:

mode – Mode index (0 to n_modes-1).

Returns:

Matrix representation of the number operator for this mode.

Raises:

ValueError – If mode index is out of range.

set_state(state: Array) None[source]

Set the field state.

Parameters:

state – The new field state.

Raises:

ValueError – If state shape doesn’t match expected shape.