qmctorch.sampler.generalized_metropolis module

class qmctorch.sampler.generalized_metropolis.GeneralizedMetropolis(nwalkers=100, nstep=1000, step_size=3, ntherm=-1, ndecor=1, nelec=1, ndim=1, init={'max': 5, 'min': -5, 'type': 'uniform'}, cuda=False)[source]

Bases: qmctorch.sampler.sampler_base.SamplerBase

Generalized Metropolis Hasting sampler

Parameters:
  • nwalkers (int, optional) – number of walkers. Defaults to 100.
  • nstep (int, optional) – number of steps. Defaults to 1000.
  • step_size (int, optional) – size of the steps. Defaults to 3.
  • ntherm (int, optional) – number of steps for thermalization. Defaults to -1.
  • ndecor (int, optional) – number of steps for decorelation. Defaults to 1.
  • nelec (int, optional) – number of electron. Defaults to 1.
  • ndim (int, optional) – number of dimensions. Defaults to 1.
  • init (dict, optional) – method to initialize the walkers. Defaults to {‘type’: ‘uniform’, ‘min’: -5, ‘max’: 5}.
  • cuda (bool, optional) – use cuda. Defaults to False.
move(drift)[source]

Move electron one at a time in a vectorized way.

Parameters:drift (torch.tensor) – drift velocity of the walkers
Returns:new positions of the walkers
Return type:torch.tensor
trans(xf, xi, drifti)[source]

transform the positions

Parameters:
  • xf ([type]) – [description]
  • xi ([type]) – [description]
  • drifti ([type]) – [description]
Returns:

[description]

Return type:

[type]

get_drift(pdf, x)[source]

Compute the drift velocity

Parameters:
  • pdf (callable) – function that returns the density
  • x (torch.tensor) – positions of the walkers
Returns:

drift velocity

Return type:

torch.tensor