Matrix Hamiltonian
- class pydmqmc.systems.MatrixHamiltonian(input_file, is_complex=False, n_orbitals=None, n_electrons=None, n_alpha=None, n_beta=None, orbital_pg_symmetry=None, eigenvalues=None)
Bases:
SystemSystem defined by a Hamiltonian matrix written to file.
Use this class for systems defined by a triangular Hamiltonian matrix output by HANDE. The Hamiltonian will be stored as a 2D NumPy array. The reference energy is assumed to be element [0,0] of the matrix.
- Parameters:
- input_filestr
Filename for the Hamiltonian.
- is_complexbool, default False
Whether or not the Hamiltonian is complex.
- n_orbitalsint, optional
Number of orbitals in the system. Required if using the
generate_determinant_bitarraysorget_virtual_orbitalsmethods.- n_electrons, n_alpha, n_betaint, optional
Number of total, alpha, and beta electrons. All three or any two may be supplied, as \(\texttt{n_electrons} = \texttt{n_alpha} + \texttt{n_beta}\). The
generate_determinant_bitarraysmethod requiresn_alphaandn_beta;n_electronsis not required but can be used to infern_alphaorn_beta.- orbital_pg_symmetryarray_like, optional
Set of orbital point group symmetries. Required if using the
generate_determinant_bitarraysorget_virtual_orbitalsmethods.- eigenvaluesarray_like, optional
Set of eigenvalues for the system.
Attributes
Array of bitarrays in the Hilbert space.
System's single-particle eigenvalues.
An n_determinants-square matrix of excitations between i and j.
The system's Hamiltonian.
Filename for loaded Hamiltonian.
Whether or not the Hamiltonain is complex.
Maximum point-group symmetry contained by the system.
Number of alpha electrons.
Number of beta electrons.
Size of the Hilbert space.
Total number of electrons.
Number of spin orbitals.
Orbital point-group symmetries.
All orbital indexes.
Mask used for point-group operations.
Reference Hartree-Fock energy.
All possible spin polarization of the system(?).
Methods
Generate all determinants as bitarrays.
Generate the matrix of excitations.
Integer representations of system bitarrays.
get_virtual_orbitals(occ)Given an occupied orbital array, get information on virtual orbitals.
Subtract the Hartree-Fock energy from the Hamiltonian.
Warning
Support for complex Hamiltonians is not yet implemented. Setting is_complex = True will raise NotImplementedError.
- generate_determinant_bitarrays()
Generate all determinants as bitarrays.
This function sets the n_determinants and bitarrays members. All determinints spanned by the system within the point-group symmetry will be generated.
A reference bitarry is first generated separately for each of the spin channels. Next, all unqiue combinations of 1’s & 0’s are generated for that reference. Finally, all the unique concatenations of the alpha & beta bitarrays are iterated over, checking that the point group symmetry of the concatenated bitarray falls within the system’s possible point groups. If the concatenated bitarray has an allowed point group symmetry, that determinant is stored.
Warning
This function will only have an effect the first time it is run. If members n_determinants and bitarrays are not None, this function will return without making any changes.
Notes
A bitarray is shorthand for an array of 1’s and 0’s. More traditionally referred to as “bitstrings,” these are used to represent Slater determinants. 1’s represent an occupied orbital and 0 an unoccupied orbital.
This function was originally called generate_bit_arrays and supported the use_symmetry_block boolean, which controls whether to use the symmetry reduced point group Hamiltonian (True) or whether the entire Hamiltonian containing all those point-group symmetries spanned by the system will be generated (False). Since in practice this parameter was always True and this function does not control Hamiltonian generation, this parameter has been removed from the function call and hardcoded to True within the function body.
- generate_excitation_matrix()
Generate the matrix of excitations.
Sets the excitation_matrix member. Each matrix index i, j represents the transition between bitarrays i and j. This function will also generate the system determinants if they have not already been generated, thereby setting n_determinants and bitarrays.
Warning
This function will only have an effect the first time it is run. If the excitation_matrix member is not None, this function will return without making any changes.
- get_bitarray_integers()
Integer representations of system bitarrays.
- get_virtual_orbitals(occ)
Given an occupied orbital array, get information on virtual orbitals.
- Parameters:
- occarray_like
The occupied orbitals for the current determinant.
- Returns:
- unoccArray
The unoccupied orbital indexes in the current determinant.
- virt_msArray
The corresponding spins of unocc.
- virt_symArray
The corresponding symmetries of unocc.
- nvirtArray
The number of unoccupied orbitals in each spin-symmetry as indexed by spin and symmetry.
Warning
There is a always an empty array corresponding to a spin of \(ms = 0\).
- zero_hamiltonian()
Subtract the Hartree-Fock energy from the Hamiltonian.
This will overwrite the existing Hamiltonian with the shifted version.
- property bitarrays
Array of bitarrays in the Hilbert space.
- property eigenvalues
System’s single-particle eigenvalues.
- property excitation_matrix
An n_determinants-square matrix of excitations between i and j.
- property hamiltonian
The system’s Hamiltonian.
- property input_file
Filename for loaded Hamiltonian.
- property is_complex
Whether or not the Hamiltonain is complex.
- property max_symmetry
Maximum point-group symmetry contained by the system.
- property n_alpha
Number of alpha electrons.
- property n_beta
Number of beta electrons.
- property n_determinants
Size of the Hilbert space.
- property n_electrons
Total number of electrons.
- property n_orbitals
Number of spin orbitals.
- property orbital_pg_symmetry
Orbital point-group symmetries.
- property orbitals
All orbital indexes.
- property pg_mask
Mask used for point-group operations.
- property ref_energy
Reference Hartree-Fock energy.
- property spin_polarizations
All possible spin polarization of the system(?).