qmctorch.wavefunction.jastrows.distance package
Submodules
qmctorch.wavefunction.jastrows.distance.electron_electron_distance module
- class qmctorch.wavefunction.jastrows.distance.electron_electron_distance.ElectronElectronDistance(*args: Any, **kwargs: Any)[source]
Bases:
ModuleComputes 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: torch.Tensor, derivative: int = 0) torch.Tensor[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.Tensor) – 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:
- safe_sqrt(dist: torch.Tensor) torch.Tensor[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: torch.Tensor, dist: torch.Tensor) torch.Tensor[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: torch.Tensor, dist: torch.Tensor) torch.Tensor[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: torch.Tensor) torch.Tensor[source]
Compute the distance following a quadratic expansion
- Parameters:
ndim] (pos {torch.tensor} -- electron position [nbatch x nelec x)
- Returns:
torch.tensor – distance matrices nbatch x nelec x ndim]
- static get_difference(pos: torch.Tensor) torch.Tensor[source]
Compute the difference ri - rj
- Parameters:
ndim] (pos {torch.tensor} -- electron position [nbatch x nelec x)
- Returns:
torch.tensor – distance matrices nbatch x nelec x nelec x ndim]
qmctorch.wavefunction.jastrows.distance.electron_nuclei_distance module
- class qmctorch.wavefunction.jastrows.distance.electron_nuclei_distance.ElectronNucleiDistance(*args: Any, **kwargs: Any)[source]
Bases:
ModuleComputes the electron-nuclei distances
\[r_{iA} = \sqrt{ (x_i-x_A)^2 + (y_i-y_A)^2 + (z_i-z_A)^2}\]- Parameters:
- Examples::
>>> endist = ElectronNucleiDistance(2,2) >>> epos = torch.tensor(500,6) >>> r = edist(pos) >>> dr = edist(pos,derivative=1)
- forward(input: torch.Tensor, derivative: int = 0) torch.Tensor | Tuple[torch.Tensor, torch.Tensor][source]
Compute the pairwise distances between electrons and atoms or their derivative.
- Parameters:
input (torch.Tensor) –
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 Natom if derivative = 0
Nbatch x Ndim x Nelec x Natom if derivative = 1,2
- Return type:
Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]
- get_der_distance(pos: torch.Tensor, dist: torch.Tensor) torch.Tensor[source]
Get the derivative of the electron-nuclei distance matrix
\[\frac{d r_{iA}}{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: torch.Tensor, dist: torch.Tensor) torch.Tensor[source]
Get the derivative of the electron-nuclei distance matrix
\[\frac{d^2 r_{iA}}{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]
qmctorch.wavefunction.jastrows.distance.scaling module
- qmctorch.wavefunction.jastrows.distance.scaling.get_scaled_distance(kappa: float, r: torch.Tensor) torch.Tensor[source]
compute the scaled distance
\[u_{ij} = \frac{1-e^{-\kappa r_{ij}}}{\kappa}\]- Parameters:
kappa (float) – scaling factor
r (torch.tensor) – matrix of the e-e distances Nbatch x Nelec x Nelec
- Returns:
- values of the scaled distance
Nbatch, Nelec, Nelec
- Return type:
torch.tensor
- qmctorch.wavefunction.jastrows.distance.scaling.get_der_scaled_distance(kappa: float, r: torch.Tensor, dr: torch.Tensor) torch.Tensor[source]
Returns the derivative of the scaled distances
\[\frac{d u}{d x_i} = \frac{d r_{ij}}{d x_i} e^{-\kappa r_{ij}}\]- Parameters:
kappa (float) – scaling factor
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:
- deriative of the scaled distance
Nbatch x Ndim x Nelec x Nelec
- Return type:
torch.tensor
- qmctorch.wavefunction.jastrows.distance.scaling.get_second_der_scaled_distance(kappa: float, r: torch.Tensor, dr: torch.Tensor, d2r: torch.Tensor) torch.Tensor[source]
computes the second derivative of the scaled distances
\[\frac{d^2u_{ij}}{d x_i^2} = \frac{d^2r_{ij}}{d x_i^2} -\kappa \left( \frac{d r_{ij}}{d x_i} \right)^2 e^{-\kappa r_{ij}}\]- Parameters:
kappa (float) – scaling factor
r (torch.tensor) – unsqueezed 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:
- second deriative of the scaled distance
Nbatch x Ndim x Nelec x Nelec
- Return type:
torch.tensor
Module contents
- class qmctorch.wavefunction.jastrows.distance.ElectronElectronDistance(*args: Any, **kwargs: Any)[source]
Bases:
ModuleComputes 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: torch.Tensor, derivative: int = 0) torch.Tensor[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.Tensor) – 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:
- safe_sqrt(dist: torch.Tensor) torch.Tensor[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: torch.Tensor, dist: torch.Tensor) torch.Tensor[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: torch.Tensor, dist: torch.Tensor) torch.Tensor[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: torch.Tensor) torch.Tensor[source]
Compute the distance following a quadratic expansion
- Parameters:
ndim] (pos {torch.tensor} -- electron position [nbatch x nelec x)
- Returns:
torch.tensor – distance matrices nbatch x nelec x ndim]
- static get_difference(pos: torch.Tensor) torch.Tensor[source]
Compute the difference ri - rj
- Parameters:
ndim] (pos {torch.tensor} -- electron position [nbatch x nelec x)
- Returns:
torch.tensor – distance matrices nbatch x nelec x nelec x ndim]
- class qmctorch.wavefunction.jastrows.distance.ElectronNucleiDistance(*args: Any, **kwargs: Any)[source]
Bases:
ModuleComputes the electron-nuclei distances
\[r_{iA} = \sqrt{ (x_i-x_A)^2 + (y_i-y_A)^2 + (z_i-z_A)^2}\]- Parameters:
- Examples::
>>> endist = ElectronNucleiDistance(2,2) >>> epos = torch.tensor(500,6) >>> r = edist(pos) >>> dr = edist(pos,derivative=1)
- forward(input: torch.Tensor, derivative: int = 0) torch.Tensor | Tuple[torch.Tensor, torch.Tensor][source]
Compute the pairwise distances between electrons and atoms or their derivative.
- Parameters:
input (torch.Tensor) –
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 Natom if derivative = 0
Nbatch x Ndim x Nelec x Natom if derivative = 1,2
- Return type:
Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]
- get_der_distance(pos: torch.Tensor, dist: torch.Tensor) torch.Tensor[source]
Get the derivative of the electron-nuclei distance matrix
\[\frac{d r_{iA}}{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: torch.Tensor, dist: torch.Tensor) torch.Tensor[source]
Get the derivative of the electron-nuclei distance matrix
\[\frac{d^2 r_{iA}}{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]