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: System

System 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_bitarrays or get_virtual_orbitals methods.

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_bitarrays method requires n_alpha and n_beta; n_electrons is not required but can be used to infer n_alpha or n_beta.

orbital_pg_symmetryarray_like, optional

Set of orbital point group symmetries. Required if using the generate_determinant_bitarrays or get_virtual_orbitals methods.

eigenvaluesarray_like, optional

Set of eigenvalues for the system.

Attributes

bitarrays

Array of bitarrays in the Hilbert space.

eigenvalues

System's single-particle eigenvalues.

excitation_matrix

An n_determinants-square matrix of excitations between i and j.

hamiltonian

The system's Hamiltonian.

input_file

Filename for loaded Hamiltonian.

is_complex

Whether or not the Hamiltonain is complex.

max_symmetry

Maximum point-group symmetry contained by the system.

n_alpha

Number of alpha electrons.

n_beta

Number of beta electrons.

n_determinants

Size of the Hilbert space.

n_electrons

Total number of electrons.

n_orbitals

Number of spin orbitals.

orbital_pg_symmetry

Orbital point-group symmetries.

orbitals

All orbital indexes.

pg_mask

Mask used for point-group operations.

ref_energy

Reference Hartree-Fock energy.

spin_polarizations

All possible spin polarization of the system(?).

Methods

generate_determinant_bitarrays()

Generate all determinants as bitarrays.

generate_excitation_matrix()

Generate the matrix of excitations.

get_bitarray_integers()

Integer representations of system bitarrays.

get_virtual_orbitals(occ)

Given an occupied orbital array, get information on virtual orbitals.

zero_hamiltonian()

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(?).