Skip to content
Discussion options

You must be logged in to vote

The most straightforward thing you can do is to simply define the new variational state $$\ket{U\psi}$$ and use it.

A way to do it is the following:

...
nn_model = nk.model.RBM()
vs = nk.vqs.MCState(sampler, nn_model)
U = nk.operator.spin.sigmax(hi, 1).to_jax_operator()

Unn_fun, Unn_variables = make_logpsi_U_afun(vs._apply_fun, vs.variables, U)
Uvs = nk.vqs.MCState(sampler, apply_fun=Unn_fun, variables=Unn_variables)

the relevant function can be found in here
https://gist.github.com/PhilipVinc/5fcc9fbba0e5d6ed6d56f0a4325e2808

Then everything will work out of th box.
Be careful that when you create a new MCState, the sampler chains will be initialised completely at random, so if you do th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jackaraz
Comment options

Answer selected by jackaraz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2093 on July 15, 2025 11:02.