# netket.sampler.MetropolisLocal#

netket.sampler.MetropolisLocal(hilbert, **kwargs)[source]#

Sampler acting on one local degree of freedom.

This sampler acts locally only on one local degree of freedom $$s_i$$, and proposes a new state: $$s_1 \dots s^\prime_i \dots s_N$$, where $$s^\prime_i \neq s_i$$.

The transition probability associated to this sampler can be decomposed into two steps:

1. One of the site indices $$i = 1\dots N$$ is chosen with uniform probability.

2. Among all the possible ($$m - 1$$) values that $$s^\prime_i$$ can take, one of them is chosen with uniform probability.

For example, in the case of spin $$1/2$$ particles, $$m=2$$ and the possible local values are $$s_i = -1,+1$$. In this case then MetropolisLocal is equivalent to flipping a random spin.

In the case of bosons, with occupation numbers $$s_i = 0, 1, \dots n_{\mathrm{max}}$$, MetropolisLocal would pick a random local occupation number uniformly between $$0$$ and $$n_{\mathrm{max}}$$ except the current $$s_i$$.

Parameters:
• hilbert â€“ The Hilbert space to sample.

• n_chains â€“ The total number of independent Markov chains across all MPI ranks. Either specify this or n_chains_per_rank.

• n_chains_per_rank â€“ Number of independent chains on every MPI rank (default = 16).

• sweep_size â€“ Number of sweeps for each step along the chain. Defaults to the number of sites in the Hilbert space. This is equivalent to subsampling the Markov chain.

• reset_chains â€“ If True, resets the chain state when reset is called on every new sampling (default = False).

• machine_pow â€“ The power to which the machine should be exponentiated to generate the pdf (default = 2).

• dtype â€“ The dtype of the states sampled (default = np.float64).

Return type:

MetropolisSampler