hamil¶
Base classes and functions for generating and interacting with Hamiltonian matrices.
-
class
hamil.
Hamiltonian
(sys, basis, tau=0.1)¶ Base Hamiltonian class.
The relevant subclass which provides the appropriate matrix elements should be used.
Parameters: - sys – object describing system to be studied; used only in the virtual matrix element functions
- basis (iterable of iterables of single-particle basis functions) – set of many-particle basis functions
- tau (float) – timestep by which to propogate psip distributions in imaginary time
Note
This is a base class; basis and sys must be appropriate to the actual subclass used and are specific to the required system and underlying many-particle basis set.
-
sys
= None¶ system to be studied
-
basis
= None¶ set of many-particle basis functions
-
nbasis
= None¶ number of many-particle basis functions (i.e. length basis)
-
hamil
= None¶ Hamiltonian matrix in the basis set of the many-particle basis functions
-
tau
= None¶ timestep by which to propogate psip distributions in imaginary time
-
pos_propogator
= None¶ positive propogator matrix, \(T^+\) where \(T = 1 - \tau H = T^+ - T^-\) and \(T^+\) elements are non-negative.
-
neg_propogator
= None¶ negative propogator matrix, \(T^-\) where \(T = 1 - \tau H = T^+ - T^-\) and \(T^-\) elements are non-negative.
-
mat_fn_diag
(b)¶ Calculate a diagonal Hamiltonian matrix element.
Warning
Virtual member. Must be appropriately implemented in a subclass.
Parameters: b (iterable of single-particle basis functions) – a many-particle basis function, \(|b\rangle\) Return type: float Returns: \(\langle b|H|b \rangle\).
-
mat_fn_offdiag
(b1, b2)¶ Calculate an off-diagonal Hamiltonian matrix element.
Warning
Virtual member. Must be appropriately implemented in a subclass.
Parameters: - b1 (iterable of single-particle basis functions) – a many-particle basis function, \(|b_1\rangle\)
- b2 (iterable of single-particle basis functions) – a many-particle basis function, \(|b_2\rangle\)
Return type: float
Returns: \(\langle b_1|H|b_2 \rangle\).
-
eigh
()¶ Returns: (eigenvalues, eigenvectors) of the Hamiltonian matrix.
-
eigvalsh
()¶ Returns: eigenvalues of the Hamiltonian matrix.
-
negabs_off_diagonal_elements
()¶ Set off-diagonal elements of the Hamiltonian matrix to be negative.
This converts the Hamiltonian into the lesser sign-problem matrix discussed by Spencer, Blunt and Foulkes.
-
negabs_diagonal_elements
()¶ Set diagonal elements of the Hamiltonian matrix to be negative.
This, when called after negabs_offdiagonal_elements, converts the Hamiltonian into the greater sign-problem matrix discussed by Spencer, Blunt and Foulkes.
-
propogate
(pos_psips, neg_psips)¶ Propogates a psip (psi-particle) distribution for a single timestep.
Parameters: - pos_psips (1D array or list (length nbasis)) – distribution of positive psips at time \(t = n\tau\) on the many-fermion basis set.
- neg_psips (1D array or list (length nbasis)) – distribution of negative psips at time \(t = n\tau\) on the many-fermion basis set.
Returns: (next_pos_psips, next_neg_psips) — positive and negative psip distributions at time \(t=(n+1)\tau\).
-
hamil.
hartree_excitation
(p1, p2)¶ Find the excitation connecting two Hartree products.
Parameters: - p1 (iterable of single-particle basis functions) – a Hartree product basis function
- p2 (iterable of single-particle basis functions) – a many-particle basis function
Returns: (from_1, to_1) where:
- from_1
list of single-particle basis functions excited from p1
- to_2
list of single-particle basis functions excited into p2
-
hamil.
determinant_excitation
(d1, d2)¶ Find the excitation connecting two Slater determinants.
Parameters: - p1 (iterable of single-particle basis functions) – a Slater determinant basis function
- p2 (iterable of single-particle basis functions) – a Slater determinant basis function
Returns: (from_1, to_1, nperm) where:
- from_1
list of single-particle basis functions excited from d1
- to_2
list of single-particle basis functions excited into d2
- nperm
number of permutations required to align the two determinants such that the orders of single-particle basis functions are in maximum agreement. This, in general, is not the minimal possible number of permutations but the parity of the permutations, which is all that is required for calculating matrix elements, is correct.
-
hamil.
permanent_excitation
(p1, p2)¶ Find the excitation connecting two permanents.
Parameters: - p1 (iterable of single-particle basis functions) – a permanent basis function
- p2 (iterable of single-particle basis functions) – a permanent basis function
Returns: (from_1, to_1) where:
- from_1
list of single-particle basis functions excited from p1
- to_2
list of single-particle basis functions excited into p2