qmctorch.wavefunction.pooling.slater_pooling module
- class qmctorch.wavefunction.pooling.slater_pooling.SlaterPooling(*args: Any, **kwargs: Any)[source]
Bases:
Module
Computes the Sater determinants
- Parameters:
- forward(input)[source]
Computes the values of the determinats
- Parameters:
input (torch.tensor) – MO matrices nbatch x nelec x nmo
- Returns:
slater determinants
- Return type:
torch.tensor
- get_slater_matrices(input)[source]
Computes the slater matrices
- Parameters:
input (torch.tensor) – MO matrices nbatch x nelec x nmo
- Returns:
slater matrices of spin up/down
- Return type:
(torch.tensor, torch.tensor)
- det_explicit(input)[source]
Computes the values of the determinants from the slater matrices
- Parameters:
input (torch.tensor) – MO matrices nbatch x nelec x nmo
- Returns:
slater determinants
- Return type:
torch.tensor
- det_single_double(input)[source]
Computes the determinant of ground state + single + double
- Parameters:
input (torch.tensor) – MO matrices nbatch x nelec x nmo
- Returns:
slater determinants
- Return type:
torch.tensor
- det_ground_state(input)[source]
Computes the SD of the ground state
- Parameters:
input (torch.tensor) – MO matrices nbatch x nelec x nmo
- det_unique_single_double(input)[source]
Computes the SD of single/double excitations
The determinants of the single excitations are calculated from the ground state determinant and the ground state Slater matrices whith one column modified. See : Monte Carlo Methods in ab initio quantum chemistry B.L. Hammond, appendix B1
Note : if the state on coonfigs are specified in order we end up with excitations that comes from a deep orbital, the resulting slater matrix has one column changed (with the new orbital) and several permutation. We therefore need to multiply the slater determinant by (-1)^nperm.
\[MO = [ A | B ] det(Exc_{ij}) = (det(A) * A^{-1} * B)_{i,j}\]- Parameters:
input (torch.tensor) – MO matrices nbatch x nelec x nmo
- operator(mo, bop, op=<built-in function add>, op_squared=False)[source]
Computes the values of an opearator applied to the procuts of determinant
- Parameters:
mo (torch.tensor) – matrix of MO vals(Nbatch, Nelec, Nmo)
bkin (torch.tensor) – kinetic operator (Nbatch, Nelec, Nmo)
op (operator) – how to combine the up/down contribution
op_squared (bool, optional) –
- Returns:
kinetic energy
- Return type:
torch.tensor
- operator_ground_state(mo, bop, op_squared=False)[source]
Computes the values of any operator on gs only
- Parameters:
mo (torch.tensor) – matrix of molecular orbitals
bkin (torch.tensor) – matrix of kinetic operator
op_squared (bool, optional) –
- Returns:
operator values
- Return type:
torch.tensor
- operator_explicit(mo, bkin, op_squared=False)[source]
- Computes the value of any operator using the trace trick for a product
of spin up/down determinant.
\[\begin{split}-\\frac{1}{2} \Delta \Psi = -\\frac{1}{2} D_{up} D_{down} ( \Delta_{up} D_{up} / D_{up} + \Delta_{down} D_{down} / D_{down} )\end{split}\]- Parameters:
mo (torch.tensor) – matrix of MO vals(Nbatch, Nelec, Nmo)
bkin (torch.tensor) – kinetic operator (Nbatch, Nelec, Nmo)
op_squared (bool, optional) –
- Returns:
kinetic energy
- Return type:
torch.tensor
- operator_single_double(mo, bop, op_squared=False)[source]
Computes the value of any operator on gs + single + double
- Parameters:
mo (torch.tensor) – matrix of molecular orbitals
bkin (torch.tensor) – matrix of kinetic operator
op_squared (bool, optional) –
- Returns:
kinetic energy values
- Return type:
torch.tensor
- operator_unique_single_double(mo, bop, op_squared)[source]
Compute the operator value of the unique single/double conformation
- static op_single(baseterm, mat_exc, M, index, nbatch)[source]
Computes the operator values for single excitation
\[Tr( \bar{A}^{-1} \bar{B}) = Tr(A^{-1} B) + Tr( T M ) T = P ( A^{-1} \bar{A})^{-1} P M = A^{-1}\bar{B} - A^{-1}BA^{-1}\bar{A}\]- Parameters:
baseterm (torch.tensor) – trace(A B)
mat_exc (torch.tensor) – invA @ Abar
M (torch.tensor) – invA Bbar - inv A B inv A Abar
index (List) – list of index of the excitations
nbatch – batch size
- static op_multiexcitation(baseterm, mat_exc, M, index, size, nbatch)[source]
Computes the operator values for single excitation
\[Tr( \bar{A}^{-1} \bar{B}) = Tr(A^{-1} B) + Tr( T M ) T = P ( A^{-1} \bar{A})^{-1} P M = A^{-1}\bar{B} - A^{-1}BA^{-1}\bar{A}\]- Parameters:
baseterm (torch.tensor) – trace(A B)
mat_exc (torch.tensor) – invA @ Abar
M (torch.tensor) – invA Bbar - inv A B inv A Abar
index (List) – list of index of the excitations
size (int) – number of excitation
nbatch – batch size
- static op_squared_single(baseterm, mat_exc, M, Y, index, nbatch)[source]
Computes the operator squared for single excitation
\[Tr( (\bar{A}^{-1} \bar{B})^2) = Tr((A^{-1} B)^2) + Tr( (T M)^2 ) + 2 Tr(T Y) T = P ( A^{-1} \bar{A})^{-1} P -> mat_exc in the code M = A^{-1}\bar{B} - A^{-1}BA^{-1}\bar{A} Y = A^{-1} B M\]- Parameters:
baseterm (torch.tensor) – trace(A B A B)
mat_exc (torch.tensor) – invA @ Abar
M (torch.tensor) – invA Bbar - inv A B inv A Abar
Y (torch.tensor) – invA B M
index (List) – list of index of the excitations
nbatch – batch size
- static op_squared_multiexcitation(baseterm, mat_exc, M, Y, index, size, nbatch)[source]
Computes the operator squared for multiple excitation
\[Tr( (\bar{A}^{-1} \bar{B})^2) = Tr((A^{-1} B)^2) + Tr( (T M)^2 ) + 2 Tr(T Y) T = P ( A^{-1} \bar{A})^{-1} P -> mat_exc in the code M = A^{-1}\bar{B} - A^{-1}BA^{-1}\bar{A} Y = A^{-1} B M\]- Parameters:
baseterm (torch.tensor) – trace(A B A B)
mat_exc (torch.tensor) – invA @ Abar
M (torch.tensor) – invA Bbar - inv A B inv A Abar
Y (torch.tensor) – invA B M
index (List) – list of index of the excitations
nbatch – batch size
size (int) – number of excitation