qmctorch.utils.interpolate module

class qmctorch.utils.interpolate.InterpolateMolecularOrbitals(wf)[source]

Bases: object

Interpolation of the AO using a log grid centered on each atom.

get_mo_max_index(orb)[source]

Get the index of the highest MO to inlcude in the interpoaltion

Parameters:orb (str) – occupied or all
Raises:ValueError – if orb not valid
interpolate_mo_irreg_grid(pos, n, orb)[source]

Interpolate the mo occupied in the configs.

Parameters:
  • pos (torch.tensor) – sampling points (Nbatch, 3*Nelec)
  • n (int, optional) – Interpolation order. Defaults to 6.
Returns:

mo values Nbatch, Nelec, Nmo

Return type:

torch.tensor

interpolate_mo_reg_grid(pos, res, blength, orb)[source]

Interpolate the mo occupied in the configs.

Parameters:pos (torch.tensor) – sampling points (Nbatch, 3*Nelec)
Returns:mo values Nbatch, Nelec, Nmo
Return type:torch.tensor
class qmctorch.utils.interpolate.InterpolateAtomicOrbitals(wf)[source]

Bases: object

Interpolation of the AO using a log grid centered on each atom.

get_interpolator(n=6, length=2)[source]

evaluate the interpolation function.

Parameters:
  • n (int, optional) – number of points on each log axis. Defaults to 6.
  • length (int, optional) – half length of the grid. Defaults to 2.
qmctorch.utils.interpolate.get_boundaries(atomic_positions, border_length=2.0)[source]

Computes the boundaries of the structure

Parameters:
  • atomic_positions (torch.Tensor, np.ndarray, list) – atomic positions
  • border_length (float, optional) – length of the border. Defaults to 2.
Raises:

ValueError – if type of positions not recognized

Returns:

min, max values in the 3 cartesian directions

Return type:

(np.ndarray, np.ndarray, mp.ndarray)

qmctorch.utils.interpolate.get_reg_grid(atomic_positions, resolution=0.1, border_length=2.0)[source]

Computes a regular grid points from the atomic positions

Parameters:
  • atomic_positions (torch.Tensor, np.ndarray, list) – atomic positions
  • resolution (float, optional) – ditance between two points. Defaults to 0.5.
  • border_length (float, optional) – length of the border. Defaults to 2.
Returns:

grid points in the x, y and z axis

Return type:

(np.ndarray, np.ndarray, mp.ndarray)

qmctorch.utils.interpolate.interpolator_reg_grid(func, x, y, z)[source]

Computes the interpolation function

Parameters:
  • func (callable) – compute the value of the funtion to interpolate
  • x (np.ndarray) – grid points in the x direction
  • y (np.ndarray) – grid points in the y direction
  • z (np.ndarray) – grid points in the z direction
Returns:

interpolation function

Return type:

callable

qmctorch.utils.interpolate.interpolate_reg_grid(interpfunc, pos)[source]

Interpolate the funtion

Parameters:
  • interpfunc (callable) – function to interpolate the data points
  • pos (torch.tensor) – positions of the walkers Nbatch x 3*Nelec
Returns:

interpolated values of the function evaluated at pos

Return type:

torch.tensor

qmctorch.utils.interpolate.is_even(x)[source]

return true if x is even.

qmctorch.utils.interpolate.logspace(n, length)[source]

returns a 1d array of logspace between -length and +length.

qmctorch.utils.interpolate.get_log_grid(atomic_positions, n=6, length=2.0, border_length=2.0)[source]

Computes a logarithmic grid

Parameters:
  • atomic_positions (list, np.ndarray, torch.tensor) – positions of the atoms
  • n (int, optional) – number of points in each axis around each atom. Defaults to 6.
  • length (float, optional) – absolute value of the max distance from the atom. Defaults to 2.
  • border_length (float, optional) – length of the border. Defaults to 2.
Returns:

grid points (Npts,3)

Return type:

np.ndanrray

qmctorch.utils.interpolate.interpolator_irreg_grid(func, grid_pts)[source]

compute a linear ND interpolator

Parameters:
  • func (callable) – compute the value of the funtion to interpolate
  • grid_pts (np.ndarray) – grid points in the x direction
Returns:

interpolation function

Return type:

callable

qmctorch.utils.interpolate.interpolate_irreg_grid(interpfunc, pos)[source]

Interpolate the funtion

Parameters:
  • interpfunc (callable) – function to interpolate the data points
  • pos (torch.tensor) – positions of the walkers Nbatch x 3*Nelec
Returns:

interpolated values of the function evaluated at pos

Return type:

torch.tensor