Variational quantum state module
- class jVMC.vqs.NQS(net, logarithmic=True, batchSize=1000, seed=1234, orbit=None, avgFun=<function avgFun_Coefficients_Exp>)
Wrapper class providing basic functionality of variational states.
- This class can operate in two modi:
- Single-network ansatz
Quantum state of the form \(\psi_\theta(s)\equiv\exp(r_\theta(s))\), where the network \(r_\theta\) is a) holomorphic, i.e., parametrized by complex valued parameters \(\vartheta\). b) non-holomorphic, i.e., parametrized by real valued parameters \(\theta\).
- Two-network ansatz
Quantum state of the form \(\psi_\theta(s)\equiv\exp(r_{\theta_r}(s)+i\varphi_{\theta_\phi}(s))\) with an amplitude network \(r_{\theta_{r}}\) and a phase network \(\varphi_{\theta_\phi}\) parametrized by real valued parameters \(\theta_r,\theta_\phi\).
- Initializer arguments:
net: Variational network.A network has to be registered as pytree node and provide a
__call__function for evaluation. It is expected that the network is of typejVMC.nets.sym_wrapper.SymNet. If the network is composed of two networks, the correct wrapping structure isjVMC.nets.sym_wrapper.SymNet(jVMC.nets.two_nets_wrapper.TwoNets).
batchSize: Batch size for batched network evaluation. Choice of this parameter impacts performance: with too small values performance is limited by memory access overheads, too large values can lead to “out of memory” issues.seed: Seed for the PRNG to initialize the network parameters.
- __call__(s)
Evaluate variational wave function.
Compute the logarithmic wave function coefficients \(\ln\psi(s)\) for computational configurations \(s\).
- Args:
s: Array of computational basis states.
- Returns:
Logarithmic wave function coefficients \(\ln\psi(s)\).
- get_parameters()
Get variational parameters.
- Returns:
Array holding current values of all variational parameters.
- get_sampler_net()
Get real part of NQS and current parameters
This function returns a function that evaluates the real part of the NQS, \(\text{Re}(\log\psi(s))\), and the current parameters.
- Returns:
Real part of the NQS and current parameters
- gradients(s)
Compute gradients of logarithmic wave function.
Compute gradient of the logarithmic wave function coefficients, \(\nabla\ln\psi(s)\), for computational configurations \(s\).
- Args:
s: Array of computational basis states.
- Returns:
A vector containing derivatives \(\partial_{\theta_k}\ln\psi(s)\) with respect to each variational parameter \(\theta_k\) for each input configuration \(s\).
- gradients_dict(s)
Compute gradients of logarithmic wave function and return them as dictionary.
Compute gradient of the logarithmic wave function coefficients, \(\nabla\ln\psi(s)\), for computational configurations \(s\).
- Args:
s: Array of computational basis states.
- Returns:
A dictionary containing derivatives \(\partial_{\theta_k}\ln\psi(s)\) with respect to each variational parameter \(\theta_k\) for each input configuration \(s\).
- set_parameters(P)
Set variational parameters.
Sets new values of all variational parameters.
- Args:
P: New values of variational parameters.
- update_parameters(deltaP)
Update variational parameters.
Sets new values of all variational parameters by adding given values. If parameters are not initialized, parameters are set to
deltaP.- Args:
deltaP: Values to be added to variational parameters.