Skip to content

Commit ded883a

Browse files
github-actions[bot]CompatHelper JuliapbrehmerlkdvosYue-Zhengyuan
authored
Updates for compatibility with TensorKit v0.15 (#270)
* CompatHelper: bump compat for TensorKit to 0.15, (keep existing compat) * Rename `TruncationScheme` to `TruncationStrategy` * Lower SVD broadening test tolerance * Replace TensorKit's SDD and SVD * Update all occurences of `tsvd`, `eigh`, `leftorth` and `rightorth` to new interface * Use `svd_vals` instead of `svd_compact` Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Use some more `svd_vals` * Remove old TensorKit (internal) functions from src/utility/svd.jl and update with new MAK functions * Remove some more old TensorKit * Fix TruncationSpace problems * Readd TensorKit internal functions for IterSVD computation * Fix SVD running issues * Fix CTMRG flavors test * Formatting * Fix `truncerror` errors * Fix `_svd_trunc!` for `FixedSVD` * Enforce non-dualness of truncspaces * Make clust bond truncation tests runnable again and fix more dual truncspaces * Remove accidental TensorKitSectors * Formatting * Remove asserts no longer necessary * Fix `qr/lq_through` * Replace `dual(V)` by `flip(V)` in SU FixedSpaceTruncation * Use `flip` to flip spaces * Forbid dual environment spaces * Drop TensorKit v0.14 * Remove dual env spaces from tests * Fix LAPACK algorithm call error * Fix typos * Add hacky computation for truncation error in _svd_trunc! * Fix small typo * Apply truncation error suggestion * (Temporary?) workaround for duality check * Ignore crashing `svd_vals` derivatives * Improve duality checking for environment virtual spaces * Use wts as initialization for 3-site SU env * Replace all occurences of `trscheme` by `trunc` * Fix VUMPS test * Remove explicit `truncrank` and `trunctol` import * Remove the rest as well * Return r, l only from `qr/lq_through` * Restore parametrized inner `CTMRGEnv` constructor, move version with spacechecks to outer constructor --------- Co-authored-by: CompatHelper Julia <compathelper_noreply@julialang.org> Co-authored-by: Paul Brehmer <paul.brehmer@univie.ac.at> Co-authored-by: Paul Brehmer <paulbrehmer8@googlemail.com> Co-authored-by: Lukas Devos <ldevos98@gmail.com> Co-authored-by: Yue Zhengyuan <yuezy1997@icloud.com> Co-authored-by: leburgel <lander.burgelman@gmail.com>
1 parent 8d1224d commit ded883a

58 files changed

Lines changed: 892 additions & 831 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1414
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
1515
MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502"
1616
MPSKitModels = "ca635005-6f8c-4cd1-b51d-8491250ef2ab"
17+
MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4"
1718
OhMyThreads = "67456a42-1dca-4109-a031-0a68de7e3ad5"
1819
OptimKit = "77e91f04-9b3b-57a6-a776-40b61faaebe0"
1920
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
@@ -35,13 +36,14 @@ LinearAlgebra = "1"
3536
LoggingExtras = "1"
3637
MPSKit = "0.13.7"
3738
MPSKitModels = "0.4"
39+
MatrixAlgebraKit = "0.5.0"
3840
OhMyThreads = "0.7, 0.8"
3941
OptimKit = "0.3, 0.4"
4042
Printf = "1"
4143
QuadGK = "2.11.1"
4244
Random = "1"
4345
Statistics = "1"
44-
TensorKit = "0.14.9"
46+
TensorKit = "0.15"
4547
TensorOperations = "5"
4648
TestExtras = "0.3"
4749
VectorInterface = "0.4, 0.5"

docs/src/examples/bose_hubbard/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ When running PEPS simulations with explicit internal symmetries, specifying the
7777
the virtual spaces of the PEPS and its environment becomes a bit more involved. For the
7878
environment, one could in principle allow the virtual space to be chosen dynamically during
7979
the boundary contraction using CTMRG by using a truncation scheme that allows for this
80-
(e.g. using `alg=:truncdim` or `alg=:truncbelow` to truncate to a fixed total bond dimension
80+
(e.g. using `alg=:truncrank` or `alg=:trunctol` to truncate to a fixed total bond dimension
8181
or singular value cutoff respectively). For the PEPS virtual space however, the structure
8282
has to be specified before the optimization.
8383

@@ -99,7 +99,7 @@ optimization framework in the usual way to find the ground state. So, we first s
9999
algorithms and their tolerances:
100100

101101
````julia
102-
boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trscheme = (; alg = :fixedspace))
102+
boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace))
103103
gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :eigsolver, iterscheme = :diffgauge)
104104
optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2);
105105
````
Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"cells": [
33
{
4-
"outputs": [],
54
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
68
"source": [
79
"using Markdown #hide"
8-
],
9-
"metadata": {},
10-
"execution_count": null
10+
]
1111
},
1212
{
1313
"cell_type": "markdown",
14+
"metadata": {},
1415
"source": [
1516
"# Optimizing the $U(1)$-symmetric Bose-Hubbard model\n",
1617
"\n",
@@ -21,23 +22,23 @@
2122
"environment - made possible through TensorKit.\n",
2223
"\n",
2324
"But first let's seed the RNG and import the required modules:"
24-
],
25-
"metadata": {}
25+
]
2626
},
2727
{
28-
"outputs": [],
2928
"cell_type": "code",
29+
"execution_count": null,
30+
"metadata": {},
31+
"outputs": [],
3032
"source": [
3133
"using Random\n",
3234
"using TensorKit, PEPSKit\n",
3335
"using MPSKit: add_physical_charge\n",
3436
"Random.seed!(2928528935);"
35-
],
36-
"metadata": {},
37-
"execution_count": null
37+
]
3838
},
3939
{
4040
"cell_type": "markdown",
41+
"metadata": {},
4142
"source": [
4243
"## Defining the model\n",
4344
"\n",
@@ -48,62 +49,62 @@
4849
"ground state to be well approximated by a PEPS with a manifest global $U(1)$ symmetry.\n",
4950
"Furthermore, we'll impose a cutoff at 2 bosons per site, set the chemical potential to zero\n",
5051
"and use a simple $1 \\times 1$ unit cell:"
51-
],
52-
"metadata": {}
52+
]
5353
},
5454
{
55-
"outputs": [],
5655
"cell_type": "code",
56+
"execution_count": null,
57+
"metadata": {},
58+
"outputs": [],
5759
"source": [
5860
"t = 1.0\n",
5961
"U = 30.0\n",
6062
"cutoff = 2\n",
6163
"mu = 0.0\n",
6264
"lattice = InfiniteSquare(1, 1);"
63-
],
64-
"metadata": {},
65-
"execution_count": null
65+
]
6666
},
6767
{
6868
"cell_type": "markdown",
69+
"metadata": {},
6970
"source": [
7071
"Next, we impose an explicit global $U(1)$ symmetry as well as a fixed particle number\n",
7172
"density in our simulations. We can do this by setting the `symmetry` argument of the\n",
7273
"Hamiltonian constructor to `U1Irrep` and passing one as the particle number density\n",
7374
"keyword argument `n`:"
74-
],
75-
"metadata": {}
75+
]
7676
},
7777
{
78-
"outputs": [],
7978
"cell_type": "code",
79+
"execution_count": null,
80+
"metadata": {},
81+
"outputs": [],
8082
"source": [
8183
"symmetry = U1Irrep\n",
8284
"n = 1\n",
8385
"H = bose_hubbard_model(ComplexF64, symmetry, lattice; cutoff, t, U, n);"
84-
],
85-
"metadata": {},
86-
"execution_count": null
86+
]
8787
},
8888
{
8989
"cell_type": "markdown",
90+
"metadata": {},
9091
"source": [
9192
"Before we continue, it might be interesting to inspect the corresponding lattice physical\n",
9293
"spaces (which is here just a $1 \\times 1$ matrix due to the single-site unit cell):"
93-
],
94-
"metadata": {}
94+
]
9595
},
9696
{
97-
"outputs": [],
9897
"cell_type": "code",
98+
"execution_count": null,
99+
"metadata": {},
100+
"outputs": [],
99101
"source": [
100102
"physical_spaces = physicalspace(H)"
101-
],
102-
"metadata": {},
103-
"execution_count": null
103+
]
104104
},
105105
{
106106
"cell_type": "markdown",
107+
"metadata": {},
107108
"source": [
108109
"Note that the physical space contains $U(1)$ charges -1, 0 and +1. Indeed, imposing a\n",
109110
"particle number density of +1 corresponds to shifting the physical charges by -1 to\n",
@@ -117,7 +118,7 @@
117118
"the virtual spaces of the PEPS and its environment becomes a bit more involved. For the\n",
118119
"environment, one could in principle allow the virtual space to be chosen dynamically during\n",
119120
"the boundary contraction using CTMRG by using a truncation scheme that allows for this\n",
120-
"(e.g. using `alg=:truncdim` or `alg=:truncbelow` to truncate to a fixed total bond dimension\n",
121+
"(e.g. using `alg=:truncrank` or `alg=:trunctol` to truncate to a fixed total bond dimension\n",
121122
"or singular value cutoff respectively). For the PEPS virtual space however, the structure\n",
122123
"has to be specified before the optimization.\n",
123124
"\n",
@@ -126,43 +127,43 @@
126127
"with a model at unit filling our physical space only contains integer $U(1)$ irreps.\n",
127128
"Therefore, we'll build our PEPS and environment spaces using integer $U(1)$ irreps centered\n",
128129
"around the zero charge:"
129-
],
130-
"metadata": {}
130+
]
131131
},
132132
{
133-
"outputs": [],
134133
"cell_type": "code",
134+
"execution_count": null,
135+
"metadata": {},
136+
"outputs": [],
135137
"source": [
136138
"V_peps = U1Space(0 => 2, 1 => 1, -1 => 1)\n",
137139
"V_env = U1Space(0 => 6, 1 => 4, -1 => 4, 2 => 2, -2 => 2);"
138-
],
139-
"metadata": {},
140-
"execution_count": null
140+
]
141141
},
142142
{
143143
"cell_type": "markdown",
144+
"metadata": {},
144145
"source": [
145146
"## Finding the ground state\n",
146147
"\n",
147148
"Having defined our Hamiltonian and spaces, it is just a matter of plugging this into the\n",
148149
"optimization framework in the usual way to find the ground state. So, we first specify all\n",
149150
"algorithms and their tolerances:"
150-
],
151-
"metadata": {}
151+
]
152152
},
153153
{
154-
"outputs": [],
155154
"cell_type": "code",
155+
"execution_count": null,
156+
"metadata": {},
157+
"outputs": [],
156158
"source": [
157-
"boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trscheme = (; alg = :fixedspace))\n",
159+
"boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace))\n",
158160
"gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :eigsolver, iterscheme = :diffgauge)\n",
159161
"optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2);"
160-
],
161-
"metadata": {},
162-
"execution_count": null
162+
]
163163
},
164164
{
165165
"cell_type": "markdown",
166+
"metadata": {},
166167
"source": [
167168
"!!! note\n",
168169
"\tTaking CTMRG gradients and optimizing symmetric tensors tends to be more problematic\n",
@@ -179,81 +180,80 @@
179180
"\n",
180181
"Keep in mind that the PEPS is constructed from a unit cell of spaces, so we have to make a\n",
181182
"matrix of `V_peps` spaces:"
182-
],
183-
"metadata": {}
183+
]
184184
},
185185
{
186-
"outputs": [],
187186
"cell_type": "code",
187+
"execution_count": null,
188+
"metadata": {},
189+
"outputs": [],
188190
"source": [
189191
"virtual_spaces = fill(V_peps, size(lattice)...)\n",
190192
"peps₀ = InfinitePEPS(randn, ComplexF64, physical_spaces, virtual_spaces)\n",
191193
"env₀, = leading_boundary(CTMRGEnv(peps₀, V_env), peps₀; boundary_alg...);"
192-
],
193-
"metadata": {},
194-
"execution_count": null
194+
]
195195
},
196196
{
197197
"cell_type": "markdown",
198+
"metadata": {},
198199
"source": [
199200
"And at last, we optimize (which might take a bit):"
200-
],
201-
"metadata": {}
201+
]
202202
},
203203
{
204-
"outputs": [],
205204
"cell_type": "code",
205+
"execution_count": null,
206+
"metadata": {},
207+
"outputs": [],
206208
"source": [
207209
"peps, env, E, info = fixedpoint(\n",
208210
" H, peps₀, env₀; boundary_alg, gradient_alg, optimizer_alg, verbosity = 3\n",
209211
")\n",
210212
"@show E;"
211-
],
212-
"metadata": {},
213-
"execution_count": null
213+
]
214214
},
215215
{
216216
"cell_type": "markdown",
217+
"metadata": {},
217218
"source": [
218219
"We can compare our PEPS result to the energy obtained using a cylinder-MPS calculation\n",
219220
"using a cylinder circumference of $L_y = 7$ and a bond dimension of 446, which yields\n",
220221
"$E = -0.273284888$:"
221-
],
222-
"metadata": {}
222+
]
223223
},
224224
{
225-
"outputs": [],
226225
"cell_type": "code",
226+
"execution_count": null,
227+
"metadata": {},
228+
"outputs": [],
227229
"source": [
228230
"E_ref = -0.273284888\n",
229231
"@show (E - E_ref) / E_ref;"
230-
],
231-
"metadata": {},
232-
"execution_count": null
232+
]
233233
},
234234
{
235235
"cell_type": "markdown",
236+
"metadata": {},
236237
"source": [
237238
"---\n",
238239
"\n",
239240
"*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*"
240-
],
241-
"metadata": {}
241+
]
242242
}
243243
],
244-
"nbformat_minor": 3,
245244
"metadata": {
245+
"kernelspec": {
246+
"display_name": "Julia 1.11.5",
247+
"language": "julia",
248+
"name": "julia-1.11"
249+
},
246250
"language_info": {
247251
"file_extension": ".jl",
248252
"mimetype": "application/julia",
249253
"name": "julia",
250254
"version": "1.11.5"
251-
},
252-
"kernelspec": {
253-
"name": "julia-1.11",
254-
"display_name": "Julia 1.11.5",
255-
"language": "julia"
256255
}
257256
},
258-
"nbformat": 4
257+
"nbformat": 4,
258+
"nbformat_minor": 3
259259
}

docs/src/examples/fermi_hubbard/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Again, the procedure of ground state optimization is very similar to before. Fir
8181
define all algorithmic parameters:
8282

8383
````julia
84-
boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trscheme = (; alg = :fixedspace))
84+
boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace))
8585
gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :diffgauge)
8686
optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3)
8787
````

0 commit comments

Comments
 (0)