57 {
60
63 double gE, EnergyRange, OpRange, OpMin;
64 double Fluc, MaxFluc, MaxPos;
65
66 if( !Initialize(argc, argv, Nargs_common) ) {
67 std::cerr << "Error: Initialization failed." << std::endl;
68 std::exit(EX_USAGE);
69 }
71
72
73 debug_print(
"# Checking for the directory structure.");
75 std::ofstream OutSample;
76
77
78
79
80
81#ifdef GPU
82 magma_init();
83 magma_queue_t queue = NULL;
84 magma_int_t dev = 0;
85 magma_getdevice( &dev );
86 magma_queue_create( dev, &queue );
87#else
89#endif
90
91
92 debug_print(
"# Calculating translation-invariant sectors.");
96 << "# 1.(Sample No.) 2.(Fluc_2) 3.(Fluc_infty) 4.(Pos_max_flux) 5.(ndata)\n"
97 << std::endl << std::scientific;
98 }
99
100
101
104 std::vector<Integer_t> NdataInShell(dim_max);
105 std::vector<double> eigenEnergy(dim_max);
106 std::vector<double> EXPvalue(dim_max);
107 std::vector<double> MCAverage(dim_max);
110#ifndef GPU
111 matrix<Complex_t> h_tot(dim_max, dim_max);
112 matrix<Complex_t> loc_tot(dim_max, dim_max);
113 #define dh h
114 #define dloc loc
115 #define dh_tot h_tot
116 #define dloc_tot loc_tot
117#endif
118
119
120#ifdef GPU
121
124 Integer_t const LDT = magma_roundup(dim_max, GPU_UNIT);
127 matrix_gpu<Complex_t> dh_tot(LDT, dim_max);
128 matrix_gpu<Complex_t> dloc_tot(LDT, dim_max);
129
130
131
133
134#endif
135
136 double start, t_int, end, temp_t;
137 double T_diag=0, T_post=0, T_pre=0;
138 init_genrand(SEED);
141 generateLocal_h( h,
dloc_h, -1);
142 generateLocal_op(loc,
dloc_op, -1);
143 }
145 std::cout << "(init_genrand): time=" << std::fixed << (end-start) << std::endl;
146
147
148
149
151 end = start;
153
154 generateLocal_h( h,
dloc_h, -1);
155 generateLocal_op(loc,
dloc_op, -1);
156 #ifdef GPU
159 #endif
160
161 if(repetition < 10000) {
163 }
165 debug_print(
"# (rep,n)=(" << repetition <<
"," << n <<
")");
166 debug_print(
"# Constructing global matrices in the sector.");
168 {
171 #ifdef GPU
172 magma_queue_sync(queue);
173 #endif
174 }
176
177 debug_print(
"# Calculating eigenstate expectation values.");
180 if(info != 0) {
182 continue;
183 }
184 debug_print(
"# Calculating the spectral range of the observable.");
187
190 {
191 EnergyRange = eigenEnergy[dim_sub-1] -eigenEnergy[0];
192 gE = eigenEnergy[0];
194 eigenEnergy[i] = (eigenEnergy[i] -gE)/EnergyRange;
195
196 }
197
198
199 MCAverage.resize(dim_sub); NdataInShell.resize(dim_sub);
200 std::fill( MCAverage.begin(), MCAverage.end(), 0.0);
201 std::fill(NdataInShell.begin(), NdataInShell.end(), 0.0);
204 }
205
206 ndata =
MeasureOfETH(Fluc, MaxFluc, MaxPos,
Emin,
Emax, dim_sub, eigenEnergy, EXPvalue, MCAverage);
207 }
209
210 OutMeasure[n] << std::setw(6) << repetition <<
" " << std::showpos
211 << std::setw(13) << Fluc << " "
212 << std::setw(13) << MaxFluc << " "
213 << std::setw(13) << MaxPos << " " << std::noshowpos << ndata << "\n";
214 if(repetition < 10000) {
216 OutSample << std::setw(2) << n << " " << std::showpos
217 << std::setw(13) << eigenEnergy[i]*EnergyRange+gE << " "
218 << std::setw(13) << eigenEnergy[i] << " "
219 << std::setw(13) << EXPvalue[i] << "\n" << std::noshowpos;
220 }
221 }
222 }
223 if(repetition < 10000) OutSample.close();
224 if(repetition%10 == 9) {
226 std::cerr << "(total=" << std::setw(6) << repetition+1
227 << "): timeINT=" << std::setprecision(6) << std::setw(8) << (end-t_int)
228 << ", timeTOT=" << std::setprecision(6) << std::setw(8) << (end-start)
229 << ", T_construct=" << std::setprecision(6) << std::setw(10) << T_pre << "(" << std::setprecision(1) << 100*T_pre /(end-start) << "%)"
230 << ", T_diag=" << std::setprecision(6) << std::setw(8) << T_diag << "(" << std::setprecision(1) << 100*T_diag/(end-start) << "%)"
231 << ", T_process=" << std::setprecision(6) << std::setw(8) << T_post << "(" << std::setprecision(1) << 100*T_post/(end-start) << "%)"
232 << std::endl;
234 }
235 }
236
237 Finalize(argc, argv);
238 #ifdef GPU
239 magma_finalize();
240 #endif
241 return 0;
242}
double getETtime()
Definition EnergySpectrum.c:14
std::ofstream OutMeasure[n_max+1]
Definition MeasureOfETH_CreateOutputFiles.cpp:1
std::vector< TransSector > Sector(n_max+1)
Definition mytypes.hpp:147
void queue(magma_queue_t x)
Definition mytypes.hpp:297
Calculate the microcanonical averages with respect to a given sorted vector 'eigVal'.
Definition MicroCanonicalAverage.hpp:25
debug_print("# Determining GPU configuration.")
GPUconfig GPUconf(dim3(nBlock, nBlock, 1), dim3(nThread, nThread, 1), 0, queue)
MKL_INT Integer_t
Definition mytypes.hpp:359
Integer_t const num_op
Definition setVariablesForEnsemble.cpp:39
Integer_t const num_h
Definition setVariablesForEnsemble.cpp:38
Integer_t const repMin
Definition setVariablesForEnsemble.cpp:31
Integer_t const n_min
Definition setVariablesForEnsemble.cpp:28
Integer_t const repMax
Definition setVariablesForEnsemble.cpp:32
Integer_t const dloc_op
Definition setVariablesForEnsemble.cpp:41
Integer_t const dloc_h
Definition setVariablesForEnsemble.cpp:40
Integer_t const n_max
Definition setVariablesForEnsemble.cpp:27
constexpr double Emin
Definition setVariablesForMCAverage.cpp:4
constexpr double Emax
Definition setVariablesForMCAverage.cpp:5
double const dE
Definition setVariablesForMCAverage.cpp:2
Integer_t EigenExpValue(std::vector< double > &EXPvalue, std::vector< double > &Eigenvalue, Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian, const matrix< Complex_t< double > > &Operator, void *GPUconf)
Definition statmech.cpp:120
Integer_t MeasureOfETH(double &Fluc_2, double &Fluc_inf, double &MaxPos, double const Emin, double const Emax, Integer_t const dim, const std::vector< double > &eigenEnergy, const std::vector< double > &EXPvalue, const std::vector< double > &MCAverage)
Definition statmech.cpp:244
double SpectralRange(double &OpMin, Integer_t const dim, matrix< Complex_t< double > > &Operator)
Definition statmech.cpp:49