|
@@ -6,7 +6,7 @@ Copyright (c) J.-S. Caux
|
6
|
6
|
|
7
|
7
|
-----------------------------------------------------------
|
8
|
8
|
|
9
|
|
-File: ABACUS+_Usage_Example_Heis.cc
|
|
9
|
+File: ABACUS_Usage_Example_Heis.cc
|
10
|
10
|
|
11
|
11
|
Purpose: illustrates basic use of ABACUS for spin chains.
|
12
|
12
|
|
|
@@ -22,20 +22,21 @@ int main()
|
22
|
22
|
{
|
23
|
23
|
clock_t StartTime = clock();
|
24
|
24
|
|
25
|
|
- // Refer to include/JSC_Heis.h for all class definitions
|
|
25
|
+ // Refer to include/ABACUS_Heis.h for all class definitions
|
26
|
26
|
// and to src/HEIS/ for the actual implementations.
|
27
|
27
|
|
28
|
28
|
// Set basic system parameters:
|
29
|
29
|
DP Delta = 1.0; // anisotropy
|
30
|
30
|
int N = 64; // chain length
|
31
|
|
- int M = 32; // number of downturned spins as compared to all spins up; must be <= N/2 (on or above equator)
|
|
31
|
+ int M = 32; // number of downturned spins; must be <= N/2 (on or above equator)
|
32
|
32
|
|
33
|
33
|
// Define the chain: J, Delta, h, Nsites
|
34
|
34
|
Heis_Chain chain(1.0, Delta, 0.0, N);
|
35
|
35
|
|
36
|
36
|
// The Heis_Chain class so constructed contains information about all types of strings:
|
37
|
37
|
cout << "Delta = " << Delta << endl << "Possible string lengths and parities: ";
|
38
|
|
- for (int j = 0; j < chain.Nstrings; ++j) cout << "(" << chain.Str_L[j] << ", " << chain.par[j] << ")" << "\t";
|
|
38
|
+ for (int j = 0; j < chain.Nstrings; ++j)
|
|
39
|
+ cout << "(" << chain.Str_L[j] << ", " << chain.par[j] << ")" << "\t";
|
39
|
40
|
cout << endl;
|
40
|
41
|
|
41
|
42
|
|
|
@@ -64,22 +65,26 @@ int main()
|
64
|
65
|
// Now define some excited state.
|
65
|
66
|
|
66
|
67
|
// First method:
|
67
|
|
- // Start with defining a base using a base constructor with a vector of numbers of rapidities of each type as argument:
|
|
68
|
+ // Start with defining a base using a base constructor with a vector of
|
|
69
|
+ // numbers of rapidities of each type as argument:
|
68
|
70
|
// First define Nrapidities vector:
|
69
|
71
|
Vect<int> Nrapidities(0, chain.Nstrings);
|
70
|
|
- // Assigning the numbers that follow, you have to ensure (yourself!) the \sum_j M_j n_j = M (where n_j is the length of type j).
|
|
72
|
+ // Assigning the numbers that follow, you have to ensure (yourself!) that
|
|
73
|
+ // the \sum_j M_j n_j = M (where n_j is the length of type j).
|
71
|
74
|
Nrapidities[0] = M-2; // number of one-strings
|
72
|
75
|
Nrapidities[1] = 1; // one two-string
|
73
|
76
|
// Define the base:
|
74
|
77
|
Heis_Base ebase(chain, Nrapidities);
|
75
|
78
|
// Once the base is defined, the limiting quantum numbers are automatically computed:
|
76
|
79
|
cout << "ebase defined, data is (Mdown, Nrap, Nraptot, Ix2_infty, Ix2_min, Ix2_max, baselabel):"
|
77
|
|
- << ebase.Mdown << endl << ebase.Nrap << endl << ebase.Nraptot << endl << ebase.Ix2_infty << endl
|
|
80
|
+ << ebase.Mdown << endl << ebase.Nrap << endl << ebase.Nraptot << endl
|
|
81
|
+ << ebase.Ix2_infty << endl
|
78
|
82
|
<< ebase.Ix2_min << endl << ebase.Ix2_max << endl << ebase.baselabel << endl;
|
79
|
83
|
|
80
|
84
|
// An excited state can then be defined using this new base:
|
81
|
85
|
XXX_Bethe_State estate(chain, ebase);
|
82
|
|
- // Individual quantum numbers can be manipulated: this will NOT update the state label or verify range of Ix2
|
|
86
|
+ // Individual quantum numbers can be manipulated: this will NOT update the
|
|
87
|
+ // state label or verify range of Ix2
|
83
|
88
|
estate.Ix2[0][0] = M+1;
|
84
|
89
|
estate.Compute_All(true);
|
85
|
90
|
cout << endl << "estate: " << estate << endl;
|
|
@@ -91,11 +96,12 @@ int main()
|
91
|
96
|
|
92
|
97
|
|
93
|
98
|
// Construct a new Bethe state
|
94
|
|
- XXX_Bethe_State estateref (chain, ebase2); // this will contain the lowest-energy quantum numbers for this base
|
|
99
|
+ XXX_Bethe_State estateref (chain, ebase2); // defaults to the lowest-energy state for this base
|
95
|
100
|
XXX_Bethe_State estate2 (chain, ebase2); // yet another state
|
96
|
101
|
|
97
|
102
|
// Setting a state to a given label:
|
98
|
|
- estate2.Set_to_Label ("31_1_nh", estateref.Ix2); // The base of estate must coincide with the base in the label. Label is relative to estateref.Ix2
|
|
103
|
+ // The base of estate must coincide with the base in label. Label is relative to estateref.Ix2.
|
|
104
|
+ estate2.Set_to_Label ("31_1_nh", estateref.Ix2);
|
99
|
105
|
estate2.Compute_All(true);
|
100
|
106
|
cout << "estate2: " << estate2 << endl;
|
101
|
107
|
|
|
@@ -106,7 +112,8 @@ int main()
|
106
|
112
|
cout << "Excitation momentum (mod 2 pi) = estate.K - gstate.K = " << estate.K - gstate.K << endl;
|
107
|
113
|
|
108
|
114
|
|
109
|
|
- // Computing matrix elements: CAREFUL: magnetizations must be consistent with operator (error is flagged).
|
|
115
|
+ // Computing matrix elements:
|
|
116
|
+ // CAREFUL: magnetizations must be consistent with operator (error is flagged).
|
110
|
117
|
cout << "Matrix elements: " << endl;
|
111
|
118
|
// The logarithm of the matrix elements are computed as complex numbers:
|
112
|
119
|
cout << "ln_Sz (gstate, estate) = " << ln_Sz_ME (gstate, estate) << endl;
|