Post-processing

The eigenfunctions returned by the solver are Gridap finite element functions (CellField). Every observable that can be written as an integral over the mesh is computed with the same quadrature used to build the Hamiltonian. The functions below act on a vector of eigenfunctions ϕ and return one value per state. U is the trial space, Ω the triangulation and dΩ the measure (see Low-level interface).

Checks

FunctionComputes
norm_l2(ψ, dΩ)``\big(\int
eigenstates_normalization(ϕ, dΩ)the norm of every state
orthogonality_check(ϕ, dΩ)``

The eigenvectors returned by ARPACK are normalized, and eigenvectors of different eigenvalues are orthogonal. Within a degenerate subspace (e.g. the $(n+1)$-fold levels of the 2D isotropic oscillator) the complex ARPACK driver returns linearly independent vectors that are not necessarily orthogonal. If an orthonormal basis of the subspace is needed, orthonormalize it, e.g. with Gram–Schmidt using sum(∫(ϕ[j]' * ϕ[i]) * dΩ) as inner product.

Densities

FunctionComputes
density(ϕ)``\rho_n(\mathbf x) =
reduced_density(ϕ, r, model)2D: $\rho^{(1)}(x)=\int\rho\,dy$ and $\rho^{(2)}(y)=\int\rho\,dx$ sampled at the points r = (x_vector, y_vector)
Version 0.1.0

In v0.1.0, reduced_density returned $(1-\Delta x/L)\,\rho^{(1)}$. Fixed in v0.1.1; results computed with v0.1.0 can be corrected by dividing by their integral.

Moments of the coordinates

FunctionComputes
coord_first_moment(ϕ, U, Ω, dΩ, k)$\langle x_k\rangle$
coord_second_moment(ϕ, U, Ω, dΩ, k)$\langle x_k^2\rangle$
coord_standar_deviation(ϕ, U, Ω, dΩ, k)$\sigma_{x_k}=\sqrt{\langle x_k^2\rangle-\langle x_k\rangle^2}$

Information-theoretic quantities

FunctionComputes
time_indep_entropy(ϕ, U, dΩ)Shannon entropy $S=-\int\rho\log_2\rho\,d\Omega$ (bits)
time_indep_entropy(ϕ, U, dΩ, α)Rényi entropy $S_\alpha=\frac{1}{1-\alpha}\log_2\int\rho^\alpha d\Omega$
reduced_time_indep_entropy(r, ρ)for a density $\rho(x_i, y_j)$ sampled on a grid: $-\int\rho(x_i,y)\log_2\rho(x_i,y)\,dy$ for every $x_i$, and the analogous quantity for every $y_j$ (trapezoidal rule)
time_indep_diff_mutual_information(Sx, Sy, Sxy)$I = S_x + S_y - S_{xy}$

To obtain the mutual information between the two coordinates of a 2D state, compute the entropies of the reduced densities $\rho^{(1)}$, $\rho^{(2)}$ (one number each) and the total entropy $S$, then $I = S^{(1)} + S^{(2)} - S$. For two particles, $I$ measures the correlation between them; it vanishes for product states.

Version 0.1.0

In v0.1.0 the Rényi entropy evaluated $\rho^{\alpha/\ln 2}$ instead of $\rho^\alpha$; fixed in v0.1.1. The Shannon entropy was always correct. With v0.1.0, compute it directly as log2(sum(∫((z -> z^α) ∘ ρ) * dΩ)) / (1 - α) with ρ = density(ϕ)[n].

Writing your own observables

Any integral can be written with Gridap syntax. For example the expectation value of the potential and the kinetic energy of state n:

ψ = ϕ[n]
V_mean = real(sum(∫(ψ' * q * ψ) * dΩ))
T_mean = real(sum(∫(p * (∇(ψ)' ⋅ ∇(ψ))) * dΩ))

and the overlap of two states computed on the same mesh, sum(∫(ψ1' * ψ2) * dΩ).