Variational Quantum Eigensolver with Fewer Qubits
Branch: master
Clone or download
Latest commit e0110d7 Feb 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
data fix general case Feb 10, 2019
src update docstrings Feb 3, 2019
test update readme Feb 1, 2019
.gitignore add Monifest.toml Feb 2, 2019
CuChem.jl fix GPU Feb 2, 2019
LICENSE polish cmd Jan 31, 2019 update readme Feb 8, 2019
applications.jl fix general case Feb 10, 2019
j1j2.jl fix general case Feb 10, 2019
resolve_env.jl resolve script, no project anymore. Feb 2, 2019


Matrix product state (MPS) inspired quantum circuits ansatz for variational quantum eigensolver (VQE).

Physical Hamiltonian includes: 1D and 2D Heisenberg model, with or without frustration, OBC or PBC.

Circuit Block includes: General, U(1) and SU(2) symmetric ansatz.

Setup Guide

Clone this repository to your local host.

Set up your julia environment

  • julia 1.0+
  • install required julia libraries: Yao, DelimitedFiles, FileIO, Fire, JLD2, KrylovKit and StatsBase. To access GPU, you need the extra packages: CUDAnative, CuArrays and CuYao. They can be resolved by typing
$ julia resolve_env.jl # if a GPU is available
$ julia resolve_env.jl nocuda

Run an Example

As an example, we solve the ground state of frustrated Heisenberg model with J2 = 0.5 on 4 x 4 lattice. to run

$ julia j1j2.jl train --symmetry su2 --depth 1

Here, symmetry and depth are optional parameters to specify symmetry of ansatz and depth of circuit block. The default symmetry is su2 and the default circuit depth is 5. The above training with default setting can be very very slow. With Nvidia Titan V GPU, training can be accelerated by a factor of ~35 comparing with the sequential CPU version, but still takes several hours. Decreasing the circuit depth can also accelerate the training.

You can meaure the correlation function and energy per site using pre-trained model stored in data/

$ julia j1j2.jl measure szsz -- depth 1         # Sz(i)*Sz(j) correlation matrix, default depth is 5.
$ julia j1j2.jl measure energy --symmetry su2   # sample energy expectation value

To get help on input parameters, please type

$ julia j1j2.jl train --help
$ julia j1j2.jl measure --help


  • paper: Variational Quantum Eigensolver with Fewer Qubits (pdf), arXiv:1902.02663, Jin-Guo Liu, Yihong Zhang, Yuan Wan and Lei Wang


You are welcome to use this code for your research. Please kindly cite:

  author = {Jin-Guo Liu, Yi-Hong Zhang, Yuan Wan and Lei Wang},
  title = {Variational Quantum Eigensolver with Fewer Qubits},
  eprint = {arXiv:1902.02663},
  url = {}