3.2.2. horton.correlatedwfn.perturbation – Perturbation theory module¶
- Variables used in this module:
nocc: number of occupied orbitals in the principle configuration nvirt: number of virtual orbitals in the principle configuration nbasis: total number of basis functions energy: the energy correction, list that can contain different contributions amplitudes: the optimized amplitudes, list that can contain different contributions - Indexing convention:
i,j,k,..: occupied orbitals of principle configuration a,b,c,..: virtual orbitals of principle configuration p,q,r,..: general indices (occupied, virtual)
-
class
horton.correlatedwfn.perturbation.Perturbation(lf, occ_model)¶ Bases:
objectArguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
__call__(*args, **kwargs)¶ Performs a perturbation theory calculation.
Arguments:
- one, two
- One- (TwoIndex) and two-body (FourIndex) integrals (some Hamiltonian matrix elements)
- args
- If Psi_0 = RHF, first argument is the MO coefficient matrix (Expansion instance), if Psi_0 = AP1roG, first argument is again the MO coefficient matrix the second argument is the geminal coefficient matrix (TwoIndex).
- Keywords:
- Contains reference energy and solver specific input parameters:
- eref: (float) reference energy (default float(‘nan’))
- ecore: (float) core energy (default float(‘nan’))
- threshold: (float) tolerance for amplitudes (default 1e-6)
- maxiter: (int) maximum number of iterations (default 200)
- guess: (np.array) initial guess (default None)
- indextrans: (str) 4-index transformation. One of
einsum, tensordot(defaulttensordot)
- indextrans: (str) 4-index transformation. One of
- Returns
- List of energy contributions (total energy, seniority-0, seniority-2, and seniority-4) and PT amplitudes (doubles)
-
__init__(lf, occ_model)¶ Arguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
calculate_energy(amplitudes, args)¶
-
clear()¶ Clear all wavefunction information
-
clear_aux_matrix()¶ Clear the auxiliary matrices
-
get_aux_matrix(select)¶ Get an auxiliary matrix.
Arguments:
- select
- Suffix of auxiliary matrix. See
RMP2.init_aux_matrix(),PTa.init_aux_matrix(), andPTb.init_aux_matrix()for possible choices
-
get_guess()¶
-
update_amplitudes(new)¶
-
update_energy(args)¶ Update PT energy
-
vfunction(coeffs, matrix)¶
-
amplitudes¶ The PT amplitudes
-
energy¶ The PT energy
-
lf¶ The linalg factory
-
nbasis¶ The number of basis functions
-
nocc¶ The number of occupied orbitals
-
nvirt¶ The number of virtual orbitals
-
class
horton.correlatedwfn.perturbation.RMP2(lf, occ_model)¶ Bases:
horton.correlatedwfn.perturbation.PerturbationArguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
__call__(*args, **kwargs)¶ Performs a perturbation theory calculation.
Arguments:
- one, two
- One- (TwoIndex) and two-body (FourIndex) integrals (some Hamiltonian matrix elements)
- args
- If Psi_0 = RHF, first argument is the MO coefficient matrix (Expansion instance), if Psi_0 = AP1roG, first argument is again the MO coefficient matrix the second argument is the geminal coefficient matrix (TwoIndex).
- Keywords:
- Contains reference energy and solver specific input parameters:
- eref: (float) reference energy (default float(‘nan’))
- ecore: (float) core energy (default float(‘nan’))
- threshold: (float) tolerance for amplitudes (default 1e-6)
- maxiter: (int) maximum number of iterations (default 200)
- guess: (np.array) initial guess (default None)
- indextrans: (str) 4-index transformation. One of
einsum, tensordot(defaulttensordot)
- indextrans: (str) 4-index transformation. One of
- Returns
- List of energy contributions (total energy, seniority-0, seniority-2, and seniority-4) and PT amplitudes (doubles)
-
__init__(lf, occ_model)¶ Arguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
calculate_amplitudes(*args, **kwargs)¶ Calculates MP2 amplitudes
Arguments:
- matrix
- Sliced 2-el MO integrals
-
calculate_aux_matrix(*args)¶ Compute auxiliary matrices
Arguments:
- args
- One- and two-electron integrals (some Hamiltonian matrix elements) in the MO basis.
-
calculate_energy(amplitudes, args)¶
-
calculate_ex_matrix(*args, **kwargs)¶ Calculates excitation matrix with elements (jbkc)
Arguments:
- mo2
- 2-el MO integrals
-
check_input(**kwargs)¶ Check input parameters
-
check_result(**kwargs)¶ Check if amplitudes are symmetric (within a given threshold).
-
clear()¶ Clear all wavefunction information
-
clear_aux_matrix()¶ Clear the auxiliary matrices
-
get_aux_matrix(select)¶ Get an auxiliary matrix.
Arguments:
- select
- Suffix of auxiliary matrix. See
RMP2.init_aux_matrix(),PTa.init_aux_matrix(), andPTb.init_aux_matrix()for possible choices
-
get_guess()¶
-
init_aux_matrix(select)¶ Initialize auxiliary matrices
Arguments:
- select
- One of ‘fock’
-
print_energy(**kwargs)¶
-
print_info(**kwargs)¶
-
solve(*args, **kwargs)¶ Solve for energy and amplitudes
Arguments:
- args
- Contains one- and two-electron integrals in the MO basis:
- [0]: wfn expansion coefficients
- [1]: 1-el MO integrals
- [2]: 2-el MO integrals
- Keywords
eref: reference energy threshold: threshold for symmetry check of MP2 amplitudes
-
update_amplitudes(new)¶ Update MP2 amplitudes
Arguments:
- new
- PT amplitudes. A FourIndex instance
-
update_aux_matrix(*args, **kwargs)¶ Derive all auxiliary matrices. fock_pp: one_pp + sum_m(2<pm|pm> - <pm|mp>),
Arguments:
- mo1, mo2
- one- and two-electron integrals.
-
update_energy(args)¶ Update PT energy
-
vfunction(coeffs, matrix)¶
-
amplitudes¶ The PT amplitudes
-
energy¶ The PT energy
-
lf¶ The linalg factory
-
nbasis¶ The number of basis functions
-
nocc¶ The number of occupied orbitals
-
nvirt¶ The number of virtual orbitals
-
class
horton.correlatedwfn.perturbation.PTa(lf, occ_model)¶ Bases:
horton.correlatedwfn.perturbation.PerturbationArguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
__call__(*args, **kwargs)¶ Performs a perturbation theory calculation.
Arguments:
- one, two
- One- (TwoIndex) and two-body (FourIndex) integrals (some Hamiltonian matrix elements)
- args
- If Psi_0 = RHF, first argument is the MO coefficient matrix (Expansion instance), if Psi_0 = AP1roG, first argument is again the MO coefficient matrix the second argument is the geminal coefficient matrix (TwoIndex).
- Keywords:
- Contains reference energy and solver specific input parameters:
- eref: (float) reference energy (default float(‘nan’))
- ecore: (float) core energy (default float(‘nan’))
- threshold: (float) tolerance for amplitudes (default 1e-6)
- maxiter: (int) maximum number of iterations (default 200)
- guess: (np.array) initial guess (default None)
- indextrans: (str) 4-index transformation. One of
einsum, tensordot(defaulttensordot)
- indextrans: (str) 4-index transformation. One of
- Returns
- List of energy contributions (total energy, seniority-0, seniority-2, and seniority-4) and PT amplitudes (doubles)
-
__init__(lf, occ_model)¶ Arguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
calculate_amplitudes(*args, **kwargs)¶ Calculate amplitudes
Arguments:
- matrix
- A FourIndex instance.
-
calculate_aux_matrix(*args)¶ Compute auxiliary matrices
Arguments:
- args
- List of arguements. Only geminal coefficients [1], one- [2] and two-body [3] integrals are used.
-
calculate_energy(amplitudes, *args)¶ Calculate PT energy and energy contribution of seniority sectors
Arguments:
- amplitudes
- PT amplitudes. A FourIndex instance
- args
- List containing the geminal coefficients, 1- and 2-el integrals, and auxiliary matrices
-
check_input(**kwargs)¶ Check input parameters.
-
check_result(**kwargs)¶ Check if amplitudes are reasonable.
-
clear()¶ Clear all wavefunction information
-
clear_aux_matrix()¶ Clear the auxiliary matrices
-
get_aux_matrix(select)¶ Get an auxiliary matrix.
Arguments:
- select
- Suffix of auxiliary matrix. See
RMP2.init_aux_matrix(),PTa.init_aux_matrix(), andPTb.init_aux_matrix()for possible choices
-
get_guess()¶
-
init_aux_matrix(select, dim=None, dim2=None)¶ Initialize auxiliary matrices
Arguments:
- select
- One of
fock,ocjbc,vcjkb,ocjkb,vcjbc,dcjb
Optional arguments:
- dim, dim2
- The dimension of the auxiliary matrices for specific axes.
-
print_energy(**kwargs)¶
-
print_info(**kwargs)¶
-
solve(*args, **kwargs)¶ Solve for energy and amplitudes
Arguments:
- args
- Contains geminal coefficients, 1- and 2-el integrals, and auxiliary matrices
- Keywords
eref: reference energy ecore: core energy threshold: threshold when checking symmetry of amplitudes
-
update_amplitudes(new)¶ Update cluster amplitudes
Arguments:
- new
- PT amplitudes. A FourIndex instance
-
update_aux_matrix(*args, **kwargs)¶ Derive all matrices. fock_pq: one_pq + sum_m(2<pm|qm> - <pm|mq>), oc_jbc: sum_m(<mm|bc> c_jm^bc), vc_jkb: sum_d(<dd|jk> c_jk^bd), vc_jbc: sum_d(<dd|bc> c_j^d), oc_jkb: sum_m(<mm|jk> c_m^b), dc_jb: sum_md(<mm|dd> c_jm^bd),
Arguments:
- mo1, mo2
- one- and two-electron integrals to be sorted.
- cia
- The geminal coefficients. A TwoIndex instance
-
update_energy(args)¶ Update PT energy
-
vfunction(coeffs, matrix)¶
-
vfunction_0(*args)¶ Elements of <bcjk|H|0>.
Arguments:
- args
All function arguments needed to calculate the vector function:
- [0]: wfn expansion coefficients
- [1]: geminal coefficients
- [2]: 1-el MO integrals
- [3]: 2-el MO integrals
- [4]: inactive Fock matrix
- [5]: ocjbc auxilary matrix
- [6]: vcjkb auxilary matrix
- [7]: vcjbc auxilary matrix
- [8]: ocjkb auxilary matrix
-
vfunction_psi0(*args, **kwargs)¶ Elements of <bcjk|H|AP1roG>.
Arguments:
- args
All function arguments needed to calculate the vector function:
- [0]: wfn expansion coefficients
- [1]: geminal coefficients
- [2]: 1-el MO integrals
- [3]: 2-el MO integrals
- [4]: inactive Fock matrix
- [5]: ocjbc auxilary matrix
- [6]: vcjkb auxilary matrix
- [7]: vcjbc auxilary matrix
- [8]: ocjkb auxilary matrix
- [9]: dcjb auxilary matrix
-
amplitudes¶ The PT amplitudes
-
energy¶ The PT energy
-
lf¶ The linalg factory
-
nbasis¶ The number of basis functions
-
nocc¶ The number of occupied orbitals
-
nvirt¶ The number of virtual orbitals
-
class
horton.correlatedwfn.perturbation.PTb(lf, occ_model)¶ Bases:
horton.correlatedwfn.perturbation.PerturbationArguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
__call__(*args, **kwargs)¶ Performs a perturbation theory calculation.
Arguments:
- one, two
- One- (TwoIndex) and two-body (FourIndex) integrals (some Hamiltonian matrix elements)
- args
- If Psi_0 = RHF, first argument is the MO coefficient matrix (Expansion instance), if Psi_0 = AP1roG, first argument is again the MO coefficient matrix the second argument is the geminal coefficient matrix (TwoIndex).
- Keywords:
- Contains reference energy and solver specific input parameters:
- eref: (float) reference energy (default float(‘nan’))
- ecore: (float) core energy (default float(‘nan’))
- threshold: (float) tolerance for amplitudes (default 1e-6)
- maxiter: (int) maximum number of iterations (default 200)
- guess: (np.array) initial guess (default None)
- indextrans: (str) 4-index transformation. One of
einsum, tensordot(defaulttensordot)
- indextrans: (str) 4-index transformation. One of
- Returns
- List of energy contributions (total energy, seniority-0, seniority-2, and seniority-4) and PT amplitudes (doubles)
-
__init__(lf, occ_model)¶ Arguments:
- lf
- A LinalgFactory instance.
- occ_model
- Aufbau model
Optional arguments:
-
calculate_aux_matrix(*args)¶ Compute auxiliary matrices
Arguments:
- mo1, mo2
- One- and two-electron integrals (some Hamiltonian matrix elements) in the MO basis.
- args
- List of arguements. Only geminal coefficients are used.
-
calculate_energy(amplitudes, *args)¶ Calculate PT energy and energy contribution of seniority sectors
Arguments:
- amplitudes
- PT amplitudes. A FourIndex instance
- args
- List containing the geminal coefficients, 1- and 2-el integrals, and auxiliary matrices
-
check_input(**kwargs)¶ Check input parameters.
-
check_result(**kwargs)¶ Check if amplitudes are reasonable.
-
clear()¶ Clear all wavefunction information
-
clear_aux_matrix()¶ Clear the auxiliary matrices
-
get_aux_matrix(select)¶ Get an auxiliary matrix.
Arguments:
- select
- Suffix of auxiliary matrix. See
RMP2.init_aux_matrix(),PTa.init_aux_matrix(), andPTb.init_aux_matrix()for possible choices
-
get_guess()¶ Generate initial guess for amplitudes
-
init_aux_matrix(select, dim=None, dim2=None)¶ Initialize auxiliary matrices
Arguments:
- select
- One of
fock,ocjbc,vcjkb,ocjkb,vcjbc,dcjb
Optional arguments:
- dim, dim2
- The dimension of the auxiliary matrices for specific axes.
-
print_energy(**kwargs)¶
-
print_info(**kwargs)¶
-
solve(*args, **kwargs)¶ Solve for energy and amplitudes
Arguments:
- args
- Contains geminal coefficients, 1- and 2-el integrals, and auxiliary matrices
- Keywords
eref: reference energy ecore: core energy threshold: threshold when checking symmetry of amplitudes guess: initial guess
For more details, see
Pertubation.__call__()
-
update_amplitudes(new)¶ Update cluster amplitudes
Arguments:
- new
- PT amplitudes. A FourIndex instance
-
update_aux_matrix(*args, **kwargs)¶ Derive all matrices. fock_pq: one_pq + sum_m(2<pm|qm> - <pm|mq>), oc_jbc: sum_m(<mm|bc> c_jm^bc), vc_jkb: sum_d(<dd|jk> c_jk^bd), vc_jbc: sum_d(<dd|bc> c_j^d), oc_jkb: sum_m(<mm|jk> c_m^b), dc_jb: sum_md(<mm|dd> c_jm^bd),
Arguments:
- mo1, mo2
- one- and two-electron integrals to be sorted.
- cia
- The geminal coefficients. A TwoIndex instance
-
update_energy(args)¶ Update PT energy
-
vfunction(*args, **kwargs)¶ .
Arguments:
- amplitudes
- Cluster amplitudes. Need to be determined.
- args
All function arguments needed to calculated the vector function:
- [0]: wfn expansion coefficients
- [1]: geminal coefficients
- [2]: 1-el MO integrals
- [3]: 2-el MO integrals
- [4]: inactive Fock matrix
- [5]: ocjbc auxilary matrix
- [6]: vcjkb auxilary matrix
- [7]: vcjbc auxilary matrix
- [8]: ocjkb auxilary matrix
- [9]: dcjb auxilary matrix
- [10]: eref-ecore
-
vfunction_psi0(*args, **kwargs)¶ Elements of <bcjk|H|AP1roG>.
Arguments:
- args
All function arguments needed to calculate the vector function:
- [0]: wfn expansion coefficients
- [1]: geminal coefficients
- [2]: 1-el MO integrals
- [3]: 2-el MO integrals
- [4]: inactive Fock matrix
- [5]: ocjbc auxilary matrix
- [6]: vcjkb auxilary matrix
- [7]: vcjbc auxilary matrix
- [8]: ocjkb auxilary matrix
- [9]: dcjb auxilary matrix
- [10]: eref-ecore
-
amplitudes¶ The PT amplitudes
-
energy¶ The PT energy
-
lf¶ The linalg factory
-
nbasis¶ The number of basis functions
-
nocc¶ The number of occupied orbitals
-
nvirt¶ The number of virtual orbitals