Browse Source

Reorganization of headers (I): rename JSC -> ABACUS

All files need to be changed to refer to new headers.
First step of the reorganization.
master
J.-S. Caux 6 years ago
parent
commit
63cdd4250c
100 changed files with 4397 additions and 5468 deletions
  1. 69
    0
      ABACUS.org
  2. 78
    78
      Makefile
  3. 7
    1
      README.md
  4. 28
    42
      include/ABACUS.h
  5. 17
    32
      include/ABACUS_Bethe.h
  6. 8
    10
      include/ABACUS_Combi.h
  7. 9
    9
      include/ABACUS_Fitting.h
  8. 428
    0
      include/ABACUS_Heis.h
  9. 86
    87
      include/ABACUS_Integ.h
  10. 48
    57
      include/ABACUS_LiebLin.h
  11. 440
    0
      include/ABACUS_Matrix.h
  12. 35
    0
      include/ABACUS_NRG.h
  13. 110
    145
      include/ABACUS_ODSLF.h
  14. 828
    0
      include/ABACUS_Scan.h
  15. 23
    55
      include/ABACUS_Spec_Fns.h
  16. 7
    11
      include/ABACUS_State_Ensemble.h
  17. 23
    25
      include/ABACUS_TBA.h
  18. 438
    0
      include/ABACUS_Utils.h
  19. 60
    175
      include/ABACUS_Vect.h
  20. 42
    40
      include/ABACUS_XXX_VOA.h
  21. 47
    0
      include/ABACUS_XXZ_VOA.h
  22. 12
    12
      include/ABACUS_Young.h
  23. 0
    777
      include/JSC_Heis.h
  24. 0
    32
      include/JSC_Infprec.h
  25. 0
    440
      include/JSC_Matrix.h
  26. 0
    36
      include/JSC_NRG.h
  27. 0
    1263
      include/JSC_Scan.h
  28. 0
    86
      include/JSC_XXZ_h0.h
  29. 0
    485
      include/JSC_util.h
  30. 72
    71
      src/BETHE/Base.cc
  31. 6
    7
      src/BETHE/Bethe_State.cc
  32. 41
    44
      src/BETHE/Offsets.cc
  33. 7
    9
      src/COMBI/Combinatorics.cc
  34. 8
    9
      src/EXECS/2CBG_ThLim.cc
  35. 10
    10
      src/EXECS/Analyze_RAW_File.cc
  36. 16
    17
      src/EXECS/Check_RAW_File.cc
  37. 9
    10
      src/EXECS/Heis_DSF.cc
  38. 10
    11
      src/EXECS/Heis_DSF_GeneralState.cc
  39. 19
    21
      src/EXECS/Heis_DSF_par.cc
  40. 9
    11
      src/EXECS/Heis_DSF_par_Prepare.cc
  41. 21
    23
      src/EXECS/Heis_DSF_par_Run.cc
  42. 9
    11
      src/EXECS/Heis_DSF_par_Wrapup.cc
  43. 10
    10
      src/EXECS/LiebLin_Catalogue_Fixed_c_k_Nscaling.cc
  44. 6
    7
      src/EXECS/LiebLin_DSF.cc
  45. 9
    10
      src/EXECS/LiebLin_DSF_GeneralState.cc
  46. 9
    11
      src/EXECS/LiebLin_DSF_GeneralState_par_Prepare.cc
  47. 22
    24
      src/EXECS/LiebLin_DSF_GeneralState_par_Run.cc
  48. 10
    12
      src/EXECS/LiebLin_DSF_GeneralState_par_Wrapup.cc
  49. 8
    9
      src/EXECS/LiebLin_DSF_MosesState.cc
  50. 24
    26
      src/EXECS/LiebLin_DSF_MosesState_par.cc
  51. 15
    17
      src/EXECS/LiebLin_DSF_MosesState_par_Prepare.cc
  52. 30
    32
      src/EXECS/LiebLin_DSF_MosesState_par_Run.cc
  53. 15
    17
      src/EXECS/LiebLin_DSF_MosesState_par_Wrapup.cc
  54. 8
    9
      src/EXECS/LiebLin_DSF_over_Ensemble.cc
  55. 32
    33
      src/EXECS/LiebLin_DSF_over_Ensemble_par.cc
  56. 22
    24
      src/EXECS/LiebLin_DSF_par.cc
  57. 9
    11
      src/EXECS/LiebLin_DSF_par_Prepare.cc
  58. 18
    20
      src/EXECS/LiebLin_DSF_par_Run.cc
  59. 9
    11
      src/EXECS/LiebLin_DSF_par_Wrapup.cc
  60. 10
    11
      src/EXECS/LiebLin_DSF_tester.cc
  61. 10
    11
      src/EXECS/LiebLin_DSF_tester_Ix2.cc
  62. 13
    13
      src/EXECS/LiebLin_Data_Daemon.cc
  63. 10
    10
      src/EXECS/LiebLin_Data_Daemon_Nscaling.cc
  64. 14
    14
      src/EXECS/LiebLin_Fourier_ssf_to_Qsqx.cc
  65. 14
    14
      src/EXECS/LiebLin_Fourier_to_t_equal_x.cc
  66. 12
    12
      src/EXECS/LiebLin_Fourier_to_t_equal_x_from_RAW.cc
  67. 17
    17
      src/EXECS/LiebLin_Fourier_to_x_equal_t.cc
  68. 12
    12
      src/EXECS/LiebLin_Fourier_to_x_equal_t_from_RAW.cc
  69. 8
    9
      src/EXECS/LiebLin_Moses_tester.cc
  70. 14
    15
      src/EXECS/LiebLin_RAW_File_Stats.cc
  71. 8
    9
      src/EXECS/LiebLin_TBA.cc
  72. 8
    9
      src/EXECS/LiebLin_TBA_fixed_nbar.cc
  73. 6
    7
      src/EXECS/LiebLin_TBA_fixed_nbar_ebar.cc
  74. 8
    9
      src/EXECS/ODSLF_DSF.cc
  75. 8
    8
      src/EXECS/Produce_Sorted_RAW_File.cc
  76. 13
    14
      src/EXECS/RAW_File_Stats.cc
  77. 9
    9
      src/EXECS/Smoothen_Heis_DSF.cc
  78. 12
    12
      src/EXECS/Smoothen_LiebLin_DSF.cc
  79. 12
    12
      src/EXECS/Smoothen_LiebLin_DSF_GeneralState.cc
  80. 10
    10
      src/EXECS/Smoothen_LiebLin_DSF_MosesState.cc
  81. 8
    8
      src/EXECS/Smoothen_LiebLin_DSF_Scaled.cc
  82. 11
    11
      src/EXECS/Smoothen_LiebLin_DSF_over_Ensemble.cc
  83. 9
    9
      src/EXECS/Smoothen_ODSLF_DSF.cc
  84. 27
    28
      src/EXECS/XXZ_gpd_StagSz_h0.cc
  85. 7
    9
      src/FITTING/covsrt.cc
  86. 4
    6
      src/FITTING/lin_reg.cc
  87. 7
    9
      src/FITTING/mrq.cc
  88. 17
    3
      src/FITTING/polint.cc
  89. 17
    3
      src/FITTING/polint_cx.cc
  90. 227
    228
      src/HEIS/Heis.cc
  91. 23
    22
      src/HEIS/Heis_Chem_Pot.cc
  92. 10
    11
      src/HEIS/Heis_Matrix_Element_Contrib.cc
  93. 30
    31
      src/HEIS/Heis_Sumrules.cc
  94. 23
    24
      src/HEIS/M_vs_H.cc
  95. 80
    80
      src/HEIS/XXX_Bethe_State.cc
  96. 110
    110
      src/HEIS/XXZ_Bethe_State.cc
  97. 126
    127
      src/HEIS/XXZ_gpd_Bethe_State.cc
  98. 42
    37
      src/HEIS/ln_Overlap_XXX.cc
  99. 55
    40
      src/HEIS/ln_Smin_ME_XXX.cc
  100. 0
    0
      src/HEIS/ln_Smin_ME_XXZ.cc

+ 69
- 0
ABACUS.org View File

@@ -0,0 +1,69 @@
1
+#+TODO: TODO(t@) | DONE(d@)
2
+#+TODO: BUGREPORT(b@) CRITICAL(#@) | SOLVED(s@)
3
+#+TODO: CONCEPT(c@) UPDATED(u@) | REJECTED(r@)
4
+#+TODO: PICKEDUP(p@) | ABANDONED(k@) IMPLEMENTED(i@)
5
+
6
+
7
+* Templates
8
+  :PROPERTIES:
9
+  :CUSTOM_ID: Templates
10
+  :END:
11
+** Project
12
+*** dev-unit
13
+**** Description
14
+Type your description here
15
+**** Tasks
16
+***** Task1example (needs a TODO state)
17
+
18
+
19
+
20
+* Bugs 							   :ABACUS:Dev:Bugs:
21
+  :PROPERTIES:
22
+  :ARCHIVE:  %s_archive::* Bugs
23
+  :CUSTOM_ID: Bugs
24
+  :END:
25
+
26
+
27
+* Priority 					       :ABACUS:Dev:Priority:
28
+  :PROPERTIES:
29
+  :ARCHIVE:  %s_archive::* Priority
30
+  :CUSTOM_ID: Priority
31
+  :END:
32
+
33
+
34
+* Implementation queue				       :ABACUS:Dev:ImpQueue:
35
+  :PROPERTIES:
36
+  :ARCHIVE:  %s_archive::* Implementation queue
37
+  :CUSTOM_ID: ImplementationQueue
38
+  :END:
39
+
40
+
41
+** CONCEPT Complex integration
42
+   - State "CONCEPT"    from ""           [2018-02-10 Sat 06:28]
43
+*** Complete implementation of Integral_result_CX
44
+**** Description
45
+The `Integral_result_CX Integrate_optimal_using_table` functions are not yet implemented.
46
+**** Tasks
47
+***** Implement `Integral_result_CX Integrate_optimal_using_table`
48
+
49
+
50
+
51
+
52
+** CONCEPT Rewrite ODSLF to use `State_Label`
53
+   - State "CONCEPT"    from ""           [2018-02-10 Sat 06:49]
54
+
55
+
56
+
57
+* Planning (short term)				     :ABACUS:Dev:PlanningST:
58
+  :PROPERTIES:
59
+  :ARCHIVE: %s_archive::* Planning (short term)
60
+  :CUSTOM_ID: PlanningShortTerm
61
+  :END:
62
+
63
+
64
+
65
+* Planning (long term)				     :ABACUS:Dev:PlanningLT:
66
+  :PROPERTIES:
67
+  :ARCHIVE: %s_archive::* Planning (long term)
68
+  :CUSTOM_ID: PlanningLongTerm
69
+  :END:

+ 78
- 78
Makefile View File

@@ -37,12 +37,12 @@ COMPILE = $(CXX) -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
37 37
 COMPILE_MPI = mpicxx -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
38 38
 #COMPILE_OMP = g++ -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
39 39
 
40
-VPATH = $(SRCDIR)BETHE:$(SRCDIR)LIEBLIN:$(SRCDIR)COMBI:$(SRCDIR)EXECS:$(SRCDIR)FITTING:$(SRCDIR)HEIS:$(SRCDIR)INTEG:$(SRCDIR)MATRIX:$(SRCDIR)NRG:$(SRCDIR)ODSLF:$(SRCDIR)SCAN:$(SRCDIR)TBA:$(SRCDIR)UTILS:$(SRCDIR)XXX_h0:$(SRCDIR)XXZ_h0:$(SRCDIR)YOUNG
40
+VPATH = $(SRCDIR)BETHE:$(SRCDIR)LIEBLIN:$(SRCDIR)COMBI:$(SRCDIR)EXECS:$(SRCDIR)FITTING:$(SRCDIR)HEIS:$(SRCDIR)INTEG:$(SRCDIR)MATRIX:$(SRCDIR)NRG:$(SRCDIR)ODSLF:$(SRCDIR)SCAN:$(SRCDIR)TBA:$(SRCDIR)UTILS:$(SRCDIR)XXX_VOA:$(SRCDIR)XXZ_VOA:$(SRCDIR)YOUNG
41 41
 
42 42
 vpath %.h $(HEADDIR)
43 43
 
44
-Headers_JSC = JSC.h JSC_util.h JSC_Combi.h JSC_Integ.h JSC_Matrix.h JSC_NRG.h JSC_Spec_Fns.h JSC_Vect.h JSC_Young.h
45
-Headers_all = $(Headers_JSC) JSC_LiebLin.h JSC_Heis.h JSC_Scan.h JSC_State_Ensemble.h JSC_XXX_h0.h JSC_XXZ_h0.h
44
+Headers_ABACUS = ABACUS.h ABACUS_Utils.h ABACUS_Combi.h ABACUS_Integ.h ABACUS_Matrix.h ABACUS_NRG.h ABACUS_Spec_Fns.h ABACUS_Vect.h ABACUS_Young.h
45
+Headers_all = $(Headers_ABACUS) ABACUS_LiebLin.h ABACUS_Heis.h ABACUS_Scan.h ABACUS_State_Ensemble.h ABACUS_XXX_VOA.h ABACUS_XXZ_VOA.h
46 46
 
47 47
 Objects_LIEBLIN = $(OBJDIR)LiebLin_Bethe_State.o $(OBJDIR)LiebLin_Chem_Pot.o \
48 48
 	$(OBJDIR)LiebLin_Matrix_Element_Contrib.o $(OBJDIR)LiebLin_ln_Overlap.o \
@@ -84,15 +84,15 @@ Objects_TBA = $(OBJDIR)Root_Density.o $(OBJDIR)TBA_LiebLin.o $(OBJDIR)TBA_XXZ.o
84 84
 Objects_UTILS = $(OBJDIR)Data_File_Name.o $(OBJDIR)K_and_Omega_Files.o $(OBJDIR)Smoothen_RAW_into_SF.o \
85 85
 	$(OBJDIR)Smoothen_RAW_into_SF_LiebLin_Scaled.o $(OBJDIR)Sort_RAW_File.o $(OBJDIR)State_Label.o
86 86
 
87
-Objects_XXX_h0 = $(OBJDIR)XXX_h0.o
87
+Objects_XXX_VOA = $(OBJDIR)XXX_VOA.o
88 88
 
89
-Objects_XXZ_h0 = $(OBJDIR)XXZ_h0.o
89
+Objects_XXZ_VOA = $(OBJDIR)XXZ_VOA.o
90 90
 
91 91
 Objects_YOUNG = $(OBJDIR)Young_Tableau.o
92 92
 
93 93
 Objects_ALL = $(Objects_LIEBLIN) $(Objects_HEIS) $(Objects_COMBI) $(Objects_FITTING) \
94 94
 	$(Objects_INTEG) $(Objects_MATRIX) $(Objects_NRG) $(Objects_SCAN) $(Objects_TBA) \
95
-	$(Objects_UTILS) $(Objects_XXX_h0) $(Objects_XXZ_h0) $(Objects_YOUNG)
95
+	$(Objects_UTILS) $(Objects_XXX_VOA) $(Objects_XXZ_VOA) $(Objects_YOUNG)
96 96
 
97 97
 EXECS = $(BINDIR)LiebLin_DSF $(BINDIR)LiebLin_Data_Daemon $(BINDIR)LiebLin_RAW_File_Stats \
98 98
 	$(BINDIR)LiebLin_DSF_tester $(BINDIR)LiebLin_DSF_tester_Ix2 $(BINDIR)LiebLin_DSF_MosesState \
@@ -144,218 +144,218 @@ lib$(VERSION).a : $(Objects_ALL)
144 144
 ###########################################
145 145
 # Interacting LiebLin gas
146 146
 
147
-$(OBJDIR)LiebLin_Bethe_State.o : LiebLin_Bethe_State.cc $(Headers_JSC) JSC_LiebLin.h
147
+$(OBJDIR)LiebLin_Bethe_State.o : LiebLin_Bethe_State.cc $(Headers_ABACUS) ABACUS_LiebLin.h
148 148
 	$(COMPILE) -c $< -o $@
149 149
 
150
-$(OBJDIR)LiebLin_Chem_Pot.o : LiebLin_Chem_Pot.cc $(Headers_JSC) JSC_LiebLin.h
150
+$(OBJDIR)LiebLin_Chem_Pot.o : LiebLin_Chem_Pot.cc $(Headers_ABACUS) ABACUS_LiebLin.h
151 151
 	$(COMPILE) -c $< -o $@
152 152
 
153
-$(OBJDIR)LiebLin_Matrix_Element_Contrib.o : LiebLin_Matrix_Element_Contrib.cc $(Headers_JSC) JSC_LiebLin.h
153
+$(OBJDIR)LiebLin_Matrix_Element_Contrib.o : LiebLin_Matrix_Element_Contrib.cc $(Headers_ABACUS) ABACUS_LiebLin.h
154 154
 	$(COMPILE) -c $< -o $@
155 155
 
156
-$(OBJDIR)LiebLin_ln_Overlap.o : LiebLin_ln_Overlap.cc $(Headers_JSC) JSC_LiebLin.h
156
+$(OBJDIR)LiebLin_ln_Overlap.o : LiebLin_ln_Overlap.cc $(Headers_ABACUS) ABACUS_LiebLin.h
157 157
 	$(COMPILE) -c $< -o $@
158 158
 
159
-$(OBJDIR)LiebLin_Sumrules.o : LiebLin_Sumrules.cc $(Headers_JSC) JSC_LiebLin.h
159
+$(OBJDIR)LiebLin_Sumrules.o : LiebLin_Sumrules.cc $(Headers_ABACUS) ABACUS_LiebLin.h
160 160
 	$(COMPILE) -c $< -o $@
161 161
 
162
-$(OBJDIR)LiebLin_State_Ensemble.o : LiebLin_State_Ensemble.cc $(Headers_JSC) JSC_LiebLin.h
162
+$(OBJDIR)LiebLin_State_Ensemble.o : LiebLin_State_Ensemble.cc $(Headers_ABACUS) ABACUS_LiebLin.h
163 163
 	$(COMPILE) -c $< -o $@
164 164
 
165
-$(OBJDIR)LiebLin_Tgt0.o : LiebLin_Tgt0.cc $(Headers_JSC) JSC_LiebLin.h
165
+$(OBJDIR)LiebLin_Tgt0.o : LiebLin_Tgt0.cc $(Headers_ABACUS) ABACUS_LiebLin.h
166 166
 	$(COMPILE) -c $< -o $@
167 167
 
168
-$(OBJDIR)LiebLin_Twisted_lnnorm.o : LiebLin_Twisted_lnnorm.cc $(Headers_JSC) JSC_LiebLin.h
168
+$(OBJDIR)LiebLin_Twisted_lnnorm.o : LiebLin_Twisted_lnnorm.cc $(Headers_ABACUS) ABACUS_LiebLin.h
169 169
 	$(COMPILE) -c $< -o $@
170 170
 
171
-$(OBJDIR)LiebLin_Utils.o : LiebLin_Utils.cc $(Headers_JSC) JSC_LiebLin.h
171
+$(OBJDIR)LiebLin_Utils.o : LiebLin_Utils.cc $(Headers_ABACUS) ABACUS_LiebLin.h
172 172
 	$(COMPILE) -c $< -o $@
173 173
 
174
-$(OBJDIR)ln_Density_ME.o : ln_Density_ME.cc $(Headers_JSC) JSC_LiebLin.h
174
+$(OBJDIR)ln_Density_ME.o : ln_Density_ME.cc $(Headers_ABACUS) ABACUS_LiebLin.h
175 175
 	$(COMPILE) -c $< -o $@
176 176
 
177
-$(OBJDIR)LiebLin_Twisted_ln_Overlap.o : LiebLin_Twisted_ln_Overlap.cc $(Headers_JSC) JSC_LiebLin.h
177
+$(OBJDIR)LiebLin_Twisted_ln_Overlap.o : LiebLin_Twisted_ln_Overlap.cc $(Headers_ABACUS) ABACUS_LiebLin.h
178 178
 	$(COMPILE) -c $< -o $@
179 179
 
180
-$(OBJDIR)ln_Psi_ME.o : ln_Psi_ME.cc $(Headers_JSC) JSC_LiebLin.h
180
+$(OBJDIR)ln_Psi_ME.o : ln_Psi_ME.cc $(Headers_ABACUS) ABACUS_LiebLin.h
181 181
 	$(COMPILE) -c $< -o $@
182 182
 
183
-$(OBJDIR)ln_g2_ME.o : ln_g2_ME.cc $(Headers_JSC) JSC_LiebLin.h
183
+$(OBJDIR)ln_g2_ME.o : ln_g2_ME.cc $(Headers_ABACUS) ABACUS_LiebLin.h
184 184
 	$(COMPILE) -c $< -o $@
185 185
 
186 186
 
187 187
 ###########################################
188 188
 # Heisenberg chains
189 189
 
190
-$(OBJDIR)Heis.o : Heis.cc $(Headers_JSC) JSC_Heis.h
190
+$(OBJDIR)Heis.o : Heis.cc $(Headers_ABACUS) ABACUS_Heis.h
191 191
 	$(COMPILE) -c $< -o $@
192 192
 
193
-$(OBJDIR)Heis_Chem_Pot.o : Heis_Chem_Pot.cc $(Headers_JSC) JSC_Heis.h
193
+$(OBJDIR)Heis_Chem_Pot.o : Heis_Chem_Pot.cc $(Headers_ABACUS) ABACUS_Heis.h
194 194
 	$(COMPILE) -c $< -o $@
195 195
 
196
-$(OBJDIR)Heis_Sumrules.o : Heis_Sumrules.cc $(Headers_JSC) JSC_Heis.h
196
+$(OBJDIR)Heis_Sumrules.o : Heis_Sumrules.cc $(Headers_ABACUS) ABACUS_Heis.h
197 197
 	$(COMPILE) -c $< -o $@
198 198
 
199
-$(OBJDIR)Heis_Matrix_Element_Contrib.o : Heis_Matrix_Element_Contrib.cc $(Headers_JSC) JSC_Heis.h
199
+$(OBJDIR)Heis_Matrix_Element_Contrib.o : Heis_Matrix_Element_Contrib.cc $(Headers_ABACUS) ABACUS_Heis.h
200 200
 	$(COMPILE) -c $< -o $@
201 201
 
202
-$(OBJDIR)ln_Overlap_XXX.o : ln_Overlap_XXX.cc $(Headers_JSC) JSC_Heis.h
202
+$(OBJDIR)ln_Overlap_XXX.o : ln_Overlap_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
203 203
 	$(COMPILE) -c $< -o $@
204 204
 
205
-$(OBJDIR)ln_Sz_ME_XXX.o : ln_Sz_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
205
+$(OBJDIR)ln_Sz_ME_XXX.o : ln_Sz_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
206 206
 	$(COMPILE) -c $< -o $@
207 207
 
208
-$(OBJDIR)ln_Szz_ME_XXX.o : ln_Szz_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
208
+$(OBJDIR)ln_Szz_ME_XXX.o : ln_Szz_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
209 209
 	$(COMPILE) -c $< -o $@
210 210
 
211
-$(OBJDIR)ln_Smm_ME_XXX.o : ln_Smm_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
211
+$(OBJDIR)ln_Smm_ME_XXX.o : ln_Smm_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
212 212
 	$(COMPILE) -c $< -o $@
213 213
 
214
-$(OBJDIR)ln_Szm_p_Smz_ME_XXX.o : ln_Szm_p_Smz_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
214
+$(OBJDIR)ln_Szm_p_Smz_ME_XXX.o : ln_Szm_p_Smz_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
215 215
 	$(COMPILE) -c $< -o $@
216 216
 
217
-$(OBJDIR)ln_Sz_ME_XXZ.o : ln_Sz_ME_XXZ.cc $(Headers_JSC) JSC_Heis.h
217
+$(OBJDIR)ln_Sz_ME_XXZ.o : ln_Sz_ME_XXZ.cc $(Headers_ABACUS) ABACUS_Heis.h
218 218
 	$(COMPILE) -c $< -o $@
219 219
 
220
-$(OBJDIR)ln_Sz_ME_XXZ_gpd.o : ln_Sz_ME_XXZ_gpd.cc $(Headers_JSC) JSC_Heis.h
220
+$(OBJDIR)ln_Sz_ME_XXZ_gpd.o : ln_Sz_ME_XXZ_gpd.cc $(Headers_ABACUS) ABACUS_Heis.h
221 221
 	$(COMPILE) -c $< -o $@
222 222
 
223
-$(OBJDIR)ln_Smin_ME_XXX.o : ln_Smin_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
223
+$(OBJDIR)ln_Smin_ME_XXX.o : ln_Smin_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
224 224
 	$(COMPILE) -c $< -o $@
225 225
 
226
-$(OBJDIR)ln_Smin_ME_XXZ.o : ln_Smin_ME_XXZ.cc $(Headers_JSC) JSC_Heis.h
226
+$(OBJDIR)ln_Smin_ME_XXZ.o : ln_Smin_ME_XXZ.cc $(Headers_ABACUS) ABACUS_Heis.h
227 227
 	$(COMPILE) -c $< -o $@
228 228
 
229
-$(OBJDIR)ln_Smin_ME_XXZ_gpd.o : ln_Smin_ME_XXZ_gpd.cc $(Headers_JSC) JSC_Heis.h
229
+$(OBJDIR)ln_Smin_ME_XXZ_gpd.o : ln_Smin_ME_XXZ_gpd.cc $(Headers_ABACUS) ABACUS_Heis.h
230 230
 	$(COMPILE) -c $< -o $@
231 231
 
232
-$(OBJDIR)M_vs_H.o : M_vs_H.cc $(Headers_JSC) JSC_Heis.h
232
+$(OBJDIR)M_vs_H.o : M_vs_H.cc $(Headers_ABACUS) ABACUS_Heis.h
233 233
 	$(COMPILE) -c $< -o $@
234 234
 
235
-$(OBJDIR)XXX_Bethe_State.o : XXX_Bethe_State.cc $(Headers_JSC) JSC_Heis.h
235
+$(OBJDIR)XXX_Bethe_State.o : XXX_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h
236 236
 	$(COMPILE) -c $< -o $@
237 237
 
238
-$(OBJDIR)XXZ_Bethe_State.o : XXZ_Bethe_State.cc $(Headers_JSC) JSC_Heis.h
238
+$(OBJDIR)XXZ_Bethe_State.o : XXZ_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h
239 239
 	$(COMPILE) -c $< -o $@
240 240
 
241
-$(OBJDIR)XXZ_gpd_Bethe_State.o : XXZ_gpd_Bethe_State.cc $(Headers_JSC) JSC_Heis.h
241
+$(OBJDIR)XXZ_gpd_Bethe_State.o : XXZ_gpd_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h
242 242
 	$(COMPILE) -c $< -o $@
243 243
 
244 244
 
245 245
 ###########################################
246 246
 # One-d spinless fermions
247 247
 
248
-$(OBJDIR)ODSLF.o : ODSLF.cc $(Headers_JSC) JSC_Heis.h JSC_ODSLF.h
248
+$(OBJDIR)ODSLF.o : ODSLF.cc $(Headers_ABACUS) ABACUS_Heis.h ABACUS_ODSLF.h
249 249
 	$(COMPILE) -c $< -o $@
250 250
 
251
-$(OBJDIR)ODSLF_Chem_Pot.o : ODSLF_Chem_Pot.cc $(Headers_JSC) JSC_ODSLF.h
251
+$(OBJDIR)ODSLF_Chem_Pot.o : ODSLF_Chem_Pot.cc $(Headers_ABACUS) ABACUS_ODSLF.h
252 252
 	$(COMPILE) -c $< -o $@
253 253
 
254
-$(OBJDIR)ODSLF_Sumrules.o : ODSLF_Sumrules.cc $(Headers_JSC) JSC_ODSLF.h
254
+$(OBJDIR)ODSLF_Sumrules.o : ODSLF_Sumrules.cc $(Headers_ABACUS) ABACUS_ODSLF.h
255 255
 	$(COMPILE) -c $< -o $@
256 256
 
257
-$(OBJDIR)ODSLF_XXZ_Bethe_State.o : ODSLF_XXZ_Bethe_State.cc $(Headers_JSC) JSC_Heis.h JSC_ODSLF.h
257
+$(OBJDIR)ODSLF_XXZ_Bethe_State.o : ODSLF_XXZ_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h ABACUS_ODSLF.h
258 258
 	$(COMPILE) -c $< -o $@
259 259
 
260
-$(OBJDIR)ln_Smin_ME_ODSLF_XXZ.o : ln_Smin_ME_ODSLF_XXZ.cc $(Headers_JSC) JSC_ODSLF.h
260
+$(OBJDIR)ln_Smin_ME_ODSLF_XXZ.o : ln_Smin_ME_ODSLF_XXZ.cc $(Headers_ABACUS) ABACUS_ODSLF.h
261 261
 	$(COMPILE) -c $< -o $@
262 262
 
263
-$(OBJDIR)ln_Sz_ME_ODSLF_XXZ.o : ln_Sz_ME_ODSLF_XXZ.cc $(Headers_JSC) JSC_ODSLF.h
263
+$(OBJDIR)ln_Sz_ME_ODSLF_XXZ.o : ln_Sz_ME_ODSLF_XXZ.cc $(Headers_ABACUS) ABACUS_ODSLF.h
264 264
 	$(COMPILE) -c $< -o $@
265 265
 
266
-$(OBJDIR)ODSLF_Matrix_Element_Contrib.o : ODSLF_Matrix_Element_Contrib.cc $(Headers_JSC) JSC_ODSLF.h
266
+$(OBJDIR)ODSLF_Matrix_Element_Contrib.o : ODSLF_Matrix_Element_Contrib.cc $(Headers_ABACUS) ABACUS_ODSLF.h
267 267
 	$(COMPILE) -c $< -o $@
268 268
 
269 269
 
270 270
 ###########################################
271 271
 # Combinatorics functions
272 272
 
273
-$(OBJDIR)Combinatorics.o : Combinatorics.cc $(Headers_JSC)
273
+$(OBJDIR)Combinatorics.o : Combinatorics.cc $(Headers_ABACUS)
274 274
 	$(COMPILE) -c $< -o $@
275 275
 
276 276
 ###########################################
277 277
 # Integ functions
278 278
 
279
-$(OBJDIR)Integration.o : Integration.cc $(Headers_JSC)
279
+$(OBJDIR)Integration.o : Integration.cc $(Headers_ABACUS)
280 280
 	$(COMPILE) -c $< -o $@
281 281
 
282 282
 ###########################################
283 283
 # Fitting functions
284 284
 
285
-$(OBJDIR)covsrt.o : covsrt.cc $(Headers_JSC)
285
+$(OBJDIR)covsrt.o : covsrt.cc $(Headers_ABACUS)
286 286
 	$(COMPILE) -c $< -o $@
287 287
 
288
-$(OBJDIR)lin_reg.o : lin_reg.cc $(Headers_JSC)
288
+$(OBJDIR)lin_reg.o : lin_reg.cc $(Headers_ABACUS)
289 289
 	$(COMPILE) -c $< -o $@
290 290
 
291
-$(OBJDIR)mrq.o : mrq.cc $(Headers_JSC)
291
+$(OBJDIR)mrq.o : mrq.cc $(Headers_ABACUS)
292 292
 	$(COMPILE) -c $< -o $@
293 293
 
294
-$(OBJDIR)polint.o : polint.cc $(Headers_JSC)
294
+$(OBJDIR)polint.o : polint.cc $(Headers_ABACUS)
295 295
 	$(COMPILE) -c $< -o $@
296 296
 
297
-$(OBJDIR)polint_cx.o : polint_cx.cc $(Headers_JSC)
297
+$(OBJDIR)polint_cx.o : polint_cx.cc $(Headers_ABACUS)
298 298
 	$(COMPILE) -c $< -o $@
299 299
 
300 300
 
301 301
 ###########################################
302 302
 # Matrix functions
303 303
 
304
-$(OBJDIR)balanc.o : balanc.cc $(Headers_JSC)
304
+$(OBJDIR)balanc.o : balanc.cc $(Headers_ABACUS)
305 305
 	$(COMPILE) -c $< -o $@
306 306
 
307
-$(OBJDIR)det_LU.o : det_LU.cc $(Headers_JSC)
307
+$(OBJDIR)det_LU.o : det_LU.cc $(Headers_ABACUS)
308 308
 	$(COMPILE) -c $< -o $@
309 309
 
310
-$(OBJDIR)det_LU_CX.o : det_LU_CX.cc $(Headers_JSC)
310
+$(OBJDIR)det_LU_CX.o : det_LU_CX.cc $(Headers_ABACUS)
311 311
 	$(COMPILE) -c $< -o $@
312 312
 
313
-$(OBJDIR)eigsrt.o : eigsrt.cc $(Headers_JSC)
313
+$(OBJDIR)eigsrt.o : eigsrt.cc $(Headers_ABACUS)
314 314
 	$(COMPILE) -c $< -o $@
315 315
 
316
-$(OBJDIR)elmhes.o : elmhes.cc $(Headers_JSC)
316
+$(OBJDIR)elmhes.o : elmhes.cc $(Headers_ABACUS)
317 317
 	$(COMPILE) -c $< -o $@
318 318
 
319
-$(OBJDIR)gaussj.o : gaussj.cc $(Headers_JSC)
319
+$(OBJDIR)gaussj.o : gaussj.cc $(Headers_ABACUS)
320 320
 	$(COMPILE) -c $< -o $@
321 321
 
322
-$(OBJDIR)hqr.o : hqr.cc $(Headers_JSC)
322
+$(OBJDIR)hqr.o : hqr.cc $(Headers_ABACUS)
323 323
 	$(COMPILE) -c $< -o $@
324 324
 
325
-$(OBJDIR)jacobi.o : jacobi.cc $(Headers_JSC)
325
+$(OBJDIR)jacobi.o : jacobi.cc $(Headers_ABACUS)
326 326
 	$(COMPILE) -c $< -o $@
327 327
 
328
-$(OBJDIR)lndet_LU.o : lndet_LU.cc $(Headers_JSC)
328
+$(OBJDIR)lndet_LU.o : lndet_LU.cc $(Headers_ABACUS)
329 329
 	$(COMPILE) -c $< -o $@
330 330
 
331
-$(OBJDIR)lndet_LU_CX.o : lndet_LU_CX.cc $(Headers_JSC)
331
+$(OBJDIR)lndet_LU_CX.o : lndet_LU_CX.cc $(Headers_ABACUS)
332 332
 	$(COMPILE) -c $< -o $@
333 333
 
334
-$(OBJDIR)lndet_LU_dstry.o : lndet_LU_dstry.cc $(Headers_JSC)
334
+$(OBJDIR)lndet_LU_dstry.o : lndet_LU_dstry.cc $(Headers_ABACUS)
335 335
 	$(COMPILE) -c $< -o $@
336 336
 
337
-$(OBJDIR)lndet_LU_CX_dstry.o : lndet_LU_CX_dstry.cc $(Headers_JSC)
337
+$(OBJDIR)lndet_LU_CX_dstry.o : lndet_LU_CX_dstry.cc $(Headers_ABACUS)
338 338
 	$(COMPILE) -c $< -o $@
339 339
 
340
-$(OBJDIR)lubksb.o : lubksb.cc $(Headers_JSC)
340
+$(OBJDIR)lubksb.o : lubksb.cc $(Headers_ABACUS)
341 341
 	$(COMPILE) -c $< -o $@
342 342
 
343
-$(OBJDIR)lubksb_CX.o : lubksb_CX.cc $(Headers_JSC)
343
+$(OBJDIR)lubksb_CX.o : lubksb_CX.cc $(Headers_ABACUS)
344 344
 	$(COMPILE) -c $< -o $@
345 345
 
346
-$(OBJDIR)ludcmp.o : ludcmp.cc $(Headers_JSC)
346
+$(OBJDIR)ludcmp.o : ludcmp.cc $(Headers_ABACUS)
347 347
 	$(COMPILE) -c $< -o $@
348 348
 
349
-$(OBJDIR)ludcmp_CX.o : ludcmp_CX.cc $(Headers_JSC)
349
+$(OBJDIR)ludcmp_CX.o : ludcmp_CX.cc $(Headers_ABACUS)
350 350
 	$(COMPILE) -c $< -o $@
351 351
 
352
-$(OBJDIR)pythag.o : pythag.cc $(Headers_JSC)
352
+$(OBJDIR)pythag.o : pythag.cc $(Headers_ABACUS)
353 353
 	$(COMPILE) -c $< -o $@
354 354
 
355
-$(OBJDIR)tqli.o : tqli.cc $(Headers_JSC)
355
+$(OBJDIR)tqli.o : tqli.cc $(Headers_ABACUS)
356 356
 	$(COMPILE) -c $< -o $@
357 357
 
358
-$(OBJDIR)tred2.o : tred2.cc $(Headers_JSC)
358
+$(OBJDIR)tred2.o : tred2.cc $(Headers_ABACUS)
359 359
 	$(COMPILE) -c $< -o $@
360 360
 
361 361
 
@@ -399,16 +399,16 @@ $(OBJDIR)Scan_Thread_Data.o : Scan_Thread_Data.cc $(Headers_all)
399 399
 ###########################################
400 400
 # Thermodynamic Bethe Ansatz
401 401
 
402
-$(OBJDIR)Root_Density.o : Root_Density.cc $(Headers_JSC) JSC_TBA.h
402
+$(OBJDIR)Root_Density.o : Root_Density.cc $(Headers_ABACUS) ABACUS_TBA.h
403 403
 	$(COMPILE) -c $< -o $@
404 404
 
405
-$(OBJDIR)TBA_LiebLin.o : TBA_LiebLin.cc $(Headers_JSC) JSC_TBA.h
405
+$(OBJDIR)TBA_LiebLin.o : TBA_LiebLin.cc $(Headers_ABACUS) ABACUS_TBA.h
406 406
 	$(COMPILE) -c $< -o $@
407 407
 
408
-$(OBJDIR)TBA_XXZ.o : TBA_XXZ.cc $(Headers_JSC) JSC_TBA.h
408
+$(OBJDIR)TBA_XXZ.o : TBA_XXZ.cc $(Headers_ABACUS) ABACUS_TBA.h
409 409
 	$(COMPILE) -c $< -o $@
410 410
 
411
-$(OBJDIR)TBA_2CBG.o : TBA_2CBG.cc $(Headers_JSC) JSC_TBA.h
411
+$(OBJDIR)TBA_2CBG.o : TBA_2CBG.cc $(Headers_ABACUS) ABACUS_TBA.h
412 412
 	$(COMPILE) -c $< -o $@
413 413
 
414 414
 ###########################################
@@ -433,15 +433,15 @@ $(OBJDIR)State_Label.o : State_Label.cc $(Headers_all)
433 433
 	$(COMPILE) -c $< -o $@
434 434
 
435 435
 ###########################################
436
-# XXX_h0
436
+# XXX_VOA
437 437
 
438
-$(OBJDIR)XXX_h0.o : XXX_h0.cc $(Headers_all) JSC_XXX_h0.h
438
+$(OBJDIR)XXX_VOA.o : XXX_VOA.cc $(Headers_all) ABACUS_XXX_VOA.h
439 439
 	$(COMPILE) -c $< -o $@
440 440
 
441 441
 ###########################################
442
-# XXZ_h0
442
+# XXZ_VOA
443 443
 
444
-$(OBJDIR)XXZ_h0.o : XXZ_h0.cc $(Headers_all) JSC_XXZ_h0.h
444
+$(OBJDIR)XXZ_VOA.o : XXZ_VOA.cc $(Headers_all) ABACUS_XXZ_VOA.h
445 445
 	$(COMPILE) -c $< -o $@
446 446
 
447 447
 ###########################################

+ 7
- 1
README.md View File

@@ -26,7 +26,13 @@ $ make
26 26
 This will produce all executables, together with a library `ABACUS_[vn]` where vn is of the form [digit][character].
27 27
 
28 28
 
29
----
29
+## Acknowledgements
30
+__Antoine Klauser__ provided functions for computing neighbour-operator-product matrix elements in XXX: `ln_Szz_ME`, `ln_Szm_p_Smz_ME` and `ln_Smm_ME`.
31
+
32
+__Jacopo De Nardis__ provided the code for the `ln_g2_ME` function for Lieb-Liniger.
33
+
34
+__Teun Zwart__ has given much useful advice concerning C++ code organization.
35
+
30 36
 
31 37
 Previous versions
32 38
 =================

include/JSC.h → include/ABACUS.h View File

@@ -2,31 +2,30 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC.h
9
+File:  ABACUS.h
10 10
 
11 11
 Purpose:  Core header file, includes all descendents.
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#ifndef _JSC_H_
17
-#define _JSC_H_
15
+#ifndef ABACUS_H
16
+#define ABACUS_H
18 17
 
19 18
 // This core header file includes all the others
20 19
 
21
-const char JSC_VERSION[20] = "ABACUS++G_8";
20
+const char ABACUS_VERSION[20] = "ABACUS++G_8";
22 21
 
23 22
 // Standard includes
24
-#include <cmath>    
23
+#include <cmath>
25 24
 #include <complex>  // for complex number algebra
26 25
 #include <string>
27 26
 
28 27
 #include <iostream>
29
-#include <fstream> 
28
+#include <fstream>
30 29
 #include <iomanip>
31 30
 
32 31
 #include <cstdlib>  // for exit(), ...
@@ -46,77 +45,64 @@ const char JSC_VERSION[20] = "ABACUS++G_8";
46 45
 #include <signal.h>    /* signal name macros, and the signal() prototype */
47 46
 
48 47
 // My own math functions and shortcuts
49
-#include "JSC_util.h"
48
+#include "ABACUS_Utils.h"
50 49
 
51 50
 // Vectors and matrices
52
-#include "JSC_Vect.h"   // My vector class definitions
53
-#include "JSC_Matrix.h"  // My matrix class definitions
51
+#include "ABACUS_Vect.h"   // My vector class definitions
52
+#include "ABACUS_Matrix.h"  // My matrix class definitions
54 53
 
55 54
 // Choose_Table
56
-#include "JSC_Combi.h"
55
+#include "ABACUS_Combi.h"
57 56
 
58 57
 // Fitting, interpolating
59
-#include "JSC_Fitting.h"
58
+#include "ABACUS_Fitting.h"
60 59
 
61 60
 // Young tableaux
62
-#include "JSC_Young.h" 
61
+#include "ABACUS_Young.h"
63 62
 
64 63
 // Integration
65
-#include "JSC_Integ.h"
64
+#include "ABACUS_Integ.h"
66 65
 
67 66
 // Special functions:
68
-#include "JSC_Spec_Fns.h"
67
+#include "ABACUS_Spec_Fns.h"
69 68
 
70 69
 //***  Integrable models:
71 70
 
72 71
 // Heisenberg spin-1/2 antiferromagnet
73
-#include "JSC_Heis.h"      
72
+#include "ABACUS_Heis.h"
74 73
 
75 74
 // Lieb-Liniger
76
-#include "JSC_LiebLin.h" 
75
+#include "ABACUS_LiebLin.h"
77 76
 
78 77
 // One-d spinless fermions:
79
-#include "JSC_ODSLF.h"
78
+#include "ABACUS_ODSLF.h"
80 79
 
81 80
 // General:
82
-//#include "JSC_Bethe.h"
81
+//#include "ABACUS_Bethe.h"  // IN DEVELOPMENT
83 82
 
84 83
 // Thermodynamic Bethe Ansatz utilities
85
-#include "JSC_TBA.h"
84
+#include "ABACUS_TBA.h"
86 85
 
87 86
 // State ensembles
88
-#include "JSC_State_Ensemble.h"
89
-
90
-// XXX in zero field:  Uq(sl(2)) stuff
91
-#include "JSC_XXX_h0.h"
87
+#include "ABACUS_State_Ensemble.h"
92 88
 
93
-// XXZ in zero field:  quantum groups
94
-#include "JSC_XXZ_h0.h"
89
+// XXX in zero field:  Vertex Operator Approach
90
+#include "ABACUS_XXX_VOA.h"
95 91
 
96
-// Two-component Bose gas
97
-//#include "2CBG.h"
92
+// XXZ in zero field:  Vertex Operator Approach
93
+#include "ABACUS_XXZ_VOA.h"
98 94
 
99
-// Richardson 
100
-//#include "Richardson.h"
101 95
 
102 96
 // *** Correlation functions:
103 97
 
104 98
 // New scanning protocols for ABACUS++
105
-#include "JSC_Scan.h"
106
-
107
-// Functions for everybody
108
-//#include "JSC_fns.h"            // KEEP THIS INCLUDE LAST, SINCE IT USES PREVIOUS DECLARATIONS
99
+#include "ABACUS_Scan.h"
109 100
 
110 101
 // Numerical RG:
111
-#include "JSC_NRG.h"
112
-
113
-// OpenMP 
114
-#include <omp.h>
102
+#include "ABACUS_NRG.h"
115 103
 
116 104
 // Typedefs:
117 105
 typedef double DP;
118 106
 
119 107
 
120
-#endif // _JSC_H_
121
-
122
-
108
+#endif // ABACUS_H

include/JSC_Bethe.h → include/ABACUS_Bethe.h View File

@@ -2,36 +2,24 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_Bethe.h
9
+File:  ABACUS_Bethe.h
10 10
 
11 11
 Purpose:  Declares Bethe state-related classes and functions.
12 12
 
13
-***********************************************************/
14
-
15
-#ifndef _BETHE_
16
-#define _BETHE_
17
-
18
-#include "JSC.h"
13
+Status: IN DEVELOPMENT
19 14
 
20
-namespace JSC {
15
+***********************************************************/
21 16
 
22
-  /*
23
-  class Model {
17
+#ifndef ABACUS_BETHE_H
18
+#define ABACUS_BETHE_H
24 19
 
25
-  protected:
26
-    string Name;  // LiebLin, XXZ, XXX, XXZ_gpd
27
-    int Nsites;   // 
28
-    int L;
29
-    DP interaction;
20
+#include "ABACUS.h"
30 21
 
31
-  public:
32
-    Model (string Name_ref, 
33
-  };
34
-  */
22
+namespace ABACUS {
35 23
 
36 24
 
37 25
   class Base {
@@ -41,7 +29,7 @@ namespace JSC {
41 29
     Vect<int> Nrap;    // Nrap[i] contains the number of rapidities of type i, i = 0, ..., Nstrings - 1.
42 30
     int Nraptot;       // total number of strings in this state
43 31
     Vect<DP> Ix2_infty;  // Ix2_infty[i] contains the max of BAE function for the (half-)integer I[i], i = 0, Nstrings - 1.
44
-    Vect<int> Ix2_min; 
32
+    Vect<int> Ix2_min;
45 33
     Vect<int> Ix2_max;    // Ix2_max[i] contains the integer part of 2*I_infty, with correct parity for base.
46 34
     string baselabel;
47 35
 
@@ -51,20 +39,19 @@ namespace JSC {
51 39
 
52 40
   public:   // LiebLin constructors
53 41
     Base (int N);       // Constructor for repulsive LiebLin gas case:  one type of particle
54
-    
42
+
55 43
   public:   // HEIS constructors
56
-    //Base (const Heis_Chain& RefChain, int M);  // constructs configuration with all Mdown in one-string of +1 parity // DEPRECATED
57 44
     Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities);  // sets to Nrapidities vector, and checks consistency
58 45
     Base (const Heis_Chain& RefChain, string baselabel_ref);
59
-    
60
-  public:    // operators    
46
+
47
+  public:    // operators
61 48
     Base& operator= (const Base& RefBase);
62 49
     bool operator== (const Base& RefBase);
63 50
     bool operator!= (const Base& RefBase);
64 51
 
65 52
   public:    // member functions
66
-    void Compute_Ix2_limits(const Heis_Chain& RefChain);  // computes the Ix2_infty and Ix2_max 
67
-  };    
53
+    void Compute_Ix2_limits(const Heis_Chain& RefChain);  // computes the Ix2_infty and Ix2_max
54
+  };
68 55
 
69 56
 
70 57
   //****************************************************************************
@@ -83,7 +70,7 @@ namespace JSC {
83 70
     int iK;
84 71
     DP K;
85 72
     DP lnnorm;
86
-  
73
+
87 74
   public:   // identification
88 75
     string label;  // this is the relative label by default
89 76
     Vect<Vect<int> > OriginIx2; // to define the relative label
@@ -94,16 +81,14 @@ namespace JSC {
94 81
     int iter;
95 82
     int iter_Newton;
96 83
 
97
-    //public:  // for descendents, etc
98
-
99 84
   public:   // constructors
100 85
     Bethe_State();
101 86
     Bethe_State (const Bethe_State& RefState);  // copy constructor
102
-    Bethe_State (const Bethe_State& OriginState, string label_ref);  
87
+    Bethe_State (const Bethe_State& OriginState, string label_ref);
103 88
 
104 89
     LiebLin_Bethe_State& operator= (const LiebLin_Bethe_State& RefState);
105 90
 
106 91
 
107
-} // namespace JSC
92
+} // namespace ABACUS
108 93
 
109 94
 #endif

include/JSC_Combi.h → include/ABACUS_Combi.h View File

@@ -1,25 +1,23 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 2006-9.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_Combi.h
9
+File:  ABACUS_Combi.h
10 10
 
11 11
 Purpose:  Declares combinatorics-related classes and functions.
12 12
 
13
-Last modified:  08/10/2009
14
-
15 13
 ***********************************************************/
16 14
 
17
-#ifndef _COMBI_
18
-#define _COMBI_
15
+#ifndef ABACUS_COMBI_H
16
+#define ABACUS_COMBI_H
19 17
 
20
-#include "JSC.h"
18
+#include "ABACUS.h"
21 19
 
22
-namespace JSC {
20
+namespace ABACUS {
23 21
 
24 22
   //***********************************************************************
25 23
 
@@ -46,6 +44,6 @@ namespace JSC {
46 44
   std::ostream& operator<< (std::ostream& s, Choose_Table& Ref_table);
47 45
 
48 46
 
49
-} // namespace JSC
47
+} // namespace ABACUS
50 48
 
51 49
 #endif

include/JSC_Fitting.h → include/ABACUS_Fitting.h View File

@@ -2,26 +2,26 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC.h
9
+File:  ABACUS_Fitting.h
10 10
 
11
-Purpose:  Core header file, includes all descendents.
11
+Purpose:  Defines functions for fitting: linear regression etc.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#ifndef _FITTING_
16
-#define _FITTING_
15
+#ifndef ABACUS_FITTING_H
16
+#define ABACUS_FITTING_H
17 17
 
18
-namespace JSC {
18
+namespace ABACUS {
19 19
 
20 20
   // Functions in src/FITTING directory
21 21
   void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit);
22 22
   void lin_reg (Vect_DP x, Vect_DP y, Vect_DP sigma, DP& a, DP& b, DP& chisq);
23 23
   void lin_reg (Vect_DP x, Vect_DP y, DP& a, DP& b, DP& chisq);
24
-  void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a, 
24
+  void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
25 25
 	       Vect<bool>& ia, SQMat_DP& covar, SQMat_DP& alpha, DP& chisq,
26 26
 	       void funcs(const DP, Vect_DP&, DP&, Vect_DP&), DP& alambda);
27 27
   void mrqcof (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
@@ -30,8 +30,8 @@ namespace JSC {
30 30
 
31 31
   // For interpolating:
32 32
   void polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy);
33
-  void polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy);
33
+  void polint(Vect_CX& xa, Vect_CX& ya, const std::complex<DP> x, std::complex<DP>& y, std::complex<DP>& dy);
34 34
 
35
-} // namespace JSC
35
+} // namespace ABACUS
36 36
 
37 37
 #endif

+ 428
- 0
include/ABACUS_Heis.h View File

@@ -0,0 +1,428 @@
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  ABACUS_Heis.h
10
+
11
+Purpose:  Declares Heisenberg chain classes and functions.
12
+
13
+***********************************************************/
14
+
15
+#ifndef ABACUS_HEIS_H
16
+#define ABACUS_HEIS_H
17
+
18
+#include "ABACUS.h"
19
+
20
+namespace ABACUS {
21
+
22
+  // First, some global constants...
23
+
24
+  const long long int ID_UPPER_LIMIT = 10000000LL;  // max size of vectors we can define without seg fault
25
+  const int INTERVALS_SIZE = 100000;                // size of Scan_Intervals arrays
26
+  const int NBASESMAX = 1000; // max number of bases kept
27
+
28
+  const DP ITER_REQ_PREC = 100.0 * MACHINE_EPS_SQ;
29
+
30
+  // Cutoffs on particle numbers
31
+  const int MAXSTRINGS = 20;      // maximal number of particle types we allow in bases
32
+
33
+  const int NEXC_MAX_HEIS = 16; // maximal number of excitations (string binding/unbinding, particle-hole) considered
34
+
35
+
36
+  //***********************************************************************
37
+
38
+  class Heis_Chain {
39
+
40
+  public:
41
+    DP J;
42
+    DP Delta;
43
+    DP anis;  // acos(Delta) if Delta < 1.0, 0 if Delta == 1.0, acosh(Delta) if Delta > 1.0
44
+    DP hz;
45
+    int Nsites;
46
+    int Nstrings;  // how many possible strings.  The following two arrays have Nstrings nonzero elements.
47
+    int* Str_L; // vector (length M) containing the allowed string lengths.  Elements that are 0 have no meaning.
48
+    int* par;    // vector (length M) containing the parities of the strings.  Elements that are 0 have no meaning.
49
+    // Parities are all +1 except for gapless XXZ subcases
50
+    DP* si_n_anis_over_2;  // for optimization: sin for XXZ, sinh for XXZ_gpd
51
+    DP* co_n_anis_over_2;  // for optimization
52
+    DP* ta_n_anis_over_2;  // for optimization
53
+    DP prec;  // precision required for computations, always put to ITER_REQ_PREC
54
+
55
+  public:
56
+    Heis_Chain ();
57
+    Heis_Chain (DP JJ, DP DD, DP hh, int NN);  // contructor:  simply initializes
58
+    Heis_Chain (const Heis_Chain& RefChain);            // copy constructor;
59
+    Heis_Chain& operator= (const Heis_Chain& RefChain);
60
+    bool operator== (const Heis_Chain& RefChain);
61
+    bool operator!= (const Heis_Chain& RefChain);
62
+    ~Heis_Chain();  // destructor
63
+
64
+  };
65
+
66
+
67
+  //****************************************************************************
68
+
69
+  // Objects in class Heis_Base are a checked vector containing the number of rapidities of allowable types for a given state
70
+
71
+  class Heis_Base {
72
+
73
+  public:
74
+    int Mdown;         // total number of down spins
75
+    Vect<int> Nrap;    // Nrap[i] contains the number of rapidities of type i, i = 0, Nstrings - 1.
76
+    int Nraptot;       // total number of strings in this state
77
+    Vect<DP> Ix2_infty;  // Ix2_infty[i] contains the max of BAE function for the (half-)integer I[i], i = 0, Nstrings - 1.
78
+    Vect<int> Ix2_min;
79
+    Vect<int> Ix2_max;    // Ix2_max[i] contains the integer part of 2*I_infty, with correct parity for base.
80
+    double dimH;          // dimension of sub Hilbert space associated to this base; use double to avoid max int problems.
81
+    std::string baselabel;      // base label
82
+
83
+  public:
84
+    Heis_Base ();
85
+    Heis_Base (const Heis_Base& RefBase);  // copy constructor
86
+    Heis_Base (const Heis_Chain& RefChain, int M);  // constructs configuration with all Mdown in one-string of +1 parity
87
+    Heis_Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities);  // sets to Nrapidities vector, and checks consistency
88
+    Heis_Base (const Heis_Chain& RefChain, std::string baselabel_ref);
89
+    inline int& operator[] (const int i);
90
+    inline const int& operator[] (const int i) const;
91
+    Heis_Base& operator= (const Heis_Base& RefBase);
92
+    bool operator== (const Heis_Base& RefBase);
93
+    bool operator!= (const Heis_Base& RefBase);
94
+
95
+    void Compute_Ix2_limits(const Heis_Chain& RefChain);  // computes the Ix2_infty and Ix2_max
96
+
97
+  };
98
+
99
+  inline int& Heis_Base::operator[] (const int i)
100
+  {
101
+    return Nrap[i];
102
+  }
103
+
104
+  inline const int& Heis_Base::operator[] (const int i) const
105
+  {
106
+    return Nrap[i];
107
+  }
108
+
109
+
110
+  //****************************************************************************
111
+
112
+  // Objects in class Lambda carry all rapidities of a state
113
+
114
+  class Lambda {
115
+
116
+  private:
117
+    int Nstrings;
118
+    Vect<int> Nrap;
119
+    int Nraptot;
120
+    DP** lambda;
121
+
122
+  public:
123
+    Lambda ();
124
+    Lambda (const Heis_Chain& RefChain, int M);   // constructor, puts all lambda's to zero
125
+    Lambda (const Heis_Chain& RefChain, const Heis_Base& base);   // constructor, putting I's to lowest-energy config
126
+    // consistent with Heis_Base configuration for chain RefChain
127
+    Lambda& operator= (const Lambda& RefConfig);
128
+    inline DP* operator[] (const int i);
129
+    inline const DP* operator[] (const int i) const;
130
+    ~Lambda();
131
+
132
+  };
133
+
134
+  inline DP* Lambda::operator[] (const int i)
135
+  {
136
+    return lambda[i];
137
+  }
138
+
139
+  inline const DP* Lambda::operator[] (const int i) const
140
+  {
141
+    return lambda[i];
142
+  }
143
+
144
+
145
+  //****************************************************************************
146
+
147
+  // Objects in class Heis_Bethe_State carry all information about an eigenstate
148
+
149
+  // Derived classes include XXZ_Bethe_State, XXX_Bethe_State, XXZ_gpd_Bethe_State
150
+  // These contain subclass-specific functions and data.
151
+
152
+  class Heis_Bethe_State {
153
+
154
+  public:
155
+    Heis_Chain chain;
156
+    Heis_Base base;
157
+    Vect<Vect<int> > Ix2;
158
+    Lambda lambda;
159
+    Lambda deviation;      // string deviations
160
+    Lambda BE;             // Bethe equation for relevant rapidity, in the form BE = theta - (1/N)\sum ... - \pi I/N = 0
161
+    DP diffsq;             // sum of squares of rapidity differences in last iteration
162
+    int conv;              // convergence status
163
+    DP dev;                // sum of absolute values of string deviations
164
+    int iter;              // number of iterations necessary for convergence
165
+    int iter_Newton;              // number of iterations necessary for convergence (Newton method)
166
+    DP E;                  // total energy
167
+    int iK;                // K = 2.0*PI * iK/Nsites
168
+    DP K;                  // total momentum
169
+    DP lnnorm;             // ln of norm of reduced Gaudin matrix
170
+    std::string label;
171
+
172
+  public:
173
+    Heis_Bethe_State ();
174
+    Heis_Bethe_State (const Heis_Bethe_State& RefState);  // copy constructor
175
+    Heis_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
176
+    Heis_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
177
+    virtual ~Heis_Bethe_State () {};
178
+
179
+  public:
180
+    int Charge () { return(base.Mdown); };
181
+    void Set_to_Label (std::string label_ref, const Vect<Vect<int> >& OriginIx2);
182
+    void Set_Label_from_Ix2 (const Vect<Vect<int> >& OriginIx2);
183
+    bool Check_Symmetry ();  // checks whether the I's are symmetrically distributed
184
+    void Compute_diffsq ();  // \sum BE[j][alpha]^2
185
+    void Find_Rapidities (bool reset_rapidities);  // Finds the rapidities
186
+    void Find_Rapidities_Twisted (bool reset_rapidities, DP twist);  // Finds the rapidities with twist added to RHS of logBE
187
+    void Solve_BAE_bisect (int j, int alpha, DP req_prec, int itermax);
188
+    void Iterate_BAE (DP iter_factor);     // Finds new set of lambda[j][alpha] from previous one by simple iteration
189
+    void Solve_BAE_straight_iter (DP straight_prec, int max_iter_interp, DP iter_factor);
190
+    void Solve_BAE_extrap (DP extrap_prec, int max_iter_extrap, DP iter_factor);
191
+    void Iterate_BAE_Newton ();     // Finds new set of lambda[j][alpha] from previous one by a Newton step
192
+    void Solve_BAE_Newton (DP Newton_prec, int max_iter_Newton);
193
+    void Solve_BAE_with_silk_gloves (DP silk_prec, int max_iter_silk, DP iter_factor);
194
+    void Compute_lnnorm ();
195
+    void Compute_Momentum ();
196
+    void Compute_All (bool reset_rapidities);     // solves BAE, computes E, K and lnnorm
197
+
198
+    inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<Vect<int> >& OriginStateIx2)
199
+    {
200
+      Ix2[0][0] = Ix2[0][1] - 2;
201
+      Ix2[0][base.Nrap[0] - 1] = Ix2[0][base.Nrap[0] - 2] + 2;
202
+      (*this).Compute_Momentum();
203
+      if (base.Nrap[0] == 0) return(false);
204
+      if (iKneeded >= iK) Ix2[0][base.Nrap[0]-1] += 2*(iKneeded - iK);
205
+      else Ix2[0][0] += 2*(iKneeded - iK);
206
+      if (Ix2[0][0] < base.Ix2_min[0] || Ix2[0][base.Nrap[0]-1] > base.Ix2_max[0]) return(false);
207
+      (*this).Set_Label_from_Ix2 (OriginStateIx2);
208
+      return(true);
209
+    }
210
+    void Set_to_Outer_Skeleton (const Vect<Vect<int> >& OriginStateIx2) {
211
+      Ix2[0][0] = base.Ix2_min[0] - 4;
212
+      Ix2[0][base.Nrap[0]-1] = base.Ix2_max[0] + 4;
213
+      (*this).Set_Label_from_Ix2 (OriginStateIx2);
214
+    };
215
+
216
+    void Set_to_Closest_Matching_Ix2_fixed_Base (const Heis_Bethe_State& StateToMatch); // defined in Heis.cc
217
+
218
+
219
+    // Virtual functions, all defined in the derived classes
220
+
221
+  public:
222
+    virtual void Set_Free_lambdas() { ABACUSerror("Heis_Bethe_State::..."); }  // sets the rapidities to solutions of BAEs without scattering terms
223
+    virtual bool Check_Admissibility(char option) { ABACUSerror("Heis_Bethe_State::..."); return(false); }
224
+    // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
225
+    virtual void Compute_BE (int j, int alpha) { ABACUSerror("Heis_Bethe_State::..."); }
226
+    virtual void Compute_BE () { ABACUSerror("Heis_Bethe_State::..."); }
227
+    virtual DP Iterate_BAE(int i, int alpha) { ABACUSerror("Heis_Bethe_State::..."); return(0.0);}
228
+    virtual bool Check_Rapidities() { ABACUSerror("Heis_Bethe_State::..."); return(false); }
229
+    virtual DP String_delta () { ABACUSerror("Heis_Bethe_State::..."); return(0.0); }
230
+    virtual void Compute_Energy () { ABACUSerror("Heis_Bethe_State::..."); }
231
+    virtual void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red) { ABACUSerror("Heis_Bethe_State::..."); }
232
+  };
233
+
234
+  inline bool Is_Inner_Skeleton (Heis_Bethe_State& State) {
235
+    return (State.base.Nrap[0] >= 2 && (State.Ix2[0][0] == State.Ix2[0][1] - 2 || State.Ix2[0][State.base.Nrap[0]-1] == State.Ix2[0][State.base.Nrap[0]-2] + 2));
236
+  };
237
+  inline bool Is_Outer_Skeleton (Heis_Bethe_State& State) {
238
+    return (State.Ix2[0][0] == State.base.Ix2_min[0] - 4 && State.Ix2[0][State.base.Nrap[0]-1] == State.base.Ix2_max[0] + 4);
239
+  };
240
+
241
+  inline bool Force_Descent (char whichDSF, Heis_Bethe_State& ScanState, Heis_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
242
+  {
243
+    bool force_descent = false;
244
+
245
+    // Force descent for all DSFs if we're at K = 0 or PI and not conserving momentum upon descent:
246
+    if (desc_type_required > 8 && (2*(ScanState.iK - RefState.iK) % iKmod == 0)) force_descent = true; // type_req > 8 means that we don't conserve momentum
247
+
248
+    return(force_descent);
249
+  }
250
+
251
+
252
+  std::ostream& operator<< (std::ostream& s, const Heis_Bethe_State& state);
253
+
254
+
255
+  //****************************************************************************
256
+
257
+  // Objects in class XXZ_Bethe_State carry all extra information pertaining to XXZ gapless
258
+
259
+  class XXZ_Bethe_State : public Heis_Bethe_State {
260
+
261
+  public:
262
+    Lambda sinhlambda;
263
+    Lambda coshlambda;
264
+    Lambda tanhlambda;
265
+
266
+  public:
267
+    XXZ_Bethe_State ();
268
+    XXZ_Bethe_State (const XXZ_Bethe_State& RefState);  // copy constructor
269
+    XXZ_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
270
+    XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
271
+
272
+  public:
273
+    XXZ_Bethe_State& operator= (const XXZ_Bethe_State& RefState);
274
+
275
+  public:
276
+    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
277
+    void Compute_sinhlambda();
278
+    void Compute_coshlambda();
279
+    void Compute_tanhlambda();
280
+    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
281
+    void Compute_BE (int j, int alpha);
282
+    void Compute_BE ();
283
+    DP Iterate_BAE(int i, int j);
284
+    bool Check_Rapidities();  // checks that all rapidities are not nan
285
+    DP String_delta ();
286
+    void Compute_Energy ();
287
+    void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
288
+
289
+    // XXZ specific functions:
290
+  public:
291
+
292
+  };
293
+
294
+  XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState);
295
+  XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState);
296
+
297
+
298
+  //****************************************************************************
299
+
300
+  // Objects in class XXX_Bethe_State carry all extra information pertaining to XXX antiferromagnet
301
+
302
+  class XXX_Bethe_State : public Heis_Bethe_State {
303
+
304
+  public:
305
+    XXX_Bethe_State ();
306
+    XXX_Bethe_State (const XXX_Bethe_State& RefState);  // copy constructor
307
+    XXX_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
308
+    XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
309
+
310
+  public:
311
+    XXX_Bethe_State& operator= (const XXX_Bethe_State& RefState);
312
+
313
+  public:
314
+    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
315
+    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
316
+    void Compute_BE (int j, int alpha);
317
+    void Compute_BE ();
318
+    DP Iterate_BAE(int i, int j);
319
+    bool Check_Rapidities();  // checks that all rapidities are not nan
320
+    DP String_delta ();
321
+    void Compute_Energy ();
322
+    void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
323
+
324
+    // XXX specific functions
325
+  public:
326
+    bool Check_Finite_rap ();
327
+
328
+  };
329
+
330
+  XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState);
331
+  XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState);
332
+
333
+  //****************************************************************************
334
+
335
+  // Objects in class XXZ_gpd_Bethe_State carry all extra information pertaining to XXZ gapped antiferromagnets
336
+
337
+  class XXZ_gpd_Bethe_State : public Heis_Bethe_State {
338
+
339
+  public:
340
+    Lambda sinlambda;
341
+    Lambda coslambda;
342
+    Lambda tanlambda;
343
+
344
+  public:
345
+    XXZ_gpd_Bethe_State ();
346
+    XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState);  // copy constructor
347
+    XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
348
+    XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
349
+
350
+  public:
351
+    XXZ_gpd_Bethe_State& operator= (const XXZ_gpd_Bethe_State& RefState);
352
+
353
+  public:
354
+    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
355
+    void Compute_sinlambda();
356
+    void Compute_coslambda();
357
+    void Compute_tanlambda();
358
+    int Weight();   // weight function for contributions cutoff
359
+    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
360
+    void Compute_BE (int j, int alpha);
361
+    void Compute_BE ();
362
+    DP Iterate_BAE(int i, int j);
363
+    void Iterate_BAE_Newton();
364
+    bool Check_Rapidities();  // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
365
+    DP String_delta ();
366
+    void Compute_Energy ();
367
+    void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
368
+
369
+    // XXZ_gpd specific functions
370
+  public:
371
+
372
+  };
373
+
374
+  XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
375
+  XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
376
+
377
+
378
+  //***********************************************
379
+
380
+  // Function declarations
381
+
382
+  // in M_vs_H.cc
383
+  DP Ezero (DP Delta, int N, int M);
384
+  DP H_vs_M (DP Delta, int N, int M);
385
+  DP HZmin (DP Delta, int N, int M, Vect_DP& Ezero_ref);
386
+  int M_vs_H (DP Delta, int N, DP HZ);
387
+
388
+  DP X_avg (char xyorz, DP Delta, int N, int M);
389
+
390
+  DP Chemical_Potential (const Heis_Bethe_State& RefState);
391
+  DP Particle_Hole_Excitation_Cost (char whichDSF, Heis_Bethe_State& AveragingState);
392
+
393
+  //DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded);
394
+  DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
395
+  void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
396
+
397
+  std::complex<DP> ln_Sz_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
398
+  std::complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
399
+
400
+  std::complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
401
+  std::complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
402
+
403
+  // From Antoine Klauser:
404
+  std::complex<DP> ln_Szz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
405
+  std::complex<DP> ln_Szm_p_Smz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
406
+  std::complex<DP> ln_Smm_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
407
+
408
+  std::complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
409
+  std::complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
410
+
411
+
412
+  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
413
+				     XXZ_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
414
+  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
415
+				     XXX_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
416
+  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
417
+				     XXZ_gpd_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
418
+
419
+  // For geometric quench:
420
+  std::complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B);
421
+
422
+  void Scan_Heis_Geometric_Quench (DP Delta, int N_1, int M, long long int base_id_1, long long int type_id_1, long long int id_1,
423
+				   int N_2, int iKmin, int iKmax, int Max_Secs, bool refine);
424
+
425
+
426
+} // namespace ABACUS
427
+
428
+#endif

include/JSC_Integ.h → include/ABACUS_Integ.h View File

@@ -1,31 +1,30 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_Integ.h
9
+File:  ABACUS_Integ.h
10 10
 
11 11
 Purpose:  Declares combinatorics-related classes and functions.
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#ifndef _INTEG_
17
-#define _INTEG_
15
+#ifndef ABACUS_INTEG_H
16
+#define ABACUS_INTEG_H
18 17
 
19
-#include "JSC.h"
18
+#include "ABACUS.h"
20 19
 
21
-namespace JSC {
20
+namespace ABACUS {
22 21
 
23 22
 
24 23
   //**********************  Class Domain ************************
25 24
 
26 25
   template<class T>
27 26
     class Domain {
28
-    
27
+
29 28
   private:
30 29
     Vect<T> bdry;
31 30
 
@@ -35,41 +34,41 @@ namespace JSC {
35 34
 	bdry[0] = T(0);
36 35
 	bdry[1] = T(0);
37 36
       }
38
-    
37
+
39 38
   public:
40 39
     Domain (T xmin_ref, T xmax_ref) : bdry(Vect<T>(2))
41 40
       {
42
-	if (xmax_ref < xmin_ref) JSCerror("Use xmax > xmin in Domain.");
43
-	
41
+	if (xmax_ref < xmin_ref) ABACUSerror("Use xmax > xmin in Domain.");
42
+
44 43
 	bdry[0] = xmin_ref;
45 44
 	bdry[1] = xmax_ref;
46 45
       }
47
-      
46
+
48 47
   public:
49 48
     inline T xmin (int i)
50
-      {
51
-	if (i > bdry.size()/2) JSCerror("i index too high in Domain::xmin.");
52
-	
53
-	return(bdry[2*i]);
54
-      }
55
-    
49
+    {
50
+      if (i > bdry.size()/2) ABACUSerror("i index too high in Domain::xmin.");
51
+
52
+      return(bdry[2*i]);
53
+    }
54
+
56 55
   public:
57 56
     inline T xmax (int i)
58
-      {
59
-	if (i > bdry.size()/2) JSCerror("i index too high in Domain::xmax.");
60
-	
61
-	return(bdry[2*i + 1]);
62
-      }
63
-    
57
+    {
58
+      if (i > bdry.size()/2) ABACUSerror("i index too high in Domain::xmax.");
59
+
60
+      return(bdry[2*i + 1]);
61
+    }
62
+
64 63
   public:
65 64
     inline int Ndomains ()
66
-      {
67
-	return(bdry.size()/2);
68
-      }
65
+    {
66
+      return(bdry.size()/2);
67
+    }
69 68
 
70 69
   public:
71 70
     void Include (T xmin_ref, T xmax_ref) {
72
-      
71
+
73 72
       // Determine the indices of xmin_ref & xmax_ref
74 73
       int xmin_reg = -1;
75 74
       int xmax_reg = -1;
@@ -79,15 +78,13 @@ namespace JSC {
79 78
 	if ((i+1) % 2 && bdry[i] <= xmax_ref) xmax_reg++;
80 79
 	if (i % 2 && bdry[i] < xmax_ref) xmax_reg++;
81 80
       }
82
-      
83
-      //cout << "Include: xmin_reg = " << xmin_reg << "\txmax_reg = " << xmax_reg << endl;
84
-      
81
+
85 82
       Vect<T> new_bdry(bdry.size() + 2 * ((xmin_reg % 2 && xmax_reg % 2) - (xmax_reg - xmin_reg)/2));
86
-      
83
+
87 84
       int ishift = 0;
88 85
       for (int i = 0; i <= xmin_reg; ++i) new_bdry[i] = bdry[i];
89 86
       if (xmin_reg % 2) {
90
-	new_bdry[xmin_reg + 1] = xmin_ref; 
87
+	new_bdry[xmin_reg + 1] = xmin_ref;
91 88
 	ishift++;
92 89
 	if (xmax_reg % 2) {
93 90
 	  new_bdry[xmin_reg + 2] = xmax_ref;
@@ -100,15 +97,15 @@ namespace JSC {
100 97
       }
101 98
       for (int i = xmin_reg + ishift + 1; i < new_bdry.size(); ++i)
102 99
 	new_bdry[i] = bdry[xmax_reg - xmin_reg - ishift + i];
103
-      
100
+
104 101
       bdry = new_bdry;
105
-      
102
+
106 103
       return;
107 104
     }
108
-    
105
+
109 106
   public:
110 107
     void Exclude (T xmin_ref, T xmax_ref) {
111
-      
108
+
112 109
       // Determine the indices of xmin_ref & xmax_ref
113 110
       int xmin_reg = -1;
114 111
       int xmax_reg = -1;
@@ -118,15 +115,13 @@ namespace JSC {
118 115
 	if ((i+1) % 2 && bdry[i] <= xmax_ref) xmax_reg++;
119 116
 	if (i % 2 && bdry[i] < xmax_ref) xmax_reg++;
120 117
       }
121
-      
122
-      //cout << "Exclude: xmin_reg = " << xmin_reg << "\txmax_reg = " << xmax_reg << endl;
123
-      
118
+
124 119
       Vect<T> new_bdry(bdry.size() + 2 * (((xmin_reg + 1) % 2 && (xmax_reg + 1) % 2) - (xmax_reg - xmin_reg)/2));
125
-      
120
+
126 121
       int ishift = 0;
127 122
       for (int i = 0; i <= xmin_reg; ++i) new_bdry[i] = bdry[i];
128 123
       if ((xmin_reg + 1) % 2) {
129
-	new_bdry[xmin_reg + 1] = xmin_ref; 
124
+	new_bdry[xmin_reg + 1] = xmin_ref;
130 125
 	ishift++;
131 126
 	if ((xmax_reg + 1) % 2) {
132 127
 	  new_bdry[xmin_reg + 2] = xmax_ref;
@@ -139,24 +134,25 @@ namespace JSC {
139 134
       }
140 135
       for (int i = xmin_reg + ishift + 1; i < new_bdry.size(); ++i)
141 136
 	new_bdry[i] = bdry[xmax_reg - xmin_reg - ishift + i];
142
-      
137
+
143 138
       bdry = new_bdry;
144
-      
139
+
145 140
       return;
146 141
     }
147
-    
142
+
148 143
   };
149 144
 
150 145
   template<class T>
151 146
     std::ostream& operator<< (std::ostream& s, Domain<T> dom)
152 147
     {
153 148
       for (int i = 0; i < dom.Ndomains(); ++i) {
154
-	if (i > 0) s << endl;
149
+	if (i > 0) s << std::endl;
155 150
 	s << dom.xmin(i) << "\t" << dom.xmax(i);
156 151
       }
157 152
       return(s);
158 153
     }
159 154
 
155
+
160 156
   // ********************************* struct I_table ************************
161 157
 
162 158
   struct I_table {
@@ -168,11 +164,9 @@ namespace JSC {
168 164
     DP alpha;
169 165
     DP logalpha;
170 166
     DP prec;
171
-    //Vect_DP rho_tbl;
172
-    //Vect_DP I_tbl;
173 167
     DP* rho_tbl;
174 168
     DP* I_tbl;
175
-    
169
+
176 170
     I_table (DP (*function) (DP, DP), DP rhomin_ref, DP rhomax_ref, int Nvals_ref, DP req_prec);
177 171
     DP Return_val (DP req_rho);
178 172
     void Save ();
@@ -195,8 +189,9 @@ namespace JSC {
195 189
     int maxnrpts;
196 190
     DP* rho_tbl;
197 191
     DP* I_tbl;
198
-    
199
-    Integral_table (DP (*function) (DP, DP, int), const char* filenameprefix_ref, DP rhomin_ref, DP rhomax_ref, int Nvals_ref, DP req_prec, int max_nr_pts);
192
+
193
+    Integral_table (DP (*function) (DP, DP, int), const char* filenameprefix_ref, DP rhomin_ref,
194
+		    DP rhomax_ref, int Nvals_ref, DP req_prec, int max_nr_pts);
200 195
     DP Return_val (DP req_rho);
201 196
     void Save (const char* filenameprefix);
202 197
     bool Load (const char* filenameprefix, DP rhomin_ref, DP rhomax_ref, int Nvals_ref, DP req_prec, int max_nr_pts);
@@ -207,16 +202,17 @@ namespace JSC {
207 202
   // ******************************** Recursive integration functions ******************************
208 203
 
209 204
   DP Integrate_Riemann (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, int Npts);
210
-  DP Integrate_Riemann_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, 
205
+  DP Integrate_Riemann_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
211 206
 				    DP xmin, DP xmax, int Npts);
212 207
 
213 208
   DP Integrate_rec (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, DP req_prec, int max_rec_level);
214
-  DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, 
209
+  DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
215 210
 				DP xmin, DP xmax, DP req_prec, int max_rec_level);
216
-  DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, 
217
-				DP xmin, DP xmax, DP req_prec, int max_rec_level, ofstream& outfile);
218
-  DP Integrate_rec_using_table_and_file (DP (*function) (Vect_DP, I_table, ofstream&), Vect_DP& args, int arg_to_integ, I_table Itable, 
219
-					 DP xmin, DP xmax, DP req_prec, int max_rec_level, ofstream& outfile);
211
+  DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
212
+				DP xmin, DP xmax, DP req_prec, int max_rec_level, std::ofstream& outfile);
213
+  DP Integrate_rec_using_table_and_file (DP (*function) (Vect_DP, I_table, std::ofstream&), Vect_DP& args,
214
+					 int arg_to_integ, I_table Itable,
215
+					 DP xmin, DP xmax, DP req_prec, int max_rec_level, std::ofstream& outfile);
220 216
 
221 217
 
222 218
 
@@ -240,12 +236,11 @@ namespace JSC {
240 236
   class Integral_data {
241 237
 
242 238
   private:
243
-    data_pt* data;  
239
+    data_pt* data;
244 240
     DP* abs_d2f_dx;  // second derivative * dx
245
-    DP max_abs_d2f_dx;  // 
241
+    DP max_abs_d2f_dx;  //
246 242
 
247 243
   public:
248
-    //int n_vals;
249 244
     Integral_result integ_res;
250 245
 
251 246
   public:
@@ -254,37 +249,44 @@ namespace JSC {
254 249
 
255 250
   public:
256 251
     Integral_data (DP (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
257
-    Integral_data (DP (*function_ref) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ_ref, I_table Itable, DP xmin_ref, DP xmax_ref);
258
-    Integral_data (DP (*function_ref) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ_ref, Integral_table Itable, DP xmin_ref, DP xmax_ref);
259
-    void Save (ofstream& outfile);
252
+    Integral_data (DP (*function_ref) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ_ref,
253
+		   I_table Itable, DP xmin_ref, DP xmax_ref);
254
+    Integral_data (DP (*function_ref) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ_ref,
255
+		   Integral_table Itable, DP xmin_ref, DP xmax_ref);
256
+    void Save (std::ofstream& outfile);
260 257
     void Improve_estimate (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
261 258
     void Improve_estimate (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, int Npts_max);
262
-    void Improve_estimate (DP (*function) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ, Integral_table Itable, int Npts_max);
259
+    void Improve_estimate (DP (*function) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ,
260
+			   Integral_table Itable, int Npts_max);
263 261
     ~Integral_data ();
264 262
 
265 263
   };
266 264
 
267
-  Integral_result Integrate_optimal (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
268
-  Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ, 
265
+  Integral_result Integrate_optimal (DP (*function) (Vect_DP), Vect_DP& args,
266
+				     int arg_to_integ, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
267
+  Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
269 268
 						 I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
270
-  Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, Integral_table Itable), Vect_DP& args, int arg_to_integ, 
271
-						 Integral_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
269
+  Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, Integral_table Itable), Vect_DP& args, int arg_to_integ,
270
+						 Integral_table Itable, DP xmin, DP xmax, DP req_rel_prec,
271
+						 DP req_abs_prec, int max_nr_pts);
272
+
273
+  Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
274
+						 I_table Itable, DP xmin, DP xmax, DP req_rel_prec,
275
+						 DP req_abs_prec, int max_nr_pts, std::ofstream& outfile);
272 276
 
273
-  Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ, 
274
-						 I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, ofstream& outfile);
275 277
 
276 278
   // ******************************** Recursive version:  optimal, complex implementation ******************************
277 279
 
278
-  // NB:  function returns complex values but takes real arguments 
280
+  // NB:  function returns complex values but takes real arguments
279 281
 
280 282
   struct data_pt_CX {
281 283
     DP x;
282
-    complex<DP> f;
284
+    std::complex<DP> f;
283 285
     DP dx;
284 286
   };
285 287
 
286 288
   struct Integral_result_CX {
287
-    complex<DP> integ_est;
289
+    std::complex<DP> integ_est;
288 290
     DP abs_prec;
289 291
     DP rel_prec;
290 292
     int n_vals;
@@ -293,12 +295,11 @@ namespace JSC {
293 295
   class Integral_data_CX {
294 296
 
295 297
   private:
296
-    data_pt_CX* data;  
298
+    data_pt_CX* data;
297 299
     DP* abs_d2f_dx;  // second derivative * dx
298
-    DP max_abs_d2f_dx;  // 
300
+    DP max_abs_d2f_dx;  //
299 301
 
300 302
   public:
301
-    //int n_vals;
302 303
     Integral_result_CX integ_res;
303 304
 
304 305
   public:
@@ -306,26 +307,24 @@ namespace JSC {
306 307
     DP xmax;
307 308
 
308 309
   public:
309
-    Integral_data_CX (complex<DP> (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
310
-    //Integral_data_CX (complex<DP> (*function_ref) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ_ref, I_table Itable, DP xmin_ref, DP xmax_ref);
311
-    void Save (ofstream& outfile);
312
-    void Improve_estimate (complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
313
-    //void Improve_estimate (complex<DP> (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, int Npts_max);
310
+    Integral_data_CX (std::complex<DP> (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
311
+    void Save (std::ofstream& outfile);
312
+    void Improve_estimate (std::complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
314 313
     ~Integral_data_CX ();
315 314
 
316 315
   };
317 316
 
318
-  Integral_result_CX Integrate_optimal (complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, 
317
+  Integral_result_CX Integrate_optimal (std::complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax,
319 318
 					DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
320
-  //Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ, 
319
+  //Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
321 320
   //					 I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
322
-  //Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ, 
323
-  //					 I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, ofstream& outfile);
321
+  //Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
322
+  //					 I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, std::ofstream& outfile);
324 323
 
325 324
 
326 325
 
327 326
 
328 327
 
329
-} // namespace JSC
328
+} // namespace ABACUS
330 329
 
331 330
 #endif

include/JSC_LiebLin.h → include/ABACUS_LiebLin.h View File

@@ -2,49 +2,46 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_LiebLin.h
9
+File:  ABACUS_LiebLin.h
10 10
 
11 11
 Purpose:  Declares LiebLin gas-related classes and functions.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#ifndef _LIEBLIN_
16
-#define _LIEBLIN_
15
+#ifndef ABACUS_LIEBLIN_H
16
+#define ABACUS_LIEBLIN_H
17 17
 
18
-#include "JSC.h"
18
+#include "ABACUS.h"
19 19
 
20
-namespace JSC {
20
+namespace ABACUS {
21 21
 
22 22
   // First, some global constants...
23 23
 
24
-  //const DP ITER_REQ_PREC_LIEBLIN = 1.0e+6 * MACHINE_EPS_SQ;
25 24
   const DP ITER_REQ_PREC_LIEBLIN = 1.0e+4 * MACHINE_EPS_SQ;
26 25
 
27 26
   const int LIEBLIN_Ix2_MIN = -1000000; // Like a UV cutoff. Assumption: never reached in scanning.
28 27
   const int LIEBLIN_Ix2_MAX = -LIEBLIN_Ix2_MIN;
29 28
 
29
+
30 30
   //***********************************************************************
31 31
 
32
-  //class LiebLin_Bethe_State : public Bethe_State {
33 32
   class LiebLin_Bethe_State {
34 33
 
35 34
   public:
36 35
     DP c_int;  // interaction parameter
37
-    DP L;  
36
+    DP L;
38 37
     DP cxL;
39 38
     int N;
40
-    string label;
41
-    //Vect<int> OriginStateIx2; // quantum numbers of state on which excitations are built; always ordered
39
+    std::string label;
42 40
     Vect<int> Ix2_available; // quantum numbers which are allowable but not occupied
43 41
     Vect<int> index_first_hole_to_right;
44 42
     Vect<int> displacement;
45 43
     Vect<int> Ix2;
46 44
     Vect<DP> lambdaoc;
47
-    //Vect<DP> BE;
48 45
     Vect<DP> S; // scattering sum
49 46
     Vect<DP> dSdlambdaoc; // its derivative
50 47
     DP diffsq;
@@ -62,9 +59,9 @@ namespace JSC {
62 59
     LiebLin_Bethe_State& operator= (const LiebLin_Bethe_State& RefState);
63 60
 
64 61
   public:
65
-    int Charge () { return(N); }; 
66
-    void Set_to_Label (string label_ref, const Vect<int>& OriginStateIx2);
67
-    void Set_to_Label (string label_ref); // assumes OriginState == GroundState
62
+    int Charge () { return(N); };
63
+    void Set_to_Label (std::string label_ref, const Vect<int>& OriginStateIx2);
64
+    void Set_to_Label (std::string label_ref); // assumes OriginState == GroundState
68 65
     void Set_Label_from_Ix2 (const Vect<int>& OriginStateIx2);
69 66
     void Set_Label_Internals_from_Ix2 (const Vect<int>& OriginStateIx2);
70 67
     bool Check_Admissibility(char whichDSF); // always returns true
@@ -88,7 +85,7 @@ namespace JSC {
88 85
     void Parity_Flip ();  // takes all lambdaoc to -lambdaoc
89 86
     inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<int>& OriginIx2)
90 87
     {
91
-      if (N < 3) JSCerror("N<3 incompatible with fixed momentum scanning");
88
+      if (N < 3) ABACUSerror("N<3 incompatible with fixed momentum scanning");
92 89
       Ix2[0] = Ix2[1] - 2;
93 90
       Ix2[N-1] = Ix2[N-2] + 2;
94 91
       (*this).Compute_Momentum();
@@ -98,27 +95,28 @@ namespace JSC {
98 95
       (*this).Set_Label_from_Ix2 (OriginIx2);
99 96
       return(true);
100 97
     }
101
-    void Set_to_Outer_Skeleton (const Vect<int>& OriginIx2) 
102
-    { 
103
-      Ix2[0] = LIEBLIN_Ix2_MIN + (N % 2) + 1; 
104
-      Ix2[N-1] = LIEBLIN_Ix2_MAX - (N % 2) - 1; 
98
+    void Set_to_Outer_Skeleton (const Vect<int>& OriginIx2)
99
+    {
100
+      Ix2[0] = LIEBLIN_Ix2_MIN + (N % 2) + 1;
101
+      Ix2[N-1] = LIEBLIN_Ix2_MAX - (N % 2) - 1;
105 102
       (*this).Set_Label_from_Ix2 (OriginIx2);
106
-      //cout << "Set state to outer skeleton: Ix2 " << (*this).Ix2 << endl;
107
-      //cout << "label " << (*this).label << endl;
108 103
     };
109 104
   };
110 105
 
111
-  inline bool Is_Inner_Skeleton (LiebLin_Bethe_State& State) { 
112
-    return (State.N >= 2 && (State.Ix2[0] == State.Ix2[1] - 2 || State.Ix2[State.N-1] == State.Ix2[State.N-2] + 2)); 
113
-  }; 
114
-  inline bool Is_Outer_Skeleton (LiebLin_Bethe_State& State) { 
115
-    return (State.N >= 2 && State.Ix2[0] == LIEBLIN_Ix2_MIN + (State.N % 2) + 1 && State.Ix2[State.N-1] == LIEBLIN_Ix2_MAX - (State.N % 2) - 1); 
116
-  }; 
117
-  inline bool Is_Outer_Skeleton (const LiebLin_Bethe_State& State) { 
118
-    return (State.N >= 2 && State.Ix2[0] == LIEBLIN_Ix2_MIN + (State.N % 2) + 1 && State.Ix2[State.N-1] == LIEBLIN_Ix2_MAX - (State.N % 2) - 1); 
119
-  }; 
120
-
121
-  inline bool Force_Descent (char whichDSF, LiebLin_Bethe_State& ScanState, LiebLin_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
106
+  inline bool Is_Inner_Skeleton (LiebLin_Bethe_State& State) {
107
+    return (State.N >= 2 && (State.Ix2[0] == State.Ix2[1] - 2 || State.Ix2[State.N-1] == State.Ix2[State.N-2] + 2));
108
+  };
109
+  inline bool Is_Outer_Skeleton (LiebLin_Bethe_State& State) {
110
+    return (State.N >= 2 && State.Ix2[0] == LIEBLIN_Ix2_MIN + (State.N % 2) + 1
111
+	    && State.Ix2[State.N-1] == LIEBLIN_Ix2_MAX - (State.N % 2) - 1);
112
+  };
113
+  inline bool Is_Outer_Skeleton (const LiebLin_Bethe_State& State) {
114
+    return (State.N >= 2 && State.Ix2[0] == LIEBLIN_Ix2_MIN + (State.N % 2) + 1
115
+	    && State.Ix2[State.N-1] == LIEBLIN_Ix2_MAX - (State.N % 2) - 1);
116
+  };
117
+
118
+  inline bool Force_Descent (char whichDSF, LiebLin_Bethe_State& ScanState, LiebLin_Bethe_State& RefState,
119
+			     int desc_type_required, int iKmod, DP Chem_Pot)
122 120
   {
123 121
     bool forcedesc = false;
124 122
 
@@ -138,9 +136,12 @@ namespace JSC {
138 136
 
139 137
   DP Chemical_Potential (LiebLin_Bethe_State& RefState);
140 138
   DP Sumrule_Factor (char whichDSF, LiebLin_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
141
-  void Evaluate_F_Sumrule (char whichDSF, const LiebLin_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax, const char* RAW_Cstr, const char* FSR_Cstr);
142
-  void Evaluate_F_Sumrule (string prefix, char whichDSF, const LiebLin_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
143
-  void Evaluate_F_Sumrule (char whichDSF, DP c_int, DP L, int N, DP kBT, int nstates_req, DP Chem_Pot, int iKmin, int iKmax, const char* FSR_Cstr);
139
+  void Evaluate_F_Sumrule (char whichDSF, const LiebLin_Bethe_State& RefState, DP Chem_Pot,
140
+			   int iKmin, int iKmax, const char* RAW_Cstr, const char* FSR_Cstr);
141
+  void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const LiebLin_Bethe_State& RefState,
142
+			   DP Chem_Pot, int iKmin, int iKmax);
143
+  void Evaluate_F_Sumrule (char whichDSF, DP c_int, DP L, int N, DP kBT, int nstates_req,
144
+			   DP Chem_Pot, int iKmin, int iKmax, const char* FSR_Cstr);
144 145
 
145 146
   // in LiebLin_Utils.cc
146 147
   DP LiebLin_dE0_dc (DP c_int, DP L, int N);
@@ -152,32 +153,22 @@ namespace JSC {
152 153
 
153 154
   DP Particle_Hole_Excitation_Cost (char whichDSF, LiebLin_Bethe_State& AveragingState);
154 155
 
155
-  complex<DP> ln_Density_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
156
-  complex<DP> ln_Psi_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
157
-  complex<DP> ln_g2_ME (LiebLin_Bethe_State& mu, LiebLin_Bethe_State& lambda);
156
+  std::complex<DP> ln_Density_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
157
+  std::complex<DP> ln_Psi_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
158
+  std::complex<DP> ln_g2_ME (LiebLin_Bethe_State& mu, LiebLin_Bethe_State& lambda);
158 159
 
159
-  //DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, LiebLin_Bethe_State& LeftState, 
160
-  //				     LiebLin_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
161
-  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, LiebLin_Bethe_State& LeftState, 
162
-				     LiebLin_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
160
+  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, LiebLin_Bethe_State& LeftState,
161
+				     LiebLin_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
163 162
 
164
-  DP LiebLin_Twisted_lnnorm (Vect<complex<DP> >& lambdaoc, double cxL);
165
-  complex<DP> LiebLin_Twisted_ln_Overlap (DP expbeta, Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
166
-  complex<DP> LiebLin_Twisted_ln_Overlap (complex<DP> expbeta, Vect<complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
167
-  complex<DP> LiebLin_ln_Overlap (Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
168
-  complex<DP> LiebLin_ln_Overlap (Vect<complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
163
+  DP LiebLin_Twisted_lnnorm (Vect<std::complex<DP> >& lambdaoc, double cxL);
164
+  std::complex<DP> LiebLin_Twisted_ln_Overlap (DP expbeta, Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
165
+  std::complex<DP> LiebLin_Twisted_ln_Overlap (std::complex<DP> expbeta, Vect<std::complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
166
+  std::complex<DP> LiebLin_ln_Overlap (Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
167
+  std::complex<DP> LiebLin_ln_Overlap (Vect<std::complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
169 168
 
170 169
   // In src/LiebLin_Tgt0.cc:
171
-  //DP Entropy_rho (LiebLin_Bethe_State& RefState, int Delta);
172
-  //DP Entropy_Fixed_Delta (LiebLin_Bethe_State& RefState, int Delta);
173
-  //DP Entropy (LiebLin_Bethe_State& RefState, int Delta);
174 170
   DP Entropy (LiebLin_Bethe_State& RefState);
175
-  //DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT, int Delta);
176 171
   DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT);
177
-  //DP Entropy (LiebLin_Bethe_State& RefState, DP epsilon);
178
-  //DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT, DP epsilon);
179
-  //LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT, int Delta);
180
-  //LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT, DP epsilon);
181 172
   LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT);
182 173
   LiebLin_Bethe_State Add_Particle_at_Center (const LiebLin_Bethe_State& RefState);
183 174
   LiebLin_Bethe_State Remove_Particle_at_Center (const LiebLin_Bethe_State& RefState);
@@ -185,6 +176,6 @@ namespace JSC {
185 176
   DP rho_of_lambdaoc_2 (LiebLin_Bethe_State& RefState, DP lambdaoc, DP delta);
186 177
 
187 178
 
188
-} // namespace JSC
179
+} // namespace ABACUS
189 180
 
190 181
 #endif

+ 440
- 0
include/ABACUS_Matrix.h View File

@@ -0,0 +1,440 @@
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  ABACUS_Matrix.h
10
+
11
+Purpose:  Declares square matrix class.
12
+
13
+***********************************************************/
14
+
15
+#ifndef ABACUS_MATRIX_H
16
+#define ABACUS_MATRIX_H
17
+
18
+namespace ABACUS {
19
+
20
+
21
+  // CLASS DEFINITIONS
22
+
23
+  template <class T>
24
+    class SQMat {
25
+
26
+  private:
27
+    int dim;
28
+    T** M;
29
+
30
+  public:
31
+    SQMat (int N);             // initializes all elements of this n by n matrix to zero
32
+    SQMat (const SQMat& rhs);  // copy constructor
33
+    SQMat (const T& a, int N);  // initialize to diagonal matrix with value a (NOT like in NR !!!)
34
+    SQMat (const SQMat& a, const SQMat& b);  // initialize to tensor product of a and b
35
+    SQMat (const SQMat& a, int row_id, int col_id);  // init by cutting row row_id and col col_id
36
+    void Print ();
37
+    SQMat& operator= (const SQMat& rhs);  // assignment
38
+    SQMat& operator= (const T& a);        // assign 1 to diagonal elements (NOT like in NR !!!)
39
+    inline T* operator[] (const int i);  // subscripting: pointer to row i
40
+    inline const T* operator[] (const int i) const;
41
+    SQMat& operator+= (const T& a);
42
+    SQMat& operator+= (const SQMat& a);
43
+    SQMat& operator-= (const T& a);
44
+    SQMat& operator-= (const SQMat& a);
45
+    SQMat& operator*= (const T& a);
46
+    SQMat& operator*= (const SQMat& a);
47
+    inline int size() const;
48
+    ~SQMat();
49
+
50
+  };
51
+
52
+  template <class T>
53
+    SQMat<T>::SQMat (int N) : dim(N) , M(new T*[N])
54
+    {
55
+      M[0] = new T[N*N];
56
+      for (int i = 1; i < N; i++) M[i] = M[i-1] + N;
57
+    }
58
+
59
+  template <class T>
60
+    SQMat<T>::SQMat (const SQMat& rhs) : dim(rhs.dim) , M(new T*[dim])
61
+    {
62
+      int i,j;
63
+      M[0] = new T[dim*dim];
64
+      for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
65
+      for (i = 0; i < dim; i++)
66
+	for (j = 0; j < dim; j++) M[i][j] = rhs[i][j];
67
+    }
68
+
69
+  template <class T>
70
+    SQMat<T>::SQMat (const T& a, int N) : dim(N) , M(new T*[dim])
71
+    {
72
+      int i, j;
73
+      M[0] = new T[dim*dim];
74
+      for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
75
+      for (i = 0; i < dim; i++) {
76
+	for (j = 0; j < dim; j++) M[i][j] = T(0);
77
+	M[i][i] = a;
78
+      }
79
+    }
80
+
81
+  template <class T>
82
+    SQMat<T>::SQMat (const SQMat& a, const SQMat& b) : dim (a.dim * b.dim) , M(new T*[a.dim * b.dim])
83
+    {
84
+      M[0] = new T[a.dim * b.dim * a.dim * b.dim];
85
+
86
+      for (int i = 1; i < a.dim * b.dim; ++i) M[i] = M[i-1] + a.dim * b.dim;
87
+
88
+      for (int i1 = 0; i1 < a.dim; ++i1) {
89
+
90
+	for (int i2 = 0; i2 < a.dim; ++i2) {
91
+
92
+	  for (int j1 = 0; j1 < b.dim; ++j1) {
93
+
94
+	    for (int j2 = 0; j2 < b.dim; ++j2) {
95
+
96
+    	      M[i1 * (b.dim) + j1][i2 * (b.dim) + j2] = a[i1][i2] * b[j1][j2];
97
+	    }
98
+	  }
99
+	}
100
+      }
101
+    }
102
+
103
+  template <class T>
104
+    SQMat<T>::SQMat (const SQMat&a, int row_id, int col_id) : dim (a.dim - 1) , M(new T*[dim])
105
+    {
106
+      if (dim == 0) {
107
+	ABACUSerror("Error:  chopping a row and col from size one matrix.");
108
+	exit(1);
109
+      }
110
+
111
+      M[0] = new T[dim * dim];
112
+
113
+      for (int i = 1; i < dim; ++i) M[i] = M[i-1] + dim;
114
+
115
+      for (int i = 0; i < row_id; ++i)
116
+	for (int j = 0; j < col_id; ++j) M[i][j] = a[i][j];
117
+      for (int i = row_id; i < dim; ++i)
118
+	for (int j = 0; j < col_id; ++j) M[i][j] = a[i+1][j];
119
+      for (int i = 0; i < row_id; ++i)
120
+	for (int j = col_id; j < dim; ++j) M[i][j] = a[i][j+1];
121
+      for (int i = row_id; i < dim; ++i)
122
+	for (int j = col_id; j < dim; ++j) M[i][j] = a[i+1][j+1];
123
+
124
+    }
125
+
126
+  // operators
127
+  template <class T>
128
+    void SQMat<T>::Print ()
129
+    {
130
+      std::cout << std::endl;
131
+      for (int i = 0; i < dim; ++i) {
132
+	for (int j = 0; j < dim; ++j) std::cout << M[i][j] << " ";
133
+	std::cout << std::endl;
134
+      }
135
+      std::cout << std::endl;
136
+    }
137
+
138
+  template <class T>
139
+    SQMat<T>& SQMat<T>::operator= (const SQMat<T>& rhs)
140
+    {
141
+      if (this != &rhs) {
142
+	if (dim != rhs.dim) {
143
+	  ABACUSerror("Assignment between matrices of different dimensions.  Bailing out.");
144
+	  exit(1);
145
+	}
146
+
147
+	for (int i = 0; i < dim; ++i)
148
+	  for (int j = 0; j < dim; ++j) M[i][j] = rhs[i][j];
149
+      }
150
+      return *this;
151
+    }
152
+
153
+  template <class T>
154
+    SQMat<T>& SQMat<T>::operator= (const T& a)
155
+    {
156
+      for (int i = 0; i < dim; ++i) {
157
+	for (int j = 0; j < dim; ++j)
158
+	  M[i][j] = T(0);
159
+	M[i][i] = a;
160
+      }
161
+      return *this;
162
+    }
163
+
164
+  template <class T>
165
+    inline T* SQMat<T>::operator[] (const int i)
166
+    {
167
+      return M[i];
168
+    }
169
+
170
+  template <class T>
171
+    inline const T* SQMat<T>::operator[] (const int i) const
172
+    {
173
+      return M[i];
174
+    }
175
+
176
+  template <class T>
177
+    SQMat<T>& SQMat<T>::operator+= (const T& a)
178
+    {
179
+
180
+      for (int i = 0; i < dim; ++i) M[i][i] += a;
181
+
182
+      return *this;
183
+    }
184
+
185
+  template <class T>
186
+    SQMat<T>& SQMat<T>::operator+= (const SQMat<T>& a)
187
+    {
188
+      if (dim != a.dim) {
189
+	ABACUSerror("Incompatible matrix sizes in matrix operator +.");
190
+	exit(1);
191
+      }
192
+      for (int i = 0; i < dim; ++i) {
193
+	for (int j = 0; j < dim; ++j) {
194
+	  M[i][j] += a[i][j];
195
+	}
196
+      }
197
+      return *this;
198
+    }
199
+
200
+  template <class T>
201
+    SQMat<T>& SQMat<T>::operator-= (const T& a)
202
+    {
203
+
204
+      for (int i = 0; i < dim; ++i) M[i][i] -= a;
205
+
206
+      return *this;
207
+    }
208
+
209
+  template <class T>
210
+    SQMat<T>& SQMat<T>::operator-= (const SQMat<T>& a)
211
+    {
212
+      if (dim != a.dim) {
213
+	ABACUSerror("Incompatible matrix sizes in matrix operator +.");
214
+	exit(1);
215
+      }
216
+      for (int i = 0; i < dim; ++i) {
217
+	for (int j = 0; j < dim; ++j) {
218
+	  M[i][j] -= a[i][j];
219
+	}
220
+      }
221
+      return *this;
222
+    }
223
+
224
+  template <class T>
225
+    SQMat<T>& SQMat<T>::operator*= (const T& a)
226
+    {
227
+
228
+      for (int i = 0; i < dim; ++i) for (int j = 0; j < dim; ++j) M[i][j] *= a;
229
+
230
+      return *this;
231
+    }
232
+
233
+  template <class T>
234
+    SQMat<T>& SQMat<T>::operator*= (const SQMat<T>& a)
235
+    {
236
+
237
+      if (dim != a.dim) {
238
+	ABACUSerror("Incompatible matrix sizes in matrix operator *.");
239
+	exit(1);
240
+      }
241
+
242
+      SQMat<T> leftarg(*this);  // use copy constructor.
243
+
244
+      for (int i = 0; i < dim; ++i) {
245
+
246
+	for (int j = 0; j < dim; ++j) {
247
+
248
+	  M[i][j] = 0.0;
249
+
250
+	  for (int k = 0; k < dim; ++k) {
251
+
252
+	    M[i][j] += leftarg[i][k] * a[k][j];
253
+	  }
254
+	}
255
+      }
256
+
257
+      return *this;
258
+    }
259
+
260
+  template <class T>
261
+    inline int SQMat<T>::size() const
262
+    {
263
+      return dim;
264
+    }
265
+
266
+  template <class T>
267
+    SQMat<T>::~SQMat()
268
+    {
269
+      if (M != 0) {
270
+	delete[] (M[0]);
271
+	delete[] (M);
272
+      }
273
+    }
274
+
275
+
276
+  //*****************************
277
+
278
+  template <class T>
279
+    class RecMat {
280
+
281
+  private:
282
+    int nrows;
283
+    int ncols;
284
+    T** M;
285
+
286
+  public:
287
+    RecMat (int Nrows, int Ncols);             // initializes all elements of this n by n matrix to zero
288
+    RecMat (const T& a, int Nrows, int Ncols);
289
+    RecMat (const RecMat& rhs);  // copy constructor
290
+    void Print ();
291
+    RecMat& operator= (const RecMat& rhs);  // assignment
292
+    inline T* operator[] (const int i);  // subscripting: pointer to row i
293
+    inline const T* operator[] (const int i) const;
294
+    inline int nr_rows() const;
295
+    inline int nr_cols() const;
296
+    ~RecMat();
297
+
298
+  };
299
+
300
+  template <class T>
301
+    RecMat<T>::RecMat (int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
302
+    {
303
+      M[0] = new T[Nrows*Ncols];
304
+      for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
305
+
306
+      for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) M[i][j] = T(0);
307
+    }
308
+
309
+  template <class T>
310
+    RecMat<T>::RecMat (const T& a, int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
311
+    {
312
+      M[0] = new T[Nrows*Ncols];
313
+      for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
314
+
315
+      for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) {
316
+	  if (i == j) M[i][i] = a;
317
+	  else M[i][j] = T(0);
318
+	}
319
+    }
320
+
321
+  template <class T>
322
+    RecMat<T>::RecMat (const RecMat& rhs) : nrows(rhs.nrows), ncols(rhs.ncols), M(new T*[nrows])
323
+    {
324
+      int i,j;
325
+      M[0] = new T[nrows*ncols];
326
+      for (i = 1; i < nrows; i++) M[i] = M[i-1] + ncols;
327
+      for (i = 0; i < nrows; i++)
328
+	for (j = 0; j < ncols; j++) M[i][j] = rhs[i][j];
329
+    }
330
+
331
+  // operators
332
+  template <class T>
333
+    void RecMat<T>::Print ()
334
+    {
335
+      std::cout << std::endl;
336
+      for (int i = 0; i < nrows; ++i) {
337
+	for (int j = 0; j < ncols; ++j) std::cout << M[i][j] << " ";
338
+	std::cout << std::endl;
339
+      }
340
+      std::cout << std::endl;
341
+    }
342
+
343
+  template <class T>
344
+    RecMat<T>& RecMat<T>::operator= (const RecMat<T>& rhs)
345
+    {
346
+      if (this != &rhs) {
347
+	if (nrows != rhs.nrows || ncols != rhs.ncols) {
348
+	  if (M != 0) {
349
+	    delete[] (M[0]);
350
+	    delete[] (M);
351
+	  }
352
+	  nrows = rhs.nrows;
353
+	  ncols = rhs.ncols;
354
+	  M = new T*[nrows];
355
+	  M[0] = new T[nrows * ncols];
356
+	}
357
+
358
+	for (int i = 0; i < nrows; ++i)
359
+	  for (int j = 0; j < ncols; ++j) M[i][j] = rhs[i][j];
360
+      }
361
+      return *this;
362
+    }
363
+
364
+  template <class T>
365
+    inline T* RecMat<T>::operator[] (const int i)
366
+    {
367
+      return M[i];
368
+    }
369
+
370
+  template <class T>
371
+    inline const T* RecMat<T>::operator[] (const int i) const
372
+    {
373
+      return M[i];
374
+    }
375
+
376
+  template <class T>
377
+    inline int RecMat<T>::nr_rows() const
378
+    {
379
+      return nrows;
380
+    }
381
+
382
+  template <class T>
383
+    inline int RecMat<T>::nr_cols() const
384
+    {
385
+      return ncols;
386
+    }
387
+
388
+  template <class T>
389
+    inline std::ostream& operator<< (std::ostream& s, const RecMat<T>& matrix)
390
+    {
391
+      for (int i = 0; i < matrix.nr_rows(); ++i) {
392
+	for (int j = 0; j < matrix.nr_cols(); ++j) s << matrix[i][j] << " ";
393
+	s << std::endl;
394
+      }
395
+
396
+      return (s);
397
+    }
398
+
399
+  template <class T>
400
+    RecMat<T>::~RecMat()
401
+    {
402
+      if (M != 0) {
403
+	delete[] (M[0]);
404
+	delete[] (M);
405
+      }
406
+    }
407
+
408
+  // TYPEDEFS:
409
+
410
+  typedef ABACUS::SQMat<DP> SQMat_DP;
411
+  typedef ABACUS::SQMat<std::complex<double> > SQMat_CX;
412
+
413
+
414
+  // FUNCTION DEFINITIONS
415
+
416
+  // Functions in src/MATRIX directory
417
+
418
+  DP det_LU (SQMat_DP a);
419
+  DP lndet_LU (SQMat_DP a);
420
+  std::complex<DP> lndet_LU_dstry (SQMat_DP& a);
421
+  std::complex<DP> det_LU_CX (SQMat_CX a);
422
+  std::complex<DP> lndet_LU_CX (SQMat_CX a);
423
+  std::complex<DP> lndet_LU_CX_dstry (SQMat_CX& a);
424
+  void eigsrt (Vect_DP& d, SQMat_DP& v);
425
+  void balanc (SQMat_DP& a);
426
+  void elmhes (SQMat_DP& a);
427
+  void gaussj (SQMat_DP& a, SQMat_DP& b);
428
+  void hqr (SQMat_DP& a, Vect_CX& wri);
429
+  void jacobi (SQMat_DP& a, Vect_DP& d, SQMat_DP& v, int& nrot);
430
+  void lubksb (SQMat_DP& a, Vect_INT& indx, Vect_DP& b);
431
+  void lubksb_CX (SQMat_CX& a, Vect_INT& indx, Vect_CX& b);
432
+  void ludcmp (SQMat_DP& a, Vect_INT& indx, DP& d);
433
+  void ludcmp_CX (SQMat_CX& a, Vect_INT& indx, DP& d);
434
+  DP pythag(DP a, DP b);
435
+  void tqli(Vect_DP& d, Vect_DP& e, SQMat_DP& z);
436
+  void tred2 (SQMat_DP& a, Vect_DP& d, Vect_DP& e);
437
+
438
+} // namespace ABACUS
439
+
440
+#endif

+ 35
- 0
include/ABACUS_NRG.h View File

@@ -0,0 +1,35 @@
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  ABACUS_NRG.h
10
+
11
+Purpose:  Declares NRG-related classes and functions.
12
+
13
+***********************************************************/
14
+
15
+#ifndef ABACUS_NRG_H
16
+#define ABACUS_NRG_H
17
+
18
+#include "ABACUS.h"
19
+
20
+namespace ABACUS {
21
+
22
+  DP K_Weight_integrand (Vect_DP args);  // weighing function for state selection
23
+
24
+  void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required,
25
+			      bool symmetric_states, int iKmod,
26
+			      int weighing_option, Vect<std::complex <DP> >& FT_of_potential);
27
+
28
+  void Build_DFF_Matrix_Block_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required,
29
+				       bool symmetric_states, int iKmod, int weighing_option,
30
+				       int label_left_begin, int label_left_end, int label_right_begin, int label_right_end,
31
+				       int block_option, DP* DFF_block_1, DP* DFF_block_2, Vect_DP Kweight);
32
+
33
+}
34
+
35
+#endif

include/JSC_ODSLF.h → include/ABACUS_ODSLF.h View File

@@ -2,22 +2,22 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  Heis.h
9
+File:  ABACUS_ODSLF.h
10 10
 
11 11
 Purpose:  Declares lattice spinless fermion classes and functions.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#ifndef _ODSLF_
16
-#define _ODSLF_
15
+#ifndef ABACUS_ODSLF_H
16
+#define ABACUS_ODSLF_H
17 17
 
18
-#include "JSC.h"
18
+#include "ABACUS.h"
19 19
 
20
-namespace JSC {
20
+namespace ABACUS {
21 21
 
22 22
   //****************************************************************************
23 23
 
@@ -40,12 +40,12 @@ namespace JSC {
40 40
     ODSLF_Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities);  // sets to Nrapidities vector, and checks consistency
41 41
     ODSLF_Base (const Heis_Chain& RefChain, long long int id_ref);
42 42
     inline int& operator[] (const int i);
43
-    inline const int& operator[] (const int i) const; 
43
+    inline const int& operator[] (const int i) const;
44 44
     ODSLF_Base& operator= (const ODSLF_Base& RefBase);
45 45
     bool operator== (const ODSLF_Base& RefBase);
46 46
     bool operator!= (const ODSLF_Base& RefBase);
47 47
 
48
-    void Compute_Ix2_limits(const Heis_Chain& RefChain);  // computes the Ix2_infty and Ix2_max 
48
+    void Compute_Ix2_limits(const Heis_Chain& RefChain);  // computes the Ix2_infty and Ix2_max
49 49
 
50 50
     void Scan_for_Possible_Types (Vect<long long int>& possible_type_id, int& nfound, int base_level, Vect<int>& Nexcitations);
51 51
     Vect<long long int> Possible_Types ();  // returns a vector of possible types
@@ -56,19 +56,19 @@ namespace JSC {
56 56
   {
57 57
     return Nrap[i];
58 58
   }
59
-  
59
+
60 60
   inline const int& ODSLF_Base::operator[] (const int i) const
61 61
   {
62 62
     return Nrap[i];
63 63
   }
64 64
 
65
+
65 66
   //****************************************************************************
66 67
 
67 68
   // Objects in class ODSLF_Ix2_Config carry all the I's of a given state
68 69
 
69 70
   class ODSLF_Ix2_Config {
70 71
 
71
-    //private:
72 72
   public:
73 73
     int Nstrings;
74 74
     Vect<int> Nrap;
@@ -76,73 +76,63 @@ namespace JSC {
76 76
 
77 77
     int** Ix2;
78 78
 
79
-    //Vect<Vect<int> > Ix2;
80
-
81 79
   public:
82 80
     ODSLF_Ix2_Config ();
83 81
     ODSLF_Ix2_Config (const Heis_Chain& RefChain, int M);   // constructor, puts I's to ground state
84
-    ODSLF_Ix2_Config (const Heis_Chain& RefChain, const ODSLF_Base& base);   // constructor, putting I's to lowest-energy config 
85
-                                                               // consistent with Heis_Base configuration for chain RefChain
82
+    ODSLF_Ix2_Config (const Heis_Chain& RefChain, const ODSLF_Base& base);   // constructor, putting I's to lowest-energy config
83
+    // consistent with Heis_Base configuration for chain RefChain
86 84
     ODSLF_Ix2_Config& operator= (const ODSLF_Ix2_Config& RefConfig);
87 85
     inline int* operator[] (const int i);
88
-    //inline Vect<int> operator[] (const int i);
89 86
     inline const int* operator[] (const int i) const;
90
-    //inline const Vect<int> operator[] (const int i) const;
91 87
     ~ODSLF_Ix2_Config();
92 88
   };
93 89
 
94 90
   inline int* ODSLF_Ix2_Config::operator[] (const int i)
95
-  //inline Vect<int> Ix2_Config::operator[] (const int i)
96
-    {
97
-      return Ix2[i];
98
-    }
99
-  
91
+  {
92
+    return Ix2[i];
93
+  }
94
+
100 95
   inline const int* ODSLF_Ix2_Config::operator[] (const int i) const
101
-  //inline const Vect<int> Ix2_Config::operator[] (const int i) const
102 96
   {
103 97
     return Ix2[i];
104 98
   }
105 99
 
106 100
   std::ostream& operator<< (std::ostream& s, const ODSLF_Ix2_Config& RefConfig);
107 101
 
102
+
108 103
   //****************************************************************************
109 104
 
110 105
   // Objects in class ODSLF_Lambda carry all rapidities of a state
111 106
 
112 107
   class ODSLF_Lambda {
113
-    
108
+
114 109
   private:
115 110
     int Nstrings;
116 111
     Vect<int> Nrap;
117 112
     int Nraptot;
118 113
     DP** lambda;
119
-    //Vect<Vect<DP> > lambda;
120
-    
114
+
121 115
   public:
122 116
     ODSLF_Lambda ();
123 117
     ODSLF_Lambda (const Heis_Chain& RefChain, int M);   // constructor, puts all lambda's to zero
124
-    ODSLF_Lambda (const Heis_Chain& RefChain, const ODSLF_Base& base);   // constructor, putting I's to lowest-energy config 
118
+    ODSLF_Lambda (const Heis_Chain& RefChain, const ODSLF_Base& base);   // constructor, putting I's to lowest-energy config
125 119
     // consistent with Heis_Base configuration for chain RefChain
126 120
     ODSLF_Lambda& operator= (const ODSLF_Lambda& RefConfig);
127 121
     inline DP* operator[] (const int i);
128
-    //inline Vect<DP> operator[] (const int i);
129 122
     inline const DP* operator[] (const int i) const;
130
-    //inline const Vect<DP> operator[] (const int i) const;
131 123
     ~ODSLF_Lambda();
132 124
 
133 125
   };
134 126
 
135 127
   inline DP* ODSLF_Lambda::operator[] (const int i)
136
-  //inline Vect<DP> Lambda::operator[] (const int i)
137
-    {
138
-      return lambda[i];
139
-    }
140
-  
128
+  {
129
+    return lambda[i];
130
+  }
131
+
141 132
   inline const DP* ODSLF_Lambda::operator[] (const int i) const
142
-  //inline const Vect<DP> Lambda::operator[] (const int i) const
143
-    {
144
-      return lambda[i];
145
-    }
133
+  {
134
+    return lambda[i];
135
+  }
146 136
 
147 137
 
148 138
   //****************************************************************************
@@ -168,7 +158,7 @@ namespace JSC {
168 158
     bool operator>= (const ODSLF_Ix2_Offsets& RefOffsets);
169 159
 
170 160
   public:
171
-    void Set_to_id (long long int idnr);  
161
+    void Set_to_id (long long int idnr);
172 162
     void Compute_id ();
173 163
     void Compute_type_id ();
174 164
 
@@ -178,14 +168,15 @@ namespace JSC {
178 168
   };
179 169
 
180 170
   inline long long int ODSLF_Ix2_Offsets_type_id (Vect<int>& nparticles)
181
-    {
182
-      long long int type_id_here = 0ULL;
171
+  {
172
+    long long int type_id_here = 0ULL;
173
+
174
+    for (int i = 0; i < nparticles.size(); ++i)
175
+      type_id_here += nparticles[i] * pow_ulli(10ULL, i);
183 176
 
184
-      for (int i = 0; i < nparticles.size(); ++i)
185
-	type_id_here += nparticles[i] * pow_ulli(10ULL, i);
177
+    return(type_id_here);
178
+  }
186 179
 
187
-      return(type_id_here);
188
-    }
189 180
 
190 181
   //****************************************************************************
191 182
   // Objects in class ODSLF_Ix2_Offsets_List carry a vector of used Ix2_Offsets
@@ -211,7 +202,7 @@ namespace JSC {
211 202
   // These contain subclass-specific functions and data.
212 203
 
213 204
   class ODSLF_Bethe_State {
214
-    
205
+
215 206
   public:
216 207
     Heis_Chain chain;
217 208
     ODSLF_Base base;
@@ -219,7 +210,7 @@ namespace JSC {
219 210
     ODSLF_Ix2_Config Ix2;
220 211
     ODSLF_Lambda lambda;
221 212
     ODSLF_Lambda BE;            // Bethe equation for relevant rapidity, in the form BE = theta - (1/N)\sum ... - \pi I/N = 0
222
-    DP diffsq;             // sum of squares of rapidity differences in last iteration 
213
+    DP diffsq;             // sum of squares of rapidity differences in last iteration
223 214
     int conv;              // convergence status
224 215
     int iter;              // number of iterations necessary for convergence
225 216
     int iter_Newton;              // number of iterations necessary for convergence (Newton method)
@@ -227,8 +218,6 @@ namespace JSC {
227 218
     int iK;                // K = 2.0*PI * iK/Nsites
228 219
     DP K;                  // total momentum
229 220
     DP lnnorm;             // ln of norm of reduced Gaudin matrix
230
-    //long long int id;
231
-    //long long int maxid;
232 221
     long long int base_id;
233 222
     long long int type_id;
234 223
     long long int id;
@@ -236,17 +225,16 @@ namespace JSC {
236 225
     int nparticles;
237 226
 
238 227
   public:
239
-    ODSLF_Bethe_State (); 
228
+    ODSLF_Bethe_State ();
240 229
     ODSLF_Bethe_State (const ODSLF_Bethe_State& RefState);  // copy constructor
241 230
     ODSLF_Bethe_State (const ODSLF_Bethe_State& RefState, long long int type_id_ref);  // new state with requested type_id
242 231
     ODSLF_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
243 232
     ODSLF_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base);  // constructor to lowest-energy config with base
244
-    ODSLF_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  
233
+    ODSLF_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);
245 234
     virtual ~ODSLF_Bethe_State () {};
246 235
 
247 236
   public:
248
-    int Charge () { return(base.Mdown); }; 
249
-    //void Set_I_Offset (const I_Offset& RefOffset);  // sets the Ix2 to given offsets
237
+    int Charge () { return(base.Mdown); };
250 238
     void Set_Ix2_Offsets (const ODSLF_Ix2_Offsets& RefOffset);  // sets the Ix2 to given offsets
251 239
     void Set_to_id (long long int id_ref);
252 240
     void Set_to_id (long long int id_ref, ODSLF_Bethe_State& RefState);
@@ -271,65 +259,45 @@ namespace JSC {
271 259
     // Virtual functions, all defined in the derived classes
272 260
 
273 261
   public:
274
-    virtual void Set_Free_lambdas() { JSCerror("ODSLF_Bethe_State::..."); }  // sets the rapidities to solutions of BAEs without scattering terms
275
-    virtual bool Check_Admissibility(char option) { JSCerror("ODSLF_Bethe_State::..."); return(false); }   
262
+    virtual void Set_Free_lambdas() { ABACUSerror("ODSLF_Bethe_State::..."); }  // sets the rapidities to solutions of BAEs without scattering terms
263
+    virtual bool Check_Admissibility(char option) { ABACUSerror("ODSLF_Bethe_State::..."); return(false); }
276 264
     // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
277
-    virtual void Compute_BE (int j, int alpha) { JSCerror("ODSLF_Bethe_State::..."); }
278
-    virtual void Compute_BE () { JSCerror("ODSLF_Bethe_State::..."); }
279
-    virtual DP Iterate_BAE(int i, int alpha) { JSCerror("ODSLF_Bethe_State::..."); return(0.0);}
280
-    virtual bool Check_Rapidities() { JSCerror("ODSLF_Bethe_State::..."); return(false); }
281
-    virtual void Compute_Energy () { JSCerror("ODSLF_Bethe_State::..."); }
282
-    virtual void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red) { JSCerror("ODSLF_Bethe_State::..."); }
265
+    virtual void Compute_BE (int j, int alpha) { ABACUSerror("ODSLF_Bethe_State::..."); }
266
+    virtual void Compute_BE () { ABACUSerror("ODSLF_Bethe_State::..."); }
267
+    virtual DP Iterate_BAE(int i, int alpha) { ABACUSerror("ODSLF_Bethe_State::..."); return(0.0);}
268
+    virtual bool Check_Rapidities() { ABACUSerror("ODSLF_Bethe_State::..."); return(false); }
269
+    virtual void Compute_Energy () { ABACUSerror("ODSLF_Bethe_State::..."); }
270
+    virtual void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red) { ABACUSerror("ODSLF_Bethe_State::..."); }
283 271
   };
284 272
 
285 273
   inline bool Force_Descent (char whichDSF, ODSLF_Bethe_State& ScanState, ODSLF_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
286 274
   {
287
-    JSCerror("Need to implement Force_Descent properly for ODSLF.");
275
+    ABACUSerror("Need to implement Force_Descent properly for ODSLF.");
288 276
 
289 277
     bool force_descent = false;
290 278
 
291
-    // Force descent if energy of ScanState is lower than that of RefState
292
-    if (ScanState.E - RefState.E - (ScanState.base.Mdown - RefState.base.Mdown) < 0.0) return(true); 
293
-    /*
294
-    // We force descent if 
295
-    // 1)  - there exists a higher string whose quantum number is still on 0
296
-    // AND - there is at most a single particle-hole in the 0 base level
297
-    // AND - either the particle or the hole hasn't yet moved.
298
-    if (RefState.base_id/100000LL > 0) { // there is a higher string
299
-      int type0 = RefState.type_id % 10000;
300
-      if (type0 == 0 
301
-	  || type0 == 101 && RefState.offsets.Tableau[0].id * RefState.offsets.Tableau[2].id == 0LL 
302
-	  || type0 == 110 && RefState.offsets.Tableau[1].id * RefState.offsets.Tableau[2].id == 0LL 
303
-	  || type0 == 1001 && RefState.offsets.Tableau[0].id * RefState.offsets.Tableau[3].id == 0LL 
304
-	  || type0 == 1010 && RefState.offsets.Tableau[1].id * RefState.offsets.Tableau[3].id == 0LL) // single p-h pair in base level 0
305
-	for (int j = 1; j < RefState.chain.Nstrings; ++j) {
306
-	  if (RefState.base[j] == 1 && RefState.Ix2[j][0] == 0) {
307
-	    force_descent = true;
308
-	  }
309
-	}
310
-    }
311
-    */
312 279
     // Force descent if quantum nr distribution is symmetric:
313 280
     if (RefState.Check_Symmetry()) force_descent = true;
314
-    
281
+
315 282
     return(force_descent);
316 283
   }
317 284
 
318 285
   std::ostream& operator<< (std::ostream& s, const ODSLF_Bethe_State& state);
319 286
 
287
+
320 288
   //****************************************************************************
321 289
 
322 290
   // Objects in class XXZ_Bethe_State carry all extra information pertaining to XXZ gapless
323 291
 
324 292
   class ODSLF_XXZ_Bethe_State : public ODSLF_Bethe_State {
325
-    
293
+
326 294
   public:
327
-    ODSLF_Lambda sinhlambda;  
328
-    ODSLF_Lambda coshlambda;  
329
-    ODSLF_Lambda tanhlambda;  
295
+    ODSLF_Lambda sinhlambda;
296
+    ODSLF_Lambda coshlambda;
297
+    ODSLF_Lambda tanhlambda;
330 298
 
331 299
   public:
332
-    ODSLF_XXZ_Bethe_State (); 
300
+    ODSLF_XXZ_Bethe_State ();
333 301
     ODSLF_XXZ_Bethe_State (const ODSLF_XXZ_Bethe_State& RefState);  // copy constructor
334 302
     ODSLF_XXZ_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
335 303
     ODSLF_XXZ_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base);  // constructor to lowest-energy config with base
@@ -337,7 +305,7 @@ namespace JSC {
337 305
 
338 306
   public:
339 307
     ODSLF_XXZ_Bethe_State& operator= (const ODSLF_XXZ_Bethe_State& RefState);
340
-    
308
+
341 309
   public:
342 310
     void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
343 311
     void Compute_sinhlambda();
@@ -349,14 +317,14 @@ namespace JSC {
349 317
     DP Iterate_BAE(int i, int j);
350 318
     bool Check_Rapidities();  // checks that all rapidities are not nan
351 319
     void Compute_Energy ();
352
-    //void Compute_Momentum ();
353
-    void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);    
320
+    void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
354 321
 
355 322
     // XXZ specific functions:
356 323
   public:
357 324
 
358 325
   };
359 326
 
327
+
360 328
   //****************************************************************************
361 329
   /*
362 330
   // Objects in class ODSLF_XXX_Bethe_State carry all extra information pertaining to XXX antiferromagnet
@@ -364,29 +332,29 @@ namespace JSC {
364 332
   class ODSLF_XXX_Bethe_State : public ODSLF_Bethe_State {
365 333
 
366 334
   public:
367
-    ODSLF_XXX_Bethe_State (); 
368
-    ODSLF_XXX_Bethe_State (const ODSLF_XXX_Bethe_State& RefState);  // copy constructor
369
-    ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
370
-    ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, const ODSLF__Base& base);  // constructor to lowest-energy config with base
371
-    ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with base
335
+  ODSLF_XXX_Bethe_State ();
336
+  ODSLF_XXX_Bethe_State (const ODSLF_XXX_Bethe_State& RefState);  // copy constructor
337
+  ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
338
+  ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, const ODSLF__Base& base);  // constructor to lowest-energy config with base
339
+  ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with base
372 340
 
373 341
   public:
374
-    ODSLF_XXX_Bethe_State& operator= (const ODSLF_XXX_Bethe_State& RefState);
342
+  ODSLF_XXX_Bethe_State& operator= (const ODSLF_XXX_Bethe_State& RefState);
375 343
 
376 344
   public:
377
-    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
378
-    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
379
-    void Compute_BE (int j, int alpha);
380
-    void Compute_BE ();
381
-    DP Iterate_BAE(int i, int j);
382
-    bool Check_Rapidities();  // checks that all rapidities are not nan    
383
-    void Compute_Energy ();
384
-    //void Compute_Momentum ();
385
-    void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
386
-
387
-    // XXX specific functions
345
+  void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
346
+  bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
347
+  void Compute_BE (int j, int alpha);
348
+  void Compute_BE ();
349
+  DP Iterate_BAE(int i, int j);
350
+  bool Check_Rapidities();  // checks that all rapidities are not nan
351
+  void Compute_Energy ();
352
+  //void Compute_Momentum ();
353
+  void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
354
+
355
+  // XXX specific functions
388 356
   public:
389
-    bool Check_Finite_rap ();
357
+  bool Check_Finite_rap ();
390 358
 
391 359
   };
392 360
   */
@@ -395,45 +363,45 @@ namespace JSC {
395 363
   // Objects in class ODSLF_XXZ_gpd_Bethe_State carry all extra information pertaining to XXZ gapped antiferromagnets
396 364
 
397 365
   class ODSLF_XXZ_gpd_Bethe_State : public ODSLF__Bethe_State {
398
-    
399
-  public:
400
-    Lambda sinlambda;  
401
-    Lambda coslambda;  
402
-    Lambda tanlambda;  
403 366
 
404 367
   public:
405
-    ODSLF_XXZ_gpd_Bethe_State (); 
406
-    ODSLF_XXZ_gpd_Bethe_State (const ODSLF_XXZ_gpd_Bethe_State& RefState);  // copy constructor
407
-    ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
408
-    ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base);  // constructor to lowest-energy config with base
409
-    ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with base
368
+  Lambda sinlambda;
369
+  Lambda coslambda;
370
+  Lambda tanlambda;
410 371
 
411 372
   public:
412
-    ODSLF_XXZ_gpd_Bethe_State& operator= (const ODSLF_XXZ_gpd_Bethe_State& RefState);
373
+  ODSLF_XXZ_gpd_Bethe_State ();
374
+  ODSLF_XXZ_gpd_Bethe_State (const ODSLF_XXZ_gpd_Bethe_State& RefState);  // copy constructor
375
+  ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
376
+  ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base);  // constructor to lowest-energy config with base
377
+  ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with base
413 378
 
414 379
   public:
415
-    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
416
-    void Compute_sinlambda();
417
-    void Compute_coslambda();
418
-    void Compute_tanlambda();
419
-    int Weight();   // weight function for contributions cutoff 
420
-    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
421
-    void Compute_BE (int j, int alpha);
422
-    void Compute_BE ();
423
-    DP Iterate_BAE(int i, int j);
424
-    void Iterate_BAE_Newton();
425
-    bool Check_Rapidities();  // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
426
-    void Compute_Energy ();
427
-    //void Compute_Momentum ();
428
-    void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
380
+  ODSLF_XXZ_gpd_Bethe_State& operator= (const ODSLF_XXZ_gpd_Bethe_State& RefState);
429 381
 
430
-    // XXZ_gpd specific functions
382
+  public:
383
+  void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
384
+  void Compute_sinlambda();
385
+  void Compute_coslambda();
386
+  void Compute_tanlambda();
387
+  int Weight();   // weight function for contributions cutoff
388
+  bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
389
+  void Compute_BE (int j, int alpha);
390
+  void Compute_BE ();
391
+  DP Iterate_BAE(int i, int j);
392
+  void Iterate_BAE_Newton();
393
+  bool Check_Rapidities();  // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
394
+  void Compute_Energy ();
395
+  //void Compute_Momentum ();
396
+  void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
397
+
398
+  // XXZ_gpd specific functions
431 399
   public:
432 400
 
433 401
   };
434 402
   */
435 403
   //***********************************************
436
-  
404
+
437 405
   // Function declarations
438 406
   /*
439 407
   // in M_vs_H.cc
@@ -445,19 +413,16 @@ namespace JSC {
445 413
   DP X_avg (char xyorz, DP Delta, int N, int M);
446 414
   */
447 415
   DP Chemical_Potential (const ODSLF_Bethe_State& RefState);
448
-  //DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded);
449 416
   DP Sumrule_Factor (char whichDSF, ODSLF_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
450
-  void Evaluate_F_Sumrule (string prefix, char whichDSF, const ODSLF_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
417
+  void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const ODSLF_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
451 418
 
452
-  complex<DP> ln_Sz_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
453
-  complex<DP> ln_Smin_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
419
+  std::complex<DP> ln_Sz_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
420
+  std::complex<DP> ln_Smin_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
454 421
 
455
-  //DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState, 
456
-  //				     ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
457
-  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState, 
458
-				     ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
422
+  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState,
423
+				     ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
459 424
 
460 425
 
461
-} // namespace JSC
426
+} // namespace ABACUS
462 427
 
463 428
 #endif

+ 828
- 0
include/ABACUS_Scan.h View File

@@ -0,0 +1,828 @@
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  ABACUS_Scan.h
10
+
11
+Purpose:  Declares all classes and functions used in the
12
+          ABACUS logic of scanning with threads.
13
+
14
+***********************************************************/
15
+
16
+#ifndef ABACUS_SCAN_H
17
+#define ABACUS_SCAN_H
18
+
19
+#include "ABACUS.h"
20
+
21
+namespace ABACUS {
22
+
23
+  const int MAX_STATE_LIST_SIZE = 10000;
24
+
25
+  // Functions in src/UTILS/Data_File_Name.cc:
26
+  void Data_File_Name (std::stringstream& name, char whichDSF, DP c_int, DP L, int N,
27
+		       int iKmin, int iKmax, DP kBT, DP L2, std::string defaultname);
28
+  void Data_File_Name (std::stringstream& name, char whichDSF, int iKmin, int iKmax, DP kBT,
29
+		       LiebLin_Bethe_State& State, LiebLin_Bethe_State& RefScanState, std::string defaultname);
30
+  void Data_File_Name (std::stringstream& name, char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
31
+		       DP kBT, int N2, std::string defaultname);
32
+  void Data_File_Name (std::stringstream& name, char whichDSF, int iKmin, int iKmax, DP kBT,
33
+		       Heis_Bethe_State& State, Heis_Bethe_State& RefScanState, std::string defaultname);
34
+  void ODSLF_Data_File_Name (std::stringstream& name, char whichDSF, DP Delta, int N, int M,
35
+			     int iKmin, int iKmax, DP kBT, int N2, std::string defaultname);
36
+  void Data_File_Name (std::stringstream& name, char whichDSF, int iKmin, int iKmax, DP kBT,
37
+		       ODSLF_Bethe_State& State, ODSLF_Bethe_State& RefScanState, std::string defaultname);
38
+
39
+  // Coding to convert ints to strings: for application in reduced labels
40
+  //const int ABACUScodingsize = 64; // use a multiple of 2 to accelerate divisions in labeling.
41
+  //const char ABACUScoding[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '?'};
42
+
43
+  // From ABACUS++T_8 onwards: forbid special characters as |, :, !, ? and all capital letters in labels.
44
+  // This is due to the dumb capitalization-preserving but capitalization-insensitive HFS+ filesystem on Mac OS X.
45
+  const int ABACUScodingsize = 32;
46
+  const char ABACUScoding[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v'};
47
+  const char LABELSEP = '_'; // was _
48
+  const char TYPESEP = 'x';  // was |
49
+  const char EXCSEP = 'y';   // was :
50
+  const char INEXCSEP = 'z'; // was @
51
+
52
+  struct State_Label_Data {
53
+
54
+    Vect<int> type; // integer type labels of the types present
55
+    Vect<int> M; // how many particles of each type
56
+    Vect<int> nexc; // how many excitations as compared to the reference state used
57
+    Vect<Vect<int> > Ix2old; // which Ix2 will be excited
58
+    Vect<Vect<int> > Ix2exc; // which Ix2 the excitation has shifted to
59
+
60
+    State_Label_Data (const Vect<int>& type_ref, const Vect<int>& M_ref,
61
+		      const Vect<int>& nexc_ref, const Vect<Vect<int> >& Ix2old_ref, const Vect<Vect<int> >& Ix2exc_ref)
62
+    {
63
+      type = type_ref; M = M_ref; nexc = nexc_ref; Ix2old = Ix2old_ref; Ix2exc = Ix2exc_ref;
64
+    }
65
+
66
+  };
67
+
68
+  std::string Extract_Base_Label (std::string label); // works for labels and complabels
69
+  std::string Extract_nexc_Label (std::string label);
70
+
71
+  // For compressed labels: conversions between integers and char/strings.
72
+  std::string Convert_POSINT_to_STR (int int_to_convert);
73
+  int Convert_CHAR_to_POSINT (char char_to_convert);
74
+  int Convert_STR_to_POSINT (std::string str_to_convert);
75
+
76
+  State_Label_Data Read_Base_Label (std::string label);
77
+  State_Label_Data Read_State_Label (std::string label, const Vect<Vect<int> >& OriginIx2);
78
+  State_Label_Data Read_State_Label (std::string label, const Vect<int>& OriginIx2); // if there is only one type
79
+  std::string Return_State_Label (State_Label_Data data, const Vect<Vect<int> >& OriginIx2);
80
+  std::string Return_State_Label (State_Label_Data data, const Vect<int>& OriginIx2); // if there is only one type
81
+  std::string Return_State_Label (const Vect<Vect<int> >& ScanIx2, const Vect<Vect<int> >& OriginIx2);
82
+  std::string Return_State_Label (const Vect<int>& ScanIx2, const Vect<int>& OriginIx2); // if there is only one type
83
+  Vect<Vect<int> > Return_Ix2_from_Label (std::string label_ref, const Vect<Vect<int> >& OriginIx2);
84
+  Vect<int> Return_Ix2_from_Label (std::string label_ref, const Vect<int>& OriginIx2); // specialization to Lieb-Liniger
85
+
86
+  // Functions for descending states: in SCAN/Descendents.cc
87
+  Vect<std::string> Descendent_States_with_iK_Stepped_Up (std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
88
+  Vect<std::string> Descendent_States_with_iK_Stepped_Down (std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
89
+  Vect<std::string> Descendent_States_with_iK_Preserved (std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc_up, bool preserve_nexc_up, bool disperse_only_current_exc_down, bool preserve_nexc_down);
90
+  Vect<std::string> Descendent_States_with_iK_Stepped_Up (std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
91
+  Vect<std::string> Descendent_States_with_iK_Stepped_Down (std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
92
+  Vect<std::string> Descendent_States_with_iK_Preserved (std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc_up, bool preserve_nexc_up, bool disperse_only_current_exc_down, bool preserve_nexc_down);
93
+
94
+  // For symmetric state scanning:
95
+  Vect<std::string> Descendent_States_with_iK_Stepped_Up_rightIx2only
96
+    (std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
97
+  Vect<std::string> Descendent_States_with_iK_Stepped_Down_rightIx2only
98
+    (std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
99
+  Vect<std::string> Descendent_States_with_iK_Stepped_Up_rightIx2only
100
+    (std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
101
+  Vect<std::string> Descendent_States_with_iK_Stepped_Down_rightIx2only
102
+    (std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
103
+
104
+  // Functions in src/SCAN/General_Scan.cc:
105
+  void Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
106
+		     int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
107
+  void Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
108
+		     int Max_Secs, DP target_sumrule, bool refine);
109
+  void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
110
+		     int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
111
+  void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, std::string defaultname, int iKmin, int iKmax,
112
+		     int Max_Secs, DP target_sumrule, bool refine);
113
+  void Scan_LiebLin_Geometric_Quench (DP c_int, DP L_1, int type_id_1, long long int id_1, DP L_2, int N,
114
+				      int iK_UL, int Max_Secs, DP target_sumrule, bool refine);
115
+
116
+  void Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
117
+		  int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
118
+  void Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
119
+		  int Max_Secs, DP target_sumrule, bool refine);
120
+  void Scan_Heis (char whichDSF, XXZ_Bethe_State& AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
121
+		  int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
122
+  void Scan_Heis (char whichDSF, XXX_Bethe_State& AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
123
+		  int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
124
+  void Scan_Heis (char whichDSF, XXZ_gpd_Bethe_State& AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
125
+		  int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
126
+
127
+  void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
128
+		   int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors);
129
+  void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax, int Max_Secs, bool refine);
130
+  void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int iKneeded, int Max_Secs, bool refine);
131
+  void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int Max_Secs, bool refine);
132
+
133
+  // Functions to prepare and wrapup parallel scans:
134
+  void Prepare_Parallel_Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
135
+				      std::string defaultname, int paralevel, Vect<int> rank_lower_paralevels,
136
+				      Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
137
+  void Wrapup_Parallel_Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
138
+				     std::string defaultname, int paralevel, Vect<int> rank_lower_paralevels,
139
+				     Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
140
+
141
+  void Prepare_Parallel_Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
142
+				   int paralevel, Vect<int> rank_lower_paralevels,
143
+				   Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
144
+  void Wrapup_Parallel_Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
145
+				  int paralevel, Vect<int> rank_lower_paralevels,
146
+				  Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
147
+
148
+
149
+  void Sort_RAW_File (const char ffsq_file[], char optionchar);
150
+  void Sort_RAW_File (const char ffsq_file[], char optionchar, char whichDSF);
151
+
152
+  // Functions for data interpretation:
153
+  DP Smoothen_RAW_into_SF (std::string prefix, int iKmin, int iKmax, int DiK,
154
+			   DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
155
+  DP Smoothen_RAW_into_SF (std::string prefix, Vect<std::string> rawfilename, Vect<DP> weight, int iKmin, int iKmax, int DiK,
156
+			   DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
157
+  void Write_K_File (DP Length, int iKmin, int iKmax);
158
+  void Write_Omega_File (int Nout_omega, DP omegamin, DP omegamax);
159
+  // Smoothen with gaussian width scaled with two-particle bandwidth
160
+  DP Smoothen_RAW_into_SF_LiebLin_Scaled (std::string prefix, DP L, int N, int iKmin, int iKmax, int DiK, DP ommin, DP ommax, int Nom, DP width, DP normalization);
161
+
162
+
163
+  //****************************************************************************
164
+
165
+  struct Scan_Info {
166
+
167
+    DP sumrule_obtained;
168
+    DP Nfull; // dimensionality of (sub)Hilbert space considered
169
+    long long int Ninadm;
170
+    long long int Ndata;
171
+    long long int Ndata_conv;
172
+    long long int Ndata_conv0;
173
+    double TT; // total computation time in seconds
174
+
175
+  public:
176
+    Scan_Info();  // constructor, puts everything to zero
177
+    Scan_Info (DP sr, DP Nf, long long int Ni, long long int Nd, long long int Ndc, long long int Ndc0, double t);
178
+
179
+    void Save (const char* outfile_Cstr);
180
+    void Load (const char* infile_Cstr);
181
+
182
+    inline Scan_Info& operator = (const Scan_Info& ref_info)
183
+    {
184
+      sumrule_obtained = ref_info.sumrule_obtained;
185
+      Nfull = ref_info.Nfull;
186
+      Ninadm = ref_info.Ninadm;
187
+      Ndata = ref_info.Ndata;
188
+      Ndata_conv = ref_info.Ndata_conv;
189
+      Ndata_conv0 = ref_info.Ndata_conv0;
190
+      TT = ref_info.TT;
191
+
192
+      return(*this);
193
+    }
194
+
195
+      inline Scan_Info& operator+= (const Scan_Info& ref_info)
196
+    {
197
+      if (this != &ref_info) {
198
+	sumrule_obtained += ref_info.sumrule_obtained;
199
+	Nfull += ref_info.Nfull;
200
+	Ninadm += ref_info.Ninadm;
201
+	Ndata += ref_info.Ndata;
202
+	Ndata_conv += ref_info.Ndata_conv;
203
+	Ndata_conv0 += ref_info.Ndata_conv0;
204
+	TT += ref_info.TT;
205
+      }
206
+
207
+      return(*this);
208
+    }
209
+
210
+    inline Scan_Info& operator-= (const Scan_Info& ref_info)
211
+    {
212
+      if (this != &ref_info) {
213
+	sumrule_obtained -= ref_info.sumrule_obtained;
214
+	Nfull -= ref_info.Nfull;
215
+	Ninadm -= ref_info.Ninadm;
216
+	Ndata -= ref_info.Ndata;
217
+	Ndata_conv -= ref_info.Ndata_conv;
218
+	Ndata_conv0 -= ref_info.Ndata_conv0;
219
+	TT -= ref_info.TT;
220
+      }
221
+
222
+      return(*this);
223
+    }
224
+
225
+  };
226
+
227
+  std::ostream& operator<< (std::ostream& s, const Scan_Info& info);
228
+
229
+  template<class Tstate>
230
+    Scan_Info General_Scan (char whichDSF, int iKmin, int iKmax, int iKmod, DP kBT, Tstate& AveragingState, Tstate& SeedScanState,
231
+			    std::string defaultScanStatename, int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
232
+
233
+
234
+  //****************************************************************************
235
+
236
+  // Functions in src/SCAN/Descendents.cc:
237
+  Vect<std::string> Descendents (const LiebLin_Bethe_State& ScanState, const LiebLin_Bethe_State& OriginState, int type_required);
238
+  Vect<std::string> Descendents (const Heis_Bethe_State& ScanState, const Heis_Bethe_State& OriginState, int type_required);
239
+
240
+
241
+  struct Scan_Thread {
242
+
243
+    std::string label;
244
+    int type;
245
+
246
+    Scan_Thread ();
247
+    Scan_Thread (std::string label_ref, int type_ref) {
248
+      label = label_ref;
249
+      type = type_ref;
250
+    }
251
+
252
+    Scan_Thread& operator= (const Scan_Thread& RefThread);
253
+  };
254
+
255
+
256
+  struct Scan_Thread_Data {
257
+
258
+    // By convention, a Scan_Thread_Data object handles a list of threads which are yet to be descended.
259
+    // Improvement on Scan_Thread_Set used up to ABACUS++G_7, saving data to disk instead of holding it in memory.
260
+
261
+    int nlists = 6400; // number of threads lists, fixed to this number by convention.
262
+    DP logscale = (1.0/64) * log(2.0); // each separate list contains threads differing by a scale factor of 2^{1/64} \approx 1.01.
263
+
264
+    std::string thrdir_name; // directory in which threads files are saved.
265
+
266
+    Vect<int> nthreads_total;
267
+
268
+    Vect<int> nthreads_on_disk;
269
+    int lowest_il_with_nthreads_neq_0;
270
+
271
+    // In-memory storage, for adding threads efficiently without constantly writing to disk
272
+    // These objects are saved to disk when Next_Scan_Threads are called.
273
+    Vect<int> dim;
274
+    Vect<int> nthreads_in_memory;
275
+    Vect<Vect<std::string> > label;
276
+    Vect<Vect<int> > type; // which type of descendent is needed
277
+
278
+    Vect<std::string> filename;
279
+
280
+    Scan_Thread_Data ();
281
+    Scan_Thread_Data (std::string thrdir_name_ref, bool refine);
282
+    ~Scan_Thread_Data ();
283
+
284
+    bool Increase_Memory_Size (int il, int nr_to_add);
285
+    void Include_Thread (DP abs_data_value_ref, std::string label_ref, int type_ref);
286
+    void Include_Thread (int il, std::string label_ref, int type_ref);
287
+
288
+    Vect<Scan_Thread> Extract_Next_Scan_Threads (); // returns a vector of the threads that are next in line. By defn, all threads with index il == lowest_il_with_nthreads_neq_0. These are removed from the object.
289
+    Vect<Scan_Thread> Extract_Next_Scan_Threads (int min_nr); // as above, but returns a minimum of min_nr threads.
290
+
291
+
292
+    void Flush_to_Disk (int il);
293
+    void Save ();
294
+    void Load ();
295
+  };
296
+
297
+
298
+
299
+  //****************************************************************************
300
+
301
+  // To populate a list of states for scanning:
302
+
303
+  inline void Scan_for_Possible_Bases (const Vect<int> SeedNrap, const Vect<int> Str_L,
304
+				       int Mdown_remaining, Vect<std::string>& possible_base_label, int& nfound, int nexc_max_used,
305
+				       int base_level_to_scan, Vect<int>& Nrapidities)
306
+  {
307
+    if (Mdown_remaining < 0) { ABACUSerror("Scan_for_Possible_Bases:  shouldn't be here..."); }  // reached inconsistent point
308
+
309
+    if (base_level_to_scan == 0) {
310
+      if (Str_L[0] != 1) ABACUSerror("Str_L[0] != 1 in ABACUS_Scan.h Scan_for_Possible_Bases.");
311
+      Nrapidities[0] = Mdown_remaining;
312
+
313
+      // Set label:
314
+      std::stringstream M0out;
315
+      M0out << Nrapidities[0];
316
+      possible_base_label[nfound] = M0out.str();
317
+      for (int itype = 1; itype < Nrapidities.size(); ++itype)
318
+	if (Nrapidities[itype] > 0) {
319
+	  possible_base_label[nfound] += TYPESEP;
320
+	  std::stringstream typeout;
321
+	  typeout << itype;
322
+	  possible_base_label[nfound] += typeout.str();
323
+	  possible_base_label[nfound] += EXCSEP;
324
+	  std::stringstream Mout;
325
+	  Mout << Nrapidities[itype];
326
+	  possible_base_label[nfound] += Mout.str();
327
+	}
328
+      nfound++;
329
+    }
330
+
331
+    else {
332
+      // Preserve the number of strings at this level as compared to SeedState:
333
+      Nrapidities[base_level_to_scan] = SeedNrap[base_level_to_scan];
334
+      if (Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan] >= 0)
335
+	Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan],
336
+				 possible_base_label, nfound, nexc_max_used, base_level_to_scan - 1, Nrapidities);
337
+
338
+      // Reduce number of strings at this level as compared to SeedState:
339
+      for (int i = 1; i <= ABACUS::min(SeedNrap[base_level_to_scan], nexc_max_used/Str_L[base_level_to_scan]); ++i) {
340
+	Nrapidities[base_level_to_scan] = SeedNrap[base_level_to_scan] - i;
341
+	if (Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan] >= 0)
342
+	  Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan],
343
+				   possible_base_label, nfound, nexc_max_used - i*Str_L[base_level_to_scan], base_level_to_scan - 1, Nrapidities);
344
+      }
345
+      // Increase the number of strings at this level as compared to SeedState:
346
+      for (int i = 1; i <= ABACUS::min(Mdown_remaining/Str_L[base_level_to_scan], nexc_max_used/Str_L[base_level_to_scan]); ++i) {
347
+	Nrapidities[base_level_to_scan] = SeedNrap[base_level_to_scan] + i;
348
+	if (Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan] >= 0)
349
+	  Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan],
350
+				   possible_base_label, nfound, nexc_max_used - i*Str_L[base_level_to_scan], base_level_to_scan - 1, Nrapidities);
351
+      }
352
+    }
353
+  }
354
+
355
+
356
+  inline Vect<std::string> Possible_Bases (const Vect<int> SeedNrap, const Vect<int> Str_L, int Mdown)//const Heis_Bethe_State& SeedState)
357
+  {
358
+    int nexc_max_used = NEXC_MAX_HEIS;
359
+
360
+    Vect<std::string> possible_base_label (1000);
361
+    int nfound = 0;
362
+    Vect<int> Nrapidities = SeedNrap;
363
+    int Mdown_remaining = Mdown;
364
+
365
+    Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining, possible_base_label, nfound, nexc_max_used, SeedNrap.size() - 1, Nrapidities);
366
+
367
+    // Copy results into a clean vector:
368
+    Vect<std::string> possible_base_label_found (nfound);
369
+    for (int i = 0; i < nfound; ++i) possible_base_label_found[i] = possible_base_label[i];
370
+
371
+    return(possible_base_label_found);
372
+  }
373
+
374
+
375
+
376
+  //****************************************************************************
377
+
378
+  template<class Tstate>
379
+    class Scan_State_List {
380
+
381
+  public:
382
+    int ndef;
383
+    Vect<Tstate> State;
384
+    Vect<std::string> base_label;
385
+    Vect<Scan_Info> info;  // info for base and type of State[n]
386
+    Vect<bool> flag_for_scan; // set to true, next round of scanning will use this base/type
387
+    Vect<bool> scan_attempted; // whether this has already been attempted
388
+
389
+  public:
390
+    inline Scan_State_List (char whichDSF, const Tstate& SeedScanState);
391
+
392
+  public:
393
+    inline Tstate& Return_State (std::string base_label_ref);  // returns a state corresponding to same base and type
394
+    inline void Populate_List (char whichDSF, const Tstate& SeedScanState);  // creates all types of states containing up to nexc_max excitations
395
+    inline void Include_Info (Scan_Info& info_to_add, std::string base_label_ref);
396
+    inline void Raise_Scanning_Flags (DP threshold); // checks whether base/type should be scanned based on simpler base/type combinations
397
+
398
+    inline void Order_in_SRC ();
399
+    inline void Save_Info (const char* sumfile_Cstr);
400
+    inline void Load_Info (const char* sumfile_Cstr);
401
+  };
402
+
403
+  // Do the explicit class specializations:
404
+
405
+  template<>
406
+    inline Scan_State_List<LiebLin_Bethe_State>::Scan_State_List (char whichDSF, const LiebLin_Bethe_State& SeedScanState)
407
+    : ndef(0), State(Vect<LiebLin_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
408
+    info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
409
+    scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
410
+      {
411
+	State[0] = SeedScanState;
412
+      }
413
+
414
+  template<>
415
+    inline Scan_State_List<XXZ_Bethe_State>::Scan_State_List (char whichDSF, const XXZ_Bethe_State& SeedScanState)
416
+    : ndef(0), State(Vect<XXZ_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
417
+    info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
418
+    scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
419
+      {
420
+	State[0] = SeedScanState;
421
+      }
422
+
423
+  template<>
424
+    inline Scan_State_List<XXX_Bethe_State>::Scan_State_List (char whichDSF, const XXX_Bethe_State& SeedScanState)
425
+    : ndef(0), State(Vect<XXX_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
426
+    info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
427
+    scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
428
+      {
429
+	State[0] = SeedScanState;
430
+      }
431
+
432
+  template<>
433
+    inline Scan_State_List<XXZ_gpd_Bethe_State>::Scan_State_List (char whichDSF, const XXZ_gpd_Bethe_State& SeedScanState)
434
+    : ndef(0), State(Vect<XXZ_gpd_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
435
+    info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
436
+    scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
437
+      {
438
+	State[0] = SeedScanState;
439
+      }
440
+
441
+  /* IN_DEVELOPMENT
442
+     template<>
443
+     inline Scan_State_List<ODSLF_XXZ_Bethe_State>::Scan_State_List (char whichDSF, const ODSLF_XXZ_Bethe_State& RefState)
444
+     : ndef(0), State(Vect<ODSLF_XXZ_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
445
+     info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
446
+     scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
447
+     {
448
+     if (whichDSF == 'Z' || whichDSF == 'z') State[0] = ODSLF_XXZ_Bethe_State(RefState.chain, RefState.base.Mdown);
449
+     else if (whichDSF == 'm') State[0] = ODSLF_XXZ_Bethe_State(RefState.chain, RefState.base.Mdown - 1);
450
+     else if (whichDSF == 'p') State[0] = ODSLF_XXZ_Bethe_State(RefState.chain, RefState.base.Mdown + 1);
451
+     else ABACUSerror("Unknown whichDSF in Scan_State_List<ODSLF_XXZ... constructor.");
452
+     }
453
+  */
454
+
455
+  template<>
456
+    inline LiebLin_Bethe_State& Scan_State_List<LiebLin_Bethe_State>::Return_State (std::string base_label_ref)
457
+    {
458
+      int n = 0;
459
+      while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
460
+
461
+      if (n == ndef) {
462
+	State[n] = State[0];
463
+	base_label[n] = base_label_ref;
464
+	info[n].Nfull = 1LL; // Nfull not definable for LiebLin
465
+	ndef++;
466
+      }
467
+
468
+      return(State[n]);
469
+    }
470
+
471
+  template<>
472
+    inline XXZ_Bethe_State& Scan_State_List<XXZ_Bethe_State>::Return_State (std::string base_label_ref)
473
+    {
474
+      int n = 0;
475
+      while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
476
+
477
+      if (n == ndef) {
478
+	Heis_Base checkbase (State[0].chain, base_label_ref);
479
+	State[n] = XXZ_Bethe_State (State[0].chain, checkbase);
480
+	info[n].Nfull = checkbase.dimH;
481
+	ndef++;
482
+      }
483
+
484
+      return(State[n]);
485
+    }
486
+
487
+  template<>
488
+    inline XXX_Bethe_State& Scan_State_List<XXX_Bethe_State>::Return_State (std::string base_label_ref)
489
+    {
490
+      int n = 0;
491
+      while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
492
+
493
+      if (n == ndef) {
494
+	Heis_Base checkbase (State[0].chain, base_label_ref);
495
+	State[n] = XXX_Bethe_State (State[0].chain, checkbase);
496
+	info[n].Nfull = checkbase.dimH;
497
+	ndef++;
498
+      }
499
+
500
+      return(State[n]);
501
+    }
502
+
503
+  template<>
504
+    inline XXZ_gpd_Bethe_State& Scan_State_List<XXZ_gpd_Bethe_State>::Return_State (std::string base_label_ref)
505
+    {
506
+      int n = 0;
507
+      while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
508
+
509
+      if (n == ndef) {
510
+	Heis_Base checkbase (State[0].chain, base_label_ref);
511
+	State[n] = XXZ_gpd_Bethe_State (State[0].chain, checkbase);
512
+	info[n].Nfull = checkbase.dimH;
513
+	ndef++;
514
+      }
515
+
516
+      return(State[n]);
517
+    }
518
+
519
+  /* IN DEVELOPMENT
520
+     template<>
521
+     inline ODSLF_XXZ_Bethe_State& Scan_State_List<ODSLF_XXZ_Bethe_State>::Return_State (long long int base_id_ref, long long int type_id_ref)
522
+     {
523
+     int n = 0;
524
+     while (n < ndef && !(base_id_ref == State[n].base_id && type_id_ref == State[n].type_id)) n++;
525
+
526
+     if (n == ndef) {
527
+     State[n] = ODSLF_XXZ_Bethe_State (State[0].chain, base_id_ref, type_id_ref);
528
+     info[n].Nfull = State[n].maxid + 1LL;
529
+     ndef++;
530
+     }
531
+
532
+     return(State[n]);
533
+     }
534
+  */
535
+
536
+  template<>
537
+    inline void Scan_State_List<LiebLin_Bethe_State>::Populate_List (char whichDSF, const LiebLin_Bethe_State& SeedScanState)
538
+    {
539
+      // For LiebLin_Bethe_State: only one base is used, so there is only one state here.
540
+
541
+      if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
542
+
543
+      std::stringstream baselabel;
544
+      baselabel << State[0].N;
545
+      base_label[0] = baselabel.str();
546
+      std::stringstream label0;
547
+      label0 << State[0].N << LABELSEP << ABACUScoding[0] << LABELSEP;//"_0_";
548
+      State[0].Set_to_Label (label0.str(), SeedScanState.Ix2);
549
+      info[0].Nfull = 1LL; // Nfull not definable for LiebLin
550
+      ndef = 1;
551
+    }
552
+
553
+  template<>
554
+    inline void Scan_State_List<XXZ_Bethe_State>::Populate_List (char whichDSF, const XXZ_Bethe_State& SeedScanState)
555
+    {
556
+      // creates all types of states containing up to nexc_max excitations
557
+
558
+      if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
559
+
560
+      // We assume that SeedScanState has quantum numbers which are set according to the relevant AveragingState.
561
+
562
+      // This function creates a list of states with other bases in the vicinity of that of SeedScanState,
563
+      // matching the quantum numbers as closely as possible.
564
+
565
+      Vect<int> Str_L(SeedScanState.chain.Nstrings);
566
+      for (int i = 0; i < SeedScanState.chain.Nstrings; ++i) Str_L[i] = SeedScanState.chain.Str_L[i];
567
+
568
+      // First of all, we create a list of the possible bases themselves.
569
+      Vect<std::string> bases_label = Possible_Bases (SeedScanState.base.Nrap, Str_L, SeedScanState.base.Mdown);  // returns a vector of possible bases
570
+
571
+      for (int ib = 0; ib < bases_label.size(); ++ib) {
572
+
573
+	Heis_Base checkbase (State[0].chain, bases_label[ib]);
574
+
575
+	State[ndef] = XXZ_Bethe_State (State[0].chain, checkbase);
576
+	State[ndef].Set_to_Closest_Matching_Ix2_fixed_Base (SeedScanState);
577
+	State[ndef].Set_Label_from_Ix2 (State[ndef].Ix2); // sets to trivial label for this base
578
+	base_label[ndef] = bases_label[ib];
579
+	info[ndef].Nfull = State[ndef].base.dimH;
580
+	ndef++;
581
+	if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
582
+      }
583
+    }
584
+
585
+  template<>
586
+    inline void Scan_State_List<XXX_Bethe_State>::Populate_List (char whichDSF, const XXX_Bethe_State& SeedScanState)
587
+    {
588
+      // creates all types of states containing up to nexc_max excitations
589
+
590
+      if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
591
+
592
+      // We assume that SeedScanState has quantum numbers which are set according to the relevant AveragingState.
593
+
594
+      // This function creates a list of states with other bases in the vicinity of that of SeedScanState,
595
+      // matching the quantum numbers as closely as possible.
596
+
597
+      Vect<int> Str_L(SeedScanState.chain.Nstrings);
598
+      for (int i = 0; i < SeedScanState.chain.Nstrings; ++i) Str_L[i] = SeedScanState.chain.Str_L[i];
599
+
600
+      // To take infinite rapidities into account, we use intermediate states with up to 2 less finite rapidities (1 for Szz, 2 for Spm)
601
+      int nrinfrapmax = 0;
602
+      if (whichDSF == 'z') nrinfrapmax = 1;
603
+      else if (whichDSF == 'p') nrinfrapmax = ABACUS::min(2, SeedScanState.base.Mdown);
604
+
605
+      Vect<int> Nrapmod = SeedScanState.base.Nrap;
606
+
607
+      for (int nrinfrap = 0; nrinfrap <= nrinfrapmax; ++nrinfrap) {
608
+
609
+	Nrapmod[0] = SeedScanState.base.Nrap[0] - nrinfrap;
610
+	if (Nrapmod[0] < 0) ABACUSerror("Putting too many rapidities at infinity in ABACUS_Scan.h: Possible_Bases.");
611
+
612
+	Vect<std::string> bases_label = Possible_Bases (Nrapmod, Str_L, SeedScanState.base.Mdown-nrinfrap);  // returns a vector of possible bases
613
+
614
+	for (int ib = 0; ib < bases_label.size(); ++ib) {
615
+
616
+	  Heis_Base checkbase (State[0].chain, bases_label[ib]);
617
+
618
+	  State[ndef] = XXX_Bethe_State (State[0].chain, checkbase);
619
+	  State[ndef].Set_to_Closest_Matching_Ix2_fixed_Base (SeedScanState);
620
+	  base_label[ndef] = bases_label[ib];
621
+	  info[ndef].Nfull = State[ndef].base.dimH;
622
+	  ndef++;
623
+	  if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
624
+	}
625
+      } // for nrinfrap
626
+    }
627
+
628
+  template<>
629
+    inline void Scan_State_List<XXZ_gpd_Bethe_State>::Populate_List (char whichDSF, const XXZ_gpd_Bethe_State& SeedScanState)
630
+    {
631
+      // creates all types of states containing up to nexc_max excitations
632
+
633
+      if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
634
+
635
+      // We assume that SeedScanState has quantum numbers which are set according to the relevant AveragingState.
636
+
637
+      // This function creates a list of states with other bases in the vicinity of that of SeedScanState,
638
+      // matching the quantum numbers as closely as possible.
639
+
640
+      Vect<int> Str_L(SeedScanState.chain.Nstrings);
641
+      for (int i = 0; i < SeedScanState.chain.Nstrings; ++i) Str_L[i] = SeedScanState.chain.Str_L[i];
642
+
643
+      // First of all, we create a list of the possible bases themselves.
644
+      Vect<std::string> bases_label = Possible_Bases (SeedScanState.base.Nrap, Str_L, SeedScanState.base.Mdown);  // returns a vector of possible bases
645
+
646
+      for (int ib = 0; ib < bases_label.size(); ++ib) {
647
+
648
+	Heis_Base checkbase (State[0].chain, bases_label[ib]);
649
+
650
+	State[ndef] = XXZ_gpd_Bethe_State (State[0].chain, checkbase);
651
+	State[ndef].Set_to_Closest_Matching_Ix2_fixed_Base (SeedScanState);
652
+	base_label[ndef] = bases_label[ib];
653
+	info[ndef].Nfull = State[ndef].base.dimH;
654
+	ndef++;
655
+	if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
656
+      }
657
+    }
658
+
659
+
660
+  /* IN DEVELOPMENT
661
+     template<>
662
+     inline void Scan_State_List<ODSLF_XXZ_Bethe_State>::Populate_List ()
663
+     {
664
+     // creates all types of states containing up to nexc_max excitations
665
+
666
+     if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
667
+
668
+     //std::cout << "In Populate_List: " << State[0] << std::endl;
669
+
670
+     Vect<long long int> bases_id = State[0].chain.Possible_Bases (State[0].base.Mdown);  // returns a vector of possible bases
671
+
672
+     //std::cout << "Mdown = " << State[0].base.Mdown << "\tPossible bases size: " << bases_id.size() << "\tPossible bases: " << bases_id << std::endl;
673
+
674
+     for (int ib = 0; ib < bases_id.size(); ++ib) {
675
+     ODSLF_Base checkbase (State[0].chain, bases_id[ib]);
676
+
677
+     Vect<long long int> types_id = checkbase.Possible_Types ();  // returns a vector of possible types
678
+
679
+     //std::cout << "For base_id " << bases_id[ib] << "\t found types " << types_id << std::endl;
680
+
681
+     for (int it = 0; it < types_id.size(); ++it) {
682
+
683
+     if (bases_id[ib] < 1000000) { // FUDGE:  consider only one-strings
684
+     //std::cout << "Populate list:  constructing state: " << bases_id[ib] << "\t" << types_id[it] << std::endl;
685
+     State[ndef] = ODSLF_XXZ_Bethe_State (State[0].chain, bases_id[ib], types_id[it]);
686
+     //std::cout << "Populate list:  before setting id: " << std::endl << State[ndef] << std::endl;
687
+     State[ndef].Set_to_id(0LL);
688
+     //std::cout << "Populate list:  after setting id:  "  << std::endl << State[ndef] << std::endl;
689
+     info[ndef].Nfull = State[ndef].maxid + 1LL;
690
+     ndef++;
691
+     if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
692
+     }
693
+     }
694
+
695
+     }
696
+     }
697
+
698
+  */
699
+
700
+
701
+
702
+  template<class Tstate>
703
+    inline void Scan_State_List<Tstate>::Include_Info (Scan_Info& info_to_add, std::string base_label_ref)
704
+    {
705
+
706
+      int n = 0;
707
+      while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
708
+
709
+      if (n == ndef) {
710
+	std::cout << "ndef = " << ndef << std::endl;
711
+	for (int i = 0; i < ndef; ++i) std::cout << base_label[i] << "\t";
712
+	std::cout << std::endl;
713
+	std::cout << "base_label_ref " << base_label_ref << std::endl;
714
+	ABACUSerror("Did not find base_label_ref in Scan_State_List::Include_Info.");
715
+      }
716
+
717
+      info[n] += info_to_add;
718
+      return;
719
+    }
720
+
721
+
722
+  template<class Tstate>
723
+    inline void Scan_State_List<Tstate>::Raise_Scanning_Flags (DP threshold)
724
+    {
725
+      flag_for_scan = true;
726
+    }
727
+
728
+  template<class Tstate>
729
+    inline void Scan_State_List<Tstate>::Order_in_SRC ()
730
+    {
731
+      if (ndef > 0) {
732
+
733
+	Vect_INT index(ndef);
734
+	for (int i = 0; i < ndef; ++i) index[i] = i;
735
+
736
+	Vect<DP> sr (ndef);
737
+	for (int i = 0; i < ndef; ++i) sr[i] = info[i].sumrule_obtained;
738
+
739
+	sr.QuickSort(index, 0, ndef - 1);
740
+
741
+	Vect<Tstate> State_ordered(ndef);
742
+	Vect<std::string> base_label_ordered(ndef);
743
+	Vect<Scan_Info> info_ordered(ndef);
744
+	Vect<bool> flag_for_scan_ordered(ndef);
745
+
746
+	// Put data in proper order
747
+	for (int i = 0; i < ndef; ++i) {
748
+	  State_ordered[i] = State[index[ndef - 1 - i] ];
749
+	  base_label_ordered[i] = base_label[index[ndef - 1 - i] ];
750
+	  info_ordered[i] = info[index[ndef - 1 - i] ];
751
+	  flag_for_scan_ordered[i] = flag_for_scan[index[ndef - 1 - i] ];
752
+	}
753
+
754
+	// Put back in *this object:
755
+	for (int i = 0; i < ndef; ++i) {
756
+	  State[i] = State_ordered[i];
757
+	  base_label[i] = base_label_ordered[i];
758
+	  info[i] = info_ordered[i];
759
+	  flag_for_scan[i] = flag_for_scan_ordered[i];
760
+	} // The rest are all simply 0.
761
+      }
762
+    }
763
+
764
+  template<class Tstate>
765
+    inline void Scan_State_List<Tstate>::Save_Info (const char* sumfile_Cstr)
766
+    {
767
+      std::ofstream outfile;
768
+
769
+      outfile.open(sumfile_Cstr);
770
+      if (outfile.fail()) ABACUSerror("Could not open outfile... ");
771
+
772
+      outfile.setf(std::ios::fixed);
773
+      outfile.precision(16);
774
+
775
+      outfile << std::setw(20) << "base" << std::setw(25) << "sumrule_obtained" << std::setw(25) << "Nfull" << std::setw(10) << "Ninadm" << std::setw(10) << "Ndata" << std::setw(10) << "conv" << std::setw(10) << "conv0" << std::setw(10) << "TT.";
776
+
777
+      for (int i = 0; i < ndef; ++i)
778
+	if (info[i].Nfull > 0.0) {
779
+	  int TT_hr = int(info[i].TT/3600);
780
+	  int TT_min = int((info[i].TT - 3600.0*TT_hr)/60);
781
+	  outfile << std::endl << std::setw(20) << base_label[i] << std::setw(25) << std::fixed << std::setprecision(20) << info[i].sumrule_obtained;
782
+	  if (info[i].Nfull < 1.0e+10) outfile << std::setw(25) << std::fixed << std::setprecision(0) << info[i].Nfull;
783
+	  else outfile << std::setw(25) << std::scientific << std::setprecision(16) << info[i].Nfull;
784
+	  outfile << std::setw(10) << info[i].Ninadm << std::setw(10) << info[i].Ndata << std::setw(10) << info[i].Ndata_conv << std::setw(10) << info[i].Ndata_conv0 << std::setw(10) << TT_hr << " h " << TT_min << " m " << std::fixed << std::showpoint << std::setprecision(3) << info[i].TT - 3600.0*TT_hr - 60.0*TT_min << " s";
785
+	}
786
+      outfile.close();
787
+    }
788
+
789
+  template<class Tstate>
790
+    inline void Scan_State_List<Tstate>::Load_Info (const char* sumfile_Cstr)
791
+    {
792
+      std::ifstream infile;
793
+      infile.open(sumfile_Cstr);
794
+      if(infile.fail()) {
795
+	std::cout << std::endl << sumfile_Cstr << std::endl;
796
+	ABACUSerror("Could not open input file in Scan_State_List::Load_Info.");
797
+      }
798
+
799
+      // Load first line, containing informative text:
800
+      char junk[256];
801
+      infile.getline(junk, 256);
802
+
803
+      // Now load the previous info's:
804
+      std::string base_label_ref;
805
+      DP sr_ref;
806
+      DP Nfull_ref;
807
+      long long int Ninadm_ref, Ndata_ref, conv_ref, conv0_ref;
808
+      DP TT_ref;
809
+      int TT_hr, TT_min;
810
+      DP TT_sec;
811
+      char a;
812
+
813
+      while (infile.peek() != EOF) {
814
+	infile >> base_label_ref >> sr_ref >> Nfull_ref >> Ninadm_ref >> Ndata_ref >> conv_ref >> conv0_ref >> TT_hr >> a >> TT_min >> a >> TT_sec >> a;
815
+	TT_ref = 3600.0 * TT_hr + 60.0* TT_min + TT_sec;
816
+	Scan_Info info_ref (sr_ref, Nfull_ref, Ninadm_ref, Ndata_ref, conv_ref, conv0_ref, TT_ref);
817
+	(*this).Include_Info (info_ref, base_label_ref);
818
+      }
819
+
820
+      infile.close();
821
+
822
+      return;
823
+    }
824
+
825
+
826
+} // namespace ABACUS
827
+
828
+#endif

include/JSC_Spec_Fns.h → include/ABACUS_Spec_Fns.h View File

@@ -2,24 +2,22 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_Spec_Fns.h
9
+File:  ABACUS_Spec_Fns.h
10 10
 
11 11
 Purpose:  Defines special math functions.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#ifndef _JSC_SPEC_FNS_H_
16
-#define _JSC_SPEC_FNS_H_
15
+#ifndef ABACUS_SPEC_FNS_H
16
+#define ABACUS_SPEC_FNS_H
17 17
 
18
-#include "JSC.h"
18
+#include "ABACUS.h"
19 19
 
20
-using namespace std;
21
-
22
-namespace JSC {
20
+namespace ABACUS {
23 21
 
24 22
   inline DP Cosine_Integral (DP x)
25 23
   {
@@ -28,8 +26,8 @@ namespace JSC {
28 26
     // Refer to GR[6] 8.23
29 27
 
30 28
     if (x <= 0.0) {
31
-      cout << "Cosine_Integral called with real argument " << x << " <= 0, which is ill-defined because of the branch cut." << endl;
32
-      JSCerror("");
29
+      std::cout << "Cosine_Integral called with real argument " << x << " <= 0, which is ill-defined because of the branch cut." << std::endl;
30
+      ABACUSerror("");
33 31
     }
34 32
 
35 33
     else if (x < 15.0) { // Use power series expansion
@@ -45,7 +43,7 @@ namespace JSC {
45 43
       DP series = minonetothen * exp(logxtothetwon - log(2.0 * n) - logtwonfact);
46 44
       DP term_n;
47 45
 
48
-      do { 
46
+      do {
49 47
 	n += 1;
50 48
 	minonetothen *= -1.0;
51 49
 	logxtothetwon += twologx;
@@ -55,34 +53,6 @@ namespace JSC {
55 53
 
56 54
       } while (fabs(term_n) > 1.0e-16);
57 55
 
58
-
59
-
60
-
61
-      /*
62
-      // For improved convergence we pair terms up,         DOESN'T WORK WELL
63
-
64
-      // Ci (x) = gamma + \ln x - \sum{n = 1, 3, 5, ...} \frac{x^{2n}}{2n (2n)!} ( 1 - \frac{n}{n+1} \frac{x^2}{(2n+1)(2n+2)} )
65
-
66
-      int n = 1;
67
-      DP logxtothetwon = 2.0 * log(x);
68
-      DP logtwon = log(2.0);
69
-      DP logtwonfact = log(2.0);
70
-      DP xsq = x*x;
71
-
72
-      DP series = exp(logxtothetwon - logtwon - logtwonfact) * (1 - xsq/((2.0 * n + 1.0) * (2.0 * n + 2.0) * (1.0 + 1.0/n)));
73
-      DP term_n;
74
-      DP twologx = 2.0 * log(x);
75
-
76
-      do { 
77
-	n += 2;
78
-	logxtothetwon += twologx;
79
-	logtwonfact += log((2.0 * n - 1.0) * 2.0 * n);
80
-	term_n = exp(logxtothetwon - log(2.0 * n) - logtwonfact) * (1 - xsq/((2.0 * n + 1.0) * (2.0 * n + 2.0) * (1.0 + 1.0/n)));;
81
-	series += term_n;
82
-
83
-      } while (fabs(term_n) > 1.0e-16);
84
-      */
85
-
86 56
       return(Euler_Mascheroni + log(x) + series);
87 57
     }
88 58
 
@@ -102,7 +72,7 @@ namespace JSC {
102 72
       DP series1 = minonetothen * exp(logtwonfact - logxtothetwon);
103 73
       DP series2 = minonetothen * exp(logtwonplus1fact - logxtothetwonplus1);
104 74
 
105
-      do { 
75
+      do {
106 76
 	n += 1;
107 77
 	minonetothen *= -1.0;
108 78
 	logxtothetwon += twologx;
@@ -133,11 +103,11 @@ namespace JSC {
133 103
     // in which q is the nome. (GR 8.180.1)
134 104
     // We always evaluate to numerical accuracy.
135 105
 
136
-    if (q >= 1.0) JSCerror("Jacobi_Theta_1_q function called with q > 1.");
106
+    if (q >= 1.0) ABACUSerror("Jacobi_Theta_1_q function called with q > 1.");
137 107
 
138 108
 
139 109
     DP answer = 0.0;
140
-    DP contrib = 0.0; 
110
+    DP contrib = 0.0;
141 111
     DP qtonminhalfsq = pow(q, 0.25);  // this will be q^{(n-1/2)^2}
142 112
     DP qtotwon = pow(q, 2.0); // this will be q^{2n}
143 113
     DP qsq = q*q;
@@ -149,26 +119,24 @@ namespace JSC {
149 119
       qtonminhalfsq *= qtotwon;
150 120
       qtotwon *= qsq;
151 121
       n++;
152
-      //cout << "\t\tn = " << n << "\tanswer = " << answer << "\tcontrib = " << contrib << "\tqtonminhalfsq = " << qtonminhalfsq << "\tqtotwon = " << qtotwon << endl;
153 122
     } while (fabs(contrib/answer) > MACHINE_EPS);
154 123
 
155
-    //cout << "\t\tJacobi_Theta_1: used " << n << " iterations." << "\tanswer = " << answer << "\tcontrib = " << contrib << "\tqtonminhalfsq = " << qtonminhalfsq << "\tqtotwon = " << qtotwon << endl;
156 124
     return(answer);
157 125
   }
158 126
 
159
-  inline complex<DP> ln_Jacobi_Theta_1_q (complex<DP> u, complex<DP> q) {
127
+  inline std::complex<DP> ln_Jacobi_Theta_1_q (std::complex<DP> u, std::complex<DP> q) {
160 128
 
161 129
     // This uses the product representation
162 130
     // \theta_1 (x) = 2 q^{1/4} \sin{u} \prod_{n=1}^\infty (1 - 2 q^{2n} \cos 2u + q^{4n}) (1 - q^{2n})
163 131
     // (GR 8.181.2)
164 132
 
165
-    complex<DP> contrib = 0.0;
166
-    complex<DP> qtotwon = q*q; // this will be q^{2n}
167
-    complex<DP> qsq = q*q;
168
-    complex<DP> twocos2u = 2.0 * cos(2.0*u);
133
+    std::complex<DP> contrib = 0.0;
134
+    std::complex<DP> qtotwon = q*q; // this will be q^{2n}
135
+    std::complex<DP> qsq = q*q;
136
+    std::complex<DP> twocos2u = 2.0 * cos(2.0*u);
169 137
     int n = 1;
170
-    complex<DP> answer = log(2.0 * sin(u)) + 0.25 * log(q);
171
-    
138
+    std::complex<DP> answer = log(2.0 * sin(u)) + 0.25 * log(q);
139
+
172 140
     do {
173 141
       contrib = log((1.0 - twocos2u * qtotwon + qtotwon * qtotwon) * (1.0 - qtotwon));
174 142
       answer += contrib;
@@ -184,7 +152,7 @@ namespace JSC {
184 152
 
185 153
   inline DP ln_Gamma_for_Barnes_G_RE (Vect_DP args)
186 154
   {
187
-    return(real(ln_Gamma(complex<double>(args[0]))));
155
+    return(real(ln_Gamma(std::complex<double>(args[0]))));
188 156
   }
189 157
 
190 158
   inline DP ln_Barnes_G_RE (DP z)
@@ -199,9 +167,9 @@ namespace JSC {
199 167
     int max_nr_pts = 10000;
200 168
     Integral_result integ_ln_Gamma = Integrate_optimal (ln_Gamma_for_Barnes_G_RE, args, 0, 0.0, z - 1.0, req_rel_prec, req_abs_prec, max_nr_pts);
201 169
 
202
-    return(0.5 * (z - 1.0) * (2.0 - z + logtwoPI) + (z - 1.0) * real(ln_Gamma(complex<double>(z - 1.0))) - integ_ln_Gamma.integ_est);
170
+    return(0.5 * (z - 1.0) * (2.0 - z + logtwoPI) + (z - 1.0) * real(ln_Gamma(std::complex<double>(z - 1.0))) - integ_ln_Gamma.integ_est);
203 171
   }
204 172
 
205
-} // namespace JSC
173
+} // namespace ABACUS
206 174
 
207
-#endif // _JS_SPEC_FNS_H_
175
+#endif

include/JSC_State_Ensemble.h → include/ABACUS_State_Ensemble.h View File

@@ -2,23 +2,22 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_State_Ensemble.h
9
+File:  ABACUS_State_Ensemble.h
10 10
 
11 11
 Purpose:  Define state ensembles.
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#ifndef _ENS_
17
-#define _ENS_
15
+#ifndef ABACUS_STATE_ENSEMBLE_H
16
+#define ABACUS_STATE_ENSEMBLE_H
18 17
 
19
-#include "JSC.h"
18
+#include "ABACUS.h"
20 19
 
21
-namespace JSC {
20
+namespace ABACUS {
22 21
 
23 22
 
24 23
   struct LiebLin_Diagonal_State_Ensemble {
@@ -29,8 +28,6 @@ namespace JSC {
29 28
 
30 29
     LiebLin_Diagonal_State_Ensemble ();
31 30
     LiebLin_Diagonal_State_Ensemble (const LiebLin_Bethe_State& RefState, int nstates_req);
32
-    //LiebLin_Diagonal_State_Ensemble (const LiebLin_Bethe_State& RefState, int nstates_req, const Vect<DP>& weight_ref);
33
-    //LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho, int nstates_req);
34 31
     LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho);
35 32
 
36 33
     LiebLin_Diagonal_State_Ensemble& operator= (const LiebLin_Diagonal_State_Ensemble& rhs);
@@ -38,10 +35,9 @@ namespace JSC {
38 35
     void Save (const char* ensfile_Cstr);
39 36
   };
40 37
 
41
-  //LiebLin_Diagonal_State_Ensemble LiebLin_Thermal_Saddle_Point_Ensemble (DP c_int, DP L, int N, DP kBT, int nstates_req);
42 38
   LiebLin_Diagonal_State_Ensemble LiebLin_Thermal_Saddle_Point_Ensemble (DP c_int, DP L, int N, DP kBT);
43 39
 
44 40
 
45
-} // namespace JSC
41
+} // namespace ABACUS
46 42
 
47 43
 #endif

include/JSC_TBA.h → include/ABACUS_TBA.h View File

@@ -2,26 +2,25 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS. library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_TBA.h
9
+File:  ABACUS_TBA.h
10 10
 
11 11
 Purpose:  Thermodynamic Bethe Ansatz general functions
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#ifndef _TBA_
17
-#define _TBA_
15
+#ifndef ABACUS_TBA_H
16
+#define ABACUS_TBA_H
18 17
 
19
-#include "JSC.h"
18
+#include "ABACUS.h"
20 19
 
21
-namespace JSC {
20
+namespace ABACUS {
22 21
 
23 22
   struct Root_Density {
24
-    
23
+
25 24
     int Npts;  // how many points are used to describe each function
26 25
     DP lambdamax;  // what the largest rapidity is
27 26
     Vect_DP lambda;  // rapidity vector
@@ -31,42 +30,42 @@ namespace JSC {
31 30
     DP diff;   // relative differences with previous iteration
32 31
     bool value_infty_set;  // boolean, true if asymptotic value set
33 32
     DP value_infty;  // asymptotic value, computed analytically
34
-    
33
+
35 34
     Root_Density ();
36 35
     Root_Density (int Npts_ref, DP lambdamax_ref);
37
-    
36
+
38 37
     Root_Density& operator= (const Root_Density& RefDensity);
39
-    
38
+
40 39
     void Save (const char* outfile_Cstr);
41 40
 
42 41
     DP Return_Value (DP lambda_ref);  // evaluates the function for any argument using linear interpolation
43 42
     void Set_Asymptotics (DP value_infty_ref);  // sets value for lambda >= lambdamax
44
-    
43
+
45 44
     Root_Density Compress_and_Match_Densities (DP comp_factor);  // returns a Root_Density with fewer points
46 45
   };
47 46
 
48 47
   struct Root_Density_Set {
49
-    
48
+
50 49
     int ntypes;
51 50
     Vect<Root_Density> epsilon;
52 51
     int Npts_total;  // sum of all Npts of epsilon's
53 52
     DP diff;  // sum of diff's of the epsilon's
54
-    
53
+
55 54
     Root_Density_Set ();
56 55
     Root_Density_Set (int ntypes_ref, int Npts_ref, DP lambdamax_ref);
57 56
     Root_Density_Set (int ntypes_ref, Vect_INT Npts_ref, Vect_DP lambdamax_ref);
58
-    
57
+
59 58
     Root_Density_Set& operator= (const Root_Density_Set& RefSet);
60
-    
59
+
61 60
     void Insert_new_function (DP asymptotic_value);
62 61
     void Extend_limits (Vect<bool> need_to_extend_limit);
63 62
     void Insert_new_points (Vect<Vect<bool> > need_new_point_around);
64
-    
63
+
65 64
     DP Return_Value (int n_ref, DP lambda_ref);  // returns a value, no matter what.
66
-    
65
+
67 66
     Root_Density_Set Return_Compressed_and_Matched_Set (DP comp_factor);
68 67
     void Match_Densities (Root_Density_Set& RefSet);
69
-    
68
+
70 69
     void Save (const char* outfile_Cstr);
71 70
   };
72 71
 
@@ -100,13 +99,13 @@ namespace JSC {
100 99
   Root_Density LiebLin_rho_TBA (DP kBT, const Root_Density& epsilon, const Root_Density& depsilon_dmu);
101 100
   Root_Density LiebLin_rhoh_TBA (DP kBT, const Root_Density& epsilon, const Root_Density& depsilon_dmu);
102 101
   DP LiebLin_nbar_TBA (const Root_Density& rho);
103
-  DP LiebLin_ebar_TBA (const Root_Density& rho); 
104
-  DP LiebLin_sbar_TBA (const Root_Density& rho, const Root_Density& rhoh); 
102
+  DP LiebLin_ebar_TBA (const Root_Density& rho);
103
+  DP LiebLin_sbar_TBA (const Root_Density& rho, const Root_Density& rhoh);
105 104
   LiebLin_TBA_Solution LiebLin_TBA_Solution_fixed_nbar (DP c_int, DP nbar_required, DP kBT, DP req_diff, int Max_Secs);
106 105
   LiebLin_TBA_Solution LiebLin_TBA_Solution_fixed_nbar_ebar (DP c_int, DP nbar_required, DP ebar_required, DP req_diff, int Max_Secs);
107 106
   LiebLin_Bethe_State Discretized_LiebLin_Bethe_State (DP c_int, DP L, int N, const Root_Density& rho);
108 107
 
109
-  // Functions defined in TBA_XXZ.cc 
108
+  // Functions defined in TBA_XXZ.cc
110 109
   DP XXZ_phi1_kernel (DP zeta, DP lambda);
111 110
   DP XXZ_phi2_kernel (DP zeta, DP lambda);
112 111
   DP XXZ_a1_kernel (DP sinzeta, DP coszeta, DP lambda);
@@ -121,7 +120,6 @@ namespace JSC {
121 120
   Root_Density XXZ_Kbackflow_GS (DP Delta, DP B, DP lambdamax, DP lambda_p, DP lambda_h, int Npts, DP req_prec);
122 121
   Root_Density XXZ_Fbackflow_GS (DP Delta, DP B, DP lambdamax, DP lambda_p, DP lambda_h, int Npts, DP req_prec);
123 122
   Root_Density XXZ_Z_GS (DP Delta, DP B, DP lambdamax, int Npts, DP req_prec);
124
-  //void XXZ_Compare_Lattice_and_Continuum_Backflows_base_1010 (DP Delta, int N, int M, long long int id);
125 123
 
126 124
   // Defined in TBA_2CBG.cc:
127 125
   struct TBA_Data_2CBG {
@@ -141,7 +139,7 @@ namespace JSC {
141 139
   void Scan_2CBG_TBAE (DP c_int, DP mu_min, DP mu_max, int Nmu, DP Omega_min, DP Omega_max, int NOmega,
142 140
 		       DP kBT_min, DP kBT_max, int NkBT, int Max_Secs);
143 141
 
144
-  
145
-} // namespace JSC
142
+
143
+} // namespace ABACUS
146 144
 
147 145
 #endif

+ 438
- 0
include/ABACUS_Utils.h View File

@@ -0,0 +1,438 @@
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  ABACUS_util.h
10
+
11
+Purpose:  Defines basic math functions.
12
+
13
+***********************************************************/
14
+
15
+#ifndef ABACUS_UTIL_H
16
+#define ABACUS_UTIL_H
17
+
18
+#include "ABACUS.h"
19
+
20
+
21
+typedef double DP;
22
+
23
+// Global constants
24
+
25
+const double PI = 3.141592653589793238462643;
26
+const double sqrtPI = sqrt(PI);
27
+const double twoPI = 2.0*PI;
28
+const double logtwoPI = log(twoPI);
29
+const double Euler_Mascheroni = 0.577215664901532860606;
30
+const double Gamma_min_0p5 = -2.0 * sqrt(PI);
31
+const std::complex<double> II(0.0,1.0);  //  Shorthand for i
32
+
33
+const DP MACHINE_EPS = std::numeric_limits<DP>::epsilon();
34
+const DP MACHINE_EPS_SQ = pow(MACHINE_EPS, 2.0);
35
+
36
+// Now for some basic math utilities:
37
+
38
+namespace ABACUS {
39
+
40
+  // File checks:
41
+
42
+  inline bool file_exists (const char* filename)
43
+  {
44
+    std::fstream file;
45
+    file.open(filename);
46
+    bool exists = !file.fail();
47
+    file.close();
48
+
49
+    return(exists);
50
+  }
51
+
52
+  // Error handler:
53
+
54
+  inline void ABACUSerror (const std::string error_text)
55
+  // my error handler
56
+  {
57
+    std::cerr << "Run-time error... " << std::endl;
58
+    std::cerr << error_text << std::endl;
59
+    std::cerr << "Exiting to system..." << std::endl;
60
+    exit(1);
61
+  }
62
+
63
+  struct Divide_by_zero {};
64
+
65
+
66
+  // Basics:  min, max, fabs
67
+
68
+  template<class T>
69
+    inline const T max (const T& a, const T& b) { return a > b ? (a) : (b); }
70
+
71
+  template<class T>
72
+    inline const T min (const T& a, const T& b) { return a > b ? (b) : (a); }
73
+
74
+  template<class T>
75
+    inline const T fabs (const T& a) { return a >= 0 ? (a) : (-a); }
76
+
77
+  inline long long int pow_lli (const long long int& base, const int& exp)
78
+  {
79
+    long long int answer = base;
80
+    if (exp == 0) answer = 1LL;
81
+    else for (int i = 1; i < exp; ++i) answer *= base;
82
+    return(answer);
83
+  }
84
+
85
+  inline unsigned long long int pow_ulli (const unsigned long long int& base, const int& exp)
86
+  {
87
+    unsigned long long int answer = base;
88
+    if (exp == 0) answer = 1ULL;
89
+    for (int i = 1; i < exp; ++i) answer *= base;
90
+    return(answer);
91
+  }
92
+
93
+  inline int fact (const int& N)
94
+  {
95
+    int ans = 0;
96
+
97
+    if (N < 0) {
98
+      std::cerr << "Error:  factorial of negative number.  Exited." << std::endl;
99
+      exit(1);
100
+    }
101
+    else if ( N == 1  ||  N == 0) ans = 1;
102
+    else ans = N * fact(N-1);
103
+
104
+    return(ans);
105
+  }
106
+
107
+  inline DP ln_fact (const int& N)
108
+  {
109
+    DP ans = 0.0;
110
+
111
+    if (N < 0) {
112
+      std::cerr << "Error:  factorial of negative number.  Exited." << std::endl;
113
+      exit(1);
114
+    }
115
+    else if ( N == 1  ||  N == 0) ans = 0.0;
116
+    else ans = log(DP(N)) + ln_fact(N-1);
117
+
118
+    return(ans);
119
+  }
120
+
121
+  inline long long int fact_lli (const int& N)
122
+  {
123
+    long long int ans = 0;
124
+
125
+    if (N < 0) {
126
+      std::cerr << "Error:  factorial of negative number.  Exited." << std::endl;
127
+      exit(1);
128
+    }
129
+    else if ( N == 1  ||  N == 0) ans = 1;
130
+    else ans = fact_lli(N-1) * N;
131
+
132
+    return(ans);
133
+  }
134
+
135
+  inline long long int fact_ulli (const int& N)
136
+  {
137
+    unsigned long long int ans = 0;
138
+
139
+    if (N < 0) {
140
+      std::cerr << "Error:  factorial of negative number.  Exited." << std::endl;
141
+      exit(1);
142
+    }
143
+    else if ( N == 1  ||  N == 0) ans = 1;
144
+    else ans = fact_ulli(N-1) * N;
145
+
146
+    return(ans);
147
+  }
148
+
149
+  inline int choose (const int& N1, const int& N2)
150
+  {
151
+    // returns N1 choose N2
152
+
153
+    int ans = 0;
154
+    if (N1 < N2) {
155
+      std::cout << "Error:  N1 smaller than N2 in choose.  Exited." << std::endl;
156
+      exit(1);
157
+    }
158
+    else if (N1 == N2) ans = 1;
159
+    else if (N1 < 12) ans = fact(N1)/(fact(N2) * fact(N1 - N2));
160
+    else {
161
+      ans = 1;
162
+      int mult = N1;
163
+      while (mult > max(N2, N1 - N2)) ans *= mult--;
164
+      ans /= fact(min(N2, N1 - N2));
165
+    }
166
+
167
+    return(ans);
168
+  }
169
+
170
+  inline DP ln_choose (const int& N1, const int& N2)
171
+  {
172
+    // returns the log of N1 choose N2
173
+
174
+    DP ans = 0.0;
175
+    if (N1 < N2) {
176
+      std::cout << "Error:  N1 smaller than N2 in choose.  Exited." << std::endl;
177
+      exit(1);
178
+    }
179
+    else if (N1 == N2) ans = 0.0;
180
+    else ans = ln_fact(N1) - ln_fact(N2) - ln_fact(N1 - N2);
181
+
182
+    return(ans);
183
+  }
184
+
185
+
186
+  inline long long int choose_lli (const int& N1, const int& N2)
187
+  {
188
+    // returns N1 choose N2
189
+
190
+    long long int ans = 0;
191
+    if (N1 < N2) {
192
+      std::cout << "Error:  N1 smaller than N2 in choose.  Exited." << std::endl;
193
+      exit(1);
194
+    }
195
+    else if (N1 == N2) ans = 1;
196
+    else if (N1 < 12) ans = fact_lli(N1)/(fact_lli(N2) * fact_lli(N1 - N2));
197
+    else {
198
+      // Make sure that N2 is less than or equal to N1/2;  if not, just switch...
199
+      int N2_min = min(N2, N1 - N2);
200
+
201
+      ans = 1;
202
+      for (int i = 0; i < N2_min; ++i) {
203
+	ans *= (N1 - i);
204
+	ans /= i + 1;
205
+      }
206
+    }
207
+
208
+    return(ans);
209
+  }
210
+
211
+  inline unsigned long long int choose_ulli (const int& N1, const int& N2)
212
+  {
213
+    // returns N1 choose N2
214
+
215
+    unsigned long long int ans = 0;
216
+    if (N1 < N2) {
217
+      std::cout << "Error:  N1 smaller than N2 in choose.  Exited." << std::endl;
218
+      exit(1);
219
+    }
220
+    else if (N1 == N2) ans = 1;
221
+    else if (N1 < 12) ans = fact_ulli(N1)/(fact_ulli(N2) * fact_ulli(N1 - N2));
222
+    else {
223
+      // Make sure that N2 is less than or equal to N1/2;  if not, just switch...
224
+      int N2_min = min(N2, N1 - N2);
225
+
226
+      ans = 1;
227
+      for (int i = 0; i < N2_min; ++i) {
228
+	ans *= (N1 - i);
229
+	ans /= i + 1;
230
+      }
231
+    }
232
+
233
+    return(ans);
234
+  }
235
+
236
+  inline DP SIGN (const DP &a, const DP &b)
237
+  {
238
+    return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
239
+  }
240
+
241
+  inline DP sign_of (const DP& a)
242
+  {
243
+    return (a >= 0.0 ? 1.0 : -1.0);
244
+  }
245
+
246
+  inline int sgn_int (const int& a)
247
+  {
248
+    return (a >= 0) ? 1 : -1;
249
+  }
250
+
251
+  inline int sgn_DP (const DP& a)
252
+  {
253
+    return (a >= 0) ? 1 : -1;
254
+  }
255
+
256
+  template<class T>
257
+    inline void SWAP (T& a, T& b) {T dum = a; a = b; b = dum;}
258
+
259
+  inline int kronecker (int a, int b)
260
+  {
261
+    return a == b ? 1 : 0;
262
+  }
263
+
264
+  template<class T>
265
+    inline bool is_nan (const T& a)
266
+    {
267
+      return(!((a < T(0.0)) || (a >= T(0.0))));
268
+    }
269
+
270
+  inline std::complex<DP> atan_cx(const std::complex<DP>& x)
271
+  {
272
+    return(-0.5 * II * log((1.0 + II* x)/(1.0 - II* x)));
273
+  }
274
+
275
+  /****************  Gamma function *******************/
276
+
277
+  inline std::complex<double> ln_Gamma (std::complex<double> z)
278
+  {
279
+    // Implementation of Lanczos method with g = 9.
280
+    // Coefficients from Godfrey 2001.
281
+
282
+    if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
283
+
284
+    else {
285
+
286
+      std::complex<double> series = 1.000000000000000174663
287
+	+ 5716.400188274341379136/z
288
+	- 14815.30426768413909044/(z + 1.0)
289
+	+ 14291.49277657478554025/(z + 2.0)
290
+	- 6348.160217641458813289/(z + 3.0)
291
+	+ 1301.608286058321874105/(z + 4.0)
292
+	- 108.1767053514369634679/(z + 5.0)
293
+	+ 2.605696505611755827729/(z + 6.0)
294
+	- 0.7423452510201416151527e-2 / (z + 7.0)
295
+	+ 0.5384136432509564062961e-7 / (z + 8.0)
296
+	- 0.4023533141268236372067e-8 / (z + 9.0);
297
+
298
+      return(0.5 * logtwoPI + (z - 0.5) * log(z + 8.5) - (z + 8.5) + log(series));
299
+    }
300
+
301
+    return(log(0.0));  // never called
302
+  }
303
+
304
+  inline std::complex<double> ln_Gamma_old (std::complex<double> z)
305
+  {
306
+    // Implementation of Lanczos method with g = 9.
307
+    // Coefficients from Godfrey 2001.
308
+
309
+    if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
310
+
311
+    else {
312
+
313
+      int g = 9;
314
+
315
+      double p[11] = { 1.000000000000000174663,
316
+		       5716.400188274341379136,
317
+		       -14815.30426768413909044,
318
+		       14291.49277657478554025,
319
+		       -6348.160217641458813289,
320
+		       1301.608286058321874105,
321
+		       -108.1767053514369634679,
322
+		       2.605696505611755827729,
323
+		       -0.7423452510201416151527e-2,
324
+		       0.5384136432509564062961e-7,
325
+		       -0.4023533141268236372067e-8 };
326
+
327
+      std::complex<double> z_min_1 = z - 1.0;
328
+      std::complex<double> series = p[0];
329
+      for (int i = 1; i < g+2; ++i)
330
+	series += p[i]/(z_min_1 + std::complex<double>(i));
331
+
332
+      return(0.5 * logtwoPI + (z_min_1 + 0.5) * log(z_min_1 + std::complex<double>(g) + 0.5)
333
+	     - (z_min_1 + std::complex<double>(g) + 0.5) + log(series));
334
+    }
335
+
336
+    return(log(0.0));  // never called
337
+  }
338
+
339
+  inline std::complex<double> ln_Gamma_2 (std::complex<double> z)
340
+  {
341
+    // Implementation of Lanczos method with g = 7.
342
+
343
+    if (real(z) < 0.5) return(log(PI/(sin(PI*z)) - ln_Gamma(1.0 - z)));
344
+
345
+    else {
346
+
347
+      int g = 7;
348
+
349
+      double p[9] = { 0.99999999999980993, 676.5203681218851, -1259.1392167224028,
350
+		      771.32342877765313, -176.61502916214059, 12.507343278686905,
351
+		      -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7};
352
+
353
+      std::complex<double> z_min_1 = z - 1.0;
354
+      std::complex<double> series = p[0];
355
+      for (int i = 1; i < g+2; ++i)
356
+	series += p[i]/(z_min_1 + std::complex<double>(i));
357
+
358
+      return(0.5 * logtwoPI + (z_min_1 + 0.5) * log(z_min_1 + std::complex<double>(g) + 0.5)
359
+	     - (z_min_1 + std::complex<double>(g) + 0.5) + log(series));
360
+    }
361
+
362
+    return(log(0.0));  // never called
363
+  }
364
+
365
+  /**********  Partition numbers **********/
366
+
367
+  inline long long int Partition_Function (int n)
368
+  {
369
+    // Returns the value of the partition function p(n), giving the number of partitions of n into integers.
370
+
371
+    if (n < 0) ABACUSerror("Calling Partition_Function for n < 0.");
372
+    else if (n == 0 || n == 1) return(1LL);
373
+    else if (n == 2) return(2LL);
374
+    else if (n == 3) return(3LL);
375
+
376
+    else {  // do recursion using pentagonal numbers
377
+      long long int pn = 0LL;
378
+      int pentnrplus, pentnrmin;  // pentagonal numbers
379
+      for (int i = 1; true; ++i) {
380
+	pentnrplus = (i * (3*i - 1))/2;
381
+	pentnrmin = (i * (3*i + 1))/2;
382
+	if (n - pentnrplus >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrplus);
383
+	if (n - pentnrmin >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrmin);
384
+	else break;
385
+      }
386
+      return(pn);
387
+    }
388
+    return(-1LL);  // never called
389
+  }
390
+
391
+
392
+  /**********  Sorting **********/
393
+
394
+  template <class T>
395
+    void QuickSort (T* V, int l, int r)
396
+    {
397
+      int i = l, j = r;
398
+      T pivot = V[l + (r-l)/2];
399
+
400
+      while (i <= j) {
401
+	while (V[i] < pivot) i++;
402
+	while (V[j] > pivot) j--;
403
+	if (i <= j) {
404
+	  std::swap(V[i],V[j]);
405
+	  i++;
406
+	  j--;
407
+	}
408
+      };
409
+
410
+      if (l < j) QuickSort(V, l, j);
411
+      if (i < r) QuickSort(V, i, r);
412
+    }
413
+
414
+  template <class T>
415
+    void QuickSort (T* V, int* index, int l, int r)
416
+    {
417
+      int i = l, j = r;
418
+      T pivot = V[l + (r-l)/2];
419
+
420
+      while (i <= j) {
421
+	while (V[i] < pivot) i++;
422
+	while (V[j] > pivot) j--;
423
+	if (i <= j) {
424
+	  std::swap(V[i],V[j]);
425
+	  std::swap(index[i],index[j]);
426
+	  i++;
427
+	  j--;
428
+	}
429
+      };
430
+
431
+      if (l < j) QuickSort(V, index, l, j);
432
+      if (i < r) QuickSort(V, index, i, r);
433
+    }
434
+
435
+
436
+} // namespace ABACUS
437
+
438
+#endif

include/JSC_Vect.h → include/ABACUS_Vect.h View File

@@ -2,20 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS++ library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_Vect.h
9
+File:  ABACUS_Vect.h
10 10
 
11 11
 Purpose:  Declares vector class.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#ifndef _JSC_VECT_
16
-#define _JSC_VECT_
15
+#ifndef ABACUS_VECT_H
16
+#define ABACUS_VECT_H
17 17
 
18
-namespace JSC {
18
+namespace ABACUS {
19 19
 
20 20
   template <class T>
21 21
     class Vect {
@@ -32,7 +32,7 @@ namespace JSC {
32 32
     Vect& operator= (const T& a);      // assign a to all elements
33 33
     inline T& operator[] (const int i);
34 34
     inline const T& operator[] (const int i) const;
35
-    Vect& operator+= (const Vect& rhs);  
35
+    Vect& operator+= (const Vect& rhs);
36 36
     Vect& operator-= (const Vect& rhs);
37 37
     bool operator== (const Vect& rhs);  // checks equality of size and of all elements
38 38
     bool operator!= (const Vect& rhs);  // checks inequality
@@ -52,31 +52,31 @@ namespace JSC {
52 52
     void QuickSort (Vect<int>& index);
53 53
     ~Vect();
54 54
   };
55
-  
55
+
56 56
   template <class T>
57 57
     Vect<T>::Vect() : dim(0), V(0) {}
58
-  
58
+
59 59
   template <class T>
60 60
     Vect<T>::Vect (int N) : dim(N), V(new T[N]) {}
61
-  
61
+
62 62
   template <class T>
63 63
     Vect<T>::Vect (const T& a, int N) : dim(N), V(new T[N])
64
-  {
65
-    for (int i = 0; i < N; ++i) V[i] = a;
66
-  }
67
-  
64
+    {
65
+      for (int i = 0; i < N; ++i) V[i] = a;
66
+    }
67
+
68 68
   template <class T>
69 69
     Vect<T>::Vect (const T* a, int N) : dim(N), V(new T[N])
70
-  {
71
-    for (int i = 0; i < N; ++i) V[i] = *a++;
72
-  }
73
-  
70
+    {
71
+      for (int i = 0; i < N; ++i) V[i] = *a++;
72
+    }
73
+
74 74
   template <class T>
75 75
     Vect<T>::Vect (const Vect<T>& rhs) : dim(rhs.dim), V(new T[dim])
76
-  {
77
-    for (int i = 0; i < dim; ++i) V[i] = rhs[i];
78
-  }
79
-  
76
+    {
77
+      for (int i = 0; i < dim; ++i) V[i] = rhs[i];
78
+    }
79
+
80 80
   template <class T>
81 81
     Vect<T>& Vect<T>::operator= (const Vect<T>& rhs)
82 82
     {
@@ -90,7 +90,7 @@ namespace JSC {
90 90
       }
91 91
       return *this;
92 92
     }
93
-  
93
+
94 94
   template <class T>
95 95
     Vect<T>& Vect<T>::operator= (const T& a)
96 96
     {
@@ -100,15 +100,15 @@ namespace JSC {
100 100
 
101 101
   template <class T>
102 102
     inline T& Vect<T>::operator[] (const int i)
103
-  {
104
-    return V[i];
105
-  }
106
-  
103
+    {
104
+      return V[i];
105
+    }
106
+
107 107
   template <class T>
108 108
     inline const T& Vect<T>::operator[] (const int i) const
109
-  {
110
-    return V[i];
111
-  }
109
+    {
110
+      return V[i];
111
+    }
112 112
 
113 113
   template <class T>
114 114
     Vect<T>& Vect<T>::operator+= (const Vect<T>& rhs)
@@ -116,7 +116,7 @@ namespace JSC {
116 116
       for (int i = 0; i < dim; ++i) V[i] += rhs[i];
117 117
       return *this;
118 118
     }
119
-  
119
+
120 120
   template <class T>
121 121
     Vect<T>& Vect<T>::operator-= (const Vect<T>& rhs)
122 122
     {
@@ -138,7 +138,7 @@ namespace JSC {
138 138
     bool Vect<T>::operator!= (const Vect<T>& rhs)
139 139
     {
140 140
       return(!((*this) == rhs));
141
-    } 
141
+    }
142 142
 
143 143
   template <class T>
144 144
     bool Vect<T>::Append (const Vect<T>& rhs)  // appends rhs to the vector
@@ -180,7 +180,7 @@ namespace JSC {
180 180
       int resized_dim = dim + nr_to_add;
181 181
 
182 182
       T* resized_vect = new T[resized_dim];
183
-      for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];      
183
+      for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];
184 184
       for (int i = dim; i < resized_dim; ++i) resized_vect[i] = T(0);
185 185
 
186 186
       dim = resized_dim;
@@ -199,7 +199,7 @@ namespace JSC {
199 199
       int resized_dim = dim + nr_to_add;
200 200
 
201 201
       T* resized_vect = new T[resized_dim];
202
-      for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];      
202
+      for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];
203 203
       for (int i = dim; i < resized_dim; ++i) resized_vect[i] = setval;
204 204
 
205 205
       dim = resized_dim;
@@ -215,12 +215,12 @@ namespace JSC {
215 215
 
216 216
   template <class T>
217 217
     inline int Vect<T>::size() const
218
-  {
219
-    return dim;
220
-  }
218
+    {
219
+      return dim;
220
+    }
221 221
 
222 222
   template <class T>
223
-  inline double Vect<T>::norm () const
223
+    inline double Vect<T>::norm () const
224 224
     {
225 225
       double normsq = 0.0;
226 226
       for (int i = 0; i < dim; ++i) normsq += abs(V[i]) * abs(V[i]);
@@ -228,7 +228,7 @@ namespace JSC {
228 228
     }
229 229
 
230 230
   template <>
231
-  inline double Vect<double>::norm () const
231
+    inline double Vect<double>::norm () const
232 232
     {
233 233
       double normsq = 0.0;
234 234
       for (int i = 0; i < dim; ++i) normsq += V[i] * V[i];
@@ -236,7 +236,7 @@ namespace JSC {
236 236
     }
237 237
 
238 238
   template <>
239
-  inline double Vect<complex<double> >::norm () const
239
+    inline double Vect<std::complex<double> >::norm () const
240 240
     {
241 241
       double normsq = 0.0;
242 242
       for (int i = 0; i < dim; ++i) normsq += std::norm(V[i]);
@@ -262,7 +262,7 @@ namespace JSC {
262 262
   template <class T>
263 263
     inline T Vect<T>::sum() const
264 264
     {
265
-      T total = T(0);  
265
+      T total = T(0);
266 266
       for (int i = 0; i < dim; ++i) total += V[i];
267 267
       return total;
268 268
     }
@@ -275,69 +275,13 @@ namespace JSC {
275 275
 
276 276
       return(index < dim);
277 277
     }
278
-  /*  
279
-  template <class T>
280
-    void Vect<T>::QuickSort (int l, int r)
281
-    {
282
-      //cout << "QuickSort called for l = " << l << "\t r = " << r << endl;
283
-      //cout << (*this) << endl;
284
-      //for (int ih = l; ih <= r; ++ih) cout << setprecision(16) << "ih = " << ih << "\tV[ih] = " << V[ih] << endl;
285
-
286
-      static T m;
287
-      static int j;
288
-      int i;
289
-
290
-      if (r > l) {
291
-	m = V[r]; i = l-1; j = r;
292
-
293
-	for (;;) {
294
-	  while (V[++i] < m);
295
-	  while (V[--j] > m);
296
-	  if (i >= j) break;
297
-	  std::swap(V[i], V[j]);
298
-	}
299
-	std::swap(V[i], V[r]);
300
-
301
-	(*this).QuickSort(l, i-1);
302
-	(*this).QuickSort(i+1, r);
303
-      }
304
-    }
305
-  */
306
-  /*
307
-  template <class T>
308
-    void Vect<T>::QuickSort (int l, int r)
309
-    {
310
-      // My own version of QuickSort: add sentinels on left and right
311
-      if (r > l) {
312
-	int s = l + (r-l)/2; // central element index
313
-	// Rearrange so that V[l] <= V[s] <= V[r] (sentinels on left and right)
314
-	if (V[l] > V[r]) std::swap(V[l],V[r]);
315
-	if (V[s] > V[r]) std::swap(V[s],V[r]);
316
-	if (V[l] > V[s]) std::swap(V[l],V[s]);
317
-	m = V[s]; i = l-1; j = r;
318
-	//m = V[r]; i = l-1; j = r;
319
-
320
-	for (;;) {
321
-	  while (V[i] < m) i++;
322
-	  while (V[j] > m) j--;
323
-	  if (i >= j) break;
324
-	  std::swap(V[i], V[j]); // restart from indices i and j just used, in case one is pivot
325
-	}
326
-	//std::swap(V[i], V[r]);
327
-
328
-	(*this).QuickSort(l, i-1);
329
-	(*this).QuickSort(i+1, r);
330
-      }
331
-
332
-    }
333
-  */
334 278
 
335 279
   template <class T>
336 280
     void Vect<T>::QuickSort (int l, int r)
337 281
     {
338 282
       int i = l, j = r;
339 283
       T pivot = V[l + (r-l)/2];
340
-      
284
+
341 285
       while (i <= j) {
342 286
 	while (V[i] < pivot) i++;
343 287
 	while (V[j] > pivot) j--;
@@ -347,7 +291,7 @@ namespace JSC {
347 291
 	  j--;
348 292
 	}
349 293
       };
350
-      
294
+
351 295
       if (l < j) (*this).QuickSort(l, j);
352 296
       if (i < r) (*this).QuickSort(i, r);
353 297
     }
@@ -358,71 +302,12 @@ namespace JSC {
358 302
       if ((*this).size() > 1) (*this).QuickSort (0, (*this).size() - 1);
359 303
     }
360 304
 
361
-  /*
362
-  template <class T>
363
-    void Vect<T>::QuickSort (Vect<int>& index, int l, int r)
364
-    {
365
-      if (index.size() != (*this).size()) {
366
-	cout << (*this).size() << "\t" << index.size() << endl;
367
-	JSCerror("Wrong dim for index in Vect QuickSort.");
368
-      }
369
-
370
-      static T m;
371
-      static int j;
372
-      int i;
373
-
374
-      if (r > l) {
375
-	m = V[r]; i = l-1; j = r;
376
-
377
-	for (;;) {
378
-	  while (V[++i] < m);
379
-	  while (V[--j] > m);
380
-	  if (i >= j) break;
381
-	  std::swap(V[i], V[j]);
382
-	  std::swap(index[i], index[j]);
383
-	}
384
-	std::swap(V[i], V[r]);
385
-	std::swap(index[i], index[r]);
386
-
387
-	(*this).QuickSort(index, l, i-1);
388
-	(*this).QuickSort(index, i+1, r);
389
-      }
390
-    }
391
-  */
392
-  /*
393
-  template <class T>
394
-    void Vect<T>::QuickSort (Vect<int>& index, int l, int r)
395
-    {
396
-      // My own version of QuickSort:
397
-      if (r > l) {
398
-	int s = l + (r-l)/2; // central element index
399
-	// Rearrange so that V[l] <= V[s] <= V[r] (sentinels on left and right)
400
-	if (V[l] > V[r]) std::swap(V[l],V[r]);
401
-	if (V[s] > V[r]) std::swap(V[s],V[r]);
402
-	if (V[l] > V[s]) std::swap(V[l],V[s]);
403
-	m = V[s]; i = l-1; j = r+1;
404
-
405
-	for (;;) {
406
-	  while (V[++i] < m);
407
-	  while (V[--j] > m);
408
-	  if (i >= j) break;
409
-	  std::swap(index[i], index[j]);
410
-	  std::swap(V[i--], V[j++]); // restart from indices i and j just used, in case one is pivot
411
-	}
412
-
413
-	(*this).QuickSort(index, l, i-1);
414
-	(*this).QuickSort(index, i+1, r);
415
-      }
416
-
417
-    }
418
-  */
419
-
420 305
   template <class T>
421 306
     void Vect<T>::QuickSort (Vect<int>& index, int l, int r)
422 307
     {
423 308
       int i = l, j = r;
424 309
       T pivot = V[l + (r-l)/2];
425
-      
310
+
426 311
       while (i <= j) {
427 312
 	while (V[i] < pivot) i++;
428 313
 	while (V[j] > pivot) j--;
@@ -433,7 +318,7 @@ namespace JSC {
433 318
 	  j--;
434 319
 	}
435 320
       };
436
-      
321
+
437 322
       if (l < j) (*this).QuickSort(index, l, j);
438 323
       if (i < r) (*this).QuickSort(index, i, r);
439 324
     }
@@ -441,32 +326,32 @@ namespace JSC {
441 326
   template <class T>
442 327
     void Vect<T>::QuickSort (Vect<int>& index)
443 328
     {
444
-      if (index.size() != (*this).size()) JSCerror("Wrong dim for index in Vect QuickSort.");
329
+      if (index.size() != (*this).size()) ABACUSerror("Wrong dim for index in Vect QuickSort.");
445 330
       (*this).QuickSort (index, 0, (*this).size() - 1);
446 331
     }
447 332
 
448 333
   template <class T>
449
-  inline std::ostream& operator<< (std::ostream& s, const Vect<T>& vector)
450
-  {
451
-    for (int i = 0; i < vector.size() - 1; ++i) s << vector[i] << " ";
452
-    if (vector.size() >= 1) s << vector[vector.size() - 1];
334
+    inline std::ostream& operator<< (std::ostream& s, const Vect<T>& vector)
335
+    {
336
+      for (int i = 0; i < vector.size() - 1; ++i) s << vector[i] << " ";
337
+      if (vector.size() >= 1) s << vector[vector.size() - 1];
453 338
 
454
-    return (s);
455
-  }
339
+      return (s);
340
+    }
456 341
 
457 342
   template <class T>
458 343
     Vect<T>::~Vect<T>()
459
-  {
460
-    if (V != 0) delete[] V;
461
-  }
344
+    {
345
+      if (V != 0) delete[] V;
346
+    }
347
+
462 348
 
349
+  // TYPEDEFS
350
+  typedef ABACUS::Vect<int> Vect_INT;
351
+  typedef ABACUS::Vect<double> Vect_DP;
352
+  typedef ABACUS::Vect<std::complex<double> > Vect_CX;
463 353
 
464
-  // TYPEDEFS  
465
-  typedef JSC::Vect<int> Vect_INT;
466
-  typedef JSC::Vect<double> Vect_DP;
467
-  typedef JSC::Vect<complex<double> > Vect_CX;
468 354
 
469
-  
470
-} // namespace JSC
355
+} // namespace ABACUS
471 356
 
472 357
 #endif

include/JSC_XXX_h0.h → include/ABACUS_XXX_VOA.h View File

@@ -2,56 +2,58 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_XXX_h0.h
10
-
11
-Purpose:  Declares classes for XXX in zero field:  Uq(sl(2)) stuff.
9
+File:  ABACUS_XXX_VOA.h
12 10
 
11
+Purpose:  Declares classes for XXX in zero field: Vertex Operator Approach
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#ifndef _XXX_h0_
17
-#define _XXX_h0_
15
+#ifndef ABACUS_XXX_VOA_H
16
+#define ABACUS_XXX_VOA_H
18 17
 
19
-#include "JSC.h"
18
+#include "ABACUS.h"
20 19
 
21 20
 const DP default_req_prec = 1.0e-14;
22 21
 const int default_max_rec = 10;
23 22
 
24
-namespace JSC {
23
+namespace ABACUS {
25 24
 
26 25
   inline DP Integrand_11 (Vect_DP args)
27
-    {
28
-      // args[0] corresponds to t, args[1] to rho
29
-      return((exp(args[0]) * sinh(args[0]) * cos(4.0 * args[0] * args[1])/(2.0 * pow(cosh(args[0]), 2.0)) + 2.0 * pow(sin(2.0 * args[0] * args[1]), 2.0))/args[0]);
30
-    }
31
-  
26
+  {
27
+    // args[0] corresponds to t, args[1] to rho
28
+    return((exp(args[0]) * sinh(args[0]) * cos(4.0 * args[0] * args[1])
29
+	    /(2.0 * pow(cosh(args[0]), 2.0)) + 2.0 * pow(sin(2.0 * args[0] * args[1]), 2.0))/args[0]);
30
+  }
31
+
32 32
   inline DP Integrand_12 (Vect_DP args)
33
-    {
34
-      DP expm2t = exp(-2.0*args[0]);
35
-      return(cos(4.0 * args[0] * args[1]) * expm2t * (3.0 + expm2t)/ (args[0] * (1.0 + expm2t) * (1.0 + expm2t)));
36
-    }
37
-  
33
+  {
34
+    DP expm2t = exp(-2.0*args[0]);
35
+    return(cos(4.0 * args[0] * args[1]) * expm2t * (3.0 + expm2t)/ (args[0] * (1.0 + expm2t) * (1.0 + expm2t)));
36
+  }
37
+
38 38
   inline DP Integrand_2 (Vect_DP args)
39
-    {
40
-      DP answer = 0.0;
41
-      if (args[0] < 1.0) answer = exp(args[0]) * pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * sinh(args[0]) * pow(cosh(args[0]), 2.0));
42
-      else if (args[0] >= 1.0) {
43
-	DP expm2t = exp(-2.0 * args[0]);
44
-	answer = 8.0 * expm2t * pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * (1.0 - expm2t) * (1.0 + expm2t) * (1.0 + expm2t));
45
-      }
46
-      return(answer);
39
+  {
40
+    DP answer = 0.0;
41
+    if (args[0] < 1.0) answer = exp(args[0]) * pow(sin(2.0 * args[0] * args[1]), 2.0)
42
+			 /(args[0] * sinh(args[0]) * pow(cosh(args[0]), 2.0));
43
+    else if (args[0] >= 1.0) {
44
+      DP expm2t = exp(-2.0 * args[0]);
45
+      answer = 8.0 * expm2t * pow(sin(2.0 * args[0] * args[1]), 2.0)
46
+	/(args[0] * (1.0 - expm2t) * (1.0 + expm2t) * (1.0 + expm2t));
47 47
     }
48
-  
48
+    return(answer);
49
+  }
50
+
49 51
   inline DP Integrand_A (Vect_DP args)
50
-    {
51
-      // This kernel is for -ln | A_-(i\pi/2) | function
52
-      return(exp(args[0]) * pow(sinh(args[0]/2.0), 2.0)/(args[0] * sinh(2.0*args[0]) * cosh(args[0])));
53
-    }
54
-  
52
+  {
53
+    // This kernel is for -ln | A_-(i\pi/2) | function
54
+    return(exp(args[0]) * pow(sinh(args[0]/2.0), 2.0)/(args[0] * sinh(2.0*args[0]) * cosh(args[0])));
55
+  }
56
+
55 57
   DP I_integral (DP rho, DP req_prec);
56 58
 
57 59
 
@@ -73,32 +75,32 @@ namespace JSC {
73 75
   DP SF_2p_check_fixed_k_sumrule_opt (DP k, DP req_prec, int Npts, I_table Itable);
74 76
 
75 77
 
76
-/********************** FOUR SPINONS **********************/
78
+  /********************** FOUR SPINONS **********************/
77 79
 
78 80
   DP Sum_norm_gl (Vect_DP rho, DP req_prec);
79 81
   DP Compute_C4 (DP req_prec);
80 82
   DP SF_contrib (Vect_DP p, DP req_prec, I_table Itable);
81 83
   DP J_fn (Vect_DP p, DP req_prec, I_table Itable);
82 84
   inline DP Jacobian_p3p4_KW (DP k, DP w, DP K, DP W)
83
-    {
84
-      return(1.0/sqrt(pow(twoPI * sin(0.5 * (k - K)), 2.0) - (w-W)*(w-W)));
85
-    }
85
+  {
86
+    return(1.0/sqrt(pow(twoPI * sin(0.5 * (k - K)), 2.0) - (w-W)*(w-W)));
87
+  }
86 88
   bool Set_p_given_kwKW (DP k, DP w, DP K, DP W, Vect_DP& p);
87 89
   inline DP wmin_4p (DP k)
88 90
   {
89 91
     return(PI * fabs(sin(k)));
90
-  }  
92
+  }
91 93
   inline DP wmax_4p (DP k)
92 94
   {
93 95
     return(2.0 * PI * sqrt(2.0 * (1.0 + fabs(cos(0.5*k)))));
94 96
   }
95 97
   inline  DP Wmin (DP k, DP w, DP K)
96 98
   {
97
-    return(JSC::max(1.0e-15, JSC::max(fabs(PI * sin(K)), w - twoPI * sin(0.5 * (fabs(k-K))))));
99
+    return(ABACUS::max(1.0e-15, ABACUS::max(fabs(PI * sin(K)), w - twoPI * sin(0.5 * (fabs(k-K))))));
98 100
   }
99 101
   inline  DP Wmax (DP k, DP w, DP K)
100 102
   {
101
-    return(JSC::min(twoPI * sin(0.5 * K), w - fabs(PI * sin(k - K))));
103
+    return(ABACUS::min(twoPI * sin(0.5 * K), w - fabs(PI * sin(k - K))));
102 104
   }
103 105
   DP G_fn (Vect_DP args_to_G, I_table Itable);
104 106
   DP G1_fn (Vect_DP args_to_G, I_table Itable);
@@ -134,6 +136,6 @@ namespace JSC {
134 136
   DP Direct_J_integral_bin (int Npts_p, int Npts_o, DP req_prec, I_table Itable);
135 137
   void Smoothen_raw_SF_4p (int Npts_p, int Npts_o, DP req_prec, DP width);
136 138
 
137
-} // namespace JSC
139
+} // namespace ABACUS
138 140
 
139 141
 #endif

+ 47
- 0
include/ABACUS_XXZ_VOA.h View File

@@ -0,0 +1,47 @@
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  ABACUS_XXZ_VOA.h
10
+
11
+Purpose:  Declares classes for XXZ in zero field:  Vertex Operator Approach
12
+
13
+***********************************************************/
14
+
15
+#ifndef ABACUS_XXZ_VOA_H
16
+#define ABACUS_XXZ_VOA_H
17
+
18
+#include "ABACUS.h"
19
+
20
+
21
+namespace ABACUS {
22
+
23
+  DP I_xi_integral (DP xi, DP rho, DP req_prec, int max_nr_pts);
24
+
25
+  /*********************  TWO SPINONS ********************/
26
+  DP Szz_XXZ_h0_2spinons (DP k, DP omega, Integral_table Itable);
27
+  DP Szz_XXZ_h0_2spinons (Vect_DP args, Integral_table Itable);
28
+  DP Szz_XXZ_h0_2spinons_alt (Vect_DP args, Integral_table Itable);
29
+  DP Szz_XXZ_h0_2spinons_omega (Vect_DP args, Integral_table Itable);
30
+  DP Szz_XXZ_h0_2spinons_omega_alt (Vect_DP args, Integral_table Itable);
31
+  DP Szz_XXZ_h0_2spinons_intomega (Vect_DP args, Integral_table Itable);
32
+  DP Szz_XXZ_h0_2spinons_intomega_alt (Vect_DP args, Integral_table Itable);
33
+  DP Szz_XXZ_h0_2spinons_check_sumrule (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
34
+  DP Szz_XXZ_h0_2spinons_check_sumrule_alt (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
35
+  DP Fixed_k_sumrule_omega_Szz_XXZ_h0_N (DP Delta, DP k);
36
+  DP GSE_XXZ_h0 (DP Delta, DP req_prec, int max_nr_pts);
37
+  DP Fixed_k_sumrule_omega_Szz_XXZ_h0 (DP Delta, DP k, DP req_prec, int max_nr_pts);
38
+  DP Szz_XXZ_h0_2spinons_check_fixed_k_Szz_sumrule (DP Delta, DP k, DP req_prec, int max_nr_pts, Integral_table Itable);
39
+  DP Szz_XXZ_h0_2spinons_check_fixed_k_Szz_sumrule_alt (DP Delta, DP k, DP req_prec, int max_nr_pts, Integral_table Itable);
40
+
41
+  //******************************** Functions to produce files similar to ABACUS **********************************
42
+  void Produce_Szz_XXZ_h0_2spinons_file (DP Delta, int N, int Nomega, DP omegamax, Integral_table Itable);
43
+  void Produce_Szz_XXZ_h0_2spinons_fixed_K_file (DP Delta, DP Kover2PI, int Nomega, Integral_table Itable);
44
+
45
+} // namespace ABACUS
46
+
47
+#endif

include/JSC_Young.h → include/ABACUS_Young.h View File

@@ -2,22 +2,22 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  JSC_Young.h
9
+File:  ABACUS_Young.h
10 10
 
11 11
 Purpose:  Declares Young tableau class.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#ifndef _YOUNG_
16
-#define _YOUNG_
15
+#ifndef ABACUS_YOUNG_H
16
+#define ABACUS_YOUNG_H
17 17
 
18
-#include "JSC_Vect.h"
18
+#include "ABACUS_Vect.h"
19 19
 
20
-namespace JSC {
20
+namespace ABACUS {
21 21
 
22 22
   const int YOUNG_TABLEAU_ID_OPTION = 0;
23 23
   const long long int TABLEAU_ID_UPPER_LIMIT = 10000000LL;
@@ -32,7 +32,7 @@ namespace JSC {
32 32
     int* Row_L;
33 33
     int* Col_L;
34 34
     long long int id;     // identification number
35
-    long long int maxid;  
35
+    long long int maxid;
36 36
     long long int* map;
37 37
     bool map_computed;
38 38
     long long int idnr_reached;
@@ -59,11 +59,11 @@ namespace JSC {
59 59
     Young_Tableau& Set_Row_L (Vect<int>& Row_Lengths);  // set row lengths
60 60
     Young_Tableau& Set_Col_L_given_Row_L ();   // sets the Col_L array self-consistently
61 61
     Young_Tableau& Set_Row_L_given_Col_L ();   // sets the Col_L array self-consistently
62
-    long long int Compute_Descendent_id (int option, Vect<int>& Desc_Row_L, int Nrows_Desc, int Ncols_Desc, 
62
+    long long int Compute_Descendent_id (int option, Vect<int>& Desc_Row_L, int Nrows_Desc, int Ncols_Desc,
63 63
 					 const Young_Tableau& RefTableau);
64 64
     Young_Tableau& Compute_id();       // computes the id number of tableau
65 65
     Young_Tableau& Compute_id(int option);       // computes the id number of tableau according to rule option
66
-    Young_Tableau& Print();            // couts the tableau 
66
+    Young_Tableau& Print();            // couts the tableau
67 67
 
68 68
     bool Lower_Row (int i);
69 69
     bool Raise_Row (int i);
@@ -104,15 +104,15 @@ namespace JSC {
104 104
     Vect<long long int> map;
105 105
     long long int idnr_reached;
106 106
     int nboxes_reached;
107
-    
107
+
108 108
   public:
109 109
     Tableau_Map (int Nrows, int Ncols);
110 110
     void Distribute_id (int nboxes_to_dist, int level, Young_Tableau& RefTableau);
111
-    
111
+
112 112
   };
113 113
 
114 114
 
115 115
 
116
-} // namespace JSC
116
+} // namespace ABACUS
117 117
 
118 118
 #endif

+ 0
- 777
include/JSC_Heis.h View File

@@ -1,777 +0,0 @@
1
-/**********************************************************
2
-
3
-This software is part of J.-S. Caux's ABACUS++ library.
4
-
5
-Copyright (c) 
6
-
7
------------------------------------------------------------
8
-
9
-File:  Heis.h
10
-
11
-Purpose:  Declares Heisenberg chain classes and functions.
12
-
13
-
14
-
15
-***********************************************************/
16
-
17
-#ifndef _HEIS_
18
-#define _HEIS_
19
-
20
-#include "JSC.h"
21
-
22
-namespace JSC {
23
-
24
-  // First, some global constants...
25
-
26
-  const long long int ID_UPPER_LIMIT = 10000000LL;  // max size of vectors we can define without seg fault
27
-  const int INTERVALS_SIZE = 100000;                // size of Scan_Intervals arrays
28
-  const int NBASESMAX = 1000; // max number of bases kept 
29
-
30
-  const DP ITER_REQ_PREC = 100.0 * MACHINE_EPS_SQ;
31
-  //const DP ITER_REQ_PREC = MACHINE_EPS_SQ;
32
-
33
-  // Cutoffs on particle numbers
34
-  //const int NPARTICLES_MAX = 24;
35
-  //const int NHOLES_MAX = NPARTICLES_MAX/2;
36
-  //const int MAX_RAPS_ABOVE_ZERO = 10;  // max nr of rapidities above lowest type
37
-  //const int NPARTICLES_MAX = 2;
38
-  //const int NHOLES_MAX = 1;
39
-  //const int MAX_TYPES_IN_BASE = 4;      // maximal number of particle types we allow in bases
40
-  const int MAXSTRINGS = 20;      // maximal number of particle types we allow in bases
41
-  //const int MAXSTRINGS = 2;      // maximal number of particle types we allow in bases
42
-  //const DP HEIS_deltaprec = 1.0e-6;//1.0e-4;  // maximal string deviation allowed // DEPRECATED in ++T_9
43
-
44
-  const int NEXC_MAX_HEIS = 16; // maximal number of excitations (string binding/unbinding, particle-hole) considered
45
-
46
-  //***********************************************************************
47
-
48
-  class Heis_Chain {
49
-
50
-  public:
51
-    DP J;
52
-    DP Delta;
53
-    DP anis;  // acos(Delta) if Delta < 1.0, 0 if Delta == 1.0, acosh(Delta) if Delta > 1.0
54
-    DP hz;  
55
-    int Nsites;
56
-    int Nstrings;  // how many possible strings.  The following two arrays have Nstrings nonzero elements. 
57
-    int* Str_L; // vector (length M) containing the allowed string lengths.  Elements that are 0 have no meaning.
58
-    int* par;    // vector (length M) containing the parities of the strings.  Elements that are 0 have no meaning.
59
-                  // Parities are all +1 except for gapless XXZ subcases
60
-    DP* si_n_anis_over_2;  // for optimization: sin for XXZ, sinh for XXZ_gpd
61
-    DP* co_n_anis_over_2;  // for optimization
62
-    DP* ta_n_anis_over_2;  // for optimization
63
-    DP prec;  // precision required for computations, always put to ITER_REQ_PREC
64
-
65
-  public:
66
-    Heis_Chain (); 
67
-    Heis_Chain (DP JJ, DP DD, DP hh, int NN);  // contructor:  simply initializes
68
-    Heis_Chain (const Heis_Chain& RefChain);            // copy constructor;
69
-    Heis_Chain& operator= (const Heis_Chain& RefChain); 
70
-    bool operator== (const Heis_Chain& RefChain);
71
-    bool operator!= (const Heis_Chain& RefChain);
72
-    ~Heis_Chain();  // destructor
73
-
74
-  public:
75
-    //void Scan_for_Possible_Bases (int Mdown, Vect<long long int>& possible_base_id, int& nfound, int nexc_max_used, 
76
-    //				  int base_level_to_scan, Vect<int>& Nrapidities);
77
-    //Vect<long long int> Possible_Bases (int Mdown);  // returns a vector of possible bases
78
-    /* Deactivated in ++G_8
79
-    void Scan_for_Possible_Bases (int Mdown, Vect<string>& possible_base_label, int& nfound, int nexc_max_used, 
80
-    				  int base_level_to_scan, Vect<int>& Nrapidities);
81
-    Vect<string> Possible_Bases (int Mdown);  // returns a vector of possible bases
82
-    */
83
-  };
84
-
85
-  //****************************************************************************
86
-
87
-  // Objects in class Heis_Base are a checked vector containing the number of rapidities of allowable types for a given state
88
-
89
-  class Heis_Base {
90
-
91
-  public:
92
-    int Mdown;         // total number of down spins
93
-    Vect<int> Nrap;    // Nrap[i] contains the number of rapidities of type i, i = 0, Nstrings - 1.
94
-    int Nraptot;       // total number of strings in this state
95
-    Vect<DP> Ix2_infty;  // Ix2_infty[i] contains the max of BAE function for the (half-)integer I[i], i = 0, Nstrings - 1.
96
-    Vect<int> Ix2_min;
97
-    Vect<int> Ix2_max;    // Ix2_max[i] contains the integer part of 2*I_infty, with correct parity for base.
98
-    //long long int id;  // identification number
99
-    double dimH;          // dimension of sub Hilbert space associated to this base; use double to avoid max int problems.
100
-    string baselabel;      // base label
101
-
102
-  public:
103
-    Heis_Base ();
104
-    Heis_Base (const Heis_Base& RefBase);  // copy constructor
105
-    Heis_Base (const Heis_Chain& RefChain, int M);  // constructs configuration with all Mdown in one-string of +1 parity
106
-    Heis_Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities);  // sets to Nrapidities vector, and checks consistency
107
-    //Heis_Base (const Heis_Chain& RefChain, long long int id_ref);
108
-    Heis_Base (const Heis_Chain& RefChain, string baselabel_ref);
109
-    inline int& operator[] (const int i);
110
-    inline const int& operator[] (const int i) const; 
111
-    Heis_Base& operator= (const Heis_Base& RefBase);
112
-    bool operator== (const Heis_Base& RefBase);
113
-    bool operator!= (const Heis_Base& RefBase);
114
-
115
-    void Compute_Ix2_limits(const Heis_Chain& RefChain);  // computes the Ix2_infty and Ix2_max 
116
-
117
-    //void Scan_for_Possible_Types (Vect<long long int>& possible_type_id, int& nfound, int base_level, Vect<int>& Nexcitations);
118
-    //Vect<long long int> Possible_Types ();  // returns a vector of possible types
119
-
120
-  };
121
-
122
-  inline int& Heis_Base::operator[] (const int i)
123
-  {
124
-    return Nrap[i];
125
-  }
126
-  
127
-  inline const int& Heis_Base::operator[] (const int i) const
128
-  {
129
-    return Nrap[i];
130
-  }
131
-
132
-  //****************************************************************************
133
-  /*
134
-  // Objects in class Ix2_Config carry all the I's of a given state
135
-
136
-  class Ix2_Config {
137
-
138
-    //private:
139
-  public:
140
-    int Nstrings;
141
-    Vect<int> Nrap;
142
-    int Nraptot;
143
-
144
-    //int** Ix2;
145
-    Vect<Vect<int> > Ix2;
146
-
147
-  public:
148
-    Ix2_Config ();
149
-    Ix2_Config (const Heis_Chain& RefChain, int M);   // constructor, puts I's to ground state
150
-    Ix2_Config (const Heis_Chain& RefChain, const Heis_Base& base);   // constructor, putting I's to lowest-energy config 
151
-                                                               // consistent with Heis_Base configuration for chain RefChain
152
-    Ix2_Config& operator= (const Ix2_Config& RefConfig);
153
-    //inline int* operator[] (const int i);
154
-    inline Vect<int> operator[] (const int i); 
155
-    //inline const int* operator[] (const int i) const;
156
-    inline const Vect<int> operator[] (const int i) const; 
157
-    //~Ix2_Config(); // not needed, inherited from Vect
158
-    string Return_Label (const Ix2_Config& OriginIx2);
159
-  };
160
-
161
-  //inline int* Ix2_Config::operator[] (const int i)
162
-  inline Vect<int> Ix2_Config::operator[] (const int i)
163
-    {
164
-      return Ix2[i];
165
-    }
166
-  
167
-  //inline const int* Ix2_Config::operator[] (const int i) const
168
-  inline const Vect<int> Ix2_Config::operator[] (const int i) const
169
-  {
170
-    return Ix2[i];
171
-  }
172
-
173
-  std::ostream& operator<< (std::ostream& s, const Ix2_Config& RefConfig);
174
-  */
175
-  //****************************************************************************
176
-
177
-  // Objects in class Lambda carry all rapidities of a state
178
-
179
-  class Lambda {
180
-    
181
-  private:
182
-    int Nstrings;
183
-    Vect<int> Nrap;
184
-    int Nraptot;
185
-    DP** lambda;
186
-    //Vect<Vect<DP> > lambda;
187
-    
188
-  public:
189
-    Lambda ();
190
-    Lambda (const Heis_Chain& RefChain, int M);   // constructor, puts all lambda's to zero
191
-    Lambda (const Heis_Chain& RefChain, const Heis_Base& base);   // constructor, putting I's to lowest-energy config 
192
-    // consistent with Heis_Base configuration for chain RefChain
193
-    Lambda& operator= (const Lambda& RefConfig);
194
-    inline DP* operator[] (const int i);
195
-    //inline Vect<DP> operator[] (const int i);
196
-    inline const DP* operator[] (const int i) const;
197
-    //inline const Vect<DP> operator[] (const int i) const;
198
-    ~Lambda();
199
-
200
-  };
201
-
202
-  inline DP* Lambda::operator[] (const int i)
203
-  //inline Vect<DP> Lambda::operator[] (const int i)
204
-    {
205
-      return lambda[i];
206
-    }
207
-  
208
-  inline const DP* Lambda::operator[] (const int i) const
209
-  //inline const Vect<DP> Lambda::operator[] (const int i) const
210
-    {
211
-      return lambda[i];
212
-    }
213
-
214
-
215
-  //****************************************************************************
216
-
217
-  // Objects in class Ix2_Offsets carry Young tableau representations of the Ix2 configurations
218
-  /*
219
-  class Ix2_Offsets {
220
-
221
-  public:
222
-    Heis_Base base;
223
-    Vect<Young_Tableau> Tableau;  // vector of pointers to tableaux at each level
224
-    long long int type_id;
225
-    long long int id;        // id number of offset
226
-    long long int maxid;     // max id number allowable
227
-
228
-  public:
229
-    Ix2_Offsets ();
230
-    Ix2_Offsets (const Ix2_Offsets& RefOffset);  // copy constructor
231
-    Ix2_Offsets (const Heis_Base& RefBase, long long int req_type_id);
232
-    Ix2_Offsets (const Heis_Base& RefBase, Vect<int> nparticles);  // sets all tableaux to empty ones, with nparticles[] at each level
233
-    Ix2_Offsets& operator= (const Ix2_Offsets& RefOffset);
234
-    bool operator<= (const Ix2_Offsets& RefOffsets);
235
-    bool operator>= (const Ix2_Offsets& RefOffsets);
236
-
237
-  public:
238
-    void Set_to_id (long long int idnr);  
239
-    void Compute_id ();
240
-    void Compute_type_id ();
241
-
242
-  public:
243
-    bool Add_Boxes_From_Lowest (int Nboxes, bool odd_sectors); // adds Nboxes in minimal energy config, all boxes in either even or odd sectors
244
-
245
-  };
246
-
247
-  inline long long int Ix2_Offsets_type_id (Vect<int>& nparticles)
248
-    {
249
-      long long int type_id_here = 0ULL;
250
-
251
-      for (int i = 0; i < nparticles.size(); ++i)
252
-	type_id_here += nparticles[i] * pow_ulli(10ULL, i);
253
-
254
-      return(type_id_here);
255
-    }
256
-
257
-  long long int Find_idmin (Ix2_Offsets& scan_offsets, int particle_type, int tableau_level, int Row_L_min);
258
-  long long int Find_idmax (Ix2_Offsets& scan_offsets, int particle_type, int tableau_level);
259
-  */
260
-  //****************************************************************************
261
-  // Objects in class Ix2_Offsets_List carry a vector of used Ix2_Offsets
262
-  /*
263
-  class Ix2_Offsets_List {
264
-
265
-  public:
266
-    int ndef;
267
-    Vect<Ix2_Offsets> Offsets;
268
-
269
-  public:
270
-    Ix2_Offsets_List ();
271
-    Ix2_Offsets& Return_Offsets (Heis_Base& RefBase, Vect<int> nparticles);  // returns the Ix2_Offsets corresponding to nparticles[]/base
272
-    Ix2_Offsets& Return_Offsets (Heis_Base& RefBase, long long int req_type_id);
273
-  };
274
-  */
275
-  //****************************************************************************
276
-
277
-  // Objects in class Heis_Bethe_State carry all information about an eigenstate
278
-
279
-  // Derived classes include XXZ_Bethe_State, XXX_Bethe_State, XXZ_gpd_Bethe_State
280
-  // These contain subclass-specific functions and data.
281
-
282
-  class Heis_Bethe_State {
283
-    
284
-  public:
285
-    Heis_Chain chain;
286
-    Heis_Base base;
287
-    //Ix2_Offsets offsets;
288
-    //Ix2_Config Ix2;
289
-    Vect<Vect<int> > Ix2;
290
-    Lambda lambda;
291
-    Lambda deviation;      // string deviations
292
-    Lambda BE;             // Bethe equation for relevant rapidity, in the form BE = theta - (1/N)\sum ... - \pi I/N = 0
293
-    DP diffsq;             // sum of squares of rapidity differences in last iteration 
294
-    int conv;              // convergence status
295
-    DP dev;                // sum of absolute values of string deviations
296
-    int iter;              // number of iterations necessary for convergence
297
-    int iter_Newton;              // number of iterations necessary for convergence (Newton method)
298
-    DP E;                  // total energy
299
-    int iK;                // K = 2.0*PI * iK/Nsites
300
-    DP K;                  // total momentum
301
-    DP lnnorm;             // ln of norm of reduced Gaudin matrix
302
-    //long long int base_id;
303
-    //long long int type_id;
304
-    //long long int id;
305
-    //long long int maxid;
306
-    //int nparticles;
307
-    string label;
308
-
309
-  public:
310
-    Heis_Bethe_State (); 
311
-    Heis_Bethe_State (const Heis_Bethe_State& RefState);  // copy constructor
312
-    //Heis_Bethe_State (const Heis_Bethe_State& RefState, long long int type_id_ref);  // new state with requested type_id
313
-    Heis_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
314
-    Heis_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
315
-    //Heis_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  
316
-    virtual ~Heis_Bethe_State () {};
317
-
318
-  public:
319
-    int Charge () { return(base.Mdown); }; 
320
-    //void Set_Ix2_Offsets (const Ix2_Offsets& RefOffset);  // sets the Ix2 to given offsets
321
-    //void Set_to_id (long long int id_ref);
322
-    //void Set_to_id (long long int id_ref, Heis_Bethe_State& RefState);
323
-    //int Nparticles (); // counts the number of particles in state once Ix2 offsets set (so type_id is correctly set)
324
-    //void Set_to_Label (string label_ref, const Ix2_Config& OriginIx2); 
325
-    void Set_to_Label (string label_ref, const Vect<Vect<int> >& OriginIx2); 
326
-    void Set_Label_from_Ix2 (const Vect<Vect<int> >& OriginIx2); 
327
-    bool Check_Symmetry ();  // checks whether the I's are symmetrically distributed
328
-    void Compute_diffsq ();  // \sum BE[j][alpha]^2
329
-    void Find_Rapidities (bool reset_rapidities);  // Finds the rapidities
330
-    void Find_Rapidities_Twisted (bool reset_rapidities, DP twist);  // Finds the rapidities with twist added to RHS of logBE
331
-    //void BAE_smackdown (DP max_allowed);
332
-    //void Solve_BAE_smackdown (DP max_allowed, int maxruns);
333
-    void Solve_BAE_bisect (int j, int alpha, DP req_prec, int itermax);
334
-    void Iterate_BAE (DP iter_factor);     // Finds new set of lambda[j][alpha] from previous one by simple iteration
335
-    void Solve_BAE_straight_iter (DP straight_prec, int max_iter_interp, DP iter_factor);
336
-    void Solve_BAE_extrap (DP extrap_prec, int max_iter_extrap, DP iter_factor);
337
-    void Iterate_BAE_Newton ();     // Finds new set of lambda[j][alpha] from previous one by a Newton step
338
-    void Solve_BAE_Newton (DP Newton_prec, int max_iter_Newton);
339
-    void Solve_BAE_with_silk_gloves (DP silk_prec, int max_iter_silk, DP iter_factor);
340
-    void Compute_lnnorm ();
341
-    void Compute_Momentum ();
342
-    void Compute_All (bool reset_rapidities);     // solves BAE, computes E, K and lnnorm
343
-
344
-    inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<Vect<int> >& OriginStateIx2)
345
-    {
346
-      Ix2[0][0] = Ix2[0][1] - 2;
347
-      Ix2[0][base.Nrap[0] - 1] = Ix2[0][base.Nrap[0] - 2] + 2;
348
-      (*this).Compute_Momentum();
349
-      if (base.Nrap[0] == 0) return(false);
350
-      if (iKneeded >= iK) Ix2[0][base.Nrap[0]-1] += 2*(iKneeded - iK);
351
-      else Ix2[0][0] += 2*(iKneeded - iK);
352
-      if (Ix2[0][0] < base.Ix2_min[0] || Ix2[0][base.Nrap[0]-1] > base.Ix2_max[0]) return(false);
353
-      (*this).Set_Label_from_Ix2 (OriginStateIx2);
354
-      return(true);
355
-    }
356
-    void Set_to_Outer_Skeleton (const Vect<Vect<int> >& OriginStateIx2) { 
357
-      Ix2[0][0] = base.Ix2_min[0] - 4; 
358
-      Ix2[0][base.Nrap[0]-1] = base.Ix2_max[0] + 4; 
359
-      (*this).Set_Label_from_Ix2 (OriginStateIx2);
360
-    };
361
-
362
-    void Set_to_Closest_Matching_Ix2_fixed_Base (const Heis_Bethe_State& StateToMatch); // defined in Heis.cc
363
-
364
-
365
-    // Virtual functions, all defined in the derived classes
366
-
367
-  public:
368
-    virtual void Set_Free_lambdas() { JSCerror("Heis_Bethe_State::..."); }  // sets the rapidities to solutions of BAEs without scattering terms
369
-    virtual bool Check_Admissibility(char option) { JSCerror("Heis_Bethe_State::..."); return(false); }   
370
-    // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
371
-    virtual void Compute_BE (int j, int alpha) { JSCerror("Heis_Bethe_State::..."); }
372
-    virtual void Compute_BE () { JSCerror("Heis_Bethe_State::..."); }
373
-    virtual DP Iterate_BAE(int i, int alpha) { JSCerror("Heis_Bethe_State::..."); return(0.0);}
374
-    virtual bool Check_Rapidities() { JSCerror("Heis_Bethe_State::..."); return(false); }
375
-    virtual DP String_delta () { JSCerror("Heis_Bethe_State::..."); return(0.0); }
376
-    virtual void Compute_Energy () { JSCerror("Heis_Bethe_State::..."); }
377
-    virtual void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red) { JSCerror("Heis_Bethe_State::..."); }
378
-  };
379
-
380
-  inline bool Is_Inner_Skeleton (Heis_Bethe_State& State) { 
381
-    return (State.base.Nrap[0] >= 2 && (State.Ix2[0][0] == State.Ix2[0][1] - 2 || State.Ix2[0][State.base.Nrap[0]-1] == State.Ix2[0][State.base.Nrap[0]-2] + 2)); 
382
-  }; 
383
-  inline bool Is_Outer_Skeleton (Heis_Bethe_State& State) { 
384
-    return (State.Ix2[0][0] == State.base.Ix2_min[0] - 4 && State.Ix2[0][State.base.Nrap[0]-1] == State.base.Ix2_max[0] + 4); 
385
-  }; 
386
-  
387
-  inline bool Force_Descent (char whichDSF, Heis_Bethe_State& ScanState, Heis_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
388
-  {
389
-    bool force_descent = false;
390
-
391
-    // Force descent if energy of ScanState is lower than that of RefState
392
-    //if (ScanState.E - RefState.E - (ScanState.base.Mdown - RefState.base.Mdown) < 0.0) return(true); 
393
-    /*
394
-    // We force descent if 
395
-    // 1)  - there exists a higher string whose quantum number is still on 0
396
-    // AND - there is at most a single particle-hole in the 0 base level
397
-    // AND - either the particle or the hole hasn't yet moved.
398
-    if (ScanState.base_id/100000LL > 0) { // there is a higher string
399
-      int type0 = ScanState.type_id % 10000;
400
-      if (type0 == 0 
401
-	  || type0 == 101 && ScanState.offsets.Tableau[0].id * ScanState.offsets.Tableau[2].id == 0LL 
402
-	  || type0 == 110 && ScanState.offsets.Tableau[1].id * ScanState.offsets.Tableau[2].id == 0LL 
403
-	  || type0 == 1001 && ScanState.offsets.Tableau[0].id * ScanState.offsets.Tableau[3].id == 0LL 
404
-	  || type0 == 1010 && ScanState.offsets.Tableau[1].id * ScanState.offsets.Tableau[3].id == 0LL) // single p-h pair in base level 0
405
-	for (int j = 1; j < ScanState.chain.Nstrings; ++j) {
406
-	  if (ScanState.base[j] == 1 && ScanState.Ix2[j][0] == 0) {
407
-	    force_descent = true;
408
-	  }
409
-	}
410
-    }
411
-    */
412
-    // Force descent if quantum nr distribution is symmetric:
413
-    //if (ScanState.Check_Symmetry()) force_descent = true;
414
-    //if (desc_type_required > 8 && ScanState.Check_Symmetry()) force_descent = true;
415
-
416
-    // Force descent for longitudinal if we're at zero or pi momentum:
417
-    //ScanState.Compute_Momentum();
418
-    //if (whichDSF == 'z' && (ScanState.iK - RefState.iK) % iKmod == 0) force_descent = true;
419
-    //if (desc_type_required > 8 && whichDSF == 'z' && (2*(ScanState.iK - RefState.iK) % iKmod == 0)) force_descent = true; // type_req > 8 means that we don't conserve momentum
420
-    // Force descent for all DSFs if we're at K = 0 or PI and not conserving momentum upon descent:
421
-    if (desc_type_required > 8 && (2*(ScanState.iK - RefState.iK) % iKmod == 0)) force_descent = true; // type_req > 8 means that we don't conserve momentum
422
-
423
-    //if (force_descent) cout << "Forcing descent on state with label " << ScanState.label << endl;
424
-
425
-    if (ScanState.chain.Delta > 1.0) {
426
-      /*
427
-      // Count the nr of holes in one-strings:
428
-      int nholes = 0;
429
-      for (int i = 0; i < ScanState.base.Nrap[0] - 1; ++i) if (ScanState.Ix2[0][i+1] - ScanState.Ix2[0][i] != 2) nholes++;
430
-      
431
-      if (nholes <= 2) {
432
-	if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 2 && ScanState.base.Nrap[1] == 1) force_descent = true;
433
-	if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 3 && ScanState.base.Nrap[2] == 1) force_descent = true;
434
-	if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 4 && ScanState.base.Nrap[1] == 2) force_descent = true;
435
-      }
436
-      */
437
-
438
-      if (ScanState.label.compare(0, 10, "14x1y1_0x0") == 0) force_descent = true;
439
-      if (ScanState.label.compare(0, 10, "14x1y1_0x1") == 0) force_descent = true;
440
-      if (ScanState.label.compare(0, 10, "14x1y1_1x0") == 0) force_descent = true;
441
-      if (ScanState.label.compare(0, 10, "14x1y1_1x1") == 0) force_descent = true;
442
-      if (ScanState.label.compare(0, 10, "14x1y1_2x0") == 0) force_descent = true;
443
-      if (ScanState.label.compare(0, 10, "14x1y1_2x1") == 0) force_descent = true;
444
-      if (ScanState.label.compare(0, 10, "12x1y2_0x0") == 0) force_descent = true;
445
-      if (ScanState.label.compare(0, 10, "12x1y2_0x1") == 0) force_descent = true;
446
-      if (ScanState.label.compare(0, 10, "12x1y2_0x2") == 0) force_descent = true;
447
-      if (ScanState.label.compare(0, 10, "12x1y2_1x0") == 0) force_descent = true;
448
-      if (ScanState.label.compare(0, 10, "12x1y2_1x1") == 0) force_descent = true;
449
-      if (ScanState.label.compare(0, 10, "12x1y2_1x2") == 0) force_descent = true;
450
-      if (ScanState.label.compare(0, 10, "12x1y2_2x0") == 0) force_descent = true;
451
-      if (ScanState.label.compare(0, 10, "12x1y2_2x1") == 0) force_descent = true;
452
-      if (ScanState.label.compare(0, 10, "12x1y2_2x2") == 0) force_descent = true;
453
-      if (ScanState.label.compare(0, 10, "13x2y1_0x0") == 0) force_descent = true;
454
-      if (ScanState.label.compare(0, 10, "13x2y1_0x1") == 0) force_descent = true;
455
-      if (ScanState.label.compare(0, 10, "13x2y1_1x0") == 0) force_descent = true;
456
-      if (ScanState.label.compare(0, 10, "13x2y1_1x1") == 0) force_descent = true;
457
-      if (ScanState.label.compare(0, 10, "13x2y1_2x0") == 0) force_descent = true;
458
-      if (ScanState.label.compare(0, 10, "13x2y1_2x1") == 0) force_descent = true;
459
-
460
-      if (ScanState.label.compare(0, 10, "30x1y1_0x0") == 0) force_descent = true;
461
-      if (ScanState.label.compare(0, 10, "30x1y1_0x1") == 0) force_descent = true;
462
-      if (ScanState.label.compare(0, 10, "30x1y1_1x0") == 0) force_descent = true;
463
-      if (ScanState.label.compare(0, 10, "30x1y1_1x1") == 0) force_descent = true;
464
-      if (ScanState.label.compare(0, 10, "30x1y1_2x0") == 0) force_descent = true;
465
-      if (ScanState.label.compare(0, 10, "30x1y1_2x1") == 0) force_descent = true;
466
-      if (ScanState.label.compare(0, 10, "28x1y2_0x0") == 0) force_descent = true;
467
-      if (ScanState.label.compare(0, 10, "28x1y2_0x1") == 0) force_descent = true;
468
-      if (ScanState.label.compare(0, 10, "28x1y2_0x2") == 0) force_descent = true;
469
-      if (ScanState.label.compare(0, 10, "28x1y2_1x0") == 0) force_descent = true;
470
-      if (ScanState.label.compare(0, 10, "28x1y2_1x1") == 0) force_descent = true;
471
-      if (ScanState.label.compare(0, 10, "28x1y2_1x2") == 0) force_descent = true;
472
-      if (ScanState.label.compare(0, 10, "28x1y2_2x0") == 0) force_descent = true;
473
-      if (ScanState.label.compare(0, 10, "28x1y2_2x1") == 0) force_descent = true;
474
-      if (ScanState.label.compare(0, 10, "28x1y2_2x2") == 0) force_descent = true;
475
-      if (ScanState.label.compare(0, 10, "29x2y1_0x0") == 0) force_descent = true;
476
-      if (ScanState.label.compare(0, 10, "29x2y1_0x1") == 0) force_descent = true;
477
-      if (ScanState.label.compare(0, 10, "29x2y1_1x0") == 0) force_descent = true;
478
-      if (ScanState.label.compare(0, 10, "29x2y1_1x1") == 0) force_descent = true;
479
-      if (ScanState.label.compare(0, 10, "29x2y1_2x0") == 0) force_descent = true;
480
-      if (ScanState.label.compare(0, 10, "29x2y1_2x1") == 0) force_descent = true;
481
-
482
-      if (ScanState.label.compare(0, 10, "46x1y1_0x0") == 0) force_descent = true;
483
-      if (ScanState.label.compare(0, 10, "46x1y1_0x1") == 0) force_descent = true;
484
-      if (ScanState.label.compare(0, 10, "46x1y1_1x0") == 0) force_descent = true;
485
-      if (ScanState.label.compare(0, 10, "46x1y1_1x1") == 0) force_descent = true;
486
-      if (ScanState.label.compare(0, 10, "46x1y1_2x0") == 0) force_descent = true;
487
-      if (ScanState.label.compare(0, 10, "46x1y1_2x1") == 0) force_descent = true;
488
-      if (ScanState.label.compare(0, 10, "44x1y2_0x0") == 0) force_descent = true;
489
-      if (ScanState.label.compare(0, 10, "44x1y2_0x1") == 0) force_descent = true;
490
-      if (ScanState.label.compare(0, 10, "44x1y2_0x2") == 0) force_descent = true;
491
-      if (ScanState.label.compare(0, 10, "44x1y2_1x0") == 0) force_descent = true;
492
-      if (ScanState.label.compare(0, 10, "44x1y2_1x1") == 0) force_descent = true;
493
-      if (ScanState.label.compare(0, 10, "44x1y2_1x2") == 0) force_descent = true;
494
-      if (ScanState.label.compare(0, 10, "44x1y2_2x0") == 0) force_descent = true;
495
-      if (ScanState.label.compare(0, 10, "44x1y2_2x1") == 0) force_descent = true;
496
-      if (ScanState.label.compare(0, 10, "44x1y2_2x2") == 0) force_descent = true;
497
-      if (ScanState.label.compare(0, 10, "45x2y1_0x0") == 0) force_descent = true;
498
-      if (ScanState.label.compare(0, 10, "45x2y1_0x1") == 0) force_descent = true;
499
-      if (ScanState.label.compare(0, 10, "45x2y1_1x0") == 0) force_descent = true;
500
-      if (ScanState.label.compare(0, 10, "45x2y1_1x1") == 0) force_descent = true;
501
-      if (ScanState.label.compare(0, 10, "45x2y1_2x0") == 0) force_descent = true;
502
-      if (ScanState.label.compare(0, 10, "45x2y1_2x1") == 0) force_descent = true;
503
-
504
-
505
-      if (ScanState.label.compare(0, 10, "62x1y1_0x0") == 0) force_descent = true;
506
-      if (ScanState.label.compare(0, 10, "62x1y1_0x1") == 0) force_descent = true;
507
-      if (ScanState.label.compare(0, 10, "62x1y1_1x0") == 0) force_descent = true;
508
-      if (ScanState.label.compare(0, 10, "62x1y1_1x1") == 0) force_descent = true;
509
-      if (ScanState.label.compare(0, 10, "62x1y1_2x0") == 0) force_descent = true;
510
-      //if (ScanState.label.compare(0, 10, "62x1y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
511
-      if (ScanState.label.compare(0, 10, "62x1y1_2x1") == 0 
512
-	  && (desc_type_required == 14 || desc_type_required == 13 || desc_type_required == 11 || desc_type_required == 10)) force_descent = true;
513
-      /*
514
-      if (ScanState.label.compare(0, 10, "60x1y2_0x0") == 0) force_descent = true;
515
-      if (ScanState.label.compare(0, 10, "60x1y2_0x1") == 0) force_descent = true;
516
-      if (ScanState.label.compare(0, 10, "60x1y2_0x2") == 0) force_descent = true;
517
-      if (ScanState.label.compare(0, 10, "60x1y2_1x0") == 0) force_descent = true;
518
-      if (ScanState.label.compare(0, 10, "60x1y2_1x1") == 0) force_descent = true;
519
-      if (ScanState.label.compare(0, 10, "60x1y2_1x2") == 0) force_descent = true;
520
-      if (ScanState.label.compare(0, 10, "60x1y2_2x0") == 0) force_descent = true;
521
-      if (ScanState.label.compare(0, 10, "60x1y2_2x1") == 0 && desc_type_required < 2) force_descent = true;
522
-      if (ScanState.label.compare(0, 10, "60x1y2_2x2") == 0 && desc_type_required < 2) force_descent = true;
523
-      if (ScanState.label.compare(0, 10, "61x2y1_0x0") == 0) force_descent = true;
524
-      if (ScanState.label.compare(0, 10, "61x2y1_0x1") == 0) force_descent = true;
525
-      if (ScanState.label.compare(0, 10, "61x2y1_1x0") == 0) force_descent = true;
526
-      if (ScanState.label.compare(0, 10, "61x2y1_1x1") == 0) force_descent = true;
527
-      if (ScanState.label.compare(0, 10, "61x2y1_2x0") == 0) force_descent = true;
528
-      if (ScanState.label.compare(0, 10, "61x2y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
529
-      */
530
-
531
-      if (ScanState.label.compare(0, 11, "126x1y1_0x0") == 0) force_descent = true;
532
-      if (ScanState.label.compare(0, 11, "126x1y1_0x1") == 0) force_descent = true;
533
-      if (ScanState.label.compare(0, 11, "126x1y1_1x0") == 0) force_descent = true;
534
-      if (ScanState.label.compare(0, 11, "126x1y1_1x1") == 0) force_descent = true;
535
-      if (ScanState.label.compare(0, 11, "126x1y1_2x0") == 0) force_descent = true;
536
-      //if (ScanState.label.compare(0, 11, "126x1y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
537
-      if (ScanState.label.compare(0, 11, "126x1y1_2x1") == 0 
538
-	  && (desc_type_required == 14 || desc_type_required == 13 || desc_type_required == 11 || desc_type_required == 10)) force_descent = true;
539
-      /*
540
-      if (ScanState.label.compare(0, 10, "124x1y2_0x0") == 0) force_descent = true;
541
-      if (ScanState.label.compare(0, 10, "124x1y2_0x1") == 0) force_descent = true;
542
-      if (ScanState.label.compare(0, 10, "124x1y2_0x2") == 0) force_descent = true;
543
-      if (ScanState.label.compare(0, 10, "124x1y2_1x0") == 0) force_descent = true;
544
-      if (ScanState.label.compare(0, 10, "124x1y2_1x1") == 0) force_descent = true;
545
-      if (ScanState.label.compare(0, 10, "124x1y2_1x2") == 0) force_descent = true;
546
-      if (ScanState.label.compare(0, 10, "124x1y2_2x0") == 0) force_descent = true;
547
-      if (ScanState.label.compare(0, 10, "124x1y2_2x1") == 0) force_descent = true;
548
-      if (ScanState.label.compare(0, 10, "124x1y2_2x2") == 0) force_descent = true;
549
-      if (ScanState.label.compare(0, 10, "125x2y1_0x0") == 0) force_descent = true;
550
-      if (ScanState.label.compare(0, 10, "125x2y1_0x1") == 0) force_descent = true;
551
-      if (ScanState.label.compare(0, 10, "125x2y1_1x0") == 0) force_descent = true;
552
-      if (ScanState.label.compare(0, 10, "125x2y1_1x1") == 0) force_descent = true;
553
-      if (ScanState.label.compare(0, 10, "125x2y1_2x0") == 0) force_descent = true;
554
-      if (ScanState.label.compare(0, 10, "125x2y1_2x1") == 0) force_descent = true;
555
-      */
556
-      if (ScanState.label.compare(0, 11, "254x1y1_0x0") == 0) force_descent = true;
557
-      if (ScanState.label.compare(0, 11, "254x1y1_0x1") == 0) force_descent = true;
558
-      if (ScanState.label.compare(0, 11, "254x1y1_1x0") == 0) force_descent = true;
559
-      if (ScanState.label.compare(0, 11, "254x1y1_1x1") == 0) force_descent = true;
560
-      if (ScanState.label.compare(0, 11, "254x1y1_2x0") == 0) force_descent = true;
561
-      if (ScanState.label.compare(0, 11, "254x1y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
562
-
563
-      // Do not force descent a state with rapidities outside of fundamental interval:
564
-      /*
565
-      for (int j = 0; j < ScanState.chain.Nstrings; ++j) {
566
-	// Logic: allow rapidities -PI/2 <= lambda <= PI/2 (including boundaries)
567
-	if (ScanState.base.Nrap[j] > 0 && 
568
-	    (ScanState.lambda[j][0] < -PI/2 || ScanState.lambda[j][ScanState.base.Nrap[j] - 1] > PI/2))
569
-	  force_descent = false;
570
-	
571
-	// rapidities should also be ordered as the quantum numbers:
572
-	for (int alpha = 1; alpha < ScanState.base.Nrap[j]; ++alpha)
573
-	  if (ScanState.lambda[j][alpha - 1] >= ScanState.lambda[j][alpha])
574
-	    force_descent = false;
575
-      }
576
-      */
577
-      //if (force_descent) cout << "Forcing descent on state with label " << ScanState.label << endl;
578
-    } // if Delta > 1
579
-
580
-    //if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 2 && ScanState.base.Nrap[1] == 1 && ScanState.Ix2[1][0] == 0) force_descent = true;
581
-    //if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 3 && ScanState.base.Nrap[2] == 1 && ScanState.Ix2[2][0] == 0) force_descent = true;
582
-    //if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 4 && ScanState.base.Nrap[1] == 2 && ScanState.Ix2[1][0] == -1 && ScanState.Ix2[1][1] == 1) force_descent = true;
583
-
584
-    return(force_descent);
585
-  }
586
-
587
-  std::ostream& operator<< (std::ostream& s, const Heis_Bethe_State& state);
588
-
589
-  //****************************************************************************
590
-
591
-  // Objects in class XXZ_Bethe_State carry all extra information pertaining to XXZ gapless
592
-
593
-  class XXZ_Bethe_State : public Heis_Bethe_State {
594
-    
595
-  public:
596
-    Lambda sinhlambda;  
597
-    Lambda coshlambda;  
598
-    Lambda tanhlambda;  
599
-
600
-  public:
601
-    XXZ_Bethe_State (); 
602
-    XXZ_Bethe_State (const XXZ_Bethe_State& RefState);  // copy constructor
603
-    XXZ_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
604
-    XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
605
-    //XXZ_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with bas
606
-
607
-  public:
608
-    XXZ_Bethe_State& operator= (const XXZ_Bethe_State& RefState);
609
-    
610
-  public:
611
-    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
612
-    void Compute_sinhlambda();
613
-    void Compute_coshlambda();
614
-    void Compute_tanhlambda();
615
-    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
616
-    void Compute_BE (int j, int alpha);
617
-    void Compute_BE ();
618
-    DP Iterate_BAE(int i, int j);
619
-    bool Check_Rapidities();  // checks that all rapidities are not nan
620
-    DP String_delta ();
621
-    void Compute_Energy ();
622
-    //void Compute_Momentum ();
623
-    void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);    
624
-
625
-    // XXZ specific functions:
626
-  public:
627
-
628
-  };
629
-
630
-  XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState);
631
-  XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState);
632
-
633
-  //****************************************************************************
634
-
635
-  // Objects in class XXX_Bethe_State carry all extra information pertaining to XXX antiferromagnet
636
-
637
-  class XXX_Bethe_State : public Heis_Bethe_State {
638
-
639
-  public:
640
-    XXX_Bethe_State (); 
641
-    XXX_Bethe_State (const XXX_Bethe_State& RefState);  // copy constructor
642
-    XXX_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
643
-    XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
644
-    //XXX_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with base
645
-
646
-  public:
647
-    XXX_Bethe_State& operator= (const XXX_Bethe_State& RefState);
648
-
649
-  public:
650
-    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
651
-    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
652
-    void Compute_BE (int j, int alpha);
653
-    void Compute_BE ();
654
-    DP Iterate_BAE(int i, int j);
655
-    bool Check_Rapidities();  // checks that all rapidities are not nan    
656
-    DP String_delta ();
657
-    void Compute_Energy ();
658
-    //void Compute_Momentum ();
659
-    void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
660
-
661
-    // XXX specific functions
662
-  public:
663
-    bool Check_Finite_rap ();
664
-
665
-  };
666
-
667
-  XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState);
668
-  XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState);
669
-
670
-  //****************************************************************************
671
-
672
-  // Objects in class XXZ_gpd_Bethe_State carry all extra information pertaining to XXZ gapped antiferromagnets
673
-
674
-  class XXZ_gpd_Bethe_State : public Heis_Bethe_State {
675
-    
676
-  public:
677
-    Lambda sinlambda;  
678
-    Lambda coslambda;  
679
-    Lambda tanlambda;  
680
-
681
-  public:
682
-    XXZ_gpd_Bethe_State (); 
683
-    XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState);  // copy constructor
684
-    XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M);  // constructor to ground-state configuration
685
-    XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base);  // constructor to lowest-energy config with base
686
-    //XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);  // constructor to lowest-energy config with base
687
-
688
-  public:
689
-    XXZ_gpd_Bethe_State& operator= (const XXZ_gpd_Bethe_State& RefState);
690
-
691
-  public:
692
-    void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
693
-    void Compute_sinlambda();
694
-    void Compute_coslambda();
695
-    void Compute_tanlambda();
696
-    int Weight();   // weight function for contributions cutoff 
697
-    bool Check_Admissibility(char option);           // verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
698
-    void Compute_BE (int j, int alpha);
699
-    void Compute_BE ();
700
-    DP Iterate_BAE(int i, int j);
701
-    void Iterate_BAE_Newton();
702
-    bool Check_Rapidities();  // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
703
-    DP String_delta ();
704
-    void Compute_Energy ();
705
-    //void Compute_Momentum ();
706
-    void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
707
-
708
-    // XXZ_gpd specific functions
709
-  public:
710
-
711
-  };
712
-
713
-  XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
714
-  XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
715
-
716
-  //***********************************************
717
-  
718
-  // Function declarations
719
-
720
-  // in M_vs_H.cc
721
-  DP Ezero (DP Delta, int N, int M);
722
-  DP H_vs_M (DP Delta, int N, int M);
723
-  DP HZmin (DP Delta, int N, int M, Vect_DP& Ezero_ref);
724
-  int M_vs_H (DP Delta, int N, DP HZ);
725
-
726
-  DP X_avg (char xyorz, DP Delta, int N, int M);
727
-
728
-  DP Chemical_Potential (const Heis_Bethe_State& RefState);
729
-  DP Particle_Hole_Excitation_Cost (char whichDSF, Heis_Bethe_State& AveragingState);
730
-
731
-  //DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded);
732
-  DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
733
-  void Evaluate_F_Sumrule (string prefix, char whichDSF, const Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
734
-
735
-  complex<DP> ln_Sz_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
736
-  complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
737
-
738
-  complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
739
-  complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
740
-
741
-  // From Antoine Klauser:
742
-  complex<DP> ln_Szz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
743
-  complex<DP> ln_Szm_p_Smz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
744
-  complex<DP> ln_Smm_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
745
-
746
-  complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
747
-  complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
748
-
749
-  // The following functions have become member functions.
750
-  //DP String_delta (XXZ_Bethe_State& state);
751
-  //DP String_delta (XXX_Bethe_State& state);
752
-  //DP String_delta (XXZ_gpd_Bethe_State& state);
753
-
754
-  //DP Compute_Form_Factor_Entry (char whichDSF, Heis_Bethe_State& LeftState, Heis_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
755
-  //DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState, 
756
-  //				     XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
757
-  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState, 
758
-				     XXZ_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
759
-  //DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState, 
760
-  //				     XXX_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
761
-  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState, 
762
-				     XXX_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
763
-  //DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState, 
764
-  //				     XXZ_gpd_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
765
-  DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState, 
766
-				     XXZ_gpd_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
767
-
768
-  // For geometric quench:
769
-  complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B);
770
-
771
-  void Scan_Heis_Geometric_Quench (DP Delta, int N_1, int M, long long int base_id_1, long long int type_id_1, long long int id_1, 
772
-				   int N_2, int iKmin, int iKmax, int Max_Secs, bool refine);
773
-
774
-
775
-} // namespace JSC
776
-
777
-#endif

+ 0
- 32
include/JSC_Infprec.h View File

@@ -1,32 +0,0 @@
1
-/**********************************************************
2
-
3
-This software is part of J.-S. Caux's ABACUS library.
4
-
5
-Copyright (c).
6
-
7
------------------------------------------------------------
8
-
9
-File:  JSC_Infprec.h
10
-
11
-Purpose:  Declarations for infinite precision arithmetic classes.
12
-
13
-***********************************************************/
14
-
15
-
16
-#ifndef _JSC_INFPREC_
17
-#define _JSC_INFPREC_
18
-
19
-namespace JSC {
20
-
21
-  class infprec_int {
22
-    
23
-  private:
24
-    int nintrep; // number of integers used in representation
25
-    int baseint; // fundamental int
26
-    Vect<unsigned int> xint; // extra integers
27
- 
28
-  }
29
-
30
-} // namespace JSC
31
-
32
-#endif

+ 0
- 440
include/JSC_Matrix.h View File

@@ -1,440 +0,0 @@
1
-/**********************************************************
2
-
3
-This software is part of J.-S. Caux's ABACUS library.
4
-
5
-Copyright (c).
6
-
7
------------------------------------------------------------
8
-
9
-File:  JSC_Matrix.h
10
-
11
-Purpose:  Declares square matrix class.
12
-
13
-***********************************************************/
14
-
15
-#ifndef _MATRIX_
16
-#define _MATRIX_
17
-
18
-namespace JSC {
19
-
20
-
21
-  // CLASS DEFINITIONS
22
-
23
-  template <class T> 
24
-    class SQMat {
25
-    
26
-  private:
27
-    int dim;
28
-    T** M;
29
-    
30
-  public:
31
-    SQMat (int N);             // initializes all elements of this n by n matrix to zero
32
-    SQMat (const SQMat& rhs);  // copy constructor
33
-    SQMat (const T& a, int N);  // initialize to diagonal matrix with value a (NOT like in NR !!!)
34
-    SQMat (const SQMat& a, const SQMat& b);  // initialize to tensor product of a and b
35
-    SQMat (const SQMat& a, int row_id, int col_id);  // init by cutting row row_id and col col_id
36
-    void Print ();
37
-    SQMat& operator= (const SQMat& rhs);  // assignment
38
-    SQMat& operator= (const T& a);        // assign 1 to diagonal elements (NOT like in NR !!!)
39
-    inline T* operator[] (const int i);  // subscripting: pointer to row i
40
-    inline const T* operator[] (const int i) const;
41
-    SQMat& operator+= (const T& a);
42
-    SQMat& operator+= (const SQMat& a);
43
-    SQMat& operator-= (const T& a);
44
-    SQMat& operator-= (const SQMat& a);
45
-    SQMat& operator*= (const T& a);
46
-    SQMat& operator*= (const SQMat& a);
47
-    inline int size() const;
48
-    ~SQMat();
49
-    
50
-  };
51
-  
52
-  template <class T>
53
-    SQMat<T>::SQMat (int N) : dim(N) , M(new T*[N])
54
-    {
55
-      M[0] = new T[N*N];
56
-      for (int i = 1; i < N; i++) M[i] = M[i-1] + N;
57
-    }
58
-    
59
-    template <class T>
60
-      SQMat<T>::SQMat (const SQMat& rhs) : dim(rhs.dim) , M(new T*[dim])
61
-      {
62
-	int i,j;
63
-	M[0] = new T[dim*dim];
64
-	for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
65
-	for (i = 0; i < dim; i++) 
66
-	  for (j = 0; j < dim; j++) M[i][j] = rhs[i][j];
67
-      }
68
-      
69
-      template <class T>
70
-	SQMat<T>::SQMat (const T& a, int N) : dim(N) , M(new T*[dim])
71
-	{
72
-	  int i, j;
73
-	  M[0] = new T[dim*dim];
74
-	  for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
75
-	  for (i = 0; i < dim; i++) {
76
-	    for (j = 0; j < dim; j++) M[i][j] = T(0); 
77
-	    M[i][i] = a;
78
-	  }
79
-	}
80
-	
81
-    template <class T>
82
-    SQMat<T>::SQMat (const SQMat& a, const SQMat& b) : dim (a.dim * b.dim) , M(new T*[a.dim * b.dim]) 
83
-    {
84
-      M[0] = new T[a.dim * b.dim * a.dim * b.dim];
85
-
86
-      for (int i = 1; i < a.dim * b.dim; ++i) M[i] = M[i-1] + a.dim * b.dim;
87
-    
88
-      for (int i1 = 0; i1 < a.dim; ++i1) {
89
-
90
-	for (int i2 = 0; i2 < a.dim; ++i2) {
91
-
92
-	  for (int j1 = 0; j1 < b.dim; ++j1) {
93
-
94
-	    for (int j2 = 0; j2 < b.dim; ++j2) {
95
-
96
-    	      M[i1 * (b.dim) + j1][i2 * (b.dim) + j2] = a[i1][i2] * b[j1][j2];
97
-	    }
98
-	  }
99
-	}
100
-      }
101
-    }
102
-
103
-      template <class T>
104
-	SQMat<T>::SQMat (const SQMat&a, int row_id, int col_id) : dim (a.dim - 1) , M(new T*[dim])
105
-	{
106
-	  if (dim == 0) {
107
-	    JSCerror("Error:  chopping a row and col from size one matrix.");
108
-	    exit(1);
109
-	  }
110
-    
111
-    	  M[0] = new T[dim * dim];
112
-
113
-	  for (int i = 1; i < dim; ++i) M[i] = M[i-1] + dim;
114
-
115
-	  for (int i = 0; i < row_id; ++i)
116
-	    for (int j = 0; j < col_id; ++j) M[i][j] = a[i][j];
117
-	  for (int i = row_id; i < dim; ++i)
118
-	    for (int j = 0; j < col_id; ++j) M[i][j] = a[i+1][j];
119
-	  for (int i = 0; i < row_id; ++i)
120
-	    for (int j = col_id; j < dim; ++j) M[i][j] = a[i][j+1];
121
-	  for (int i = row_id; i < dim; ++i)
122
-	    for (int j = col_id; j < dim; ++j) M[i][j] = a[i+1][j+1];
123
-	  
124
-	}
125
-
126
-  // operators
127
-	template <class T>
128
-	void SQMat<T>::Print ()
129
-	{
130
-	  cout << endl;
131
-	  for (int i = 0; i < dim; ++i) {
132
-	    for (int j = 0; j < dim; ++j) cout << M[i][j] << " ";
133
-	    cout << endl;
134
-	  }
135
-	  cout << endl;
136
-	}
137
-
138
-    template <class T>
139
-    SQMat<T>& SQMat<T>::operator= (const SQMat<T>& rhs)
140
-    {
141
-      if (this != &rhs) {
142
-	if (dim != rhs.dim) {
143
-	  JSCerror("Assignment between matrices of different dimensions.  Bailing out.");
144
-	  exit(1);
145
-	}
146
-
147
-	for (int i = 0; i < dim; ++i) 
148
-	  for (int j = 0; j < dim; ++j) M[i][j] = rhs[i][j];
149
-      }
150
-      return *this;
151
-    }
152
-
153
-    template <class T>
154
-    SQMat<T>& SQMat<T>::operator= (const T& a)
155
-    {
156
-      for (int i = 0; i < dim; ++i) {
157
-	for (int j = 0; j < dim; ++j) 
158
-	  M[i][j] = T(0);
159
-	M[i][i] = a;
160
-      }
161
-      return *this;
162
-    }
163
-
164
-    template <class T>
165
-    inline T* SQMat<T>::operator[] (const int i)
166
-    {
167
-      return M[i];
168
-    }
169
-
170
-    template <class T>
171
-    inline const T* SQMat<T>::operator[] (const int i) const
172
-    {
173
-      return M[i];
174
-    }
175
-
176
-    template <class T>
177
-      SQMat<T>& SQMat<T>::operator+= (const T& a)
178
-      {
179
-
180
-	for (int i = 0; i < dim; ++i) M[i][i] += a;
181
-
182
-	return *this;
183
-      }
184
-
185
-    template <class T>
186
-      SQMat<T>& SQMat<T>::operator+= (const SQMat<T>& a)
187
-      {
188
-	if (dim != a.dim) {
189
-	  JSCerror("Incompatible matrix sizes in matrix operator +.");
190
-	  exit(1);
191
-	}
192
-	for (int i = 0; i < dim; ++i) {
193
-	  for (int j = 0; j < dim; ++j) {
194
-	    M[i][j] += a[i][j];
195
-	  }
196
-	}
197
-	return *this;
198
-      }
199
-
200
-    template <class T>
201
-      SQMat<T>& SQMat<T>::operator-= (const T& a)
202
-      {
203
-
204
-	for (int i = 0; i < dim; ++i) M[i][i] -= a;
205
-
206
-	return *this;
207
-      }
208
-
209
-    template <class T>
210
-      SQMat<T>& SQMat<T>::operator-= (const SQMat<T>& a)
211
-      {
212
-	if (dim != a.dim) {
213
-	  JSCerror("Incompatible matrix sizes in matrix operator +.");
214
-	  exit(1);
215
-	}
216
-	for (int i = 0; i < dim; ++i) {
217
-	  for (int j = 0; j < dim; ++j) {
218
-	    M[i][j] -= a[i][j];
219
-	  }
220
-	}
221
-	return *this;
222
-      }
223
-
224
-    template <class T>
225
-      SQMat<T>& SQMat<T>::operator*= (const T& a)
226
-      {
227
-
228
-	for (int i = 0; i < dim; ++i) for (int j = 0; j < dim; ++j) M[i][j] *= a;
229
-
230
-	return *this;
231
-      }
232
-
233
-    template <class T>
234
-      SQMat<T>& SQMat<T>::operator*= (const SQMat<T>& a)
235
-      {
236
-
237
-	if (dim != a.dim) {
238
-	  JSCerror("Incompatible matrix sizes in matrix operator *.");
239
-	  exit(1);
240
-	}
241
-
242
-	SQMat<T> leftarg(*this);  // use copy constructor.
243
-    
244
-	for (int i = 0; i < dim; ++i) {
245
-
246
-	  for (int j = 0; j < dim; ++j) {
247
-
248
-	    M[i][j] = 0.0;
249
-
250
-	    for (int k = 0; k < dim; ++k) {
251
-
252
-	      M[i][j] += leftarg[i][k] * a[k][j];
253
-	    }
254
-	  }
255
-	}
256
-
257
-	return *this;
258
-      }
259
-  
260
-    template <class T>
261
-    inline int SQMat<T>::size() const
262
-    {
263
-      return dim;
264
-    }
265
-
266
-    template <class T>
267
-    SQMat<T>::~SQMat()
268
-    {
269
-      if (M != 0) {
270
-	delete[] (M[0]);
271
-	delete[] (M);
272
-      }
273
-    }
274
-
275
-
276
-    //*****************************
277
-
278
-  template <class T> 
279
-    class RecMat {
280
-    
281
-  private:
282
-    int nrows;
283
-    int ncols;
284
-    T** M;
285
-    
286
-  public:
287
-    RecMat (int Nrows, int Ncols);             // initializes all elements of this n by n matrix to zero
288
-    RecMat (const T& a, int Nrows, int Ncols);
289
-     RecMat (const RecMat& rhs);  // copy constructor
290
-    void Print ();
291
-    RecMat& operator= (const RecMat& rhs);  // assignment
292
-    inline T* operator[] (const int i);  // subscripting: pointer to row i
293
-    inline const T* operator[] (const int i) const;
294
-    inline int nr_rows() const;
295
-    inline int nr_cols() const;
296
-    ~RecMat();
297
-    
298
-  };
299
-  
300
-  template <class T>
301
-    RecMat<T>::RecMat (int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
302
-    {
303
-      M[0] = new T[Nrows*Ncols];
304
-      for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
305
-
306
-      for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) M[i][j] = T(0);
307
-    }
308
-
309
-  template <class T>
310
-    RecMat<T>::RecMat (const T& a, int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
311
-    {
312
-      M[0] = new T[Nrows*Ncols];
313
-      for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
314
-
315
-      for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) {
316
-	if (i == j) M[i][i] = a;
317
-	else M[i][j] = T(0);
318
-      }
319
-    }
320
-    
321
-    template <class T>
322
-      RecMat<T>::RecMat (const RecMat& rhs) : nrows(rhs.nrows), ncols(rhs.ncols), M(new T*[nrows])
323
-      {
324
-	int i,j;
325
-	M[0] = new T[nrows*ncols];
326
-	for (i = 1; i < nrows; i++) M[i] = M[i-1] + ncols;
327
-	for (i = 0; i < nrows; i++) 
328
-	  for (j = 0; j < ncols; j++) M[i][j] = rhs[i][j];
329
-      }
330
-      
331
-  // operators
332
-	template <class T>
333
-	void RecMat<T>::Print ()
334
-	{
335
-	  cout << endl;
336
-	  for (int i = 0; i < nrows; ++i) {
337
-	    for (int j = 0; j < ncols; ++j) cout << M[i][j] << " ";
338
-	    cout << endl;
339
-	  }
340
-	  cout << endl;
341
-	}
342
-
343
-    template <class T>
344
-    RecMat<T>& RecMat<T>::operator= (const RecMat<T>& rhs)
345
-    {
346
-      if (this != &rhs) {
347
-	if (nrows != rhs.nrows || ncols != rhs.ncols) {
348
-	  if (M != 0) {
349
-	    delete[] (M[0]);
350
-	    delete[] (M);
351
-	  }
352
-	  nrows = rhs.nrows;
353
-	  ncols = rhs.ncols;
354
-	  M = new T*[nrows];
355
-	  M[0] = new T[nrows * ncols];
356
-	}
357
-
358
-	for (int i = 0; i < nrows; ++i) 
359
-	  for (int j = 0; j < ncols; ++j) M[i][j] = rhs[i][j];
360
-      }
361
-      return *this;
362
-    }
363
-
364
-    template <class T>
365
-    inline T* RecMat<T>::operator[] (const int i)
366
-    {
367
-      return M[i];
368
-    }
369
-
370
-    template <class T>
371
-    inline const T* RecMat<T>::operator[] (const int i) const
372
-    {
373
-      return M[i];
374
-    }
375
-
376
-    template <class T>
377
-    inline int RecMat<T>::nr_rows() const
378
-    {
379
-      return nrows;
380
-    }
381
-
382
-    template <class T>
383
-    inline int RecMat<T>::nr_cols() const
384
-    {
385
-      return ncols;
386
-    }
387
-
388
-    template <class T>
389
-      inline std::ostream& operator<< (std::ostream& s, const RecMat<T>& matrix)
390
-      {
391
-	for (int i = 0; i < matrix.nr_rows(); ++i) {
392
-	  for (int j = 0; j < matrix.nr_cols(); ++j) s << matrix[i][j] << " ";
393
-	  s << endl;
394
-	}
395
-
396
-	return (s);
397
-      }
398
-
399
-    template <class T>
400
-    RecMat<T>::~RecMat()
401
-    {
402
-      if (M != 0) {
403
-	delete[] (M[0]);
404
-	delete[] (M);
405
-      }
406
-    }
407
-
408
-    // TYPEDEFS:
409
-
410
-    typedef JSC::SQMat<DP> SQMat_DP;
411
-    typedef JSC::SQMat<complex<double> > SQMat_CX;
412
-
413
-
414
-    // FUNCTION DEFINITIONS
415
-
416
-    // Functions in src/MATRIX directory
417
-
418
-    DP det_LU (SQMat_DP a);
419
-    DP lndet_LU (SQMat_DP a);
420
-    complex<DP> lndet_LU_dstry (SQMat_DP& a);
421
-    complex<DP> det_LU_CX (SQMat_CX a);
422
-    complex<DP> lndet_LU_CX (SQMat_CX a);
423
-    complex<DP> lndet_LU_CX_dstry (SQMat_CX& a);
424
-    void eigsrt (Vect_DP& d, SQMat_DP& v);
425
-    void balanc (SQMat_DP& a);
426
-    void elmhes (SQMat_DP& a);
427
-    void gaussj (SQMat_DP& a, SQMat_DP& b);
428
-    void hqr (SQMat_DP& a, Vect_CX& wri);
429
-    void jacobi (SQMat_DP& a, Vect_DP& d, SQMat_DP& v, int& nrot);
430
-    void lubksb (SQMat_DP& a, Vect_INT& indx, Vect_DP& b);
431
-    void lubksb_CX (SQMat_CX& a, Vect_INT& indx, Vect_CX& b);
432
-    void ludcmp (SQMat_DP& a, Vect_INT& indx, DP& d);  
433
-    void ludcmp_CX (SQMat_CX& a, Vect_INT& indx, DP& d);  
434
-    DP pythag(DP a, DP b);
435
-    void tqli(Vect_DP& d, Vect_DP& e, SQMat_DP& z);
436
-    void tred2 (SQMat_DP& a, Vect_DP& d, Vect_DP& e);
437
-        
438
-} // namespace JSC
439
-
440
-#endif

+ 0
- 36
include/JSC_NRG.h View File

@@ -1,36 +0,0 @@
1
-/**********************************************************
2
-
3
-This software is part of J.-S. Caux's ABACUS library.
4
-
5
-Copyright (c).
6
-
7
------------------------------------------------------------
8
-
9
-File:  JSC_NRG.h
10
-
11
-Purpose:  Declares NRG-related classes and functions.
12
-
13
-***********************************************************/
14
-
15
-#ifndef _NRG_
16
-#define _NRG_
17
-
18
-#include "JSC.h"
19
-
20
-namespace JSC {
21
-
22
-  DP K_Weight_integrand (Vect_DP args);  // weighing function for state selection
23
-
24
-  //void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
25
-  //		      int weighing_option, DP (*weight_integrand_fn) (Vect_DP), Vect_DP& args_to_weight_integrand);
26
-  void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
27
-			      //int weighing_option, DP (*weight_integrand_fn) (Vect_DP), Vect_DP& args_to_weight_integrand)
28
-			      int weighing_option, Vect<complex <DP> >& FT_of_potential);
29
-  
30
-  void Build_DFF_Matrix_Block_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod, 
31
-				       int weighing_option, int label_left_begin, int label_left_end, int label_right_begin, int label_right_end,
32
-				       int block_option, DP* DFF_block_1, DP* DFF_block_2, Vect_DP Kweight);
33
-
34
-}
35
-
36
-#endif // _NRG_

+ 0
- 1263
include/JSC_Scan.h
File diff suppressed because it is too large
View File


+ 0
- 86
include/JSC_XXZ_h0.h View File

@@ -1,86 +0,0 @@
1
-/**********************************************************
2
-
3
-This software is part of J.-S. Caux's ABACUS library.
4
-
5
-Copyright (c).
6
-
7
------------------------------------------------------------
8
-
9
-File:  JSC_XXZ_h0.h
10
-
11
-Purpose:  Declares classes for XXZ in zero field:  quantum group stuff.
12
-
13
-
14
-***********************************************************/
15
-
16
-#ifndef _XXZ_h0_
17
-#define _XXZ_h0_
18
-
19
-#include "JSC.h"
20
-
21
-//const DP default_req_prec = 1.0e-14;
22
-//const int default_max_rec = 10;
23
-
24
-namespace JSC {
25
-
26
-  /*
27
-  inline DP Integrand_xi_11 (Vect_DP args)
28
-    {
29
-      // args[0] corresponds to t, args[1] to rho, args[2] to xi
30
-      //return((exp(args[0]) * sinh(args[0]) * cos(4.0 * args[0] * args[1])/(2.0 * pow(cosh(args[0]), 2.0)) + 2.0 * pow(sin(2.0 * args[0] * args[1]), 2.0))/args[0]);
31
-      return((sinh(args[0]*(1.0 + args[2])) * sinh(args[0]) * cos(4.0 * args[0] * args[1])/(2.0 * sinh(args[0] * args[2]) * pow(cosh(args[0]), 2.0)) 
32
-	      + 2.0 * pow(sin(2.0 * args[0] * args[1]), 2.0))/args[0]);
33
-    }
34
-  
35
-  inline DP Integrand_xi_12 (Vect_DP args)
36
-    {
37
-      DP expm2t = exp(-2.0*args[0]);
38
-      DP expm2txi = exp(-2.0*args[0]*args[2]);
39
-      //return(cos(4.0 * args[0] * args[1]) * expm2t * (3.0 + expm2t)/ (args[0] * (1.0 + expm2t) * (1.0 + expm2t)));
40
-      return(cos(4.0 * args[0] * args[1]) * (expm2t * (3.0 * (1.0 + expm2txi) + expm2t) + expm2txi) / (args[0] * (1.0 - expm2txi) * (1.0 + expm2t) * (1.0 + expm2t)));
41
-    }
42
-  */
43
-  /*  
44
-  inline DP Integrand_xi_2 (Vect_DP args)
45
-    {
46
-      DP answer = 0.0;
47
-      if (args[0] < 1.0) 
48
-	//answer = exp(args[0]) * pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * sinh(args[0]) * pow(cosh(args[0]), 2.0));
49
-	answer = sinh(args[0] * (args[2] + 1.0)) * pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * sinh(args[2] * args[0]) * sinh(args[0]) * pow(cosh(args[0]), 2.0));
50
-      else if (args[0] >= 1.0) {
51
-	DP expm2t = exp(-2.0 * args[0]);
52
-	DP expm2txi = exp(-2.0*args[0]*args[2]);
53
-	//answer = 8.0 * expm2t * pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * (1.0 - expm2t) * (1.0 + expm2t) * (1.0 + expm2t));
54
-	answer = 8.0 * ((1.0 - expm2t*expm2txi)/(1.0 - expm2t*expm2txi)) * expm2t * 
55
-	  pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * (1.0 - expm2t) * (1.0 + expm2t) * (1.0 + expm2t));
56
-      }
57
-      return(answer);
58
-    }
59
-  */
60
-
61
-  DP I_xi_integral (DP xi, DP rho, DP req_prec, int max_nr_pts);
62
-
63
-
64
-  /*********************  TWO SPINONS ********************/
65
-  DP Szz_XXZ_h0_2spinons (DP k, DP omega, Integral_table Itable);
66
-  DP Szz_XXZ_h0_2spinons (Vect_DP args, Integral_table Itable);
67
-  DP Szz_XXZ_h0_2spinons_alt (Vect_DP args, Integral_table Itable);
68
-  DP Szz_XXZ_h0_2spinons_omega (Vect_DP args, Integral_table Itable);
69
-  DP Szz_XXZ_h0_2spinons_omega_alt (Vect_DP args, Integral_table Itable);
70
-  DP Szz_XXZ_h0_2spinons_intomega (Vect_DP args, Integral_table Itable);
71
-  DP Szz_XXZ_h0_2spinons_intomega_alt (Vect_DP args, Integral_table Itable);
72
-  DP Szz_XXZ_h0_2spinons_check_sumrule (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
73
-  DP Szz_XXZ_h0_2spinons_check_sumrule_alt (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
74
-  DP Fixed_k_sumrule_omega_Szz_XXZ_h0_N (DP Delta, DP k);
75
-  DP GSE_XXZ_h0 (DP Delta, DP req_prec, int max_nr_pts);
76
-  DP Fixed_k_sumrule_omega_Szz_XXZ_h0 (DP Delta, DP k, DP req_prec, int max_nr_pts);
77
-  DP Szz_XXZ_h0_2spinons_check_fixed_k_Szz_sumrule (DP Delta, DP k, DP req_prec, int max_nr_pts, Integral_table Itable);
78
-  DP Szz_XXZ_h0_2spinons_check_fixed_k_Szz_sumrule_alt (DP Delta, DP k, DP req_prec, int max_nr_pts, Integral_table Itable);
79
-
80
-  //******************************** Functions to produce files similar to ABACUS **********************************
81
-  void Produce_Szz_XXZ_h0_2spinons_file (DP Delta, int N, int Nomega, DP omegamax, Integral_table Itable);
82
-  void Produce_Szz_XXZ_h0_2spinons_fixed_K_file (DP Delta, DP Kover2PI, int Nomega, Integral_table Itable);
83
-
84
-} // namespace JSC
85
-
86
-#endif

+ 0
- 485
include/JSC_util.h View File

@@ -1,485 +0,0 @@
1
-/**********************************************************
2
-
3
-This software is part of J.-S. Caux's ABACUS library.
4
-
5
-Copyright (c).
6
-
7
------------------------------------------------------------
8
-
9
-File:  JSC_util.h
10
-
11
-Purpose:  Defines basic math functions.
12
-
13
-***********************************************************/
14
-
15
-#ifndef _JSC_UTIL_H_
16
-#define _JSC_UTIL_H_
17
-
18
-#include "JSC.h"
19
-
20
-using namespace std;
21
-
22
-typedef double DP;
23
-
24
-// Global constants
25
-
26
-const double PI = 3.141592653589793238462643;
27
-const double sqrtPI = sqrt(PI);
28
-const double twoPI = 2.0*PI;
29
-const double logtwoPI = log(twoPI);
30
-const double Euler_Mascheroni = 0.577215664901532860606;
31
-const double Gamma_min_0p5 = -2.0 * sqrt(PI);
32
-const complex<double> II(0.0,1.0);  //  Shorthand for i
33
-
34
-const DP MACHINE_EPS = numeric_limits<DP>::epsilon();
35
-const DP MACHINE_EPS_SQ = pow(MACHINE_EPS, 2.0);
36
-
37
-// Now for some basic math utilities:
38
-
39
-namespace JSC {
40
-
41
-  // File checks:
42
-
43
-  inline bool file_exists (const char* filename)
44
-  {
45
-    fstream file;
46
-    file.open(filename);
47
-    bool exists = !file.fail();
48
-    file.close();
49
-
50
-    return(exists);
51
-  }
52
-    
53
-  // Error handler:
54
-    
55
-  inline void JSCerror (const string error_text)
56
-  // my error handler
57
-  {
58
-    cerr << "Run-time error... " << endl;
59
-    cerr << error_text << endl;
60
-    cerr << "Exiting to system..." << endl;
61
-    exit(1);
62
-  }
63
-
64
-  struct Divide_by_zero {};
65
-
66
-
67
-  // Basics:  min, max, fabs
68
-
69
-  template<class T> 
70
-    inline const T max (const T& a, const T& b) { return a > b ? (a) : (b); }
71
-  
72
-  template<class T> 
73
-    inline const T min (const T& a, const T& b) { return a > b ? (b) : (a); }
74
-  
75
-  template<class T>
76
-    inline const T fabs (const T& a) { return a >= 0 ? (a) : (-a); }
77
-
78
-  inline long long int pow_lli (const long long int& base, const int& exp)
79
-    { 
80
-      long long int answer = base;
81
-      if (exp == 0) answer = 1LL;
82
-      else for (int i = 1; i < exp; ++i) answer *= base;
83
-      return(answer);
84
-    }
85
-
86
-  inline unsigned long long int pow_ulli (const unsigned long long int& base, const int& exp)
87
-    { 
88
-      unsigned long long int answer = base;
89
-      if (exp == 0) answer = 1ULL;
90
-      for (int i = 1; i < exp; ++i) answer *= base;
91
-      return(answer);
92
-    }
93
-
94
-  inline int fact (const int& N)
95
-    {
96
-      int ans = 0;
97
-
98
-      if (N < 0) {
99
-	cerr << "Error:  factorial of negative number.  Exited." << endl;
100
-	exit(1);
101
-      }
102
-      else if ( N == 1  ||  N == 0) ans = 1;
103
-      else ans = N * fact(N-1);
104
-
105
-      return(ans);
106
-    }
107
-
108
-  inline DP ln_fact (const int& N)
109
-    {
110
-      DP ans = 0.0;
111
-
112
-      if (N < 0) {
113
-	cerr << "Error:  factorial of negative number.  Exited." << endl;
114
-	exit(1);
115
-      }
116
-      else if ( N == 1  ||  N == 0) ans = 0.0;
117
-      else ans = log(DP(N)) + ln_fact(N-1);
118
-
119
-      return(ans);
120
-    }
121
-
122
-    inline long long int fact_lli (const int& N)
123
-    {
124
-      long long int ans = 0;
125
-
126
-      if (N < 0) {
127
-	cerr << "Error:  factorial of negative number.  Exited." << endl;
128
-	exit(1);
129
-      }
130
-      else if ( N == 1  ||  N == 0) ans = 1;
131
-      else ans = fact_lli(N-1) * N;
132
-
133
-      return(ans);
134
-    }
135
-
136
-    inline long long int fact_ulli (const int& N)
137
-    {
138
-      unsigned long long int ans = 0;
139
-
140
-      if (N < 0) {
141
-	cerr << "Error:  factorial of negative number.  Exited." << endl;
142
-	exit(1);
143
-      }
144
-      else if ( N == 1  ||  N == 0) ans = 1;
145
-      else ans = fact_ulli(N-1) * N;
146
-
147
-      return(ans);
148
-    }
149
-
150
-    inline int choose (const int& N1, const int& N2)
151
-    {
152
-      // returns N1 choose N2
153
-
154
-      int ans = 0;
155
-      if (N1 < N2) {
156
-	cout << "Error:  N1 smaller than N2 in choose.  Exited." << endl;
157
-	exit(1);
158
-      }
159
-      else if (N1 == N2) ans = 1;
160
-      else if (N1 < 12) ans = fact(N1)/(fact(N2) * fact(N1 - N2));
161
-      else {
162
-	ans = 1;
163
-	int mult = N1;
164
-	while (mult > max(N2, N1 - N2)) ans *= mult--;
165
-	ans /= fact(min(N2, N1 - N2));
166
-      }
167
-
168
-      return(ans);
169
-    }
170
-
171
-    inline DP ln_choose (const int& N1, const int& N2)
172
-    {
173
-      // returns the log of N1 choose N2
174
-
175
-      DP ans = 0.0;
176
-      if (N1 < N2) {
177
-	cout << "Error:  N1 smaller than N2 in choose.  Exited." << endl;
178
-	exit(1);
179
-      }
180
-      else if (N1 == N2) ans = 0.0;
181
-      else ans = ln_fact(N1) - ln_fact(N2) - ln_fact(N1 - N2);
182
-
183
-      return(ans);
184
-    }
185
-
186
-
187
-    inline long long int choose_lli (const int& N1, const int& N2)
188
-    {
189
-      // returns N1 choose N2
190
-
191
-      long long int ans = 0;
192
-      if (N1 < N2) {
193
-	cout << "Error:  N1 smaller than N2 in choose.  Exited." << endl;
194
-	exit(1);
195
-      }
196
-      else if (N1 == N2) ans = 1;
197
-      else if (N1 < 12) ans = fact_lli(N1)/(fact_lli(N2) * fact_lli(N1 - N2));
198
-      else {
199
-	// Make sure that N2 is less than or equal to N1/2;  if not, just switch...
200
-	int N2_min = min(N2, N1 - N2);
201
-
202
-	ans = 1;
203
-	for (int i = 0; i < N2_min; ++i) {
204
-	  ans *= (N1 - i);
205
-	  ans /= i + 1;
206
-	}
207
-      }
208
-
209
-      return(ans);
210
-    }
211
-
212
-    inline unsigned long long int choose_ulli (const int& N1, const int& N2)
213
-    {
214
-      // returns N1 choose N2
215
-
216
-      unsigned long long int ans = 0;
217
-      if (N1 < N2) {
218
-	cout << "Error:  N1 smaller than N2 in choose.  Exited." << endl;
219
-	exit(1);
220
-      }
221
-      else if (N1 == N2) ans = 1;
222
-      else if (N1 < 12) ans = fact_ulli(N1)/(fact_ulli(N2) * fact_ulli(N1 - N2));
223
-      else {
224
-	// Make sure that N2 is less than or equal to N1/2;  if not, just switch...
225
-	int N2_min = min(N2, N1 - N2);
226
-
227
-	ans = 1;
228
-	for (int i = 0; i < N2_min; ++i) {
229
-	  ans *= (N1 - i);
230
-	  ans /= i + 1;
231
-	}
232
-      }
233
-
234
-      return(ans);
235
-    }
236
-
237
-    inline DP SIGN (const DP &a, const DP &b) 
238
-    {
239
-      return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
240
-    }
241
-
242
-    inline DP sign_of (const DP& a)
243
-    {
244
-      return (a >= 0.0 ? 1.0 : -1.0);
245
-    }
246
-
247
-    inline int sgn_int (const int& a)
248
-    {
249
-      return (a >= 0) ? 1 : -1;
250
-    }
251
-
252
-    inline int sgn_DP (const DP& a)
253
-    {
254
-      return (a >= 0) ? 1 : -1;
255
-    }
256
-
257
-    template<class T>
258
-    inline void SWAP (T& a, T& b) {T dum = a; a = b; b = dum;}
259
-
260
-    inline int kronecker (int a, int b) 
261
-      {
262
-	return a == b ? 1 : 0;
263
-      }
264
-
265
-    template<class T>
266
-    inline bool is_nan (const T& a)
267
-      {
268
-	return(!((a < T(0.0)) || (a >= T(0.0))));
269
-      }
270
-
271
-    inline complex<DP> atan_cx(const complex<DP>& x)
272
-      {
273
-	return(-0.5 * II * log((1.0 + II* x)/(1.0 - II* x)));
274
-      }
275
-
276
-    /****************  Gamma function *******************/
277
-
278
-    inline complex<double> ln_Gamma (complex<double> z)
279
-      {
280
-	// Implementation of Lanczos method with g = 9.
281
-	// Coefficients from Godfrey 2001.
282
-	
283
-	if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
284
-	
285
-	else {
286
-
287
-	  complex<double> series = 1.000000000000000174663
288
-	    + 5716.400188274341379136/z 
289
-	    - 14815.30426768413909044/(z + 1.0)
290
-	    + 14291.49277657478554025/(z + 2.0)
291
-	    - 6348.160217641458813289/(z + 3.0)
292
-	    + 1301.608286058321874105/(z + 4.0)
293
-	    - 108.1767053514369634679/(z + 5.0)
294
-	    + 2.605696505611755827729/(z + 6.0)
295
-	    - 0.7423452510201416151527e-2 / (z + 7.0)
296
-	    + 0.5384136432509564062961e-7 / (z + 8.0)
297
-	    - 0.4023533141268236372067e-8 / (z + 9.0);
298
-	  
299
-	  return(0.5 * logtwoPI + (z - 0.5) * log(z + 8.5) - (z + 8.5) + log(series));
300
-	}
301
-	
302
-	return(log(0.0));  // never called
303
-      }
304
-
305
-    inline complex<double> ln_Gamma_old (complex<double> z)
306
-      {
307
-	// Implementation of Lanczos method with g = 9.
308
-	// Coefficients from Godfrey 2001.
309
-	
310
-	if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
311
-	
312
-	else {
313
-	  
314
-	  int g = 9;
315
-	  
316
-	  double p[11] = { 1.000000000000000174663,
317
-			   5716.400188274341379136, 
318
-			   -14815.30426768413909044,
319
-			   14291.49277657478554025,
320
-			   -6348.160217641458813289,
321
-			   1301.608286058321874105,
322
-			   -108.1767053514369634679,
323
-			   2.605696505611755827729,
324
-			   -0.7423452510201416151527e-2,
325
-			   0.5384136432509564062961e-7,
326
-			   -0.4023533141268236372067e-8 };
327
-	  
328
-	  complex<double> z_min_1 = z - 1.0;
329
-	  complex<double> series = p[0];
330
-	  for (int i = 1; i < g+2; ++i)
331
-	    series += p[i]/(z_min_1 + complex<double>(i));
332
-	  
333
-	  return(0.5 * logtwoPI + (z_min_1 + 0.5) * log(z_min_1 + complex<double>(g) + 0.5) - (z_min_1 + complex<double>(g) + 0.5) + log(series));
334
-	}
335
-	
336
-	return(log(0.0));  // never called
337
-      }
338
-
339
-    inline complex<double> ln_Gamma_2 (complex<double> z)
340
-      {
341
-	// Implementation of Lanczos method with g = 7.
342
-	
343
-	if (real(z) < 0.5) return(log(PI/(sin(PI*z)) - ln_Gamma(1.0 - z)));
344
-	
345
-	else {
346
-	  
347
-	  int g = 7;
348
-	  
349
-	  double p[9] = { 0.99999999999980993, 676.5203681218851, -1259.1392167224028,
350
-			  771.32342877765313, -176.61502916214059, 12.507343278686905,
351
-			  -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7};
352
-	  
353
-	  complex<double> z_min_1 = z - 1.0;
354
-	  complex<double> series = p[0];
355
-	  for (int i = 1; i < g+2; ++i)
356
-	    series += p[i]/(z_min_1 + complex<double>(i));
357
-
358
-	  return(0.5 * logtwoPI + (z_min_1 + 0.5) * log(z_min_1 + complex<double>(g) + 0.5) - (z_min_1 + complex<double>(g) + 0.5) + log(series));
359
-	}
360
-	
361
-	return(log(0.0));  // never called
362
-      }
363
-
364
-    /**********  Partition numbers **********/
365
-
366
-    inline long long int Partition_Function (int n)
367
-    {
368
-      // Returns the value of the partition function p(n), giving the number of partitions of n into integers.
369
-
370
-      if (n < 0) JSCerror("Calling Partition_Function for n < 0.");
371
-      else if (n == 0 || n == 1) return(1LL);
372
-      else if (n == 2) return(2LL);
373
-      else if (n == 3) return(3LL);
374
-
375
-      else {  // do recursion using pentagonal numbers
376
-	long long int pn = 0LL;
377
-	int pentnrplus, pentnrmin;  // pentagonal numbers
378
-	for (int i = 1; true; ++i) {
379
-	  pentnrplus = (i * (3*i - 1))/2;
380
-	  pentnrmin = (i * (3*i + 1))/2;
381
-	  //cout << "\ti = " << i << "pnrp = " << pentnrplus << "\tpnrm = " << pentnrmin << endl;
382
-	  if (n - pentnrplus >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrplus);
383
-	  if (n - pentnrmin >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrmin);
384
-	  else break;
385
-	}
386
-	return(pn);
387
-      }
388
-      return(-1LL);  // never called
389
-    }
390
-
391
-
392
-    /**********  Sorting **********/
393
-
394
-    /*
395
-    template<class item_type>
396
-      void QuickSort (item_type* a, int l, int r)
397
-      {
398
-	static item_type m;
399
-	static int j;
400
-	int i;
401
-	
402
-	if (r > l) {
403
-	  m = a[r]; i = l-1; j = r;
404
-	  for (;;) {
405
-	    while (a[++i] < m);
406
-	    while (a[--j] > m);
407
-	    if (i >= j) break;
408
-	    std::swap(a[i], a[j]);
409
-	  }
410
-	  std::swap(a[i], a[r]);
411
-	  QuickSort(a, l, i-1);
412
-	  QuickSort(a, i+1, r);
413
-	}
414
-      }
415
-    */
416
-
417
-  template <class T>
418
-    void QuickSort (T* V, int l, int r)
419
-    {
420
-      int i = l, j = r;
421
-      T pivot = V[l + (r-l)/2];
422
-      
423
-      while (i <= j) {
424
-	while (V[i] < pivot) i++;
425
-	while (V[j] > pivot) j--;
426
-	if (i <= j) {
427
-	  std::swap(V[i],V[j]);
428
-	  i++;
429
-	  j--;
430
-	}
431
-      };
432
-      
433
-      if (l < j) QuickSort(V, l, j);
434
-      if (i < r) QuickSort(V, i, r);
435
-    }
436
-    
437
-  /*
438
-    template<class item_type> 
439
-      void QuickSort (item_type* a, int* idx, int l, int r)
440
-      {
441
-	static item_type m;
442
-	static int j;
443
-	int i;
444
-	
445
-	if (r > l) {
446
-	  m = a[r]; i = l-1; j = r;
447
-	  for (;;) {
448
-	    while (a[++i] < m);
449
-	    while (a[--j] > m);
450
-	    if (i >= j) break;
451
-	    std::swap(a[i], a[j]);
452
-	    std::swap(idx[i], idx[j]);
453
-	  }
454
-	  std::swap(a[i], a[r]);
455
-	  std::swap(idx[i], idx[r]);
456
-	  QuickSort(a, idx, l, i-1);
457
-	  QuickSort(a, idx, i+1, r);
458
-	}
459
-      }
460
-  */
461
-  template <class T>
462
-    void QuickSort (T* V, int* index, int l, int r)
463
-    {
464
-      int i = l, j = r;
465
-      T pivot = V[l + (r-l)/2];
466
-      
467
-      while (i <= j) {
468
-	while (V[i] < pivot) i++;
469
-	while (V[j] > pivot) j--;
470
-	if (i <= j) {
471
-	  std::swap(V[i],V[j]);
472
-	  std::swap(index[i],index[j]);
473
-	  i++;
474
-	  j--;
475
-	}
476
-      };
477
-      
478
-      if (l < j) QuickSort(V, index, l, j);
479
-      if (i < r) QuickSort(V, index, i, r);
480
-    }
481
-
482
-
483
-} // namespace JSC
484
-
485
-#endif // _JS_UTIL_H_

+ 72
- 71
src/BETHE/Base.cc View File

@@ -1,6 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
4 6
 
5 7
 -----------------------------------------------------------
6 8
 
@@ -10,26 +12,25 @@ Purpose:  defines functions in Base class,
10 12
           providing a unified base object for all
11 13
           Bethe Ansatz integrable models.
12 14
 
13
-
14 15
 ***********************************************************/
15 16
 
16
-#include "JSC.h"
17
+#include "ABACUS.h"
17 18
 
18 19
 using namespace std;
19 20
 
20
-namespace JSC {
21
+namespace ABACUS {
21 22
 
22 23
   // Function definitions:  class Base
23 24
 
24 25
   Base::Base () : Charge(0), Nrap(Vect<int>()), Nraptot(0), Ix2_infty(Vect<DP>()),
25 26
 		  Ix2_max(Vect<int>()), id(0LL) {}
26
-  
27
+
27 28
   Base::Base (int N) : Charge(N), Nrap(Vect<int>(N,1)), Nraptot(N), Ix2_infty(Vect<DP>(1.0e+100,1)),
28 29
 		       Ix2_max(Vect<int>(LONG_LONG_MAX, 1)), id(N) {}
29 30
 
30 31
   Base::Base (const Base& RefBase)  // copy constructor
31
-    : Charge(RefBase.Charge), Nrap(Vect<int>(RefBase.Nrap.size())), Nraptot(RefBase.Nraptot), 
32
-      Ix2_infty(Vect<DP>(RefBase.Ix2_infty.size())), Ix2_max(Vect<int>(RefBase.Ix2_max.size())), id(RefBase.id) 
32
+    : Charge(RefBase.Charge), Nrap(Vect<int>(RefBase.Nrap.size())), Nraptot(RefBase.Nraptot),
33
+      Ix2_infty(Vect<DP>(RefBase.Ix2_infty.size())), Ix2_max(Vect<int>(RefBase.Ix2_max.size())), id(RefBase.id)
33 34
   {
34 35
     for (int i = 0; i < Nrap.size(); ++i) {
35 36
       Nrap[i] = RefBase.Nrap[i];
@@ -40,7 +41,7 @@ namespace JSC {
40 41
 
41 42
   /*
42 43
   // DEPRECATED
43
-  Base::Base (const Heis_Chain& RefChain, int M) 
44
+  Base::Base (const Heis_Chain& RefChain, int M)
44 45
     : Charge(M), Nrap(Vect<int>(RefChain.Nstrings)), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings))
45 46
   {
46 47
     for (int i = 0; i < RefChain.Nstrings; ++i) Nrap[i] = 0;
@@ -48,17 +49,17 @@ namespace JSC {
48 49
 
49 50
     Nraptot = 0;
50 51
     for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
51
-    
52
+
52 53
     // The id of this is zero by definition
53 54
     id = 0LL;
54 55
 
55 56
     // Now compute the Ix2_infty numbers
56
-    
57
+
57 58
     (*this).Compute_Ix2_limits(RefChain);
58 59
 
59 60
   }
60 61
   */
61
-  Base::Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities) 
62
+  Base::Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities)
62 63
     : Charge(0), Nrap(Nrapidities), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings)),
63 64
       id (0LL)
64 65
   {
@@ -66,16 +67,16 @@ namespace JSC {
66 67
     // Check consistency of Nrapidities vector with RefChain
67 68
 
68 69
     //if (RefChain.Nstrings != Nrapidities.size()) cout << "error:  Nstrings = " << RefChain.Nstrings << "\tNrap.size = " << Nrapidities.size() << endl;
69
-    
70
-    if (RefChain.Nstrings != Nrapidities.size()) JSCerror("Incompatible Nrapidities vector used in Base constructor.");
71
-    
70
+
71
+    if (RefChain.Nstrings != Nrapidities.size()) ABACUSerror("Incompatible Nrapidities vector used in Base constructor.");
72
+
72 73
     int Mcheck = 0;
73 74
     for (int i = 0; i < RefChain.Nstrings; ++i) Mcheck += RefChain.Str_L[i] * Nrap[i];
74 75
     Charge = Mcheck;
75
-    
76
+
76 77
     Nraptot = 0;
77 78
     for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
78
-    
79
+
79 80
     // Compute id
80 81
     id += Nrapidities[0];
81 82
     long long int factor = 100000LL;
@@ -87,10 +88,10 @@ namespace JSC {
87 88
     // Now compute the Ix2_infty numbers
88 89
 
89 90
     (*this).Compute_Ix2_limits(RefChain);
90
-    
91
+
91 92
   }
92 93
 
93
-  Base::Base (const Heis_Chain& RefChain, long long int id_ref) 
94
+  Base::Base (const Heis_Chain& RefChain, long long int id_ref)
94 95
     : Charge(0), Nrap(Vect<int>(RefChain.Nstrings)), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings)),
95 96
       id (id_ref)
96 97
   {
@@ -108,18 +109,18 @@ namespace JSC {
108 109
     //id = id_ref;
109 110
 
110 111
     //cout << "In Base constructor:  id_ref = " << id_ref << " and Nrapidities = " << Nrap << endl;
111
-    
112
+
112 113
     // Check consistency of Nrapidities vector with RefChain
113 114
 
114
-    //if (RefChain.Nstrings != Nrap.size()) JSCerror("Incompatible Nrapidities vector used in Base constructor.");
115
-    
115
+    //if (RefChain.Nstrings != Nrap.size()) ABACUSerror("Incompatible Nrapidities vector used in Base constructor.");
116
+
116 117
     int Mcheck = 0;
117 118
     for (int i = 0; i < RefChain.Nstrings; ++i) Mcheck += RefChain.Str_L[i] * Nrap[i];
118 119
     Charge = Mcheck;
119
-    
120
+
120 121
     Nraptot = 0;
121 122
     for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
122
-    
123
+
123 124
     // Now compute the Ix2_infty numbers
124 125
 
125 126
     (*this).Compute_Ix2_limits(RefChain);
@@ -138,7 +139,7 @@ namespace JSC {
138 139
     }
139 140
     return(*this);
140 141
   }
141
-  
142
+
142 143
   bool Base::operator== (const Base& RefBase)
143 144
   {
144 145
     bool answer = (Nrap == RefBase.Nrap);
@@ -159,39 +160,39 @@ namespace JSC {
159 160
     if ((RefChain.Delta > 0.0) && (RefChain.Delta < 1.0)) {
160 161
 
161 162
       // Compute the Ix2_infty numbers
162
-    
163
+
163 164
       DP sum1 = 0.0;
164 165
       DP sum2 = 0.0;
165
-      
166
+
166 167
       for (int j = 0; j < RefChain.Nstrings; ++j) {
167
-	
168
+
168 169
 	sum1 = 0.0;
169
-	
170
+
170 171
 	for (int k = 0; k < RefChain.Nstrings; ++k) {
171
-	  
172
+
172 173
 	  sum2 = 0.0;
173
-	  
174
-	  sum2 += (RefChain.Str_L[j] == RefChain.Str_L[k]) ? 0.0 : 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k]) 
174
+
175
+	  sum2 += (RefChain.Str_L[j] == RefChain.Str_L[k]) ? 0.0 : 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
175 176
 										  - 0.5 * fabs(RefChain.Str_L[j] - RefChain.Str_L[k]) * RefChain.anis));
176
-	  sum2 += 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k]) 
177
+	  sum2 += 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
177 178
 				 - 0.5 * (RefChain.Str_L[j] + RefChain.Str_L[k]) * RefChain.anis));
178
-	  
179
-	  for (int a = 1; a < JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]); ++a)
180
-	    sum2 += 2.0 * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k]) 
179
+
180
+	  for (int a = 1; a < ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]); ++a)
181
+	    sum2 += 2.0 * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
181 182
 					 - 0.5 * (fabs(RefChain.Str_L[j] - RefChain.Str_L[k]) + 2.0*a) * RefChain.anis));
182
-	  
183
+
183 184
 	  sum1 += (Nrap[k] - ((j == k) ? 1 : 0)) * sum2;
184 185
 	}
185
-	
186
-	Ix2_infty[j] = (1.0/PI) * fabs(RefChain.Nsites * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j]) 
186
+
187
+	Ix2_infty[j] = (1.0/PI) * fabs(RefChain.Nsites * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j])
187 188
 								      - 0.5 * RefChain.Str_L[j] * RefChain.anis)) - sum1);
188
-	
189
+
189 190
       }  // The Ix2_infty are now set.
190 191
 
191 192
       // Now compute the Ix2_max limits
192
-      
193
+
193 194
       for (int j = 0; j < RefChain.Nstrings; ++j) {
194
-	
195
+
195 196
 	Ix2_max[j] = int(floor(Ix2_infty[j]));  // sets basic integer
196 197
 
197 198
 	// Reject formally infinite rapidities (i.e. if Delta is root of unity)
@@ -205,7 +206,7 @@ namespace JSC {
205 206
 	if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
206 207
 
207 208
 	while (Ix2_max[j] > RefChain.Nsites) {
208
-	  Ix2_max[j] -= 2;  
209
+	  Ix2_max[j] -= 2;
209 210
 	}
210 211
       }
211 212
     } // if XXZ gapless
@@ -213,41 +214,41 @@ namespace JSC {
213 214
     else if (RefChain.Delta == 1.0) {
214 215
 
215 216
       // Compute the Ix2_infty numbers
216
-    
217
+
217 218
       int sum1 = 0;
218
-      
219
+
219 220
       for (int j = 0; j < RefChain.Nstrings; ++j) {
220
-	
221
+
221 222
 	sum1 = 0;
222
-	
223
+
223 224
 	for (int k = 0; k < RefChain.Nstrings; ++k) {
224
-	  
225
-	  sum1 += Nrap[k] * (2 * JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
225
+
226
+	  sum1 += Nrap[k] * (2 * ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
226 227
 	}
227
-	
228
+
228 229
 	//Ix2_infty[j] = (RefChain.Nsites - 1.0 + 2.0 * RefChain.Str_L[j] - sum1);
229 230
 	Ix2_infty[j] = (RefChain.Nsites + 1.0 - sum1); // to get counting right...
230
-	
231
+
231 232
       }  // The Ix2_infty are now set.
232
-      
233
+
233 234
       // Now compute the Ix2_max limits
234
-      
235
+
235 236
       for (int j = 0; j < RefChain.Nstrings; ++j) {
236 237
 
237 238
 	Ix2_max[j] = int(floor(Ix2_infty[j]));  // sets basic integer
238 239
 
239 240
 	// Give the correct parity to Ix2_max
240
-	
241
+
241 242
 	// If Nrap is even, Ix2_max must be odd.  If odd, then even.
242 243
 
243 244
 	if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
244 245
 
245 246
 	// If Ix2_max equals Ix2_infty, we reduce it by 2:
246
-	
247
+
247 248
 	if (Ix2_max[j] == int(Ix2_infty[j])) Ix2_max[j] -= 2;
248
-	
249
+
249 250
 	while (Ix2_max[j] > RefChain.Nsites) {
250
-	  Ix2_max[j] -= 2;  
251
+	  Ix2_max[j] -= 2;
251 252
 	}
252 253
       }
253 254
 
@@ -256,40 +257,40 @@ namespace JSC {
256 257
     else if (RefChain.Delta > 1.0) {
257 258
 
258 259
       // Compute the Ix2_infty numbers
259
-      
260
+
260 261
       int sum1 = 0;
261
-      
262
+
262 263
       for (int j = 0; j < RefChain.Nstrings; ++j) {
263
-	
264
+
264 265
 	sum1 = 0;
265
-	
266
+
266 267
 	for (int k = 0; k < RefChain.Nstrings; ++k) {
267
-	  
268
-	  sum1 += Nrap[k] * (2 * JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
268
+
269
+	  sum1 += Nrap[k] * (2 * ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
269 270
 	}
270
-	
271
+
271 272
 	Ix2_infty[j] = (RefChain.Nsites - 1 + 2 * RefChain.Str_L[j] - sum1);
272
-	
273
+
273 274
       }  // The Ix2_infty are now set.
274
-      
275
+
275 276
       // Now compute the Ix2_max limits
276
-      
277
+
277 278
       for (int j = 0; j < RefChain.Nstrings; ++j) {
278
-	
279
+
279 280
 	Ix2_max[j] = int(floor(Ix2_infty[j]));  // sets basic integer
280 281
 
281 282
 	// Give the correct parity to Ix2_max
282
-	
283
+
283 284
 	// If Nrap is even, Ix2_max must be odd.  If odd, then even.
284 285
 
285 286
 	if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
286
-	
287
+
287 288
 	// If Ix2_max equals Ix2_infty, we reduce it by 2:
288 289
 
289 290
 	//if (Ix2_max[j] == Ix2_infty[j]) Ix2_max[j] -= 2;
290 291
 
291 292
 	while (Ix2_max[j] > RefChain.Nsites) {
292
-	  Ix2_max[j] -= 2;  
293
+	  Ix2_max[j] -= 2;
293 294
 	}
294 295
 
295 296
 	// Fudge, for strings:
@@ -304,4 +305,4 @@ namespace JSC {
304 305
 
305 306
 
306 307
 
307
-} // namespace JSC
308
+} // namespace ABACUS

+ 6
- 7
src/BETHE/Bethe_State.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,18 +12,17 @@ Purpose:  defines functions in Bethe_State class,
12 12
           providing a unified object for eigenstates of all
13 13
           Bethe Ansatz integrable models.
14 14
 
15
-
16
-
15
+IN DEVELOPMENT
17 16
 
18 17
 ***********************************************************/
19 18
 
20
-#include "JSC.h"
19
+#include "ABACUS.h"
21 20
 
22 21
 using namespace std;
23 22
 
24
-namespace JSC {
23
+namespace ABACUS {
25 24
 
26 25
   Bethe_State::Bethe_State (long long int base_id_ref, long long int type_id_ref, long long int id_ref, long long int maxid_ref) :
27 26
     base_id(base_id_ref), type_id(type_id_ref), id(id_ref), maxid(maxid_ref) {}
28 27
 
29
-} // namespace JSC
28
+} // namespace ABACUS

+ 41
- 44
src/BETHE/Offsets.cc View File

@@ -1,25 +1,22 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 2006-9.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  src/BETHE/Offsets.cc
10 10
 
11 11
 Purpose:  defines functions in Offsets class.
12
-          
13
-
14
-Last modified:  19/10/2009
15 12
 
16 13
 ***********************************************************/
17 14
 
18
-#include "JSC.h"
15
+#include "ABACUS.h"
19 16
 
20 17
 using namespace std;
21 18
 
22
-namespace JSC {
19
+namespace ABACUS {
23 20
 
24 21
   //  Function definitions:  class Offsets
25 22
 
@@ -31,7 +28,7 @@ namespace JSC {
31 28
     for (int i = 0; i < 2 * base.Nrap.size() + 2; ++i) Tableau[i] = RefOffset.Tableau[i];
32 29
   }
33 30
 
34
-  Offsets::Offsets (const Heis_Base& RefBase, long long int req_type_id) 
31
+  Offsets::Offsets (const Heis_Base& RefBase, long long int req_type_id)
35 32
   // sets all tableaux to empty ones, with nparticles(req_type_id) at each level
36 33
   {
37 34
     // Build nparticles vector from req_type_id
@@ -47,9 +44,9 @@ namespace JSC {
47 44
 
48 45
     // Check if we've got the right vector...
49 46
     long long int idcheck = Offsets_type_id (nparticles);
50
-    if (idcheck != req_type_id) JSCerror("idcheck != req_type_id in Offsets constructor.");
47
+    if (idcheck != req_type_id) ABACUSerror("idcheck != req_type_id in Offsets constructor.");
51 48
 
52
-    (*this) = Offsets(RefBase, nparticles);    
49
+    (*this) = Offsets(RefBase, nparticles);
53 50
   }
54 51
 
55 52
   Offsets::Offsets (const Heis_Base& RefBase, Vect<int> nparticles) // sets all tableaux to empty ones, with nparticles at each level
@@ -58,43 +55,43 @@ namespace JSC {
58 55
 
59 56
     // Checks on nparticles vector:
60 57
 
61
-    if (nparticles.size() != 2 * base.Nrap.size() + 2) JSCerror("Wrong nparticles.size in Offsets constructor.");
62
-    
63
-    //if (base.Nrap[0] != (nparticles[3] + nparticles[2] + base.Mdown - nparticles[0] - nparticles[1])) JSCerror("Wrong Nrap[0] in Offsets constructor.");
58
+    if (nparticles.size() != 2 * base.Nrap.size() + 2) ABACUSerror("Wrong nparticles.size in Offsets constructor.");
59
+
60
+    //if (base.Nrap[0] != (nparticles[3] + nparticles[2] + base.Mdown - nparticles[0] - nparticles[1])) ABACUSerror("Wrong Nrap[0] in Offsets constructor.");
64 61
     if (nparticles[3] + nparticles[2] != nparticles[0] + nparticles[1]) {
65 62
       cout << nparticles[0] << "\t" << nparticles[1] << "\t" << nparticles[2] << "\t" << nparticles[3] << endl;
66
-      JSCerror("Wrong Npar[0-3] in Offsets constructor.");
63
+      ABACUSerror("Wrong Npar[0-3] in Offsets constructor.");
67 64
     }
68 65
 
69
-    for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level) 
66
+    for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
70 67
       if (base.Nrap[base_level] != nparticles[2*base_level + 2] + nparticles[2*base_level + 3]) {
71 68
 	cout << base_level << "\t" << base.Nrap[base_level] << "\t" << nparticles[2*base_level + 2] << "\t" <<  nparticles[2*base_level + 3] << endl;
72
-	JSCerror("Wrong Nrap[] in Offsets constructor.");
69
+	ABACUSerror("Wrong Nrap[] in Offsets constructor.");
73 70
       }
74 71
 
75 72
     // nparticles[0,1]:  number of holes on R and L side in GS interval
76
-    if (nparticles[0] > (base.Nrap[0] + 1)/2) JSCerror("nparticles[0] too large in Offsets constructor.");
77
-    if (nparticles[1] > base.Nrap[0]/2) JSCerror("nparticles[1] too large in Offsets constructor.");
73
+    if (nparticles[0] > (base.Nrap[0] + 1)/2) ABACUSerror("nparticles[0] too large in Offsets constructor.");
74
+    if (nparticles[1] > base.Nrap[0]/2) ABACUSerror("nparticles[1] too large in Offsets constructor.");
78 75
 
79 76
     // nparticles[2,3]:  number of particles of type 0 on R and L side out of GS interval
80
-    if (nparticles[2] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) JSCerror("nparticles[2] too large in Offsets constructor.");
81
-    if (nparticles[3] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) JSCerror("nparticles[3] too large in Offsets constructor.");
77
+    if (nparticles[2] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) ABACUSerror("nparticles[2] too large in Offsets constructor.");
78
+    if (nparticles[3] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) ABACUSerror("nparticles[3] too large in Offsets constructor.");
82 79
 
83 80
     for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
84 81
       if ((nparticles[2*base_level + 2] > 0 && nparticles[2*base_level + 2] > (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
85 82
 	  //|| (nparticles[2*base_level + 3] > 0 && nparticles[2*base_level + 3] > (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2)) {
86
-	  || (nparticles[2*base_level + 3] > 0 
83
+	  || (nparticles[2*base_level + 3] > 0
87 84
 	      && nparticles[2*base_level + 3] > base.Ix2_max[base_level] + 1 - (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)) {
88 85
 	cout << base_level << "\t" << nparticles[2*base_level + 2] << "\t" << (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2
89
-	     << "\t" << nparticles[2*base_level + 3] << "\t" << (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2 
86
+	     << "\t" << nparticles[2*base_level + 3] << "\t" << (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2
90 87
 	     << "\t" << (nparticles[2*base_level + 2] > 0) << "\t" << (nparticles[2*base_level + 2] > (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
91 88
 	  //<< "\t" << (nparticles[2*base_level + 3] > 0) << "\t" << (nparticles[2*base_level + 3] > (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2)
92
-	     << "\t" << (nparticles[2*base_level + 3] > 0) << "\t" 
89
+	     << "\t" << (nparticles[2*base_level + 3] > 0) << "\t"
93 90
 	     << (nparticles[2*base_level + 3] > base.Ix2_max[base_level] + 1 - (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
94 91
 	     << endl;
95
-	JSCerror("nparticles too large in Offsets constructor.");
92
+	ABACUSerror("nparticles too large in Offsets constructor.");
96 93
       }
97
-    
94
+
98 95
     // Check sum of rapidities
99 96
 
100 97
     // Holes in GS interval
@@ -104,14 +101,14 @@ namespace JSC {
104 101
     // Particles of type 0 out of GS interval
105 102
     Tableau[2] = Young_Tableau(nparticles[2], (base.Ix2_max[0] - base.Nrap[0] + 1)/2 - nparticles[2], Tableau[0]);
106 103
     Tableau[3] = Young_Tableau(nparticles[3], (base.Ix2_max[0] - base.Nrap[0] + 1)/2 - nparticles[3], Tableau[2]);
107
-    
104
+
108 105
     // Tableaux of index i = 2,...:  data about string type i/2-1.
109 106
     for (int base_level = 1; base_level < base.Nrap.size(); ++base_level) {
110
-      Tableau[2*base_level + 2] = Young_Tableau(nparticles[2*base_level + 2], 
107
+      Tableau[2*base_level + 2] = Young_Tableau(nparticles[2*base_level + 2],
111 108
 						//(base.Ix2_max[base_level] - ((base.Nrap[base_level]) % 2) + 2)/2 - nparticles[2*base_level + 2], Tableau[2]);
112 109
 						//(base.Ix2_max[base_level] - base.Nrap[base_level] % 2 + 2)/2 - nparticles[2*base_level + 2], Tableau[2]);
113 110
 						(base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2))/2 + 1 - nparticles[2*base_level + 2], Tableau[2]);
114
-      Tableau[2*base_level + 3] = Young_Tableau(nparticles[2*base_level + 3], 
111
+      Tableau[2*base_level + 3] = Young_Tableau(nparticles[2*base_level + 3],
115 112
 						//(base.Ix2_max[base_level] - base.Nrap[base_level] % 2)/2 - nparticles[2*base_level + 3], Tableau[3]);
116 113
 						(base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2 + 1 - nparticles[2*base_level + 3], Tableau[3]);
117 114
     }
@@ -147,11 +144,11 @@ namespace JSC {
147 144
     for (int level = 0; level < 4; ++level) { // check fundamental level only
148 145
       //for (int level = 0; level < 2 * base.Nrap.size() + 2; ++level) {
149 146
       // First check whether all rows which exist in both tableaux satisfy rule:
150
-      for (int tableau_level = 0; tableau_level < JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
151
-	if (Tableau[level].Row_L[tableau_level] > RefOffsets.Tableau[level].Row_L[tableau_level]) 
147
+      for (int tableau_level = 0; tableau_level < ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
148
+	if (Tableau[level].Row_L[tableau_level] > RefOffsets.Tableau[level].Row_L[tableau_level])
152 149
 	  answer = false;
153 150
       // Now check whether there exist extra rows violating rule:
154
-      for (int tableau_level = JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < Tableau[level].Nrows; ++tableau_level)
151
+      for (int tableau_level = ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < Tableau[level].Nrows; ++tableau_level)
155 152
 	if (Tableau[level].Row_L[tableau_level] > 0) answer = false;
156 153
     }
157 154
 
@@ -167,11 +164,11 @@ namespace JSC {
167 164
     for (int level = 0; level < 4; ++level) { // check fundamental level only
168 165
       //for (int level = 0; level < 2 * base.Nrap.size() + 2; ++level) {
169 166
       // First check whether all rows which exist in both tableaux satisfy rule:
170
-      for (int tableau_level = 0; tableau_level < JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
171
-	if (Tableau[level].Row_L[tableau_level] < RefOffsets.Tableau[level].Row_L[tableau_level]) 
167
+      for (int tableau_level = 0; tableau_level < ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
168
+	if (Tableau[level].Row_L[tableau_level] < RefOffsets.Tableau[level].Row_L[tableau_level])
172 169
 	  answer = false;
173 170
       // Now check whether there exist extra rows violating rule:
174
-      for (int tableau_level = JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < RefOffsets.Tableau[level].Nrows; ++tableau_level)
171
+      for (int tableau_level = ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < RefOffsets.Tableau[level].Nrows; ++tableau_level)
175 172
 	if (RefOffsets.Tableau[level].Row_L[tableau_level] > 0) answer = false;
176 173
     }
177 174
 
@@ -190,13 +187,13 @@ namespace JSC {
190 187
 
191 188
   void Offsets::Set_to_id (long long int idnr)
192 189
   {
193
-    // The idnr of the Offset is given by 
190
+    // The idnr of the Offset is given by
194 191
     // sub_id[0] + (total number of tableaux of type 0) * (sub_id[1] + (total number of tableaux of type 1) * (sub_id[2] + ...
195 192
     // + total number of tableaux of type (2*base.Nrap.size()) * sub_id[2*base.Nrap.size() + 1]
196 193
 
197 194
     if (idnr > maxid) {
198 195
       cout << idnr << "\t" << maxid << endl;
199
-      JSCerror("idnr too large in offsets.Set_to_id.");
196
+      ABACUSerror("idnr too large in offsets.Set_to_id.");
200 197
     }
201 198
 
202 199
     id = idnr;
@@ -223,7 +220,7 @@ namespace JSC {
223 220
 
224 221
     for (int i = 0; i <= 2*base.Nrap.size() + 1; ++i) {
225 222
       //cout << "level = " << i << " Tableau.id = " << sub_id[i] << endl;
226
-      if ((Tableau[i].Nrows * Tableau[i].Ncols == 0) && (sub_id[i] != 0)) JSCerror("index too large in offset.Set_to_id.");
223
+      if ((Tableau[i].Nrows * Tableau[i].Ncols == 0) && (sub_id[i] != 0)) ABACUSerror("index too large in offset.Set_to_id.");
227 224
       if (Tableau[i].id != sub_id[i]) Tableau[i].Set_to_id(sub_id[i]);
228 225
     }
229 226
 
@@ -235,7 +232,7 @@ namespace JSC {
235 232
   void Offsets::Compute_id ()
236 233
   {
237 234
     long long int prod_maxid = 1LL;
238
-    
235
+
239 236
     id = 0LL;
240 237
 
241 238
     for (int i = 0; i < 2*base.Nrap.size() + 2; ++i) {
@@ -251,14 +248,14 @@ namespace JSC {
251 248
     // this function provides the full set of descendents (either at the same momentum if
252 249
     // fixed_iK == true, or not) by returning a vector of all descendent id's (leaving the
253 250
     // base and type invariant), which can then be used for further calculations.
254
-    
251
+
255 252
     // This set of descendents is meant to be used when calculating either partition functions
256 253
     // or zero-temperature correlation functions.
257
-    
258
-    // IMPORTANT ASSUMPTIONS:  
254
+
255
+    // IMPORTANT ASSUMPTIONS:
259 256
     // - all even sectors consistently increase/decrease momentum for increasing tableau row length
260 257
     // - all odd  sectors consistently decrease/increase momentum for increasing tableau row length
261
-    
258
+
262 259
     // FOR FIXED MOMENTUM:
263 260
     // all tableau levels `above' the lowest occupied one are descended as for fixed_iK == false,
264 261
     // and the lowest sector's highest tableau level's row length is modified (increased or decreased by one
@@ -269,9 +266,9 @@ namespace JSC {
269 266
     Vect<Young_Tableau> Tableau_ref = (*this).Tableau;
270 267
     Vect<Young_Tableau> Tableau_desc = Tableau_ref;
271 268
 
272
-    
269
+
273 270
   }
274 271
 
275 272
 
276 273
 
277
-} // namespace JSC
274
+} // namespace ABACUS

+ 7
- 9
src/COMBI/Combinatorics.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's C++ library.
4 4
 
5
-Copyright (c) 2006.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,15 +10,13 @@ Combinatorics.cc
10 10
 
11 11
 Defines all class related to combinatorics.
12 12
 
13
-LAST MODIFIED:  04/09/06
14
-
15 13
 ******************************************************************/
16 14
 
17
-#include "JSC.h"
15
+#include "ABACUS.h"
18 16
 
19 17
 using namespace std;
20 18
 
21
-namespace JSC {
19
+namespace ABACUS {
22 20
 
23 21
   Choose_Table::Choose_Table ()
24 22
     : Npower(0ULL), Npowerp1(1ULL), table(new unsigned long long int[1])
@@ -33,7 +31,7 @@ namespace JSC {
33 31
 
34 32
     // We can only go up to ULL_MAX:
35 33
     if (log(DP(ULLONG_MAX)) < DP(Npowerp1) * log(2.0))
36
-      JSCerror("Choose_Table:  too large to contruct.");
34
+      ABACUSerror("Choose_Table:  too large to contruct.");
37 35
 
38 36
     table = new unsigned long long int[dim];
39 37
 
@@ -62,8 +60,8 @@ namespace JSC {
62 60
 
63 61
   unsigned long long int Choose_Table::choose(int N, int M)
64 62
   {
65
-    if (N < 0 || N > Npower) JSCerror("N out of bounds in choose(N,M).");
66
-    if (M < 0 || M > Npower) JSCerror("M out of bounds in choose(N,M).");
63
+    if (N < 0 || N > Npower) ABACUSerror("N out of bounds in choose(N,M).");
64
+    if (M < 0 || M > Npower) ABACUSerror("M out of bounds in choose(N,M).");
67 65
 
68 66
     return(table[Npowerp1 * N + M]);
69 67
   }
@@ -86,4 +84,4 @@ namespace JSC {
86 84
   }
87 85
 
88 86
 
89
-} // namespace JSC
87
+} // namespace ABACUS

+ 8
- 9
src/EXECS/2CBG_ThLim.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,18 +10,17 @@ File:  2CBG_ThLim.cc
10 10
 
11 11
 Purpose:  solves the TBA equations for the 2-component Bose gas
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, const char* argv[])
22 21
 {
23 22
 
24
-  if (argc != 7) JSCerror("Wrong number of arguments to 2CBG_ThLim executable.  Use c(best to set to 1), mu, Omega, kBT, TT(minutes), bool Save_data (0 == false).");
23
+  if (argc != 7) ABACUSerror("Wrong number of arguments to 2CBG_ThLim executable.  Use c(best to set to 1), mu, Omega, kBT, TT(minutes), bool Save_data (0 == false).");
25 24
 
26 25
   DP c_int = atof(argv[1]);
27 26
   DP mu = atof(argv[2]);
@@ -30,10 +29,10 @@ int main(int argc, const char* argv[])
30 29
   int Max_Secs = 60 * atoi(argv[5]);
31 30
   bool Save_data = bool(atoi(argv[6]));
32 31
 
33
-  if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
34
-  if (Omega <= 0.0) JSCerror("Give a strictly positive Omega, otherwise the algorithm cannot converge.");
35
-  if (kBT <= 0.0) JSCerror("Negative T ?  You must be a string theorist.");
36
-  if (Max_Secs < 10) JSCerror("Give more time.");
32
+  if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
33
+  if (Omega <= 0.0) ABACUSerror("Give a strictly positive Omega, otherwise the algorithm cannot converge.");
34
+  if (kBT <= 0.0) ABACUSerror("Negative T ?  You must be a string theorist.");
35
+  if (Max_Secs < 10) ABACUSerror("Give more time.");
37 36
 
38 37
   //cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
39 38
 

+ 10
- 10
src/EXECS/Analyze_RAW_File.cc View File

@@ -1,28 +1,28 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Analyze_RAW_File.cc
10 10
 
11 11
 Purpose:  give some statistics for the matrix element distribution in a raw file.
12
-          
12
+
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23
-  if (argc != 4) { 
23
+  if (argc != 4) {
24 24
     cout << "Argument needed: rawfile, iKmin, iKmax." << endl;
25
-    JSCerror("");
25
+    ABACUSerror("");
26 26
   }
27 27
 
28 28
   const char* rawfilename = argv[1];
@@ -33,7 +33,7 @@ int main(int argc, char* argv[])
33 33
   RAW_infile.open(rawfilename);
34 34
   if (RAW_infile.fail()) {
35 35
     cout << rawfilename << endl;
36
-    JSCerror("Could not open RAW_infile... "); 
36
+    ABACUSerror("Could not open RAW_infile... ");
37 37
   }
38 38
 
39 39
   DP omega;
@@ -72,7 +72,7 @@ int main(int argc, char* argv[])
72 72
 
73 73
   RAW_infile.close();
74 74
 
75
-  cout << "Inverse participation ratio: \t" << sumFF4/(sumFFsq*sumFFsq) << endl; 
75
+  cout << "Inverse participation ratio: \t" << sumFF4/(sumFFsq*sumFFsq) << endl;
76 76
   // Entropy is -sum (FFsq/sumFFsq) * ln(FFsq/sumFFsq) = sum (FFsq lnFFsq - FFsq ln sumFFsq)/sumFFsq
77 77
   cout << "Entropy: \t" << -(sumFFsqlnFFsq - sumFFsq * log(sumFFsq))/sumFFsq << endl;
78 78
 

+ 16
- 17
src/EXECS/Check_RAW_File.cc View File

@@ -2,24 +2,24 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Check_RAW_File.cc
10 10
 
11
-Purpose:  from a .raw_srt file, check that nonzero momentum states 
11
+Purpose:  from a .raw_srt file, check that nonzero momentum states
12 12
           appear (only) twice, and zero momentum ones (only) once.
13
-          
13
+
14 14
 ***********************************************************/
15 15
 
16
-#include "JSC.h"
16
+#include "ABACUS.h"
17 17
 
18 18
 using namespace std;
19
-using namespace JSC;
19
+using namespace ABACUS;
20 20
 
21 21
 
22
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
23 23
 {
24 24
   if (argc != 7) { // print out some instructions
25 25
     cout << "Usage of Check_RAW_File executable:  provide the following arguments:" << endl;
@@ -29,7 +29,7 @@ int main(int argc, char* argv[])
29 29
 
30 30
   char* rawfilename = argv[1];
31 31
   int iKmin = atoi(argv[2]);
32
-  int iKmax = atoi(argv[3]); 
32
+  int iKmax = atoi(argv[3]);
33 33
   int sympoint = atoi(argv[4]);
34 34
   DP FFmin = atof(argv[5]);
35 35
   int check_option = atoi(argv[6]);
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
38 38
     RAW_infile.open(rawfilename);
39 39
     if (RAW_infile.fail()) {
40 40
       cout << rawfilename << endl;
41
-      JSCerror("Could not open sorted RAW_infile... "); 
41
+      ABACUSerror("Could not open sorted RAW_infile... ");
42 42
     }
43 43
 
44 44
     DP omega_next, omega, omega_prev;
@@ -88,14 +88,14 @@ int main(int argc, char* argv[])
88 88
       //   << omega_next << "\t" << iK_next << "\t" << FF_next << "\t" << label_next << endl;
89 89
       line++;
90 90
 
91
-      if (label.compare(label_next) == 0) 
91
+      if (label.compare(label_next) == 0)
92 92
 	cout << "Identical labels around line " << line << ": " << endl
93 93
 	     << omega << "\t" << iK << "\t" << FF << "\t" << dev << "\t" << label << endl;
94
-      
95
-      if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax 
94
+
95
+      if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
96 96
 	  && fabs((FF - FF_prev)/(FF + FF_prev)) > 1.0e-6 && fabs((FF - FF_next)/(FF + FF_next)) > 1.0e-6) {
97
-	
98
-	cout << "State missing around line " << line << ": " << endl 
97
+
98
+	cout << "State missing around line " << line << ": " << endl
99 99
 	  //<< omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << conv_prev << "\t" << label_prev << endl
100 100
 	     << omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << dev_prev << "\t" << label_prev << endl
101 101
 	  //<< omega << "\t" << iK << "\t" << FF << "\t" << conv << "\t" << label << endl
@@ -119,10 +119,10 @@ int main(int argc, char* argv[])
119 119
 	cin >> a;
120 120
       }
121 121
 
122
-      if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax 
122
+      if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
123 123
 	  && fabs((omega - omega_prev)/(omega + omega_prev)) > 1.0e-6 && fabs((omega - omega_next)/(omega + omega_next)) > 1.0e-6) {
124
-	
125
-	cout << "State missing around line " << line << ": " << endl 
124
+
125
+	cout << "State missing around line " << line << ": " << endl
126 126
 	     << omega_prev << "\t" << iK_prev << "\t" << dev_prev << "\t" << label_prev << endl
127 127
 	     << omega << "\t" << iK << "\t" << dev << "\t" << label << endl
128 128
 	     << omega_next << "\t" << iK_next << "\t" << dev_next << "\t" << label_next << endl;
@@ -144,4 +144,3 @@ int main(int argc, char* argv[])
144 144
 
145 145
     return(0);
146 146
 }
147
-

+ 9
- 10
src/EXECS/Heis_DSF.cc View File

@@ -1,29 +1,29 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Heis_DSF.cc
10 10
 
11
-Purpose:  main function for ABACUS++ for Heisenberg spin-1/2 chain
11
+Purpose:  main function for ABACUS for Heisenberg spin-1/2 chain
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 8) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of Heis_DSF executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
@@ -81,7 +81,7 @@ int main(int argc, char* argv[])
81 81
       argsfile.open(argv[1]);
82 82
       if (argsfile.fail()) {
83 83
 	cout << argv[1] << endl;
84
-	JSCerror("Could not open arguments file.");
84
+	ABACUSerror("Could not open arguments file.");
85 85
       }
86 86
 
87 87
     char junk[256];
@@ -134,9 +134,8 @@ int main(int argc, char* argv[])
134 134
     Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, refine);
135 135
   }
136 136
 
137
-  else JSCerror("Wrong number of arguments to Heis_DSF executable.");
137
+  else ABACUSerror("Wrong number of arguments to Heis_DSF executable.");
138 138
   */
139 139
 
140 140
   return(0);
141 141
 }
142
-

+ 10
- 11
src/EXECS/Heis_DSF_GeneralState.cc View File

@@ -1,29 +1,29 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Heis_DSF_GeneralState.cc
10 10
 
11
-Purpose:  main function for ABACUS++ for Heisenberg spin-1/2 chain
11
+Purpose:  main function for ABACUS for Heisenberg spin-1/2 chain
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 9) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of Heis_DSF executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
68 68
     Ix2_input_file.open(filename_Cstr);
69 69
     if (Ix2_input_file.fail()) {
70 70
       cout << filename_Cstr << endl;
71
-      JSCerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
71
+      ABACUSerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
72 72
     }
73 73
 
74 74
     Heis_Chain chain(1.0, Delta, 0.0, N);
@@ -111,7 +111,7 @@ int main(int argc, char* argv[])
111 111
       }
112 112
       AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
113 113
       AveragingState.Compute_All(true);
114
-      
114
+
115 115
       // Perform the scan:
116 116
       Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
117 117
     }
@@ -122,7 +122,7 @@ int main(int argc, char* argv[])
122 122
       }
123 123
       AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
124 124
       AveragingState.Compute_All(true);
125
-      
125
+
126 126
       // Perform the scan:
127 127
       Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
128 128
     }
@@ -130,4 +130,3 @@ int main(int argc, char* argv[])
130 130
 
131 131
   return(0);
132 132
 }
133
-

+ 19
- 21
src/EXECS/Heis_DSF_par.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Heis_DSF_par.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc != 8) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of Heis_DSF_par executable: " << endl;
33
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
32
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
36 35
     cout << "DP Delta \t\t Value of the anisotropy:  use positive real values only" << endl;
@@ -56,21 +55,21 @@ int main(int argc, char *argv[])
56 55
 
57 56
   DP supercycle_time = 600.0; // allotted time per supercycle
58 57
 
59
-  if (Max_Secs <= supercycle_time + 300) JSCerror("Please allow more time in Heis_DSF_par.");
58
+  if (Max_Secs <= supercycle_time + 300) ABACUSerror("Please allow more time in Heis_DSF_par.");
60 59
 
61 60
   MPI::Init(argc, argv);
62 61
 
63 62
   DP tstart = MPI::Wtime();
64
-  
63
+
65 64
   int rank = MPI::COMM_WORLD.Get_rank();
66 65
   int nr_processors = MPI::COMM_WORLD.Get_size();
67 66
 
68
-  if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
67
+  if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
69 68
 
70 69
   refine = true;
71 70
 
72 71
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
73
-  
72
+
74 73
   // IMPORTANT PRECONDITION:  no flags are being raised in General_Scan in parallel mode, so
75 74
   // the preinitializing serial run must be extensive enough to have flagged all base/type s necessary.
76 75
 
@@ -83,30 +82,30 @@ int main(int argc, char *argv[])
83 82
     if (rank == 0)
84 83
       // Split up thread list into chunks, one per processor
85 84
       Prepare_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, nr_processors);
86
-    
85
+
87 86
     //cout << "rank " << rank << " done preparing, ready to scan." << endl;
88 87
 
89
-    // Barrier synchronization, to make sure other processes wait for process of rank 0 
88
+    // Barrier synchronization, to make sure other processes wait for process of rank 0
90 89
     // to have finished splitting up the thr file into pieces before starting:
91 90
     MPI_Barrier (MPI::COMM_WORLD);
92
-    
91
+
93 92
     // then everybody gets going on their own chunk !
94 93
     Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
95 94
 	       supercycle_time, target_sumrule, refine, rank, nr_processors);
96 95
 
97 96
     //cout << "rank " << rank << " finished scanning, reached wrapup stage." << endl;
98
-    
99
-    // Another barrier synchronization 
97
+
98
+    // Another barrier synchronization
100 99
     MPI_Barrier (MPI::COMM_WORLD);
101 100
 
102
-    // Now that everybody is done, digest data into unique files    
103
-    if (rank == 0) 
101
+    // Now that everybody is done, digest data into unique files
102
+    if (rank == 0)
104 103
       Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, nr_processors);
105 104
 
106 105
     //cout << "rank " << rank << " passed wrapup stage." << endl;
107 106
 
108
-    // Another barrier synchronization 
109
-    MPI_Barrier (MPI::COMM_WORLD);    
107
+    // Another barrier synchronization
108
+    MPI_Barrier (MPI::COMM_WORLD);
110 109
 
111 110
     tnow = MPI::Wtime();
112 111
 
@@ -117,4 +116,3 @@ int main(int argc, char *argv[])
117 116
 
118 117
   return(0);
119 118
 }
120
-

+ 9
- 11
src/EXECS/Heis_DSF_par_Prepare.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's C++ library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Heis_DSF_par_Prepare.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc < 9) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of Heis_DSF_par_Prepare executable: " << endl;
33
-    cout << endl << "This function prepares for ABACUS++G in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
32
+    cout << endl << "This function prepares for ABACUSG in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
36 35
     cout << "DP Delta \t\t Value of the anisotropy:  use positive real values only" << endl;
@@ -53,7 +52,7 @@ int main(int argc, char *argv[])
53 52
     iKmin = atoi(argv[n++]);
54 53
     iKmax = atoi(argv[n++]);
55 54
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
56
-    if (argc != 9 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Prepare.");
55
+    if (argc != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Prepare.");
57 56
 
58 57
     Vect<int> rank_lower_paralevels(paralevel - 1);
59 58
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -64,12 +63,11 @@ int main(int argc, char *argv[])
64 63
     nr_processors_at_newlevel = atoi(argv[n++]);
65 64
 
66 65
     string defaultScanStatename = "";
67
-    
66
+
68 67
     // Split up thread list into chunks, one per processor
69 68
     Prepare_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
70
-    
69
+
71 70
   }
72 71
 
73 72
   return(0);
74 73
 }
75
-

+ 21
- 23
src/EXECS/Heis_DSF_par_Run.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Heis_DSF_par_Run.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc < 10) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of Heis_DSF_par_Run executable: " << endl;
33
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
32
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
36 35
     cout << "DP Delta \t\t Value of the anisotropy:  use positive real values only" << endl;
@@ -56,7 +55,7 @@ int main(int argc, char *argv[])
56 55
   iKmin = atoi(argv[n++]);
57 56
   iKmax = atoi(argv[n++]);
58 57
   paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
59
-  if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Run.");
58
+  if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Run.");
60 59
   Vect<int> rank_lower_paralevels(paralevel - 1);
61 60
   Vect<int> nr_processors_lower_paralevels(paralevel - 1);
62 61
   for (int i = 0; i < paralevel - 1; ++i) {
@@ -69,12 +68,12 @@ int main(int argc, char *argv[])
69 68
 
70 69
   //DP supercycle_time = 600.0; // allotted time per supercycle
71 70
 
72
-  if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in Heis_DSF_par_Run.");
71
+  if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in Heis_DSF_par_Run.");
73 72
 
74 73
   MPI::Init(argc, argv);
75
-  
74
+
76 75
   DP tstart = MPI::Wtime();
77
-  
76
+
78 77
   int rank_here = MPI::COMM_WORLD.Get_rank();
79 78
   int nr_processors_here = MPI::COMM_WORLD.Get_size();
80 79
 
@@ -87,12 +86,12 @@ int main(int argc, char *argv[])
87 86
   rank[paralevel-1] = rank_here;
88 87
   nr_processors[paralevel-1] = nr_processors_here;
89 88
 
90
-  if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
89
+  if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
91 90
 
92 91
   refine = true;
93 92
 
94 93
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
95
-  
94
+
96 95
 
97 96
   DP tnow = MPI::Wtime();
98 97
 
@@ -100,21 +99,21 @@ int main(int argc, char *argv[])
100 99
 
101 100
   while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
102 101
 
103
-    // Barrier synchronization, to make sure other processes wait for process of rank 0 
102
+    // Barrier synchronization, to make sure other processes wait for process of rank 0
104 103
     // to have finished splitting up the thr file into pieces before starting:
105 104
     MPI_Barrier (MPI::COMM_WORLD);
106
-    
105
+
107 106
     // then everybody gets going on their own chunk !
108
-    Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, 
107
+    Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
109 108
 	       supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
110
-    
111
-    // Another barrier synchronization 
109
+
110
+    // Another barrier synchronization
112 111
     MPI_Barrier (MPI::COMM_WORLD);
113
-    
112
+
114 113
     // Now that everybody is done, digest data into unique files
115
-    
116
-    // Another barrier synchronization 
117
-    MPI_Barrier (MPI::COMM_WORLD);    
114
+
115
+    // Another barrier synchronization
116
+    MPI_Barrier (MPI::COMM_WORLD);
118 117
 
119 118
     tnow = MPI::Wtime();
120 119
 
@@ -124,4 +123,3 @@ int main(int argc, char *argv[])
124 123
 
125 124
   return(0);
126 125
 }
127
-

+ 9
- 11
src/EXECS/Heis_DSF_par_Wrapup.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's C++ library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Heis_DSF_par_Prepare.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare or Wrapup
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc < 9) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of Heis_DSF_par_Wrapup executable: " << endl;
33
-    cout << endl << "This function wraps up an ABACUS++G parallel mode run." << endl;
32
+    cout << endl << "This function wraps up an ABACUSG parallel mode run." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
36 35
     cout << "DP Delta \t\t Value of the anisotropy:  use positive real values only" << endl;
@@ -53,7 +52,7 @@ int main(int argc, char *argv[])
53 52
     iKmin = atoi(argv[n++]);
54 53
     iKmax = atoi(argv[n++]);
55 54
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
56
-    if (argc != 9 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
55
+    if (argc != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
57 56
 
58 57
     Vect<int> rank_lower_paralevels(paralevel - 1);
59 58
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -64,12 +63,11 @@ int main(int argc, char *argv[])
64 63
     nr_processors_at_newlevel = atoi(argv[n++]);
65 64
 
66 65
     string defaultScanStatename = "";
67
-    
66
+
68 67
     // Split up thread list into chunks, one per processor
69 68
     Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
70
-    
69
+
71 70
   }
72 71
 
73 72
   return(0);
74 73
 }
75
-

+ 10
- 10
src/EXECS/LiebLin_Catalogue_Fixed_c_k_Nscaling.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,13 +12,14 @@ Purpose:  Produces sets of data files for correlations, increasing system size a
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include <omp.h>
16
+#include "ABACUS.h"
16 17
 
17 18
 using namespace std;
18
-using namespace JSC;
19
+using namespace ABACUS;
19 20
 
20 21
 
21
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
22 23
 {
23 24
 
24 25
   if (argc != 7) { // provide some info
@@ -45,7 +46,7 @@ int main(int argc, char* argv[])
45 46
     DP kBT = atof(argv[ia++]);
46 47
     DP target_sumrule = atof(argv[ia++]);
47 48
     int Max_Secs = atoi(argv[ia++]);
48
-    
49
+
49 50
 
50 51
     //clock_t StartTime = clock();
51 52
     double StartTime = omp_get_wtime();
@@ -76,9 +77,9 @@ int main(int argc, char* argv[])
76 77
       Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
77 78
       SRC_stringstream << ".src";
78 79
       SRC_string = SRC_stringstream.str();    const char* SRC_Cstr = SRC_string.c_str();
79
-      
80
+
80 81
       fstream srcfile;
81
-      srcfile.open(SRC_Cstr, fstream::in);    
82
+      srcfile.open(SRC_Cstr, fstream::in);
82 83
       if (srcfile.fail()) {
83 84
 	srsat = 0.0;
84 85
 	refine = false;
@@ -92,7 +93,7 @@ int main(int argc, char* argv[])
92 93
       ActualTime = omp_get_wtime();
93 94
       Secs_left = int(Max_Secs - (ActualTime - StartTime));
94 95
 
95
-      if (srsat < target_sumrule && Secs_left > Max_Secs/2) 
96
+      if (srsat < target_sumrule && Secs_left > Max_Secs/2)
96 97
 	// Improve the icmin calculation by one chunk:
97 98
 	Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Secs_left, target_sumrule, refine);
98 99
 
@@ -107,10 +108,9 @@ int main(int argc, char* argv[])
107 108
 	break;
108 109
       }
109 110
 
110
-    } // while there is time      
111
+    } // while there is time
111 112
 
112 113
   } // else if arguments given OK
113 114
 
114 115
   return(0);
115 116
 }
116
-

+ 6
- 7
src/EXECS/LiebLin_DSF.cc View File

@@ -2,28 +2,28 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF.cc
10 10
 
11
-Purpose:  main function for ABACUS++ for LiebLin gas
11
+Purpose:  main function for ABACUS for LiebLin gas
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 11) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -59,4 +59,3 @@ int main(int argc, char* argv[])
59 59
 
60 60
   return(0);
61 61
 }
62
-

+ 9
- 10
src/EXECS/LiebLin_DSF_GeneralState.cc View File

@@ -2,28 +2,28 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_GeneralState.cc
10 10
 
11
-Purpose:  function for ABACUS++ for LiebLin gas, on general states
11
+Purpose:  function for ABACUS for LiebLin gas, on general states
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 11) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
66 66
     Ix2_input_file.open(filename_Cstr);
67 67
     if (Ix2_input_file.fail()) {
68 68
       cout << filename_Cstr << endl;
69
-      JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
69
+      ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
70 70
     }
71 71
     for (int i = 0; i < N; ++i) {
72 72
       Ix2_input_file >> Ix2_input[i];
@@ -83,10 +83,10 @@ int main(int argc, char* argv[])
83 83
     //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine, 0, 1);
84 84
     //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine);
85 85
 
86
-    //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax, 
86
+    //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
87 87
     //		  int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors)
88 88
     // Simplified function call of the above:
89
-    //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax, 
89
+    //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
90 90
     //		  int Max_Secs, DP target_sumrule, bool refine)
91 91
     Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine);
92 92
 
@@ -94,4 +94,3 @@ int main(int argc, char* argv[])
94 94
 
95 95
   return(0);
96 96
 }
97
-

+ 9
- 11
src/EXECS/LiebLin_DSF_GeneralState_par_Prepare.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_GeneralState_par_Prepare.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -29,9 +28,9 @@ int main(int argc, char *argv[])
29 28
 
30 29
   if (argc < 10) { // provide some info
31 30
 
32
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
31
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
33 32
     cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
34
-    cout << endl << "This function prepares an ABACUS++ parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
33
+    cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
35 34
     cout << endl << "Provide the following arguments:" << endl << endl;
36 35
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
37 36
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -58,7 +57,7 @@ int main(int argc, char *argv[])
58 57
     iKmax = atoi(argv[n++]);
59 58
     //kBT = atof(argv[n++]);
60 59
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
61
-    if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_GeneralState_par_Prepare.");
60
+    if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_GeneralState_par_Prepare.");
62 61
 
63 62
     Vect<int> rank_lower_paralevels(paralevel - 1);
64 63
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -83,7 +82,7 @@ int main(int argc, char *argv[])
83 82
     Ix2_input_file.open(filename_Cstr);
84 83
     if (Ix2_input_file.fail()) {
85 84
       cout << filename_Cstr << endl;
86
-      JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
85
+      ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
87 86
     }
88 87
     for (int i = 0; i < N; ++i) {
89 88
       Ix2_input_file >> Ix2_input[i];
@@ -98,9 +97,8 @@ int main(int argc, char *argv[])
98 97
 
99 98
     // Split up thread list into chunks, one per processor
100 99
     Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
101
-    
100
+
102 101
   }
103 102
 
104 103
   return(0);
105 104
 }
106
-

+ 22
- 24
src/EXECS/LiebLin_DSF_GeneralState_par_Run.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_GeneralState_par_Run.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -29,9 +28,9 @@ int main(int argc, char *argv[])
29 28
 
30 29
   if (argc < 10) { // provide some info
31 30
 
32
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
31
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
33 32
     cout << endl << "Usage of LiebLin_DSF_par executable: " << endl;
34
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
33
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
35 34
     cout << endl << "Provide the following arguments:" << endl << endl;
36 35
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
37 36
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -59,7 +58,7 @@ int main(int argc, char *argv[])
59 58
   iKmax = atoi(argv[n++]);
60 59
   //kBT = atof(argv[n++]);
61 60
   paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
62
-  if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
61
+  if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
63 62
   Vect<int> rank_lower_paralevels(paralevel - 1);
64 63
   Vect<int> nr_processors_lower_paralevels(paralevel - 1);
65 64
   for (int i = 0; i < paralevel - 1; ++i) {
@@ -72,14 +71,14 @@ int main(int argc, char *argv[])
72 71
 
73 72
   //DP supercycle_time = 600.0; // allotted time per supercycle
74 73
 
75
-  if (Max_Secs <= 120) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
74
+  if (Max_Secs <= 120) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
76 75
 
77 76
   int Max_Secs_used = Max_Secs - 120;
78 77
 
79 78
   MPI::Init(argc, argv);
80
-  
79
+
81 80
   DP tstart = MPI::Wtime();
82
-  
81
+
83 82
   int rank_here = MPI::COMM_WORLD.Get_rank();
84 83
   int nr_processors_here = MPI::COMM_WORLD.Get_size();
85 84
 
@@ -95,18 +94,18 @@ int main(int argc, char *argv[])
95 94
   Ix2_input_file.open(filename_Cstr);
96 95
   if (Ix2_input_file.fail()) {
97 96
     cout << filename_Cstr << endl;
98
-    JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
97
+    ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
99 98
   }
100 99
   for (int i = 0; i < N; ++i) {
101 100
     Ix2_input_file >> Ix2_input[i];
102 101
     //cout << i << "\t" << Ix2_input[i] << endl;
103 102
   }
104
-  
103
+
105 104
   // Now define the AveragingState
106 105
   LiebLin_Bethe_State AveragingState(c_int, L, N);
107 106
   AveragingState.Ix2 = Ix2_input;
108 107
   AveragingState.Compute_All(true);
109
-  
108
+
110 109
 
111 110
   Vect<int> rank (paralevel);
112 111
   Vect<int> nr_processors (paralevel);
@@ -117,31 +116,31 @@ int main(int argc, char *argv[])
117 116
   rank[paralevel-1] = rank_here;
118 117
   nr_processors[paralevel-1] = nr_processors_here;
119 118
 
120
-  if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
119
+  if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
121 120
 
122 121
   refine = true;
123 122
 
124 123
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
125
-  
124
+
126 125
 
127 126
   DP tnow = MPI::Wtime();
128 127
 
129
-  
128
+
130 129
   //while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
131
-  if (Max_Secs_used > 0) { 
130
+  if (Max_Secs_used > 0) {
132 131
 
133 132
     // Barrier synchronization
134 133
     MPI_Barrier (MPI::COMM_WORLD);
135
-    
134
+
136 135
     // then everybody gets going on their own chunk !
137
-    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 
136
+    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
138 137
     //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
139 138
     //	       supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
140 139
     Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
141
-    
142
-    // Another barrier synchronization 
140
+
141
+    // Another barrier synchronization
143 142
     MPI_Barrier (MPI::COMM_WORLD);
144
-    
143
+
145 144
     tnow = MPI::Wtime();
146 145
 
147 146
   } // while (tnow - tstart...
@@ -150,4 +149,3 @@ int main(int argc, char *argv[])
150 149
 
151 150
   return(0);
152 151
 }
153
-

+ 10
- 12
src/EXECS/LiebLin_DSF_GeneralState_par_Wrapup.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par_Prepare.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -29,9 +28,9 @@ int main(int argc, char *argv[])
29 28
 
30 29
   if (argc < 10) { // provide some info
31 30
 
32
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
31
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
33 32
     cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
34
-    cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
33
+    cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
35 34
     cout << endl << "Provide the following arguments:" << endl << endl;
36 35
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
37 36
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -58,7 +57,7 @@ int main(int argc, char *argv[])
58 57
     iKmax = atoi(argv[n++]);
59 58
     //kBT = atof(argv[n++]);
60 59
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
61
-    if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
60
+    if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
62 61
 
63 62
     Vect<int> rank_lower_paralevels(paralevel - 1);
64 63
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -81,7 +80,7 @@ int main(int argc, char *argv[])
81 80
     Ix2_input_file.open(filename_Cstr);
82 81
     if (Ix2_input_file.fail()) {
83 82
       cout << filename_Cstr << endl;
84
-      JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
83
+      ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
85 84
     }
86 85
     for (int i = 0; i < N; ++i) {
87 86
       Ix2_input_file >> Ix2_input[i];
@@ -93,12 +92,11 @@ int main(int argc, char *argv[])
93 92
     AveragingState.Ix2 = Ix2_input;
94 93
     //AveragingState.Compute_All(true);
95 94
     */
96
-    
95
+
97 96
     // Digest files into a unique one for the latest paralevel:
98 97
     Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
99
-    
98
+
100 99
   }
101 100
 
102 101
   return(0);
103 102
 }
104
-

+ 8
- 9
src/EXECS/LiebLin_DSF_MosesState.cc View File

@@ -2,28 +2,28 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF.cc
10 10
 
11
-Purpose:  main function for ABACUS++ for LiebLin gas
11
+Purpose:  main function for ABACUS for LiebLin gas
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 13) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_MosesState executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -31,8 +31,8 @@ int main(int argc, char* argv[])
31 31
     cout << "DP L \t\t\t Length of the system:  use positive real values only" << endl;
32 32
     cout << "int N \t\t\t Number of particles:  use positive integer values only" << endl;
33 33
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
34
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
35
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
34
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
35
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
36 36
     cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over:  recommended values:  -2*N and 2*N" << endl;
37 37
     //cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
38 38
     cout << "int Max_Secs \t\t Allowed computational time:  (in seconds)" << endl;
@@ -81,4 +81,3 @@ int main(int argc, char* argv[])
81 81
 
82 82
   return(0);
83 83
 }
84
-

+ 24
- 26
src/EXECS/LiebLin_DSF_MosesState_par.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
30 29
 
31 30
   if (argc != 12) { // provide some info
32 31
 
33
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
32
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
34 33
     cout << endl << "Usage of LiebLin_DSF_MosesState_par executable: " << endl;
35
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
34
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
36 35
     cout << endl << "Provide the following arguments:" << endl << endl;
37 36
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
38 37
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
39 38
     cout << "DP L \t\t\t Length of the system:  use positive real values only" << endl;
40 39
     cout << "int N \t\t\t Number of particles:  use positive integer values only" << endl;
41 40
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
42
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
43
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
41
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
42
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
44 43
     cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over:  recommended values:  -2*N and 2*N" << endl;
45 44
     cout << "int Max_Secs \t\t Allowed computational time:  (in seconds)" << endl;
46 45
     cout << "int supercycle_time \t\t time for one supercycle (in seconds)" << endl;
@@ -66,21 +65,21 @@ int main(int argc, char *argv[])
66 65
 
67 66
   //DP supercycle_time = 600.0; // allotted time per supercycle
68 67
 
69
-  if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
68
+  if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
70 69
 
71 70
   MPI::Init(argc, argv);
72
-  
71
+
73 72
   DP tstart = MPI::Wtime();
74
-  
73
+
75 74
   int rank = MPI::COMM_WORLD.Get_rank();
76 75
   int nr_processors = MPI::COMM_WORLD.Get_size();
77 76
 
78
-  if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
77
+  if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
79 78
 
80 79
   refine = true;
81 80
 
82 81
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
83
-  
82
+
84 83
 
85 84
   DP tnow = MPI::Wtime();
86 85
 
@@ -106,27 +105,27 @@ int main(int argc, char *argv[])
106 105
       // Split up thread list into chunks, one per processor
107 106
       //Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
108 107
       Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
109
-    
110
-    // Barrier synchronization, to make sure other processes wait for process of rank 0 
108
+
109
+    // Barrier synchronization, to make sure other processes wait for process of rank 0
111 110
     // to have finished splitting up the thr file into pieces before starting:
112 111
     MPI_Barrier (MPI::COMM_WORLD);
113
-    
112
+
114 113
     // then everybody gets going on their own chunk !
115
-    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 
114
+    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
116 115
     //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, supercycle_time, target_sumrule, refine, rank, nr_processors);
117 116
     Scan_LiebLin (whichDSF, MosesState, defaultScanStatename, iKmin, iKmax, supercycle_time, target_sumrule, refine, rank, nr_processors);
118
-    
119
-    // Another barrier synchronization 
117
+
118
+    // Another barrier synchronization
120 119
     MPI_Barrier (MPI::COMM_WORLD);
121
-    
120
+
122 121
     // Now that everybody is done, digest data into unique files
123
-    
124
-    if (rank == 0) 
122
+
123
+    if (rank == 0)
125 124
       //Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
126 125
       Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
127 126
 
128
-    // Another barrier synchronization 
129
-    MPI_Barrier (MPI::COMM_WORLD);    
127
+    // Another barrier synchronization
128
+    MPI_Barrier (MPI::COMM_WORLD);
130 129
 
131 130
     tnow = MPI::Wtime();
132 131
 
@@ -136,4 +135,3 @@ int main(int argc, char *argv[])
136 135
 
137 136
   return(0);
138 137
 }
139
-

+ 15
- 17
src/EXECS/LiebLin_DSF_MosesState_par_Prepare.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par_Prepare.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
30 29
 
31 30
   if (argc < 12) { // provide some info
32 31
 
33
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
32
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
34 33
     cout << endl << "Usage of LiebLin_DSF_MosesState_par_Prepare executable: " << endl;
35
-    cout << endl << "This function prepares an ABACUS++ parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
34
+    cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
36 35
     cout << endl << "Provide the following arguments:" << endl << endl;
37 36
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
38 37
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
39 38
     cout << "DP L \t\t\t Length of the system:  use positive real values only" << endl;
40 39
     cout << "int N \t\t\t Number of particles:  use positive integer values only" << endl;
41 40
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
42
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
43
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
41
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
42
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
44 43
     cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over:  recommended values:  -2*N and 2*N" << endl;
45 44
     cout << "int paralevel" << endl;
46 45
     cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
@@ -61,7 +60,7 @@ int main(int argc, char *argv[])
61 60
     iKmin = atoi(argv[n++]);
62 61
     iKmax = atoi(argv[n++]);
63 62
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
64
-    if (argc != 12 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
63
+    if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
65 64
 
66 65
     Vect<int> rank_lower_paralevels(paralevel - 1);
67 66
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -73,24 +72,23 @@ int main(int argc, char *argv[])
73 72
 
74 73
     // Define the Moses state:
75 74
     LiebLin_Bethe_State MosesState (c_int, L, N);
76
-    
75
+
77 76
     // Split the sea:
78 77
     for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
79 78
     for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
80
-    
79
+
81 80
     MosesState.Compute_All (true);
82
-    
81
+
83 82
     // Handy default name:
84 83
     stringstream defaultScanStatename_strstream;
85 84
     defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
86 85
     string defaultScanStatename = defaultScanStatename_strstream.str();
87
-    
88
-    
86
+
87
+
89 88
     // Split up thread list into chunks, one per processor
90 89
     Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
91
-    
90
+
92 91
   }
93 92
 
94 93
   return(0);
95 94
 }
96
-

+ 30
- 32
src/EXECS/LiebLin_DSF_MosesState_par_Run.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
30 29
 
31 30
   if (argc < 13) { // provide some info
32 31
 
33
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
32
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
34 33
     cout << endl << "Usage of LiebLin_DSF_MosesState_par_Run executable: " << endl;
35
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
34
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
36 35
     cout << endl << "Provide the following arguments:" << endl << endl;
37 36
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
38 37
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
39 38
     cout << "DP L \t\t\t Length of the system:  use positive real values only" << endl;
40 39
     cout << "int N \t\t\t Number of particles:  use positive integer values only" << endl;
41 40
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
42
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
43
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
41
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
42
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
44 43
     cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over:  recommended values:  -2*N and 2*N" << endl;
45 44
     cout << "int paralevel" << endl;
46 45
     cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
@@ -62,7 +61,7 @@ int main(int argc, char *argv[])
62 61
   iKmin = atoi(argv[n++]);
63 62
   iKmax = atoi(argv[n++]);
64 63
   paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
65
-  if (argc != 13 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
64
+  if (argc != 13 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
66 65
   Vect<int> rank_lower_paralevels(paralevel - 1);
67 66
   Vect<int> nr_processors_lower_paralevels(paralevel - 1);
68 67
   for (int i = 0; i < paralevel - 1; ++i) {
@@ -75,12 +74,12 @@ int main(int argc, char *argv[])
75 74
 
76 75
   //DP supercycle_time = 600.0; // allotted time per supercycle
77 76
 
78
-  if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
77
+  if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
79 78
 
80 79
   MPI::Init(argc, argv);
81
-  
80
+
82 81
   DP tstart = MPI::Wtime();
83
-  
82
+
84 83
   int rank_here = MPI::COMM_WORLD.Get_rank();
85 84
   int nr_processors_here = MPI::COMM_WORLD.Get_size();
86 85
 
@@ -95,33 +94,33 @@ int main(int argc, char *argv[])
95 94
   rank[paralevel-1] = rank_here;
96 95
   nr_processors[paralevel-1] = nr_processors_here;
97 96
 
98
-  if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
97
+  if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
99 98
 
100 99
   refine = true;
101 100
 
102 101
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
103
-  
102
+
104 103
 
105 104
   DP tnow = MPI::Wtime();
106 105
 
107 106
   // Define the Moses state:
108 107
   LiebLin_Bethe_State MosesState (c_int, L, N);
109
-  
108
+
110 109
   // Split the sea:
111 110
   for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
112 111
   for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
113
-  
112
+
114 113
   MosesState.Compute_All (true);
115
-  
114
+
116 115
   // Handy default name:
117 116
   stringstream defaultScanStatename_strstream;
118 117
   defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
119 118
   string defaultScanStatename = defaultScanStatename_strstream.str();
120
-  
119
+
121 120
   //cout << "rank " << rank_here << " out of " << nr_processors_here << " waiting at barrier." << endl;
122 121
 
123 122
   MPI_Barrier (MPI::COMM_WORLD);
124
-  
123
+
125 124
 
126 125
   while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
127 126
 
@@ -129,27 +128,27 @@ int main(int argc, char *argv[])
129 128
       // Split up thread list into chunks, one per processor
130 129
       //Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
131 130
       //Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
132
-    
133
-    // Barrier synchronization, to make sure other processes wait for process of rank 0 
131
+
132
+    // Barrier synchronization, to make sure other processes wait for process of rank 0
134 133
     // to have finished splitting up the thr file into pieces before starting:
135 134
     MPI_Barrier (MPI::COMM_WORLD);
136
-    
135
+
137 136
     // then everybody gets going on their own chunk !
138
-    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 
137
+    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
139 138
     //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
140 139
     Scan_LiebLin (whichDSF, MosesState, defaultScanStatename, iKmin, iKmax, supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
141
-    
142
-    // Another barrier synchronization 
140
+
141
+    // Another barrier synchronization
143 142
     MPI_Barrier (MPI::COMM_WORLD);
144
-    
143
+
145 144
     // Now that everybody is done, digest data into unique files
146
-    
147
-    //if (rank == 0) 
145
+
146
+    //if (rank == 0)
148 147
       //Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
149 148
       //Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
150 149
 
151
-    // Another barrier synchronization 
152
-    MPI_Barrier (MPI::COMM_WORLD);    
150
+    // Another barrier synchronization
151
+    MPI_Barrier (MPI::COMM_WORLD);
153 152
 
154 153
     tnow = MPI::Wtime();
155 154
 
@@ -159,4 +158,3 @@ int main(int argc, char *argv[])
159 158
 
160 159
   return(0);
161 160
 }
162
-

+ 15
- 17
src/EXECS/LiebLin_DSF_MosesState_par_Wrapup.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_MosesState_par_Wrapup.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
30 29
 
31 30
   if (argc < 12) { // provide some info
32 31
 
33
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
32
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
34 33
     cout << endl << "Usage of LiebLin_DSF_MosesState_par_Wrapup executable: " << endl;
35
-    cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
34
+    cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
36 35
     cout << endl << "Provide the following arguments:" << endl << endl;
37 36
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
38 37
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
39 38
     cout << "DP L \t\t\t Length of the system:  use positive real values only" << endl;
40 39
     cout << "int N \t\t\t Number of particles:  use positive integer values only" << endl;
41 40
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
42
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
43
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
41
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
42
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
44 43
     cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over:  recommended values:  -2*N and 2*N" << endl;
45 44
     cout << "int paralevel" << endl;
46 45
     cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
@@ -61,7 +60,7 @@ int main(int argc, char *argv[])
61 60
     iKmin = atoi(argv[n++]);
62 61
     iKmax = atoi(argv[n++]);
63 62
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
64
-    if (argc != 12 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
63
+    if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
65 64
 
66 65
     Vect<int> rank_lower_paralevels(paralevel - 1);
67 66
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -73,24 +72,23 @@ int main(int argc, char *argv[])
73 72
 
74 73
     // Define the Moses state:
75 74
     LiebLin_Bethe_State MosesState (c_int, L, N);
76
-    
75
+
77 76
     // Split the sea:
78 77
     for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
79 78
     for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
80
-    
79
+
81 80
     MosesState.Compute_All (true);
82
-    
81
+
83 82
     // Handy default name:
84 83
     stringstream defaultScanStatename_strstream;
85 84
     defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
86 85
     string defaultScanStatename = defaultScanStatename_strstream.str();
87
-    
88
-    
86
+
87
+
89 88
     // Digest files into a unique one for the latest paralevel:
90 89
     Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
91
-    
90
+
92 91
   }
93 92
 
94 93
   return(0);
95 94
 }
96
-

+ 8
- 9
src/EXECS/LiebLin_DSF_over_Ensemble.cc View File

@@ -2,28 +2,28 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_over_Ensemble.cc
10 10
 
11
-Purpose:  main function for ABACUS++T for LiebLin gas, averaging over an Ensemble.
11
+Purpose:  main function for ABACUS for LiebLin gas, averaging over an Ensemble.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 10) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -75,7 +75,7 @@ int main(int argc, char* argv[])
75 75
     // Now perform the DSF calculation over each state in the ensemble, distributing the time according to the weight
76 76
 
77 77
     for (int ns = 0; ns < ensemble.nstates; ++ns) {
78
-      //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax, 
78
+      //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
79 79
       //int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors)
80 80
       //Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, int(Max_Secs * ensemble.weight[ns]), 1.0e+6, refine, 0, 1);
81 81
       Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, int(Max_Secs * ensemble.weight[ns]), 1.0e+6, refine);
@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
86 86
     Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
87 87
     FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
88 88
     FSR_string = FSR_stringstream.str();    const char* FSR_Cstr = FSR_string.c_str();
89
-    
89
+
90 90
     DP Chem_Pot = 0.0;
91 91
 
92 92
     Evaluate_F_Sumrule (whichDSF, c_int, L, N, kBT, ensemble.nstates, Chem_Pot, iKmin, iKmax, FSR_Cstr);
@@ -96,4 +96,3 @@ int main(int argc, char* argv[])
96 96
 
97 97
   return(0);
98 98
 }
99
-

+ 32
- 33
src/EXECS/LiebLin_DSF_over_Ensemble_par.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,19 +12,19 @@ Purpose:  main function for ABACUS for LiebLin gas, averaging over an Ensemble,
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 #include "mpi.h"
17 17
 
18 18
 using namespace std;
19
-using namespace JSC;
19
+using namespace ABACUS;
20 20
 
21 21
 
22
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
23 23
 {
24 24
 
25 25
   if (argc != 10) { // provide some info
26 26
 
27
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
27
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
28 28
     cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
29 29
     cout << endl << "Provide the following arguments:" << endl << endl;
30 30
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -53,16 +53,16 @@ int main(int argc, char* argv[])
53 53
     int Max_Secs = atoi(argv[8]);
54 54
     bool refine = (atoi(argv[9]) == 1);
55 55
 
56
-    if (refine == false) JSCerror("Please run the serial version of LiebLin_DSF_over_Ensemble first.");
56
+    if (refine == false) ABACUSerror("Please run the serial version of LiebLin_DSF_over_Ensemble first.");
57 57
 
58 58
     MPI::Init(argc, argv);
59
-    
59
+
60 60
     DP tstart = MPI::Wtime();
61
-    
61
+
62 62
     int rank = MPI::COMM_WORLD.Get_rank();
63 63
     int nr_processors = MPI::COMM_WORLD.Get_size();
64
-    
65
-    if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
64
+
65
+    if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
66 66
 
67 67
 
68 68
     // Start by constructing (or loading) the state ensemble.
@@ -91,16 +91,16 @@ int main(int argc, char* argv[])
91 91
 
92 92
     /* Original implementation: Scan always called serially. Superseded by version below, using successive parallel scans on each state in the ensemble.
93 93
     int nDSFperproc = ensemble.nstates/nr_processors + 1;
94
-    //if (ensemble.nstates % nr_processors) JSCerror("Use nr_processors * integer multiple == ensemble.nstates in LiebLin_DSF_over_Ensemble_par.");
95
-    
96
-    // Processor with rank r does all 
94
+    //if (ensemble.nstates % nr_processors) ABACUSerror("Use nr_processors * integer multiple == ensemble.nstates in LiebLin_DSF_over_Ensemble_par.");
95
+
96
+    // Processor with rank r does all
97 97
 
98 98
     int ns;
99 99
     int Max_Secs_used = Max_Secs/nDSFperproc;
100 100
 
101 101
     for (int ir = 0; ir < nDSFperproc; ++ir) {
102 102
       ns = rank + ir * nr_processors;
103
-      //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax, 
103
+      //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
104 104
       //int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors)
105 105
       if (ns < ensemble.nstates) {
106 106
 	//cout << "Processor rank " << rank << " going for ns = " << ns << " out of " << ensemble.nstates << endl;
@@ -117,13 +117,13 @@ int main(int argc, char* argv[])
117 117
 
118 118
     DP supercycle_time = 600.0; // allotted time per supercycle
119 119
 
120
-    if (Max_Secs_used <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
120
+    if (Max_Secs_used <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
121 121
 
122 122
     // Main loop over ensemble:
123
-    for (int ns = 0; ns < ensemble.nstates; ++ns) { 
124
-      
123
+    for (int ns = 0; ns < ensemble.nstates; ++ns) {
124
+
125 125
       tstart = MPI::Wtime();
126
-      DP tnow = MPI::Wtime();      
126
+      DP tnow = MPI::Wtime();
127 127
 
128 128
       string defaultScanStatename = ensemble.state[ns].label;
129 129
 
@@ -133,31 +133,31 @@ int main(int argc, char* argv[])
133 133
 	  // Split up thread list into chunks, one per processor
134 134
 	  //Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
135 135
 	  Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
136
-    
137
-	// Barrier synchronization, to make sure other processes wait for process of rank 0 
136
+
137
+	// Barrier synchronization, to make sure other processes wait for process of rank 0
138 138
 	// to have finished splitting up the thr file into pieces before starting:
139 139
 	MPI_Barrier (MPI::COMM_WORLD);
140
-	
140
+
141 141
 	// then everybody gets going on their own chunk !
142
-	//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 
142
+	//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
143 143
 	//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
144 144
 	//supercycle_time, target_sumrule, refine, rank, nr_processors);
145 145
 	Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, supercycle_time, 1.0e+6, refine, rank, nr_processors);
146
-    
147
-	// Another barrier synchronization 
146
+
147
+	// Another barrier synchronization
148 148
 	MPI_Barrier (MPI::COMM_WORLD);
149
-	
149
+
150 150
 	// Now that everybody is done, digest data into unique files
151
-    
152
-	if (rank == 0) 
151
+
152
+	if (rank == 0)
153 153
 	  //Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
154 154
 	  Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
155 155
 
156
-	// Another barrier synchronization 
157
-	MPI_Barrier (MPI::COMM_WORLD);    
156
+	// Another barrier synchronization
157
+	MPI_Barrier (MPI::COMM_WORLD);
158 158
 
159 159
 	tnow = MPI::Wtime();
160
-	
160
+
161 161
       } // while (tnow - tstart...
162 162
 
163 163
     } // for ns
@@ -174,9 +174,9 @@ int main(int argc, char* argv[])
174 174
       Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
175 175
       FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
176 176
       FSR_string = FSR_stringstream.str();    const char* FSR_Cstr = FSR_string.c_str();
177
-      
177
+
178 178
       DP Chem_Pot = 0.0;
179
-      
179
+
180 180
       Evaluate_F_Sumrule (whichDSF, c_int, L, N, kBT, ensemble.nstates, Chem_Pot, iKmin, iKmax, FSR_Cstr);
181 181
     }
182 182
 
@@ -188,4 +188,3 @@ int main(int argc, char* argv[])
188 188
 
189 189
   return(0);
190 190
 }
191
-

+ 22
- 24
src/EXECS/LiebLin_DSF_par.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc != 10) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of LiebLin_DSF_par executable: " << endl;
33
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
32
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
36 35
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -60,21 +59,21 @@ int main(int argc, char *argv[])
60 59
 
61 60
   //DP supercycle_time = 600.0; // allotted time per supercycle
62 61
 
63
-  if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
62
+  if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
64 63
 
65 64
   MPI::Init(argc, argv);
66
-  
65
+
67 66
   DP tstart = MPI::Wtime();
68
-  
67
+
69 68
   int rank = MPI::COMM_WORLD.Get_rank();
70 69
   int nr_processors = MPI::COMM_WORLD.Get_size();
71 70
 
72
-  if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
71
+  if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
73 72
 
74 73
   refine = true;
75 74
 
76 75
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
77
-  
76
+
78 77
 
79 78
   DP tnow = MPI::Wtime();
80 79
 
@@ -86,27 +85,27 @@ int main(int argc, char *argv[])
86 85
       // Split up thread list into chunks, one per processor
87 86
       //Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
88 87
       Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
89
-    
90
-    // Barrier synchronization, to make sure other processes wait for process of rank 0 
88
+
89
+    // Barrier synchronization, to make sure other processes wait for process of rank 0
91 90
     // to have finished splitting up the thr file into pieces before starting:
92 91
     MPI_Barrier (MPI::COMM_WORLD);
93
-    
92
+
94 93
     // then everybody gets going on their own chunk !
95
-    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 
94
+    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
96 95
     Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
97 96
 	       supercycle_time, target_sumrule, refine, rank, nr_processors);
98
-    
99
-    // Another barrier synchronization 
97
+
98
+    // Another barrier synchronization
100 99
     MPI_Barrier (MPI::COMM_WORLD);
101
-    
100
+
102 101
     // Now that everybody is done, digest data into unique files
103
-    
104
-    if (rank == 0) 
102
+
103
+    if (rank == 0)
105 104
       //Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
106 105
       Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
107 106
 
108
-    // Another barrier synchronization 
109
-    MPI_Barrier (MPI::COMM_WORLD);    
107
+    // Another barrier synchronization
108
+    MPI_Barrier (MPI::COMM_WORLD);
110 109
 
111 110
     tnow = MPI::Wtime();
112 111
 
@@ -116,4 +115,3 @@ int main(int argc, char *argv[])
116 115
 
117 116
   return(0);
118 117
 }
119
-

+ 9
- 11
src/EXECS/LiebLin_DSF_par_Prepare.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par_Prepare.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc < 10) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
33
-    cout << endl << "This function prepares an ABACUS++ parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
32
+    cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
36 35
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -55,7 +54,7 @@ int main(int argc, char *argv[])
55 54
     iKmax = atoi(argv[n++]);
56 55
     kBT = atof(argv[n++]);
57 56
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
58
-    if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
57
+    if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
59 58
 
60 59
     Vect<int> rank_lower_paralevels(paralevel - 1);
61 60
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -66,12 +65,11 @@ int main(int argc, char *argv[])
66 65
     nr_processors_at_newlevel = atoi(argv[n++]);
67 66
 
68 67
     string defaultScanStatename = "";
69
-    
68
+
70 69
     // Split up thread list into chunks, one per processor
71 70
     Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
72
-    
71
+
73 72
   }
74 73
 
75 74
   return(0);
76 75
 }
77
-

+ 18
- 20
src/EXECS/LiebLin_DSF_par_Run.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par_Run.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 #include "mpi.h"
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc < 10) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of LiebLin_DSF_par_Run executable: " << endl;
33
-    cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
32
+    cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
36 35
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -56,7 +55,7 @@ int main(int argc, char *argv[])
56 55
   iKmax = atoi(argv[n++]);
57 56
   kBT = atof(argv[n++]);
58 57
   paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
59
-  if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Run.");
58
+  if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Run.");
60 59
   Vect<int> rank_lower_paralevels(paralevel - 1);
61 60
   Vect<int> nr_processors_lower_paralevels(paralevel - 1);
62 61
   for (int i = 0; i < paralevel - 1; ++i) {
@@ -65,14 +64,14 @@ int main(int argc, char *argv[])
65 64
   }
66 65
   Max_Secs = atoi(argv[n++]);
67 66
 
68
-  if (Max_Secs < 120) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
67
+  if (Max_Secs < 120) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
69 68
 
70 69
   int Max_Secs_used = Max_Secs - 120;
71 70
 
72 71
   MPI::Init(argc, argv);
73
-  
72
+
74 73
   DP tstart = MPI::Wtime();
75
-  
74
+
76 75
   int rank_here = MPI::COMM_WORLD.Get_rank();
77 76
   int nr_processors_here = MPI::COMM_WORLD.Get_size();
78 77
 
@@ -85,12 +84,12 @@ int main(int argc, char *argv[])
85 84
   rank[paralevel-1] = rank_here;
86 85
   nr_processors[paralevel-1] = nr_processors_here;
87 86
 
88
-  if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS parallel !");
87
+  if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
89 88
 
90 89
   refine = true;
91 90
 
92 91
   // ASSUMPTION:  preexisting files (raw, thr, ...) exist for the run.
93
-  
92
+
94 93
 
95 94
   DP tnow = MPI::Wtime();
96 95
 
@@ -100,21 +99,20 @@ int main(int argc, char *argv[])
100 99
 
101 100
     // Barrier synchronization
102 101
     MPI_Barrier (MPI::COMM_WORLD);
103
-    
102
+
104 103
     // then everybody gets going on their own chunk !
105
-    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 
104
+    //Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
106 105
     Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
107 106
 		  Max_Secs_used, target_sumrule, refine, paralevel, rank, nr_processors);
108
-    
109
-    // Another barrier synchronization 
107
+
108
+    // Another barrier synchronization
110 109
     MPI_Barrier (MPI::COMM_WORLD);
111
-    
110
+
112 111
     tnow = MPI::Wtime();
113 112
 
114
-  } 
113
+  }
115 114
 
116 115
   MPI::Finalize();
117 116
 
118 117
   return(0);
119 118
 }
120
-

+ 9
- 11
src/EXECS/LiebLin_DSF_par_Wrapup.cc View File

@@ -2,21 +2,20 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  LiebLin_DSF_par_Wrapup.cc
10 10
 
11
-Purpose:  Parallel version of ABACUS++ using MPICH.
12
-
11
+Purpose:  Parallel version of ABACUS using MPICH.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 //#include "mpi.h" // not needed for Prepare or Wrapup
18 17
 
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, char *argv[])
22 21
 {
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
28 27
 
29 28
   if (argc < 10) { // provide some info
30 29
 
31
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
30
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
32 31
     cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
33
-    cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
32
+    cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
34 33
     cout << endl << "Provide the following arguments:" << endl << endl;
35 34
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
36 35
     cout << "DP c_int \t\t Value of the interaction parameter:  use positive real values only" << endl;
@@ -55,7 +54,7 @@ int main(int argc, char *argv[])
55 54
     iKmax = atoi(argv[n++]);
56 55
     kBT = atof(argv[n++]);
57 56
     paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
58
-    if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Wrapup.");
57
+    if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Wrapup.");
59 58
 
60 59
     Vect<int> rank_lower_paralevels(paralevel - 1);
61 60
     Vect<int> nr_processors_lower_paralevels(paralevel - 1);
@@ -66,12 +65,11 @@ int main(int argc, char *argv[])
66 65
     nr_processors_at_newlevel = atoi(argv[n++]);
67 66
 
68 67
     string defaultScanStatename = "";
69
-    
68
+
70 69
     // Digest files into a unique one for the latest paralevel:
71 70
     Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
72
-    
71
+
73 72
   }
74 73
 
75 74
   return(0);
76 75
 }
77
-

+ 10
- 11
src/EXECS/LiebLin_DSF_tester.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,18 +12,18 @@ Purpose:  allows for Ix2 manipulations (user-prompted) for LiebLin gas
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 6) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -42,10 +42,10 @@ int main(int argc, char* argv[])
42 42
     int N = atoi(argv[4]);
43 43
     DP kBT = atof(argv[5]);
44 44
 
45
-    //if (whichDSF != 'd') JSCerror("Other options not implemented yet in finite T Scan_LiebLin");
45
+    //if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in finite T Scan_LiebLin");
46 46
 
47 47
     // Delta is the number of sites involved in the smoothing of the entropy
48
-    //int Delta = int(sqrt(N))/2;//6;//N/20;  
48
+    //int Delta = int(sqrt(N))/2;//6;//N/20;
49 49
 
50 50
     // Construct the finite-size saddle-point state:
51 51
     //LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
@@ -73,11 +73,11 @@ int main(int argc, char* argv[])
73 73
       estate.Compute_All(false);
74 74
       cout << spstate << endl;
75 75
       cout << estate;
76
-      if (whichDSF == 'd') 
76
+      if (whichDSF == 'd')
77 77
 	cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
78
-      else if (whichDSF == 'o') 
78
+      else if (whichDSF == 'o')
79 79
 	cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
80
-      else if (whichDSF == 'g') 
80
+      else if (whichDSF == 'g')
81 81
 	cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
82 82
 
83 83
       //cout << "Another try ? (1 == yes, 0 == no)" << endl;
@@ -89,4 +89,3 @@ int main(int argc, char* argv[])
89 89
 
90 90
   return(0);
91 91
 }
92
-

+ 10
- 11
src/EXECS/LiebLin_DSF_tester_Ix2.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,18 +12,18 @@ Purpose:  allows for Ix2 manipulations (user-prompted) for LiebLin gas
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 6) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -42,10 +42,10 @@ int main(int argc, char* argv[])
42 42
     int N = atoi(argv[4]);
43 43
     DP kBT = atof(argv[5]);
44 44
 
45
-    //if (whichDSF != 'd') JSCerror("Other options not implemented yet in finite T Scan_LiebLin");
45
+    //if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in finite T Scan_LiebLin");
46 46
 
47 47
     // Delta is the number of sites involved in the smoothing of the entropy
48
-    //int Delta = int(sqrt(N))/2;//6;//N/20;  
48
+    //int Delta = int(sqrt(N))/2;//6;//N/20;
49 49
 
50 50
     // Construct the finite-size saddle-point state:
51 51
     //LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
@@ -73,11 +73,11 @@ int main(int argc, char* argv[])
73 73
       estate.Compute_All(false);
74 74
       cout << spstate << endl;
75 75
       cout << estate;
76
-      if (whichDSF == 'd') 
76
+      if (whichDSF == 'd')
77 77
 	cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
78
-      else if (whichDSF == 'o') 
78
+      else if (whichDSF == 'o')
79 79
 	cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
80
-      else if (whichDSF == 'g') 
80
+      else if (whichDSF == 'g')
81 81
 	cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
82 82
 
83 83
       cout << "Another try ? (1 == yes, 0 == no)" << endl;
@@ -89,4 +89,3 @@ int main(int argc, char* argv[])
89 89
 
90 90
   return(0);
91 91
 }
92
-

+ 13
- 13
src/EXECS/LiebLin_Data_Daemon.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,13 +12,14 @@ Purpose:  Produces sets of data files for correlations.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include <omp.h>
16
+#include "ABACUS.h"
16 17
 
17 18
 using namespace std;
18
-using namespace JSC;
19
+using namespace ABACUS;
19 20
 
20 21
 
21
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
22 23
 {
23 24
 
24 25
   if (argc != 11) { // provide some info
@@ -50,7 +51,7 @@ int main(int argc, char* argv[])
50 51
     DP kBT = atof(argv[ia++]);
51 52
     int Max_Hrs = atoi(argv[ia++]);
52 53
 
53
-    // Individual computations are split into chuncks of Max_Hrs/(Nc * 4) 
54
+    // Individual computations are split into chuncks of Max_Hrs/(Nc * 4)
54 55
     //int Max_Secs = (Max_Hrs * 900)/Nc;
55 56
     int Max_Secs = (Max_Hrs * 2700)/Nc; // to minimize wrapping up & restarting time
56 57
 
@@ -63,13 +64,13 @@ int main(int argc, char* argv[])
63 64
     double ActualTime = omp_get_wtime();
64 65
 
65 66
     DP c_int;
66
-    DP target_sumrule = 1.0; 
67
+    DP target_sumrule = 1.0;
67 68
 
68 69
     //while (double(ActualTime - StartTime)/CLOCKS_PER_SEC < double(3600 * Max_Hrs - Max_Secs)) {
69 70
     while (ActualTime - StartTime < double(3600 * Max_Hrs - Max_Secs)) {
70 71
 
71 72
       Vect<DP> srsat(0.0, Nc);
72
-      Vect<bool> refine(false, Nc); 
73
+      Vect<bool> refine(false, Nc);
73 74
       DP srmin = 1.0;
74 75
       int icmin = 0;
75 76
 
@@ -80,9 +81,9 @@ int main(int argc, char* argv[])
80 81
 	Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
81 82
 	SRC_stringstream << ".src";
82 83
 	SRC_string = SRC_stringstream.str();    const char* SRC_Cstr = SRC_string.c_str();
83
-	
84
+
84 85
 	fstream srcfile;
85
-	srcfile.open(SRC_Cstr, fstream::in);    
86
+	srcfile.open(SRC_Cstr, fstream::in);
86 87
 	if (srcfile.fail()) {
87 88
 	  srsat[ic] = 0.0;
88 89
 	  refine[ic] = false;
@@ -97,9 +98,9 @@ int main(int argc, char* argv[])
97 98
 	}
98 99
 	srcfile.close();
99 100
 
100
-      } // for ic  
101
+      } // for ic
101 102
 
102
-      cout << "srsat min found: " << srmin << "\t for c = " << c_int_max/pow(cfact, icmin) << ". Now refining this." 
103
+      cout << "srsat min found: " << srmin << "\t for c = " << c_int_max/pow(cfact, icmin) << ". Now refining this."
103 104
 	//<< " Time left: " << 3600* Max_Hrs - (ActualTime - StartTime)/CLOCKS_PER_SEC << " seconds." << endl;
104 105
 	   << " Time left: " << 3600* Max_Hrs - (ActualTime - StartTime) << " seconds." << endl;
105 106
 
@@ -109,7 +110,7 @@ int main(int argc, char* argv[])
109 110
       //ActualTime = clock();
110 111
       ActualTime = omp_get_wtime();
111 112
 
112
-    } // while there is time      
113
+    } // while there is time
113 114
 
114 115
     cout << "Wrapping up, time's up." << endl;
115 116
 
@@ -117,4 +118,3 @@ int main(int argc, char* argv[])
117 118
 
118 119
   return(0);
119 120
 }
120
-

+ 10
- 10
src/EXECS/LiebLin_Data_Daemon_Nscaling.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,13 +12,14 @@ Purpose:  Produces sets of data files for correlations, increasing system size a
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include <omp.h>
16
+#include "ABACUS.h"
16 17
 
17 18
 using namespace std;
18
-using namespace JSC;
19
+using namespace ABACUS;
19 20
 
20 21
 
21
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
22 23
 {
23 24
 
24 25
   if (argc != 9) { // provide some info
@@ -46,7 +47,7 @@ int main(int argc, char* argv[])
46 47
     DP kBT = atof(argv[ia++]);
47 48
     DP target_sumrule = atof(argv[ia++]);
48 49
     int Max_minutes = atoi(argv[ia++]);
49
-    
50
+
50 51
 
51 52
     //clock_t StartTime = clock();
52 53
     double StartTime = omp_get_wtime();
@@ -57,7 +58,7 @@ int main(int argc, char* argv[])
57 58
     int Secs_left = 60* Max_minutes;
58 59
 
59 60
     int iN = 0;
60
-    
61
+
61 62
     while (Secs_left > 0) {
62 63
 
63 64
       iN += 1;
@@ -72,9 +73,9 @@ int main(int argc, char* argv[])
72 73
       Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
73 74
       SRC_stringstream << ".src";
74 75
       SRC_string = SRC_stringstream.str();    const char* SRC_Cstr = SRC_string.c_str();
75
-      
76
+
76 77
       fstream srcfile;
77
-      srcfile.open(SRC_Cstr, fstream::in);    
78
+      srcfile.open(SRC_Cstr, fstream::in);
78 79
       if (srcfile.fail()) {
79 80
 	srsat = 0.0;
80 81
 	refine = false;
@@ -95,10 +96,9 @@ int main(int argc, char* argv[])
95 96
 
96 97
       cout << "Done with N = " << N << ". Time left = " << Secs_left << " seconds." << endl;
97 98
 
98
-    } // while there is time      
99
+    } // while there is time
99 100
 
100 101
   } // else if arguments given OK
101 102
 
102 103
   return(0);
103 104
 }
104
-

+ 14
- 14
src/EXECS/LiebLin_Fourier_ssf_to_Qsqx.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  Compute the Q(x)^2 expectation value for LiebLin, where Q(x) = \int_0^
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 9) { // provide some info
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of LiebLin_Fourier_to_Qsqx executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -46,11 +46,11 @@ int main(int argc, char* argv[])
46 46
     // Force Npts_x
47 47
     //Npts_x = L;
48 48
 
49
-    if (whichDSF != 'd') JSCerror("Must use whichDSF == d in LiebLin_Fourier_ssf_to_Qsqx");
49
+    if (whichDSF != 'd') ABACUSerror("Must use whichDSF == d in LiebLin_Fourier_ssf_to_Qsqx");
50 50
 
51 51
     stringstream filenameprefix;
52 52
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
53
-    string prefix = filenameprefix.str();    
53
+    string prefix = filenameprefix.str();
54 54
 
55 55
     stringstream RAW_stringstream;    string RAW_string;
56 56
     RAW_stringstream << prefix << ".raw";
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
59 59
     RAW_infile.open(RAW_Cstr);
60 60
     if (RAW_infile.fail()) {
61 61
       cout << RAW_Cstr << endl;
62
-      JSCerror("Could not open RAW_infile... "); 
62
+      ABACUSerror("Could not open RAW_infile... ");
63 63
     }
64 64
 
65 65
     // We also read the f-sumrule file, to correct for missing intensity.
@@ -70,7 +70,7 @@ int main(int argc, char* argv[])
70 70
     FSR_infile.open(FSR_Cstr);
71 71
     if (FSR_infile.fail()) {
72 72
       cout << FSR_Cstr << endl;
73
-      JSCerror("Could not open FSR_infile... "); 
73
+      ABACUSerror("Could not open FSR_infile... ");
74 74
     }
75 75
 
76 76
     stringstream SFT_stringstream;    string SFT_string;
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
78 78
     SFT_string = SFT_stringstream.str();    const char* SFT_Cstr = SFT_string.c_str();
79 79
     ofstream SFT_outfile;
80 80
     SFT_outfile.open(SFT_Cstr);
81
-    if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... "); 
81
+    if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
82 82
 
83 83
     // First compute the static structure factor from the RAW data:
84 84
 
@@ -100,7 +100,7 @@ int main(int argc, char* argv[])
100 100
     RAW_infile.close();
101 101
 
102 102
     // Reset proper normalization:
103
-    DP normalization = twoPI * L; 
103
+    DP normalization = twoPI * L;
104 104
     for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
105 105
 
106 106
 
@@ -121,15 +121,15 @@ int main(int argc, char* argv[])
121 121
       // Reset proper normalization: 1/L from space FT,
122 122
       FT[ix] *= 2.0*L/(PI * PI);
123 123
 
124
-      // Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function 
124
+      // Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
125 125
       // at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
126 126
       // so SSF becomes N/L.
127 127
       // We thus need to correct above by adding
128 128
       // \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
129 129
       // Resumming carefully:
130
-      //FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix])) 
130
+      //FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
131 131
       //* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
132
-      //FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix])) 
132
+      //FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
133 133
       //* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
134 134
     }
135 135
 

+ 14
- 14
src/EXECS/LiebLin_Fourier_to_t_equal_x.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  Fourier transform to static space correlator for LiebLin.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 10) { // provide some info
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -47,11 +47,11 @@ int main(int argc, char* argv[])
47 47
     DP t_max = atof(argv[9]);
48 48
 
49 49
     // Momentum business: use symmetry
50
-    if (iKmin != 0) JSCerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
50
+    if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
51 51
 
52 52
     stringstream filenameprefix;
53 53
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
54
-    string prefix = filenameprefix.str();    
54
+    string prefix = filenameprefix.str();
55 55
 
56 56
     stringstream RAW_stringstream;    string RAW_string;
57 57
     RAW_stringstream << prefix << ".raw";
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
60 60
     RAW_infile.open(RAW_Cstr);
61 61
     if (RAW_infile.fail()) {
62 62
       cout << RAW_Cstr << endl;
63
-      JSCerror("Could not open RAW_infile... "); 
63
+      ABACUSerror("Could not open RAW_infile... ");
64 64
     }
65 65
 
66 66
     // We also read the f-sumrule file, to correct for missing intensity.
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
71 71
     FSR_infile.open(FSR_Cstr);
72 72
     if (FSR_infile.fail()) {
73 73
       cout << FSR_Cstr << endl;
74
-      JSCerror("Could not open FSR_infile... "); 
74
+      ABACUSerror("Could not open FSR_infile... ");
75 75
     }
76 76
 
77 77
     stringstream SFT_stringstream;    string SFT_string;
@@ -79,7 +79,7 @@ int main(int argc, char* argv[])
79 79
     SFT_string = SFT_stringstream.str();    const char* SFT_Cstr = SFT_string.c_str();
80 80
     ofstream SFT_outfile;
81 81
     SFT_outfile.open(SFT_Cstr);
82
-    if (SFT_outfile.fail()) JSCerror("Could not open TFT_outfile... "); 
82
+    if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
83 83
 
84 84
     // First compute the static structure factor from the RAW data:
85 85
 
@@ -103,11 +103,11 @@ int main(int argc, char* argv[])
103 103
 
104 104
     while (RAW_infile.peek() != EOF) {
105 105
       RAW_infile >> omega >> iK >> FF >> dev >> label;
106
-      if (iK == 0) 
107
-	for (int it = 0; it < Npts_t; ++it) 
106
+      if (iK == 0)
107
+	for (int it = 0; it < Npts_t; ++it)
108 108
 	  FT[it] += FF * FF * exp(II * omega * tlattice[it]);
109
-      else 
110
-	for (int it = 0; it < Npts_t; ++it) 
109
+      else
110
+	for (int it = 0; it < Npts_t; ++it)
111 111
 	  FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
112 112
     }
113 113
     RAW_infile.close();

+ 12
- 12
src/EXECS/LiebLin_Fourier_to_t_equal_x_from_RAW.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  Fourier transform to static space correlator for LiebLin.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 10) { // provide some info
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -49,7 +49,7 @@ int main(int argc, char* argv[])
49 49
     DP t_max = atof(argv[9]);
50 50
 
51 51
     // Momentum business: use symmetry
52
-    if (iKmin != 0) JSCerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
52
+    if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
53 53
 
54 54
     ifstream RAW_infile;
55 55
     //RAW_infile.open(RAW_Cstr);
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
57 57
     if (RAW_infile.fail()) {
58 58
       //cout << RAW_Cstr << endl;
59 59
       cout << rawfilename << endl;
60
-      JSCerror("Could not open RAW_infile... "); 
60
+      ABACUSerror("Could not open RAW_infile... ");
61 61
     }
62 62
 
63 63
     stringstream SFT_stringstream;    string SFT_string;
@@ -65,7 +65,7 @@ int main(int argc, char* argv[])
65 65
     SFT_string = SFT_stringstream.str();    const char* SFT_Cstr = SFT_string.c_str();
66 66
     ofstream SFT_outfile;
67 67
     SFT_outfile.open(SFT_Cstr);
68
-    if (SFT_outfile.fail()) JSCerror("Could not open TFT_outfile... "); 
68
+    if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
69 69
 
70 70
     // First compute the static structure factor from the RAW data:
71 71
 
@@ -89,11 +89,11 @@ int main(int argc, char* argv[])
89 89
 
90 90
     while (RAW_infile.peek() != EOF) {
91 91
       RAW_infile >> omega >> iK >> FF >> dev >> label;
92
-      if (iK == 0) 
93
-	for (int it = 0; it < Npts_t; ++it) 
92
+      if (iK == 0)
93
+	for (int it = 0; it < Npts_t; ++it)
94 94
 	  FT[it] += FF * FF * exp(II * omega * tlattice[it]);
95
-      else 
96
-	for (int it = 0; it < Npts_t; ++it) 
95
+      else
96
+	for (int it = 0; it < Npts_t; ++it)
97 97
 	  FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
98 98
     }
99 99
     RAW_infile.close();

+ 17
- 17
src/EXECS/LiebLin_Fourier_to_x_equal_t.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  Fourier transform to static space correlator for LiebLin.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 9) { // provide some info
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
48 48
 
49 49
     stringstream filenameprefix;
50 50
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
51
-    string prefix = filenameprefix.str();    
51
+    string prefix = filenameprefix.str();
52 52
 
53 53
     stringstream RAW_stringstream;    string RAW_string;
54 54
     RAW_stringstream << prefix << ".raw";
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
57 57
     RAW_infile.open(RAW_Cstr);
58 58
     if (RAW_infile.fail()) {
59 59
       cout << RAW_Cstr << endl;
60
-      JSCerror("Could not open RAW_infile... "); 
60
+      ABACUSerror("Could not open RAW_infile... ");
61 61
     }
62 62
 
63 63
     // We also read the f-sumrule file, to correct for missing intensity.
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
68 68
     FSR_infile.open(FSR_Cstr);
69 69
     if (FSR_infile.fail()) {
70 70
       cout << FSR_Cstr << endl;
71
-      JSCerror("Could not open FSR_infile... "); 
71
+      ABACUSerror("Could not open FSR_infile... ");
72 72
     }
73 73
 
74 74
     stringstream SFT_stringstream;    string SFT_string;
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
76 76
     SFT_string = SFT_stringstream.str();    const char* SFT_Cstr = SFT_string.c_str();
77 77
     ofstream SFT_outfile;
78 78
     SFT_outfile.open(SFT_Cstr);
79
-    if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... "); 
79
+    if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
80 80
 
81 81
     // First compute the static structure factor from the RAW data:
82 82
 
@@ -98,7 +98,7 @@ int main(int argc, char* argv[])
98 98
     RAW_infile.close();
99 99
 
100 100
     // Reset proper normalization:
101
-    DP normalization = twoPI * L; 
101
+    DP normalization = twoPI * L;
102 102
     for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
103 103
 
104 104
     // We now refine the SSF in the following way.
@@ -142,23 +142,23 @@ int main(int argc, char* argv[])
142 142
       FTre[ix] /= L;
143 143
       FTim[ix] /= L;
144 144
 
145
-      // Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function 
145
+      // Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
146 146
       // at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
147 147
       // so SSF becomes N/L.
148 148
       // We thus need to correct above by adding
149 149
       // \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
150 150
       // Resumming carefully:
151 151
       if (whichDSF == 'd') {
152
-	FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix])) 
152
+	FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
153 153
 	  * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
154
-	FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix])) 
154
+	FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
155 155
 	  * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
156 156
       }
157 157
     }
158 158
 
159
-    // Since iKmax and iKmin are finite, we need to average over an interval of 
159
+    // Since iKmax and iKmin are finite, we need to average over an interval of
160 160
     // deltax such that (2\pi/L) iKmax deltax = 2\pi, with deltax == deltaix * L/Npts_x
161
-    // so deltaix = (Npts_x/L) * (L/iKmax) 
161
+    // so deltaix = (Npts_x/L) * (L/iKmax)
162 162
     /*
163 163
     int deltaix = 0*int(Npts_x/(2.0*iKmax));
164 164
     cout << "deltaix = " << deltaix << endl;
@@ -167,8 +167,8 @@ int main(int argc, char* argv[])
167 167
     Vect_DP FTimavg(0.0, Npts_x);
168 168
     for (int ix = 0; ix < Npts_x; ++ix) {
169 169
       for (int ix2 = -deltaix; ix2 < deltaix; ++ix2) {
170
-	FTreavg[ix] += FTre[JSC::min(JSC::max(0, ix + ix2), Npts_x - 1)];
171
-	FTimavg[ix] += FTim[JSC::min(JSC::max(0, ix + ix2), Npts_x - 1)];
170
+	FTreavg[ix] += FTre[ABACUS::min(ABACUS::max(0, ix + ix2), Npts_x - 1)];
171
+	FTimavg[ix] += FTim[ABACUS::min(ABACUS::max(0, ix + ix2), Npts_x - 1)];
172 172
       }
173 173
       FTreavg[ix] /= (2*deltaix + 1);
174 174
       FTimavg[ix] /= (2*deltaix + 1);

+ 12
- 12
src/EXECS/LiebLin_Fourier_to_x_equal_t_from_RAW.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  Fourier transform to static space correlator for LiebLin.
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 9) { // provide some info
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -50,7 +50,7 @@ int main(int argc, char* argv[])
50 50
 
51 51
     //stringstream filenameprefix;
52 52
     //Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
53
-    //string prefix = filenameprefix.str();    
53
+    //string prefix = filenameprefix.str();
54 54
 
55 55
     //stringstream RAW_stringstream;    string RAW_string;
56 56
     //RAW_stringstream << prefix << ".raw";
@@ -61,7 +61,7 @@ int main(int argc, char* argv[])
61 61
     if (RAW_infile.fail()) {
62 62
       //cout << RAW_Cstr << endl;
63 63
       cout << rawfilename << endl;
64
-      JSCerror("Could not open RAW_infile... "); 
64
+      ABACUSerror("Could not open RAW_infile... ");
65 65
     }
66 66
 
67 67
     // Define the output file name: use the RAW file name but with different suffix
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
71 71
     SFT_string = SFT_stringstream.str();    const char* SFT_Cstr = SFT_string.c_str();
72 72
     ofstream SFT_outfile;
73 73
     SFT_outfile.open(SFT_Cstr);
74
-    if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... "); 
74
+    if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
75 75
 
76 76
     // First compute the static structure factor from the RAW data:
77 77
 
@@ -93,7 +93,7 @@ int main(int argc, char* argv[])
93 93
     RAW_infile.close();
94 94
 
95 95
     // Reset proper normalization:
96
-    DP normalization = twoPI * L; 
96
+    DP normalization = twoPI * L;
97 97
     for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
98 98
 
99 99
 
@@ -117,16 +117,16 @@ int main(int argc, char* argv[])
117 117
       FTre[ix] /= L;
118 118
       FTim[ix] /= L;
119 119
 
120
-      // Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function 
120
+      // Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
121 121
       // at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
122 122
       // so SSF becomes N/L.
123 123
       // We thus need to correct above by adding
124 124
       // \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
125 125
       // Resumming carefully:
126 126
       //if (whichDSF == 'd') {
127
-      //FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix])) 
127
+      //FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
128 128
       //  * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
129
-      //FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix])) 
129
+      //FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
130 130
       //  * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
131 131
       //}
132 132
     }

+ 8
- 9
src/EXECS/LiebLin_Moses_tester.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,18 +12,18 @@ Purpose:  allows for Ix2 manipulations (user-prompted) for LiebLin gas
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 8) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -31,8 +31,8 @@ int main(int argc, char* argv[])
31 31
     cout << "DP L \t\t\t Length of the system:  use positive real values only" << endl;
32 32
     cout << "int N \t\t\t Number of particles:  use positive integer values only" << endl;
33 33
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
34
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
35
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
34
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
35
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
36 36
   }
37 37
 
38 38
   else { // (argc == 6), correct nr of arguments
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
45 45
     int DIl = atoi(argv[6]);
46 46
     int DIr = atoi(argv[7]);
47 47
 
48
-    if (whichDSF != 'd') JSCerror("Other options not implemented yet in LiebLin_Moses_tester");
48
+    if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in LiebLin_Moses_tester");
49 49
 
50 50
     // Define the Moses state:
51 51
     LiebLin_Bethe_State MosesState (c_int, L, N);
@@ -76,4 +76,3 @@ int main(int argc, char* argv[])
76 76
 
77 77
   return(0);
78 78
 }
79
-

+ 14
- 15
src/EXECS/LiebLin_RAW_File_Stats.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -13,18 +13,18 @@ Purpose:  Analyzes the distribution of matrix element values in a RAW file,
13 13
 
14 14
 ***********************************************************/
15 15
 
16
-#include "JSC.h"
16
+#include "ABACUS.h"
17 17
 
18 18
 using namespace std;
19
-using namespace JSC;
19
+using namespace ABACUS;
20 20
 
21 21
 
22
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
23 23
 {
24 24
 
25 25
   if (argc != 9) { // provide some info
26 26
 
27
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
27
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
28 28
     cout << endl << "Usage of LiebLin_RAW_File_Stats executable: " << endl;
29 29
     cout << endl << "Provide the following arguments:" << endl << endl;
30 30
     cout << "char whichDSF \t\t Which structure factor?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -46,7 +46,7 @@ int main(int argc, char* argv[])
46 46
     DP kBT = atof(argv[7]);
47 47
     int AgSize = atoi(argv[8]);
48 48
 
49
-    if (AgSize < 2) JSCerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
49
+    if (AgSize < 2) ABACUSerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
50 50
 
51 51
     stringstream RAW_stringstream;  string RAW_string;
52 52
     Data_File_Name (RAW_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
57 57
     RAW_infile.open(RAW_Cstr);
58 58
     if (RAW_infile.fail()) {
59 59
       cout << RAW_Cstr << endl;
60
-      JSCerror("Could not open RAW_infile... "); 
60
+      ABACUSerror("Could not open RAW_infile... ");
61 61
     }
62 62
 
63 63
     stringstream STAT_stringstream;  string STAT_string;
@@ -66,9 +66,9 @@ int main(int argc, char* argv[])
66 66
     STAT_string = STAT_stringstream.str();    const char* STAT_Cstr = STAT_string.c_str();
67 67
 
68 68
     ofstream STATfile;
69
-    STATfile.open(STAT_Cstr);    
69
+    STATfile.open(STAT_Cstr);
70 70
     if (STATfile.fail()) {
71
-      cout << STAT_Cstr << endl; JSCerror("Could not open STATfile.");
71
+      cout << STAT_Cstr << endl; ABACUSerror("Could not open STATfile.");
72 72
     }
73 73
 
74 74
     LiebLin_Bethe_State AveragingState = Canonical_Saddle_Point_State (c_int, L, N, whichDSF == 'Z' ? 0.0 : kBT);
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
76 76
     DP Chem_Pot = Chemical_Potential (AveragingState);
77 77
     //DP sumrule_factor = Sumrule_Factor (whichDSF, AveragingState, Chem_Pot, fixed_iK, iKneeded);
78 78
     Vect<DP> sumrule_factor(iKmax - iKmin + 1);
79
-    for (int ik = 0; ik < iKmax - iKmin + 1; ++ik) 
79
+    for (int ik = 0; ik < iKmax - iKmin + 1; ++ik)
80 80
       sumrule_factor[ik] = Sumrule_Factor (whichDSF, AveragingState, Chem_Pot, ik, ik);
81 81
     // Normalize by total number of considered momenta
82 82
     DP correction_factor = 1.0/(iKmax - iKmin + 1);
@@ -92,7 +92,7 @@ int main(int argc, char* argv[])
92 92
     DP ME;
93 93
     DP dev;
94 94
     string label;
95
-    
95
+
96 96
     int nread = 0;
97 97
 
98 98
     DP srcont = 0.0;
@@ -106,11 +106,11 @@ int main(int argc, char* argv[])
106 106
 
107 107
       RAW_infile >> omega >> iK >> ME >> dev >> label;
108 108
       nread++;
109
-      
109
+
110 110
       if (iK >= iKmin && iK <= iKmax) {
111 111
 	srcont = omega * ME * ME * sumrule_factor[iK - iKmin];
112 112
 	abssrcont = fabs(srcont);
113
-	maxsrcont = JSC::max(maxsrcont, abssrcont);
113
+	maxsrcont = ABACUS::max(maxsrcont, abssrcont);
114 114
 	totsrcont += srcont;
115 115
 	accumulatedsrcont += srcont;
116 116
 	naccounted++;
@@ -123,7 +123,7 @@ int main(int argc, char* argv[])
123 123
 	totsrcont = 0.0;
124 124
       }
125 125
     }
126
-    
126
+
127 127
     RAW_infile.close();
128 128
     STATfile.close();
129 129
   }
@@ -131,4 +131,3 @@ int main(int argc, char* argv[])
131 131
 
132 132
   return(0);
133 133
 }
134
-

+ 8
- 9
src/EXECS/LiebLin_TBA.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,19 +10,18 @@ File:  LiebLin_TBA.cc
10 10
 
11 11
 Purpose:  solves the TBA equations for Lieb-Liniger
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, const char* argv[])
22 21
 {
23 22
 
24
-  //if (argc != 7) JSCerror("Wrong number of arguments to 2CBG_ThLim executable.  Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
25
-  if (argc != 6) JSCerror("Wrong number of arguments.  Use c(best to set to 1), mu, kBT, req_diff, Max_Secs");
23
+  //if (argc != 7) ABACUSerror("Wrong number of arguments to 2CBG_ThLim executable.  Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
24
+  if (argc != 6) ABACUSerror("Wrong number of arguments.  Use c(best to set to 1), mu, kBT, req_diff, Max_Secs");
26 25
 
27 26
   DP c_int = atof(argv[1]);
28 27
   DP mu = atof(argv[2]);
@@ -30,9 +29,9 @@ int main(int argc, const char* argv[])
30 29
   DP req_diff = atof(argv[4]);
31 30
   int Max_Secs = atoi(argv[5]);
32 31
 
33
-  if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
34
-  if (kBT <= 0.0) JSCerror("Negative T ?  Not for the LiebLin gas.");
35
-  if (Max_Secs < 10) JSCerror("Give more time.");
32
+  if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
33
+  if (kBT <= 0.0) ABACUSerror("Negative T ?  Not for the LiebLin gas.");
34
+  if (Max_Secs < 10) ABACUSerror("Give more time.");
36 35
 
37 36
   //cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
38 37
 

+ 8
- 9
src/EXECS/LiebLin_TBA_fixed_nbar.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,19 +10,18 @@ File:  LiebLin_TBA_fixed_nbar.cc
10 10
 
11 11
 Purpose:  solves the TBA equations for Lieb-Liniger
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, const char* argv[])
22 21
 {
23 22
 
24
-  //if (argc != 7) JSCerror("Wrong number of arguments to 2CBG_ThLim executable.  Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
25
-  if (argc != 6) JSCerror("Wrong number of arguments.  Use c(best to set to 1), nbar, kBT, req_diff, Max_Secs");
23
+  //if (argc != 7) ABACUSerror("Wrong number of arguments to 2CBG_ThLim executable.  Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
24
+  if (argc != 6) ABACUSerror("Wrong number of arguments.  Use c(best to set to 1), nbar, kBT, req_diff, Max_Secs");
26 25
 
27 26
   DP c_int = atof(argv[1]);
28 27
   DP nbar = atof(argv[2]);
@@ -30,9 +29,9 @@ int main(int argc, const char* argv[])
30 29
   DP req_diff = atof(argv[4]);
31 30
   int Max_Secs = atoi(argv[5]);
32 31
 
33
-  if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
34
-  if (kBT <= 0.0) JSCerror("Negative T ?  Not for the LiebLin gas.");
35
-  if (Max_Secs < 10) JSCerror("Give more time.");
32
+  if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
33
+  if (kBT <= 0.0) ABACUSerror("Negative T ?  Not for the LiebLin gas.");
34
+  if (Max_Secs < 10) ABACUSerror("Give more time.");
36 35
 
37 36
   //cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
38 37
 

+ 6
- 7
src/EXECS/LiebLin_TBA_fixed_nbar_ebar.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,18 +10,17 @@ File:  LiebLin_TBA_fixed_nbar_ebar.cc
10 10
 
11 11
 Purpose:  solves the TBA equations for Lieb-Liniger
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 int main(int argc, const char* argv[])
22 21
 {
23 22
 
24
-  if (argc != 7) JSCerror("Wrong number of arguments.  Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
23
+  if (argc != 7) ABACUSerror("Wrong number of arguments.  Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
25 24
 
26 25
   DP c_int = atof(argv[1]);
27 26
   DP nbar = atof(argv[2]);
@@ -30,8 +29,8 @@ int main(int argc, const char* argv[])
30 29
   int Max_Secs = atoi(argv[5]);
31 30
   bool Save_data = bool(atoi(argv[6]));
32 31
 
33
-  if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
34
-  if (Max_Secs < 10) JSCerror("Give more time.");
32
+  if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
33
+  if (Max_Secs < 10) ABACUSerror("Give more time.");
35 34
 
36 35
   //cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
37 36
 

+ 8
- 9
src/EXECS/ODSLF_DSF.cc View File

@@ -1,29 +1,29 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  ODSLF_DSF.cc
10 10
 
11
-Purpose:  main function for ABACUS++ for spinless fermions related to Heisenberg spin-1/2 chain
11
+Purpose:  main function for ABACUS for spinless fermions related to Heisenberg spin-1/2 chain
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
 
24 24
   if (argc != 10) { // provide some info
25 25
 
26
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
26
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
27 27
     cout << "Usage of ODSLF_DSF executable: " << endl;
28 28
     cout << endl << "Provide the following arguments:" << endl << endl;
29 29
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  m for S- S+, z for Sz Sz, p for S+ S-." << endl;
@@ -53,8 +53,7 @@ int main(int argc, char* argv[])
53 53
   }
54 54
 
55 55
 
56
-  else JSCerror("Wrong number of arguments to ODSLF_DSF executable.");
56
+  else ABACUSerror("Wrong number of arguments to ODSLF_DSF executable.");
57 57
 
58 58
   return(0);
59 59
 }
60
-

+ 8
- 8
src/EXECS/Produce_Sorted_RAW_File.cc View File

@@ -1,28 +1,28 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9 9
 File:  Sort_RAW_File.cc
10 10
 
11 11
 Purpose:  produce a sorted .raw file.
12
-          
12
+
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23
-  if (argc != 4) { 
23
+  if (argc != 4) {
24 24
     cout << "Arguments needed: rawfile, whichDSF, whichsorting." << endl;
25
-    JSCerror("");
25
+    ABACUSerror("");
26 26
   }
27 27
 
28 28
   const char* rawfilename = argv[1];

+ 13
- 14
src/EXECS/RAW_File_Stats.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -13,18 +13,18 @@ Purpose:  Analyzes the distribution of matrix element values in a RAW file,
13 13
 
14 14
 ***********************************************************/
15 15
 
16
-#include "JSC.h"
16
+#include "ABACUS.h"
17 17
 
18 18
 using namespace std;
19
-using namespace JSC;
19
+using namespace ABACUS;
20 20
 
21 21
 
22
-int main(int argc, char* argv[]) 
22
+int main(int argc, char* argv[])
23 23
 {
24 24
 
25 25
   if (argc != 3) { // provide some info
26 26
 
27
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
27
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
28 28
     cout << endl << "Usage of RAW_File_Stats executable: " << endl;
29 29
     cout << endl << "Provide the following arguments:" << endl << endl;
30 30
     cout << endl << "string RAW file name" << endl;
@@ -35,13 +35,13 @@ int main(int argc, char* argv[])
35 35
     const char* rawfilename = argv[1];
36 36
     int AgSize = atoi(argv[2]);
37 37
 
38
-    if (AgSize < 2) JSCerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
38
+    if (AgSize < 2) ABACUSerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
39 39
 
40 40
     ifstream RAW_infile;
41 41
     RAW_infile.open(rawfilename);
42 42
     if (RAW_infile.fail()) {
43 43
       cout << rawfilename << endl;
44
-      JSCerror("Could not open RAW_infile... "); 
44
+      ABACUSerror("Could not open RAW_infile... ");
45 45
     }
46 46
 
47 47
     stringstream STAT_stringstream;  string STAT_string;
@@ -49,9 +49,9 @@ int main(int argc, char* argv[])
49 49
     STAT_string = STAT_stringstream.str();    const char* STAT_Cstr = STAT_string.c_str();
50 50
 
51 51
     ofstream STATfile;
52
-    STATfile.open(STAT_Cstr);    
52
+    STATfile.open(STAT_Cstr);
53 53
     if (STATfile.fail()) {
54
-      cout << STAT_Cstr << endl; JSCerror("Could not open STATfile.");
54
+      cout << STAT_Cstr << endl; ABACUSerror("Could not open STATfile.");
55 55
     }
56 56
 
57 57
     DP omega;
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
59 59
     DP ME;
60 60
     DP dev;
61 61
     string label;
62
-    
62
+
63 63
     int nread = 0;
64 64
 
65 65
     DP srcont = 0.0;
@@ -73,10 +73,10 @@ int main(int argc, char* argv[])
73 73
 
74 74
       RAW_infile >> omega >> iK >> ME >> dev >> label;
75 75
       nread++;
76
-      
76
+
77 77
       srcont = ME * ME;
78 78
       abssrcont = fabs(srcont);
79
-      maxsrcont = JSC::max(maxsrcont, abssrcont);
79
+      maxsrcont = ABACUS::max(maxsrcont, abssrcont);
80 80
       totsrcont += srcont;
81 81
       accumulatedsrcont += srcont;
82 82
       naccounted++;
@@ -88,7 +88,7 @@ int main(int argc, char* argv[])
88 88
 	totsrcont = 0.0;
89 89
       }
90 90
     }
91
-    
91
+
92 92
     RAW_infile.close();
93 93
     STATfile.close();
94 94
   }
@@ -96,4 +96,3 @@ int main(int argc, char* argv[])
96 96
 
97 97
   return(0);
98 98
 }
99
-

+ 9
- 9
src/EXECS/Smoothen_Heis_DSF.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,13 +12,13 @@ Purpose:  produces .dsf and .ssf files from a .raw file
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 13 && argc != 14) { // Print out instructions
24 24
     //if (strcmp(argv[1],"help") == 0) { // Output some instructions
@@ -26,7 +26,7 @@ int main(int argc, char* argv[])
26 26
     cout << "Provide arguments using one of the following options:" << endl << endl;
27 27
     cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax DiK kBT ommin ommax Nom gwidth" << endl << endl;
28 28
     cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
29
-    //else JSCerror("Incomprehensible arguments in Smoothen_Heis_DSF executable.");
29
+    //else ABACUSerror("Incomprehensible arguments in Smoothen_Heis_DSF executable.");
30 30
   }
31 31
 
32 32
   else if (argc == 13) { // !fixed_iK
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
45 45
 
46 46
     stringstream filenameprefix;
47 47
     Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, kBT, 0, "");
48
-    string prefix = filenameprefix.str();    
48
+    string prefix = filenameprefix.str();
49 49
 
50 50
     DP normalization = twoPI;
51 51
     DP denom_sum_K = 1.0/N;
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
74 74
 
75 75
     stringstream filenameprefix;
76 76
     Data_File_Name (filenameprefix, whichDSF, Delta, N, M, fixed_iK, iKneeded, 0.0, 0, "");
77
-    string prefix = filenameprefix.str();    
77
+    string prefix = filenameprefix.str();
78 78
 
79 79
     DP normalization = twoPI;
80 80
     int iKmin = iKneeded;
@@ -84,7 +84,7 @@ int main(int argc, char* argv[])
84 84
   }
85 85
   */
86 86
 
87
-  //else JSCerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
87
+  //else ABACUSerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
88 88
 
89 89
   return(0);
90 90
 }

+ 12
- 12
src/EXECS/Smoothen_LiebLin_DSF.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  produces .dsf and .ssf files from a .raw file
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 13) { // Print out instructions
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of Smoothen_LiebLin_DSF executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
58 58
     stringstream filenameprefix;
59 59
     //void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
60 60
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
61
-    string prefix = filenameprefix.str();    
61
+    string prefix = filenameprefix.str();
62 62
 
63 63
     DP normalization = twoPI * L;
64 64
     DP denom_sum_K = L;
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
69 69
     // We use the scaled width function as default:
70 70
 
71 71
     DP sumcheck;
72
-    //if (kBT < 0.1) 
72
+    //if (kBT < 0.1)
73 73
     //sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
74 74
     sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
75 75
       //else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
@@ -88,14 +88,14 @@ int main(int argc, char* argv[])
88 88
     DP ommax = atof(argv[8]);
89 89
     int Nom = atoi(argv[9]);
90 90
     DP gwidth = atof(argv[10]);
91
-    
91
+
92 92
     //bool fixed_iK = true;
93
-    //LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);  
93
+    //LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
94 94
     stringstream filenameprefix;
95
-    //Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);  
95
+    //Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
96 96
     //Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 0.0);
97 97
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, iKneeded, iKneeded, 0.0);
98
-    string prefix = filenameprefix.str();    
98
+    string prefix = filenameprefix.str();
99 99
 
100 100
     DP normalization = twoPI * L;
101 101
     int iKmin = iKneeded;
@@ -105,7 +105,7 @@ int main(int argc, char* argv[])
105 105
   }
106 106
   */
107 107
 
108
-  //else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
108
+  //else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
109 109
 
110 110
   return(0);
111 111
 }

+ 12
- 12
src/EXECS/Smoothen_LiebLin_DSF_GeneralState.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  produces .dsf and .ssf files from a .raw file
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 13) { // Print out instructions
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of Smoothen_LiebLin_DSF executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -67,7 +67,7 @@ int main(int argc, char* argv[])
67 67
     //void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
68 68
     //Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
69 69
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, defaultScanStatename);
70
-    string prefix = filenameprefix.str();    
70
+    string prefix = filenameprefix.str();
71 71
 
72 72
     DP normalization = twoPI * L;
73 73
     DP denom_sum_K = L;
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
78 78
     // We use the scaled width function as default:
79 79
 
80 80
     DP sumcheck;
81
-    //if (kBT < 0.1) 
81
+    //if (kBT < 0.1)
82 82
     //sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
83 83
     sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
84 84
       //else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
@@ -97,14 +97,14 @@ int main(int argc, char* argv[])
97 97
     DP ommax = atof(argv[8]);
98 98
     int Nom = atoi(argv[9]);
99 99
     DP gwidth = atof(argv[10]);
100
-    
100
+
101 101
     //bool fixed_iK = true;
102
-    //LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);  
102
+    //LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
103 103
     stringstream filenameprefix;
104
-    //Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);  
104
+    //Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
105 105
     //Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 0.0);
106 106
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, iKneeded, iKneeded, 0.0);
107
-    string prefix = filenameprefix.str();    
107
+    string prefix = filenameprefix.str();
108 108
 
109 109
     DP normalization = twoPI * L;
110 110
     int iKmin = iKneeded;
@@ -114,7 +114,7 @@ int main(int argc, char* argv[])
114 114
   }
115 115
   */
116 116
 
117
-  //else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
117
+  //else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
118 118
 
119 119
   return(0);
120 120
 }

+ 10
- 10
src/EXECS/Smoothen_LiebLin_DSF_MosesState.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  produces .dsf and .ssf files from a .raw file
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 15) { // Print out instructions
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of Smoothen_LiebLin_DSF_MosesState executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -30,8 +30,8 @@ int main(int argc, char* argv[])
30 30
     cout << "DP L \t\t\t Length of the system" << endl;
31 31
     cout << "int N \t\t\t Number of particles" << endl;
32 32
     cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
33
-    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl; 
34
-    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl; 
33
+    cout << "int DIl \t\t shift of left  sea as compared to its ground state position" << endl;
34
+    cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
35 35
     cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers" << endl;
36 36
     //cout << "DP kBT \t\t Temperature" << endl;
37 37
     cout << "int DiK \t\t\t Window of iK over which DSF is averaged (DiK == 0 means a single iK is used; DiK == 1 means 3 are used (iK-1, iK, iK+1), etc.)" << endl;
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
71 71
     stringstream filenameprefix;
72 72
     //void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
73 73
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, defaultScanStatename);
74
-    string prefix = filenameprefix.str();    
74
+    string prefix = filenameprefix.str();
75 75
 
76 76
 
77 77
 
@@ -84,14 +84,14 @@ int main(int argc, char* argv[])
84 84
     // We use the scaled width function as default:
85 85
 
86 86
     DP sumcheck;
87
-    //if (kBT < 0.1) 
87
+    //if (kBT < 0.1)
88 88
     //sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
89 89
     sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
90 90
       //else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
91 91
     //cout << "Smoothing:  sumcheck = " << sumcheck << endl;
92 92
   }
93 93
 
94
-  //else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
94
+  //else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
95 95
 
96 96
   return(0);
97 97
 }

+ 8
- 8
src/EXECS/Smoothen_LiebLin_DSF_Scaled.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  produces .dsfs and .ssf files from a .raw file
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 13) { // Print out instructions
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of Smoothen_LiebLin_DSF_Scaled executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
58 58
     stringstream filenameprefix;
59 59
     //void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
60 60
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
61
-    string prefix = filenameprefix.str();    
61
+    string prefix = filenameprefix.str();
62 62
 
63 63
     DP normalization = twoPI * L;
64 64
     //DP denom_sum_K = L;
@@ -69,14 +69,14 @@ int main(int argc, char* argv[])
69 69
     // We use the scaled width function as default:
70 70
 
71 71
     DP sumcheck;
72
-    //if (kBT < 0.1) 
72
+    //if (kBT < 0.1)
73 73
     sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
74 74
     //sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
75 75
       //else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
76 76
     //cout << "Smoothing:  sumcheck = " << sumcheck << endl;
77 77
   }
78 78
 
79
-  //else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
79
+  //else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
80 80
 
81 81
   return(0);
82 82
 }

+ 11
- 11
src/EXECS/Smoothen_LiebLin_DSF_over_Ensemble.cc View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c).
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,17 +12,17 @@ Purpose:  produces .dsf and .ssf files from an ensemble of .raw files
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 13) { // Print out instructions
24 24
 
25
-    cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
25
+    cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
26 26
     cout << endl << "Usage of Smoothen_LiebLin_DSF_over_Ensemble executable: " << endl;
27 27
     cout << endl << "Provide the following arguments:" << endl << endl;
28 28
     cout << "char whichDSF \t\t Which structure factor should be calculated ?  Options are:  d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
@@ -42,7 +42,7 @@ int main(int argc, char* argv[])
42 42
 
43 43
   }
44 44
 
45
-  else if (argc == 13) { 
45
+  else if (argc == 13) {
46 46
     char whichDSF = *argv[1];
47 47
     DP c_int = atof(argv[2]);
48 48
     DP L = atof(argv[3]);
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
60 60
     stringstream filenameprefix;
61 61
     //void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
62 62
     Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
63
-    string prefix = filenameprefix.str();    
63
+    string prefix = filenameprefix.str();
64 64
 
65 65
     DP normalization = twoPI * L;
66 66
     DP denom_sum_K = L;
@@ -85,16 +85,16 @@ int main(int argc, char* argv[])
85 85
     for (int ns = 0; ns < ensemble.nstates; ++ns) {
86 86
       // Define the raw input file name:
87 87
       stringstream filenameprefix;
88
-      //Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);  
89
-      Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);  
90
-      string prefix = filenameprefix.str();    
88
+      //Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
89
+      Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
90
+      string prefix = filenameprefix.str();
91 91
       stringstream RAW_stringstream;    string RAW_string;
92 92
       RAW_stringstream << prefix << ".raw";
93 93
       //RAW_string = RAW_stringstream.str();    const char* RAW_Cstr = RAW_string.c_str();
94 94
       rawfilename[ns] = RAW_stringstream.str();
95 95
     }
96 96
 
97
-    Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK, 
97
+    Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK,
98 98
 			  ommin, ommax, Nom, width, normalization, denom_sum_K);
99 99
 
100 100
   }

+ 9
- 9
src/EXECS/Smoothen_ODSLF_DSF.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -12,13 +12,13 @@ Purpose:  produces .dsf and .ssf files from a .raw file
12 12
 
13 13
 ***********************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18
-using namespace JSC;
18
+using namespace ABACUS;
19 19
 
20 20
 
21
-int main(int argc, char* argv[]) 
21
+int main(int argc, char* argv[])
22 22
 {
23 23
   if (argc != 10 && argc != 11) { // Print out instructions
24 24
     //if (strcmp(argv[1],"help") == 0) { // Output some instructions
@@ -26,7 +26,7 @@ int main(int argc, char* argv[])
26 26
     cout << "Provide arguments using one of the following options:" << endl << endl;
27 27
     cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax ommin ommax Nom gwidth" << endl << endl;
28 28
     cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
29
-    //else JSCerror("Incomprehensible arguments in Smoothen_ODSLF_DSF executable.");
29
+    //else ABACUSerror("Incomprehensible arguments in Smoothen_ODSLF_DSF executable.");
30 30
   }
31 31
 
32 32
   else if (argc == 11) { // !fixed_iK
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
43 43
 
44 44
     stringstream filenameprefix;
45 45
     ODSLF_Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, 0.0, 0);
46
-    string prefix = filenameprefix.str();    
46
+    string prefix = filenameprefix.str();
47 47
 
48 48
     DP normalization = twoPI;
49 49
 
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
69 69
 
70 70
     stringstream filenameprefix;
71 71
     Data_File_Name (filenameprefix, whichDSF, Delta, N, M, fixed_iK, iKneeded, 0.0, 0);
72
-    string prefix = filenameprefix.str();    
72
+    string prefix = filenameprefix.str();
73 73
 
74 74
     DP normalization = twoPI;
75 75
     int iKmin = iKneeded;
@@ -78,5 +78,5 @@ int main(int argc, char* argv[])
78 78
     cout << "Smoothing:  sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, gwidth, normalization) << endl;
79 79
   }
80 80
 
81
-  else JSCerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
81
+  else ABACUSerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
82 82
 }

+ 27
- 28
src/EXECS/XXZ_gpd_StagSz_h0.cc View File

@@ -1,43 +1,42 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  ABACUS++G_2_testing.cc
10
-
11
-Purpose:  testing of ABACUS++2
9
+File:  XXZ_gpd_StagSz_h0.cc
12 10
 
11
+Purpose:  Compute the staggered magentization of XXZ_gpd in zero field.
13 12
 
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21 20
 
22
-int main( int argc, char* argv[]) 
21
+int main( int argc, char* argv[])
23 22
 {
24 23
   if (!(argc == 3 || argc == 5)) { // provide some info
25 24
     cout << endl << "This code computes the (1/N) (-1)^j S^z_j on-site staggered magnetization for XXZ_gpd in zero field." << endl;
26 25
     cout << "First option: provide two arguments: anisotropy Delta (> 1) and system size N (even)." << endl;
27 26
     cout << "Second option: provide five arguments: system size N (even), Delta min, Delta max, NDelta." << endl;
28 27
     cout << "The output is Delta, N, stag mag, energy gap." << endl;
29
-    JSCerror("");
28
+    ABACUSerror("");
30 29
   }
31 30
   else if (argc == 3) {
32 31
     DP Delta = atof(argv[1]);
33
-    if (Delta <= 1.0) JSCerror("Provide Delta > 1.");
32
+    if (Delta <= 1.0) ABACUSerror("Provide Delta > 1.");
34 33
     int N = atoi(argv[2]);
35
-    if (N % 2) JSCerror("Provide an even Delta.");
34
+    if (N % 2) ABACUSerror("Provide an even Delta.");
36 35
     int M = N/2;
37 36
 
38 37
     // Define the chain:  J, Delta, h, Nsites
39 38
     Heis_Chain chain(1.0, Delta, 0.0, N);
40
-    
39
+
41 40
     Heis_Base gbase(chain, M);
42 41
 
43 42
     XXZ_gpd_Bethe_State gstate(chain, gbase);
@@ -54,9 +53,9 @@ int main( int argc, char* argv[])
54 53
     XXZ_gpd_Bethe_State estategap(chain, basegap);
55 54
     estategap.Compute_All(true);
56 55
 
57
-    if (!gstate.conv) JSCerror("Ground state did not converge.");
58
-    if (!estate.conv) JSCerror("Umklapp state did not converge.");
59
-    if (!estategap.conv) JSCerror("Gap state did not converge.");
56
+    if (!gstate.conv) ABACUSerror("Ground state did not converge.");
57
+    if (!estate.conv) ABACUSerror("Umklapp state did not converge.");
58
+    if (!estategap.conv) ABACUSerror("Gap state did not converge.");
60 59
 
61 60
     cout << Delta << "\t" << N << "\t" << setprecision(12) << exp(real(ln_Sz_ME (gstate, estate)))/sqrt(N) << "\t" << estategap.E - gstate.E << endl;
62 61
 
@@ -65,14 +64,14 @@ int main( int argc, char* argv[])
65 64
   else if (argc == 5) { // Do a scan in Delta
66 65
 
67 66
     int N = atoi(argv[1]);
68
-    if (N % 2) JSCerror("Provide an even Delta.");
67
+    if (N % 2) ABACUSerror("Provide an even Delta.");
69 68
     int M = N/2;
70 69
 
71 70
     DP Deltamin = atof(argv[2]);
72
-    if (Deltamin <= 1.0) JSCerror("Provide Deltamin > 1.");
71
+    if (Deltamin <= 1.0) ABACUSerror("Provide Deltamin > 1.");
73 72
 
74 73
     DP Deltamax = atof(argv[3]);
75
-    if (Deltamin <= 1.0) JSCerror("Provide Deltamax > Deltamin.");
74
+    if (Deltamin <= 1.0) ABACUSerror("Provide Deltamax > Deltamin.");
76 75
 
77 76
     int NDelta = atoi(argv[4]);
78 77
 
@@ -82,29 +81,29 @@ int main( int argc, char* argv[])
82 81
 
83 82
       // Define the chain:  J, Delta, h, Nsites
84 83
       Heis_Chain chain(1.0, Delta, 0.0, N);
85
-      
84
+
86 85
       Heis_Base gbase(chain, M);
87
-      
86
+
88 87
       XXZ_gpd_Bethe_State gstate(chain, gbase);
89 88
       gstate.Compute_All(true);
90
-      
89
+
91 90
       XXZ_gpd_Bethe_State estate(chain, gbase);
92 91
       estate.Ix2[0][0] = M+1; // umklapp excitation
93 92
       estate.Compute_All(true);
94
-      
93
+
95 94
       stringstream basestrstream;
96 95
       basestrstream << M-2 << "x1";
97 96
       string basestr = basestrstream.str();
98 97
       Heis_Base basegap(chain, basestr);
99 98
       XXZ_gpd_Bethe_State estategap(chain, basegap);
100 99
       estategap.Compute_All(true);
101
-      
102
-      if (!gstate.conv) JSCerror("Ground state did not converge.");
103
-      if (!estate.conv) JSCerror("Umklapp state did not converge.");
104
-      if (!estategap.conv) JSCerror("Gap state did not converge.");
105
-      
100
+
101
+      if (!gstate.conv) ABACUSerror("Ground state did not converge.");
102
+      if (!estate.conv) ABACUSerror("Umklapp state did not converge.");
103
+      if (!estategap.conv) ABACUSerror("Gap state did not converge.");
104
+
106 105
       cout << Delta << "\t" << N << "\t" << setprecision(12) << exp(real(ln_Sz_ME (gstate, estate)))/sqrt(N) << "\t" << estategap.E - gstate.E << endl;
107
-      
106
+
108 107
     }
109 108
   }
110 109
 

+ 7
- 9
src/FITTING/covsrt.cc View File

@@ -1,26 +1,24 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's C++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 2007.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  mrqmin.cc
9
+File:  covsrt.cc
10 10
 
11
-Purpose:  Nonlinear fitting
12
-
13
-Last modified:  14/08/07
11
+Purpose:  covsrt algorithm
14 12
 
15 13
 ***********************************************************/
16 14
 
17
-#include "JSC.h"
15
+#include "ABACUS.h"
18 16
 
19 17
 using namespace std;
20 18
 
21
-namespace JSC {
19
+namespace ABACUS {
22 20
 
23
-  void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit) 
21
+  void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit)
24 22
   {
25 23
     int i, j, k;
26 24
 

+ 4
- 6
src/FITTING/lin_reg.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's C++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 2006.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,15 +10,13 @@ File:  lin_reg.cc
10 10
 
11 11
 Purpose:  Linear regression
12 12
 
13
-Last modified:  11/05/07
14
-
15 13
 ***********************************************************/
16 14
 
17
-#include "JSC.h"
15
+#include "ABACUS.h"
18 16
 
19 17
 using namespace std;
20 18
 
21
-namespace JSC {
19
+namespace ABACUS {
22 20
 
23 21
   void lin_reg (Vect_DP x, Vect_DP y, Vect_DP sigma, DP& a, DP& b, DP& chisq)
24 22
   {

+ 7
- 9
src/FITTING/mrq.cc View File

@@ -1,26 +1,24 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's C++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 2007.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
-File:  mrqmin.cc
9
+File:  mrq.cc
10 10
 
11
-Purpose:  Nonlinear fitting
12
-
13
-Last modified:  14/08/07
11
+Purpose:  mrqmin and mrqcof algorithms
14 12
 
15 13
 ***********************************************************/
16 14
 
17
-#include "JSC.h"
15
+#include "ABACUS.h"
18 16
 
19 17
 using namespace std;
20 18
 
21
-namespace JSC {
19
+namespace ABACUS {
22 20
 
23
-  void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a, 
21
+  void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
24 22
 	       Vect<bool>& ia, SQMat_DP& covar, SQMat_DP& alpha, DP& chisq,
25 23
 	       void funcs(const DP, Vect_DP&, DP&, Vect_DP&), DP& alambda)
26 24
   {

+ 17
- 3
src/FITTING/polint.cc View File

@@ -1,7 +1,21 @@
1
-#include "JSC.h"
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  polint.cc
10
+
11
+Purpose:  Polynomial interpolation
12
+
13
+***********************************************************/
14
+
15
+#include "ABACUS.h"
2 16
 using namespace std;
3 17
 
4
-void JSC::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
18
+void ABACUS::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
5 19
 {
6 20
   // Polynomial interpolation/extrapolation, NR page 113.
7 21
 
@@ -25,7 +39,7 @@ void JSC::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
25 39
       ho = xa[i] - x;
26 40
       hp = xa[i+m] - x;
27 41
       w = c[i+1] - d[i];
28
-      if ((den = ho-hp) == 0.0) JSCerror("Error in routine polint.");
42
+      if ((den = ho-hp) == 0.0) ABACUSerror("Error in routine polint.");
29 43
       den = w/den;
30 44
       d[i] = hp * den;
31 45
       c[i] = ho * den;

+ 17
- 3
src/FITTING/polint_cx.cc View File

@@ -1,7 +1,21 @@
1
-#include "JSC.h"
1
+/**********************************************************
2
+
3
+This software is part of J.-S. Caux's ABACUS library.
4
+
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File:  polint_cx.cc
10
+
11
+Purpose:  Polynomial interpolation
12
+
13
+***********************************************************/
14
+
15
+#include "ABACUS.h"
2 16
 using namespace std;
3 17
 
4
-void JSC::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy)
18
+void ABACUS::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy)
5 19
 {
6 20
   // Polynomial interpolation/extrapolation, NR page 113.
7 21
 
@@ -26,7 +40,7 @@ void JSC::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y,
26 40
       ho = xa[i] - x;
27 41
       hp = xa[i+m] - x;
28 42
       w = c[i+1] - d[i];
29
-      if ((den = ho-hp) == 0.0) JSCerror("Error in routine polint_cx.");
43
+      if ((den = ho-hp) == 0.0) ABACUSerror("Error in routine polint_cx.");
30 44
       den = w/den;
31 45
       d[i] = hp * den;
32 46
       c[i] = ho * den;

+ 227
- 228
src/HEIS/Heis.cc
File diff suppressed because it is too large
View File


+ 23
- 22
src/HEIS/Heis_Chem_Pot.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,19 +10,20 @@ File:  src/HEIS/Heis_Chem_Pot.cc
10 10
 
11 11
 Purpose:  calculates the chemical potential.
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
16
+
17
+using namespace std;
17 18
 
18
-namespace JSC { 
19
+namespace ABACUS {
19 20
 
20 21
   DP Ezero (DP Delta, int N, int M)
21 22
   {
22 23
     // Returns the energy of the ground state with M down spins
23 24
 
24
-    if (M < 0 || M > N/2) JSCerror("M out of bounds in Ezero.");
25
-   
25
+    if (M < 0 || M > N/2) ABACUSerror("M out of bounds in Ezero.");
26
+
26 27
     DP E = -1.0; // sentinel value
27 28
 
28 29
     if (M == 0) E = N * Delta/4.0;
@@ -30,32 +31,32 @@ namespace JSC {
30 31
     else {
31 32
 
32 33
       Heis_Chain BD1(1.0, Delta, 0.0, N);
33
-      
34
+
34 35
       Vect_INT Nrapidities_groundstate(0, BD1.Nstrings);
35
-      
36
+
36 37
       Nrapidities_groundstate[0] = M;
37
-      
38
+
38 39
       Heis_Base baseconfig_groundstate(BD1, Nrapidities_groundstate);
39
-      
40
+
40 41
       if ((Delta > 0.0) && (Delta < 1.0)) {
41 42
 	XXZ_Bethe_State groundstate(BD1, baseconfig_groundstate);
42 43
 	groundstate.Compute_All(true);
43 44
 	E = groundstate.E;
44 45
       }
45
-      
46
+
46 47
       else if (Delta == 1.0) {
47 48
 	XXX_Bethe_State groundstate(BD1, baseconfig_groundstate);
48 49
 	groundstate.Compute_All(true);
49 50
 	E = groundstate.E;
50 51
       }
51
-      
52
+
52 53
       else if (Delta > 1.0) {
53 54
 	XXZ_gpd_Bethe_State groundstate(BD1, baseconfig_groundstate);
54 55
 	groundstate.Compute_All(true);
55 56
 	E = groundstate.E;
56 57
       }
57
-      
58
-      else JSCerror("Anisotropy out of bounds in Ezero.");
58
+
59
+      else ABACUSerror("Anisotropy out of bounds in Ezero.");
59 60
     }
60 61
 
61 62
     return(E);
@@ -67,7 +68,7 @@ namespace JSC {
67 68
 
68 69
     DP H = 0.0;
69 70
 
70
-    if (2*M == N) H = 0.0; 
71
+    if (2*M == N) H = 0.0;
71 72
 
72 73
     else if (Delta <= 1.0) H = Ezero (Delta, N, M - 1) - Ezero (Delta, N, M);
73 74
 
@@ -78,7 +79,7 @@ namespace JSC {
78 79
   {
79 80
     if (M < 0 || M > N/2 - 1) {
80 81
       cout << "M = " << M << endl;
81
-      JSCerror("M out of bounds in HZmin.");    
82
+      ABACUSerror("M out of bounds in HZmin.");
82 83
     }
83 84
 
84 85
     if (Ezero_ref[M] == -1.0) Ezero_ref[M] = Ezero(Delta, N, M);
@@ -91,7 +92,7 @@ namespace JSC {
91 92
   {
92 93
     // Returns the value of M for given field HZ
93 94
 
94
-    if (HZ < 0.0) JSCerror("Please use a positive field in M_vs_H.");
95
+    if (HZ < 0.0) ABACUSerror("Please use a positive field in M_vs_H.");
95 96
 
96 97
     else if (HZ == 0.0) return(N/2);
97 98
 
@@ -109,7 +110,7 @@ namespace JSC {
109 110
     if (HZ >= 1.0 + Delta) M_actual = 0;  // saturation
110 111
 
111 112
     else {
112
-      
113
+
113 114
       HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
114 115
       HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
115 116
 
@@ -117,15 +118,15 @@ namespace JSC {
117 118
 
118 119
 	if (HZmin_actual > HZ) M_actual += M_step;
119 120
 	else if (HZmax_actual <= HZ) M_actual -= M_step;
120
-	
121
+
121 122
 	M_step = (M_step + 1)/2;
122 123
 
123 124
 	HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
124 125
 	HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
125 126
 
126
-	M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);	
127
+	M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
127 128
 
128
-	//cout << "M_actual = " << M_actual << "\tM_step = " << M_step 
129
+	//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
129 130
 	//   << "\tHZmin_actual = " << HZmin_actual << "\tHZmax_actual = " << HZmax_actual << "\tHZ = " << HZ << "\t" << M_found << endl;
130 131
       }
131 132
     }

+ 10
- 11
src/HEIS/Heis_Matrix_Element_Contrib.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,15 +10,14 @@ File:  src/HEIS/Heis_Matrix_Element_Contrib.cc
10 10
 
11 11
 Purpose:  handles the generic call for a matrix element.
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19
-using namespace JSC;
18
+using namespace ABACUS;
20 19
 
21
-namespace JSC {
20
+namespace ABACUS {
22 21
 
23 22
   //DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_Bethe_State& LeftState,
24 23
 				     //XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
@@ -50,7 +49,7 @@ namespace JSC {
50 49
     }
51 50
     else if (whichDSF == 'p')
52 51
       ME = exp(real(ln_Smin_ME (LeftState, RightState)));
53
-    else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
52
+    else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
54 53
 
55 54
     if (is_nan(ME)) ME = 0.0;
56 55
 
@@ -157,7 +156,7 @@ namespace JSC {
157 156
     else if (whichDSF == 'q') // Geometric quench
158 157
       //ME_CX = ln_Overlap (LeftState, RightState);
159 158
       ME_CX = ln_Overlap (RightState, LeftState);
160
-    else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
159
+    else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
161 160
 
162 161
     if (is_nan(ME)) ME = 0.0;
163 162
     if (is_nan(norm(ME_CX))) ME_CX = -100.0;
@@ -254,7 +253,7 @@ namespace JSC {
254 253
 
255 254
       sum1 = 0;
256 255
       for (int k = 0; k < LeftState.chain.Nstrings; ++k)
257
-	sum1 += LeftState.base.Nrap[k] * (2 * JSC::min(LeftState.chain.Str_L[j], LeftState.chain.Str_L[k]) - ((j == k) ? 1 : 0));
256
+	sum1 += LeftState.base.Nrap[k] * (2 * ABACUS::min(LeftState.chain.Str_L[j], LeftState.chain.Str_L[k]) - ((j == k) ? 1 : 0));
258 257
       // This almost does it:  only missing are the states with one on -PI/2 and one on PI/2
259 258
       if (LeftState.base.Nrap[j] >= 1
260 259
 	  && (LeftState.Ix2[j][0] <= -(LeftState.chain.Nsites - sum1)
@@ -324,7 +323,7 @@ namespace JSC {
324 323
     }
325 324
     else if (whichDSF == 'p')
326 325
       ME = exp(real(ln_Smin_ME (LeftState, RightState)));
327
-    else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
326
+    else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
328 327
 
329 328
     if (is_nan(ME)) ME = 0.0;
330 329
 
@@ -376,4 +375,4 @@ namespace JSC {
376 375
   }
377 376
 
378 377
 
379
-} // namespace JSC
378
+} // namespace ABACUS

+ 30
- 31
src/HEIS/Heis_Sumrules.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,14 +10,13 @@ File:  src/HEIS/Heis_Sumrules.cc
10 10
 
11 11
 Purpose:  defines sumrule factors for Heisenberg
12 12
 
13
-
14 13
 ***********************************************************/
15 14
 
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19 18
 
20
-namespace JSC {
19
+namespace ABACUS {
21 20
 
22 21
   DP X_avg (char xyorz, DP Delta, int N, int M)
23 22
   {
@@ -29,24 +28,24 @@ namespace JSC {
29 28
 
30 29
     // Define the chain:  J, Delta, h, Nsites
31 30
     Heis_Chain chain(1.0, Delta, 0.0, N);
32
-    
31
+
33 32
     // Define the base:  chain, Mdown
34 33
     Heis_Base gbase(chain, M);
35 34
 
36 35
     // Define the chain:  J, Delta, h, Nsites
37 36
     Heis_Chain chain2(1.0, Delta + eps_Delta, 0.0, N);
38
-    
37
+
39 38
     // Define the base:  chain, Mdown
40 39
     Heis_Base gbase2(chain2, M);
41
-    
40
+
42 41
     DP E0_Delta = 0.0;
43
-    DP E0_Delta_eps = 0.0; 
42
+    DP E0_Delta_eps = 0.0;
44 43
 
45 44
     if (Delta > 0.0 && Delta < 1.0) {
46 45
 
47 46
       // Define the ground state
48 47
       XXZ_Bethe_State gstate(chain, gbase);
49
-    
48
+
50 49
       // Compute everything about the ground state
51 50
       gstate.Compute_All(true);
52 51
 
@@ -54,7 +53,7 @@ namespace JSC {
54 53
 
55 54
       // Define the ground state
56 55
       XXZ_Bethe_State gstate2(chain2, gbase2);
57
-    
56
+
58 57
       // Compute everything about the ground state
59 58
       gstate2.Compute_All(true);
60 59
 
@@ -64,7 +63,7 @@ namespace JSC {
64 63
     else if (Delta == 1.0) {
65 64
       // Define the ground state
66 65
       XXX_Bethe_State gstate(chain, gbase);
67
-    
66
+
68 67
       // Compute everything about the ground state
69 68
       gstate.Compute_All(true);
70 69
 
@@ -72,7 +71,7 @@ namespace JSC {
72 71
 
73 72
       // Define the ground state
74 73
       XXZ_gpd_Bethe_State gstate2(chain2, gbase2);  // need XXZ_gpd here
75
-    
74
+
76 75
       // Compute everything about the ground state
77 76
       gstate2.Compute_All(true);
78 77
 
@@ -82,7 +81,7 @@ namespace JSC {
82 81
     else if (Delta > 1.0) {
83 82
       // Define the ground state
84 83
       XXZ_gpd_Bethe_State gstate(chain, gbase);
85
-    
84
+
86 85
       // Compute everything about the ground state
87 86
       gstate.Compute_All(true);
88 87
 
@@ -90,14 +89,14 @@ namespace JSC {
90 89
 
91 90
       // Define the ground state
92 91
       XXZ_gpd_Bethe_State gstate2(chain2, gbase2);
93
-    
92
+
94 93
       // Compute everything about the ground state
95 94
       gstate2.Compute_All(true);
96 95
 
97 96
       E0_Delta_eps = gstate2.E;
98 97
     }
99 98
 
100
-    else JSCerror("Wrong anisotropy in S1_sumrule_factor.");
99
+    else ABACUSerror("Wrong anisotropy in S1_sumrule_factor.");
101 100
 
102 101
     DP answer = 0.0;
103 102
     //if (xyorz == 'x' || xyorz == 'y') answer = 0.5 * (E0_Delta - Delta * (E0_Delta_eps - E0_Delta)/eps_Delta);
@@ -106,7 +105,7 @@ namespace JSC {
106 105
     // Careful for z !  Hamiltonian defined as S^z S^z - 1/4, so add back N/4:
107 106
     else if (xyorz == 'z') answer = (E0_Delta_eps - E0_Delta)/eps_Delta + 0.25 * N;
108 107
 
109
-    else JSCerror("option not implemented in X_avg.");
108
+    else ABACUSerror("option not implemented in X_avg.");
110 109
 
111 110
     return(answer);
112 111
   }
@@ -129,7 +128,7 @@ namespace JSC {
129 128
     else if (mporz == 'b') sumrule = 1.0;
130 129
     else if (mporz == 'c') sumrule = 1.0;
131 130
 
132
-    else JSCerror("option not implemented in S1_sumrule_factor.");
131
+    else ABACUSerror("option not implemented in S1_sumrule_factor.");
133 132
 
134 133
     //return(1.0/sumrule);
135 134
     return(1.0/(sumrule + 1.0e-16)); // sumrule is 0 for iK == 0 or N
@@ -153,7 +152,7 @@ namespace JSC {
153 152
     else if (mporz == 'b') sumrule = 1.0;
154 153
     else if (mporz == 'c') sumrule = 1.0;
155 154
 
156
-    else JSCerror("option not implemented in S1_sumrule_factor.");
155
+    else ABACUSerror("option not implemented in S1_sumrule_factor.");
157 156
 
158 157
     return(1.0/(sumrule + 1.0e-16)); // sumrule is 0 for iK == 0 or N
159 158
   }
@@ -166,7 +165,7 @@ namespace JSC {
166 165
     //if (!fixed_iK) {
167 166
     if (iKmin != iKmax) {
168 167
       if (whichDSF == 'Z') sumrule_factor = 1.0;
169
-      else if (whichDSF == 'm') 
168
+      else if (whichDSF == 'm')
170 169
 	sumrule_factor = 1.0/AveragingState.base.Mdown;
171 170
       else if (whichDSF == 'z') sumrule_factor = 1.0/(0.25 * AveragingState.chain.Nsites);
172 171
       else if (whichDSF == 'p') sumrule_factor = 1.0/(AveragingState.chain.Nsites - AveragingState.base.Mdown);
@@ -175,33 +174,33 @@ namespace JSC {
175 174
       else if (whichDSF == 'c') sumrule_factor = 1.0;
176 175
       else if (whichDSF == 'q') sumrule_factor = 1.0;
177 176
 
178
-      else JSCerror("whichDSF option not consistent in Sumrule_Factor");
177
+      else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
179 178
     }
180 179
     //else if (fixed_iK) {
181 180
     else if (iKmin == iKmax) {
182 181
       if (whichDSF == 'Z') sumrule_factor = 1.0;
183
-      else if (whichDSF == 'm' || whichDSF == 'z' || whichDSF == 'p') 
182
+      else if (whichDSF == 'm' || whichDSF == 'z' || whichDSF == 'p')
184 183
 	//sumrule_factor = S1_sumrule_factor (whichDSF, AveragingState.chain.Delta, AveragingState.chain.Nsites, AveragingState.base.Mdown, iKneeded);
185 184
 	sumrule_factor = S1_sumrule_factor (whichDSF, AveragingState.chain.Delta, AveragingState.chain.Nsites, AveragingState.base.Mdown, Chem_Pot, iKmax);
186 185
       else if (whichDSF == 'a') sumrule_factor = 1.0;
187 186
       else if (whichDSF == 'b') sumrule_factor = 1.0;
188 187
       else if (whichDSF == 'c') sumrule_factor = 1.0;
189 188
       else if (whichDSF == 'q') sumrule_factor = 1.0;
190
-      
191
-      else JSCerror("whichDSF option not consistent in Sumrule_Factor");
189
+
190
+      else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
192 191
     }
193 192
 
194
-    
193
+
195 194
 
196 195
     return(sumrule_factor);
197 196
   }
198
-  
197
+
199 198
 
200 199
   void Evaluate_F_Sumrule (string prefix, char whichDSF, const Heis_Bethe_State& AveragingState, DP Chem_Pot, int iKmin_ref, int iKmax_ref)
201 200
   {
202 201
 
203 202
     stringstream RAW_stringstream;    string RAW_string;
204
-    RAW_stringstream << prefix << ".raw";    
203
+    RAW_stringstream << prefix << ".raw";
205 204
     RAW_string = RAW_stringstream.str();    const char* RAW_Cstr = RAW_string.c_str();
206 205
 
207 206
     stringstream FSR_stringstream;    string FSR_string;
@@ -210,15 +209,15 @@ namespace JSC {
210 209
 
211 210
     ifstream infile;
212 211
     infile.open(RAW_Cstr);
213
-    if(infile.fail()) JSCerror("Could not open raw input file in Evaluate_F_Sumrule(Heis...).");
212
+    if(infile.fail()) ABACUSerror("Could not open raw input file in Evaluate_F_Sumrule(Heis...).");
214 213
 
215 214
     int iKmin = 0;
216 215
     int iKmax = AveragingState.chain.Nsites;
217 216
     int iKmod = AveragingState.chain.Nsites;
218 217
 
219 218
     // We run through the data file to chech the f sumrule at each positive momenta:
220
-    //Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);  
221
-    Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);  
219
+    //Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
220
+    Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
222 221
 
223 222
     DP omega, ME;
224 223
     int iK, iKexc;
@@ -252,4 +251,4 @@ namespace JSC {
252 251
     outfile.close();
253 252
   }
254 253
 
255
-} // namespace JSC
254
+} // namespace ABACUS

+ 23
- 24
src/HEIS/M_vs_H.cc View File

@@ -1,8 +1,8 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c) 2006-9.
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
@@ -10,21 +10,20 @@ File:  M_vs_H.cc
10 10
 
11 11
 Purpose:  field to and from magnetization for Heisenberg
12 12
 
13
-Last modified:  21/10/09
14
-
15
-
16 13
 ***********************************************************/
17 14
 
18
-#include "JSC.h"
15
+#include "ABACUS.h"
19 16
 
20
-namespace JSC { 
17
+using namespace std;
18
+
19
+namespace ABACUS {
21 20
 
22 21
   DP Ezero (DP Delta, int N, int M)
23 22
   {
24 23
     // Returns the energy of the ground state with M down spins
25 24
 
26
-    if (M < 0 || M > N/2) JSCerror("M out of bounds in Ezero.");
27
-   
25
+    if (M < 0 || M > N/2) ABACUSerror("M out of bounds in Ezero.");
26
+
28 27
     DP E = -1.0; // sentinel value
29 28
 
30 29
     if (M == 0) E = N * Delta/4.0;
@@ -32,32 +31,32 @@ namespace JSC {
32 31
     else {
33 32
 
34 33
       Heis_Chain BD1(1.0, Delta, 0.0, N);
35
-      
34
+
36 35
       Vect_INT Nrapidities_groundstate(0, BD1.Nstrings);
37
-      
36
+
38 37
       Nrapidities_groundstate[0] = M;
39
-      
38
+
40 39
       Heis_Base baseconfig_groundstate(BD1, Nrapidities_groundstate);
41
-      
40
+
42 41
       if ((Delta > 0.0) && (Delta < 1.0)) {
43 42
 	XXZ_Bethe_State groundstate(BD1, baseconfig_groundstate);
44 43
 	groundstate.Compute_All(true);
45 44
 	E = groundstate.E;
46 45
       }
47
-      
46
+
48 47
       else if (Delta == 1.0) {
49 48
 	XXX_Bethe_State groundstate(BD1, baseconfig_groundstate);
50 49
 	groundstate.Compute_All(true);
51 50
 	E = groundstate.E;
52 51
       }
53
-      
52
+
54 53
       else if (Delta > 1.0) {
55 54
 	XXZ_gpd_Bethe_State groundstate(BD1, baseconfig_groundstate);
56 55
 	groundstate.Compute_All(true);
57 56
 	E = groundstate.E;
58 57
       }
59
-      
60
-      else JSCerror("Anisotropy out of bounds in Ezero.");
58
+
59
+      else ABACUSerror("Anisotropy out of bounds in Ezero.");
61 60
     }
62 61
 
63 62
     return(E);
@@ -69,7 +68,7 @@ namespace JSC {
69 68
 
70 69
     DP H = 0.0;
71 70
 
72
-    if (2*M == N) H = 0.0; 
71
+    if (2*M == N) H = 0.0;
73 72
 
74 73
     else if (Delta <= 1.0) H = Ezero (Delta, N, M - 1) - Ezero (Delta, N, M);
75 74
 
@@ -80,7 +79,7 @@ namespace JSC {
80 79
   {
81 80
     if (M < 0 || M > N/2 - 1) {
82 81
       cout << "M = " << M << endl;
83
-      JSCerror("M out of bounds in HZmin.");    
82
+      ABACUSerror("M out of bounds in HZmin.");
84 83
     }
85 84
 
86 85
     if (Ezero_ref[M] == -1.0) Ezero_ref[M] = Ezero(Delta, N, M);
@@ -93,7 +92,7 @@ namespace JSC {
93 92
   {
94 93
     // Returns the value of M for given field HZ
95 94
 
96
-    if (HZ < 0.0) JSCerror("Please use a positive field in M_vs_H.");
95
+    if (HZ < 0.0) ABACUSerror("Please use a positive field in M_vs_H.");
97 96
 
98 97
     else if (HZ == 0.0) return(N/2);
99 98
 
@@ -111,7 +110,7 @@ namespace JSC {
111 110
     if (HZ >= 1.0 + Delta) M_actual = 0;  // saturation
112 111
 
113 112
     else {
114
-      
113
+
115 114
       HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
116 115
       HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
117 116
 
@@ -119,15 +118,15 @@ namespace JSC {
119 118
 
120 119
 	if (HZmin_actual > HZ) M_actual += M_step;
121 120
 	else if (HZmax_actual <= HZ) M_actual -= M_step;
122
-	
121
+
123 122
 	M_step = (M_step + 1)/2;
124 123
 
125 124
 	HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
126 125
 	HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
127 126
 
128
-	M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);	
127
+	M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
129 128
 
130
-	//cout << "M_actual = " << M_actual << "\tM_step = " << M_step 
129
+	//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
131 130
 	//   << "\tHZmin_actual = " << HZmin_actual << "\tHZmax_actual = " << HZmax_actual << "\tHZ = " << HZ << "\t" << M_found << endl;
132 131
       }
133 132
     }

+ 80
- 80
src/HEIS/XXX_Bethe_State.cc View File

@@ -1,6 +1,6 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5 5
 Copyright (c)
6 6
 
@@ -12,11 +12,11 @@ Purpose:  Defines all functions for XXX_Bethe_State
12 12
 
13 13
 ******************************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18 18
 
19
-namespace JSC {
19
+namespace ABACUS {
20 20
 
21 21
   // Function prototypes
22 22
 
@@ -27,7 +27,7 @@ namespace JSC {
27 27
 
28 28
   // Function definitions:  class XXX_Bethe_State
29 29
 
30
-  XXX_Bethe_State::XXX_Bethe_State () 
30
+  XXX_Bethe_State::XXX_Bethe_State ()
31 31
     : Heis_Bethe_State()
32 32
   {};
33 33
 
@@ -35,22 +35,22 @@ namespace JSC {
35 35
     : Heis_Bethe_State(RefState)
36 36
   {
37 37
   }
38
-  
39
-  XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, int M) 
38
+
39
+  XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, int M)
40 40
     : Heis_Bethe_State(RefChain, M)
41 41
   {
42 42
     if (RefChain.Delta != 1.0) {
43 43
       cout << setprecision(16) << RefChain.Delta << endl;
44
-      JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");    
44
+      ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
45 45
     }
46 46
   }
47
-  
48
-  XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase) 
47
+
48
+  XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
49 49
     : Heis_Bethe_State(RefChain, RefBase)
50 50
   {
51 51
     if (RefChain.Delta != 1.0) {
52 52
       cout << setprecision(16) << RefChain.Delta << endl;
53
-      JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");    
53
+      ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
54 54
     }
55 55
   }
56 56
   /*
@@ -59,7 +59,7 @@ namespace JSC {
59 59
   {
60 60
     if (RefChain.Delta != 1.0) {
61 61
       cout << setprecision(16) << RefChain.Delta << endl;
62
-      JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");    
62
+      ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
63 63
     }
64 64
   }
65 65
   */
@@ -104,13 +104,13 @@ namespace JSC {
104 104
 
105 105
       }
106 106
     }
107
-    
107
+
108 108
     return;
109 109
   }
110 110
 
111 111
   bool XXX_Bethe_State::Check_Admissibility(char option)
112 112
   {
113
-    // This function checks the admissibility of the Ix2's of a state:  
113
+    // This function checks the admissibility of the Ix2's of a state:
114 114
     // returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
115 115
     // and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
116 116
 
@@ -122,9 +122,9 @@ namespace JSC {
122 122
 
123 123
     for (int j = 0; j < chain.Nstrings; ++j) {
124 124
       // The following line puts answer to true if there is at least one higher string with zero Ix2
125
-      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) && !(chain.Str_L[j] % 2)) 
126
-	higher_string_on_zero = true;  
127
-      for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;         
125
+      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) && !(chain.Str_L[j] % 2))
126
+	higher_string_on_zero = true;
127
+      for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
128 128
       // NOTE:  if base[j] == 0, Zero_at_level[j] remains false.
129 129
     }
130 130
 
@@ -134,7 +134,7 @@ namespace JSC {
134 134
     // Checks that we have strings of equal length modulo 2 with Ix2 == 0, so equal rapidities, and inadmissibility
135 135
     for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
136 136
       for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
137
-	if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2))) 
137
+	if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
138 138
 	  string_coincidence = true;
139 139
     }
140 140
     /*
@@ -147,8 +147,8 @@ namespace JSC {
147 147
 
148 148
     // Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
149 149
 
150
-    for (int j = 0; j < chain.Nstrings; ++j) 
151
-      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;    
150
+    for (int j = 0; j < chain.Nstrings; ++j)
151
+      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
152 152
 
153 153
     if (!answer) {
154 154
       E = 0.0;
@@ -170,15 +170,15 @@ namespace JSC {
170 170
 
171 171
     sumtheta = 0.0;
172 172
     for (int k = 0; k < chain.Nstrings; ++k) {
173
-      for (int beta = 0; beta < base[k]; ++beta) 
174
-	
175
-	if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
176
-	  sumtheta += atan(lambda[j][alpha] - lambda[k][beta]); 
177
-      
173
+      for (int beta = 0; beta < base[k]; ++beta)
174
+
175
+	if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
176
+	  sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
177
+
178 178
 	else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
179 179
     }
180 180
     sumtheta *= 2.0;
181
-    
181
+
182 182
     BE[j][alpha] = 2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
183 183
   }
184 184
 
@@ -190,18 +190,18 @@ namespace JSC {
190 190
 
191 191
     for (int j = 0; j < chain.Nstrings; ++j) {
192 192
       for (int alpha = 0; alpha < base[j]; ++alpha) {
193
-	
193
+
194 194
 	sumtheta = 0.0;
195 195
 	for (int k = 0; k < chain.Nstrings; ++k) {
196
-	  for (int beta = 0; beta < base[k]; ++beta) 
197
-	    
198
-	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
199
-	      sumtheta += atan(lambda[j][alpha] - lambda[k][beta]); 
200
-	  
196
+	  for (int beta = 0; beta < base[k]; ++beta)
197
+
198
+	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
199
+	      sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
200
+
201 201
 	    else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
202 202
 	}
203 203
 	sumtheta *= 2.0;
204
-	
204
+
205 205
 	BE[j][alpha] = 2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
206 206
       }
207 207
     }
@@ -211,7 +211,7 @@ namespace JSC {
211 211
   {
212 212
     // Returns a new iteration value for lambda[j][alpha] given BE[j][alpha]
213 213
 
214
-    return(0.5 * chain.Str_L[j] * tan(0.5 * 
214
+    return(0.5 * chain.Str_L[j] * tan(0.5 *
215 215
 				      //(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
216 216
 				      (2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - BE[j][alpha])
217 217
 				      ));
@@ -231,10 +231,10 @@ namespace JSC {
231 231
 
232 232
 	sumtheta = 0.0;
233 233
 	for (int k = 0; k < chain.Nstrings; ++k) {
234
-	  for (int beta = 0; beta < base[k]; ++beta) 
234
+	  for (int beta = 0; beta < base[k]; ++beta)
235 235
 
236
-	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
237
-	      sumtheta += atan(lambda[j][alpha] - lambda[k][beta]); 
236
+	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
237
+	      sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
238 238
 
239 239
 	    else sumtheta += 0.5 * Theta_XXX(lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k]);
240 240
 	}
@@ -283,10 +283,10 @@ namespace JSC {
283 283
 
284 284
 	sumtheta = 0.0;
285 285
 	for (int k = 0; k < chain.Nstrings; ++k) {
286
-	  for (int beta = 0; beta < base[k]; ++beta) 
286
+	  for (int beta = 0; beta < base[k]; ++beta)
287 287
 
288
-	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
289
-	      sumtheta += atan(lambda[j][alpha] - lambda[k][beta]); 
288
+	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
289
+	      sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
290 290
 
291 291
 	    else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
292 292
 	}
@@ -296,7 +296,7 @@ namespace JSC {
296 296
 	index++;
297 297
       }
298 298
     }
299
-    
299
+
300 300
     (*this).Build_Reduced_Gaudin_Matrix (Gaudin);
301 301
 
302 302
     for (int i = 0; i < base.Nraptot; ++i) dlambda[i] = - RHSBAE[i];
@@ -334,7 +334,7 @@ namespace JSC {
334 334
 
335 335
     for (int j = 0; j < chain.Nstrings; ++j)
336 336
       for (int alpha = 0; alpha < base[j]; ++alpha) nonan *= !is_nan(lambda[j][alpha]);
337
-    
337
+
338 338
     return nonan;
339 339
   }
340 340
 
@@ -362,48 +362,48 @@ namespace JSC {
362 362
 	for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
363 363
 
364 364
 	  ln_deltadiff = 0.0;
365
-	      
365
+
366 366
 	  for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
367
-	    
367
+
368 368
 	    if ((*this).chain.Str_L[j] > 1) {  // else the BAE are already 1
369 369
 
370 370
 	      log_BAE_reg = DP((*this).chain.Nsites) * log(((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0))
371 371
 							 /((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)));
372
-	      
373
-	      for (int k = 0; k < (*this).chain.Nstrings; ++k) 
374
-		for (int beta = 0; beta < (*this).base[k]; ++beta) 
372
+
373
+	      for (int k = 0; k < (*this).chain.Nstrings; ++k)
374
+		for (int beta = 0; beta < (*this).base[k]; ++beta)
375 375
 		  for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
376
-		    if ((j != k) || (alpha != beta) || (a != b - 1)) 
376
+		    if ((j != k) || (alpha != beta) || (a != b - 1))
377 377
 
378 378
 		      log_BAE_reg += log((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
379 379
 				      - ((*this).lambda[k][beta] + 0.5 * II * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
380 380
 					 ) - II );
381
-		    
382
-		    if ((j != k) || (alpha != beta) || (a != b + 1)) 
381
+
382
+		    if ((j != k) || (alpha != beta) || (a != b + 1))
383 383
 
384 384
 		      log_BAE_reg -= log(((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
385
-				       ) 
385
+				       )
386 386
 				      - ((*this).lambda[k][beta] + 0.5 * II * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
387 387
 					 ) + II );
388 388
 		  }
389 389
 
390 390
 	      // The regular LHS of BAE is now defined.  Now sum up the deltas...
391
-	      
391
+
392 392
 	      if (a == 1) ln_deltadiff[0] = - real(log_BAE_reg);
393
-	      
393
+
394 394
 	      else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
395
-	      
395
+
396 396
 	      else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
397 397
 
398 398
 	    } // if ((*this).chain.Str_L[j] > 1)
399
-	    
399
+
400 400
 	  } // for (int a = 1; ...
401 401
 
402 402
 	  for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
403 403
 	    deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
404 404
 	    delta += fabs(deltadiff[a]);
405
-	  }  
406
-	      
405
+	  }
406
+
407 407
 	} // alpha sum
408 408
       } // j sum
409 409
 
@@ -418,7 +418,7 @@ namespace JSC {
418 418
   void XXX_Bethe_State::Compute_Energy ()
419 419
   {
420 420
     DP sum = 0.0;
421
-    
421
+
422 422
     for (int j = 0; j < chain.Nstrings; ++j) {
423 423
       for (int alpha = 0; alpha < base[j]; ++alpha) {
424 424
 	sum += chain.Str_L[j] / ( 4.0 * lambda[j][alpha] * lambda[j][alpha] + chain.Str_L[j] * chain.Str_L[j]);
@@ -426,7 +426,7 @@ namespace JSC {
426 426
     }
427 427
 
428 428
     sum *= - chain.J * 2.0;
429
-    
429
+
430 430
     E = sum;
431 431
 
432 432
     return;
@@ -462,7 +462,7 @@ namespace JSC {
462 462
   void XXX_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
463 463
   {
464 464
 
465
-    if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
465
+    if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
466 466
 
467 467
     int index_jalpha;
468 468
     int index_kbeta;
@@ -482,24 +482,24 @@ namespace JSC {
482 482
 
483 483
 	      for (int kp = 0; kp < chain.Nstrings; ++kp) {
484 484
 		for (int betap = 0; betap < base[kp]; ++betap) {
485
-		  if (!((j == kp) && (alpha == betap))) 
486
-		    sum_hbar_XXX 
485
+		  if (!((j == kp) && (alpha == betap)))
486
+		    sum_hbar_XXX
487 487
 		      += ddlambda_Theta_XXX (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp]);
488 488
 		}
489 489
 	      }
490 490
 
491
-	      Gaudin_Red[index_jalpha][index_kbeta] 
492
-		= complex<DP> ( chain.Nsites * chain.Str_L[j]/(lambda[j][alpha] * lambda[j][alpha] + 0.25 * chain.Str_L[j] * chain.Str_L[j]) 
491
+	      Gaudin_Red[index_jalpha][index_kbeta]
492
+		= complex<DP> ( chain.Nsites * chain.Str_L[j]/(lambda[j][alpha] * lambda[j][alpha] + 0.25 * chain.Str_L[j] * chain.Str_L[j])
493 493
 				- sum_hbar_XXX);
494 494
 	    }
495 495
 
496 496
 	    else {
497
-	      if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
498
-		Gaudin_Red[index_jalpha][index_kbeta] = 
497
+	      if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
498
+		Gaudin_Red[index_jalpha][index_kbeta] =
499 499
 		  complex<DP> ( 2.0/(pow(lambda[j][alpha] - lambda[k][beta], 2.0) + 1.0));
500 500
 
501
-	      else 
502
-		Gaudin_Red[index_jalpha][index_kbeta] = 
501
+	      else
502
+		Gaudin_Red[index_jalpha][index_kbeta] =
503 503
 		  complex<DP> (ddlambda_Theta_XXX (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k]));
504 504
 	    }
505 505
 	    index_kbeta++;
@@ -520,7 +520,7 @@ namespace JSC {
520 520
 	if (fabs(lambda[j][alpha]) > 1.0e6) answer = false;
521 521
       }
522 522
     }
523
-    
523
+
524 524
     return(answer);
525 525
   }
526 526
 
@@ -533,12 +533,12 @@ namespace JSC {
533 533
     DP result;
534 534
 
535 535
     if ((nj == 1) && (nk == 1)) result = 2.0 * atan(lambda);
536
-    
536
+
537 537
     else {
538 538
 
539 539
       result = (nj == nk) ? 0.0 : 2.0 * atan(2.0 * lambda/fabs(nj - nk));
540 540
 
541
-      for (int a = 1; a < JSC::min(nj, nk); ++a) result += 4.0 * atan(2.0 * lambda/(fabs(nj - nk) + 2*a));
541
+      for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 4.0 * atan(2.0 * lambda/(fabs(nj - nk) + 2*a));
542 542
 
543 543
       result += 2.0 * atan(2.0 * lambda/(nj + nk));
544 544
     }
@@ -552,7 +552,7 @@ namespace JSC {
552 552
 
553 553
     DP result = (nj == nk) ? 0.0 : DP(n)/(lambda * lambda + 0.25 * n * n);
554 554
 
555
-    for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * (n + 2.0*a) 
555
+    for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * (n + 2.0*a)
556 556
       / (lambda * lambda + 0.25 * (n + 2.0*a) * (n + 2.0*a));
557 557
 
558 558
     result += DP(nj + nk)/(lambda * lambda + 0.25 * (nj + nk) * (nj + nk));
@@ -564,7 +564,7 @@ namespace JSC {
564 564
   {
565 565
     DP result = (nj == nk) ? 0.0 : DP(nj - nk)/(lambda * lambda + 0.25 * (nj - nk) * (nj - nk));
566 566
 
567
-    for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a) 
567
+    for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a)
568 568
       / (lambda * lambda + 0.25 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a));
569 569
 
570 570
     result += DP(nj + nk)/(lambda * lambda + 0.25 * (nj + nk) * (nj + nk));
@@ -575,8 +575,8 @@ namespace JSC {
575 575
 
576 576
   XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState)
577 577
   {
578
-    if (2*RefState.base.Mdown == RefState.chain.Nsites) 
579
-      JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
578
+    if (2*RefState.base.Mdown == RefState.chain.Nsites)
579
+      ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
580 580
 
581 581
     Vect<int> newM = RefState.base.Nrap;
582 582
     newM[0] = newM[0] + 1;
@@ -586,10 +586,10 @@ namespace JSC {
586 586
     XXX_Bethe_State ReturnState (RefState.chain, newBase);
587 587
 
588 588
     for (int il = 1; il < RefState.chain.Nstrings; ++il)
589
-      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha) 
589
+      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
590 590
 	ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
591 591
 
592
-    // Add a quantum number in middle (explicitly: to right of index M[0]/2) 
592
+    // Add a quantum number in middle (explicitly: to right of index M[0]/2)
593 593
     // and shift quantum numbers by half-integer away from added one:
594 594
     ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
595 595
     for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
@@ -602,7 +602,7 @@ namespace JSC {
602 602
   XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState)
603 603
   {
604 604
     if (RefState.base.Nrap[0] == 0)
605
-      JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
605
+      ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
606 606
 
607 607
     Vect<int> newM = RefState.base.Nrap;
608 608
     newM[0] = newM[0] - 1;
@@ -612,7 +612,7 @@ namespace JSC {
612 612
     XXX_Bethe_State ReturnState (RefState.chain, newBase);
613 613
 
614 614
     for (int il = 1; il < RefState.chain.Nstrings; ++il)
615
-      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha) 
615
+      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
616 616
 	ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
617 617
 
618 618
     // Remove midmost and shift quantum numbers by half-integer towards removed one:
@@ -622,5 +622,5 @@ namespace JSC {
622 622
     return(ReturnState);
623 623
     }
624 624
 
625
-  
626
-} // namespace JSC
625
+
626
+} // namespace ABACUS

+ 110
- 110
src/HEIS/XXZ_Bethe_State.cc View File

@@ -1,6 +1,6 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5 5
 Copyright (c)
6 6
 
@@ -12,11 +12,11 @@ Purpose:  Defines all functions for XXZ_Bethe_State
12 12
 
13 13
 ******************************************************************/
14 14
 
15
-#include "JSC.h"
15
+#include "ABACUS.h"
16 16
 
17 17
 using namespace std;
18 18
 
19
-namespace JSC {
19
+namespace ABACUS {
20 20
 
21 21
   // Function prototypes
22 22
 
@@ -30,12 +30,12 @@ namespace JSC {
30 30
 
31 31
   // Function definitions:  class XXZ_Bethe_State
32 32
 
33
-  XXZ_Bethe_State::XXZ_Bethe_State () 
34
-    : Heis_Bethe_State(), sinhlambda(Lambda(chain, 1)), coshlambda(Lambda(chain, 1)), tanhlambda(Lambda(chain, 1)) 
33
+  XXZ_Bethe_State::XXZ_Bethe_State ()
34
+    : Heis_Bethe_State(), sinhlambda(Lambda(chain, 1)), coshlambda(Lambda(chain, 1)), tanhlambda(Lambda(chain, 1))
35 35
   {};
36 36
 
37 37
   XXZ_Bethe_State::XXZ_Bethe_State (const XXZ_Bethe_State& RefState) // copy constructor
38
-    : Heis_Bethe_State(RefState), sinhlambda(Lambda(RefState.chain, RefState.base)), coshlambda(Lambda(RefState.chain, RefState.base)), 
38
+    : Heis_Bethe_State(RefState), sinhlambda(Lambda(RefState.chain, RefState.base)), coshlambda(Lambda(RefState.chain, RefState.base)),
39 39
       tanhlambda(Lambda(RefState.chain, RefState.base))
40 40
   {
41 41
     // copy arrays into new ones
@@ -50,29 +50,29 @@ namespace JSC {
50 50
     }
51 51
     //cout << "Done calling XXZ state copy constructor." << endl;
52 52
   }
53
-  
54
-  XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, int M) 
55
-    : Heis_Bethe_State(RefChain, M), 
53
+
54
+  XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, int M)
55
+    : Heis_Bethe_State(RefChain, M),
56 56
       sinhlambda(Lambda(RefChain, M)), coshlambda(Lambda(RefChain, M)), tanhlambda(Lambda(RefChain, M))
57 57
   {
58 58
     //cout << "Here in XXZ BS constructor." << endl;
59 59
     //cout << (*this).lambda[0][0] << endl;
60 60
     //cout << "OK" << endl;
61
-    if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");    
61
+    if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
62 62
   }
63
-  
64
-  XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase) 
65
-    : Heis_Bethe_State(RefChain, RefBase), 
63
+
64
+  XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
65
+    : Heis_Bethe_State(RefChain, RefBase),
66 66
       sinhlambda(Lambda(RefChain, RefBase)), coshlambda(Lambda(RefChain, RefBase)), tanhlambda(Lambda(RefChain, RefBase))
67 67
   {
68
-    if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");    
68
+    if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
69 69
   }
70 70
   /*
71 71
   XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref)
72 72
     : Heis_Bethe_State(RefChain, base_id_ref, type_id_ref),
73 73
       sinhlambda(Lambda(chain, base)), coshlambda(Lambda(chain, base)), tanhlambda(Lambda(chain, base))
74 74
   {
75
-    if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");    
75
+    if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
76 76
   }
77 77
   */
78 78
 
@@ -130,13 +130,13 @@ namespace JSC {
130 130
 	  lambda[i][alpha] = atanh(x/sqrt(1.0 + x*x)); // lambda then always initiated real
131 131
 	}
132 132
 
133
-	else JSCerror("Invalid parities in Set_Free_lambdas.");
133
+	else ABACUSerror("Invalid parities in Set_Free_lambdas.");
134 134
 	//cout << tan(chain.Str_L[i] * 0.5 * chain.anis) << endl;
135 135
 	//cout << "Set_Free_lambdas: " << i << "\t" << alpha << "\t" << lambda[i][alpha] << "\t" << tan(chain.Str_L[i] * 0.5 * chain.anis) * tan(PI * 0.5 * Ix2[i][alpha]/chain.Nsites) << endl;
136 136
 
137 137
       }
138 138
     }
139
-    
139
+
140 140
     return;
141 141
   }
142 142
 
@@ -169,7 +169,7 @@ namespace JSC {
169 169
 
170 170
   bool XXZ_Bethe_State::Check_Admissibility(char option)
171 171
   {
172
-    // This function checks the admissibility of the Ix2's of a state:  
172
+    // This function checks the admissibility of the Ix2's of a state:
173 173
     // returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
174 174
     // and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
175 175
 
@@ -179,9 +179,9 @@ namespace JSC {
179 179
     bool higher_string_on_zero = false;
180 180
     for (int j = 0; j < chain.Nstrings; ++j) {
181 181
       // The following line puts answer to true if there is at least one higher string with zero Ix2
182
-      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] >= 2) /*&& !(chain.Str_L[j] % 2)*/) 
183
-	higher_string_on_zero = true;  
184
-      for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;         
182
+      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] >= 2) /*&& !(chain.Str_L[j] % 2)*/)
183
+	higher_string_on_zero = true;
184
+      for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
185 185
       // NOTE:  if base[j] == 0, Zero_at_level[j] remains false.
186 186
     }
187 187
 
@@ -192,12 +192,12 @@ namespace JSC {
192 192
     bool string_coincidence = false;
193 193
     for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
194 194
       for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
195
-	if (Zero_at_level[j1] && Zero_at_level[j2] && (chain.par[j1] == chain.par[j2]) && (!((chain.Str_L[j1] + chain.Str_L[j2])%2))) 
195
+	if (Zero_at_level[j1] && Zero_at_level[j2] && (chain.par[j1] == chain.par[j2]) && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
196 196
 	  string_coincidence = true;
197 197
     }
198 198
 
199 199
     bool M_odd_and_onep_on_zero = false;
200
-    if (option == 'z') { // for Sz, if M is odd, exclude symmetric states with a 1+ on zero 
200
+    if (option == 'z') { // for Sz, if M is odd, exclude symmetric states with a 1+ on zero
201 201
                          // (zero rapidities in left and right states, so FF det not defined).
202 202
       bool is_ground_state = base.Nrap[0] == base.Mdown && Ix2[0][0] == -(base.Mdown - 1) && Ix2[0][base.Mdown-1] == base.Mdown - 1;
203 203
       if (Zero_at_level[0] && (base.Mdown % 2) && !is_ground_state) M_odd_and_onep_on_zero = true;
@@ -212,8 +212,8 @@ namespace JSC {
212 212
 
213 213
     // Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
214 214
 
215
-    for (int j = 0; j < chain.Nstrings; ++j) 
216
-      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;    
215
+    for (int j = 0; j < chain.Nstrings; ++j)
216
+      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
217 217
 
218 218
     if (!answer) {
219 219
       E = 0.0;
@@ -233,18 +233,18 @@ namespace JSC {
233 233
 
234 234
     DP sumtheta = 0.0;
235 235
 
236
-    for (int k = 0; k < chain.Nstrings; ++k) 
236
+    for (int k = 0; k < chain.Nstrings; ++k)
237 237
       for (int beta = 0; beta < base[k]; ++beta) {
238
-	if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
239
-	  sumtheta += (chain.par[j] == chain.par[k]) 
240
-	    ? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2])) 
241
-	    : - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ; 
242
-	else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]), 
238
+	if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
239
+	  sumtheta += (chain.par[j] == chain.par[k])
240
+	    ? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
241
+	    : - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
242
+	else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
243 243
 					 chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
244 244
       }
245 245
     sumtheta *= 2.0;
246
-    
247
-    BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
246
+
247
+    BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
248 248
 		    : -2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]])) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
249 249
 
250 250
    }
@@ -257,22 +257,22 @@ namespace JSC {
257 257
 
258 258
     DP sumtheta = 0.0;
259 259
 
260
-    for (int j = 0; j < chain.Nstrings; ++j) 
260
+    for (int j = 0; j < chain.Nstrings; ++j)
261 261
       for (int alpha = 0; alpha < base[j]; ++alpha) {
262
-	
262
+
263 263
 	sumtheta = 0.0;
264
-	for (int k = 0; k < chain.Nstrings; ++k) 
264
+	for (int k = 0; k < chain.Nstrings; ++k)
265 265
 	  for (int beta = 0; beta < base[k]; ++beta) {
266
-	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
267
-	      sumtheta += (chain.par[j] == chain.par[k]) 
268
-		? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2])) 
269
-		: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ; 
270
-	    else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]), 
266
+	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
267
+	      sumtheta += (chain.par[j] == chain.par[k])
268
+		? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
269
+		: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
270
+	    else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
271 271
 					     chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
272 272
 	  }
273 273
 	sumtheta *= 2.0;
274
-	
275
-	BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
274
+
275
+	BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
276 276
 			: -2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]])) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
277 277
 
278 278
 	//if (is_nan(BE[j][alpha])) cout << "BE nan: " << j << "\t" << alpha << "\t" << lambda[j][alpha] << "\t" << tanhlambda[j][alpha] << endl;
@@ -281,59 +281,59 @@ namespace JSC {
281 281
 
282 282
   DP XXZ_Bethe_State::Iterate_BAE (int j, int alpha)
283 283
   {
284
-    // Returns a new iteration value for lambda[j][alpha] given tanhlambda and BE Lambdas 
284
+    // Returns a new iteration value for lambda[j][alpha] given tanhlambda and BE Lambdas
285 285
     // Assumes that tanhlambda[][] and BE[][] have been computed.
286 286
 
287 287
     DP new_lambda = 0.0;
288 288
     DP arg = 0.0;
289 289
 
290
-    if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]] 
291
-      * tan(0.5 * 
290
+    if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]]
291
+      * tan(0.5 *
292 292
 	    //(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
293 293
 	    (2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) - BE[j][alpha])
294 294
 	    );
295
-    
296
-    else if (chain.par[j] == -1) arg = -tan(0.5 * 
295
+
296
+    else if (chain.par[j] == -1) arg = -tan(0.5 *
297 297
 					    //(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites)
298 298
 					    (-2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]]) - BE[j][alpha]))
299 299
       /chain.ta_n_anis_over_2[chain.Str_L[j]];
300
-    
300
+
301 301
     if (fabs(arg) < 1.0) {
302 302
       new_lambda = atanh(arg);
303 303
     }
304
-    
304
+
305 305
     else {
306 306
       new_lambda = lambda[j][alpha];  // back to drawing board...
307
-      int block = 0;  // counter to prevent runaway while loop 
307
+      int block = 0;  // counter to prevent runaway while loop
308 308
       DP new_tanhlambda = 0.0;
309 309
       DP sumtheta = 0.0;
310
-      arg = 10.0; // reset value to start while loop  
310
+      arg = 10.0; // reset value to start while loop
311 311
       while ((fabs(arg) > 1.0) && (block++ < 100)) {  // recompute the diverging root on its own...
312 312
 	new_lambda *= 1.01; // try to go slowly towards infinity...
313 313
 	new_tanhlambda = tanh(new_lambda);
314 314
 	sumtheta = 0.0;
315 315
 	for (int k = 0; k < chain.Nstrings; ++k) {
316
-	  for (int beta = 0; beta < base[k]; ++beta) 
317
-	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
318
-	      sumtheta += (chain.par[j] == chain.par[k]) 
319
-		? atan((new_tanhlambda - tanhlambda[k][beta])/((1.0 - new_tanhlambda * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2])) 
320
-		: - atan(((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ; 
321
-	    else sumtheta += 0.5 * Theta_XXZ((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta]), 
316
+	  for (int beta = 0; beta < base[k]; ++beta)
317
+	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
318
+	      sumtheta += (chain.par[j] == chain.par[k])
319
+		? atan((new_tanhlambda - tanhlambda[k][beta])/((1.0 - new_tanhlambda * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
320
+		: - atan(((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
321
+	    else sumtheta += 0.5 * Theta_XXZ((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta]),
322 322
 					     chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
323 323
 	}
324 324
 	sumtheta *= 2.0;
325 325
 	if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]] * tan(0.5 * (PI * Ix2[j][alpha] + sumtheta)/chain.Nsites);
326
-	
326
+
327 327
 	else if (chain.par[j] == -1) arg = -tan(0.5 * (PI * Ix2[j][alpha] + sumtheta)/chain.Nsites)/chain.ta_n_anis_over_2[chain.Str_L[j]];
328
-	
329
-	else JSCerror("Invalid parities in Iterate_BAE.");
328
+
329
+	else ABACUSerror("Invalid parities in Iterate_BAE.");
330 330
 
331 331
       }
332
-      
332
+
333 333
       if (fabs(arg) < 1.0) {
334 334
 	new_lambda = atanh(arg);
335 335
       }
336
-      
336
+
337 337
       //else cout << "Rapidity blows up !\t" << lambda[j][alpha] << "\t" << new_lambda << endl;
338 338
     } // else
339 339
 
@@ -346,7 +346,7 @@ namespace JSC {
346 346
 
347 347
     for (int j = 0; j < chain.Nstrings; ++j)
348 348
       for (int alpha = 0; alpha < base[j]; ++alpha) nonan *= !is_nan(lambda[j][alpha]);
349
-    
349
+
350 350
     return nonan;
351 351
   }
352 352
 
@@ -360,8 +360,8 @@ namespace JSC {
360 360
     for (int i = 0; i < (*this).chain.Nstrings; ++i) if ((*this).chain.Str_L[i] > 1) occupied_strings += (*this).base.Nrap[i];
361 361
 
362 362
     //if ((*this).conv == 0) delta = 1.0;
363
-    
364
-    if (occupied_strings == 0) delta = 0.0; 
363
+
364
+    if (occupied_strings == 0) delta = 0.0;
365 365
 
366 366
     else {
367 367
 
@@ -369,56 +369,56 @@ namespace JSC {
369 369
       Vect_DP deltadiff(0.0, 1000);  // contains |delta^{a, a+1}|
370 370
 
371 371
       complex<DP> log_BAE_reg = 0.0;
372
-      
372
+
373 373
       for (int j = 0; j < (*this).chain.Nstrings; ++j) {
374 374
 	for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
375 375
 
376 376
 	  ln_deltadiff = 0.0;
377
-	      
377
+
378 378
 	  for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
379
-	    
379
+
380 380
 	    if ((*this).chain.Str_L[j] > 1) {  // else the BAE are already 1
381 381
 
382
-	      log_BAE_reg = DP((*this).chain.Nsites) * log(sinh((*this).lambda[j][alpha] 
382
+	      log_BAE_reg = DP((*this).chain.Nsites) * log(sinh((*this).lambda[j][alpha]
383 383
 							   + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0)
384 384
 				 + 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
385 385
 			    /sinh((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)
386 386
 				  + 0.25 * II * PI * (1.0 - (*this).chain.par[j])));
387
-	      
388
-	      for (int k = 0; k < (*this).chain.Nstrings; ++k) 
389
-		for (int beta = 0; beta < (*this).base[k]; ++beta) 
387
+
388
+	      for (int k = 0; k < (*this).chain.Nstrings; ++k)
389
+		for (int beta = 0; beta < (*this).base[k]; ++beta)
390 390
 		  for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
391
-		    if ((j != k) || (alpha != beta) || (a != b - 1)) 
391
+		    if ((j != k) || (alpha != beta) || (a != b - 1))
392 392
 
393 393
 		      log_BAE_reg += log(sinh(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
394
-				       + 0.25 * II * PI * (1.0 - (*this).chain.par[j])) 
394
+				       + 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
395 395
 				      - ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
396 396
 					 + 0.25 * II * PI * (1.0 - (*this).chain.par[k])) - II * (*this).chain.anis));
397
-		    
398
-		    if ((j != k) || (alpha != beta) || (a != b + 1)) 
397
+
398
+		    if ((j != k) || (alpha != beta) || (a != b + 1))
399 399
 
400 400
 		      log_BAE_reg -= log(sinh(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
401
-				       + 0.25 * II * PI * (1.0 - (*this).chain.par[j])) 
401
+				       + 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
402 402
 				      - ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
403 403
 					 + 0.25 * II * PI * (1.0 - (*this).chain.par[k])) + II * (*this).chain.anis));
404 404
 		  }
405 405
 
406 406
 	      // The regular LHS of BAE is now defined.  Now sum up the deltas...
407
-	      
407
+
408 408
 	      if (a == 1) ln_deltadiff[0] = - real(log_BAE_reg);
409
-	      
409
+
410 410
 	      else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
411
-	      
411
+
412 412
 	      else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
413 413
 
414 414
 	    } // if ((*this).chain.Str_L[j] > 1)
415
-	    
415
+
416 416
 	  } // for (int a = 1; ...
417 417
 
418 418
 	  for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
419 419
 	    deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
420 420
 	    delta += fabs(deltadiff[a]);
421
-	  }  
421
+	  }
422 422
 
423 423
 	} // alpha sum
424 424
       } // j sum
@@ -434,7 +434,7 @@ namespace JSC {
434 434
   void XXZ_Bethe_State::Compute_Energy ()
435 435
   {
436 436
     DP sum = 0.0;
437
-    
437
+
438 438
     for (int j = 0; j < chain.Nstrings; ++j) {
439 439
       for (int alpha = 0; alpha < base[j]; ++alpha) {
440 440
 	sum += sin(chain.Str_L[j] * chain.anis) / (chain.par[j] * cosh(2.0 * lambda[j][alpha]) - cos(chain.Str_L[j] * chain.anis));
@@ -442,7 +442,7 @@ namespace JSC {
442 442
     }
443 443
 
444 444
     sum *= - chain.J * sin(chain.anis);
445
-    
445
+
446 446
     E = sum;
447 447
 
448 448
     return;
@@ -477,7 +477,7 @@ namespace JSC {
477 477
   void XXZ_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
478 478
   {
479 479
 
480
-    if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
480
+    if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
481 481
 
482 482
     int index_jalpha;
483 483
     int index_kbeta;
@@ -502,26 +502,26 @@ namespace JSC {
502 502
 
503 503
 	      for (int kp = 0; kp < chain.Nstrings; ++kp) {
504 504
 		for (int betap = 0; betap < base[kp]; ++betap) {
505
-		  if (!((j == kp) && (alpha == betap))) 
506
-		    sum_hbar_XXZ 
507
-		      += ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp], chain.par[j], chain.par[kp], 
505
+		  if (!((j == kp) && (alpha == betap)))
506
+		    sum_hbar_XXZ
507
+		      += ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp], chain.par[j], chain.par[kp],
508 508
 					     chain.si_n_anis_over_2);
509 509
 		}
510 510
 	      }
511 511
 
512
-	      Gaudin_Red[index_jalpha][index_kbeta] 
512
+	      Gaudin_Red[index_jalpha][index_kbeta]
513 513
 		= complex<DP> ( chain.Nsites * hbar_XXZ (lambda[j][alpha], chain.Str_L[j], chain.par[j], chain.si_n_anis_over_2) - sum_hbar_XXZ);
514 514
 	    }
515 515
 
516 516
 	    else {
517
-	      if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
518
-		Gaudin_Red[index_jalpha][index_kbeta] = 
519
-		  complex<DP> ((chain.par[j] * chain.par[k] == 1) 
520
-			       ? chain.si_n_anis_over_2[4]/(pow(sinhlambda[j][alpha] * coshlambda[k][beta] 
517
+	      if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
518
+		Gaudin_Red[index_jalpha][index_kbeta] =
519
+		  complex<DP> ((chain.par[j] * chain.par[k] == 1)
520
+			       ? chain.si_n_anis_over_2[4]/(pow(sinhlambda[j][alpha] * coshlambda[k][beta]
521 521
 								 - coshlambda[j][alpha] * sinhlambda[k][beta], 2.0) + sinzetasq)
522
-			       : chain.si_n_anis_over_2[4]/(-pow(coshlambda[j][alpha] * coshlambda[k][beta] 
522
+			       : chain.si_n_anis_over_2[4]/(-pow(coshlambda[j][alpha] * coshlambda[k][beta]
523 523
 								  - sinhlambda[j][alpha] * sinhlambda[k][beta], 2.0) + sinzetasq) );
524
-	      else 
524
+	      else
525 525
 		Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k],
526 526
 											  chain.par[j], chain.par[k], chain.si_n_anis_over_2));
527 527
 	    }
@@ -546,7 +546,7 @@ namespace JSC {
546 546
 
547 547
     else if (par == -1) result = -2.0 * atan(tanhlambda * tannzetaover2);
548 548
 
549
-    else JSCerror("Faulty parity in fbar_XXZ.");
549
+    else ABACUSerror("Faulty parity in fbar_XXZ.");
550 550
 
551 551
     return (result);
552 552
   }
@@ -556,12 +556,12 @@ namespace JSC {
556 556
     DP result = 0.0;
557 557
 
558 558
     if ((nj == 1) && (nk == 1)) result = fbar_XXZ(tanhlambda, parj*park, tannzetaover2[2]);
559
-    
559
+
560 560
     else {
561 561
 
562 562
       result = (nj == nk) ? 0.0 : fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk)]);
563 563
 
564
-      for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk) + 2*a]);
564
+      for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk) + 2*a]);
565 565
 
566 566
       result += fbar_XXZ(tanhlambda, parj*park, tannzetaover2[nj + nk]);
567 567
     }
@@ -577,16 +577,16 @@ namespace JSC {
577 577
 
578 578
     else if (par == -1) result = si_n_anis_over_2[2*n]/(-pow(cosh(lambda), 2.0) + pow(si_n_anis_over_2[n], 2.0));
579 579
 
580
-    else JSCerror("Faulty parity in hbar_XXZ.");
580
+    else ABACUSerror("Faulty parity in hbar_XXZ.");
581 581
 
582 582
     return (result);
583 583
   }
584
-								 
584
+
585 585
   DP ddlambda_Theta_XXZ (DP lambda, int nj, int nk, int parj, int park, DP* si_n_anis_over_2)
586 586
   {
587 587
     DP result = (nj == nk) ? 0.0 : hbar_XXZ(lambda, fabs(nj - nk), parj*park, si_n_anis_over_2);
588 588
 
589
-    for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * hbar_XXZ(lambda, fabs(nj - nk) + 2*a, parj*park, si_n_anis_over_2);
589
+    for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * hbar_XXZ(lambda, fabs(nj - nk) + 2*a, parj*park, si_n_anis_over_2);
590 590
 
591 591
     result += hbar_XXZ(lambda, nj + nk, parj*park, si_n_anis_over_2);
592 592
 
@@ -596,8 +596,8 @@ namespace JSC {
596 596
 
597 597
   XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState)
598 598
   {
599
-    if (2*RefState.base.Mdown == RefState.chain.Nsites) 
600
-      JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
599
+    if (2*RefState.base.Mdown == RefState.chain.Nsites)
600
+      ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
601 601
 
602 602
     Vect<int> newM = RefState.base.Nrap;
603 603
     newM[0] = newM[0] + 1;
@@ -607,10 +607,10 @@ namespace JSC {
607 607
     XXZ_Bethe_State ReturnState (RefState.chain, newBase);
608 608
 
609 609
     for (int il = 1; il < RefState.chain.Nstrings; ++il)
610
-      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha) 
610
+      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
611 611
 	ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
612 612
 
613
-    // Add a quantum number in middle (explicitly: to right of index M[0]/2) 
613
+    // Add a quantum number in middle (explicitly: to right of index M[0]/2)
614 614
     // and shift quantum numbers by half-integer away from added one:
615 615
     ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
616 616
     for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
@@ -623,7 +623,7 @@ namespace JSC {
623 623
   XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState)
624 624
   {
625 625
     if (RefState.base.Nrap[0] == 0)
626
-      JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
626
+      ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
627 627
 
628 628
     Vect<int> newM = RefState.base.Nrap;
629 629
     newM[0] = newM[0] - 1;
@@ -633,7 +633,7 @@ namespace JSC {
633 633
     XXZ_Bethe_State ReturnState (RefState.chain, newBase);
634 634
 
635 635
     for (int il = 1; il < RefState.chain.Nstrings; ++il)
636
-      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha) 
636
+      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
637 637
 	ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
638 638
 
639 639
     // Remove midmost and shift quantum numbers by half-integer towards removed one:
@@ -642,5 +642,5 @@ namespace JSC {
642 642
 
643 643
     return(ReturnState);
644 644
     }
645
-  
646
-} // namespace JSC
645
+
646
+} // namespace ABACUS

+ 126
- 127
src/HEIS/XXZ_gpd_Bethe_State.cc View File

@@ -1,6 +1,6 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5 5
 Copyright (c)
6 6
 
@@ -12,12 +12,11 @@ Purpose:  Defines all functions for XXZ_gpd_Bethe_State
12 12
 
13 13
 ******************************************************************/
14 14
 
15
-
16
-#include "JSC.h"
15
+#include "ABACUS.h"
17 16
 
18 17
 using namespace std;
19 18
 
20
-namespace JSC {
19
+namespace ABACUS {
21 20
 
22 21
   // Function prototypes
23 22
 
@@ -31,14 +30,14 @@ namespace JSC {
31 30
 
32 31
   // Function definitions:  class XXZ_gpd_Bethe_State
33 32
 
34
-  XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State () 
35
-    : Heis_Bethe_State(), sinlambda(Lambda(chain, 1)), coslambda(Lambda(chain, 1)), tanlambda(Lambda(chain, 1)) 
33
+  XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State ()
34
+    : Heis_Bethe_State(), sinlambda(Lambda(chain, 1)), coslambda(Lambda(chain, 1)), tanlambda(Lambda(chain, 1))
36 35
   {};
37 36
 
38 37
   XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState) // copy constructor
39
-    : Heis_Bethe_State(RefState), 
40
-      sinlambda(Lambda(RefState.chain, RefState.base)), coslambda(Lambda(RefState.chain, RefState.base)), 
41
-      tanlambda(Lambda(RefState.chain, RefState.base)) 
38
+    : Heis_Bethe_State(RefState),
39
+      sinlambda(Lambda(RefState.chain, RefState.base)), coslambda(Lambda(RefState.chain, RefState.base)),
40
+      tanlambda(Lambda(RefState.chain, RefState.base))
42 41
   {
43 42
     // copy arrays into new ones
44 43
 
@@ -50,27 +49,27 @@ namespace JSC {
50 49
       }
51 50
     }
52 51
   }
53
-  
54
-  XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M) 
55
-    : Heis_Bethe_State(RefChain, M), 
52
+
53
+  XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M)
54
+    : Heis_Bethe_State(RefChain, M),
56 55
       sinlambda(Lambda(RefChain, M)), coslambda(Lambda(RefChain, M)), tanlambda(Lambda(RefChain, M))
57 56
   {
58
-    if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
57
+    if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
59 58
   }
60 59
 
61
-  XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase) 
60
+  XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
62 61
     : Heis_Bethe_State(RefChain, RefBase),
63
-      sinlambda(Lambda(RefChain, RefBase)), coslambda(Lambda(RefChain, RefBase)), 
64
-      tanlambda(Lambda(RefChain, RefBase)) 
62
+      sinlambda(Lambda(RefChain, RefBase)), coslambda(Lambda(RefChain, RefBase)),
63
+      tanlambda(Lambda(RefChain, RefBase))
65 64
   {
66
-    if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
65
+    if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
67 66
   }
68 67
   /*
69 68
   XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref)
70 69
     : Heis_Bethe_State(RefChain, base_id_ref, type_id_ref),
71 70
       sinlambda(Lambda(chain, base)), coslambda(Lambda(chain, base)), tanlambda(Lambda(chain, base))
72 71
   {
73
-    if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
72
+    if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
74 73
   }
75 74
   */
76 75
   XXZ_gpd_Bethe_State& XXZ_gpd_Bethe_State::operator= (const XXZ_gpd_Bethe_State& RefState)
@@ -119,7 +118,7 @@ namespace JSC {
119 118
 
120 119
       }
121 120
     }
122
-    
121
+
123 122
     return;
124 123
   }
125 124
 
@@ -155,7 +154,7 @@ namespace JSC {
155 154
 
156 155
   bool XXZ_gpd_Bethe_State::Check_Admissibility(char option)
157 156
   {
158
-    // This function checks the admissibility of the Ix2's of a state:  
157
+    // This function checks the admissibility of the Ix2's of a state:
159 158
     // returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
160 159
     // and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
161 160
 
@@ -163,18 +162,18 @@ namespace JSC {
163 162
     Vect<bool> Zero_at_level(false, chain.Nstrings); // whether there exists an Ix2 == 0 at a given level
164 163
 
165 164
     /*
166
-    Vect<bool> min_Ix2_max_busy(false, chain.Nstrings); 
165
+    Vect<bool> min_Ix2_max_busy(false, chain.Nstrings);
167 166
     Vect<bool> plus_Ix2_max_busy(false, chain.Nstrings);
168
-    for (int j = 0; j < chain.Nstrings; ++j) 
167
+    for (int j = 0; j < chain.Nstrings; ++j)
169 168
       for (int alpha = 0; alpha < base[j]; ++alpha) {
170 169
 	if (Ix2[j][alpha] == -base.Ix2_max[j]) min_Ix2_max_busy[j] = true;
171 170
 	if (Ix2[j][alpha] == base.Ix2_max[j]) plus_Ix2_max_busy[j] = true;
172 171
       }
173 172
     */
174 173
     /*
175
-    // State is not admissible if this is false:  -N/2 + 1 \leq \sum I^j_{\alpha} \leq N 
174
+    // State is not admissible if this is false:  -N/2 + 1 \leq \sum I^j_{\alpha} \leq N
176 175
     int sum_all_Ix2 = 0;
177
-    for (int j = 0; j < chain.Nstrings; ++j) 
176
+    for (int j = 0; j < chain.Nstrings; ++j)
178 177
       for (int alpha = 0; alpha < base[j]; ++alpha) {
179 178
 	sum_all_Ix2 += Ix2[j][alpha];
180 179
       }
@@ -190,13 +189,13 @@ namespace JSC {
190 189
     for (int j = 0; j < chain.Nstrings; ++j) {
191 190
       sum1 = 0;
192 191
       for (int k = 0; k < chain.Nstrings; ++k) {
193
-	sum1 += base[k] * (2 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1 : 0));
192
+	sum1 += base[k] * (2 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1 : 0));
194 193
       }
195 194
       // Define limits...
196 195
       //if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
197 196
 
198 197
       // This almost does it:  only missing are the states with one on -PI/2 and one on PI/2
199
-      if (base[j] >= 1 && (Ix2[j][0] <= -(chain.Nsites - sum1) || 
198
+      if (base[j] >= 1 && (Ix2[j][0] <= -(chain.Nsites - sum1) ||
200 199
 			   (Ix2[j][base[j] - 1] - Ix2[j][0]) > 2*(chain.Nsites - sum1))) {
201 200
 	//cout << "\tAn Ix2 is out of interval at level " << j << endl;
202 201
 	//cout << Ix2[j][base[j] - 1] << "\t" << Ix2[j][0] << "\t" << chain.Nsites << "\t" << sum1 << endl;
@@ -215,19 +214,19 @@ namespace JSC {
215 214
     /*
216 215
     // State is not admissible if all min_Ix2_max are busy simultaneously:
217 216
     bool any_min_Ix2_max_free = false;
218
-    for (int j = 0; j < chain.Nstrings; ++j) 
217
+    for (int j = 0; j < chain.Nstrings; ++j)
219 218
       if (base[j] > 0 && !min_Ix2_max_busy[j]) any_min_Ix2_max_free = true;
220 219
     if (!any_min_Ix2_max_free) return(false);
221 220
     */
222 221
     /*
223 222
     // State is not admissible if -Ix2_max, -Ix2_max + 2, ..., -Ix2_max + 2*(Str_L - 1) are busy:
224
-    for (int j = 0; j < chain.Nstrings; ++j) 
225
-      if (base[j] > 0 && Ix2[j][0] <= -base.Ix2_max[j] + 2*(chain.Str_L[j] - 1)) 
223
+    for (int j = 0; j < chain.Nstrings; ++j)
224
+      if (base[j] > 0 && Ix2[j][0] <= -base.Ix2_max[j] + 2*(chain.Str_L[j] - 1))
226 225
 	return(false);
227
-    // Almost correct with above !  
226
+    // Almost correct with above !
228 227
     // State is not admissible if Ix2_max - 2, ..., Ix2_max - 2*(Str_L - 2) are busy (NB:  one slot more than on left):
229
-    for (int j = 0; j < chain.Nstrings; ++j) 
230
-      if (base[j] > 0 && Ix2[j][base[j] - 1] >= base.Ix2_max[j] - 2*(chain.Str_L[j] - 2)) 
228
+    for (int j = 0; j < chain.Nstrings; ++j)
229
+      if (base[j] > 0 && Ix2[j][base[j] - 1] >= base.Ix2_max[j] - 2*(chain.Str_L[j] - 2))
231 230
 	return(false);
232 231
     */
233 232
 
@@ -242,9 +241,9 @@ namespace JSC {
242 241
 
243 242
     for (int j = 0; j < chain.Nstrings; ++j) {
244 243
       // The following line puts answer to true if there is at least one higher string with zero Ix2
245
-      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) /*&& !(chain.Str_L[j] % 2)*/) 
246
-	higher_string_on_zero = true;  
247
-      for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;         
244
+      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) /*&& !(chain.Str_L[j] % 2)*/)
245
+	higher_string_on_zero = true;
246
+      for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
248 247
       // NOTE:  if base[j] == 0, Zero_at_level[j] remains false.
249 248
     }
250 249
 
@@ -254,7 +253,7 @@ namespace JSC {
254 253
     // Checks that we have strings of equal length modulo 2 and same parity with Ix2 == 0, so equal rapidities, and inadmissibility
255 254
     for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
256 255
       for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
257
-	if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2))) 
256
+	if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
258 257
 	  string_coincidence = true;
259 258
     }
260 259
 
@@ -274,8 +273,8 @@ namespace JSC {
274 273
 
275 274
     // Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
276 275
 
277
-    for (int j = 0; j < chain.Nstrings; ++j) 
278
-      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;    
276
+    for (int j = 0; j < chain.Nstrings; ++j)
277
+      for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
279 278
 
280 279
     if (!answer) {
281 280
       E = 0.0;
@@ -296,26 +295,26 @@ namespace JSC {
296 295
     tanlambda[j][alpha] = tan(lambda[j][alpha]);
297 296
 
298 297
     DP sumtheta = 0.0;
299
-    
298
+
300 299
     sumtheta = 0.0;
301 300
     for (int k = 0; k < chain.Nstrings; ++k) {
302
-      for (int beta = 0; beta < base[k]; ++beta) 
301
+      for (int beta = 0; beta < base[k]; ++beta)
303 302
 	if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
304
-	  sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta]) 
305
-									* chain.ta_n_anis_over_2[2])) 
306
-	    + PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI); 
307
-	}		
308
-	else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]), 
303
+	  sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
304
+									* chain.ta_n_anis_over_2[2]))
305
+	    + PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
306
+	}
307
+	else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
309 308
 					     chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
310
-	  + PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0)) 
309
+	  + PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
311 310
 	  * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
312 311
     }
313 312
     sumtheta *= 2.0;
314
-    
315
-    BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
313
+
314
+    BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
316 315
 			  + PI * floor(0.5 + lambda[j][alpha]/PI))
317 316
       - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
318
-  }        
317
+  }
319 318
 
320 319
   void XXZ_gpd_Bethe_State::Compute_BE ()
321 320
   {
@@ -324,29 +323,29 @@ namespace JSC {
324 323
     (*this).Compute_tanlambda();
325 324
 
326 325
     DP sumtheta = 0.0;
327
-    
328
-    for (int j = 0; j < chain.Nstrings; ++j) 
326
+
327
+    for (int j = 0; j < chain.Nstrings; ++j)
329 328
       for (int alpha = 0; alpha < base[j]; ++alpha) {
330
-	
329
+
331 330
 	sumtheta = 0.0;
332 331
 	for (int k = 0; k < chain.Nstrings; ++k) {
333
-	  for (int beta = 0; beta < base[k]; ++beta) 
332
+	  for (int beta = 0; beta < base[k]; ++beta)
334 333
 	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
335
-	      sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta]) 
336
-									    * chain.ta_n_anis_over_2[2])) 
337
-		+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI); 
338
-	    }		
339
-	    else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]), 
334
+	      sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
335
+									    * chain.ta_n_anis_over_2[2]))
336
+		+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
337
+	    }
338
+	    else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
340 339
 						 chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
341
-	      + PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0)) 
340
+	      + PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
342 341
 	      * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
343 342
 	}
344 343
 	sumtheta *= 2.0;
345
-	
346
-	BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
344
+
345
+	BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
347 346
 			      + PI * floor(0.5 + lambda[j][alpha]/PI))
348 347
 	  - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
349
-      }        
348
+      }
350 349
   }
351 350
 
352 351
   DP XXZ_gpd_Bethe_State::Iterate_BAE (int j, int alpha)
@@ -354,17 +353,17 @@ namespace JSC {
354 353
     // Returns a new iteration value for lambda[j][alpha] given tanlambda[][] and BE[][]
355 354
     // Assumes that tanlambda[][] and BE[][] have been computed.
356 355
 
357
-    DP arg0 = 0.5 * (2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
356
+    DP arg0 = 0.5 * (2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
358 357
 			    + PI * floor(0.5 + lambda[j][alpha]/PI)) - BE[j][alpha]);
359 358
     DP arg = chain.ta_n_anis_over_2[chain.Str_L[j]] * tan(
360 359
 							  arg0
361
-							  //0.5 * 
360
+							  //0.5 *
362 361
 							  //(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
363
-							  //(2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
362
+							  //(2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
364 363
 							  //  + PI * floor(0.5 + lambda[j][alpha]/PI)) - BE[j][alpha])
365 364
 							  );
366 365
 
367
-    return(atan(arg) 
366
+    return(atan(arg)
368 367
 	   //+ PI * floor(0.5 + arg0)
369 368
 				  //0.5 * (Ix2[j][alpha] + sumtheta/PI)/(chain.Nsites)
370 369
 	   + PI * floor(0.5 + arg0/PI)
@@ -388,15 +387,15 @@ namespace JSC {
388 387
 
389 388
 	sumtheta = 0.0;
390 389
 	for (int k = 0; k < chain.Nstrings; ++k) {
391
-	  for (int beta = 0; beta < base[k]; ++beta) 
392
-	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
393
-	      sumtheta += atan((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta]) 
390
+	  for (int beta = 0; beta < base[k]; ++beta)
391
+	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
392
+	      sumtheta += atan((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
394 393
 									   * chain.ta_n_anis_over_2[2]))
395
-		+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI); 
394
+		+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
396 395
 
397
-	    else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]), 
396
+	    else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
398 397
 					     chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
399
-	      + PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0)) 
398
+	      + PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
400 399
 	      * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
401 400
 	}
402 401
 	sumtheta *= 2.0;
@@ -449,27 +448,27 @@ namespace JSC {
449 448
 
450 449
 	sumtheta = 0.0;
451 450
 	for (int k = 0; k < chain.Nstrings; ++k) {
452
-	  for (int beta = 0; beta < base[k]; ++beta) 
451
+	  for (int beta = 0; beta < base[k]; ++beta)
453 452
 	    if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
454
-	      sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta]) 
455
-									    * chain.ta_n_anis_over_2[2])) 
456
-		+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI); 
457
-	    }		
458
-	    else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]), 
453
+	      sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
454
+									    * chain.ta_n_anis_over_2[2]))
455
+		+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
456
+	    }
457
+	    else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
459 458
 					     chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
460
-	      + PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0)) 
459
+	      + PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
461 460
 	      * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
462 461
 	}
463 462
 	sumtheta *= 2.0;
464 463
 
465
-	RHSBAE[index] = chain.Nsites * 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) 
464
+	RHSBAE[index] = chain.Nsites * 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
466 465
        					      + PI * floor(0.5 + lambda[j][alpha]/PI))
467 466
 					      //					      )
468 467
 	  - sumtheta - PI*Ix2[j][alpha];
469 468
 	index++;
470 469
       }
471 470
     }
472
-    
471
+
473 472
     (*this).Build_Reduced_Gaudin_Matrix (Gaudin);
474 473
 
475 474
     for (int i = 0; i < base.Nraptot; ++i) dlambda[i] = - RHSBAE[i];
@@ -516,8 +515,8 @@ namespace JSC {
516 515
     bool nonan = true;
517 516
 
518 517
     for (int j = 0; j < chain.Nstrings; ++j)
519
-      for (int alpha = 0; alpha < base[j]; ++alpha) if (nonan) nonan = ((!is_nan(lambda[j][alpha])) 
520
-									//&& (lambda[j][alpha] > -0.5*PI*chain.Str_L[j]) 
518
+      for (int alpha = 0; alpha < base[j]; ++alpha) if (nonan) nonan = ((!is_nan(lambda[j][alpha]))
519
+									//&& (lambda[j][alpha] > -0.5*PI*chain.Str_L[j])
521 520
 									//&& (lambda[j][alpha] <= 0.5*PI*chain.Str_L[j])
522 521
 									);
523 522
 
@@ -557,53 +556,53 @@ namespace JSC {
557 556
       Vect_DP deltadiff(0.0, 1000);  // contains |delta^{a, a+1}|
558 557
 
559 558
       complex<DP> log_BAE_reg = 0.0;
560
-      
559
+
561 560
       for (int j = 0; j < (*this).chain.Nstrings; ++j) {
562 561
 	for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
563 562
 
564 563
 	  ln_deltadiff = 0.0;
565
-	      
564
+
566 565
 	  for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
567
-	    
566
+
568 567
 	    if ((*this).chain.Str_L[j] > 1) {  // else the BAE are already 1
569 568
 
570
-	      log_BAE_reg = DP((*this).chain.Nsites) * log(sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis 
569
+	      log_BAE_reg = DP((*this).chain.Nsites) * log(sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis
571 570
 							     * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0))
572 571
 			    /sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)));
573
-	      
574
-	      for (int k = 0; k < (*this).chain.Nstrings; ++k) 
575
-		for (int beta = 0; beta < (*this).base[k]; ++beta) 
572
+
573
+	      for (int k = 0; k < (*this).chain.Nstrings; ++k)
574
+		for (int beta = 0; beta < (*this).base[k]; ++beta)
576 575
 		  for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
577
-		    if ((j != k) || (alpha != beta) || (a != b - 1)) 
576
+		    if ((j != k) || (alpha != beta) || (a != b - 1))
578 577
 
579
-		      log_BAE_reg += log(sin(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )) 
580
-				      - ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )) 
578
+		      log_BAE_reg += log(sin(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a ))
579
+				      - ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
581 580
 					     - II * (*this).chain.anis));
582
-		    
583
-		    if ((j != k) || (alpha != beta) || (a != b + 1)) 
581
+
582
+		    if ((j != k) || (alpha != beta) || (a != b + 1))
584 583
 
585 584
 		      log_BAE_reg -= log(sin(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a ))
586
-				      - ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )) 
585
+				      - ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
587 586
 					     + II * (*this).chain.anis));
588 587
 		  }
589 588
 
590 589
 	      // The regular LHS of BAE is now defined.  Now sum up the deltas...
591
-	      
590
+
592 591
 	      if (a == 1) ln_deltadiff[0] = -real(log_BAE_reg);
593
-	      
592
+
594 593
 	      else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
595
-	      
594
+
596 595
 	      else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
597 596
 
598 597
 	    } // if ((*this).chain.Str_L[j] > 1)
599
-	    
598
+
600 599
 	  } // for (int a = 1; ...
601 600
 
602 601
 	  for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
603 602
 	    deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
604 603
 	    delta += fabs(deltadiff[a]);
605
-	  }  
606
-	      
604
+	  }
605
+
607 606
 	} // alpha sum
608 607
       } // j sum
609 608
 
@@ -618,7 +617,7 @@ namespace JSC {
618 617
   void XXZ_gpd_Bethe_State::Compute_Energy ()
619 618
   {
620 619
     DP sum = 0.0;
621
-    
620
+
622 621
     for (int j = 0; j < chain.Nstrings; ++j) {
623 622
       for (int alpha = 0; alpha < base[j]; ++alpha) {
624 623
 	sum += sinh(chain.Str_L[j] * chain.anis) / (cos(2.0 * lambda[j][alpha]) - cosh(chain.Str_L[j] * chain.anis));
@@ -626,7 +625,7 @@ namespace JSC {
626 625
     }
627 626
 
628 627
     sum *= chain.J * sinh(chain.anis);
629
-    
628
+
630 629
     E = sum;
631 630
 
632 631
     return;
@@ -662,7 +661,7 @@ namespace JSC {
662 661
   void XXZ_gpd_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
663 662
   {
664 663
 
665
-    if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
664
+    if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
666 665
 
667 666
     int index_jalpha;
668 667
     int index_kbeta;
@@ -687,24 +686,24 @@ namespace JSC {
687 686
 
688 687
 	      for (int kp = 0; kp < chain.Nstrings; ++kp) {
689 688
 		for (int betap = 0; betap < base[kp]; ++betap) {
690
-		  if (!((j == kp) && (alpha == betap))) 
691
-		    sum_hbar_XXZ 
692
-		      += ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp],  
689
+		  if (!((j == kp) && (alpha == betap)))
690
+		    sum_hbar_XXZ
691
+		      += ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp],
693 692
 					     chain.si_n_anis_over_2);
694 693
 		}
695 694
 	      }
696 695
 
697
-	      Gaudin_Red[index_jalpha][index_kbeta] 
696
+	      Gaudin_Red[index_jalpha][index_kbeta]
698 697
 		= complex<DP> ( chain.Nsites * hbar_XXZ_gpd (lambda[j][alpha], chain.Str_L[j], chain.si_n_anis_over_2) - sum_hbar_XXZ);
699 698
 	    }
700
-	    
699
+
701 700
 	    else {
702
-	      if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) 
703
-		Gaudin_Red[index_jalpha][index_kbeta] = 
704
-		  complex<DP> (chain.si_n_anis_over_2[4]/(pow(sinlambda[j][alpha] * coslambda[k][beta] 
701
+	      if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
702
+		Gaudin_Red[index_jalpha][index_kbeta] =
703
+		  complex<DP> (chain.si_n_anis_over_2[4]/(pow(sinlambda[j][alpha] * coslambda[k][beta]
705 704
 							       - coslambda[j][alpha] * sinlambda[k][beta], 2.0) + sinhetasq));
706
-	      else 
707
-		Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], 
705
+	      else
706
+		Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j],
708 707
 											     chain.Str_L[k], chain.si_n_anis_over_2));
709 708
 	    }
710 709
 	    index_kbeta++;
@@ -732,12 +731,12 @@ namespace JSC {
732 731
     DP result;
733 732
 
734 733
     if ((nj == 1) && (nk == 1)) result = fbar_XXZ_gpd(tanlambda, tanhnetaover2[2]);
735
-    
734
+
736 735
     else {
737 736
 
738 737
       result = (nj == nk) ? 0.0 : fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk)]);
739 738
 
740
-      for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk) + 2*a]);
739
+      for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk) + 2*a]);
741 740
 
742 741
       result += fbar_XXZ_gpd(tanlambda, tanhnetaover2[nj + nk]);
743 742
     }
@@ -749,12 +748,12 @@ namespace JSC {
749 748
   {
750 749
     return (si_n_anis_over_2[2*n]/(pow(sin(lambda), 2.0) + pow(si_n_anis_over_2[n], 2.0)));
751 750
   }
752
-								 
751
+
753 752
   DP ddlambda_Theta_XXZ_gpd (DP lambda, int nj, int nk, DP* si_n_anis_over_2)
754 753
   {
755 754
     DP result = (nj == nk) ? 0.0 : hbar_XXZ_gpd(lambda, fabs(nj - nk), si_n_anis_over_2);
756 755
 
757
-    for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * hbar_XXZ_gpd(lambda, fabs(nj - nk) + 2*a, si_n_anis_over_2);
756
+    for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * hbar_XXZ_gpd(lambda, fabs(nj - nk) + 2*a, si_n_anis_over_2);
758 757
 
759 758
     result += hbar_XXZ_gpd(lambda, nj + nk, si_n_anis_over_2);
760 759
 
@@ -764,8 +763,8 @@ namespace JSC {
764 763
 
765 764
   XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState)
766 765
   {
767
-    if (2*RefState.base.Mdown == RefState.chain.Nsites) 
768
-      JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
766
+    if (2*RefState.base.Mdown == RefState.chain.Nsites)
767
+      ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
769 768
 
770 769
     Vect<int> newM = RefState.base.Nrap;
771 770
     newM[0] = newM[0] + 1;
@@ -775,10 +774,10 @@ namespace JSC {
775 774
     XXZ_gpd_Bethe_State ReturnState (RefState.chain, newBase);
776 775
 
777 776
     for (int il = 1; il < RefState.chain.Nstrings; ++il)
778
-      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha) 
777
+      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
779 778
 	ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
780 779
 
781
-    // Add a quantum number in middle (explicitly: to right of index M[0]/2) 
780
+    // Add a quantum number in middle (explicitly: to right of index M[0]/2)
782 781
     // and shift quantum numbers by half-integer away from added one:
783 782
     ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
784 783
     for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
@@ -791,7 +790,7 @@ namespace JSC {
791 790
   XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState)
792 791
   {
793 792
     if (RefState.base.Nrap[0] == 0)
794
-      JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
793
+      ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
795 794
 
796 795
     Vect<int> newM = RefState.base.Nrap;
797 796
     newM[0] = newM[0] - 1;
@@ -801,7 +800,7 @@ namespace JSC {
801 800
     XXZ_gpd_Bethe_State ReturnState (RefState.chain, newBase);
802 801
 
803 802
     for (int il = 1; il < RefState.chain.Nstrings; ++il)
804
-      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha) 
803
+      for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
805 804
 	ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
806 805
 
807 806
     // Remove midmost and shift quantum numbers by half-integer towards removed one:
@@ -810,5 +809,5 @@ namespace JSC {
810 809
 
811 810
     return(ReturnState);
812 811
     }
813
-  
814
-} // namespace JSC
812
+
813
+} // namespace ABACUS

+ 42
- 37
src/HEIS/ln_Overlap_XXX.cc View File

@@ -1,18 +1,23 @@
1 1
 /**********************************************************
2 2
 
3
-This software is part of J.-S. Caux's ABACUS++ library.
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-Copyright (c)
5
+Copyright (c) J.-S. Caux.
6 6
 
7 7
 -----------------------------------------------------------
8 8
 
9
+File: ln_Overlap_XXX.cc
10
+
11
+Purpose: compute the overlap between an on-shell and an off-shell states
12
+
9 13
 ***********************************************************/
10 14
 
11
-#include "JSC.h"
15
+#include "ABACUS.h"
12 16
 
13
-using namespace JSC;
17
+using namespace std;
18
+using namespace ABACUS;
14 19
 
15
-namespace JSC {
20
+namespace ABACUS {
16 21
 
17 22
 inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
18 23
 {
@@ -22,9 +27,9 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
22 27
     for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
23 28
       for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
24 29
 
25
-	if (!((j == k) && (alpha == beta) && (a == b))) 
30
+	if (!((j == k) && (alpha == beta) && (a == b)))
26 31
 	  ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
27
-		     + 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b))); 
32
+		     + 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
28 33
       }
29 34
     }
30 35
   }
@@ -60,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
60 65
 inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
61 66
 {
62 67
   return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
63
-		      + 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5)) 
64
-		      )) 
68
+		      + 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
69
+		      ))
65 70
 	  * pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
66 71
 }
67 72
 
@@ -71,7 +76,7 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
71 76
   // The A and B states can contain strings.
72 77
 
73 78
   // IMPORTANT ASSUMPTIONS:
74
-  // - State B is an eigenstate of the model on which the overlap measure is defined  
79
+  // - State B is an eigenstate of the model on which the overlap measure is defined
75 80
 
76 81
   // Check that A and B are compatible:  same Mdown
77 82
 
@@ -92,12 +97,12 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
92 97
   complex<DP> ln_prod4 = 0.0;
93 98
 
94 99
   /*
95
-  for (int i = 0; i < A.chain.Nstrings; ++i) 
100
+  for (int i = 0; i < A.chain.Nstrings; ++i)
96 101
     for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
97 102
       for (int a = 1; a <= A.chain.Str_L[i]; ++a)
98 103
 	ln_prod1 += log(norm((A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))));
99 104
 
100
-  for (int i = 0; i < B.chain.Nstrings; ++i) 
105
+  for (int i = 0; i < B.chain.Nstrings; ++i)
101 106
     for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
102 107
       for (int a = 1; a <= B.chain.Str_L[i]; ++a)
103 108
 	if (norm((B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))) > 100.0 * MACHINE_EPS_SQ)
@@ -121,8 +126,8 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
121 126
 
122 127
   for (int j = 0; j < A.chain.Nstrings; ++j)
123 128
     for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
124
-      for (int a = 1; a <= A.chain.Str_L[j]; ++a) 
125
-	ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);  
129
+      for (int a = 1; a <= A.chain.Str_L[j]; ++a)
130
+	ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
126 131
 
127 132
   //  ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
128 133
 
@@ -132,7 +137,7 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
132 137
 	if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
133 138
 	else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
134 139
     }
135
-  
140
+
136 141
   //  ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
137 142
 
138 143
   // Now proceed to build the Hm2P matrix
@@ -153,12 +158,12 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
153 158
   for (int j = 0; j < A.chain.Nstrings; ++j) {
154 159
     for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
155 160
       for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
156
-	
161
+
157 162
 	index_b = 0;
158 163
 
159 164
 	//two_over_A_lambda_sq_plus_1over2sq = 2.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
160 165
 	//				  (A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
161
-	
166
+
162 167
 	for (int k = 0; k < B.chain.Nstrings; ++k) {
163 168
 	  for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
164 169
 	    for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
@@ -173,51 +178,51 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
173 178
 		  exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
174 179
 
175 180
 		//Prod_powerN = pow((B.lambda[k][beta]  + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (B.chain.Nsites));
176
-		Prod_powerN = pow((B.lambda[k][beta]  + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (A.chain.Nsites));  // careful !  
181
+		Prod_powerN = pow((B.lambda[k][beta]  + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (A.chain.Nsites));  // careful !
177 182
 
178 183
 		Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2
179 184
 		  //- two_over_A_lambda_sq_plus_1over2sq * exp(II*im_ln_Fn_F_B_0[k][beta]);
180 185
 		  ;
181 186
 	      }
182
-	      
187
+
183 188
 	      else {
184 189
 
185 190
 		if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
186 191
 		else if (b == B.chain.Str_L[k]) {
187
-		  
192
+
188 193
 		  Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
189 194
 		  for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
190
-		  
195
+
191 196
 		  Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
192 197
 		  for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
193 198
 
194 199
 		  sum1 = 0.0;
195
-		  
200
+
196 201
 		  sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
197
-		  
198
-		  sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k]) 
199
-		    * exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1] 
202
+
203
+		  sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
204
+		    * exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
200 205
 			  - ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
201
-		  
202
-		  for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) 
203
-		    
206
+
207
+		  for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
208
+
204 209
 		    sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
205 210
 		      exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
206
-		  
211
+
207 212
 		  //sum2 = 0.0;
208
-		  
213
+
209 214
 		  //for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum)  sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
210
-		  
215
+
211 216
 		  prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
212 217
 
213
-		  for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)  
218
+		  for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
214 219
 		    prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1))); // include all string contributions F_B_0 in this term
215 220
 
216 221
 		  //Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_lambda_sq_plus_1over2sq);
217 222
 		  Hm2P[index_a][index_b] = prod_num * sum1;
218 223
 
219 224
 		} // else if (b == B.chain.Str_L[k])
220
-	      } // else 
225
+	      } // else
221 226
 
222 227
 	      index_b++;
223 228
 	    }}} // sums over k, beta, b
@@ -232,22 +237,22 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
232 237
 
233 238
   /*
234 239
   complex<DP> ln_form_factor_sq = log(0.25 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
235
-    //    + 2.0 * real(lndet_LU_CX_dstry(Hm2P)) 
240
+    //    + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
236 241
     + 2.0 * det
237 242
     - A.lnnorm - B.lnnorm;
238 243
 
239
-  //cout << "ln_SZ: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det 
244
+  //cout << "ln_SZ: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
240 245
   //   << "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
241 246
 
242 247
   return(ln_form_factor_sq);
243 248
   */
244 249
   complex<DP> ln_overlap = 0.5 * (-ln_prod3 + ln_prod4) + det - 0.5 * (A.lnnorm + B.lnnorm);
245 250
 
246
-  cout << "ln_overlap: " << endl << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det 
251
+  cout << "ln_overlap: " << endl << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
247 252
        << "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
248 253
 
249 254
   return(ln_overlap);
250 255
 
251 256
 }
252 257
 
253
-} // namespace JSC
258
+} // namespace ABACUS

+ 55
- 40
src/HEIS/ln_Smin_ME_XXX.cc View File

@@ -1,8 +1,23 @@
1
-#include "JSC.h"
1
+/**********************************************************
2 2
 
3
-using namespace JSC;
3
+This software is part of J.-S. Caux's ABACUS library.
4 4
 
5
-namespace JSC {
5
+Copyright (c) J.-S. Caux.
6
+
7
+-----------------------------------------------------------
8
+
9
+File: ln_Smin_ME_XXX.cc
10
+
11
+Purpose: compute the S^- matrix elemment for XXX
12
+
13
+***********************************************************/
14
+
15
+#include "ABACUS.h"
16
+
17
+using namespace std;
18
+using namespace ABACUS;
19
+
20
+namespace ABACUS {
6 21
 
7 22
 inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
8 23
 {
@@ -12,12 +27,12 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
12 27
     for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
13 28
       for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
14 29
 
15
-	if (!((j == k) && (alpha == beta) && (a == b))) 
30
+	if (!((j == k) && (alpha == beta) && (a == b)))
16 31
 	  ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
17
-		     + 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b))); 
32
+		     + 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
18 33
       }
19 34
     }
20
-  } 
35
+  }
21 36
 
22 37
   return(ans);
23 38
 }
@@ -50,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
50 65
 inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
51 66
 {
52 67
   return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
53
-		      + 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5)) 
54
-		      )) 
68
+		      + 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
69
+		      ))
55 70
 	  * pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
56 71
 }
57 72
 
@@ -62,11 +77,11 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
62 77
 
63 78
   // Check that the two states are compatible
64 79
 
65
-  if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Smin matrix element.");
80
+  if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Smin matrix element.");
66 81
 
67
-  // Check that A and B are Mdown-compatible:  
82
+  // Check that A and B are Mdown-compatible:
68 83
 
69
-  if (A.base.Mdown != B.base.Mdown + 1) JSCerror("Incompatible Mdown between the two states in Smin matrix element!");
84
+  if (A.base.Mdown != B.base.Mdown + 1) ABACUSerror("Incompatible Mdown between the two states in Smin matrix element!");
70 85
 
71 86
   // Some convenient arrays
72 87
 
@@ -82,12 +97,12 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
82 97
   complex<DP> ln_prod3 = 0.0;
83 98
   complex<DP> ln_prod4 = 0.0;
84 99
 
85
-  for (int i = 0; i < A.chain.Nstrings; ++i) 
100
+  for (int i = 0; i < A.chain.Nstrings; ++i)
86 101
     for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
87 102
       for (int a = 1; a <= A.chain.Str_L[i]; ++a)
88 103
 	ln_prod1 += log(norm(A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)));
89 104
 
90
-  for (int i = 0; i < B.chain.Nstrings; ++i) 
105
+  for (int i = 0; i < B.chain.Nstrings; ++i)
91 106
     for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
92 107
       for (int a = 1; a <= B.chain.Str_L[i]; ++a)
93 108
 	if (norm(B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)) > 100.0 * MACHINE_EPS_SQ)
@@ -120,8 +135,8 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
120 135
 
121 136
   for (int j = 0; j < A.chain.Nstrings; ++j)
122 137
     for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
123
-      for (int a = 1; a <= A.chain.Str_L[j]; ++a) 
124
-	ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);  
138
+      for (int a = 1; a <= A.chain.Str_L[j]; ++a)
139
+	ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
125 140
 
126 141
   //  ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
127 142
 
@@ -131,7 +146,7 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
131 146
 	if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
132 147
 	else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
133 148
     }
134
-  
149
+
135 150
   //  ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
136 151
 
137 152
   // Now proceed to build the Hm matrix
@@ -152,10 +167,10 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
152 167
   for (int j = 0; j < A.chain.Nstrings; ++j) {
153 168
     for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
154 169
       for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
155
-	
170
+
156 171
 	index_b = 0;
157
-	
158
-	one_over_A_lambda_sq_plus_1over2sq = 1.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) * 
172
+
173
+	one_over_A_lambda_sq_plus_1over2sq = 1.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
159 174
 						  (A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
160 175
 
161 176
 	for (int k = 0; k < B.chain.Nstrings; ++k) {
@@ -166,9 +181,9 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
166 181
 
167 182
 		// use simplified code for one-string here:  original form of Hm2P matrix
168 183
 
169
-		Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) * 
184
+		Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
170 185
 		  exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta]);
171
-		Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) * 
186
+		Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
172 187
 		  exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
173 188
 
174 189
 		Prod_powerN = pow((B.lambda[k][beta] + II * 0.5) /(B.lambda[k][beta] - II * 0.5), complex<DP> (B.chain.Nsites));
@@ -176,54 +191,54 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
176 191
 		Hm[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2;
177 192
 
178 193
 	      } // if (B.chain.Str_L == 1)
179
-	      
194
+
180 195
 	      else {
181 196
 
182 197
 		if (b <= B.chain.Str_L[k] - 1) Hm[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
183 198
 		else if (b == B.chain.Str_L[k]) {
184
-		  
199
+
185 200
 		  Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
186 201
 		  for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
187
-		  
202
+
188 203
 		  Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
189 204
 		  for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
190
-		  
205
+
191 206
 		  sum1 = 0.0;
192
-		  
207
+
193 208
 		  sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
194
-		  
195
-		  sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k]) 
196
-		    * exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1] 
209
+
210
+		  sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
211
+		    * exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
197 212
 			  - ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
198
-		  
199
-		  for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) 
200
-		    
213
+
214
+		  for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
215
+
201 216
 		    sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
202 217
 		      exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
203
-		  
218
+
204 219
 		  /*
205 220
 		  sum2 = 0.0;
206
-		  
221
+
207 222
 		  for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum)  sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
208
-		  
223
+
209 224
 		  */
210 225
 		  prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
211 226
 
212
-		  for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)  
213
-		    prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1))); 
227
+		  for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
228
+		    prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)));
214 229
 		  // include all string contributions F_B_0 in this term
215 230
 
216 231
 		  Hm[index_a][index_b] = prod_num * sum1;
217 232
 
218 233
 		} // else if (b == B.chain.Str_L[k])
219
-	      } // else 
234
+	      } // else
220 235
 
221 236
 	      index_b++;
222 237
 	    }}} // sums over k, beta, b
223 238
 
224 239
 	// now define the elements Hm[a][M]
225 240
 
226
-	Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;  
241
+	Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
227 242
 
228 243
 	index_a++;
229 244
       }}} // sums over j, alpha, a
@@ -236,4 +251,4 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
236 251
 
237 252
 }
238 253
 
239
-} // namespace JSC
254
+} // namespace ABACUS

+ 0
- 0
src/HEIS/ln_Smin_ME_XXZ.cc View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save