qmctorch.wavefunction.slater_jastrow module¶
-
class
qmctorch.wavefunction.slater_jastrow.
SlaterJastrow
(mol, configs='ground_state', kinetic='jacobi', jastrow_kernel=<class 'qmctorch.wavefunction.jastrows.elec_elec.kernels.pade_jastrow_kernel.PadeJastrowKernel'>, jastrow_kernel_kwargs={}, cuda=False, include_all_mo=True)[source]¶ Bases:
qmctorch.wavefunction.slater_jastrow_base.SlaterJastrowBase
Slater Jastrow wave function with electron-electron Jastrow factor
\[\Psi(R_{at}, r) = J(r)\sum_n c_n D^\uparrow_n(r^\uparrow)D^\downarrow_n(r^\downarrow)\]with
\[J(r) = \exp\left( K_{ee}(r) \right)\]with K, a kernel function depending only on the electron-eletron distances
Parameters: - mol (Molecule) – a QMCTorch molecule object
- configs (str, optional) – defines the CI configurations to be used. Defaults to ‘ground_state’. - ground_state : only the ground state determinant in the wave function - single(n,m) : only single excitation with n electrons and m orbitals - single_double(n,m) : single and double excitation with n electrons and m orbitals - cas(n, m) : all possible configuration using n eletrons and m orbitals
- kinetic (str, optional) – method to compute the kinetic energy. Defaults to ‘jacobi’. - jacobi : use the Jacobi formula to compute the kinetic energy - auto : use automatic differentiation to compute the kinetic energy
- jastrow_kernel (JastrowKernelBase, optional) – Class that computes the jastrow kernels
- jastrow_kernel_kwargs (dict, optional) – keyword arguments for the jastrow kernel contructor
- cuda (bool, optional) – turns GPU ON/OFF Defaults to Fals e.
- include_all_mo (bool, optional) – include either all molecular orbitals or only the ones that are popualted in the configs. Defaults to False
- Examples::
>>> from qmctorch.scf import Molecule >>> from qmctorch.wavefunction import SlaterJastrow >>> mol = Molecule('h2o.xyz', calculator='adf', basis = 'dzp') >>> wf = SlaterJastrow(mol, configs='cas(2,2)')
-
forward
(x, ao=None)[source]¶ computes the value of the wave function for the sampling points
\[\Psi(R) = J(R) \sum_{n} c_n D^{u}_n(r^u) \times D^{d}_n(r^d)\]Parameters: - x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
- ao (torch.tensor, optional) – values of the atomic orbitals (Nbatch, Nelec, Nao)
Returns: values of the wave functions at each sampling point (Nbatch, 1)
Return type: torch.tensor
- Examples::
>>> mol = Molecule('h2.xyz', calculator='adf', basis = 'dzp') >>> wf = SlaterJastrow(mol, configs='cas(2,2)') >>> pos = torch.rand(500,6) >>> vals = wf(pos)
-
pos2mo
(x, derivative=0)[source]¶ Get the values of MOs
Parameters: {torch.tensor} -- positions of the electrons [nbatch, nelec*ndim] (x) – Keyword Arguments: {int} -- order of the derivative (default (derivative) – {0}) Returns: torch.tensor – MO matrix [nbatch, nelec, nmo]
-
kinetic_energy_jacobi
(x, **kwargs)[source]¶ Compute the value of the kinetic enery using the Jacobi Formula. C. Filippi, Simple Formalism for Efficient Derivatives .
\[\frac{\Delta \Psi(R)}{\Psi(R)} = \Psi(R)^{-1} \sum_n c_n (\frac{\Delta D_n^u}{D_n^u} + \frac{\Delta D_n^d}{D_n^d}) D_n^u D_n^d\]We compute the laplacian of the determinants through the Jacobi formula
\[\frac{\Delta \det(A)}{\det(A)} = Tr(A^{-1} \Delta A)\]Here \(A = J(R) \phi\) and therefore :
\[\Delta A = (\Delta J) D + 2 \nabla J \nabla D + (\Delta D) J\]Parameters: x (torch.tensor) – sampling points (Nbatch, 3*Nelec) Returns: values of the kinetic energy at each sampling points Return type: torch.tensor
-
gradients_jacobi
(x, sum_grad=False, pdf=False)[source]¶ Compute the gradients of the wave function (or density) using the Jacobi Formula C. Filippi, Simple Formalism for Efficient Derivatives.
\[\frac{K(R)}{\Psi(R)} = Tr(A^{-1} B_{grad})\]The gradients of the wave function
\[\Psi(R) = J(R) \sum_n c_n D^{u}_n D^{d}_n = J(R) \Sigma\]are computed following
\[\nabla \Psi(R) = \left( \nabla J(R) \right) \Sigma + J(R) \left(\nabla \Sigma \right)\]with
\[\nabla \Sigma = \sum_n c_n (\frac{\nabla D^u_n}{D^u_n} + \frac{\nabla D^d_n}{D^d_n}) D^u_n D^d_n\]that we compute with the Jacobi formula as:
\[\nabla \Sigma = \sum_n c_n (Tr( (D^u_n)^{-1} \nabla D^u_n) + Tr( (D^d_n)^{-1} \nabla D^d_n)) D^u_n D^d_n\]Parameters: - x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
- pdf (bool, optional) – if true compute the grads of the density
Returns: values of the gradients wrt the walker pos at each sampling points
Return type: torch.tensor