ffsim.rdms

ffsim.rdms(vec, norb, nelec, *, rank=1, spin_summed=False, reorder=True)[source]

Return the reduced density matrices of a state vector.

The rank 1 RDM is defined as follows:

rdm1[p, q] = ⟨p+ q⟩

The definition of higher-rank RDMs depends on the reorder argument, which defaults to True.

reorder = True

The reordered RDMs are defined as follows:

rdm2[p, q, r, s] = ⟨p+ r+ s q⟩
rdm3[p, q, r, s, t, u] = ⟨p+ r+ t+ u s q⟩
rdm4[p, q, r, s, t, u, v, w] = ⟨p+ r+ t+ v+ w u s q⟩

reorder = False

If reorder is set to False, the RDMs are defined as follows:

rdm2[p, q, r, s] = ⟨p+ q r+ s⟩
rdm3[p, q, r, s, t, u] = ⟨p+ q r+ s t+ u⟩
rdm4[p, q, r, s, t, u, v, w] = ⟨p+ q r+ s t+ u v+ w⟩

Note

Ranks 1 through 4 are supported. A rank-k spin-summed tensor stores norb ** (2*k) entries. For ranks 3 and 4, spin-resolved calculations use real intermediate tensors with (2*norb) ** (2*k) entries and a spinless state vector of dimension binom(2*norb, sum(nelec)). These calculations can require substantially more memory than the returned RDMs.

To compute matrix elements between two different states, use transition_rdms().

Parameters:
  • vec (ndarray) – The state vector whose reduced density matrix is desired.

  • norb (int) – The number of spatial orbitals.

  • nelec (tuple[int, int]) – The number of alpha and beta electrons.

  • rank (int) – The highest rank of reduced density matrix to return, from 1 to 4.

  • spin_summed (bool) – Whether to return the “spin-summed” RDMs.

  • reorder (bool) – Whether to reorder the indices of the reduced density matrix.

Return type:

ndarray | tuple[ndarray, ...]

Returns:

The reduced density matrices. All RDMs up to and including the specified rank are returned, in increasing order of rank. For example, if rank=2 then a tuple (rdm1, rdm2) is returned. For rank=1, the 1-RDM is returned directly.

Spin-summed rank-k tensors have shape (norb,) * (2*k) and sum over all spin assignments to the k creation-annihilation pairs. In particular, the spin-summed 1-RDM is alpha-alpha + beta-beta.

Spin-resolved tensors have shape (k+1,) + (norb,) * (2*k). The leading axis selects the spin blocks, with a denoting alpha and b beta for each creation-annihilation pair: (a, b) for rank 1, (aa, ab, bb) for rank 2, (aaa, aab, abb, bbb) for rank 3, and (aaaa, aaab, aabb, abbb, bbbb) for rank 4.