Is it possible to use MetropolisHamiltonian sampler in dissipative models? #877
-
Hi! As far as I understood
The script with the error: import netket as nk
# Model params
L = 6
gp = 0.3
Vp = 2.0
# Ansatz params
beta = 2
alpha = 2
n_samples = 5000
n_samples_diag = 2000
n_iter = 1000
# Create graph
g = nk.graph.Hypercube(length=L, n_dim=1, pbc=False)
# Hilbert space of spins on the graph
hi = nk.hilbert.Spin(s=1/2, N=g.n_nodes)
# The hamiltonian
ha = nk.operator.LocalOperator(hi)
# List of dissipative jump operators
j_ops = []
for i in range(L):
ha += (gp / 2.0) * nk.operator.spin.sigmax(hi, i)
ha += (
(Vp / 4.0)
* nk.operator.spin.sigmaz(hi, i)
* nk.operator.spin.sigmaz(hi, (i + 1) % L)
)
# sigma_{-} dissipation on every site
j_ops.append(nk.operator.spin.sigmam(hi, i))
# Create the Liouvillian
lind = nk.operator.LocalLiouvillian(ha, j_ops)
# Neural quantum state model: Positive-Definite Neural Density Matrix using the ansatz from Torlai and Melko
ndm = nk.models.NDM(
alpha=alpha,
beta=beta,
)
# Metropolis Local Sampling
sa = nk.sampler.MetropolisHamiltonian(lind.hilbert, hamiltonian=lind)
# Variational state
vs = nk.vqs.MCMixedState(sa, ndm, n_samples=n_samples, n_samples_diag=n_samples_diag)
vs.init_parameters(nk.nn.initializers.normal(stddev=0.01)) The problem rises during initializing of sampler_diag with non-DoubledHibert space. Motivation: in issue #850 I tried to consider a dissipative system with Many-Body Localization. This system has symmetry: half of the spins are in the ground state, half are in the excited state. I assumed that using the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes your intuition was correct (though you will have extremely bad performance, because MetropolisHamiltonian is slow and becomes even slower the more complex the operator is... and Lindlab operators are quite slow. They could use some love. Anyhow, that's an interesting error...
Is telling you that it is erroring during the initialisation of the internal For ease of use, when you don't specify the kwarg if sampler_diag is None:
sampler_diag = sampler.replace(hilbert=hilbert_physical) This works for simple samplers such as The fix for you would be to also specify a sampler defined on the physical hilbert space for the diagonal such as MetropolisLocal or MetropolisHamiltonian(hamiltonian). -- Instead, to avoid such errors in the future, we might try to default to MetropolisLocal. |
Beta Was this translation helpful? Give feedback.
Yes your intuition was correct (though you will have extremely bad performance, because MetropolisHamiltonian is slow and becomes even slower the more complex the operator is... and Lindlab operators are quite slow. They could use some love.
I think a better take would be to create the graph for MetropolisExchange manually)
Anyhow, that's an interesting error...
This line
Is telling you that it is erroring during the initialisation of the internal
MCState
used to sample the diagonal of the density matrix.For ease of use, when you don't spe…