FCI.few_body_diagonalization¶
module provides functions to build a many-body basis and to construct Hamiltonian matrices stored in compressed storage row csr format.
Functions
|
adds lists of sparse 2-body operators into a single sparse list |
|
adds lists of sparse 3-body operators into a single sparse list |
|
converts a scipy.sparse.csr_matrix into a list of elements [p,q,r,s,value] |
|
converts a scipy.sparse.csr_matrix into a list of elements [p,q,r,s,u,v,value] |
|
for a 2-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 1-body operator |
|
for a 3-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 1-body operator |
|
for a 4-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 1-body operator |
|
for a 2-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 2-body operator |
|
for a 3-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 2-body operator |
|
for a 4-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 2-body operator |
|
for a 3-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 3-body operator |
|
for a 4-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 3-body operator |
|
for a system defined via the lookup table this function returns a list of matrix elements, a list of row indices, and a list of column indices of the shift operator that moves the state by a single lattice unit into direction |
|
returns a compressed sparse row 'csr' matrix of a 1-body operator into a 2-body basis |
|
returns a compressed sparse row 'csr' matrix of a 1-body operator into a 3-body basis |
|
returns a compressed sparse row 'csr' matrix of a 1-body operator into a 4-body basis |
|
returns a compressed sparse row 'csr' matrix of a 2-body operator into a 2-body basis |
|
returns a compressed sparse row 'csr' matrix of a 2-body operator into a 3-body basis |
|
returns a compressed sparse row 'csr' matrix of a 2-body operator into a 4-body basis |
|
returns a compressed sparse row 'csr' matrix of a 3-body operator into a 3-body basis |
|
returns a compressed sparse row 'csr' matrix of a 3-body operator into a 4-body basis |
|
returns a scalar operator as a CSR matrix using the lookup dictionary. |
|
returns dictionary of many-body states |
|
returns a compressed sparse row 'csr' matrix of the shift operator into a few-body basis |
|
returns the number of permutations needed to bring a list into order |
- FCI.few_body_diagonalization.get_many_body_states(basis, num_part, total_tz=None, total_sz=None)¶
returns dictionary of many-body states
- Parameters:
basis (list[list[int, int, int, int, int], [ ...]]) – the single-particle basis
num_part (int) – number of fermions
total_tz (int) – total z-component of isospin (twice its value)
total_sz (int) – total z-component of spin (twice its value)
- Returns:
a dictionary where keys are tuples of single-particle states and values are the indices of that many-body state; this eerves as a lookup table.
- Return type:
dict(tuple(int, int, int, …): int)
- FCI.few_body_diagonalization.get_csr_matrix_scalar_op(lookup, operator, num_sp_stat)¶
returns a scalar operator as a CSR matrix using the lookup dictionary. The few-body basis can only have A=2, 3, or 4 particles, and the rank of the operator can only be 1, 2, or 3.
- Parameters:
lookup (dict(tuple(int,int,...): int)) – dictionary of A-body states
operator (list[list[int, int, int, int, float], [...]]) – list of matrix elements of the few-body operator
num_sp_stat (int) – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse csr_matrix
- FCI.few_body_diagonalization.fill_1b_op_in_2b_basis(lookup, operator, nstat)¶
for a 2-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 1-body operator
- Parameters:
lookup (dict(tuple(int,int): int)) – dictionary of two-body states
operator (list[list[int,int,float]]) – one-body operator as list of [row, col, value]
nstast – number of single-particle states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_2b_op_in_2b_basis(lookup, operator)¶
for a 2-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 2-body operator
- Parameters:
lookup (dict(tuple(int,int): int)) – dictionary of two-body states
operator (list[list[int,int,int,int,float]]) – two-body operator as list of [p, q, r, s, value] where p, q, r, s are one-body states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_1b_op_in_3b_basis(lookup, operator, nstat)¶
for a 3-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 1-body operator
- Parameters:
lookup (dict(tuple(int,int,int): int)) – dictionary of three-body states
operator (list[list[int,int,float]]) – one-body operator as list of [p, q, value] where p, q are one-body states
nstast – number of single-particle states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_2b_op_in_3b_basis(lookup, operator, nstat)¶
for a 3-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 2-body operator
- Parameters:
lookup (dict(tuple(int,int,int): int)) – dictionary of three-body states where keys are tuples (p q r) of one-body states and values are the index of the corresponding three-body basis state
operator (list[list[int,int,int,int,float]]) – two-body operator as list of [p, q, r, s, value] where p, q, r, s are one-body states
nstast – number of single-particle states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_3b_op_in_3b_basis(lookup, operator)¶
for a 3-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 3-body operator
- Parameters:
lookup (dict(tuple(int,int,int): int)) – dictionary of three-body states where keys are tuples (p q r) of one-body states and values are the index of the corresponding three-body basis state
operator (list[list[int,int,int,int,int,int,float]]) – three-body operator as list of [p, q, r, s, u, v, value] where p, q, r, s u, v are one-body states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_1b_op_in_4b_basis(lookup, operator, nstat)¶
for a 4-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 1-body operator
- Parameters:
lookup (dict(tuple(int,int,int,int): int)) – dictionary of four-body states where keys are tuples (p q r s) of one-body states and values are the index of the corresponding four-body basis state
operator (list[list[int,int,float]]) – one-body operator as list of [p, q, value] where p, q are one-body states
nstast – number of single-particle states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_2b_op_in_4b_basis(lookup, operator, nstat)¶
for a 4-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 2-body operator
- Parameters:
lookup (dict(tuple(int,int,int,int): int)) – dictionary of four-body states where keys are tuples (p q r s) of one-body states and values are the index of the corresponding four-body basis state
operator (list[list[int,int,int,int,float]]) – two-body operator as list of [p, q, r, s, value] where p, q, r, s are one-body states
nstast – number of single-particle states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.fill_3b_op_in_4b_basis(lookup, operator, nstat)¶
for a 4-body system this function returns a list of matrix elements, a list of row indices, and a list of column indices of the 3-body operator
- Parameters:
lookup (dict(tuple(int,int,int,int): int)) – dictionary of four-body states where keys are tuples (p q r s) of one-body states and values are the index of the corresponding four-body basis state
operator (list[list[int,int,int,int,int,int,float]]) – three-body operator as list of [p, q, r, s, u, v, value] where p, q, r, s, u, v are one-body states
nstast – number of single-particle states
- Returns:
operator matrix elements as three lists op_dat, op_row, op_col
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.num_permutations(my_list)¶
returns the number of permutations needed to bring a list into order
- Parameters:
mylist (list[int]) – a list of integers
- Returns:
number of permutations needed to bring a list into order
- Return type:
int
- FCI.few_body_diagonalization.fill_shift_op(direc, lookup, myL, spin=2, isospin=2)¶
for a system defined via the lookup table this function returns a list of matrix elements, a list of row indices, and a list of column indices of the shift operator that moves the state by a single lattice unit into direction
- Parameters:
direc (int) – direction of the shift, must be 1, 2, or 3
lookup (dict(tuple(int,int,...): int)) – dictionary of few-body states where keys are tuples of one-body states and values are the index of the corresponding few-body basis state
myL (int) – number of lattcie sites in each dimension
spin (int) – number of spin components
isospin (int) – number of isospin components
- Returns:
a list of matrix elements, a list of row indices, and a list of column indices
- Return type:
list[float], list[int], list[int]
- FCI.few_body_diagonalization.get_csr_1b_op_in_2b_basis(lookup, operator, nstat)¶
returns a compressed sparse row ‘csr’ matrix of a 1-body operator into a 2-body basis
- Parameters:
lookup (dict(tuple(int,int): int)) – dictionary of two-body states where keys are tuples (p q) of one-body states and values are the index of the corresponding two-body basis state
operator (list[list[int,int,float]]) – one-body operator as list of [p, q, value] where p, q, are one-body states
nstast – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_2b_op_in_2b_basis(lookup, operator)¶
returns a compressed sparse row ‘csr’ matrix of a 2-body operator into a 2-body basis
- Parameters:
lookup (dict(tuple(int,int): int)) – dictionary of two-body states where keys are tuples (p q) of one-body states and values are the index of the corresponding two-body basis state
operator (list[list[int,int,int,int,float]]) – one-body operator as list of [p, q, r, s, value] where p, q, r, s are one-body states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_1b_op_in_3b_basis(lookup, operator, nstat)¶
returns a compressed sparse row ‘csr’ matrix of a 1-body operator into a 3-body basis
- Parameters:
lookup (dict(tuple(int,int,int): int)) – dictionary of three-body states where keys are tuples (p q r) of one-body states and values are the index of the corresponding three-body basis state
operator (list[list[int,int,float]]) – one-body operator as list of [p, q, value] where p, q, are one-body states
nstast – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_2b_op_in_3b_basis(lookup, operator, nstat)¶
returns a compressed sparse row ‘csr’ matrix of a 2-body operator into a 3-body basis
- Parameters:
lookup (dict(tuple(int,int,int): int)) – dictionary of three-body states where keys are tuples (p q r) of one-body states and values are the index of the corresponding three-body basis state
operator (list[list[int,int,int,int,float]]) – two-body operator as list of [p,q,r,s,value] where p,q,r,s are one-body states
nstast – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_3b_op_in_3b_basis(lookup, operator)¶
returns a compressed sparse row ‘csr’ matrix of a 3-body operator into a 3-body basis
- Parameters:
lookup (dict(tuple(int,int,int): int)) – dictionary of three-body states where keys are tuples (p q r) of one-body states and values are the index of the corresponding two-body basis state
operator (list[list[int,int,int,int,int,int,float]]) – one-body operator as list of [p,q,r,s,u,v, value] where p,q,r,s,u,v are one-body states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_1b_op_in_4b_basis(lookup, operator, nstat)¶
returns a compressed sparse row ‘csr’ matrix of a 1-body operator into a 4-body basis
- Parameters:
lookup (dict(tuple(int,int,int,int): int)) – dictionary of four-body states where keys are tuples (p q r s) of one-body states and values are the index of the corresponding four-body basis state
operator (list[list[int,int,float]]) – one-body operator as list of [p,q,value] where p,q are one-body states
nstast – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_2b_op_in_4b_basis(lookup, operator, nstat)¶
returns a compressed sparse row ‘csr’ matrix of a 2-body operator into a 4-body basis
- Parameters:
lookup (dict(tuple(int,int,int,int): int)) – dictionary of four-body states where keys are tuples (p q r s) of one-body states and values are the index of the corresponding four-body basis state
operator (list[list[int,int,int,int,float]]) – two-body operator as list of [p,q,r,s,value] where p,q,r,s are one-body states
nstast – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_csr_3b_op_in_4b_basis(lookup, operator, nstat)¶
returns a compressed sparse row ‘csr’ matrix of a 3-body operator into a 4-body basis
- Parameters:
lookup (dict(tuple(int,int,int,int): int)) – dictionary of four-body states where keys are tuples (p q r s) of one-body states and values are the index of the corresponding four-body basis state
operator (list[list[int,int,int,int,int,int,float]]) – two-body operator as list of [p,q,r,s,u,v,value] where p,q,r,s,u,v are one-body states
nstast – number of single-particle states
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.get_shift_op(direc, lookup, myL, spin=2, isospin=2)¶
returns a compressed sparse row ‘csr’ matrix of the shift operator into a few-body basis
- Parameters:
direc (int) – direction of the shift, must be 1, 2, or 3
lookup (dict(tuple(int,int,...): int)) – dictionary of few-body states where keys are tuples of one-body states and values are the index of the corresponding few-body basis state
myL (int) – number of lattcie sites in each dimension
spin (int) – number of spin components
isospin (int) – number of isospin components
- Returns:
csr matrix of the operator
- Return type:
scipy.sparse.csr_matrix
- FCI.few_body_diagonalization.csr_matrix_tolist_2body(op_csr, lookup2b)¶
converts a scipy.sparse.csr_matrix into a list of elements [p,q,r,s,value]
- Parameters:
op_csr (csr_matrix from scipy.sparse) – csr_matrix from scipy.sparse
lookup2b (dictionary with entries {(int,int): int}) – dictionary where keys are two-body state tuples (p,q) and values are indices
- Returns:
list [[p,q,r,s,value], ] of two-body matrix elements
- Return type:
list with elements [int,int,int,int, float]
- FCI.few_body_diagonalization.add_2body_ops(ops, my_basis, weights=None)¶
adds lists of sparse 2-body operators into a single sparse list
- Parameters:
ops ([[[int,int,int,int, float], ...], ...]) – list of lists [[p,q,r,s, val], …] of two-body operators
my_basis ([int,int,int,int,int]) – list with elements [x,y,z,tauz,sz] that are single-particle states
weights ([float,float,...]) – array of weights each operator in ops will be multiplied with
- Returns:
list [[p,q,r,s, val], …] of a single two-body operator
- Return type:
[[int,int,int,int, float], …]
- FCI.few_body_diagonalization.csr_matrix_tolist_3body(op_csr, lookup3b)¶
converts a scipy.sparse.csr_matrix into a list of elements [p,q,r,s,u,v,value]
- Parameters:
op_csr (csr_matrix from scipy.sparse) – csr_matrix from scipy.sparse
lookup3b (dictionary with entries {(int,int,int): int}) – dictionary where keys are two-body state tuples (p,q,r) and values are indices
- Returns:
list [[p,q,r,s,u,v, value], ] of two-body matrix elements
- Return type:
list with elements [int,int,int, int,int,int, float]
- FCI.few_body_diagonalization.add_3body_ops(ops, my_basis, weights=None)¶
adds lists of sparse 3-body operators into a single sparse list
- Parameters:
ops ([[[int,int,int,int,int,int, float], ...], ...]) – list of lists [[p,q,r,s,u,v, val], …] of three-body operators
my_basis ([int,int,int,int,int]) – list with elements [x,y,z,tauz,sz] that are single-particle states
weights ([float,float,...]) – array of weights each operator in ops will be multiplied with
- Returns:
list [[p,q,r,s,u,v, val], …] of a single three-body operator
- Return type:
[[int,int,int,int,int,int, float], …]