qmctorch.sampler.metropolis module
- class qmctorch.sampler.metropolis.Metropolis(nwalkers: int = 100, nstep: int = 1000, step_size: float = 0.2, ntherm: int = -1, ndecor: int = 1, nelec: int = 1, ndim: int = 3, init: Dict = {'max': 5, 'min': -5}, move: Dict = {'proba': 'normal', 'type': 'all-elec'}, cuda: bool = False)[source]
Bases:
SamplerBase
Metropolis Hasting generator
- Parameters:
nwalkers (int, optional) – Number of walkers. Defaults to 100.
nstep (int, optional) – Number of steps. Defaults to 1000.
step_size (int, optional) – length of the step. Defaults to 0.2.
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 the last position
ndecor (int, optional) – number of mc step for decorelation. Defauts 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()
move (dict, optional) –
method to move the electrons. default(‘all-elec’,’normal’)
- ’type’:
’one-elec’: move a single electron per iteration
’all-elec’: move all electrons at the same time
’all-elec-iter’: move all electrons by iterating through single elec moves
- ’proba’ :
’uniform’: uniform in a cube
’normal’: gussian in a sphere
cuda (bool, optional) – turn CUDA ON/OFF. Defaults to False.
- Examples::
>>> mol = Molecule('h2.xyz') >>> wf = SlaterJastrow(mol) >>> sampler = Metropolis(nwalkers=100, nelec=wf.nelec) >>> pos = sampler(wf.pdf)
- configure_move(move: Dict)[source]
Configure the electron moves
- Parameters:
move (dict, optional) –
method to move the electrons. default(‘all-elec’,’normal’)
- ’type’:
’one-elec’: move a single electron per iteration
’all-elec’: move all electrons at the same time
’all-elec-iter’: move all electrons by iterating through single elec moves
- ’proba’ :
’uniform’: uniform ina cube
’normal’: gussian in a sphere
- Raises:
ValueError – If moves are not recognized