-
-
Save PhilipVinc/f213e1d4e85a0f20cff5d73092a647b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netket as nk | |
import numpy as np | |
import jax | |
import flax | |
from flax import linen as nn | |
from jax import numpy as jnp | |
from netket import nn as nknn | |
g = nk.graph.Chain(8) | |
hi = nk.hilbert.Spin(1 / 2) ** g.n_nodes | |
H = nk.operator.Ising(hi, graph=g, h=1.0) | |
ma = nk.nn.models.RBM() | |
sa = nk.sampler.MetropolisLocal(hi) # , dtype=np.float64 | |
vs = nk.variational_states.ClassicalVariationalState(ma, sa, n_samples=1000) | |
optim = flax.optim.GradientDescent(learning_rate=0.1) | |
gs = nk.Vmc(H, optim, variational_state=vs) | |
gs.run(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment