This project implements the Neural-Network Jastrow-Backflow (NNJBF) and Hidden Fermion Determinant State (HFDS) parametrized by a vision transformer (ViT). It contains the code and the data used to produce this manuscript.
To get started, first make sure you have installed uv by running in your terminal
curl -LsSf https://astral.sh/uv/install.sh | sh
or visit this page
Then, clone the repo.
In the project root, run uv sync to install the dependencies.
To run a HFDS simulation:
-
Enter you parameters in
HFDS/params_dict_ViT.json. The dictionary keys take the formLxxLy_PBCx_PBCywhereLxis the horizontal size of the square latticeLyis the vertical size of the square lattice, andPBCx,PBCyare the boundary conditions. For example,4x4_OBC_PBCis used to simulate a$4\times4$ square lattice with open boundary conditions in the horizontal direction and periodic boundary conditions in the vertical direction. -
In the terminal, from the root, do
cd HFDSthenuv run main_ViT_HFDS.py "key" "suffix", wherekeyis the dictionnary key from the previous step andsuffixis used to add a suffix to end of log files. For no suffix, use"". For example,uv run main_ViT_HFDS.py "4x4_OBC_PBC" "". -
At the end of the script, 3 files are produced: one ending with
extras.logwhich contains the hyperparameters and the runtime, one with.logcontaining the energy, variance and mcmc quantities and one ending in.mpackwhich contains the saved variational parameters.
To run a Backflow simulation:
-
Enter your parameters in
BackFlow_ViT/params_dict_backflow.json. The keys use the sameLxLy_PBCx_PBCypattern as HFDS. -
From the project root, run
uv run BackFlow_ViT/main_Backflow.py "key" "suffix", wherekeyselects the dictionary entry andsuffixis appended to the output filename. For no suffix, use"". For example,uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "". -
The script writes three kinds of outputs in
BackFlow_ViT/results/<key>/: anextras.logfile with hyperparameters and runtime, a.logfile with NetKet training statistics, and a.mpackfile with the saved variational parameters. Ifcalculate_obs_at_endis true, it also saves the hole density, staggered spin, and spin-spin correlation arrays.
Some examples:
uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "unsymmetrized" --update symmetry_strategy unsymmetrized --update n_epochs 500 calculate_obs_at_end true
uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "net_ti" --update symmetry_strategy network_translation --update n_epochs 500 calculate_obs_at_end true
uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "sg_trick" --update symmetry_strategy network_space_group_trick --update n_epochs 500 calculate_obs_at_end true
uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "full_sg" --update symmetry_strategy full_symmexp_space_group --update character_id 0 --update n_epochs 500 calculate_obs_at_end true
uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "spinflip" --update symmetry_strategy network_translation_spin_flip --update n_epochs 500 calculate_obs_at_end true
uv run BackFlow_ViT/main_Backflow.py "4x4_PBC_PBC" "spinflip-legacy" --update translation_invariant true --update enforce_spin_flip true --update n_epochs 500 calculate_obs_at_end true