Skip to content

Commit b9fdb95

Browse files
leburgellkdvospbrehmerYue-Zhengyuan
authored
Documentation update (#161)
This PR includes a rather large amount of documentation improvements, including but not limited to: - Documentation infrastructure and structure for docstrings etc - Documentation infrastructure for worked out examples - Many docstring improvements - ... --------- Co-authored-by: Lukas Devos <ldevos98@gmail.com> Co-authored-by: Paul Brehmer <paul.brehmer@univie.ac.at> Co-authored-by: Paul Brehmer <paulbrehmer8@googlemail.com> Co-authored-by: Yue Zhengyuan <yuezy1997@icloud.com>
1 parent a431bec commit b9fdb95

97 files changed

Lines changed: 7942 additions & 963 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
8+
concurrency:
9+
group: doc-preview-cleanup
10+
cancel-in-progress: false
11+
12+
jobs:
13+
doc-preview-cleanup:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout gh-pages branch
19+
uses: actions/checkout@v4
20+
with:
21+
ref: gh-pages
22+
- name: Delete preview and history + push changes
23+
run: |
24+
if [ -d "${preview_dir}" ]; then
25+
git config user.name "Documenter.jl"
26+
git config user.email "documenter@juliadocs.github.io"
27+
git rm -rf "${preview_dir}"
28+
git commit -m "delete preview"
29+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
30+
git push --force origin gh-pages-new:gh-pages
31+
fi
32+
env:
33+
preview_dir: previews/PR${{ github.event.number }}

.github/workflows/PR_comment.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Docs preview comment
2+
on:
3+
pull_request:
4+
types: [labeled]
5+
6+
permissions:
7+
pull-requests: write
8+
jobs:
9+
pr_comment:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Create PR comment
13+
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name && github.event.label.name == 'documentation'
14+
uses: thollander/actions-comment-pull-request@v3
15+
with:
16+
message: 'After the build completes, the updated documentation will be available [here](https://quantumkithub.github.io/PEPSKit.jl/previews/PR${{ github.event.number }}/)'
17+
comment-tag: 'preview-doc'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ docs/build
22
Manifest.toml
33
examples/.ipynb_checkpoints
44
.vscode/
5-
.DS_Store
5+
.DS_Store
6+
**/dev/

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version = "0.5.0"
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
88
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
99
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
10+
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1011
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
1112
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
1213
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -27,6 +28,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2728
Accessors = "0.1"
2829
ChainRulesCore = "1.0"
2930
Compat = "3.46, 4.2"
31+
DocStringExtensions = "0.9.3"
3032
FiniteDifferences = "0.12"
3133
KrylovKit = "0.9.5"
3234
LinearAlgebra = "1"

README.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,40 @@ The package can be installed through the Julia general registry, via the package
3030
pkg> add PEPSKit
3131
```
3232

33+
## Key features
34+
35+
- Construction and manipulation of infinite projected entangled-pair states (PEPS)
36+
- Contraction of infinite PEPS using the corner transfer matrix renormalization group (CTMRG) and boundary MPS methods
37+
- Native support for symmetric tensors through [TensorKit](https://github.com/Jutho/TensorKit.jl), including fermionic tensors
38+
- PEPS optimization using automatic differentiation (AD) provided through [Zygote](https://fluxml.ai/Zygote.jl/stable/)
39+
- Imaginary time evolution algorithms
40+
- Support for PEPS with generic unit cells
41+
- Support for classical 2D partition functions and projected entangled-pair operators (PEPOs)
42+
- Extensible system for custom states, operators and algorithms
43+
3344
## Quickstart
3445

3546
After following the installation process, it should now be possible to load the packages and start simulating.
36-
For example, in order to obtain the groundstate of the 2D Heisenberg model, we can use the following code:
47+
For example, in order to obtain the ground state of the 2D Heisenberg model, we can use the following code:
3748

3849
```julia
39-
using TensorKit, PEPSKit, KrylovKit, OptimKit
50+
using TensorKit, PEPSKit
4051

4152
# construct the Hamiltonian
42-
H = heisenberg_XYZ(InfiniteSquare(); Jx=-1, Jy=1, Jz=-1) # sublattice rotation to obtain single-site unit cell
53+
H = heisenberg_XYZ(InfiniteSquare())
4354

44-
# choose the bond dimensions
55+
# configure the parameters
4556
D = 2
46-
chi = 20
47-
48-
# configure the algorithm parameters
49-
boundary_alg = (;
50-
alg=:simultaneous, tol=1e-10, verbosity=2, trscheme=(; alg=:truncdim, η=chi)
51-
)
52-
optimizer_alg = (; alg=:lbfgs, tol=1e-4, verbosity=3)
53-
gradient_alg = (; alg=:linsolver)
54-
reuse_env = true
55-
56-
# and find the ground state
57-
state = InfinitePEPS(2, D)
58-
env0, = leading_boundary(CTMRGEnv(state, ComplexSpace(chi)), state; boundary_alg...)
59-
peps, env, E, = fixedpoint(
60-
H, state, env0; boundary_alg, optimizer_alg, gradient_alg, reuse_env
61-
)
57+
χ = 20
58+
ctmrg_tol = 1e-10
59+
grad_tol = 1e-4
60+
61+
# initialize a PEPS and CTMRG environment
62+
peps₀ = InfinitePEPS(2, D)
63+
env₀, = leading_boundary(CTMRGEnv(peps₀, ComplexSpace(χ)), peps₀; tol=ctmrg_tol)
64+
65+
# ground state search
66+
peps, env, E, = fixedpoint(H, peps₀, env₀; tol=grad_tol, boundary_alg=(; tol=ctmrg_tol))
6267

6368
@show E # -0.6625...
6469
```

docs/Project.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
4+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
5+
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
6+
MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502"
7+
MPSKitModels = "ca635005-6f8c-4cd1-b51d-8491250ef2ab"
38
PEPSKit = "52969e89-939e-4361-9b68-9bc7cde4bdeb"
9+
TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
410

511
[compat]
6-
Documenter = "0.27"
12+
Documenter = "1.0"

docs/make.jl

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,78 @@
1+
# if docs is not the current active environment, switch to it
2+
if Base.active_project() != joinpath(@__DIR__, "Project.toml")
3+
using Pkg
4+
Pkg.activate(@__DIR__)
5+
Pkg.develop(PackageSpec(; path=joinpath(@__DIR__, "..")))
6+
Pkg.resolve()
7+
Pkg.instantiate()
8+
end
9+
110
using Documenter
11+
using DocumenterCitations
12+
using DocumenterInterLinks
213
using PEPSKit
14+
using MPSKitModels: MPSKitModels # used for docstrings
15+
16+
# bibliography
17+
bibpath = joinpath(@__DIR__, "src", "assets", "pepskit.bib")
18+
bib = CitationBibliography(bibpath; style=:authoryear)
19+
20+
# interlinks
21+
# Zygote didn't update to documenter v1 yet...
22+
links = InterLinks(
23+
"TensorKit" => "https://jutho.github.io/TensorKit.jl/stable/",
24+
"KrylovKit" => "https://jutho.github.io/KrylovKit.jl/stable/",
25+
"MPSKit" => "https://quantumkithub.github.io/MPSKit.jl/stable/",
26+
"MPSKitModels" => "https://quantumkithub.github.io/MPSKitModels.jl/dev/",
27+
# "Zygote" => "https://fluxml.ai/Zygote.jl/stable/",
28+
"ChainRulesCore" => "https://juliadiff.org/ChainRulesCore.jl/stable/",
29+
)
30+
31+
# explicitly set math engine
32+
mathengine = MathJax3(
33+
Dict(
34+
:loader => Dict("load" => ["[tex]/physics"]),
35+
:tex => Dict(
36+
"inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
37+
"tags" => "ams",
38+
"packages" => ["base", "ams", "autoload", "physics"],
39+
),
40+
),
41+
)
42+
43+
# examples pages
44+
examples_optimization =
45+
joinpath.(["heisenberg", "bose_hubbard", "xxz", "fermi_hubbard"], Ref("index.md"))
46+
examples_time_evolution = joinpath.(["heisenberg_su", "hubbard_su"], Ref("index.md"))
47+
examples_partition_functions =
48+
joinpath.(
49+
["2d_ising_partition_function", "3d_ising_partition_function"], Ref("index.md")
50+
)
51+
examples_boundary_mps = joinpath.(["boundary_mps"], Ref("index.md"))
352

453
makedocs(;
5-
modules=[PEPSKit],
54+
modules=[PEPSKit, MPSKitModels],
655
sitename="PEPSKit.jl",
756
format=Documenter.HTML(;
8-
prettyurls=get(ENV, "CI", nothing) == "true",
9-
mathengine=MathJax3(
10-
Dict(
11-
:loader => Dict("load" => ["[tex]/physics"]),
12-
:tex => Dict(
13-
"inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
14-
"tags" => "ams",
15-
"packages" => ["base", "ams", "autoload", "physics"],
16-
),
17-
),
18-
),
57+
prettyurls=get(ENV, "CI", nothing) == "true", mathengine, size_threshold=1024000
1958
),
2059
pages=[
2160
"Home" => "index.md",
22-
"Manual" => "man/intro.md",
23-
"Examples" => "examples/index.md",
61+
"Manual" => ["man/models.md", "man/multithreading.md", "man/precompilation.md"],
62+
"Examples" => [
63+
"examples/index.md",
64+
"Optimization" => joinpath.(Ref("examples"), examples_optimization),
65+
"Time Evolution" => joinpath.(Ref("examples"), examples_time_evolution),
66+
"Partition Functions" =>
67+
joinpath.(Ref("examples"), examples_partition_functions),
68+
"Boundary MPS" => joinpath.(Ref("examples"), examples_boundary_mps),
69+
],
2470
"Library" => "lib/lib.md",
71+
"References" => "references.md",
2572
],
73+
checkdocs=:none,
74+
# checkdocs_ignored_modules=[MPSKitModels], # doesn't seem to work...
75+
plugins=[bib, links],
2676
)
2777

28-
deploydocs(; repo="https://github.com/QuantumKitHub/PEPSKit.jl.git")
78+
deploydocs(; repo="github.com/QuantumKitHub/PEPSKit.jl.git", push_preview=true)

docs/src/assets/pepskit.bib

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
@article{francuz_stable_2025,
2+
title = {Stable and Efficient Differentiation of Tensor Network Algorithms},
3+
author = {Francuz, Anna and Schuch, Norbert and Vanhecke, Bram},
4+
year = {2025},
5+
month = mar,
6+
journal = {Physical Review Research},
7+
volume = {7},
8+
number = {1},
9+
pages = {013237},
10+
publisher = {American Physical Society},
11+
doi = {10.1103/PhysRevResearch.7.013237}
12+
}
13+
14+
@article{evenbly_gauge_2018,
15+
title = {Gauge fixing, canonical forms, and optimal truncations in tensor networks with closed loops},
16+
author = {Evenbly, Glen},
17+
journal = {Phys. Rev. B},
18+
volume = {98},
19+
issue = {8},
20+
pages = {085155},
21+
numpages = {11},
22+
year = {2018},
23+
month = {Aug},
24+
publisher = {American Physical Society},
25+
doi = {10.1103/PhysRevB.98.085155},
26+
url = {https://link.aps.org/doi/10.1103/PhysRevB.98.085155}
27+
}
28+
29+
@article{sandvik_computational_2011,
30+
author = {Sandvik, Anders W.},
31+
title = {Computational Studies of Quantum Spin Systems},
32+
journal = {AIP Conference Proceedings},
33+
volume = {1297},
34+
number = {1},
35+
pages = {135-338},
36+
year = {2010},
37+
month = {11},
38+
issn = {0094-243X},
39+
doi = {10.1063/1.3518900},
40+
url = {https://doi.org/10.1063/1.3518900}
41+
}
42+
43+
@article{vanderstraeten_residual_2018,
44+
title = {Residual entropies for three-dimensional frustrated spin systems with tensor networks},
45+
author = {Vanderstraeten, Laurens and Vanhecke, Bram and Verstraete, Frank},
46+
journal = {Phys. Rev. E},
47+
volume = {98},
48+
issue = {4},
49+
pages = {042145},
50+
numpages = {8},
51+
year = {2018},
52+
month = {Oct},
53+
publisher = {American Physical Society},
54+
doi = {10.1103/PhysRevE.98.042145},
55+
url = {https://link.aps.org/doi/10.1103/PhysRevE.98.042145}
56+
}
57+
58+
@article{qin_benchmark_2016,
59+
title = {Benchmark study of the two-dimensional Hubbard model with auxiliary-field quantum Monte Carlo method},
60+
author = {Qin, Mingpu and Shi, Hao and Zhang, Shiwei},
61+
journal = {Phys. Rev. B},
62+
volume = {94},
63+
issue = {8},
64+
pages = {085103},
65+
numpages = {12},
66+
year = {2016},
67+
month = {Aug},
68+
publisher = {American Physical Society},
69+
doi = {10.1103/PhysRevB.94.085103},
70+
url = {https://link.aps.org/doi/10.1103/PhysRevB.94.085103}
71+
}
72+
73+
@article{corboz_variational_2016,
74+
title = {Variational optimization with infinite projected entangled-pair states},
75+
author = {Corboz, Philippe},
76+
journal = {Phys. Rev. B},
77+
volume = {94},
78+
issue = {3},
79+
pages = {035133},
80+
numpages = {11},
81+
year = {2016},
82+
month = {Jul},
83+
publisher = {American Physical Society},
84+
doi = {10.1103/PhysRevB.94.035133},
85+
url = {https://link.aps.org/doi/10.1103/PhysRevB.94.035133}
86+
}
87+
88+
@article{haegeman_diagonalizing_2017,
89+
title = {Diagonalizing {{Transfer Matrices}} and {{Matrix Product Operators}}: {{A Medley}} of {{Exact}} and {{Computational Methods}}},
90+
shorttitle = {Diagonalizing {{Transfer Matrices}} and {{Matrix Product Operators}}},
91+
author = {Haegeman, Jutho and Verstraete, Frank},
92+
year = {2017},
93+
journal = {Annual Review of Condensed Matter Physics},
94+
volume = {8},
95+
number = {1},
96+
pages = {355--406},
97+
doi = {10.1146/annurev-conmatphys-031016-025507},
98+
keywords = {Bethe ansatz,entanglement,equilibrium and nonequilibrium statistical physics,fusion tensor categories,many-body physics,quantum spin chains,tensor networks}
99+
}
100+
101+
@article{vanderstraeten_tangentspace_2019,
102+
title = {Tangent-Space Methods for Uniform Matrix Product States},
103+
author = {Vanderstraeten, Laurens and Haegeman, Jutho and Verstraete, Frank},
104+
year = {2019},
105+
month = jan,
106+
journal = {SciPost Physics Lecture Notes},
107+
pages = {007},
108+
issn = {2590-1990},
109+
doi = {10.21468/SciPostPhysLectNotes.7},
110+
langid = {english},
111+
language = {en}
112+
}
113+
114+
@article{hasenbusch_monte_2001,
115+
author = {Hasenbusch, Martin},
116+
title = {Monte Carlo Studies of the Three-Dimensional Ising Model in Equilibrium},
117+
journal = {International Journal of Modern Physics C},
118+
volume = {12},
119+
number = {07},
120+
pages = {911-1009},
121+
year = {2001},
122+
doi = {10.1142/S0129183101002383},
123+
}
124+
125+
@article{vanderstraeten_variational_2022,
126+
title = {Variational Methods for Contracting Projected Entangled-Pair States},
127+
author = {Vanderstraeten, Laurens and Burgelman, Lander and Ponsioen, Boris and Van Damme, Maarten and Vanhecke, Bram and Corboz, Philippe and Haegeman, Jutho and Verstraete, Frank},
128+
year = {2022},
129+
month = may,
130+
journal = {Physical Review B},
131+
volume = {105},
132+
number = {19},
133+
pages = {195140},
134+
publisher = {American Physical Society},
135+
doi = {10.1103/PhysRevB.105.195140}
136+
}

0 commit comments

Comments
 (0)