-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathctmrg.cc
More file actions
60 lines (45 loc) · 1.44 KB
/
ctmrg.cc
File metadata and controls
60 lines (45 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "src/ctmrg.h"
#include "src/ising.h"
#include "itensor/util/print_macro.h"
int
main()
{
Real betac = 0.5 * log(sqrt(2) + 1.0);
Real beta = 1.1 * betac;
int maxdim = 20;
int nsteps = 20;
auto dim0 = 2;
// Define an initial Index making up
// the Ising partition function
auto s = Index(dim0, "Site");
// Define the indices of the scale-0
// Boltzmann weight tensor "A"
auto sh = addTags(s, "horiz");
auto sv = addTags(s, "vert");
auto T = ising(sh, sv, beta);
auto l = Index(1, "Link");
auto lh = addTags(l, "horiz");
auto lv = addTags(l, "vert");
auto Clu0 = ITensor(lv, lh);
Clu0.set(1, 1, 1.0);
auto Al0 = ITensor(lv, prime(lv), sh);
Al0.set(lv = 1, prime(lv) = 1, sh = 1, 1.0);
auto [Clu, Al] = ctmrg(T, Clu0, Al0, maxdim, nsteps);
lv = commonIndex(Clu, Al);
lh = uniqueIndex(Clu, Al);
auto Au = replaceInds(Al, {lv, prime(lv), sh},
{lh, prime(lh), sv});
auto ACl = Al * Clu * dag(prime(Clu));
auto ACTl = prime(ACl * dag(prime(Au)) * T * Au, -1);
auto kappa = elt(ACTl * dag(ACl));
auto Tsz = ising(sh, sv, beta, true);
auto ACTszl = prime(ACl * dag(prime(Au)) * Tsz * Au, -1);
auto m = elt(ACTszl * dag(ACl)) / kappa;
printfln("beta = %.12f", beta);
printfln("beta/betac = %.12f", beta / betac);
println("maxdim = ", maxdim);
println("niters = ", nsteps);
printfln("kappa = %.12f", kappa);
printfln("m = %.12f", m);
return 0;
}