zkit.mwigner.current

Phase-space (Wigner) current of a marginal Wigner function \(W(x, p)\).

\(W(x, p)\) is the marginal Wigner function of zkit.mwigner.transform.get_wigner_research() (the \(y\) degree of freedom integrated out). It obeys the continuity equation

\[\partial_t W + \partial_x J_x + \partial_p J_p = 0, \qquad J_x = p\,W, \qquad J_p = -V'(x)\,W + Q(x, p),\]

where \(Q\) is the non-local Moyal quantum force (\(\hbar = m = 1\)). \(Q\) vanishes for free motion and for quadratic potentials, where \(W\) follows the classical Liouville equation; these cases are exact references. Derivatives are spectral (FFT) on uniform grids, exact to round-off for states that decay to zero at the grid boundary. Only the \(x\) and \(p_x\) components are available from the marginal distribution.

zkit.mwigner.current.deriv_x(F, dx)

Spectral derivative along the first (position) axis.

zkit.mwigner.current.deriv_p(F, dp)

Spectral derivative along the second (momentum) axis.

zkit.mwigner.current.current_x(W, p)

Streaming current \(J_x(x, p) = p\,W(x, p)\).

Parameters:
  • W (numpy.ndarray) – Wigner function on the \((x, p)\) grid, shape (n_x, n_p).

  • p (array_like) – Momentum grid (length n_p).

Returns:

\(J_x\) with the shape of W.

Return type:

numpy.ndarray

zkit.mwigner.current.current_p_classical(W, x, Vp)

Classical force current \(J_p(x, p) = -V'(x)\,W(x, p)\).

Exact for free motion and quadratic potentials (\(Q = 0\)).

Parameters:
  • W (numpy.ndarray) – Wigner function, shape (n_x, n_p).

  • x (array_like) – Position grid (unused; kept for a uniform signature).

  • Vp (array_like) – \(V'(x)\) on the position grid (length n_x).

Returns:

\(J_p\) with the shape of W.

Return type:

numpy.ndarray

zkit.mwigner.current.current_p(W, x, Vp=None, moyal_terms=None, p=None)

Momentum current \(J_p\), optionally including the Moyal quantum force.

Parameters:
  • W (numpy.ndarray) – Wigner function, shape (n_x, n_p).

  • x (array_like) – Position grid.

  • Vp (array_like, optional) – \(V'(x)\); without it the classical part is zero.

  • moyal_terms (dict, optional) – Odd derivatives of \(V\) (see moyal_quantum_force()); adds the quantum force \(Q\).

  • p (array_like, optional) – Momentum grid; required with moyal_terms.

Returns:

\(J_p\) with the shape of W.

Return type:

numpy.ndarray

Raises:

ValueError – If moyal_terms is given without p.

zkit.mwigner.current.moyal_quantum_force(W, x, p, V_derivs)

Moyal quantum force \(Q(x, p)\) for a general potential.

With the Moyal residual \(R_Q\) (moyal_residual()) the continuity form gives \(\partial_p Q = -R_Q\). \(Q\) is obtained as the spectral antiderivative in \(p\), with the integration constant fixed by \(\int Q\,dp = 0\) (the quantum force carries no net momentum).

Parameters:
  • W (numpy.ndarray) – Wigner function, shape (n_x, n_p).

  • x (array_like) – Position grid.

  • p (array_like) – Uniform momentum grid.

  • V_derivs (dict) – Odd derivatives of \(V\) on the position grid: "Vp" (\(V'\)), "V3", "V5", "V7" (\(V^{(3)}\), \(V^{(5)}\), \(V^{(7)}\)).

Returns:

\(Q\) with the shape of W.

Return type:

numpy.ndarray

zkit.mwigner.current.moyal_residual(W, x, p, V_derivs)

Quantum residual of the Moyal equation.

\[R_Q = \sum_{n \ge 1} \frac{(-1)^n}{2^{2n} (2n+1)!}\, V^{(2n+1)}(x)\,\partial_p^{2n+1} W ,\]

i.e. \(\partial_t W - (-p\,\partial_x W + V'(x)\,\partial_p W)\). Terms up to \(V^{(7)}\) are included, stopping at the first missing derivative. \(R_Q = 0\) for free motion and quadratic potentials.

Parameters:
  • W (numpy.ndarray) – Wigner function, shape (n_x, n_p).

  • x (array_like) – Position grid.

  • p (array_like) – Uniform momentum grid.

  • V_derivs (dict) – "V3", "V5", "V7": odd derivatives of \(V\) sampled on the position grid of W.

Returns:

\(R_Q\) with the shape of W.

Return type:

numpy.ndarray

Raises:

ValueError – If a derivative array is not sampled on the position grid of W.

zkit.mwigner.current.continuity_residual(W, x, p, dWdt, Vp=None, moyal_derivs=None)

Residual of the phase-space continuity equation.

\[R = \partial_t W + \partial_x (p\,W) + \partial_p J_p^{\mathrm{cl}} - R_Q ,\]

which vanishes for a correct current. \(R_Q\) (moyal_residual()) is subtracted only when moyal_derivs is given.

Parameters:
  • W (numpy.ndarray) – Wigner function, shape (n_x, n_p).

  • x (array_like) – Uniform position and momentum grids.

  • p (array_like) – Uniform position and momentum grids.

  • dWdt (numpy.ndarray) – Time derivative of \(W\).

  • Vp (array_like, optional) – \(V'(x)\) for the classical force current.

  • moyal_derivs (dict, optional) – Odd derivatives of \(V\) for the quantum residual.

Returns:

\(R\) with the shape of W.

Return type:

numpy.ndarray

zkit.mwigner.current.compute_current(W, x, p, dWdt=None, Vp=None, moyal_derivs=None)

Phase-space current and, optionally, the continuity residual.

Parameters:
  • W (numpy.ndarray) – Wigner function, shape (n_x, n_p).

  • x (array_like) – Uniform position and momentum grids.

  • p (array_like) – Uniform position and momentum grids.

  • dWdt (numpy.ndarray, optional) – Time derivative of \(W\); adds the continuity residual.

  • Vp (array_like, optional) – \(V'(x)\) for the classical force current.

  • moyal_derivs (dict, optional) – Odd derivatives of \(V\), used in the residual only.

Returns:

Jx and Jp (classical part), and residual when dWdt is given (continuity_residual()).

Return type:

dict

zkit.mwigner.current.linf_norm(F)

Largest absolute value of an array.