qmctorch.wavefunction.jastrows.distance.electron_electron_distance module
- class qmctorch.wavefunction.jastrows.distance.electron_electron_distance.ElectronElectronDistance(*args: Any, **kwargs: Any)[source]
Bases:
Module
Computes the electron-electron distances
\[r_{ij} = \sqrt{ (x_i-x_j)^2 + (y_i-y_j)^2 + (z_i-z_j)^2}\]- Parameters:
- 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]