Neural Quantum States (NQS) is a method to find the ground state (lowest energy
state) of a quantum system. NQS uses a neural network (here, a restricted
Boltzmann machine, RBM) to represent the quantum many-body wavefunction
A key step in NQS is computing the local energy
In variational Monte Carlo, a trial wavefunction
which, after applying the Marshall sign rule, contributes a diagonal piece plus one off-diagonal term per bond where the two spins differ:
where eloc_naive/eloc_lookup_table implement in eloc.py.
More about the derivation of the local energy in NQS is in Eloc in NQS and more about Neural Quantum States is in Neural Quantum States.
The RBM wavefunction is
with
-
Naive (
eloc_naive): recompute$\theta'$ from scratch, i.e. a full$s' \cdot W$ matrix-vector product. Cost:$O(N_\text{bonds} \cdot N_\text{spins} \cdot M)$ . -
Lookup table (
eloc_lookup_table):$\theta$ for the unflipped$s$ is computed once; a bond flip only changes two spins, so $\theta'h = \theta_h - 2 W{ih} s_i - 2 W_{jh} s_j$ updates every hidden unit in$O(M)$ instead of$O(N_\text{spins} \cdot M)$ . Cost:$O(N_\text{bonds} \cdot M)$ total.
The lookup-table method is the implementation of choice because of the improved scaling win.
- Initialize
$\theta_h$ . - Calculate
$\log\psi(s)$ from$\theta_h$ by$\log\psi(s) = \gamma \sum_{h=1}^{M} \log\big(2\cosh(\theta_h)\big)$ . -
$E_\text{loc} = 0$ . - Loop over all bonds
$(i,j)$ , and if$s_i \neq s_j$ :- Flip the two spins
$s_i$ and$s_j$ , which gives $\theta'h = \theta_h - 2 W{ih} s_i - 2 W_{jh} s_j$. - Calculate
$\log\psi(s') = \gamma \sum_{h=1}^{M} \log\big(2\cosh(\theta'_h)\big)$ . -
$E_\text{loc} = E_\text{loc} -2 \exp\big(\log\psi(s') - \log\psi(s)\big)$ .
- Flip the two spins
- Calculate the diagonal part: loop over all bonds
$(i,j)$ ,$E_\text{loc} = E_\text{loc} + s_i \cdot s_j$ .
Note that we use
Install required python libraries:
pip install -r requirements.txt
Generate random states:
python auxiliary/generate_states.py
Either generate random RBM data or use pre-trained data:
python auxiliary/generate_RBM.py
python auxiliary/reformat_Ising.py
python eloc.py
Running sac sequentially:
sac2c eloc.sac
./a.out
Running sac multi-threaded using
sac2c -tmt_pth eloc.sac
./a.out -mt N