qmctorch.wavefunction.jastrows.elec_nuclei package

Subpackages

Submodules

qmctorch.wavefunction.jastrows.elec_nuclei.jastrow_factor_electron_nuclei module

class qmctorch.wavefunction.jastrows.elec_nuclei.jastrow_factor_electron_nuclei.JastrowFactorElectronNuclei(*args: Any, **kwargs: Any)[source]

Bases: Module

Base class for two el-nuc jastrow of the form:

\[J = \prod_{a,i} \exp(A(r_{ai}))\]
Parameters:
  • nup (int) – number of spin up electons

  • ndow (int) – number of spin down electons

  • atomic_pos (tensor) – positions of the atoms

  • cuda (bool, optional) – Turns GPU ON/OFF. Defaults to False.

forward(pos: torch.Tensor, derivative: int | Tuple[int] = 0, sum_grad: bool = True) torch.Tensor | Tuple[torch.Tensor][source]

Compute the Jastrow factors.

Parameters:
  • pos (torch.tensor) – Positions of the electrons Size : Nbatch, Nelec x Ndim

  • derivative (int, optional) – order of the derivative (0,1,2,). Defaults to 0.

  • sum_grad (bool, optional) – Return the sum_grad (i.e. the sum of the derivatives) or the individual terms. Defaults to True. False only for derivative=1

Returns:

value of the jastrow parameter for all confs

derivative = 0 (Nmo) x Nbatch x 1 derivative = 1 (Nmo) x Nbatch x Nelec (for sum_grad = True) derivative = 1 (Nmo) x Nbatch x Ndim x Nelec (for sum_grad = False) derivative = 2 (Nmo) x Nbatch x Nelec

Return type:

torch.tensor

jastrow_factor_derivative(r: torch.Tensor, dr: torch.Tensor, jast: torch.Tensor, sum_grad: bool) torch.Tensor[source]

Compute the value of the derivative of the Jastrow factor

Parameters:
  • r (torch.tensor) – ee distance matrix Nbatch x Nelec x Nelec

  • jast (torch.tensor) – values of the jastrow elements Nbatch x Nelec x Natom

Returns:

gradient of the jastrow factors

Nbatch x Ndim x Nelec

Return type:

torch.tensor

jastrow_factor_second_derivative(r: torch.Tensor, dr: torch.Tensor, d2r: torch.Tensor, jast: torch.Tensor) torch.Tensor[source]

Compute the value of the pure 2nd derivative of the Jastrow factor

Parameters:
  • r (torch.tensor) – ee distance matrix Nbatch x Nelec x Nelec

  • jast (torch.tensor) – values of the ajstrow elements Nbatch x Nelec x Nelec

Returns:

diagonal hessian of the jastrow factors

Nbatch x Nelec x Ndim

Return type:

torch.tensor

Module contents

qmctorch.wavefunction.jastrows.elec_nuclei.JastrowFactor

alias of JastrowFactorElectronNuclei

class qmctorch.wavefunction.jastrows.elec_nuclei.PadeJastrowKernel(*args: Any, **kwargs: Any)[source]

Bases: JastrowKernelElectronNucleiBase

Computes the Simple Pade-Jastrow factor

\[\begin{split}J = \prod_{i<j} \exp(B_{ij}) \quad \quad \\text{with} \quad \quad B_{ij} = \\frac{w_0 r_{i,j}}{1 + w r_{i,j}}\end{split}\]
Parameters:
  • nup (int) – number of spin up electons

  • ndow (int) – number of spin down electons

  • atoms (torch.tensor) – atomic positions of the atoms

  • w (float, optional) – Value of the variational parameter. Defaults to 1..

  • cuda (bool, optional) – Turns GPU ON/OFF. Defaults to False.

forward(r: torch.Tensor) torch.Tensor[source]
Get the jastrow kernel.
\[B_{ij} =\]

rac{b r_{i,j}}{1+b’r_{i,j}}

Args:
r (torch.tensor): matrix of the e-e distances

Nbatch x Nelec x Nelec

Returns:
torch.tensor: matrix of the jastrow kernels

Nbatch x Nelec x Nelec

compute_derivative(r: torch.Tensor, dr: torch.Tensor) torch.Tensor[source]
Get the elements of the derivative of the jastrow kernels

wrt to the first electrons

\[ \begin{align}\begin{aligned}d B_{ij} / d k_i = d B_{ij} / d k_j = - d B_{ji} / d k_i\\out_{k,i,j} = A1 + A2 A1_{kij} = w0\end{aligned}\end{align} \]
rac{dr_{ij}}{dk_i} / (1 + w r_{ij})

A2_{kij} = - w0 w’ r_{ij}

rac{dr_{ij}}{dk_i} / (1 + w r_{ij})^2

Args:
r (torch.tensor): matrix of the e-e distances

Nbatch x Nelec x Nelec

dr (torch.tensor): matrix of the derivative of the e-e distances

Nbatch x Ndim x Nelec x Nelec

Returns:
torch.tensor: matrix fof the derivative of the jastrow elements

Nbatch x Ndim x Nelec x Nelec

compute_second_derivative(r: torch.Tensor, dr: torch.Tensor, d2r: torch.Tensor) torch.Tensor[source]

Get the elements of the pure 2nd derivative of the jastrow kernels wrt to the first electron

\[d^2 B_{ij} / d k_i^2 = d^2 B_{ij} / d k_j^2 = d^2 B_{ji} / d k_i^2\]
Parameters:
  • r (torch.tensor) – matrix of the e-e distances Nbatch x Nelec x Nelec

  • dr (torch.tensor) – matrix of the derivative of the e-e distances Nbatch x Ndim x Nelec x Nelec

  • d2r (torch.tensor) –

    matrix of the 2nd derivative of

    the e-e distances

    Nbatch x Ndim x Nelec x Nelec

Returns:

matrix fof the pure 2nd derivative of

the jastrow elements Nbatch x Ndim x Nelec x Nelec

Return type:

torch.tensor

class qmctorch.wavefunction.jastrows.elec_nuclei.FullyConnectedJastrowKernel(*args: Any, **kwargs: Any)[source]

Bases: JastrowKernelElectronNucleiBase

Computes the Simple Pade-Jastrow factor

Parameters:
  • nup (int) – number of spin up electons

  • ndow (int) – number of spin down electons

  • atomic_pos (torch.tensor) – atomic positions of the atoms

  • w (float, optional) – Value of the variational parameter. Defaults to 1..

  • cuda (bool, optional) – Turns GPU ON/OFF. Defaults to False.

forward(x: torch.Tensor) torch.Tensor[source]

Get the jastrow kernel.

Parameters:

x (torch.tensor) – matrix of the e-e distances Nbatch x Nelec x Nnuc

Returns:

matrix of the jastrow kernels

Nbatch x Nelec x Nnuc

Return type:

torch.tensor