2.3.1.1.2. moha.posthf.ci package

2.3.1.1.2.1. Submodules

2.3.1.1.2.2. moha.posthf.ci.ci_basis_set module

class moha.posthf.ci.ci_basis_set.CIBasisSet[source]

Bases: list

Configuration interaction basis set.

reference

Reference Slater Determinant.

truncationint

Maxium excitation level.

__init__(self)

Initialize the instance.

append(self,basis)

Append one basis to the basis set.

assign_truncation(self,truncation)

Assign truncation.

generate_basis_set(self,truncation)

Generate N electron basis set.

generate_annihilation_creation(self,degree)

Generate a list of annihilation and creation.

apply_annihilation_creation(self,ac_list)

Apply annihilation and creation to the self Slater determinant.

add_excitation(reference, nexc)[source]

Add excitation state.

referenceSlaterDeterminant

Reference configuration.

nexcint

Number of excitation electrons.

TypeError

If reference is not a SlaterDeterminant instance.

TypeError

If nexc is not int.

append(basis)[source]

Add one basis to the basis set.

basis

Basis instance.

TypeError

If orb is not a SlaterDeterminant instance.

apply_annihilation_creation(reference, ac)[source]

Apply annihilation and creation to the self Slater determinant.

acdict

A dictionary of annihilation and creation.

TypeError

If ac is not a dictionary.

configuraitondict

New configuration for the self Slater determinant.

classmethod build(reference, truncation)[source]

Generate CI basis set.

truncationint

Truncation number.

TypeError

If truncation is not a list.

generate_annihilation_creation(reference, degree)[source]

Generate a list of annihilation and creation.

degreeint

Truncation level.

TypeError

If parameter degree is not an int.

ValueError

If parameter degree is not a none negative number.

ac_listlist

A list of annihilation and creation.

property size

Size of the CI basis set.

2.3.1.1.2.3. moha.posthf.ci.ci_operator module

class moha.posthf.ci.ci_operator.CIOperator(integral, name)[source]

Bases: moha.system.operator.base.BaseOperator

Configuration interaction Operator.

__new__(self, integral)

Generate new CI Operator.

__init__(self, integral)

Initialize the CI Operator.

build(cls, h1e, g2e, basis_set)

Build the CI Operator.

classmethod build(h1e, g2e, basis_set)[source]

Build the configuration interaction Operator.

h1enp.ndarray

One electron integral.

g2enp.ndarray

Two electron integral.

basis_set

Configuration interaction basis set.

TypeError

If basis_set is not a CIBasisSet instance.

hamCIOperator

Instance of CIOperator.

2.3.1.1.2.4. moha.posthf.ci.ci_wavefunction module

class moha.posthf.ci.ci_wavefunction.CIWaveFunction(nelec, nspatial, occ={}, basis_set=None, coefficients=None)[source]

Bases: moha.system.wavefunction.base.BaseWaveFunction

Configuration interaction wavefunction class.

nelecint

Number of electrons.

occdict

Occupation number of the wavefunction.

nspatialint

Number of spatial orbitals.

basis_setBasis

Basis set of the wavefunction.

coefficientsnp.ndarray

Coefficientss of the wavefunction.

ncoefficientsint

Number of coefficients.

nspinint

Number of spin orbital

spinint

Spin of the wavefunction

seniority: int

Seniority of the wavefunction

__init__(self, nelec, nspatial, basis_set=None, coefficients=None)

Initialize the wavefunction.

assign_nelec(self, nelec)

Assign the number of electrons.

assign_nspatial(self, nspatial)

Assign the number of spatial orbitals.

assign_occ(self, occ)

Assign the occupation number of the wavefunction.

assign_basis_set(self, basis_set)

Assign basis set of the wavefunction.

assign_coefficients(self, coefficients)

Assign coefficients of the wavefunction.

assign_basis_set(basis_set)[source]

Assign the basis_set of the wavefunction.

basis_set

Basis set of the wavefunction.

TypeError

If basis set is not a CIBasisSet instance.

assign_coefficients(coefficients)[source]

Assign the coefficients of the wavefunction.

coefficients

Parameters of the wavefunction.

TypeError

If coefficients is not a np.ndarray.

property configuration

Return the cofiguration of the wavefunction.

cdict

Configuration of the wavefunction.

property ncoefficients

Return the number of wavefunction coefficients.

ncoefficientsint

Number of coefficients.

TypeError

If coefficients is not a np.ndarray instance.

property seniority

Return the seniority of the wavefunction.

Seniority of a Slater determinant is its number of unpaired electrons. The seniority of the wavefunction is the expected number of unpaired electrons.

seniorityint

Seniority of the wavefunction.

None means that all possible seniority are allowed.

2.3.1.1.2.5. moha.posthf.ci.cis module

class moha.posthf.ci.cis.CISSolver(ham, wfn, hf_results)[source]

Bases: object

Configuration Interaction Singles Wavefunction.

CI with HF Ground state and all single and double excitations

ham

Chemical Hamiltonian.

wfn

Hartree Fock wavefunction.

hf_resultsdict

Hartree Fock calculation results.

__init__(self,ham,wfn,hf_results)

Initialize the solver.

kernel(self)

Kernel of the solver.

assign_hamiltonian(self,ham)

Assign the chemical Hamiltonian to the solver.

assign_wavefunction(self,wfn)

Assign the Hartree Fock wavefunction to the solver.

assign_hartree_fock_results(self,hf_results)

Assign the Hartree Fock calculation results to the solver.

assign_hamiltonian(ham)[source]

Assign the chemical Hamiltonian to the solver.

ham

Chemical Hamiltonian.

assign_hartree_fock_results(hf_results)[source]

Assign the Hartree Fock calculation results to the solver.

hf_resultsdict

Hartree Fock calculation results.

TypeError

If Hartree Fock calculation results is not a dictionary.

assign_wavefunction(wfn)[source]

Assign the Hartree Fock wavefunction to the solver.

wfn

Hartree Fock wavefunction.

kernel()[source]

Kernel of the solver.

resultsdict

CIS calculation results.

2.3.1.1.2.6. moha.posthf.ci.cisd module

class moha.posthf.ci.cisd.CISDSolver(ham, wfn, hf_results)[source]

Bases: object

Configuration Interaction Singles and Doubles Wavefunction.

CI with HF Ground state and all single and double excitations

ham

Chemical Hamiltonian.

wfn

Hartree Fock wavefunction.

hf_resultsdict

Hartree Fock calculation results.

__init__(self,ham,wfn,hf_results)

Initialize the solver.

kernel(self)

Kernel of the solver.

assign_hamiltonian(self,ham)

Assign the chemical Hamiltonian to the solver.

assign_wavefunction(self,wfn)

Assign the Hartree Fock wavefunction to the solver.

assign_hartree_fock_results(self,hf_results)

Assign the Hartree Fock calculation results to the solver.

assign_hamiltonian(ham)[source]

Assign the chemical Hamiltonian to the solver.

ham

Chemical Hamiltonian.

assign_hartree_fock_results(hf_results)[source]

Assign the Hartree Fock calculation results to the solver.

hf_resultsdict

Hartree Fock calculation results.

TypeError

If Hartree Fock calculation results is not a dictionary.

assign_wavefunction(wfn)[source]

Assign the Hartree Fock wavefunction to the solver.

wfn

Hartree Fock wavefunction.

kernel()[source]

Kernel of the solver.

resultsdict

CISD calculation results.

2.3.1.1.2.7. moha.posthf.ci.fci module

class moha.posthf.ci.fci.FullCISolver(ham, wfn, hf_results)[source]

Bases: object

Full Configuration Interaction Wavefunction.

CI with HF Ground state and all single and double excitations

ham

Chemical Hamiltonian.

wfn

Hartree Fock wavefunction.

hf_resultsdict

Hartree Fock calculation results.

__init__(self,ham,wfn,hf_results)

Initialize the solver.

kernel(self)

Kernel of the solver.

assign_hamiltonian(self,ham)

Assign the chemical Hamiltonian to the solver.

assign_wavefunction(self,wfn)

Assign the Hartree Fock wavefunction to the solver.

assign_hartree_fock_results(self,hf_results)

Assign the Hartree Fock calculation results to the solver.

assign_hamiltonian(ham)[source]

Assign the chemical Hamiltonian to the solver.

ham

Chemical Hamiltonian.

assign_hartree_fock_results(hf_results)[source]

Assign the Hartree Fock calculation results to the solver.

hf_resultsdict

Hartree Fock calculation results.

TypeError

If Hartree Fock calculation results is not a dictionary.

assign_wavefunction(wfn)[source]

Assign the Hartree Fock wavefunction to the solver.

wfn

Hartree Fock wavefunction.

kernel()[source]

Kernel of the solver.

resultsdict

Full CI calculation results.

2.3.1.1.2.8. moha.posthf.ci.slater module

class moha.posthf.ci.slater.SlaterCondon(h1e, g2e)[source]

Bases: object

The rules which allow us to express matrix elements Hij in terms of one and two electron integrals.

h1enp.ndarray

One electron integral.

g2enp.ndarray

Two electron integral.

__init__(self, h1e, g2e)

Initialize the instance.

calculate_matrix_element(self,det1,det2)

Calculate matrix element between two determinants.

identical(self,det)

Calculate matrix element whose configurations are identical.

differ_by1(self,det1,det2):

Calculate matrix element whose configuration differ by 1 spin orbitals.

difer_byf2(self,det1,det2):

Calculate matrix element whose configuration differ by 2 spin orbitals.

calculate_matrix_element(sd1, sd2)[source]

Calculate matrix element between two determinants.

sd1SlaterDeterminant

The first SlaterDeterminant instance.

sd2SlaterDeterminant

The second SlaterDeterminant instance.

TypeError

If sd1 is not SlaterDeterminant instance. If sd2 is not SlaterDeterminant instance.

valuefloat

The integral value of CI Hamiltonian.

differ_by1(sd1, sd2)[source]

Calculate matrix element whose configuration differ by 1 spin orbitals.

sd1

A SlaterDeterminant instance.

sd2

A SlaterDeterminant instance.

TypeError

If sd1 is not SlaterDeterminant instance. If sd2 is not SlaterDeterminant instance.

valuefloat

The integral value of CI Hamiltonian.

differ_by2(sd1, sd2)[source]

Calculate matrix element whose configuration differ by 2 spin orbitals.

sd1

First SlaterDeterminant instance.

sd2

Second SlaterDeterminant instance.

TypeError

If sd1 is not SlaterDeterminant instance. If sd2 is not SlaterDeterminant instance.

valuefloat

The integral value of CI Hamiltonian.

identical(sd)[source]

Calculate matrix element whose configurations are identical.

sdSlaterDeterminant

A SlaterDeterminant instance.

TypeError

If sd is not SlaterDeterminant instance.

valuefloat

The integral value of CI Hamiltonian.

class moha.posthf.ci.slater.SlaterDeterminant(configuration)[source]

Bases: list

Slater Determinant Basis.

selflist

Binary representation of the determinant in spin orbitals. odd indices for alpha spin orbitals. even indices for beta spin orbitals. 0 for unoccupied spin orbital. 1 for occupied spin orbital.

nspatialsint

Number of spatial orbitals.

nspinsint

Number of spin orbitals.

nalphasint

Number of alpha spin electrons.

nbetasint

Number of beta spin electrons.

nelectrons :

Number of total electrons.

alphalist

Configuraiton of alpha spin orbitals.

betalist

Configuraiton of beta spin orbitals.

occ_indiceslist

Occupation indices of the spin orbitals.

spatial_formatlist

Representation of the Slater determinants in spatial orbitals.

__init__(self,configuration)

Initialize the instance.

assign_configuration(self,configuration)

Assign configuration to the Slater determinant.

degree_of_excitation(self,other)

Compute the degree of excitation between D1 and D2.

annihilation_list(self,other)

Identifying the annihilated spin orbitals.

creation_list(self,other)

Identifying the created spin orbitals.

phase(self,other)

The phase is calculated as −1^{Nperm}.This number is equal to the number of occupied spin-orbitals between these two positions.

annihilation_list(other)[source]

Identifying the annihilated alpha spin orbitals.

detSlaterDeterminant

The second Slater determinant instance.

TypeError

If det is not a SlaterDeterminant instance.

indexdict

Index of annihilation alpha spin.

assign_configuration(configuration)[source]

Assign configuration to the Slater determinant.

configurationlist

Binary representation of the Slater determinant.

TypeError

If configuration is not list.

ValueError

If configuration is not list.

creation_list(other)[source]

Identifying the created alpha spin orbitals.

detSlaterDeterminant

The second Slater determinant instance.

TypeError

If det is not a SlaterDeterminant instance.

indexdict

Index of creation alpha spin.

degree_of_excitation(other)[source]

Compute the degree of excitation between D1 and D2 for alpha spin.

detSlaterDeterminant

The second Slater determinant instance.

TypeError

If det is not a SlaterDeterminant instance.

degreeint

Degree of alpha spin excitation between two Slater determinant.

classmethod ground(nocc, nspins)[source]

Create a ground state Slater determinant. If the number of electrons is odd, then the last electron is put into an alpha orbital.

noccint

Number of occupied spin orbitals.

norbsint

Total number of spin orbitals.

ground_sdgmpy2.mpz

Integer that describes the occupation of a Slater determinant as a bitstring.

ValueError

If nocc > nspins.

Assumes that the spin-orbitals are ordered by energy from lowest to greatest. The occupation is assumed to have the alpha block frist, then the beta block.

phase(other)[source]

The phase is calculated as −1^{Nperm}.This number is equal to the number of occupied spin-orbitals between these two positions.

otherSlaterDeterminant

The second Slater determinant instance.

TypeError

If det is not a SlaterDeterminant instance.

signint

Phase for the evaluation between two Slater determinant.

property alpha

Configuraiton of alpha spin orbitals.

alphalist

Configuraiton of alpha spin orbitals.

property beta

Configuraiton of beta spin orbitals.

betalist

Configuraiton of beta spin orbitals.

property nalphas

Number of alpha spin electrons.

property nbetas

Number of beta spin electrons.

property nelectrons

Number of total electrons.

property nspatials

Number of spatial orbitals.

property nspins

Number of spin orbitals.

property occ_indices

Indices of occupied spin orbitals.

indiceslist

Indices of occupied spin orbitals.

property spatial_format
Representation of the Slater determinants in spatial orbitals.

[0,0,0,2,1,3,3,3] 0 for unoccupied orbital 1 for occupied alpha spin orbital 2 for occupied beta spin orbital 3 for doubly occupied orbital

spatial_formatlist

Representation of the Slater determinants in spatial orbitals.

property spin_format

Representation of the Slater determinants in spin orbitals.

spin_formatlist

Representation of the Slater determinants in spin orbitals.

property vir_indices

Indices of virtual spin orbitals.

vir_indiceslist

Indices of virtual spin orbitals.

2.3.1.1.2.9. Module contents