-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWilsonLoopExperiment.cpp
120 lines (99 loc) · 3.53 KB
/
WilsonLoopExperiment.cpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// A program to simulate the Ising and (1,d-1) codes on a D-dimensional Hypercube
// Roger Melko, June 8, 2013
//
// Requires BOOST multi_array: http://www.boost.org
// compile example: g++ -O3 IsingMonteCarlo.cpp -I /opt/local/include/
//
#include <iostream>
#include <vector>
using namespace std;
#include <boost/multi_array.hpp>
#include "hypercube.h"
#include "MersenneTwister.h"
#include "simparam.h"
#include "generalD_1_2.code.h"
//#include "isingHamiltonian.h"
#include "measure.h"
#include "percolation.h"
int main ( int argc, char *argv[] )
{
//A different command line argument for each simulation
int seed_add = 0;
// if ( argc != 2 ){
// cout<<"usage: "<< argv[0] <<" integer \n";
// return 1;
// }
// else {
// seed_add = strtol(argv[1], NULL, 10);
// }
//First, we call several constructors for the various objects used
PARAMS param; //read parameter file: L, D, T, etc. See param.data
double H = param.H_;
double T = param.Temp_;
MTRand mrand(param.SEED_+seed_add); //random number generator
HyperCube cube(param.nX_,param.Dim_); //initialize the lattice
//define the Ising variables +1 or -1
Spins sigma; //Assign number of spins in the Hamiltonian below
GeneralD12Code hamil(sigma,cube,param.H_); //toric code
//--
//sigma.flip(1);
//cout<<hamil.CalcEnergyDiff(sigma,1,param.H_)<<" ";
//cout<<hamil.CalcEnergy(sigma,param.H_)<<endl;
//sigma.print();
//hamil.GaugeUpdate(sigma,T,mrand,H);
//hamil.PreparePercolation(sigma,cube); //for D>2 toric code percolation only
Measure accum(hamil.N1,param); //toric code
for (T = param.Temp_; T<param.Tlow_; T+=param.Tstep_){ //up
//Equilibriation
//for (int i=0; i<param.EQL_; i++) {
// hamil.LocalUpdate(sigma,T,mrand,H);
//}
//MCS binning
for (int k=0; k<param.nBin_; k++){
accum.zero();
for (int i=0; i<param.MCS_; i++){
hamil.LocalUpdate(sigma,T,mrand,H);
hamil.GaugeUpdate(sigma,T,mrand,H);
accum.record(hamil.Energy,sigma,hamil.WilsonLoops);
//accum.outputWilsonLoop(sigma,hamil.WilsonLoops,seed_add);
}//i
accum.output(T,H,seed_add);
}//k
}//T up
//Stationary...
//Equilibriation
//for (int i=0; i<param.EQL_; i++) {
// hamil.LocalUpdate(sigma,T,mrand);
//}
//MCS binning
for (int k=0; k<param.nBin_; k++){
accum.zero();
for (int i=0; i<param.MCS_; i++){
hamil.LocalUpdate(sigma,T,mrand,H);
hamil.GaugeUpdate(sigma,T,mrand,H);
accum.record(hamil.Energy,sigma,hamil.WilsonLoops);
accum.outputWilsonLoop(sigma,hamil.WilsonLoops,seed_add);
}//i
accum.output(T,H,seed_add);
}//k
//down
for (T = param.Tlow_; T>param.Temp_; T-=param.Tstep_){ //up
//Equilibriation
//for (int i=0; i<param.EQL_; i++) {
// hamil.LocalUpdate(sigma,T,mrand);
//}
//MCS binning
for (int k=0; k<param.nBin_; k++){
accum.zero();
for (int i=0; i<param.MCS_; i++){
hamil.LocalUpdate(sigma,T,mrand,H);
hamil.GaugeUpdate(sigma,T,mrand,H);
accum.record(hamil.Energy,sigma,hamil.WilsonLoops);
//accum.outputWilsonLoop(sigma,hamil.WilsonLoops,seed_add);
}//i
accum.output(T,H,seed_add);
}//k
}//T up
//accum.outputWilsonLoop(sigma,hamil.WilsonLoops,seed_add);
return 0;
}