fock_basis

Fock-basis construction and integer-encoded basis objects.

class edrixs.fock_basis.FockBasis(basis_int, norbs, spec=None)[source]

Integer-encoded Fock basis with constant-time state lookup.

Orbital zero is stored as the least significant bit, as in native Fortran. Orbital i has mask 1 << i; occupation lists remain in orbital order, with orbital zero first.

Parameters:
basis_intsequence of int

Integer encodings of the basis states in matrix-index order.

norbsint

Number of spin-orbitals represented by each state.

specFockBasisSpec or None, optional

Structured sector description when the basis was generated from fixed shell occupancies. Arbitrary explicit bases may leave this as None.

decode(position)[source]

Return the integer-encoded Fock state at position.

encode(value)[source]

Return the basis position of an integer-encoded Fock state.

class edrixs.fock_basis.FockBasisSpec(shapes: tuple[tuple[int, int], ...])[source]

Compact description of fixed occupancies in one or more orbital shells.

classmethod from_args(*args)[source]

Build a specification from (norbs, nocc) pairs.

property norbs

Total number of spin-orbitals.

class edrixs.fock_basis.FockBinByN(shapes: tuple[tuple[int, int], ...])[source]

Implicit combinadic basis for a complete fixed-occupancy sector.

decode(index)[source]

Return the integer-encoded state at the canonical EDRIXS index.

encode(state)[source]

Return the canonical EDRIXS index of state.

classmethod from_spec(spec)[source]

Build an implicit basis from a FockBasisSpec.

jit_args()[source]

Return compact numeric metadata for an explicitly requested JIT path.

edrixs.fock_basis.build_fock_basis(basis, method='combinadic')[source]

Realize a compact basis specification with the requested representation.

edrixs.fock_basis.fock_bin(n, k)[source]

Return all the possible \(n\)-length binary where \(k\) of \(n\) digitals are set to 1.

Parameters:
n: int

Binary length \(n\).

k: int

How many digitals are set to be 1.

Returns:
res: list of int-lists

A list of list containing the binary digitals.

Examples

>>> import edrixs
>>> edrixs.fock_bin(4, 2)
[[1, 1, 0, 0],
 [1, 0, 1, 0],
 [1, 0, 0, 1],
 [0, 1, 1, 0],
 [0, 1, 0, 1],
 [0, 0, 1, 1]]
edrixs.fock_basis.get_fock_basis_by_NJz(norb, N, jz_list)[source]

Get decimal digitals to represent Fock states, use good quantum number:

  • total angular momentum \(J_{z}\)

Parameters:
norb: int

Number of orbitals.

N: int

Number of total occupancy.

jz_list: list of int

Quantum number \(j_{z}\) for each orbital.

Returns:
res: dict

A dictionary containing the decimal digitals, the key is good quantum numbers \(j_{z}\), the value is a list of int.

Examples

>>> import edrixs
>>> edrixs.get_fock_basis_by_NJz(6, 2, [-1, 1, -3, -1, 1, 3])
{-6: [], -5: [], -4: [5, 12], -3: [], -2: [6, 9, 20], -1: [],
 0: [3, 10, 17, 36, 24], 1: [], 2: [18, 33, 40], 3: [],
 4: [34, 48], 5: [], 6: []}
edrixs.fock_basis.get_fock_basis_by_NLz(norb, N, lz_list)[source]

Get decimal digitals to represent Fock states, use good quantum number:

  • orbital angular momentum \(L_{z}\)

Parameters:
norb: int

Number of orbitals.

N: int

Number of total occupancy.

lz_list: list of int

Quantum number \(l_{z}\) for each orbital.

Returns:
res: dict

A dictionary containing the decimal digitals, the key is good quantum numbers \(L_{z}\), the value is a list of int.

Examples

>>> import edrixs
>>> edrixs.get_fock_basis_by_NLz(6, 2, [-1, -1, 0, 0, 1, 1])
{-2: [3], -1: [5, 6, 9, 10], 0: [12, 17, 18, 33, 34],
 1: [20, 36, 24, 40], 2: [48]}
edrixs.fock_basis.get_fock_basis_by_NSz(norb, N, sz_list)[source]

Get decimal digitals to represent Fock states, use good quantum number:

  • spin angular momentum \(S_{z}\)

Parameters:
norb: int

Number of orbitals.

N: int

Number of total occupancy.

sz_list: list of int

Quantum number \(s_{z}\) for each orbital.

Returns:
res: dict

A dictionary containing the decimal digitals, the key is good quantum numbers \(S_{z}\), the value is a list of int.

Examples

>>> import edrixs
>>> edrixs.get_fock_basis_by_NSz(6, 2, [1, -1, 1, -1, 1, -1])
{-2: [10, 34, 40], -1: [],
 0: [3, 6, 9, 12, 18, 33, 36, 24, 48], 1: [], 2: [5, 17, 20]}
edrixs.fock_basis.get_fock_basis_by_N_LzSz(norb, N, lz_list, sz_list)[source]

Get decimal digitals to represent Fock states, use good quantum number:

  • orbital angular momentum \(L_{z}\)

  • spin angular momentum \(S_{z}\)

Parameters:
norb: int

Number of orbitals.

N: int

Number of total occupancy.

lz_list: list of int

Quantum number \(l_{z}\) for each orbital.

sz_list: list of int

Quantum number \(s_{z}\) for each orbital.

Returns:
basis: dict

A dictionary containing the decimal digitals, the key is a tuple of good quantum numbers (\(l_{z}\), \(s_{z}\)), and the value is a list of int.

Examples

>>> import edrixs
>>> lz = [-1, -1, 0, 0, 1, 1]
>>> sz = [1, -1, 1, -1, 1, -1]
>>> edrixs.get_fock_basis_by_N_LzSz(6, 2, lz, sz)[(0, 0)]
[12, 18, 33]
edrixs.fock_basis.get_fock_basis_by_N_abelian(norb, N, a_list)[source]

Get decimal digitals to represent Fock states, use some Abelian good quantum number.

Parameters:
norb: int

Number of orbitals.

N: int

Number of total occupancy.

a_list: list of int

Quantum number of the Abelian symmetry for each orbital.

Returns:
basis: dict

A dictionary containing the decimal digitals, the key is good quantum numbers, the value is a list of int.

edrixs.fock_basis.get_fock_basis_combinadic(*args)[source]

Build an implicit combinadic basis for fixed shell occupancies.

edrixs.fock_basis.get_fock_basis_int(*args)[source]

Build an explicit FockBasis for fixed shell occupancies.

The state ordering is the historical EDRIXS ordering produced by get_fock_bin_by_N().

edrixs.fock_basis.get_fock_bin_by_N(*args)[source]

Get binary form to represent a Fock state.

Parameters:
args: ints

args[0]: number of orbitals for 1st-shell,

args[1]: number of occupancy for 1st-shell,

args[2]: number of orbitals for 2nd-shell,

args[3]: number of occupancy for 2nd-shell,

…

args[ \(2N-2\)]: number of orbitals for \(N\) th-shell,

args[ \(2N-1\)]: number of occupancy for \(N\) th-shell.

Returns:
result: list of int list

The binary form of Fock states.

Examples

>>> import edrixs
>>> edrixs.get_fock_bin_by_N(4, 2)
[[1, 1, 0, 0],
 [1, 0, 1, 0],
 [1, 0, 0, 1],
 [0, 1, 1, 0],
 [0, 1, 0, 1],
 [0, 0, 1, 1]]
>>> edrixs.get_fock_bin_by_N(4, 2, 2, 1)
[[1, 1, 0, 0, 1, 0],
 [1, 0, 1, 0, 1, 0],
 [1, 0, 0, 1, 1, 0],
 [0, 1, 1, 0, 1, 0],
 [0, 1, 0, 1, 1, 0],
 [0, 0, 1, 1, 1, 0],
 [1, 1, 0, 0, 0, 1],
 [1, 0, 1, 0, 0, 1],
 [1, 0, 0, 1, 0, 1],
 [0, 1, 1, 0, 0, 1],
 [0, 1, 0, 1, 0, 1],
 [0, 0, 1, 1, 0, 1]]
edrixs.fock_basis.get_fock_full_N(norb, N)[source]

Get the decimal digitals to represent Fock states.

Parameters:
norb: int

Number of orbitals.

N: int

Number of occupancy.

Returns:
res: list of int

The decimal digitals to represent Fock states.

Examples

>>> import edrixs
>>> edrixs.fock_bin(4, 2)
[[1, 1, 0, 0],
 [1, 0, 1, 0],
 [0, 1, 1, 0],
 [1, 0, 0, 1],
 [0, 1, 0, 1],
 [0, 0, 1, 1]]
>>> edrixs.get_fock_full_N(4, 2)
[3, 5, 6, 9, 10, 12]
edrixs.fock_basis.get_fock_half_N(N)[source]

Group half-space integer states by particle number.

edrixs.fock_basis.write_fock_dec_by_N(N, r, fname='fock_i.in')[source]

Get decimal digitals to represent Fock states, sort them by ascending order and then write them to file.

Parameters:
N: int

Number of orbitals.

r: int

Number of occuancy.

fname: string

File name.

Returns:
ndim: int

The dimension of the Hilbert space.

Examples

>>> import edrixs
>>> edrixs.write_fock_dec_by_N(4, 2, 'fock_i.in')
6

The first line of fock_i.in is the total number of Fock states, followed by the states in decimal form: 3, 5, 6, 9, 10, 12.