Skip to content

Commit

Permalink
split part of df trotter tutorial into explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Apr 26, 2024
1 parent 4fd1144 commit 0badd88
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 129 deletions.
123 changes: 123 additions & 0 deletions docs/explanations/double-factorized.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Double-factorized representation of the molecular Hamiltonian\n",
"\n",
"This page discusses the double-factorized representation of the molecular Hamiltonian.\n",
"\n",
"## Double-factorized representation\n",
"\n",
"The molecular Hamiltonian is commonly written in the form\n",
"\n",
"$$\n",
" H = \\sum_{\\sigma, pq} h_{pq} a^\\dagger_{\\sigma, p} a_{\\sigma, q}\n",
" + \\frac12 \\sum_{\\sigma \\tau, pqrs} h_{pqrs}\n",
" a^\\dagger_{\\sigma, p} a^\\dagger_{\\tau, r} a_{\\tau, s} a_{\\sigma, q}\n",
" + \\text{constant}.\n",
"$$\n",
"\n",
"This representation of the Hamiltonian is daunting for quantum simulations because the number of terms in the two-body part scales as $N^4$ where $N$ is the number of spatial orbitals. An alternative representation can be obtained by performing a \"double-factorization\" of the two-body tensor $h_{pqrs}$:\n",
"\n",
"$$\n",
" H = \\sum_{\\sigma, pq} h'_{pq} a^\\dagger_{\\sigma, p} a_{\\sigma, q}\n",
" + \\sum_{k=1}^L \\mathcal{W}_k \\mathcal{J}_k \\mathcal{W}_k^\\dagger\n",
" + \\text{constant}'.\n",
"$$\n",
"\n",
"Here each $\\mathcal{W}_k$ is an [orbital rotation](orbital-rotation.ipynb) and each $\\mathcal{J}_k$ is a so-called diagonal Coulomb operator of the form\n",
"\n",
"$$\n",
" \\mathcal{J} = \\frac12\\sum_{\\sigma \\tau, ij} \\mathbf{J}_{ij} n_{\\sigma, i} n_{\\tau, j},\n",
"$$\n",
"\n",
"where $n_{\\sigma, i} = a^\\dagger_{\\sigma, i} a_{\\sigma, i}$ is the occupation number operator and $\\mathbf{J}_{ij}$ is a real symmetric matrix. The one-body tensor and the constant have been updated to accomodate extra terms that arise from reordering fermionic ladder operators.\n",
"\n",
"For an exact factorization, $L$ is proportional to $N^2$. However, the two-body tensor often has low-rank structure, and the decomposition can be truncated while still maintaining an accurate representation. Thus, in practice, $L$ often scales only linearly with $N$, resulting in a much more compact representation that gives rise to more efficient schemes for simulating and measuring the Hamiltonian, which utilize efficient quantum circuits for orbital rotations and time evolution by a diagonal Coulomb operator.\n",
"\n",
"## Application to time evolution via Trotter-Suzuki formulas\n",
"\n",
"In this section, we discuss how the double-factorized Hamiltonian can be simulated using Trotter-Suzuki formulas.\n",
"\n",
"### Brief background on Trotter-Suzuki formulas\n",
"\n",
"Trotter-Suzuki formulas are used to approximate time evolution by a Hamiltonian $H$ which is decomposed as a sum of terms:\n",
"\n",
"$$\n",
"H = \\sum_k H_k.\n",
"$$\n",
"\n",
"Time evolution by time $t$ is given by the unitary operator\n",
"\n",
"$$\n",
"e^{i H t}.\n",
"$$\n",
"\n",
"To approximate this operator, the total evolution time is first divided into a number of smaller time steps, called \"Trotter steps\":\n",
"\n",
"$$\n",
"e^{i H t} = (e^{i H t / r})^r.\n",
"$$\n",
"\n",
"The time evolution for a single Trotter step is then approximated using a product formula, which approximates the exponential of a sum of terms by a product of exponentials of the individual terms. The formulas are approximate because the terms do not in general commute. A first-order asymmetric product formula has the form\n",
"\n",
"$$\n",
"e^{i H \\tau} \\approx \\prod_k e^{i H_k \\tau}.\n",
"$$\n",
"\n",
"Higher-order formulas can be derived which yield better approximations.\n",
"\n",
"### Application to the double-factorized Hamiltonian\n",
"\n",
"Using the double-factorized representation, the Hamiltonian is decomposed into $L+1$ terms (ignoring the constant term),\n",
"\n",
"$$\n",
"H = \\sum_{k=0}^L H_k,\n",
"$$\n",
"\n",
"where\n",
"\n",
"$$\n",
"H_0 = \\sum_{\\sigma, pq} h'_{pq} a^\\dagger_{\\sigma, p} a_{\\sigma, q}\n",
"$$\n",
"\n",
"and for $k = 1, \\ldots, L$,\n",
"\n",
"$$\n",
"H_k = \\mathcal{W}_k \\mathcal{J}_k \\mathcal{W}_k^\\dagger.\n",
"$$\n",
"\n",
"We have that\n",
"\n",
"- $H_0$ is a quadratic Hamiltonian and can be simulated as described in [Orbital rotations and quadratic Hamiltonians](orbital-rotation.ipynb#Time-evolution-by-a-quadratic-Hamiltonian), and\n",
"- $H_k$ is a diagonal Coulomb operator (up to an orbital rotation) for $k = 1, \\ldots, L$, and ffsim includes the function [apply_diag_coulomb_evolution](../api/ffsim.rst#ffsim.apply_diag_coulomb_evolution) for simulating time evolution by such an operator.\n",
"\n",
"Given the ability to simulate each of the individual terms, we can implement Trotter-Suzuki formulas for time evolution by the entire Hamiltonian. This is implemented in ffsim by the function [simulate_trotter_double_factorized](../api/ffsim.rst#ffsim.simulate_trotter_double_factorized), which implements higher-order Trotter-Suzuki formulas in addition to the first-order asymmetric formula mentioned previously. The first-order asymmetric formula corresponds to setting the argument `order=0`, which is the default. `order=1` corresponds to the first-order symmetric (commonly known as the second-order) formula, `order=2` corresponds to the second-order symmetric (fourth-order) formula, and so on."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ffsim-1cfkSnAR",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
1 change: 1 addition & 0 deletions docs/explanations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
state-vectors-and-gates
hamiltonians
orbital-rotation
double-factorized
```
Loading

0 comments on commit 0badd88

Please sign in to comment.