qmctorch.wavefunction.jastrows.distance.electron_electron_distance module

class qmctorch.wavefunction.jastrows.distance.electron_electron_distance.ElectronElectronDistance(nelec, ndim=3, scale=False, scale_factor=0.6)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Computes the electron-electron distances

\[r_{ij} = \sqrt{ (x_i-x_j)^2 + (y_i-y_j)^2 + (z_i-z_j)^2}\]
Parameters:
  • nelec (int) – number of electrons
  • ndim (int) – number of spatial dimensions
  • scale (bool, optional) – return scaled values, Defaults to False
  • scale_factor (float, optional) – value of the scale factor, Defaults to 0.6
Examples::
>>> edist = ElectronDistance(2,3)
>>> pos = torch.tensor(500,6)
>>> r = edist(pos)
>>> dr = edist(pos,derivative=1)
forward(input, derivative=0)[source]

Compute the pairwise distance between the electrons or its derivative.

When required, the derivative is computed wrt to the first electron i.e.

\[\frac{dr_{ij}}{dx_i}\]

which is different from :

\[\frac{d r_{ij}}{dx_j} = -\frac{dr_{ij}}{dx_i}\]
Parameters:
  • input (torch.tesnor) –

    position of the electron

    size : Nbatch x [Nelec x Ndim]

  • derivative (int, optional) –

    degre of the derivative.

    Defaults to 0.

Returns:

distance (or derivative) matrix

Nbatch x Nelec x Nelec if derivative = 0

Nbatch x Ndim x Nelec x Nelec if derivative = 1,2

Return type:

torch.tensor

safe_sqrt(dist)[source]

Compute the square root of the electron electron distance matrix.

Parameters:dist (torch.tensor) – ee distances squared Nbatch x Nelec x Nelec
Returns:sqrt of dist Nbatch x Nelec x Nelec
Return type:torch.tensor
get_der_distance(pos, dist)[source]

Get the derivative of the electron electron distance matrix.

\[\frac{d r_{ij}}{d x_i}\]
Parameters:
  • pos (torch.tensor) – positions of the electrons Nbatch x Nelec x Ndim
  • dist (torch.tensor) – distance matrix between the elecs Nbatch x Nelec x Nelec
Returns:

[description]

Return type:

[type]

get_second_der_distance(pos, dist)[source]

Get the second derivative of the electron electron distance matrix.

\[\frac{d^2 r_{ij}}{d x_i^2}\]
Parameters:
  • pos (torch.tensor) – positions of the electrons Nbatch x Nelec x Ndim
  • dist (torch.tensor) – distance matrix between the elecs Nbatch x Nelec x Nelec
Returns:

[description]

Return type:

[type]

static get_distance_quadratic(pos)[source]

Compute the distance following a quadratic expansion

Parameters:{torch.tensor} -- electron position [nbatch x nelec x ndim] (pos) –
Returns:torch.tensor – distance matrices nbatch x nelec x ndim]
static get_difference(pos)[source]

Compute the difference ri - rj

Parameters:{torch.tensor} -- electron position [nbatch x nelec x ndim] (pos) –
Returns:torch.tensor – distance matrices nbatch x nelec x nelec x ndim]