qmctorch.sampler.hamiltonian module

class qmctorch.sampler.hamiltonian.Hamiltonian(nwalkers: int = 100, nstep: int = 100, step_size: float = 0.2, L: int = 10, ntherm: int = -1, ndecor: int = 1, nelec: int = 1, ndim: int = 3, init: Dict[KT, VT] = {'max': 5, 'min': -5}, cuda: bool = False)[source]

Bases: qmctorch.sampler.sampler_base.SamplerBase

Hamiltonian Monte Carlo Sampler.

Parameters:
  • nwalkers (int, optional) – Number of walkers. Defaults to 100.
  • nstep (int, optional) – Number of steps. Defaults to 100.
  • step_size (int, optional) – length of the step. Defaults to 0.2.
  • L (int, optional) – length of the trajectory . Defaults to 10.
  • nelec (int, optional) – total number of electrons. Defaults to 1.
  • ntherm (int, optional) – number of mc step to thermalize. Defaults to -1, i.e. keep only last position
  • ndecor (int, optional) – number of mc step for decorrelation. Defaults to 1.
  • ndim (int, optional) – total number of dimension. Defaults to 3.
  • init (dict, optional) – method to init the positions of the walkers. See Molecule.domain()
  • cuda (bool, optional) – turn CUDA ON/OFF. Defaults to False.
static get_grad(func, inp)[source]

get the gradient of the pdf using autograd

Parameters:
  • func (callable) – function to compute the pdf
  • inp (torch.tensor) – input of the function
Returns:

gradients of the wavefunction

Return type:

torch.tensor

static log_func(func)[source]

Compute the negative log of a function

Parameters:func (callable) – input function
Returns:negative log of the function
Return type:callable