Reorganization of headers (I): rename JSC -> ABACUS
All files need to be changed to refer to new headers. First step of the reorganization.
This commit is contained in:
부모
0c893c89f7
커밋
63cdd4250c
|
@ -0,0 +1,69 @@
|
|||
#+TODO: TODO(t@) | DONE(d@)
|
||||
#+TODO: BUGREPORT(b@) CRITICAL(#@) | SOLVED(s@)
|
||||
#+TODO: CONCEPT(c@) UPDATED(u@) | REJECTED(r@)
|
||||
#+TODO: PICKEDUP(p@) | ABANDONED(k@) IMPLEMENTED(i@)
|
||||
|
||||
|
||||
* Templates
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Templates
|
||||
:END:
|
||||
** Project
|
||||
*** dev-unit
|
||||
**** Description
|
||||
Type your description here
|
||||
**** Tasks
|
||||
***** Task1example (needs a TODO state)
|
||||
|
||||
|
||||
|
||||
* Bugs :ABACUS:Dev:Bugs:
|
||||
:PROPERTIES:
|
||||
:ARCHIVE: %s_archive::* Bugs
|
||||
:CUSTOM_ID: Bugs
|
||||
:END:
|
||||
|
||||
|
||||
* Priority :ABACUS:Dev:Priority:
|
||||
:PROPERTIES:
|
||||
:ARCHIVE: %s_archive::* Priority
|
||||
:CUSTOM_ID: Priority
|
||||
:END:
|
||||
|
||||
|
||||
* Implementation queue :ABACUS:Dev:ImpQueue:
|
||||
:PROPERTIES:
|
||||
:ARCHIVE: %s_archive::* Implementation queue
|
||||
:CUSTOM_ID: ImplementationQueue
|
||||
:END:
|
||||
|
||||
|
||||
** CONCEPT Complex integration
|
||||
- State "CONCEPT" from "" [2018-02-10 Sat 06:28]
|
||||
*** Complete implementation of Integral_result_CX
|
||||
**** Description
|
||||
The `Integral_result_CX Integrate_optimal_using_table` functions are not yet implemented.
|
||||
**** Tasks
|
||||
***** Implement `Integral_result_CX Integrate_optimal_using_table`
|
||||
|
||||
|
||||
|
||||
|
||||
** CONCEPT Rewrite ODSLF to use `State_Label`
|
||||
- State "CONCEPT" from "" [2018-02-10 Sat 06:49]
|
||||
|
||||
|
||||
|
||||
* Planning (short term) :ABACUS:Dev:PlanningST:
|
||||
:PROPERTIES:
|
||||
:ARCHIVE: %s_archive::* Planning (short term)
|
||||
:CUSTOM_ID: PlanningShortTerm
|
||||
:END:
|
||||
|
||||
|
||||
|
||||
* Planning (long term) :ABACUS:Dev:PlanningLT:
|
||||
:PROPERTIES:
|
||||
:ARCHIVE: %s_archive::* Planning (long term)
|
||||
:CUSTOM_ID: PlanningLongTerm
|
||||
:END:
|
156
Makefile
156
Makefile
|
@ -37,12 +37,12 @@ COMPILE = $(CXX) -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
|||
COMPILE_MPI = mpicxx -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
||||
#COMPILE_OMP = g++ -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
vpath %.h $(HEADDIR)
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
Objects_LIEBLIN = $(OBJDIR)LiebLin_Bethe_State.o $(OBJDIR)LiebLin_Chem_Pot.o \
|
||||
$(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
|
|||
Objects_UTILS = $(OBJDIR)Data_File_Name.o $(OBJDIR)K_and_Omega_Files.o $(OBJDIR)Smoothen_RAW_into_SF.o \
|
||||
$(OBJDIR)Smoothen_RAW_into_SF_LiebLin_Scaled.o $(OBJDIR)Sort_RAW_File.o $(OBJDIR)State_Label.o
|
||||
|
||||
Objects_XXX_h0 = $(OBJDIR)XXX_h0.o
|
||||
Objects_XXX_VOA = $(OBJDIR)XXX_VOA.o
|
||||
|
||||
Objects_XXZ_h0 = $(OBJDIR)XXZ_h0.o
|
||||
Objects_XXZ_VOA = $(OBJDIR)XXZ_VOA.o
|
||||
|
||||
Objects_YOUNG = $(OBJDIR)Young_Tableau.o
|
||||
|
||||
Objects_ALL = $(Objects_LIEBLIN) $(Objects_HEIS) $(Objects_COMBI) $(Objects_FITTING) \
|
||||
$(Objects_INTEG) $(Objects_MATRIX) $(Objects_NRG) $(Objects_SCAN) $(Objects_TBA) \
|
||||
$(Objects_UTILS) $(Objects_XXX_h0) $(Objects_XXZ_h0) $(Objects_YOUNG)
|
||||
$(Objects_UTILS) $(Objects_XXX_VOA) $(Objects_XXZ_VOA) $(Objects_YOUNG)
|
||||
|
||||
EXECS = $(BINDIR)LiebLin_DSF $(BINDIR)LiebLin_Data_Daemon $(BINDIR)LiebLin_RAW_File_Stats \
|
||||
$(BINDIR)LiebLin_DSF_tester $(BINDIR)LiebLin_DSF_tester_Ix2 $(BINDIR)LiebLin_DSF_MosesState \
|
||||
|
@ -144,218 +144,218 @@ lib$(VERSION).a : $(Objects_ALL)
|
|||
###########################################
|
||||
# Interacting LiebLin gas
|
||||
|
||||
$(OBJDIR)LiebLin_Bethe_State.o : LiebLin_Bethe_State.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Bethe_State.o : LiebLin_Bethe_State.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Chem_Pot.o : LiebLin_Chem_Pot.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Chem_Pot.o : LiebLin_Chem_Pot.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Matrix_Element_Contrib.o : LiebLin_Matrix_Element_Contrib.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Matrix_Element_Contrib.o : LiebLin_Matrix_Element_Contrib.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_ln_Overlap.o : LiebLin_ln_Overlap.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_ln_Overlap.o : LiebLin_ln_Overlap.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Sumrules.o : LiebLin_Sumrules.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Sumrules.o : LiebLin_Sumrules.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_State_Ensemble.o : LiebLin_State_Ensemble.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_State_Ensemble.o : LiebLin_State_Ensemble.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Tgt0.o : LiebLin_Tgt0.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Tgt0.o : LiebLin_Tgt0.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Twisted_lnnorm.o : LiebLin_Twisted_lnnorm.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Twisted_lnnorm.o : LiebLin_Twisted_lnnorm.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Utils.o : LiebLin_Utils.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Utils.o : LiebLin_Utils.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Density_ME.o : ln_Density_ME.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)ln_Density_ME.o : ln_Density_ME.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)LiebLin_Twisted_ln_Overlap.o : LiebLin_Twisted_ln_Overlap.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)LiebLin_Twisted_ln_Overlap.o : LiebLin_Twisted_ln_Overlap.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Psi_ME.o : ln_Psi_ME.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)ln_Psi_ME.o : ln_Psi_ME.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_g2_ME.o : ln_g2_ME.cc $(Headers_JSC) JSC_LiebLin.h
|
||||
$(OBJDIR)ln_g2_ME.o : ln_g2_ME.cc $(Headers_ABACUS) ABACUS_LiebLin.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
|
||||
###########################################
|
||||
# Heisenberg chains
|
||||
|
||||
$(OBJDIR)Heis.o : Heis.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)Heis.o : Heis.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)Heis_Chem_Pot.o : Heis_Chem_Pot.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)Heis_Chem_Pot.o : Heis_Chem_Pot.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)Heis_Sumrules.o : Heis_Sumrules.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)Heis_Sumrules.o : Heis_Sumrules.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)Heis_Matrix_Element_Contrib.o : Heis_Matrix_Element_Contrib.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)Heis_Matrix_Element_Contrib.o : Heis_Matrix_Element_Contrib.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Overlap_XXX.o : ln_Overlap_XXX.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Overlap_XXX.o : ln_Overlap_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Sz_ME_XXX.o : ln_Sz_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Sz_ME_XXX.o : ln_Sz_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Szz_ME_XXX.o : ln_Szz_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Szz_ME_XXX.o : ln_Szz_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Smm_ME_XXX.o : ln_Smm_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Smm_ME_XXX.o : ln_Smm_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Szm_p_Smz_ME_XXX.o : ln_Szm_p_Smz_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Szm_p_Smz_ME_XXX.o : ln_Szm_p_Smz_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Sz_ME_XXZ.o : ln_Sz_ME_XXZ.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Sz_ME_XXZ.o : ln_Sz_ME_XXZ.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Sz_ME_XXZ_gpd.o : ln_Sz_ME_XXZ_gpd.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Sz_ME_XXZ_gpd.o : ln_Sz_ME_XXZ_gpd.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Smin_ME_XXX.o : ln_Smin_ME_XXX.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Smin_ME_XXX.o : ln_Smin_ME_XXX.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Smin_ME_XXZ.o : ln_Smin_ME_XXZ.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Smin_ME_XXZ.o : ln_Smin_ME_XXZ.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Smin_ME_XXZ_gpd.o : ln_Smin_ME_XXZ_gpd.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)ln_Smin_ME_XXZ_gpd.o : ln_Smin_ME_XXZ_gpd.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)M_vs_H.o : M_vs_H.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)M_vs_H.o : M_vs_H.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)XXX_Bethe_State.o : XXX_Bethe_State.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)XXX_Bethe_State.o : XXX_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)XXZ_Bethe_State.o : XXZ_Bethe_State.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)XXZ_Bethe_State.o : XXZ_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)XXZ_gpd_Bethe_State.o : XXZ_gpd_Bethe_State.cc $(Headers_JSC) JSC_Heis.h
|
||||
$(OBJDIR)XXZ_gpd_Bethe_State.o : XXZ_gpd_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
|
||||
###########################################
|
||||
# One-d spinless fermions
|
||||
|
||||
$(OBJDIR)ODSLF.o : ODSLF.cc $(Headers_JSC) JSC_Heis.h JSC_ODSLF.h
|
||||
$(OBJDIR)ODSLF.o : ODSLF.cc $(Headers_ABACUS) ABACUS_Heis.h ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ODSLF_Chem_Pot.o : ODSLF_Chem_Pot.cc $(Headers_JSC) JSC_ODSLF.h
|
||||
$(OBJDIR)ODSLF_Chem_Pot.o : ODSLF_Chem_Pot.cc $(Headers_ABACUS) ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ODSLF_Sumrules.o : ODSLF_Sumrules.cc $(Headers_JSC) JSC_ODSLF.h
|
||||
$(OBJDIR)ODSLF_Sumrules.o : ODSLF_Sumrules.cc $(Headers_ABACUS) ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ODSLF_XXZ_Bethe_State.o : ODSLF_XXZ_Bethe_State.cc $(Headers_JSC) JSC_Heis.h JSC_ODSLF.h
|
||||
$(OBJDIR)ODSLF_XXZ_Bethe_State.o : ODSLF_XXZ_Bethe_State.cc $(Headers_ABACUS) ABACUS_Heis.h ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Smin_ME_ODSLF_XXZ.o : ln_Smin_ME_ODSLF_XXZ.cc $(Headers_JSC) JSC_ODSLF.h
|
||||
$(OBJDIR)ln_Smin_ME_ODSLF_XXZ.o : ln_Smin_ME_ODSLF_XXZ.cc $(Headers_ABACUS) ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ln_Sz_ME_ODSLF_XXZ.o : ln_Sz_ME_ODSLF_XXZ.cc $(Headers_JSC) JSC_ODSLF.h
|
||||
$(OBJDIR)ln_Sz_ME_ODSLF_XXZ.o : ln_Sz_ME_ODSLF_XXZ.cc $(Headers_ABACUS) ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ODSLF_Matrix_Element_Contrib.o : ODSLF_Matrix_Element_Contrib.cc $(Headers_JSC) JSC_ODSLF.h
|
||||
$(OBJDIR)ODSLF_Matrix_Element_Contrib.o : ODSLF_Matrix_Element_Contrib.cc $(Headers_ABACUS) ABACUS_ODSLF.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
|
||||
###########################################
|
||||
# Combinatorics functions
|
||||
|
||||
$(OBJDIR)Combinatorics.o : Combinatorics.cc $(Headers_JSC)
|
||||
$(OBJDIR)Combinatorics.o : Combinatorics.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
###########################################
|
||||
# Integ functions
|
||||
|
||||
$(OBJDIR)Integration.o : Integration.cc $(Headers_JSC)
|
||||
$(OBJDIR)Integration.o : Integration.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
###########################################
|
||||
# Fitting functions
|
||||
|
||||
$(OBJDIR)covsrt.o : covsrt.cc $(Headers_JSC)
|
||||
$(OBJDIR)covsrt.o : covsrt.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lin_reg.o : lin_reg.cc $(Headers_JSC)
|
||||
$(OBJDIR)lin_reg.o : lin_reg.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)mrq.o : mrq.cc $(Headers_JSC)
|
||||
$(OBJDIR)mrq.o : mrq.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)polint.o : polint.cc $(Headers_JSC)
|
||||
$(OBJDIR)polint.o : polint.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)polint_cx.o : polint_cx.cc $(Headers_JSC)
|
||||
$(OBJDIR)polint_cx.o : polint_cx.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
|
||||
###########################################
|
||||
# Matrix functions
|
||||
|
||||
$(OBJDIR)balanc.o : balanc.cc $(Headers_JSC)
|
||||
$(OBJDIR)balanc.o : balanc.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)det_LU.o : det_LU.cc $(Headers_JSC)
|
||||
$(OBJDIR)det_LU.o : det_LU.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)det_LU_CX.o : det_LU_CX.cc $(Headers_JSC)
|
||||
$(OBJDIR)det_LU_CX.o : det_LU_CX.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)eigsrt.o : eigsrt.cc $(Headers_JSC)
|
||||
$(OBJDIR)eigsrt.o : eigsrt.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)elmhes.o : elmhes.cc $(Headers_JSC)
|
||||
$(OBJDIR)elmhes.o : elmhes.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)gaussj.o : gaussj.cc $(Headers_JSC)
|
||||
$(OBJDIR)gaussj.o : gaussj.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)hqr.o : hqr.cc $(Headers_JSC)
|
||||
$(OBJDIR)hqr.o : hqr.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)jacobi.o : jacobi.cc $(Headers_JSC)
|
||||
$(OBJDIR)jacobi.o : jacobi.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lndet_LU.o : lndet_LU.cc $(Headers_JSC)
|
||||
$(OBJDIR)lndet_LU.o : lndet_LU.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lndet_LU_CX.o : lndet_LU_CX.cc $(Headers_JSC)
|
||||
$(OBJDIR)lndet_LU_CX.o : lndet_LU_CX.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lndet_LU_dstry.o : lndet_LU_dstry.cc $(Headers_JSC)
|
||||
$(OBJDIR)lndet_LU_dstry.o : lndet_LU_dstry.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lndet_LU_CX_dstry.o : lndet_LU_CX_dstry.cc $(Headers_JSC)
|
||||
$(OBJDIR)lndet_LU_CX_dstry.o : lndet_LU_CX_dstry.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lubksb.o : lubksb.cc $(Headers_JSC)
|
||||
$(OBJDIR)lubksb.o : lubksb.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)lubksb_CX.o : lubksb_CX.cc $(Headers_JSC)
|
||||
$(OBJDIR)lubksb_CX.o : lubksb_CX.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ludcmp.o : ludcmp.cc $(Headers_JSC)
|
||||
$(OBJDIR)ludcmp.o : ludcmp.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)ludcmp_CX.o : ludcmp_CX.cc $(Headers_JSC)
|
||||
$(OBJDIR)ludcmp_CX.o : ludcmp_CX.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)pythag.o : pythag.cc $(Headers_JSC)
|
||||
$(OBJDIR)pythag.o : pythag.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)tqli.o : tqli.cc $(Headers_JSC)
|
||||
$(OBJDIR)tqli.o : tqli.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)tred2.o : tred2.cc $(Headers_JSC)
|
||||
$(OBJDIR)tred2.o : tred2.cc $(Headers_ABACUS)
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
|
||||
|
@ -399,16 +399,16 @@ $(OBJDIR)Scan_Thread_Data.o : Scan_Thread_Data.cc $(Headers_all)
|
|||
###########################################
|
||||
# Thermodynamic Bethe Ansatz
|
||||
|
||||
$(OBJDIR)Root_Density.o : Root_Density.cc $(Headers_JSC) JSC_TBA.h
|
||||
$(OBJDIR)Root_Density.o : Root_Density.cc $(Headers_ABACUS) ABACUS_TBA.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)TBA_LiebLin.o : TBA_LiebLin.cc $(Headers_JSC) JSC_TBA.h
|
||||
$(OBJDIR)TBA_LiebLin.o : TBA_LiebLin.cc $(Headers_ABACUS) ABACUS_TBA.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)TBA_XXZ.o : TBA_XXZ.cc $(Headers_JSC) JSC_TBA.h
|
||||
$(OBJDIR)TBA_XXZ.o : TBA_XXZ.cc $(Headers_ABACUS) ABACUS_TBA.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
$(OBJDIR)TBA_2CBG.o : TBA_2CBG.cc $(Headers_JSC) JSC_TBA.h
|
||||
$(OBJDIR)TBA_2CBG.o : TBA_2CBG.cc $(Headers_ABACUS) ABACUS_TBA.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
###########################################
|
||||
|
@ -433,15 +433,15 @@ $(OBJDIR)State_Label.o : State_Label.cc $(Headers_all)
|
|||
$(COMPILE) -c $< -o $@
|
||||
|
||||
###########################################
|
||||
# XXX_h0
|
||||
# XXX_VOA
|
||||
|
||||
$(OBJDIR)XXX_h0.o : XXX_h0.cc $(Headers_all) JSC_XXX_h0.h
|
||||
$(OBJDIR)XXX_VOA.o : XXX_VOA.cc $(Headers_all) ABACUS_XXX_VOA.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
###########################################
|
||||
# XXZ_h0
|
||||
# XXZ_VOA
|
||||
|
||||
$(OBJDIR)XXZ_h0.o : XXZ_h0.cc $(Headers_all) JSC_XXZ_h0.h
|
||||
$(OBJDIR)XXZ_VOA.o : XXZ_VOA.cc $(Headers_all) ABACUS_XXZ_VOA.h
|
||||
$(COMPILE) -c $< -o $@
|
||||
|
||||
###########################################
|
||||
|
|
|
@ -26,7 +26,13 @@ $ make
|
|||
This will produce all executables, together with a library `ABACUS_[vn]` where vn is of the form [digit][character].
|
||||
|
||||
|
||||
---
|
||||
## Acknowledgements
|
||||
__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`.
|
||||
|
||||
__Jacopo De Nardis__ provided the code for the `ln_g2_ME` function for Lieb-Liniger.
|
||||
|
||||
__Teun Zwart__ has given much useful advice concerning C++ code organization.
|
||||
|
||||
|
||||
Previous versions
|
||||
=================
|
||||
|
|
|
@ -2,31 +2,30 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC.h
|
||||
File: ABACUS.h
|
||||
|
||||
Purpose: Core header file, includes all descendents.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _JSC_H_
|
||||
#define _JSC_H_
|
||||
#ifndef ABACUS_H
|
||||
#define ABACUS_H
|
||||
|
||||
// This core header file includes all the others
|
||||
|
||||
const char JSC_VERSION[20] = "ABACUS++G_8";
|
||||
const char ABACUS_VERSION[20] = "ABACUS++G_8";
|
||||
|
||||
// Standard includes
|
||||
#include <cmath>
|
||||
#include <cmath>
|
||||
#include <complex> // for complex number algebra
|
||||
#include <string>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <cstdlib> // for exit(), ...
|
||||
|
@ -46,77 +45,64 @@ const char JSC_VERSION[20] = "ABACUS++G_8";
|
|||
#include <signal.h> /* signal name macros, and the signal() prototype */
|
||||
|
||||
// My own math functions and shortcuts
|
||||
#include "JSC_util.h"
|
||||
#include "ABACUS_Utils.h"
|
||||
|
||||
// Vectors and matrices
|
||||
#include "JSC_Vect.h" // My vector class definitions
|
||||
#include "JSC_Matrix.h" // My matrix class definitions
|
||||
#include "ABACUS_Vect.h" // My vector class definitions
|
||||
#include "ABACUS_Matrix.h" // My matrix class definitions
|
||||
|
||||
// Choose_Table
|
||||
#include "JSC_Combi.h"
|
||||
#include "ABACUS_Combi.h"
|
||||
|
||||
// Fitting, interpolating
|
||||
#include "JSC_Fitting.h"
|
||||
#include "ABACUS_Fitting.h"
|
||||
|
||||
// Young tableaux
|
||||
#include "JSC_Young.h"
|
||||
#include "ABACUS_Young.h"
|
||||
|
||||
// Integration
|
||||
#include "JSC_Integ.h"
|
||||
#include "ABACUS_Integ.h"
|
||||
|
||||
// Special functions:
|
||||
#include "JSC_Spec_Fns.h"
|
||||
#include "ABACUS_Spec_Fns.h"
|
||||
|
||||
//*** Integrable models:
|
||||
|
||||
// Heisenberg spin-1/2 antiferromagnet
|
||||
#include "JSC_Heis.h"
|
||||
#include "ABACUS_Heis.h"
|
||||
|
||||
// Lieb-Liniger
|
||||
#include "JSC_LiebLin.h"
|
||||
#include "ABACUS_LiebLin.h"
|
||||
|
||||
// One-d spinless fermions:
|
||||
#include "JSC_ODSLF.h"
|
||||
#include "ABACUS_ODSLF.h"
|
||||
|
||||
// General:
|
||||
//#include "JSC_Bethe.h"
|
||||
//#include "ABACUS_Bethe.h" // IN DEVELOPMENT
|
||||
|
||||
// Thermodynamic Bethe Ansatz utilities
|
||||
#include "JSC_TBA.h"
|
||||
#include "ABACUS_TBA.h"
|
||||
|
||||
// State ensembles
|
||||
#include "JSC_State_Ensemble.h"
|
||||
#include "ABACUS_State_Ensemble.h"
|
||||
|
||||
// XXX in zero field: Uq(sl(2)) stuff
|
||||
#include "JSC_XXX_h0.h"
|
||||
// XXX in zero field: Vertex Operator Approach
|
||||
#include "ABACUS_XXX_VOA.h"
|
||||
|
||||
// XXZ in zero field: quantum groups
|
||||
#include "JSC_XXZ_h0.h"
|
||||
// XXZ in zero field: Vertex Operator Approach
|
||||
#include "ABACUS_XXZ_VOA.h"
|
||||
|
||||
// Two-component Bose gas
|
||||
//#include "2CBG.h"
|
||||
|
||||
// Richardson
|
||||
//#include "Richardson.h"
|
||||
|
||||
// *** Correlation functions:
|
||||
|
||||
// New scanning protocols for ABACUS++
|
||||
#include "JSC_Scan.h"
|
||||
|
||||
// Functions for everybody
|
||||
//#include "JSC_fns.h" // KEEP THIS INCLUDE LAST, SINCE IT USES PREVIOUS DECLARATIONS
|
||||
#include "ABACUS_Scan.h"
|
||||
|
||||
// Numerical RG:
|
||||
#include "JSC_NRG.h"
|
||||
|
||||
// OpenMP
|
||||
#include <omp.h>
|
||||
#include "ABACUS_NRG.h"
|
||||
|
||||
// Typedefs:
|
||||
typedef double DP;
|
||||
|
||||
|
||||
#endif // _JSC_H_
|
||||
|
||||
|
||||
#endif // ABACUS_H
|
|
@ -2,36 +2,24 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Bethe.h
|
||||
File: ABACUS_Bethe.h
|
||||
|
||||
Purpose: Declares Bethe state-related classes and functions.
|
||||
|
||||
Status: IN DEVELOPMENT
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _BETHE_
|
||||
#define _BETHE_
|
||||
#ifndef ABACUS_BETHE_H
|
||||
#define ABACUS_BETHE_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
|
||||
/*
|
||||
class Model {
|
||||
|
||||
protected:
|
||||
string Name; // LiebLin, XXZ, XXX, XXZ_gpd
|
||||
int Nsites; //
|
||||
int L;
|
||||
DP interaction;
|
||||
|
||||
public:
|
||||
Model (string Name_ref,
|
||||
};
|
||||
*/
|
||||
namespace ABACUS {
|
||||
|
||||
|
||||
class Base {
|
||||
|
@ -41,7 +29,7 @@ namespace JSC {
|
|||
Vect<int> Nrap; // Nrap[i] contains the number of rapidities of type i, i = 0, ..., Nstrings - 1.
|
||||
int Nraptot; // total number of strings in this state
|
||||
Vect<DP> Ix2_infty; // Ix2_infty[i] contains the max of BAE function for the (half-)integer I[i], i = 0, Nstrings - 1.
|
||||
Vect<int> Ix2_min;
|
||||
Vect<int> Ix2_min;
|
||||
Vect<int> Ix2_max; // Ix2_max[i] contains the integer part of 2*I_infty, with correct parity for base.
|
||||
string baselabel;
|
||||
|
||||
|
@ -51,20 +39,19 @@ namespace JSC {
|
|||
|
||||
public: // LiebLin constructors
|
||||
Base (int N); // Constructor for repulsive LiebLin gas case: one type of particle
|
||||
|
||||
|
||||
public: // HEIS constructors
|
||||
//Base (const Heis_Chain& RefChain, int M); // constructs configuration with all Mdown in one-string of +1 parity // DEPRECATED
|
||||
Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities); // sets to Nrapidities vector, and checks consistency
|
||||
Base (const Heis_Chain& RefChain, string baselabel_ref);
|
||||
|
||||
public: // operators
|
||||
|
||||
public: // operators
|
||||
Base& operator= (const Base& RefBase);
|
||||
bool operator== (const Base& RefBase);
|
||||
bool operator!= (const Base& RefBase);
|
||||
|
||||
public: // member functions
|
||||
void Compute_Ix2_limits(const Heis_Chain& RefChain); // computes the Ix2_infty and Ix2_max
|
||||
};
|
||||
void Compute_Ix2_limits(const Heis_Chain& RefChain); // computes the Ix2_infty and Ix2_max
|
||||
};
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
@ -83,7 +70,7 @@ namespace JSC {
|
|||
int iK;
|
||||
DP K;
|
||||
DP lnnorm;
|
||||
|
||||
|
||||
public: // identification
|
||||
string label; // this is the relative label by default
|
||||
Vect<Vect<int> > OriginIx2; // to define the relative label
|
||||
|
@ -94,16 +81,14 @@ namespace JSC {
|
|||
int iter;
|
||||
int iter_Newton;
|
||||
|
||||
//public: // for descendents, etc
|
||||
|
||||
public: // constructors
|
||||
Bethe_State();
|
||||
Bethe_State (const Bethe_State& RefState); // copy constructor
|
||||
Bethe_State (const Bethe_State& OriginState, string label_ref);
|
||||
Bethe_State (const Bethe_State& OriginState, string label_ref);
|
||||
|
||||
LiebLin_Bethe_State& operator= (const LiebLin_Bethe_State& RefState);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -1,25 +1,23 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006-9.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Combi.h
|
||||
File: ABACUS_Combi.h
|
||||
|
||||
Purpose: Declares combinatorics-related classes and functions.
|
||||
|
||||
Last modified: 08/10/2009
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _COMBI_
|
||||
#define _COMBI_
|
||||
#ifndef ABACUS_COMBI_H
|
||||
#define ABACUS_COMBI_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//***********************************************************************
|
||||
|
||||
|
@ -46,6 +44,6 @@ namespace JSC {
|
|||
std::ostream& operator<< (std::ostream& s, Choose_Table& Ref_table);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC.h
|
||||
File: ABACUS_Fitting.h
|
||||
|
||||
Purpose: Core header file, includes all descendents.
|
||||
Purpose: Defines functions for fitting: linear regression etc.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _FITTING_
|
||||
#define _FITTING_
|
||||
#ifndef ABACUS_FITTING_H
|
||||
#define ABACUS_FITTING_H
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Functions in src/FITTING directory
|
||||
void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit);
|
||||
void lin_reg (Vect_DP x, Vect_DP y, Vect_DP sigma, DP& a, DP& b, DP& chisq);
|
||||
void lin_reg (Vect_DP x, Vect_DP y, DP& a, DP& b, DP& chisq);
|
||||
void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
Vect<bool>& ia, SQMat_DP& covar, SQMat_DP& alpha, DP& chisq,
|
||||
void funcs(const DP, Vect_DP&, DP&, Vect_DP&), DP& alambda);
|
||||
void mrqcof (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
|
@ -30,8 +30,8 @@ namespace JSC {
|
|||
|
||||
// For interpolating:
|
||||
void polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy);
|
||||
void polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy);
|
||||
void polint(Vect_CX& xa, Vect_CX& ya, const std::complex<DP> x, std::complex<DP>& y, std::complex<DP>& dy);
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,428 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS_Heis.h
|
||||
|
||||
Purpose: Declares Heisenberg chain classes and functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef ABACUS_HEIS_H
|
||||
#define ABACUS_HEIS_H
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
// First, some global constants...
|
||||
|
||||
const long long int ID_UPPER_LIMIT = 10000000LL; // max size of vectors we can define without seg fault
|
||||
const int INTERVALS_SIZE = 100000; // size of Scan_Intervals arrays
|
||||
const int NBASESMAX = 1000; // max number of bases kept
|
||||
|
||||
const DP ITER_REQ_PREC = 100.0 * MACHINE_EPS_SQ;
|
||||
|
||||
// Cutoffs on particle numbers
|
||||
const int MAXSTRINGS = 20; // maximal number of particle types we allow in bases
|
||||
|
||||
const int NEXC_MAX_HEIS = 16; // maximal number of excitations (string binding/unbinding, particle-hole) considered
|
||||
|
||||
|
||||
//***********************************************************************
|
||||
|
||||
class Heis_Chain {
|
||||
|
||||
public:
|
||||
DP J;
|
||||
DP Delta;
|
||||
DP anis; // acos(Delta) if Delta < 1.0, 0 if Delta == 1.0, acosh(Delta) if Delta > 1.0
|
||||
DP hz;
|
||||
int Nsites;
|
||||
int Nstrings; // how many possible strings. The following two arrays have Nstrings nonzero elements.
|
||||
int* Str_L; // vector (length M) containing the allowed string lengths. Elements that are 0 have no meaning.
|
||||
int* par; // vector (length M) containing the parities of the strings. Elements that are 0 have no meaning.
|
||||
// Parities are all +1 except for gapless XXZ subcases
|
||||
DP* si_n_anis_over_2; // for optimization: sin for XXZ, sinh for XXZ_gpd
|
||||
DP* co_n_anis_over_2; // for optimization
|
||||
DP* ta_n_anis_over_2; // for optimization
|
||||
DP prec; // precision required for computations, always put to ITER_REQ_PREC
|
||||
|
||||
public:
|
||||
Heis_Chain ();
|
||||
Heis_Chain (DP JJ, DP DD, DP hh, int NN); // contructor: simply initializes
|
||||
Heis_Chain (const Heis_Chain& RefChain); // copy constructor;
|
||||
Heis_Chain& operator= (const Heis_Chain& RefChain);
|
||||
bool operator== (const Heis_Chain& RefChain);
|
||||
bool operator!= (const Heis_Chain& RefChain);
|
||||
~Heis_Chain(); // destructor
|
||||
|
||||
};
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Heis_Base are a checked vector containing the number of rapidities of allowable types for a given state
|
||||
|
||||
class Heis_Base {
|
||||
|
||||
public:
|
||||
int Mdown; // total number of down spins
|
||||
Vect<int> Nrap; // Nrap[i] contains the number of rapidities of type i, i = 0, Nstrings - 1.
|
||||
int Nraptot; // total number of strings in this state
|
||||
Vect<DP> Ix2_infty; // Ix2_infty[i] contains the max of BAE function for the (half-)integer I[i], i = 0, Nstrings - 1.
|
||||
Vect<int> Ix2_min;
|
||||
Vect<int> Ix2_max; // Ix2_max[i] contains the integer part of 2*I_infty, with correct parity for base.
|
||||
double dimH; // dimension of sub Hilbert space associated to this base; use double to avoid max int problems.
|
||||
std::string baselabel; // base label
|
||||
|
||||
public:
|
||||
Heis_Base ();
|
||||
Heis_Base (const Heis_Base& RefBase); // copy constructor
|
||||
Heis_Base (const Heis_Chain& RefChain, int M); // constructs configuration with all Mdown in one-string of +1 parity
|
||||
Heis_Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities); // sets to Nrapidities vector, and checks consistency
|
||||
Heis_Base (const Heis_Chain& RefChain, std::string baselabel_ref);
|
||||
inline int& operator[] (const int i);
|
||||
inline const int& operator[] (const int i) const;
|
||||
Heis_Base& operator= (const Heis_Base& RefBase);
|
||||
bool operator== (const Heis_Base& RefBase);
|
||||
bool operator!= (const Heis_Base& RefBase);
|
||||
|
||||
void Compute_Ix2_limits(const Heis_Chain& RefChain); // computes the Ix2_infty and Ix2_max
|
||||
|
||||
};
|
||||
|
||||
inline int& Heis_Base::operator[] (const int i)
|
||||
{
|
||||
return Nrap[i];
|
||||
}
|
||||
|
||||
inline const int& Heis_Base::operator[] (const int i) const
|
||||
{
|
||||
return Nrap[i];
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Lambda carry all rapidities of a state
|
||||
|
||||
class Lambda {
|
||||
|
||||
private:
|
||||
int Nstrings;
|
||||
Vect<int> Nrap;
|
||||
int Nraptot;
|
||||
DP** lambda;
|
||||
|
||||
public:
|
||||
Lambda ();
|
||||
Lambda (const Heis_Chain& RefChain, int M); // constructor, puts all lambda's to zero
|
||||
Lambda (const Heis_Chain& RefChain, const Heis_Base& base); // constructor, putting I's to lowest-energy config
|
||||
// consistent with Heis_Base configuration for chain RefChain
|
||||
Lambda& operator= (const Lambda& RefConfig);
|
||||
inline DP* operator[] (const int i);
|
||||
inline const DP* operator[] (const int i) const;
|
||||
~Lambda();
|
||||
|
||||
};
|
||||
|
||||
inline DP* Lambda::operator[] (const int i)
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
inline const DP* Lambda::operator[] (const int i) const
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Heis_Bethe_State carry all information about an eigenstate
|
||||
|
||||
// Derived classes include XXZ_Bethe_State, XXX_Bethe_State, XXZ_gpd_Bethe_State
|
||||
// These contain subclass-specific functions and data.
|
||||
|
||||
class Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
Heis_Chain chain;
|
||||
Heis_Base base;
|
||||
Vect<Vect<int> > Ix2;
|
||||
Lambda lambda;
|
||||
Lambda deviation; // string deviations
|
||||
Lambda BE; // Bethe equation for relevant rapidity, in the form BE = theta - (1/N)\sum ... - \pi I/N = 0
|
||||
DP diffsq; // sum of squares of rapidity differences in last iteration
|
||||
int conv; // convergence status
|
||||
DP dev; // sum of absolute values of string deviations
|
||||
int iter; // number of iterations necessary for convergence
|
||||
int iter_Newton; // number of iterations necessary for convergence (Newton method)
|
||||
DP E; // total energy
|
||||
int iK; // K = 2.0*PI * iK/Nsites
|
||||
DP K; // total momentum
|
||||
DP lnnorm; // ln of norm of reduced Gaudin matrix
|
||||
std::string label;
|
||||
|
||||
public:
|
||||
Heis_Bethe_State ();
|
||||
Heis_Bethe_State (const Heis_Bethe_State& RefState); // copy constructor
|
||||
Heis_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
Heis_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
virtual ~Heis_Bethe_State () {};
|
||||
|
||||
public:
|
||||
int Charge () { return(base.Mdown); };
|
||||
void Set_to_Label (std::string label_ref, const Vect<Vect<int> >& OriginIx2);
|
||||
void Set_Label_from_Ix2 (const Vect<Vect<int> >& OriginIx2);
|
||||
bool Check_Symmetry (); // checks whether the I's are symmetrically distributed
|
||||
void Compute_diffsq (); // \sum BE[j][alpha]^2
|
||||
void Find_Rapidities (bool reset_rapidities); // Finds the rapidities
|
||||
void Find_Rapidities_Twisted (bool reset_rapidities, DP twist); // Finds the rapidities with twist added to RHS of logBE
|
||||
void Solve_BAE_bisect (int j, int alpha, DP req_prec, int itermax);
|
||||
void Iterate_BAE (DP iter_factor); // Finds new set of lambda[j][alpha] from previous one by simple iteration
|
||||
void Solve_BAE_straight_iter (DP straight_prec, int max_iter_interp, DP iter_factor);
|
||||
void Solve_BAE_extrap (DP extrap_prec, int max_iter_extrap, DP iter_factor);
|
||||
void Iterate_BAE_Newton (); // Finds new set of lambda[j][alpha] from previous one by a Newton step
|
||||
void Solve_BAE_Newton (DP Newton_prec, int max_iter_Newton);
|
||||
void Solve_BAE_with_silk_gloves (DP silk_prec, int max_iter_silk, DP iter_factor);
|
||||
void Compute_lnnorm ();
|
||||
void Compute_Momentum ();
|
||||
void Compute_All (bool reset_rapidities); // solves BAE, computes E, K and lnnorm
|
||||
|
||||
inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<Vect<int> >& OriginStateIx2)
|
||||
{
|
||||
Ix2[0][0] = Ix2[0][1] - 2;
|
||||
Ix2[0][base.Nrap[0] - 1] = Ix2[0][base.Nrap[0] - 2] + 2;
|
||||
(*this).Compute_Momentum();
|
||||
if (base.Nrap[0] == 0) return(false);
|
||||
if (iKneeded >= iK) Ix2[0][base.Nrap[0]-1] += 2*(iKneeded - iK);
|
||||
else Ix2[0][0] += 2*(iKneeded - iK);
|
||||
if (Ix2[0][0] < base.Ix2_min[0] || Ix2[0][base.Nrap[0]-1] > base.Ix2_max[0]) return(false);
|
||||
(*this).Set_Label_from_Ix2 (OriginStateIx2);
|
||||
return(true);
|
||||
}
|
||||
void Set_to_Outer_Skeleton (const Vect<Vect<int> >& OriginStateIx2) {
|
||||
Ix2[0][0] = base.Ix2_min[0] - 4;
|
||||
Ix2[0][base.Nrap[0]-1] = base.Ix2_max[0] + 4;
|
||||
(*this).Set_Label_from_Ix2 (OriginStateIx2);
|
||||
};
|
||||
|
||||
void Set_to_Closest_Matching_Ix2_fixed_Base (const Heis_Bethe_State& StateToMatch); // defined in Heis.cc
|
||||
|
||||
|
||||
// Virtual functions, all defined in the derived classes
|
||||
|
||||
public:
|
||||
virtual void Set_Free_lambdas() { ABACUSerror("Heis_Bethe_State::..."); } // sets the rapidities to solutions of BAEs without scattering terms
|
||||
virtual bool Check_Admissibility(char option) { ABACUSerror("Heis_Bethe_State::..."); return(false); }
|
||||
// verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
|
||||
virtual void Compute_BE (int j, int alpha) { ABACUSerror("Heis_Bethe_State::..."); }
|
||||
virtual void Compute_BE () { ABACUSerror("Heis_Bethe_State::..."); }
|
||||
virtual DP Iterate_BAE(int i, int alpha) { ABACUSerror("Heis_Bethe_State::..."); return(0.0);}
|
||||
virtual bool Check_Rapidities() { ABACUSerror("Heis_Bethe_State::..."); return(false); }
|
||||
virtual DP String_delta () { ABACUSerror("Heis_Bethe_State::..."); return(0.0); }
|
||||
virtual void Compute_Energy () { ABACUSerror("Heis_Bethe_State::..."); }
|
||||
virtual void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red) { ABACUSerror("Heis_Bethe_State::..."); }
|
||||
};
|
||||
|
||||
inline bool Is_Inner_Skeleton (Heis_Bethe_State& State) {
|
||||
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));
|
||||
};
|
||||
inline bool Is_Outer_Skeleton (Heis_Bethe_State& State) {
|
||||
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);
|
||||
};
|
||||
|
||||
inline bool Force_Descent (char whichDSF, Heis_Bethe_State& ScanState, Heis_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
|
||||
{
|
||||
bool force_descent = false;
|
||||
|
||||
// Force descent for all DSFs if we're at K = 0 or PI and not conserving momentum upon descent:
|
||||
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
|
||||
|
||||
return(force_descent);
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const Heis_Bethe_State& state);
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXZ_Bethe_State carry all extra information pertaining to XXZ gapless
|
||||
|
||||
class XXZ_Bethe_State : public Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
Lambda sinhlambda;
|
||||
Lambda coshlambda;
|
||||
Lambda tanhlambda;
|
||||
|
||||
public:
|
||||
XXZ_Bethe_State ();
|
||||
XXZ_Bethe_State (const XXZ_Bethe_State& RefState); // copy constructor
|
||||
XXZ_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
|
||||
public:
|
||||
XXZ_Bethe_State& operator= (const XXZ_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinhlambda();
|
||||
void Compute_coshlambda();
|
||||
void Compute_tanhlambda();
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
DP String_delta ();
|
||||
void Compute_Energy ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXZ specific functions:
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState);
|
||||
XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState);
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXX_Bethe_State carry all extra information pertaining to XXX antiferromagnet
|
||||
|
||||
class XXX_Bethe_State : public Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
XXX_Bethe_State ();
|
||||
XXX_Bethe_State (const XXX_Bethe_State& RefState); // copy constructor
|
||||
XXX_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
|
||||
public:
|
||||
XXX_Bethe_State& operator= (const XXX_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
DP String_delta ();
|
||||
void Compute_Energy ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXX specific functions
|
||||
public:
|
||||
bool Check_Finite_rap ();
|
||||
|
||||
};
|
||||
|
||||
XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState);
|
||||
XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState);
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXZ_gpd_Bethe_State carry all extra information pertaining to XXZ gapped antiferromagnets
|
||||
|
||||
class XXZ_gpd_Bethe_State : public Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
Lambda sinlambda;
|
||||
Lambda coslambda;
|
||||
Lambda tanlambda;
|
||||
|
||||
public:
|
||||
XXZ_gpd_Bethe_State ();
|
||||
XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState); // copy constructor
|
||||
XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
|
||||
public:
|
||||
XXZ_gpd_Bethe_State& operator= (const XXZ_gpd_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinlambda();
|
||||
void Compute_coslambda();
|
||||
void Compute_tanlambda();
|
||||
int Weight(); // weight function for contributions cutoff
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
void Iterate_BAE_Newton();
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
|
||||
DP String_delta ();
|
||||
void Compute_Energy ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXZ_gpd specific functions
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
|
||||
XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
|
||||
|
||||
|
||||
//***********************************************
|
||||
|
||||
// Function declarations
|
||||
|
||||
// in M_vs_H.cc
|
||||
DP Ezero (DP Delta, int N, int M);
|
||||
DP H_vs_M (DP Delta, int N, int M);
|
||||
DP HZmin (DP Delta, int N, int M, Vect_DP& Ezero_ref);
|
||||
int M_vs_H (DP Delta, int N, DP HZ);
|
||||
|
||||
DP X_avg (char xyorz, DP Delta, int N, int M);
|
||||
|
||||
DP Chemical_Potential (const Heis_Bethe_State& RefState);
|
||||
DP Particle_Hole_Excitation_Cost (char whichDSF, Heis_Bethe_State& AveragingState);
|
||||
|
||||
//DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded);
|
||||
DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
|
||||
std::complex<DP> ln_Sz_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
|
||||
std::complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
|
||||
|
||||
std::complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
std::complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
|
||||
// From Antoine Klauser:
|
||||
std::complex<DP> ln_Szz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
std::complex<DP> ln_Szm_p_Smz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
std::complex<DP> ln_Smm_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
|
||||
std::complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
|
||||
std::complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
|
||||
|
||||
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
||||
XXZ_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
||||
XXX_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
||||
XXZ_gpd_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
|
||||
|
||||
// For geometric quench:
|
||||
std::complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
|
||||
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,
|
||||
int N_2, int iKmin, int iKmax, int Max_Secs, bool refine);
|
||||
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -1,31 +1,30 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Integ.h
|
||||
File: ABACUS_Integ.h
|
||||
|
||||
Purpose: Declares combinatorics-related classes and functions.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _INTEG_
|
||||
#define _INTEG_
|
||||
#ifndef ABACUS_INTEG_H
|
||||
#define ABACUS_INTEG_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
|
||||
//********************** Class Domain ************************
|
||||
|
||||
template<class T>
|
||||
class Domain {
|
||||
|
||||
|
||||
private:
|
||||
Vect<T> bdry;
|
||||
|
||||
|
@ -35,41 +34,41 @@ namespace JSC {
|
|||
bdry[0] = T(0);
|
||||
bdry[1] = T(0);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Domain (T xmin_ref, T xmax_ref) : bdry(Vect<T>(2))
|
||||
{
|
||||
if (xmax_ref < xmin_ref) JSCerror("Use xmax > xmin in Domain.");
|
||||
|
||||
if (xmax_ref < xmin_ref) ABACUSerror("Use xmax > xmin in Domain.");
|
||||
|
||||
bdry[0] = xmin_ref;
|
||||
bdry[1] = xmax_ref;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
inline T xmin (int i)
|
||||
{
|
||||
if (i > bdry.size()/2) JSCerror("i index too high in Domain::xmin.");
|
||||
|
||||
return(bdry[2*i]);
|
||||
}
|
||||
|
||||
{
|
||||
if (i > bdry.size()/2) ABACUSerror("i index too high in Domain::xmin.");
|
||||
|
||||
return(bdry[2*i]);
|
||||
}
|
||||
|
||||
public:
|
||||
inline T xmax (int i)
|
||||
{
|
||||
if (i > bdry.size()/2) JSCerror("i index too high in Domain::xmax.");
|
||||
|
||||
return(bdry[2*i + 1]);
|
||||
}
|
||||
|
||||
{
|
||||
if (i > bdry.size()/2) ABACUSerror("i index too high in Domain::xmax.");
|
||||
|
||||
return(bdry[2*i + 1]);
|
||||
}
|
||||
|
||||
public:
|
||||
inline int Ndomains ()
|
||||
{
|
||||
return(bdry.size()/2);
|
||||
}
|
||||
{
|
||||
return(bdry.size()/2);
|
||||
}
|
||||
|
||||
public:
|
||||
void Include (T xmin_ref, T xmax_ref) {
|
||||
|
||||
|
||||
// Determine the indices of xmin_ref & xmax_ref
|
||||
int xmin_reg = -1;
|
||||
int xmax_reg = -1;
|
||||
|
@ -79,15 +78,13 @@ namespace JSC {
|
|||
if ((i+1) % 2 && bdry[i] <= xmax_ref) xmax_reg++;
|
||||
if (i % 2 && bdry[i] < xmax_ref) xmax_reg++;
|
||||
}
|
||||
|
||||
//cout << "Include: xmin_reg = " << xmin_reg << "\txmax_reg = " << xmax_reg << endl;
|
||||
|
||||
|
||||
Vect<T> new_bdry(bdry.size() + 2 * ((xmin_reg % 2 && xmax_reg % 2) - (xmax_reg - xmin_reg)/2));
|
||||
|
||||
|
||||
int ishift = 0;
|
||||
for (int i = 0; i <= xmin_reg; ++i) new_bdry[i] = bdry[i];
|
||||
if (xmin_reg % 2) {
|
||||
new_bdry[xmin_reg + 1] = xmin_ref;
|
||||
new_bdry[xmin_reg + 1] = xmin_ref;
|
||||
ishift++;
|
||||
if (xmax_reg % 2) {
|
||||
new_bdry[xmin_reg + 2] = xmax_ref;
|
||||
|
@ -100,15 +97,15 @@ namespace JSC {
|
|||
}
|
||||
for (int i = xmin_reg + ishift + 1; i < new_bdry.size(); ++i)
|
||||
new_bdry[i] = bdry[xmax_reg - xmin_reg - ishift + i];
|
||||
|
||||
|
||||
bdry = new_bdry;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
void Exclude (T xmin_ref, T xmax_ref) {
|
||||
|
||||
|
||||
// Determine the indices of xmin_ref & xmax_ref
|
||||
int xmin_reg = -1;
|
||||
int xmax_reg = -1;
|
||||
|
@ -118,15 +115,13 @@ namespace JSC {
|
|||
if ((i+1) % 2 && bdry[i] <= xmax_ref) xmax_reg++;
|
||||
if (i % 2 && bdry[i] < xmax_ref) xmax_reg++;
|
||||
}
|
||||
|
||||
//cout << "Exclude: xmin_reg = " << xmin_reg << "\txmax_reg = " << xmax_reg << endl;
|
||||
|
||||
|
||||
Vect<T> new_bdry(bdry.size() + 2 * (((xmin_reg + 1) % 2 && (xmax_reg + 1) % 2) - (xmax_reg - xmin_reg)/2));
|
||||
|
||||
|
||||
int ishift = 0;
|
||||
for (int i = 0; i <= xmin_reg; ++i) new_bdry[i] = bdry[i];
|
||||
if ((xmin_reg + 1) % 2) {
|
||||
new_bdry[xmin_reg + 1] = xmin_ref;
|
||||
new_bdry[xmin_reg + 1] = xmin_ref;
|
||||
ishift++;
|
||||
if ((xmax_reg + 1) % 2) {
|
||||
new_bdry[xmin_reg + 2] = xmax_ref;
|
||||
|
@ -139,24 +134,25 @@ namespace JSC {
|
|||
}
|
||||
for (int i = xmin_reg + ishift + 1; i < new_bdry.size(); ++i)
|
||||
new_bdry[i] = bdry[xmax_reg - xmin_reg - ishift + i];
|
||||
|
||||
|
||||
bdry = new_bdry;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
template<class T>
|
||||
std::ostream& operator<< (std::ostream& s, Domain<T> dom)
|
||||
{
|
||||
for (int i = 0; i < dom.Ndomains(); ++i) {
|
||||
if (i > 0) s << endl;
|
||||
if (i > 0) s << std::endl;
|
||||
s << dom.xmin(i) << "\t" << dom.xmax(i);
|
||||
}
|
||||
return(s);
|
||||
}
|
||||
|
||||
|
||||
// ********************************* struct I_table ************************
|
||||
|
||||
struct I_table {
|
||||
|
@ -168,11 +164,9 @@ namespace JSC {
|
|||
DP alpha;
|
||||
DP logalpha;
|
||||
DP prec;
|
||||
//Vect_DP rho_tbl;
|
||||
//Vect_DP I_tbl;
|
||||
DP* rho_tbl;
|
||||
DP* I_tbl;
|
||||
|
||||
|
||||
I_table (DP (*function) (DP, DP), DP rhomin_ref, DP rhomax_ref, int Nvals_ref, DP req_prec);
|
||||
DP Return_val (DP req_rho);
|
||||
void Save ();
|
||||
|
@ -195,8 +189,9 @@ namespace JSC {
|
|||
int maxnrpts;
|
||||
DP* rho_tbl;
|
||||
DP* I_tbl;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
DP Return_val (DP req_rho);
|
||||
void Save (const char* filenameprefix);
|
||||
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 {
|
|||
// ******************************** Recursive integration functions ******************************
|
||||
|
||||
DP Integrate_Riemann (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, int Npts);
|
||||
DP Integrate_Riemann_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP Integrate_Riemann_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP xmin, DP xmax, int Npts);
|
||||
|
||||
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);
|
||||
DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP xmin, DP xmax, DP req_prec, int max_rec_level);
|
||||
DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP xmin, DP xmax, DP req_prec, int max_rec_level, ofstream& outfile);
|
||||
DP Integrate_rec_using_table_and_file (DP (*function) (Vect_DP, I_table, ofstream&), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP xmin, DP xmax, DP req_prec, int max_rec_level, ofstream& outfile);
|
||||
DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
||||
DP xmin, DP xmax, DP req_prec, int max_rec_level, std::ofstream& outfile);
|
||||
DP Integrate_rec_using_table_and_file (DP (*function) (Vect_DP, I_table, std::ofstream&), Vect_DP& args,
|
||||
int arg_to_integ, I_table Itable,
|
||||
DP xmin, DP xmax, DP req_prec, int max_rec_level, std::ofstream& outfile);
|
||||
|
||||
|
||||
|
||||
|
@ -240,12 +236,11 @@ namespace JSC {
|
|||
class Integral_data {
|
||||
|
||||
private:
|
||||
data_pt* data;
|
||||
data_pt* data;
|
||||
DP* abs_d2f_dx; // second derivative * dx
|
||||
DP max_abs_d2f_dx; //
|
||||
DP max_abs_d2f_dx; //
|
||||
|
||||
public:
|
||||
//int n_vals;
|
||||
Integral_result integ_res;
|
||||
|
||||
public:
|
||||
|
@ -254,37 +249,44 @@ namespace JSC {
|
|||
|
||||
public:
|
||||
Integral_data (DP (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
|
||||
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);
|
||||
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);
|
||||
void Save (ofstream& outfile);
|
||||
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);
|
||||
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);
|
||||
void Save (std::ofstream& outfile);
|
||||
void Improve_estimate (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
|
||||
void Improve_estimate (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, int Npts_max);
|
||||
void Improve_estimate (DP (*function) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ, Integral_table Itable, int Npts_max);
|
||||
void Improve_estimate (DP (*function) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ,
|
||||
Integral_table Itable, int Npts_max);
|
||||
~Integral_data ();
|
||||
|
||||
};
|
||||
|
||||
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);
|
||||
Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
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);
|
||||
Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
||||
Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, Integral_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
Integral_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
||||
Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, Integral_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
Integral_table Itable, DP xmin, DP xmax, DP req_rel_prec,
|
||||
DP req_abs_prec, int max_nr_pts);
|
||||
|
||||
Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
I_table Itable, DP xmin, DP xmax, DP req_rel_prec,
|
||||
DP req_abs_prec, int max_nr_pts, std::ofstream& outfile);
|
||||
|
||||
Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, ofstream& outfile);
|
||||
|
||||
// ******************************** Recursive version: optimal, complex implementation ******************************
|
||||
|
||||
// NB: function returns complex values but takes real arguments
|
||||
// NB: function returns complex values but takes real arguments
|
||||
|
||||
struct data_pt_CX {
|
||||
DP x;
|
||||
complex<DP> f;
|
||||
std::complex<DP> f;
|
||||
DP dx;
|
||||
};
|
||||
|
||||
struct Integral_result_CX {
|
||||
complex<DP> integ_est;
|
||||
std::complex<DP> integ_est;
|
||||
DP abs_prec;
|
||||
DP rel_prec;
|
||||
int n_vals;
|
||||
|
@ -293,12 +295,11 @@ namespace JSC {
|
|||
class Integral_data_CX {
|
||||
|
||||
private:
|
||||
data_pt_CX* data;
|
||||
data_pt_CX* data;
|
||||
DP* abs_d2f_dx; // second derivative * dx
|
||||
DP max_abs_d2f_dx; //
|
||||
DP max_abs_d2f_dx; //
|
||||
|
||||
public:
|
||||
//int n_vals;
|
||||
Integral_result_CX integ_res;
|
||||
|
||||
public:
|
||||
|
@ -306,26 +307,24 @@ namespace JSC {
|
|||
DP xmax;
|
||||
|
||||
public:
|
||||
Integral_data_CX (complex<DP> (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
|
||||
//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);
|
||||
void Save (ofstream& outfile);
|
||||
void Improve_estimate (complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
|
||||
//void Improve_estimate (complex<DP> (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, int Npts_max);
|
||||
Integral_data_CX (std::complex<DP> (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
|
||||
void Save (std::ofstream& outfile);
|
||||
void Improve_estimate (std::complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
|
||||
~Integral_data_CX ();
|
||||
|
||||
};
|
||||
|
||||
Integral_result_CX Integrate_optimal (complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax,
|
||||
Integral_result_CX Integrate_optimal (std::complex<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);
|
||||
//Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
//Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
// I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
||||
//Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
// I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, ofstream& outfile);
|
||||
//Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
||||
// I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, std::ofstream& outfile);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,49 +2,46 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_LiebLin.h
|
||||
File: ABACUS_LiebLin.h
|
||||
|
||||
Purpose: Declares LiebLin gas-related classes and functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _LIEBLIN_
|
||||
#define _LIEBLIN_
|
||||
#ifndef ABACUS_LIEBLIN_H
|
||||
#define ABACUS_LIEBLIN_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// First, some global constants...
|
||||
|
||||
//const DP ITER_REQ_PREC_LIEBLIN = 1.0e+6 * MACHINE_EPS_SQ;
|
||||
const DP ITER_REQ_PREC_LIEBLIN = 1.0e+4 * MACHINE_EPS_SQ;
|
||||
|
||||
const int LIEBLIN_Ix2_MIN = -1000000; // Like a UV cutoff. Assumption: never reached in scanning.
|
||||
const int LIEBLIN_Ix2_MAX = -LIEBLIN_Ix2_MIN;
|
||||
|
||||
|
||||
//***********************************************************************
|
||||
|
||||
//class LiebLin_Bethe_State : public Bethe_State {
|
||||
class LiebLin_Bethe_State {
|
||||
|
||||
public:
|
||||
DP c_int; // interaction parameter
|
||||
DP L;
|
||||
DP L;
|
||||
DP cxL;
|
||||
int N;
|
||||
string label;
|
||||
//Vect<int> OriginStateIx2; // quantum numbers of state on which excitations are built; always ordered
|
||||
std::string label;
|
||||
Vect<int> Ix2_available; // quantum numbers which are allowable but not occupied
|
||||
Vect<int> index_first_hole_to_right;
|
||||
Vect<int> displacement;
|
||||
Vect<int> Ix2;
|
||||
Vect<DP> lambdaoc;
|
||||
//Vect<DP> BE;
|
||||
Vect<DP> S; // scattering sum
|
||||
Vect<DP> dSdlambdaoc; // its derivative
|
||||
DP diffsq;
|
||||
|
@ -62,9 +59,9 @@ namespace JSC {
|
|||
LiebLin_Bethe_State& operator= (const LiebLin_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
int Charge () { return(N); };
|
||||
void Set_to_Label (string label_ref, const Vect<int>& OriginStateIx2);
|
||||
void Set_to_Label (string label_ref); // assumes OriginState == GroundState
|
||||
int Charge () { return(N); };
|
||||
void Set_to_Label (std::string label_ref, const Vect<int>& OriginStateIx2);
|
||||
void Set_to_Label (std::string label_ref); // assumes OriginState == GroundState
|
||||
void Set_Label_from_Ix2 (const Vect<int>& OriginStateIx2);
|
||||
void Set_Label_Internals_from_Ix2 (const Vect<int>& OriginStateIx2);
|
||||
bool Check_Admissibility(char whichDSF); // always returns true
|
||||
|
@ -88,7 +85,7 @@ namespace JSC {
|
|||
void Parity_Flip (); // takes all lambdaoc to -lambdaoc
|
||||
inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<int>& OriginIx2)
|
||||
{
|
||||
if (N < 3) JSCerror("N<3 incompatible with fixed momentum scanning");
|
||||
if (N < 3) ABACUSerror("N<3 incompatible with fixed momentum scanning");
|
||||
Ix2[0] = Ix2[1] - 2;
|
||||
Ix2[N-1] = Ix2[N-2] + 2;
|
||||
(*this).Compute_Momentum();
|
||||
|
@ -98,27 +95,28 @@ namespace JSC {
|
|||
(*this).Set_Label_from_Ix2 (OriginIx2);
|
||||
return(true);
|
||||
}
|
||||
void Set_to_Outer_Skeleton (const Vect<int>& OriginIx2)
|
||||
{
|
||||
Ix2[0] = LIEBLIN_Ix2_MIN + (N % 2) + 1;
|
||||
Ix2[N-1] = LIEBLIN_Ix2_MAX - (N % 2) - 1;
|
||||
void Set_to_Outer_Skeleton (const Vect<int>& OriginIx2)
|
||||
{
|
||||
Ix2[0] = LIEBLIN_Ix2_MIN + (N % 2) + 1;
|
||||
Ix2[N-1] = LIEBLIN_Ix2_MAX - (N % 2) - 1;
|
||||
(*this).Set_Label_from_Ix2 (OriginIx2);
|
||||
//cout << "Set state to outer skeleton: Ix2 " << (*this).Ix2 << endl;
|
||||
//cout << "label " << (*this).label << endl;
|
||||
};
|
||||
};
|
||||
|
||||
inline bool Is_Inner_Skeleton (LiebLin_Bethe_State& State) {
|
||||
return (State.N >= 2 && (State.Ix2[0] == State.Ix2[1] - 2 || State.Ix2[State.N-1] == State.Ix2[State.N-2] + 2));
|
||||
};
|
||||
inline bool Is_Outer_Skeleton (LiebLin_Bethe_State& State) {
|
||||
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);
|
||||
};
|
||||
inline bool Is_Outer_Skeleton (const LiebLin_Bethe_State& State) {
|
||||
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);
|
||||
};
|
||||
inline bool Is_Inner_Skeleton (LiebLin_Bethe_State& State) {
|
||||
return (State.N >= 2 && (State.Ix2[0] == State.Ix2[1] - 2 || State.Ix2[State.N-1] == State.Ix2[State.N-2] + 2));
|
||||
};
|
||||
inline bool Is_Outer_Skeleton (LiebLin_Bethe_State& State) {
|
||||
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);
|
||||
};
|
||||
inline bool Is_Outer_Skeleton (const LiebLin_Bethe_State& State) {
|
||||
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);
|
||||
};
|
||||
|
||||
inline bool Force_Descent (char whichDSF, LiebLin_Bethe_State& ScanState, LiebLin_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
|
||||
inline bool Force_Descent (char whichDSF, LiebLin_Bethe_State& ScanState, LiebLin_Bethe_State& RefState,
|
||||
int desc_type_required, int iKmod, DP Chem_Pot)
|
||||
{
|
||||
bool forcedesc = false;
|
||||
|
||||
|
@ -138,9 +136,12 @@ namespace JSC {
|
|||
|
||||
DP Chemical_Potential (LiebLin_Bethe_State& RefState);
|
||||
DP Sumrule_Factor (char whichDSF, LiebLin_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
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);
|
||||
void Evaluate_F_Sumrule (string prefix, char whichDSF, const LiebLin_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
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);
|
||||
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);
|
||||
void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const LiebLin_Bethe_State& RefState,
|
||||
DP Chem_Pot, int iKmin, int iKmax);
|
||||
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);
|
||||
|
||||
// in LiebLin_Utils.cc
|
||||
DP LiebLin_dE0_dc (DP c_int, DP L, int N);
|
||||
|
@ -152,32 +153,22 @@ namespace JSC {
|
|||
|
||||
DP Particle_Hole_Excitation_Cost (char whichDSF, LiebLin_Bethe_State& AveragingState);
|
||||
|
||||
complex<DP> ln_Density_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
|
||||
complex<DP> ln_Psi_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
|
||||
complex<DP> ln_g2_ME (LiebLin_Bethe_State& mu, LiebLin_Bethe_State& lambda);
|
||||
std::complex<DP> ln_Density_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
|
||||
std::complex<DP> ln_Psi_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
|
||||
std::complex<DP> ln_g2_ME (LiebLin_Bethe_State& mu, LiebLin_Bethe_State& lambda);
|
||||
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, LiebLin_Bethe_State& LeftState,
|
||||
// LiebLin_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, LiebLin_Bethe_State& LeftState,
|
||||
LiebLin_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, LiebLin_Bethe_State& LeftState,
|
||||
LiebLin_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
|
||||
|
||||
DP LiebLin_Twisted_lnnorm (Vect<complex<DP> >& lambdaoc, double cxL);
|
||||
complex<DP> LiebLin_Twisted_ln_Overlap (DP expbeta, Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
complex<DP> LiebLin_Twisted_ln_Overlap (complex<DP> expbeta, Vect<complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
complex<DP> LiebLin_ln_Overlap (Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
complex<DP> LiebLin_ln_Overlap (Vect<complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
DP LiebLin_Twisted_lnnorm (Vect<std::complex<DP> >& lambdaoc, double cxL);
|
||||
std::complex<DP> LiebLin_Twisted_ln_Overlap (DP expbeta, Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
std::complex<DP> LiebLin_Twisted_ln_Overlap (std::complex<DP> expbeta, Vect<std::complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
std::complex<DP> LiebLin_ln_Overlap (Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
std::complex<DP> LiebLin_ln_Overlap (Vect<std::complex<DP> > lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate);
|
||||
|
||||
// In src/LiebLin_Tgt0.cc:
|
||||
//DP Entropy_rho (LiebLin_Bethe_State& RefState, int Delta);
|
||||
//DP Entropy_Fixed_Delta (LiebLin_Bethe_State& RefState, int Delta);
|
||||
//DP Entropy (LiebLin_Bethe_State& RefState, int Delta);
|
||||
DP Entropy (LiebLin_Bethe_State& RefState);
|
||||
//DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT, int Delta);
|
||||
DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT);
|
||||
//DP Entropy (LiebLin_Bethe_State& RefState, DP epsilon);
|
||||
//DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT, DP epsilon);
|
||||
//LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT, int Delta);
|
||||
//LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT, DP epsilon);
|
||||
LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT);
|
||||
LiebLin_Bethe_State Add_Particle_at_Center (const LiebLin_Bethe_State& RefState);
|
||||
LiebLin_Bethe_State Remove_Particle_at_Center (const LiebLin_Bethe_State& RefState);
|
||||
|
@ -185,6 +176,6 @@ namespace JSC {
|
|||
DP rho_of_lambdaoc_2 (LiebLin_Bethe_State& RefState, DP lambdaoc, DP delta);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,440 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS_Matrix.h
|
||||
|
||||
Purpose: Declares square matrix class.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef ABACUS_MATRIX_H
|
||||
#define ABACUS_MATRIX_H
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
|
||||
// CLASS DEFINITIONS
|
||||
|
||||
template <class T>
|
||||
class SQMat {
|
||||
|
||||
private:
|
||||
int dim;
|
||||
T** M;
|
||||
|
||||
public:
|
||||
SQMat (int N); // initializes all elements of this n by n matrix to zero
|
||||
SQMat (const SQMat& rhs); // copy constructor
|
||||
SQMat (const T& a, int N); // initialize to diagonal matrix with value a (NOT like in NR !!!)
|
||||
SQMat (const SQMat& a, const SQMat& b); // initialize to tensor product of a and b
|
||||
SQMat (const SQMat& a, int row_id, int col_id); // init by cutting row row_id and col col_id
|
||||
void Print ();
|
||||
SQMat& operator= (const SQMat& rhs); // assignment
|
||||
SQMat& operator= (const T& a); // assign 1 to diagonal elements (NOT like in NR !!!)
|
||||
inline T* operator[] (const int i); // subscripting: pointer to row i
|
||||
inline const T* operator[] (const int i) const;
|
||||
SQMat& operator+= (const T& a);
|
||||
SQMat& operator+= (const SQMat& a);
|
||||
SQMat& operator-= (const T& a);
|
||||
SQMat& operator-= (const SQMat& a);
|
||||
SQMat& operator*= (const T& a);
|
||||
SQMat& operator*= (const SQMat& a);
|
||||
inline int size() const;
|
||||
~SQMat();
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (int N) : dim(N) , M(new T*[N])
|
||||
{
|
||||
M[0] = new T[N*N];
|
||||
for (int i = 1; i < N; i++) M[i] = M[i-1] + N;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const SQMat& rhs) : dim(rhs.dim) , M(new T*[dim])
|
||||
{
|
||||
int i,j;
|
||||
M[0] = new T[dim*dim];
|
||||
for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
|
||||
for (i = 0; i < dim; i++)
|
||||
for (j = 0; j < dim; j++) M[i][j] = rhs[i][j];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const T& a, int N) : dim(N) , M(new T*[dim])
|
||||
{
|
||||
int i, j;
|
||||
M[0] = new T[dim*dim];
|
||||
for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
|
||||
for (i = 0; i < dim; i++) {
|
||||
for (j = 0; j < dim; j++) M[i][j] = T(0);
|
||||
M[i][i] = a;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const SQMat& a, const SQMat& b) : dim (a.dim * b.dim) , M(new T*[a.dim * b.dim])
|
||||
{
|
||||
M[0] = new T[a.dim * b.dim * a.dim * b.dim];
|
||||
|
||||
for (int i = 1; i < a.dim * b.dim; ++i) M[i] = M[i-1] + a.dim * b.dim;
|
||||
|
||||
for (int i1 = 0; i1 < a.dim; ++i1) {
|
||||
|
||||
for (int i2 = 0; i2 < a.dim; ++i2) {
|
||||
|
||||
for (int j1 = 0; j1 < b.dim; ++j1) {
|
||||
|
||||
for (int j2 = 0; j2 < b.dim; ++j2) {
|
||||
|
||||
M[i1 * (b.dim) + j1][i2 * (b.dim) + j2] = a[i1][i2] * b[j1][j2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const SQMat&a, int row_id, int col_id) : dim (a.dim - 1) , M(new T*[dim])
|
||||
{
|
||||
if (dim == 0) {
|
||||
ABACUSerror("Error: chopping a row and col from size one matrix.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
M[0] = new T[dim * dim];
|
||||
|
||||
for (int i = 1; i < dim; ++i) M[i] = M[i-1] + dim;
|
||||
|
||||
for (int i = 0; i < row_id; ++i)
|
||||
for (int j = 0; j < col_id; ++j) M[i][j] = a[i][j];
|
||||
for (int i = row_id; i < dim; ++i)
|
||||
for (int j = 0; j < col_id; ++j) M[i][j] = a[i+1][j];
|
||||
for (int i = 0; i < row_id; ++i)
|
||||
for (int j = col_id; j < dim; ++j) M[i][j] = a[i][j+1];
|
||||
for (int i = row_id; i < dim; ++i)
|
||||
for (int j = col_id; j < dim; ++j) M[i][j] = a[i+1][j+1];
|
||||
|
||||
}
|
||||
|
||||
// operators
|
||||
template <class T>
|
||||
void SQMat<T>::Print ()
|
||||
{
|
||||
std::cout << std::endl;
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) std::cout << M[i][j] << " ";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator= (const SQMat<T>& rhs)
|
||||
{
|
||||
if (this != &rhs) {
|
||||
if (dim != rhs.dim) {
|
||||
ABACUSerror("Assignment between matrices of different dimensions. Bailing out.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dim; ++i)
|
||||
for (int j = 0; j < dim; ++j) M[i][j] = rhs[i][j];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator= (const T& a)
|
||||
{
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j)
|
||||
M[i][j] = T(0);
|
||||
M[i][i] = a;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T* SQMat<T>::operator[] (const int i)
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T* SQMat<T>::operator[] (const int i) const
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator+= (const T& a)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dim; ++i) M[i][i] += a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator+= (const SQMat<T>& a)
|
||||
{
|
||||
if (dim != a.dim) {
|
||||
ABACUSerror("Incompatible matrix sizes in matrix operator +.");
|
||||
exit(1);
|
||||
}
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
M[i][j] += a[i][j];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator-= (const T& a)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dim; ++i) M[i][i] -= a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator-= (const SQMat<T>& a)
|
||||
{
|
||||
if (dim != a.dim) {
|
||||
ABACUSerror("Incompatible matrix sizes in matrix operator +.");
|
||||
exit(1);
|
||||
}
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
M[i][j] -= a[i][j];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator*= (const T& a)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dim; ++i) for (int j = 0; j < dim; ++j) M[i][j] *= a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator*= (const SQMat<T>& a)
|
||||
{
|
||||
|
||||
if (dim != a.dim) {
|
||||
ABACUSerror("Incompatible matrix sizes in matrix operator *.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SQMat<T> leftarg(*this); // use copy constructor.
|
||||
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
|
||||
M[i][j] = 0.0;
|
||||
|
||||
for (int k = 0; k < dim; ++k) {
|
||||
|
||||
M[i][j] += leftarg[i][k] * a[k][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int SQMat<T>::size() const
|
||||
{
|
||||
return dim;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::~SQMat()
|
||||
{
|
||||
if (M != 0) {
|
||||
delete[] (M[0]);
|
||||
delete[] (M);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*****************************
|
||||
|
||||
template <class T>
|
||||
class RecMat {
|
||||
|
||||
private:
|
||||
int nrows;
|
||||
int ncols;
|
||||
T** M;
|
||||
|
||||
public:
|
||||
RecMat (int Nrows, int Ncols); // initializes all elements of this n by n matrix to zero
|
||||
RecMat (const T& a, int Nrows, int Ncols);
|
||||
RecMat (const RecMat& rhs); // copy constructor
|
||||
void Print ();
|
||||
RecMat& operator= (const RecMat& rhs); // assignment
|
||||
inline T* operator[] (const int i); // subscripting: pointer to row i
|
||||
inline const T* operator[] (const int i) const;
|
||||
inline int nr_rows() const;
|
||||
inline int nr_cols() const;
|
||||
~RecMat();
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::RecMat (int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
|
||||
{
|
||||
M[0] = new T[Nrows*Ncols];
|
||||
for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
|
||||
|
||||
for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) M[i][j] = T(0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::RecMat (const T& a, int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
|
||||
{
|
||||
M[0] = new T[Nrows*Ncols];
|
||||
for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
|
||||
|
||||
for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) {
|
||||
if (i == j) M[i][i] = a;
|
||||
else M[i][j] = T(0);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::RecMat (const RecMat& rhs) : nrows(rhs.nrows), ncols(rhs.ncols), M(new T*[nrows])
|
||||
{
|
||||
int i,j;
|
||||
M[0] = new T[nrows*ncols];
|
||||
for (i = 1; i < nrows; i++) M[i] = M[i-1] + ncols;
|
||||
for (i = 0; i < nrows; i++)
|
||||
for (j = 0; j < ncols; j++) M[i][j] = rhs[i][j];
|
||||
}
|
||||
|
||||
// operators
|
||||
template <class T>
|
||||
void RecMat<T>::Print ()
|
||||
{
|
||||
std::cout << std::endl;
|
||||
for (int i = 0; i < nrows; ++i) {
|
||||
for (int j = 0; j < ncols; ++j) std::cout << M[i][j] << " ";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>& RecMat<T>::operator= (const RecMat<T>& rhs)
|
||||
{
|
||||
if (this != &rhs) {
|
||||
if (nrows != rhs.nrows || ncols != rhs.ncols) {
|
||||
if (M != 0) {
|
||||
delete[] (M[0]);
|
||||
delete[] (M);
|
||||
}
|
||||
nrows = rhs.nrows;
|
||||
ncols = rhs.ncols;
|
||||
M = new T*[nrows];
|
||||
M[0] = new T[nrows * ncols];
|
||||
}
|
||||
|
||||
for (int i = 0; i < nrows; ++i)
|
||||
for (int j = 0; j < ncols; ++j) M[i][j] = rhs[i][j];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T* RecMat<T>::operator[] (const int i)
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T* RecMat<T>::operator[] (const int i) const
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int RecMat<T>::nr_rows() const
|
||||
{
|
||||
return nrows;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int RecMat<T>::nr_cols() const
|
||||
{
|
||||
return ncols;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::ostream& operator<< (std::ostream& s, const RecMat<T>& matrix)
|
||||
{
|
||||
for (int i = 0; i < matrix.nr_rows(); ++i) {
|
||||
for (int j = 0; j < matrix.nr_cols(); ++j) s << matrix[i][j] << " ";
|
||||
s << std::endl;
|
||||
}
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::~RecMat()
|
||||
{
|
||||
if (M != 0) {
|
||||
delete[] (M[0]);
|
||||
delete[] (M);
|
||||
}
|
||||
}
|
||||
|
||||
// TYPEDEFS:
|
||||
|
||||
typedef ABACUS::SQMat<DP> SQMat_DP;
|
||||
typedef ABACUS::SQMat<std::complex<double> > SQMat_CX;
|
||||
|
||||
|
||||
// FUNCTION DEFINITIONS
|
||||
|
||||
// Functions in src/MATRIX directory
|
||||
|
||||
DP det_LU (SQMat_DP a);
|
||||
DP lndet_LU (SQMat_DP a);
|
||||
std::complex<DP> lndet_LU_dstry (SQMat_DP& a);
|
||||
std::complex<DP> det_LU_CX (SQMat_CX a);
|
||||
std::complex<DP> lndet_LU_CX (SQMat_CX a);
|
||||
std::complex<DP> lndet_LU_CX_dstry (SQMat_CX& a);
|
||||
void eigsrt (Vect_DP& d, SQMat_DP& v);
|
||||
void balanc (SQMat_DP& a);
|
||||
void elmhes (SQMat_DP& a);
|
||||
void gaussj (SQMat_DP& a, SQMat_DP& b);
|
||||
void hqr (SQMat_DP& a, Vect_CX& wri);
|
||||
void jacobi (SQMat_DP& a, Vect_DP& d, SQMat_DP& v, int& nrot);
|
||||
void lubksb (SQMat_DP& a, Vect_INT& indx, Vect_DP& b);
|
||||
void lubksb_CX (SQMat_CX& a, Vect_INT& indx, Vect_CX& b);
|
||||
void ludcmp (SQMat_DP& a, Vect_INT& indx, DP& d);
|
||||
void ludcmp_CX (SQMat_CX& a, Vect_INT& indx, DP& d);
|
||||
DP pythag(DP a, DP b);
|
||||
void tqli(Vect_DP& d, Vect_DP& e, SQMat_DP& z);
|
||||
void tred2 (SQMat_DP& a, Vect_DP& d, Vect_DP& e);
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,35 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS_NRG.h
|
||||
|
||||
Purpose: Declares NRG-related classes and functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef ABACUS_NRG_H
|
||||
#define ABACUS_NRG_H
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP K_Weight_integrand (Vect_DP args); // weighing function for state selection
|
||||
|
||||
void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required,
|
||||
bool symmetric_states, int iKmod,
|
||||
int weighing_option, Vect<std::complex <DP> >& FT_of_potential);
|
||||
|
||||
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, int weighing_option,
|
||||
int label_left_begin, int label_left_end, int label_right_begin, int label_right_end,
|
||||
int block_option, DP* DFF_block_1, DP* DFF_block_2, Vect_DP Kweight);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis.h
|
||||
File: ABACUS_ODSLF.h
|
||||
|
||||
Purpose: Declares lattice spinless fermion classes and functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _ODSLF_
|
||||
#define _ODSLF_
|
||||
#ifndef ABACUS_ODSLF_H
|
||||
#define ABACUS_ODSLF_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
|
@ -40,12 +40,12 @@ namespace JSC {
|
|||
ODSLF_Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities); // sets to Nrapidities vector, and checks consistency
|
||||
ODSLF_Base (const Heis_Chain& RefChain, long long int id_ref);
|
||||
inline int& operator[] (const int i);
|
||||
inline const int& operator[] (const int i) const;
|
||||
inline const int& operator[] (const int i) const;
|
||||
ODSLF_Base& operator= (const ODSLF_Base& RefBase);
|
||||
bool operator== (const ODSLF_Base& RefBase);
|
||||
bool operator!= (const ODSLF_Base& RefBase);
|
||||
|
||||
void Compute_Ix2_limits(const Heis_Chain& RefChain); // computes the Ix2_infty and Ix2_max
|
||||
void Compute_Ix2_limits(const Heis_Chain& RefChain); // computes the Ix2_infty and Ix2_max
|
||||
|
||||
void Scan_for_Possible_Types (Vect<long long int>& possible_type_id, int& nfound, int base_level, Vect<int>& Nexcitations);
|
||||
Vect<long long int> Possible_Types (); // returns a vector of possible types
|
||||
|
@ -56,19 +56,19 @@ namespace JSC {
|
|||
{
|
||||
return Nrap[i];
|
||||
}
|
||||
|
||||
|
||||
inline const int& ODSLF_Base::operator[] (const int i) const
|
||||
{
|
||||
return Nrap[i];
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class ODSLF_Ix2_Config carry all the I's of a given state
|
||||
|
||||
class ODSLF_Ix2_Config {
|
||||
|
||||
//private:
|
||||
public:
|
||||
int Nstrings;
|
||||
Vect<int> Nrap;
|
||||
|
@ -76,73 +76,63 @@ namespace JSC {
|
|||
|
||||
int** Ix2;
|
||||
|
||||
//Vect<Vect<int> > Ix2;
|
||||
|
||||
public:
|
||||
ODSLF_Ix2_Config ();
|
||||
ODSLF_Ix2_Config (const Heis_Chain& RefChain, int M); // constructor, puts I's to ground state
|
||||
ODSLF_Ix2_Config (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor, putting I's to lowest-energy config
|
||||
// consistent with Heis_Base configuration for chain RefChain
|
||||
ODSLF_Ix2_Config (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor, putting I's to lowest-energy config
|
||||
// consistent with Heis_Base configuration for chain RefChain
|
||||
ODSLF_Ix2_Config& operator= (const ODSLF_Ix2_Config& RefConfig);
|
||||
inline int* operator[] (const int i);
|
||||
//inline Vect<int> operator[] (const int i);
|
||||
inline const int* operator[] (const int i) const;
|
||||
//inline const Vect<int> operator[] (const int i) const;
|
||||
~ODSLF_Ix2_Config();
|
||||
};
|
||||
|
||||
inline int* ODSLF_Ix2_Config::operator[] (const int i)
|
||||
//inline Vect<int> Ix2_Config::operator[] (const int i)
|
||||
{
|
||||
return Ix2[i];
|
||||
}
|
||||
|
||||
{
|
||||
return Ix2[i];
|
||||
}
|
||||
|
||||
inline const int* ODSLF_Ix2_Config::operator[] (const int i) const
|
||||
//inline const Vect<int> Ix2_Config::operator[] (const int i) const
|
||||
{
|
||||
return Ix2[i];
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const ODSLF_Ix2_Config& RefConfig);
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class ODSLF_Lambda carry all rapidities of a state
|
||||
|
||||
class ODSLF_Lambda {
|
||||
|
||||
|
||||
private:
|
||||
int Nstrings;
|
||||
Vect<int> Nrap;
|
||||
int Nraptot;
|
||||
DP** lambda;
|
||||
//Vect<Vect<DP> > lambda;
|
||||
|
||||
|
||||
public:
|
||||
ODSLF_Lambda ();
|
||||
ODSLF_Lambda (const Heis_Chain& RefChain, int M); // constructor, puts all lambda's to zero
|
||||
ODSLF_Lambda (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor, putting I's to lowest-energy config
|
||||
ODSLF_Lambda (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor, putting I's to lowest-energy config
|
||||
// consistent with Heis_Base configuration for chain RefChain
|
||||
ODSLF_Lambda& operator= (const ODSLF_Lambda& RefConfig);
|
||||
inline DP* operator[] (const int i);
|
||||
//inline Vect<DP> operator[] (const int i);
|
||||
inline const DP* operator[] (const int i) const;
|
||||
//inline const Vect<DP> operator[] (const int i) const;
|
||||
~ODSLF_Lambda();
|
||||
|
||||
};
|
||||
|
||||
inline DP* ODSLF_Lambda::operator[] (const int i)
|
||||
//inline Vect<DP> Lambda::operator[] (const int i)
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
inline const DP* ODSLF_Lambda::operator[] (const int i) const
|
||||
//inline const Vect<DP> Lambda::operator[] (const int i) const
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
@ -168,7 +158,7 @@ namespace JSC {
|
|||
bool operator>= (const ODSLF_Ix2_Offsets& RefOffsets);
|
||||
|
||||
public:
|
||||
void Set_to_id (long long int idnr);
|
||||
void Set_to_id (long long int idnr);
|
||||
void Compute_id ();
|
||||
void Compute_type_id ();
|
||||
|
||||
|
@ -178,14 +168,15 @@ namespace JSC {
|
|||
};
|
||||
|
||||
inline long long int ODSLF_Ix2_Offsets_type_id (Vect<int>& nparticles)
|
||||
{
|
||||
long long int type_id_here = 0ULL;
|
||||
{
|
||||
long long int type_id_here = 0ULL;
|
||||
|
||||
for (int i = 0; i < nparticles.size(); ++i)
|
||||
type_id_here += nparticles[i] * pow_ulli(10ULL, i);
|
||||
for (int i = 0; i < nparticles.size(); ++i)
|
||||
type_id_here += nparticles[i] * pow_ulli(10ULL, i);
|
||||
|
||||
return(type_id_here);
|
||||
}
|
||||
|
||||
return(type_id_here);
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
// Objects in class ODSLF_Ix2_Offsets_List carry a vector of used Ix2_Offsets
|
||||
|
@ -211,7 +202,7 @@ namespace JSC {
|
|||
// These contain subclass-specific functions and data.
|
||||
|
||||
class ODSLF_Bethe_State {
|
||||
|
||||
|
||||
public:
|
||||
Heis_Chain chain;
|
||||
ODSLF_Base base;
|
||||
|
@ -219,7 +210,7 @@ namespace JSC {
|
|||
ODSLF_Ix2_Config Ix2;
|
||||
ODSLF_Lambda lambda;
|
||||
ODSLF_Lambda BE; // Bethe equation for relevant rapidity, in the form BE = theta - (1/N)\sum ... - \pi I/N = 0
|
||||
DP diffsq; // sum of squares of rapidity differences in last iteration
|
||||
DP diffsq; // sum of squares of rapidity differences in last iteration
|
||||
int conv; // convergence status
|
||||
int iter; // number of iterations necessary for convergence
|
||||
int iter_Newton; // number of iterations necessary for convergence (Newton method)
|
||||
|
@ -227,8 +218,6 @@ namespace JSC {
|
|||
int iK; // K = 2.0*PI * iK/Nsites
|
||||
DP K; // total momentum
|
||||
DP lnnorm; // ln of norm of reduced Gaudin matrix
|
||||
//long long int id;
|
||||
//long long int maxid;
|
||||
long long int base_id;
|
||||
long long int type_id;
|
||||
long long int id;
|
||||
|
@ -236,17 +225,16 @@ namespace JSC {
|
|||
int nparticles;
|
||||
|
||||
public:
|
||||
ODSLF_Bethe_State ();
|
||||
ODSLF_Bethe_State ();
|
||||
ODSLF_Bethe_State (const ODSLF_Bethe_State& RefState); // copy constructor
|
||||
ODSLF_Bethe_State (const ODSLF_Bethe_State& RefState, long long int type_id_ref); // new state with requested type_id
|
||||
ODSLF_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
ODSLF_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor to lowest-energy config with base
|
||||
ODSLF_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);
|
||||
ODSLF_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);
|
||||
virtual ~ODSLF_Bethe_State () {};
|
||||
|
||||
public:
|
||||
int Charge () { return(base.Mdown); };
|
||||
//void Set_I_Offset (const I_Offset& RefOffset); // sets the Ix2 to given offsets
|
||||
int Charge () { return(base.Mdown); };
|
||||
void Set_Ix2_Offsets (const ODSLF_Ix2_Offsets& RefOffset); // sets the Ix2 to given offsets
|
||||
void Set_to_id (long long int id_ref);
|
||||
void Set_to_id (long long int id_ref, ODSLF_Bethe_State& RefState);
|
||||
|
@ -271,65 +259,45 @@ namespace JSC {
|
|||
// Virtual functions, all defined in the derived classes
|
||||
|
||||
public:
|
||||
virtual void Set_Free_lambdas() { JSCerror("ODSLF_Bethe_State::..."); } // sets the rapidities to solutions of BAEs without scattering terms
|
||||
virtual bool Check_Admissibility(char option) { JSCerror("ODSLF_Bethe_State::..."); return(false); }
|
||||
virtual void Set_Free_lambdas() { ABACUSerror("ODSLF_Bethe_State::..."); } // sets the rapidities to solutions of BAEs without scattering terms
|
||||
virtual bool Check_Admissibility(char option) { ABACUSerror("ODSLF_Bethe_State::..."); return(false); }
|
||||
// verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
|
||||
virtual void Compute_BE (int j, int alpha) { JSCerror("ODSLF_Bethe_State::..."); }
|
||||
virtual void Compute_BE () { JSCerror("ODSLF_Bethe_State::..."); }
|
||||
virtual DP Iterate_BAE(int i, int alpha) { JSCerror("ODSLF_Bethe_State::..."); return(0.0);}
|
||||
virtual bool Check_Rapidities() { JSCerror("ODSLF_Bethe_State::..."); return(false); }
|
||||
virtual void Compute_Energy () { JSCerror("ODSLF_Bethe_State::..."); }
|
||||
virtual void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red) { JSCerror("ODSLF_Bethe_State::..."); }
|
||||
virtual void Compute_BE (int j, int alpha) { ABACUSerror("ODSLF_Bethe_State::..."); }
|
||||
virtual void Compute_BE () { ABACUSerror("ODSLF_Bethe_State::..."); }
|
||||
virtual DP Iterate_BAE(int i, int alpha) { ABACUSerror("ODSLF_Bethe_State::..."); return(0.0);}
|
||||
virtual bool Check_Rapidities() { ABACUSerror("ODSLF_Bethe_State::..."); return(false); }
|
||||
virtual void Compute_Energy () { ABACUSerror("ODSLF_Bethe_State::..."); }
|
||||
virtual void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red) { ABACUSerror("ODSLF_Bethe_State::..."); }
|
||||
};
|
||||
|
||||
inline bool Force_Descent (char whichDSF, ODSLF_Bethe_State& ScanState, ODSLF_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
|
||||
{
|
||||
JSCerror("Need to implement Force_Descent properly for ODSLF.");
|
||||
ABACUSerror("Need to implement Force_Descent properly for ODSLF.");
|
||||
|
||||
bool force_descent = false;
|
||||
|
||||
// Force descent if energy of ScanState is lower than that of RefState
|
||||
if (ScanState.E - RefState.E - (ScanState.base.Mdown - RefState.base.Mdown) < 0.0) return(true);
|
||||
/*
|
||||
// We force descent if
|
||||
// 1) - there exists a higher string whose quantum number is still on 0
|
||||
// AND - there is at most a single particle-hole in the 0 base level
|
||||
// AND - either the particle or the hole hasn't yet moved.
|
||||
if (RefState.base_id/100000LL > 0) { // there is a higher string
|
||||
int type0 = RefState.type_id % 10000;
|
||||
if (type0 == 0
|
||||
|| type0 == 101 && RefState.offsets.Tableau[0].id * RefState.offsets.Tableau[2].id == 0LL
|
||||
|| type0 == 110 && RefState.offsets.Tableau[1].id * RefState.offsets.Tableau[2].id == 0LL
|
||||
|| type0 == 1001 && RefState.offsets.Tableau[0].id * RefState.offsets.Tableau[3].id == 0LL
|
||||
|| type0 == 1010 && RefState.offsets.Tableau[1].id * RefState.offsets.Tableau[3].id == 0LL) // single p-h pair in base level 0
|
||||
for (int j = 1; j < RefState.chain.Nstrings; ++j) {
|
||||
if (RefState.base[j] == 1 && RefState.Ix2[j][0] == 0) {
|
||||
force_descent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Force descent if quantum nr distribution is symmetric:
|
||||
if (RefState.Check_Symmetry()) force_descent = true;
|
||||
|
||||
|
||||
return(force_descent);
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const ODSLF_Bethe_State& state);
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXZ_Bethe_State carry all extra information pertaining to XXZ gapless
|
||||
|
||||
class ODSLF_XXZ_Bethe_State : public ODSLF_Bethe_State {
|
||||
|
||||
public:
|
||||
ODSLF_Lambda sinhlambda;
|
||||
ODSLF_Lambda coshlambda;
|
||||
ODSLF_Lambda tanhlambda;
|
||||
|
||||
public:
|
||||
ODSLF_XXZ_Bethe_State ();
|
||||
ODSLF_Lambda sinhlambda;
|
||||
ODSLF_Lambda coshlambda;
|
||||
ODSLF_Lambda tanhlambda;
|
||||
|
||||
public:
|
||||
ODSLF_XXZ_Bethe_State ();
|
||||
ODSLF_XXZ_Bethe_State (const ODSLF_XXZ_Bethe_State& RefState); // copy constructor
|
||||
ODSLF_XXZ_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
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 {
|
|||
|
||||
public:
|
||||
ODSLF_XXZ_Bethe_State& operator= (const ODSLF_XXZ_Bethe_State& RefState);
|
||||
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinhlambda();
|
||||
|
@ -349,14 +317,14 @@ namespace JSC {
|
|||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXZ specific functions:
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
/*
|
||||
// Objects in class ODSLF_XXX_Bethe_State carry all extra information pertaining to XXX antiferromagnet
|
||||
|
@ -364,29 +332,29 @@ namespace JSC {
|
|||
class ODSLF_XXX_Bethe_State : public ODSLF_Bethe_State {
|
||||
|
||||
public:
|
||||
ODSLF_XXX_Bethe_State ();
|
||||
ODSLF_XXX_Bethe_State (const ODSLF_XXX_Bethe_State& RefState); // copy constructor
|
||||
ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, const ODSLF__Base& base); // constructor to lowest-energy config with base
|
||||
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
|
||||
ODSLF_XXX_Bethe_State ();
|
||||
ODSLF_XXX_Bethe_State (const ODSLF_XXX_Bethe_State& RefState); // copy constructor
|
||||
ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
ODSLF_XXX_Bethe_State (const Heis_Chain& RefChain, const ODSLF__Base& base); // constructor to lowest-energy config with base
|
||||
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
|
||||
|
||||
public:
|
||||
ODSLF_XXX_Bethe_State& operator= (const ODSLF_XXX_Bethe_State& RefState);
|
||||
ODSLF_XXX_Bethe_State& operator= (const ODSLF_XXX_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXX specific functions
|
||||
// XXX specific functions
|
||||
public:
|
||||
bool Check_Finite_rap ();
|
||||
bool Check_Finite_rap ();
|
||||
|
||||
};
|
||||
*/
|
||||
|
@ -395,45 +363,45 @@ namespace JSC {
|
|||
// Objects in class ODSLF_XXZ_gpd_Bethe_State carry all extra information pertaining to XXZ gapped antiferromagnets
|
||||
|
||||
class ODSLF_XXZ_gpd_Bethe_State : public ODSLF__Bethe_State {
|
||||
|
||||
public:
|
||||
Lambda sinlambda;
|
||||
Lambda coslambda;
|
||||
Lambda tanlambda;
|
||||
|
||||
public:
|
||||
ODSLF_XXZ_gpd_Bethe_State ();
|
||||
ODSLF_XXZ_gpd_Bethe_State (const ODSLF_XXZ_gpd_Bethe_State& RefState); // copy constructor
|
||||
ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor to lowest-energy config with base
|
||||
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
|
||||
Lambda sinlambda;
|
||||
Lambda coslambda;
|
||||
Lambda tanlambda;
|
||||
|
||||
public:
|
||||
ODSLF_XXZ_gpd_Bethe_State& operator= (const ODSLF_XXZ_gpd_Bethe_State& RefState);
|
||||
ODSLF_XXZ_gpd_Bethe_State ();
|
||||
ODSLF_XXZ_gpd_Bethe_State (const ODSLF_XXZ_gpd_Bethe_State& RefState); // copy constructor
|
||||
ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
ODSLF_XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const ODSLF_Base& base); // constructor to lowest-energy config with base
|
||||
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
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinlambda();
|
||||
void Compute_coslambda();
|
||||
void Compute_tanlambda();
|
||||
int Weight(); // weight function for contributions cutoff
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
void Iterate_BAE_Newton();
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
|
||||
ODSLF_XXZ_gpd_Bethe_State& operator= (const ODSLF_XXZ_gpd_Bethe_State& RefState);
|
||||
|
||||
// XXZ_gpd specific functions
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinlambda();
|
||||
void Compute_coslambda();
|
||||
void Compute_tanlambda();
|
||||
int Weight(); // weight function for contributions cutoff
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
void Iterate_BAE_Newton();
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<std::complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXZ_gpd specific functions
|
||||
public:
|
||||
|
||||
};
|
||||
*/
|
||||
//***********************************************
|
||||
|
||||
|
||||
// Function declarations
|
||||
/*
|
||||
// in M_vs_H.cc
|
||||
|
@ -445,19 +413,16 @@ namespace JSC {
|
|||
DP X_avg (char xyorz, DP Delta, int N, int M);
|
||||
*/
|
||||
DP Chemical_Potential (const ODSLF_Bethe_State& RefState);
|
||||
//DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded);
|
||||
DP Sumrule_Factor (char whichDSF, ODSLF_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
void Evaluate_F_Sumrule (string prefix, char whichDSF, const ODSLF_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const ODSLF_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
|
||||
complex<DP> ln_Sz_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
|
||||
complex<DP> ln_Smin_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
|
||||
std::complex<DP> ln_Sz_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
|
||||
std::complex<DP> ln_Smin_ME (ODSLF_XXZ_Bethe_State& A, ODSLF_XXZ_Bethe_State& B);
|
||||
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState,
|
||||
// ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState,
|
||||
ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState,
|
||||
ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, std::stringstream& DAT_outfile);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,828 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS_Scan.h
|
||||
|
||||
Purpose: Declares all classes and functions used in the
|
||||
ABACUS logic of scanning with threads.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef ABACUS_SCAN_H
|
||||
#define ABACUS_SCAN_H
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
const int MAX_STATE_LIST_SIZE = 10000;
|
||||
|
||||
// Functions in src/UTILS/Data_File_Name.cc:
|
||||
void Data_File_Name (std::stringstream& name, char whichDSF, DP c_int, DP L, int N,
|
||||
int iKmin, int iKmax, DP kBT, DP L2, std::string defaultname);
|
||||
void Data_File_Name (std::stringstream& name, char whichDSF, int iKmin, int iKmax, DP kBT,
|
||||
LiebLin_Bethe_State& State, LiebLin_Bethe_State& RefScanState, std::string defaultname);
|
||||
void Data_File_Name (std::stringstream& name, char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
|
||||
DP kBT, int N2, std::string defaultname);
|
||||
void Data_File_Name (std::stringstream& name, char whichDSF, int iKmin, int iKmax, DP kBT,
|
||||
Heis_Bethe_State& State, Heis_Bethe_State& RefScanState, std::string defaultname);
|
||||
void ODSLF_Data_File_Name (std::stringstream& name, char whichDSF, DP Delta, int N, int M,
|
||||
int iKmin, int iKmax, DP kBT, int N2, std::string defaultname);
|
||||
void Data_File_Name (std::stringstream& name, char whichDSF, int iKmin, int iKmax, DP kBT,
|
||||
ODSLF_Bethe_State& State, ODSLF_Bethe_State& RefScanState, std::string defaultname);
|
||||
|
||||
// Coding to convert ints to strings: for application in reduced labels
|
||||
//const int ABACUScodingsize = 64; // use a multiple of 2 to accelerate divisions in labeling.
|
||||
//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', '!', '?'};
|
||||
|
||||
// From ABACUS++T_8 onwards: forbid special characters as |, :, !, ? and all capital letters in labels.
|
||||
// This is due to the dumb capitalization-preserving but capitalization-insensitive HFS+ filesystem on Mac OS X.
|
||||
const int ABACUScodingsize = 32;
|
||||
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'};
|
||||
const char LABELSEP = '_'; // was _
|
||||
const char TYPESEP = 'x'; // was |
|
||||
const char EXCSEP = 'y'; // was :
|
||||
const char INEXCSEP = 'z'; // was @
|
||||
|
||||
struct State_Label_Data {
|
||||
|
||||
Vect<int> type; // integer type labels of the types present
|
||||
Vect<int> M; // how many particles of each type
|
||||
Vect<int> nexc; // how many excitations as compared to the reference state used
|
||||
Vect<Vect<int> > Ix2old; // which Ix2 will be excited
|
||||
Vect<Vect<int> > Ix2exc; // which Ix2 the excitation has shifted to
|
||||
|
||||
State_Label_Data (const Vect<int>& type_ref, const Vect<int>& M_ref,
|
||||
const Vect<int>& nexc_ref, const Vect<Vect<int> >& Ix2old_ref, const Vect<Vect<int> >& Ix2exc_ref)
|
||||
{
|
||||
type = type_ref; M = M_ref; nexc = nexc_ref; Ix2old = Ix2old_ref; Ix2exc = Ix2exc_ref;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
std::string Extract_Base_Label (std::string label); // works for labels and complabels
|
||||
std::string Extract_nexc_Label (std::string label);
|
||||
|
||||
// For compressed labels: conversions between integers and char/strings.
|
||||
std::string Convert_POSINT_to_STR (int int_to_convert);
|
||||
int Convert_CHAR_to_POSINT (char char_to_convert);
|
||||
int Convert_STR_to_POSINT (std::string str_to_convert);
|
||||
|
||||
State_Label_Data Read_Base_Label (std::string label);
|
||||
State_Label_Data Read_State_Label (std::string label, const Vect<Vect<int> >& OriginIx2);
|
||||
State_Label_Data Read_State_Label (std::string label, const Vect<int>& OriginIx2); // if there is only one type
|
||||
std::string Return_State_Label (State_Label_Data data, const Vect<Vect<int> >& OriginIx2);
|
||||
std::string Return_State_Label (State_Label_Data data, const Vect<int>& OriginIx2); // if there is only one type
|
||||
std::string Return_State_Label (const Vect<Vect<int> >& ScanIx2, const Vect<Vect<int> >& OriginIx2);
|
||||
std::string Return_State_Label (const Vect<int>& ScanIx2, const Vect<int>& OriginIx2); // if there is only one type
|
||||
Vect<Vect<int> > Return_Ix2_from_Label (std::string label_ref, const Vect<Vect<int> >& OriginIx2);
|
||||
Vect<int> Return_Ix2_from_Label (std::string label_ref, const Vect<int>& OriginIx2); // specialization to Lieb-Liniger
|
||||
|
||||
// Functions for descending states: in SCAN/Descendents.cc
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
// For symmetric state scanning:
|
||||
Vect<std::string> Descendent_States_with_iK_Stepped_Up_rightIx2only
|
||||
(std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
|
||||
Vect<std::string> Descendent_States_with_iK_Stepped_Down_rightIx2only
|
||||
(std::string ScanIx2_label, const LiebLin_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
|
||||
Vect<std::string> Descendent_States_with_iK_Stepped_Up_rightIx2only
|
||||
(std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
|
||||
Vect<std::string> Descendent_States_with_iK_Stepped_Down_rightIx2only
|
||||
(std::string ScanIx2_label, const Heis_Bethe_State& OriginState, bool disperse_only_current_exc, bool preserve_nexc);
|
||||
|
||||
// Functions in src/SCAN/General_Scan.cc:
|
||||
void Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
void Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
|
||||
int Max_Secs, DP target_sumrule, bool refine);
|
||||
void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, std::string defaultname, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine);
|
||||
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,
|
||||
int iK_UL, int Max_Secs, DP target_sumrule, bool refine);
|
||||
|
||||
void Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
void Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine);
|
||||
void Scan_Heis (char whichDSF, XXZ_Bethe_State& AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
void Scan_Heis (char whichDSF, XXX_Bethe_State& AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
void Scan_Heis (char whichDSF, XXZ_gpd_Bethe_State& AveragingState, std::string defaultScanStatename, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
|
||||
void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
|
||||
int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors);
|
||||
void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax, int Max_Secs, bool refine);
|
||||
void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int iKneeded, int Max_Secs, bool refine);
|
||||
void Scan_ODSLF (char whichDSF, DP Delta, int N, int M, int Max_Secs, bool refine);
|
||||
|
||||
// Functions to prepare and wrapup parallel scans:
|
||||
void Prepare_Parallel_Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
|
||||
std::string defaultname, int paralevel, Vect<int> rank_lower_paralevels,
|
||||
Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
|
||||
void Wrapup_Parallel_Scan_LiebLin (char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT,
|
||||
std::string defaultname, int paralevel, Vect<int> rank_lower_paralevels,
|
||||
Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
|
||||
|
||||
void Prepare_Parallel_Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
|
||||
int paralevel, Vect<int> rank_lower_paralevels,
|
||||
Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
|
||||
void Wrapup_Parallel_Scan_Heis (char whichDSF, DP Delta, int N, int M, int iKmin, int iKmax,
|
||||
int paralevel, Vect<int> rank_lower_paralevels,
|
||||
Vect<int> nr_processors_lower_paralevels, int nr_processors_at_newlevel);
|
||||
|
||||
|
||||
void Sort_RAW_File (const char ffsq_file[], char optionchar);
|
||||
void Sort_RAW_File (const char ffsq_file[], char optionchar, char whichDSF);
|
||||
|
||||
// Functions for data interpretation:
|
||||
DP Smoothen_RAW_into_SF (std::string prefix, int iKmin, int iKmax, int DiK,
|
||||
DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
|
||||
DP Smoothen_RAW_into_SF (std::string prefix, Vect<std::string> rawfilename, Vect<DP> weight, int iKmin, int iKmax, int DiK,
|
||||
DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
|
||||
void Write_K_File (DP Length, int iKmin, int iKmax);
|
||||
void Write_Omega_File (int Nout_omega, DP omegamin, DP omegamax);
|
||||
// Smoothen with gaussian width scaled with two-particle bandwidth
|
||||
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);
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
struct Scan_Info {
|
||||
|
||||
DP sumrule_obtained;
|
||||
DP Nfull; // dimensionality of (sub)Hilbert space considered
|
||||
long long int Ninadm;
|
||||
long long int Ndata;
|
||||
long long int Ndata_conv;
|
||||
long long int Ndata_conv0;
|
||||
double TT; // total computation time in seconds
|
||||
|
||||
public:
|
||||
Scan_Info(); // constructor, puts everything to zero
|
||||
Scan_Info (DP sr, DP Nf, long long int Ni, long long int Nd, long long int Ndc, long long int Ndc0, double t);
|
||||
|
||||
void Save (const char* outfile_Cstr);
|
||||
void Load (const char* infile_Cstr);
|
||||
|
||||
inline Scan_Info& operator = (const Scan_Info& ref_info)
|
||||
{
|
||||
sumrule_obtained = ref_info.sumrule_obtained;
|
||||
Nfull = ref_info.Nfull;
|
||||
Ninadm = ref_info.Ninadm;
|
||||
Ndata = ref_info.Ndata;
|
||||
Ndata_conv = ref_info.Ndata_conv;
|
||||
Ndata_conv0 = ref_info.Ndata_conv0;
|
||||
TT = ref_info.TT;
|
||||
|
||||
return(*this);
|
||||
}
|
||||
|
||||
inline Scan_Info& operator+= (const Scan_Info& ref_info)
|
||||
{
|
||||
if (this != &ref_info) {
|
||||
sumrule_obtained += ref_info.sumrule_obtained;
|
||||
Nfull += ref_info.Nfull;
|
||||
Ninadm += ref_info.Ninadm;
|
||||
Ndata += ref_info.Ndata;
|
||||
Ndata_conv += ref_info.Ndata_conv;
|
||||
Ndata_conv0 += ref_info.Ndata_conv0;
|
||||
TT += ref_info.TT;
|
||||
}
|
||||
|
||||
return(*this);
|
||||
}
|
||||
|
||||
inline Scan_Info& operator-= (const Scan_Info& ref_info)
|
||||
{
|
||||
if (this != &ref_info) {
|
||||
sumrule_obtained -= ref_info.sumrule_obtained;
|
||||
Nfull -= ref_info.Nfull;
|
||||
Ninadm -= ref_info.Ninadm;
|
||||
Ndata -= ref_info.Ndata;
|
||||
Ndata_conv -= ref_info.Ndata_conv;
|
||||
Ndata_conv0 -= ref_info.Ndata_conv0;
|
||||
TT -= ref_info.TT;
|
||||
}
|
||||
|
||||
return(*this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const Scan_Info& info);
|
||||
|
||||
template<class Tstate>
|
||||
Scan_Info General_Scan (char whichDSF, int iKmin, int iKmax, int iKmod, DP kBT, Tstate& AveragingState, Tstate& SeedScanState,
|
||||
std::string defaultScanStatename, int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors);
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Functions in src/SCAN/Descendents.cc:
|
||||
Vect<std::string> Descendents (const LiebLin_Bethe_State& ScanState, const LiebLin_Bethe_State& OriginState, int type_required);
|
||||
Vect<std::string> Descendents (const Heis_Bethe_State& ScanState, const Heis_Bethe_State& OriginState, int type_required);
|
||||
|
||||
|
||||
struct Scan_Thread {
|
||||
|
||||
std::string label;
|
||||
int type;
|
||||
|
||||
Scan_Thread ();
|
||||
Scan_Thread (std::string label_ref, int type_ref) {
|
||||
label = label_ref;
|
||||
type = type_ref;
|
||||
}
|
||||
|
||||
Scan_Thread& operator= (const Scan_Thread& RefThread);
|
||||
};
|
||||
|
||||
|
||||
struct Scan_Thread_Data {
|
||||
|
||||
// By convention, a Scan_Thread_Data object handles a list of threads which are yet to be descended.
|
||||
// Improvement on Scan_Thread_Set used up to ABACUS++G_7, saving data to disk instead of holding it in memory.
|
||||
|
||||
int nlists = 6400; // number of threads lists, fixed to this number by convention.
|
||||
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.
|
||||
|
||||
std::string thrdir_name; // directory in which threads files are saved.
|
||||
|
||||
Vect<int> nthreads_total;
|
||||
|
||||
Vect<int> nthreads_on_disk;
|
||||
int lowest_il_with_nthreads_neq_0;
|
||||
|
||||
// In-memory storage, for adding threads efficiently without constantly writing to disk
|
||||
// These objects are saved to disk when Next_Scan_Threads are called.
|
||||
Vect<int> dim;
|
||||
Vect<int> nthreads_in_memory;
|
||||
Vect<Vect<std::string> > label;
|
||||
Vect<Vect<int> > type; // which type of descendent is needed
|
||||
|
||||
Vect<std::string> filename;
|
||||
|
||||
Scan_Thread_Data ();
|
||||
Scan_Thread_Data (std::string thrdir_name_ref, bool refine);
|
||||
~Scan_Thread_Data ();
|
||||
|
||||
bool Increase_Memory_Size (int il, int nr_to_add);
|
||||
void Include_Thread (DP abs_data_value_ref, std::string label_ref, int type_ref);
|
||||
void Include_Thread (int il, std::string label_ref, int type_ref);
|
||||
|
||||
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.
|
||||
Vect<Scan_Thread> Extract_Next_Scan_Threads (int min_nr); // as above, but returns a minimum of min_nr threads.
|
||||
|
||||
|
||||
void Flush_to_Disk (int il);
|
||||
void Save ();
|
||||
void Load ();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// To populate a list of states for scanning:
|
||||
|
||||
inline void Scan_for_Possible_Bases (const Vect<int> SeedNrap, const Vect<int> Str_L,
|
||||
int Mdown_remaining, Vect<std::string>& possible_base_label, int& nfound, int nexc_max_used,
|
||||
int base_level_to_scan, Vect<int>& Nrapidities)
|
||||
{
|
||||
if (Mdown_remaining < 0) { ABACUSerror("Scan_for_Possible_Bases: shouldn't be here..."); } // reached inconsistent point
|
||||
|
||||
if (base_level_to_scan == 0) {
|
||||
if (Str_L[0] != 1) ABACUSerror("Str_L[0] != 1 in ABACUS_Scan.h Scan_for_Possible_Bases.");
|
||||
Nrapidities[0] = Mdown_remaining;
|
||||
|
||||
// Set label:
|
||||
std::stringstream M0out;
|
||||
M0out << Nrapidities[0];
|
||||
possible_base_label[nfound] = M0out.str();
|
||||
for (int itype = 1; itype < Nrapidities.size(); ++itype)
|
||||
if (Nrapidities[itype] > 0) {
|
||||
possible_base_label[nfound] += TYPESEP;
|
||||
std::stringstream typeout;
|
||||
typeout << itype;
|
||||
possible_base_label[nfound] += typeout.str();
|
||||
possible_base_label[nfound] += EXCSEP;
|
||||
std::stringstream Mout;
|
||||
Mout << Nrapidities[itype];
|
||||
possible_base_label[nfound] += Mout.str();
|
||||
}
|
||||
nfound++;
|
||||
}
|
||||
|
||||
else {
|
||||
// Preserve the number of strings at this level as compared to SeedState:
|
||||
Nrapidities[base_level_to_scan] = SeedNrap[base_level_to_scan];
|
||||
if (Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan] >= 0)
|
||||
Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan],
|
||||
possible_base_label, nfound, nexc_max_used, base_level_to_scan - 1, Nrapidities);
|
||||
|
||||
// Reduce number of strings at this level as compared to SeedState:
|
||||
for (int i = 1; i <= ABACUS::min(SeedNrap[base_level_to_scan], nexc_max_used/Str_L[base_level_to_scan]); ++i) {
|
||||
Nrapidities[base_level_to_scan] = SeedNrap[base_level_to_scan] - i;
|
||||
if (Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan] >= 0)
|
||||
Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan],
|
||||
possible_base_label, nfound, nexc_max_used - i*Str_L[base_level_to_scan], base_level_to_scan - 1, Nrapidities);
|
||||
}
|
||||
// Increase the number of strings at this level as compared to SeedState:
|
||||
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) {
|
||||
Nrapidities[base_level_to_scan] = SeedNrap[base_level_to_scan] + i;
|
||||
if (Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan] >= 0)
|
||||
Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining - Str_L[base_level_to_scan] * Nrapidities[base_level_to_scan],
|
||||
possible_base_label, nfound, nexc_max_used - i*Str_L[base_level_to_scan], base_level_to_scan - 1, Nrapidities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Vect<std::string> Possible_Bases (const Vect<int> SeedNrap, const Vect<int> Str_L, int Mdown)//const Heis_Bethe_State& SeedState)
|
||||
{
|
||||
int nexc_max_used = NEXC_MAX_HEIS;
|
||||
|
||||
Vect<std::string> possible_base_label (1000);
|
||||
int nfound = 0;
|
||||
Vect<int> Nrapidities = SeedNrap;
|
||||
int Mdown_remaining = Mdown;
|
||||
|
||||
Scan_for_Possible_Bases (SeedNrap, Str_L, Mdown_remaining, possible_base_label, nfound, nexc_max_used, SeedNrap.size() - 1, Nrapidities);
|
||||
|
||||
// Copy results into a clean vector:
|
||||
Vect<std::string> possible_base_label_found (nfound);
|
||||
for (int i = 0; i < nfound; ++i) possible_base_label_found[i] = possible_base_label[i];
|
||||
|
||||
return(possible_base_label_found);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
template<class Tstate>
|
||||
class Scan_State_List {
|
||||
|
||||
public:
|
||||
int ndef;
|
||||
Vect<Tstate> State;
|
||||
Vect<std::string> base_label;
|
||||
Vect<Scan_Info> info; // info for base and type of State[n]
|
||||
Vect<bool> flag_for_scan; // set to true, next round of scanning will use this base/type
|
||||
Vect<bool> scan_attempted; // whether this has already been attempted
|
||||
|
||||
public:
|
||||
inline Scan_State_List (char whichDSF, const Tstate& SeedScanState);
|
||||
|
||||
public:
|
||||
inline Tstate& Return_State (std::string base_label_ref); // returns a state corresponding to same base and type
|
||||
inline void Populate_List (char whichDSF, const Tstate& SeedScanState); // creates all types of states containing up to nexc_max excitations
|
||||
inline void Include_Info (Scan_Info& info_to_add, std::string base_label_ref);
|
||||
inline void Raise_Scanning_Flags (DP threshold); // checks whether base/type should be scanned based on simpler base/type combinations
|
||||
|
||||
inline void Order_in_SRC ();
|
||||
inline void Save_Info (const char* sumfile_Cstr);
|
||||
inline void Load_Info (const char* sumfile_Cstr);
|
||||
};
|
||||
|
||||
// Do the explicit class specializations:
|
||||
|
||||
template<>
|
||||
inline Scan_State_List<LiebLin_Bethe_State>::Scan_State_List (char whichDSF, const LiebLin_Bethe_State& SeedScanState)
|
||||
: ndef(0), State(Vect<LiebLin_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
|
||||
info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
|
||||
scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
|
||||
{
|
||||
State[0] = SeedScanState;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Scan_State_List<XXZ_Bethe_State>::Scan_State_List (char whichDSF, const XXZ_Bethe_State& SeedScanState)
|
||||
: ndef(0), State(Vect<XXZ_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
|
||||
info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
|
||||
scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
|
||||
{
|
||||
State[0] = SeedScanState;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Scan_State_List<XXX_Bethe_State>::Scan_State_List (char whichDSF, const XXX_Bethe_State& SeedScanState)
|
||||
: ndef(0), State(Vect<XXX_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
|
||||
info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
|
||||
scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
|
||||
{
|
||||
State[0] = SeedScanState;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Scan_State_List<XXZ_gpd_Bethe_State>::Scan_State_List (char whichDSF, const XXZ_gpd_Bethe_State& SeedScanState)
|
||||
: ndef(0), State(Vect<XXZ_gpd_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
|
||||
info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
|
||||
scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
|
||||
{
|
||||
State[0] = SeedScanState;
|
||||
}
|
||||
|
||||
/* IN_DEVELOPMENT
|
||||
template<>
|
||||
inline Scan_State_List<ODSLF_XXZ_Bethe_State>::Scan_State_List (char whichDSF, const ODSLF_XXZ_Bethe_State& RefState)
|
||||
: ndef(0), State(Vect<ODSLF_XXZ_Bethe_State>(MAX_STATE_LIST_SIZE)), base_label(Vect<std::string>(MAX_STATE_LIST_SIZE)),
|
||||
info(Vect<Scan_Info>(MAX_STATE_LIST_SIZE)), flag_for_scan(Vect<bool>(false, MAX_STATE_LIST_SIZE)),
|
||||
scan_attempted(Vect<bool>(false, MAX_STATE_LIST_SIZE))
|
||||
{
|
||||
if (whichDSF == 'Z' || whichDSF == 'z') State[0] = ODSLF_XXZ_Bethe_State(RefState.chain, RefState.base.Mdown);
|
||||
else if (whichDSF == 'm') State[0] = ODSLF_XXZ_Bethe_State(RefState.chain, RefState.base.Mdown - 1);
|
||||
else if (whichDSF == 'p') State[0] = ODSLF_XXZ_Bethe_State(RefState.chain, RefState.base.Mdown + 1);
|
||||
else ABACUSerror("Unknown whichDSF in Scan_State_List<ODSLF_XXZ... constructor.");
|
||||
}
|
||||
*/
|
||||
|
||||
template<>
|
||||
inline LiebLin_Bethe_State& Scan_State_List<LiebLin_Bethe_State>::Return_State (std::string base_label_ref)
|
||||
{
|
||||
int n = 0;
|
||||
while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
|
||||
|
||||
if (n == ndef) {
|
||||
State[n] = State[0];
|
||||
base_label[n] = base_label_ref;
|
||||
info[n].Nfull = 1LL; // Nfull not definable for LiebLin
|
||||
ndef++;
|
||||
}
|
||||
|
||||
return(State[n]);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline XXZ_Bethe_State& Scan_State_List<XXZ_Bethe_State>::Return_State (std::string base_label_ref)
|
||||
{
|
||||
int n = 0;
|
||||
while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
|
||||
|
||||
if (n == ndef) {
|
||||
Heis_Base checkbase (State[0].chain, base_label_ref);
|
||||
State[n] = XXZ_Bethe_State (State[0].chain, checkbase);
|
||||
info[n].Nfull = checkbase.dimH;
|
||||
ndef++;
|
||||
}
|
||||
|
||||
return(State[n]);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline XXX_Bethe_State& Scan_State_List<XXX_Bethe_State>::Return_State (std::string base_label_ref)
|
||||
{
|
||||
int n = 0;
|
||||
while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
|
||||
|
||||
if (n == ndef) {
|
||||
Heis_Base checkbase (State[0].chain, base_label_ref);
|
||||
State[n] = XXX_Bethe_State (State[0].chain, checkbase);
|
||||
info[n].Nfull = checkbase.dimH;
|
||||
ndef++;
|
||||
}
|
||||
|
||||
return(State[n]);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline XXZ_gpd_Bethe_State& Scan_State_List<XXZ_gpd_Bethe_State>::Return_State (std::string base_label_ref)
|
||||
{
|
||||
int n = 0;
|
||||
while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
|
||||
|
||||
if (n == ndef) {
|
||||
Heis_Base checkbase (State[0].chain, base_label_ref);
|
||||
State[n] = XXZ_gpd_Bethe_State (State[0].chain, checkbase);
|
||||
info[n].Nfull = checkbase.dimH;
|
||||
ndef++;
|
||||
}
|
||||
|
||||
return(State[n]);
|
||||
}
|
||||
|
||||
/* IN DEVELOPMENT
|
||||
template<>
|
||||
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)
|
||||
{
|
||||
int n = 0;
|
||||
while (n < ndef && !(base_id_ref == State[n].base_id && type_id_ref == State[n].type_id)) n++;
|
||||
|
||||
if (n == ndef) {
|
||||
State[n] = ODSLF_XXZ_Bethe_State (State[0].chain, base_id_ref, type_id_ref);
|
||||
info[n].Nfull = State[n].maxid + 1LL;
|
||||
ndef++;
|
||||
}
|
||||
|
||||
return(State[n]);
|
||||
}
|
||||
*/
|
||||
|
||||
template<>
|
||||
inline void Scan_State_List<LiebLin_Bethe_State>::Populate_List (char whichDSF, const LiebLin_Bethe_State& SeedScanState)
|
||||
{
|
||||
// For LiebLin_Bethe_State: only one base is used, so there is only one state here.
|
||||
|
||||
if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
|
||||
|
||||
std::stringstream baselabel;
|
||||
baselabel << State[0].N;
|
||||
base_label[0] = baselabel.str();
|
||||
std::stringstream label0;
|
||||
label0 << State[0].N << LABELSEP << ABACUScoding[0] << LABELSEP;//"_0_";
|
||||
State[0].Set_to_Label (label0.str(), SeedScanState.Ix2);
|
||||
info[0].Nfull = 1LL; // Nfull not definable for LiebLin
|
||||
ndef = 1;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Scan_State_List<XXZ_Bethe_State>::Populate_List (char whichDSF, const XXZ_Bethe_State& SeedScanState)
|
||||
{
|
||||
// creates all types of states containing up to nexc_max excitations
|
||||
|
||||
if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
|
||||
|
||||
// We assume that SeedScanState has quantum numbers which are set according to the relevant AveragingState.
|
||||
|
||||
// This function creates a list of states with other bases in the vicinity of that of SeedScanState,
|
||||
// matching the quantum numbers as closely as possible.
|
||||
|
||||
Vect<int> Str_L(SeedScanState.chain.Nstrings);
|
||||
for (int i = 0; i < SeedScanState.chain.Nstrings; ++i) Str_L[i] = SeedScanState.chain.Str_L[i];
|
||||
|
||||
// First of all, we create a list of the possible bases themselves.
|
||||
Vect<std::string> bases_label = Possible_Bases (SeedScanState.base.Nrap, Str_L, SeedScanState.base.Mdown); // returns a vector of possible bases
|
||||
|
||||
for (int ib = 0; ib < bases_label.size(); ++ib) {
|
||||
|
||||
Heis_Base checkbase (State[0].chain, bases_label[ib]);
|
||||
|
||||
State[ndef] = XXZ_Bethe_State (State[0].chain, checkbase);
|
||||
State[ndef].Set_to_Closest_Matching_Ix2_fixed_Base (SeedScanState);
|
||||
State[ndef].Set_Label_from_Ix2 (State[ndef].Ix2); // sets to trivial label for this base
|
||||
base_label[ndef] = bases_label[ib];
|
||||
info[ndef].Nfull = State[ndef].base.dimH;
|
||||
ndef++;
|
||||
if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Scan_State_List<XXX_Bethe_State>::Populate_List (char whichDSF, const XXX_Bethe_State& SeedScanState)
|
||||
{
|
||||
// creates all types of states containing up to nexc_max excitations
|
||||
|
||||
if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
|
||||
|
||||
// We assume that SeedScanState has quantum numbers which are set according to the relevant AveragingState.
|
||||
|
||||
// This function creates a list of states with other bases in the vicinity of that of SeedScanState,
|
||||
// matching the quantum numbers as closely as possible.
|
||||
|
||||
Vect<int> Str_L(SeedScanState.chain.Nstrings);
|
||||
for (int i = 0; i < SeedScanState.chain.Nstrings; ++i) Str_L[i] = SeedScanState.chain.Str_L[i];
|
||||
|
||||
// To take infinite rapidities into account, we use intermediate states with up to 2 less finite rapidities (1 for Szz, 2 for Spm)
|
||||
int nrinfrapmax = 0;
|
||||
if (whichDSF == 'z') nrinfrapmax = 1;
|
||||
else if (whichDSF == 'p') nrinfrapmax = ABACUS::min(2, SeedScanState.base.Mdown);
|
||||
|
||||
Vect<int> Nrapmod = SeedScanState.base.Nrap;
|
||||
|
||||
for (int nrinfrap = 0; nrinfrap <= nrinfrapmax; ++nrinfrap) {
|
||||
|
||||
Nrapmod[0] = SeedScanState.base.Nrap[0] - nrinfrap;
|
||||
if (Nrapmod[0] < 0) ABACUSerror("Putting too many rapidities at infinity in ABACUS_Scan.h: Possible_Bases.");
|
||||
|
||||
Vect<std::string> bases_label = Possible_Bases (Nrapmod, Str_L, SeedScanState.base.Mdown-nrinfrap); // returns a vector of possible bases
|
||||
|
||||
for (int ib = 0; ib < bases_label.size(); ++ib) {
|
||||
|
||||
Heis_Base checkbase (State[0].chain, bases_label[ib]);
|
||||
|
||||
State[ndef] = XXX_Bethe_State (State[0].chain, checkbase);
|
||||
State[ndef].Set_to_Closest_Matching_Ix2_fixed_Base (SeedScanState);
|
||||
base_label[ndef] = bases_label[ib];
|
||||
info[ndef].Nfull = State[ndef].base.dimH;
|
||||
ndef++;
|
||||
if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
|
||||
}
|
||||
} // for nrinfrap
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Scan_State_List<XXZ_gpd_Bethe_State>::Populate_List (char whichDSF, const XXZ_gpd_Bethe_State& SeedScanState)
|
||||
{
|
||||
// creates all types of states containing up to nexc_max excitations
|
||||
|
||||
if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
|
||||
|
||||
// We assume that SeedScanState has quantum numbers which are set according to the relevant AveragingState.
|
||||
|
||||
// This function creates a list of states with other bases in the vicinity of that of SeedScanState,
|
||||
// matching the quantum numbers as closely as possible.
|
||||
|
||||
Vect<int> Str_L(SeedScanState.chain.Nstrings);
|
||||
for (int i = 0; i < SeedScanState.chain.Nstrings; ++i) Str_L[i] = SeedScanState.chain.Str_L[i];
|
||||
|
||||
// First of all, we create a list of the possible bases themselves.
|
||||
Vect<std::string> bases_label = Possible_Bases (SeedScanState.base.Nrap, Str_L, SeedScanState.base.Mdown); // returns a vector of possible bases
|
||||
|
||||
for (int ib = 0; ib < bases_label.size(); ++ib) {
|
||||
|
||||
Heis_Base checkbase (State[0].chain, bases_label[ib]);
|
||||
|
||||
State[ndef] = XXZ_gpd_Bethe_State (State[0].chain, checkbase);
|
||||
State[ndef].Set_to_Closest_Matching_Ix2_fixed_Base (SeedScanState);
|
||||
base_label[ndef] = bases_label[ib];
|
||||
info[ndef].Nfull = State[ndef].base.dimH;
|
||||
ndef++;
|
||||
if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* IN DEVELOPMENT
|
||||
template<>
|
||||
inline void Scan_State_List<ODSLF_XXZ_Bethe_State>::Populate_List ()
|
||||
{
|
||||
// creates all types of states containing up to nexc_max excitations
|
||||
|
||||
if (ndef != 0) ABACUSerror("Please only populate a virgin Scan_State_List.");
|
||||
|
||||
//std::cout << "In Populate_List: " << State[0] << std::endl;
|
||||
|
||||
Vect<long long int> bases_id = State[0].chain.Possible_Bases (State[0].base.Mdown); // returns a vector of possible bases
|
||||
|
||||
//std::cout << "Mdown = " << State[0].base.Mdown << "\tPossible bases size: " << bases_id.size() << "\tPossible bases: " << bases_id << std::endl;
|
||||
|
||||
for (int ib = 0; ib < bases_id.size(); ++ib) {
|
||||
ODSLF_Base checkbase (State[0].chain, bases_id[ib]);
|
||||
|
||||
Vect<long long int> types_id = checkbase.Possible_Types (); // returns a vector of possible types
|
||||
|
||||
//std::cout << "For base_id " << bases_id[ib] << "\t found types " << types_id << std::endl;
|
||||
|
||||
for (int it = 0; it < types_id.size(); ++it) {
|
||||
|
||||
if (bases_id[ib] < 1000000) { // FUDGE: consider only one-strings
|
||||
//std::cout << "Populate list: constructing state: " << bases_id[ib] << "\t" << types_id[it] << std::endl;
|
||||
State[ndef] = ODSLF_XXZ_Bethe_State (State[0].chain, bases_id[ib], types_id[it]);
|
||||
//std::cout << "Populate list: before setting id: " << std::endl << State[ndef] << std::endl;
|
||||
State[ndef].Set_to_id(0LL);
|
||||
//std::cout << "Populate list: after setting id: " << std::endl << State[ndef] << std::endl;
|
||||
info[ndef].Nfull = State[ndef].maxid + 1LL;
|
||||
ndef++;
|
||||
if (ndef >= MAX_STATE_LIST_SIZE) ABACUSerror("Increase number of elements in ScanStateList.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
template<class Tstate>
|
||||
inline void Scan_State_List<Tstate>::Include_Info (Scan_Info& info_to_add, std::string base_label_ref)
|
||||
{
|
||||
|
||||
int n = 0;
|
||||
while (n < ndef && base_label_ref.compare(base_label[n]) != 0) n++;
|
||||
|
||||
if (n == ndef) {
|
||||
std::cout << "ndef = " << ndef << std::endl;
|
||||
for (int i = 0; i < ndef; ++i) std::cout << base_label[i] << "\t";
|
||||
std::cout << std::endl;
|
||||
std::cout << "base_label_ref " << base_label_ref << std::endl;
|
||||
ABACUSerror("Did not find base_label_ref in Scan_State_List::Include_Info.");
|
||||
}
|
||||
|
||||
info[n] += info_to_add;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
template<class Tstate>
|
||||
inline void Scan_State_List<Tstate>::Raise_Scanning_Flags (DP threshold)
|
||||
{
|
||||
flag_for_scan = true;
|
||||
}
|
||||
|
||||
template<class Tstate>
|
||||
inline void Scan_State_List<Tstate>::Order_in_SRC ()
|
||||
{
|
||||
if (ndef > 0) {
|
||||
|
||||
Vect_INT index(ndef);
|
||||
for (int i = 0; i < ndef; ++i) index[i] = i;
|
||||
|
||||
Vect<DP> sr (ndef);
|
||||
for (int i = 0; i < ndef; ++i) sr[i] = info[i].sumrule_obtained;
|
||||
|
||||
sr.QuickSort(index, 0, ndef - 1);
|
||||
|
||||
Vect<Tstate> State_ordered(ndef);
|
||||
Vect<std::string> base_label_ordered(ndef);
|
||||
Vect<Scan_Info> info_ordered(ndef);
|
||||
Vect<bool> flag_for_scan_ordered(ndef);
|
||||
|
||||
// Put data in proper order
|
||||
for (int i = 0; i < ndef; ++i) {
|
||||
State_ordered[i] = State[index[ndef - 1 - i] ];
|
||||
base_label_ordered[i] = base_label[index[ndef - 1 - i] ];
|
||||
info_ordered[i] = info[index[ndef - 1 - i] ];
|
||||
flag_for_scan_ordered[i] = flag_for_scan[index[ndef - 1 - i] ];
|
||||
}
|
||||
|
||||
// Put back in *this object:
|
||||
for (int i = 0; i < ndef; ++i) {
|
||||
State[i] = State_ordered[i];
|
||||
base_label[i] = base_label_ordered[i];
|
||||
info[i] = info_ordered[i];
|
||||
flag_for_scan[i] = flag_for_scan_ordered[i];
|
||||
} // The rest are all simply 0.
|
||||
}
|
||||
}
|
||||
|
||||
template<class Tstate>
|
||||
inline void Scan_State_List<Tstate>::Save_Info (const char* sumfile_Cstr)
|
||||
{
|
||||
std::ofstream outfile;
|
||||
|
||||
outfile.open(sumfile_Cstr);
|
||||
if (outfile.fail()) ABACUSerror("Could not open outfile... ");
|
||||
|
||||
outfile.setf(std::ios::fixed);
|
||||
outfile.precision(16);
|
||||
|
||||
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.";
|
||||
|
||||
for (int i = 0; i < ndef; ++i)
|
||||
if (info[i].Nfull > 0.0) {
|
||||
int TT_hr = int(info[i].TT/3600);
|
||||
int TT_min = int((info[i].TT - 3600.0*TT_hr)/60);
|
||||
outfile << std::endl << std::setw(20) << base_label[i] << std::setw(25) << std::fixed << std::setprecision(20) << info[i].sumrule_obtained;
|
||||
if (info[i].Nfull < 1.0e+10) outfile << std::setw(25) << std::fixed << std::setprecision(0) << info[i].Nfull;
|
||||
else outfile << std::setw(25) << std::scientific << std::setprecision(16) << info[i].Nfull;
|
||||
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";
|
||||
}
|
||||
outfile.close();
|
||||
}
|
||||
|
||||
template<class Tstate>
|
||||
inline void Scan_State_List<Tstate>::Load_Info (const char* sumfile_Cstr)
|
||||
{
|
||||
std::ifstream infile;
|
||||
infile.open(sumfile_Cstr);
|
||||
if(infile.fail()) {
|
||||
std::cout << std::endl << sumfile_Cstr << std::endl;
|
||||
ABACUSerror("Could not open input file in Scan_State_List::Load_Info.");
|
||||
}
|
||||
|
||||
// Load first line, containing informative text:
|
||||
char junk[256];
|
||||
infile.getline(junk, 256);
|
||||
|
||||
// Now load the previous info's:
|
||||
std::string base_label_ref;
|
||||
DP sr_ref;
|
||||
DP Nfull_ref;
|
||||
long long int Ninadm_ref, Ndata_ref, conv_ref, conv0_ref;
|
||||
DP TT_ref;
|
||||
int TT_hr, TT_min;
|
||||
DP TT_sec;
|
||||
char a;
|
||||
|
||||
while (infile.peek() != EOF) {
|
||||
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;
|
||||
TT_ref = 3600.0 * TT_hr + 60.0* TT_min + TT_sec;
|
||||
Scan_Info info_ref (sr_ref, Nfull_ref, Ninadm_ref, Ndata_ref, conv_ref, conv0_ref, TT_ref);
|
||||
(*this).Include_Info (info_ref, base_label_ref);
|
||||
}
|
||||
|
||||
infile.close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,24 +2,22 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Spec_Fns.h
|
||||
File: ABACUS_Spec_Fns.h
|
||||
|
||||
Purpose: Defines special math functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _JSC_SPEC_FNS_H_
|
||||
#define _JSC_SPEC_FNS_H_
|
||||
#ifndef ABACUS_SPEC_FNS_H
|
||||
#define ABACUS_SPEC_FNS_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
inline DP Cosine_Integral (DP x)
|
||||
{
|
||||
|
@ -28,8 +26,8 @@ namespace JSC {
|
|||
// Refer to GR[6] 8.23
|
||||
|
||||
if (x <= 0.0) {
|
||||
cout << "Cosine_Integral called with real argument " << x << " <= 0, which is ill-defined because of the branch cut." << endl;
|
||||
JSCerror("");
|
||||
std::cout << "Cosine_Integral called with real argument " << x << " <= 0, which is ill-defined because of the branch cut." << std::endl;
|
||||
ABACUSerror("");
|
||||
}
|
||||
|
||||
else if (x < 15.0) { // Use power series expansion
|
||||
|
@ -45,7 +43,7 @@ namespace JSC {
|
|||
DP series = minonetothen * exp(logxtothetwon - log(2.0 * n) - logtwonfact);
|
||||
DP term_n;
|
||||
|
||||
do {
|
||||
do {
|
||||
n += 1;
|
||||
minonetothen *= -1.0;
|
||||
logxtothetwon += twologx;
|
||||
|
@ -55,34 +53,6 @@ namespace JSC {
|
|||
|
||||
} while (fabs(term_n) > 1.0e-16);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// For improved convergence we pair terms up, DOESN'T WORK WELL
|
||||
|
||||
// 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)} )
|
||||
|
||||
int n = 1;
|
||||
DP logxtothetwon = 2.0 * log(x);
|
||||
DP logtwon = log(2.0);
|
||||
DP logtwonfact = log(2.0);
|
||||
DP xsq = x*x;
|
||||
|
||||
DP series = exp(logxtothetwon - logtwon - logtwonfact) * (1 - xsq/((2.0 * n + 1.0) * (2.0 * n + 2.0) * (1.0 + 1.0/n)));
|
||||
DP term_n;
|
||||
DP twologx = 2.0 * log(x);
|
||||
|
||||
do {
|
||||
n += 2;
|
||||
logxtothetwon += twologx;
|
||||
logtwonfact += log((2.0 * n - 1.0) * 2.0 * n);
|
||||
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)));;
|
||||
series += term_n;
|
||||
|
||||
} while (fabs(term_n) > 1.0e-16);
|
||||
*/
|
||||
|
||||
return(Euler_Mascheroni + log(x) + series);
|
||||
}
|
||||
|
||||
|
@ -102,7 +72,7 @@ namespace JSC {
|
|||
DP series1 = minonetothen * exp(logtwonfact - logxtothetwon);
|
||||
DP series2 = minonetothen * exp(logtwonplus1fact - logxtothetwonplus1);
|
||||
|
||||
do {
|
||||
do {
|
||||
n += 1;
|
||||
minonetothen *= -1.0;
|
||||
logxtothetwon += twologx;
|
||||
|
@ -133,11 +103,11 @@ namespace JSC {
|
|||
// in which q is the nome. (GR 8.180.1)
|
||||
// We always evaluate to numerical accuracy.
|
||||
|
||||
if (q >= 1.0) JSCerror("Jacobi_Theta_1_q function called with q > 1.");
|
||||
if (q >= 1.0) ABACUSerror("Jacobi_Theta_1_q function called with q > 1.");
|
||||
|
||||
|
||||
DP answer = 0.0;
|
||||
DP contrib = 0.0;
|
||||
DP contrib = 0.0;
|
||||
DP qtonminhalfsq = pow(q, 0.25); // this will be q^{(n-1/2)^2}
|
||||
DP qtotwon = pow(q, 2.0); // this will be q^{2n}
|
||||
DP qsq = q*q;
|
||||
|
@ -149,26 +119,24 @@ namespace JSC {
|
|||
qtonminhalfsq *= qtotwon;
|
||||
qtotwon *= qsq;
|
||||
n++;
|
||||
//cout << "\t\tn = " << n << "\tanswer = " << answer << "\tcontrib = " << contrib << "\tqtonminhalfsq = " << qtonminhalfsq << "\tqtotwon = " << qtotwon << endl;
|
||||
} while (fabs(contrib/answer) > MACHINE_EPS);
|
||||
|
||||
//cout << "\t\tJacobi_Theta_1: used " << n << " iterations." << "\tanswer = " << answer << "\tcontrib = " << contrib << "\tqtonminhalfsq = " << qtonminhalfsq << "\tqtotwon = " << qtotwon << endl;
|
||||
return(answer);
|
||||
}
|
||||
|
||||
inline complex<DP> ln_Jacobi_Theta_1_q (complex<DP> u, complex<DP> q) {
|
||||
inline std::complex<DP> ln_Jacobi_Theta_1_q (std::complex<DP> u, std::complex<DP> q) {
|
||||
|
||||
// This uses the product representation
|
||||
// \theta_1 (x) = 2 q^{1/4} \sin{u} \prod_{n=1}^\infty (1 - 2 q^{2n} \cos 2u + q^{4n}) (1 - q^{2n})
|
||||
// (GR 8.181.2)
|
||||
|
||||
complex<DP> contrib = 0.0;
|
||||
complex<DP> qtotwon = q*q; // this will be q^{2n}
|
||||
complex<DP> qsq = q*q;
|
||||
complex<DP> twocos2u = 2.0 * cos(2.0*u);
|
||||
std::complex<DP> contrib = 0.0;
|
||||
std::complex<DP> qtotwon = q*q; // this will be q^{2n}
|
||||
std::complex<DP> qsq = q*q;
|
||||
std::complex<DP> twocos2u = 2.0 * cos(2.0*u);
|
||||
int n = 1;
|
||||
complex<DP> answer = log(2.0 * sin(u)) + 0.25 * log(q);
|
||||
|
||||
std::complex<DP> answer = log(2.0 * sin(u)) + 0.25 * log(q);
|
||||
|
||||
do {
|
||||
contrib = log((1.0 - twocos2u * qtotwon + qtotwon * qtotwon) * (1.0 - qtotwon));
|
||||
answer += contrib;
|
||||
|
@ -184,7 +152,7 @@ namespace JSC {
|
|||
|
||||
inline DP ln_Gamma_for_Barnes_G_RE (Vect_DP args)
|
||||
{
|
||||
return(real(ln_Gamma(complex<double>(args[0]))));
|
||||
return(real(ln_Gamma(std::complex<double>(args[0]))));
|
||||
}
|
||||
|
||||
inline DP ln_Barnes_G_RE (DP z)
|
||||
|
@ -199,9 +167,9 @@ namespace JSC {
|
|||
int max_nr_pts = 10000;
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif // _JS_SPEC_FNS_H_
|
||||
#endif
|
|
@ -2,23 +2,22 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_State_Ensemble.h
|
||||
File: ABACUS_State_Ensemble.h
|
||||
|
||||
Purpose: Define state ensembles.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _ENS_
|
||||
#define _ENS_
|
||||
#ifndef ABACUS_STATE_ENSEMBLE_H
|
||||
#define ABACUS_STATE_ENSEMBLE_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
|
||||
struct LiebLin_Diagonal_State_Ensemble {
|
||||
|
@ -29,8 +28,6 @@ namespace JSC {
|
|||
|
||||
LiebLin_Diagonal_State_Ensemble ();
|
||||
LiebLin_Diagonal_State_Ensemble (const LiebLin_Bethe_State& RefState, int nstates_req);
|
||||
//LiebLin_Diagonal_State_Ensemble (const LiebLin_Bethe_State& RefState, int nstates_req, const Vect<DP>& weight_ref);
|
||||
//LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho, int nstates_req);
|
||||
LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho);
|
||||
|
||||
LiebLin_Diagonal_State_Ensemble& operator= (const LiebLin_Diagonal_State_Ensemble& rhs);
|
||||
|
@ -38,10 +35,9 @@ namespace JSC {
|
|||
void Save (const char* ensfile_Cstr);
|
||||
};
|
||||
|
||||
//LiebLin_Diagonal_State_Ensemble LiebLin_Thermal_Saddle_Point_Ensemble (DP c_int, DP L, int N, DP kBT, int nstates_req);
|
||||
LiebLin_Diagonal_State_Ensemble LiebLin_Thermal_Saddle_Point_Ensemble (DP c_int, DP L, int N, DP kBT);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,26 +2,25 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS. library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_TBA.h
|
||||
File: ABACUS_TBA.h
|
||||
|
||||
Purpose: Thermodynamic Bethe Ansatz general functions
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _TBA_
|
||||
#define _TBA_
|
||||
#ifndef ABACUS_TBA_H
|
||||
#define ABACUS_TBA_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
struct Root_Density {
|
||||
|
||||
|
||||
int Npts; // how many points are used to describe each function
|
||||
DP lambdamax; // what the largest rapidity is
|
||||
Vect_DP lambda; // rapidity vector
|
||||
|
@ -31,42 +30,42 @@ namespace JSC {
|
|||
DP diff; // relative differences with previous iteration
|
||||
bool value_infty_set; // boolean, true if asymptotic value set
|
||||
DP value_infty; // asymptotic value, computed analytically
|
||||
|
||||
|
||||
Root_Density ();
|
||||
Root_Density (int Npts_ref, DP lambdamax_ref);
|
||||
|
||||
|
||||
Root_Density& operator= (const Root_Density& RefDensity);
|
||||
|
||||
|
||||
void Save (const char* outfile_Cstr);
|
||||
|
||||
DP Return_Value (DP lambda_ref); // evaluates the function for any argument using linear interpolation
|
||||
void Set_Asymptotics (DP value_infty_ref); // sets value for lambda >= lambdamax
|
||||
|
||||
|
||||
Root_Density Compress_and_Match_Densities (DP comp_factor); // returns a Root_Density with fewer points
|
||||
};
|
||||
|
||||
struct Root_Density_Set {
|
||||
|
||||
|
||||
int ntypes;
|
||||
Vect<Root_Density> epsilon;
|
||||
int Npts_total; // sum of all Npts of epsilon's
|
||||
DP diff; // sum of diff's of the epsilon's
|
||||
|
||||
|
||||
Root_Density_Set ();
|
||||
Root_Density_Set (int ntypes_ref, int Npts_ref, DP lambdamax_ref);
|
||||
Root_Density_Set (int ntypes_ref, Vect_INT Npts_ref, Vect_DP lambdamax_ref);
|
||||
|
||||
|
||||
Root_Density_Set& operator= (const Root_Density_Set& RefSet);
|
||||
|
||||
|
||||
void Insert_new_function (DP asymptotic_value);
|
||||
void Extend_limits (Vect<bool> need_to_extend_limit);
|
||||
void Insert_new_points (Vect<Vect<bool> > need_new_point_around);
|
||||
|
||||
|
||||
DP Return_Value (int n_ref, DP lambda_ref); // returns a value, no matter what.
|
||||
|
||||
|
||||
Root_Density_Set Return_Compressed_and_Matched_Set (DP comp_factor);
|
||||
void Match_Densities (Root_Density_Set& RefSet);
|
||||
|
||||
|
||||
void Save (const char* outfile_Cstr);
|
||||
};
|
||||
|
||||
|
@ -100,13 +99,13 @@ namespace JSC {
|
|||
Root_Density LiebLin_rho_TBA (DP kBT, const Root_Density& epsilon, const Root_Density& depsilon_dmu);
|
||||
Root_Density LiebLin_rhoh_TBA (DP kBT, const Root_Density& epsilon, const Root_Density& depsilon_dmu);
|
||||
DP LiebLin_nbar_TBA (const Root_Density& rho);
|
||||
DP LiebLin_ebar_TBA (const Root_Density& rho);
|
||||
DP LiebLin_sbar_TBA (const Root_Density& rho, const Root_Density& rhoh);
|
||||
DP LiebLin_ebar_TBA (const Root_Density& rho);
|
||||
DP LiebLin_sbar_TBA (const Root_Density& rho, const Root_Density& rhoh);
|
||||
LiebLin_TBA_Solution LiebLin_TBA_Solution_fixed_nbar (DP c_int, DP nbar_required, DP kBT, DP req_diff, int Max_Secs);
|
||||
LiebLin_TBA_Solution LiebLin_TBA_Solution_fixed_nbar_ebar (DP c_int, DP nbar_required, DP ebar_required, DP req_diff, int Max_Secs);
|
||||
LiebLin_Bethe_State Discretized_LiebLin_Bethe_State (DP c_int, DP L, int N, const Root_Density& rho);
|
||||
|
||||
// Functions defined in TBA_XXZ.cc
|
||||
// Functions defined in TBA_XXZ.cc
|
||||
DP XXZ_phi1_kernel (DP zeta, DP lambda);
|
||||
DP XXZ_phi2_kernel (DP zeta, DP lambda);
|
||||
DP XXZ_a1_kernel (DP sinzeta, DP coszeta, DP lambda);
|
||||
|
@ -121,7 +120,6 @@ namespace JSC {
|
|||
Root_Density XXZ_Kbackflow_GS (DP Delta, DP B, DP lambdamax, DP lambda_p, DP lambda_h, int Npts, DP req_prec);
|
||||
Root_Density XXZ_Fbackflow_GS (DP Delta, DP B, DP lambdamax, DP lambda_p, DP lambda_h, int Npts, DP req_prec);
|
||||
Root_Density XXZ_Z_GS (DP Delta, DP B, DP lambdamax, int Npts, DP req_prec);
|
||||
//void XXZ_Compare_Lattice_and_Continuum_Backflows_base_1010 (DP Delta, int N, int M, long long int id);
|
||||
|
||||
// Defined in TBA_2CBG.cc:
|
||||
struct TBA_Data_2CBG {
|
||||
|
@ -141,7 +139,7 @@ namespace JSC {
|
|||
void Scan_2CBG_TBAE (DP c_int, DP mu_min, DP mu_max, int Nmu, DP Omega_min, DP Omega_max, int NOmega,
|
||||
DP kBT_min, DP kBT_max, int NkBT, int Max_Secs);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,438 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS_util.h
|
||||
|
||||
Purpose: Defines basic math functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef ABACUS_UTIL_H
|
||||
#define ABACUS_UTIL_H
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
|
||||
typedef double DP;
|
||||
|
||||
// Global constants
|
||||
|
||||
const double PI = 3.141592653589793238462643;
|
||||
const double sqrtPI = sqrt(PI);
|
||||
const double twoPI = 2.0*PI;
|
||||
const double logtwoPI = log(twoPI);
|
||||
const double Euler_Mascheroni = 0.577215664901532860606;
|
||||
const double Gamma_min_0p5 = -2.0 * sqrt(PI);
|
||||
const std::complex<double> II(0.0,1.0); // Shorthand for i
|
||||
|
||||
const DP MACHINE_EPS = std::numeric_limits<DP>::epsilon();
|
||||
const DP MACHINE_EPS_SQ = pow(MACHINE_EPS, 2.0);
|
||||
|
||||
// Now for some basic math utilities:
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
// File checks:
|
||||
|
||||
inline bool file_exists (const char* filename)
|
||||
{
|
||||
std::fstream file;
|
||||
file.open(filename);
|
||||
bool exists = !file.fail();
|
||||
file.close();
|
||||
|
||||
return(exists);
|
||||
}
|
||||
|
||||
// Error handler:
|
||||
|
||||
inline void ABACUSerror (const std::string error_text)
|
||||
// my error handler
|
||||
{
|
||||
std::cerr << "Run-time error... " << std::endl;
|
||||
std::cerr << error_text << std::endl;
|
||||
std::cerr << "Exiting to system..." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct Divide_by_zero {};
|
||||
|
||||
|
||||
// Basics: min, max, fabs
|
||||
|
||||
template<class T>
|
||||
inline const T max (const T& a, const T& b) { return a > b ? (a) : (b); }
|
||||
|
||||
template<class T>
|
||||
inline const T min (const T& a, const T& b) { return a > b ? (b) : (a); }
|
||||
|
||||
template<class T>
|
||||
inline const T fabs (const T& a) { return a >= 0 ? (a) : (-a); }
|
||||
|
||||
inline long long int pow_lli (const long long int& base, const int& exp)
|
||||
{
|
||||
long long int answer = base;
|
||||
if (exp == 0) answer = 1LL;
|
||||
else for (int i = 1; i < exp; ++i) answer *= base;
|
||||
return(answer);
|
||||
}
|
||||
|
||||
inline unsigned long long int pow_ulli (const unsigned long long int& base, const int& exp)
|
||||
{
|
||||
unsigned long long int answer = base;
|
||||
if (exp == 0) answer = 1ULL;
|
||||
for (int i = 1; i < exp; ++i) answer *= base;
|
||||
return(answer);
|
||||
}
|
||||
|
||||
inline int fact (const int& N)
|
||||
{
|
||||
int ans = 0;
|
||||
|
||||
if (N < 0) {
|
||||
std::cerr << "Error: factorial of negative number. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 1;
|
||||
else ans = N * fact(N-1);
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline DP ln_fact (const int& N)
|
||||
{
|
||||
DP ans = 0.0;
|
||||
|
||||
if (N < 0) {
|
||||
std::cerr << "Error: factorial of negative number. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 0.0;
|
||||
else ans = log(DP(N)) + ln_fact(N-1);
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline long long int fact_lli (const int& N)
|
||||
{
|
||||
long long int ans = 0;
|
||||
|
||||
if (N < 0) {
|
||||
std::cerr << "Error: factorial of negative number. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 1;
|
||||
else ans = fact_lli(N-1) * N;
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline long long int fact_ulli (const int& N)
|
||||
{
|
||||
unsigned long long int ans = 0;
|
||||
|
||||
if (N < 0) {
|
||||
std::cerr << "Error: factorial of negative number. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 1;
|
||||
else ans = fact_ulli(N-1) * N;
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline int choose (const int& N1, const int& N2)
|
||||
{
|
||||
// returns N1 choose N2
|
||||
|
||||
int ans = 0;
|
||||
if (N1 < N2) {
|
||||
std::cout << "Error: N1 smaller than N2 in choose. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 1;
|
||||
else if (N1 < 12) ans = fact(N1)/(fact(N2) * fact(N1 - N2));
|
||||
else {
|
||||
ans = 1;
|
||||
int mult = N1;
|
||||
while (mult > max(N2, N1 - N2)) ans *= mult--;
|
||||
ans /= fact(min(N2, N1 - N2));
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline DP ln_choose (const int& N1, const int& N2)
|
||||
{
|
||||
// returns the log of N1 choose N2
|
||||
|
||||
DP ans = 0.0;
|
||||
if (N1 < N2) {
|
||||
std::cout << "Error: N1 smaller than N2 in choose. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 0.0;
|
||||
else ans = ln_fact(N1) - ln_fact(N2) - ln_fact(N1 - N2);
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
|
||||
inline long long int choose_lli (const int& N1, const int& N2)
|
||||
{
|
||||
// returns N1 choose N2
|
||||
|
||||
long long int ans = 0;
|
||||
if (N1 < N2) {
|
||||
std::cout << "Error: N1 smaller than N2 in choose. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 1;
|
||||
else if (N1 < 12) ans = fact_lli(N1)/(fact_lli(N2) * fact_lli(N1 - N2));
|
||||
else {
|
||||
// Make sure that N2 is less than or equal to N1/2; if not, just switch...
|
||||
int N2_min = min(N2, N1 - N2);
|
||||
|
||||
ans = 1;
|
||||
for (int i = 0; i < N2_min; ++i) {
|
||||
ans *= (N1 - i);
|
||||
ans /= i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline unsigned long long int choose_ulli (const int& N1, const int& N2)
|
||||
{
|
||||
// returns N1 choose N2
|
||||
|
||||
unsigned long long int ans = 0;
|
||||
if (N1 < N2) {
|
||||
std::cout << "Error: N1 smaller than N2 in choose. Exited." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 1;
|
||||
else if (N1 < 12) ans = fact_ulli(N1)/(fact_ulli(N2) * fact_ulli(N1 - N2));
|
||||
else {
|
||||
// Make sure that N2 is less than or equal to N1/2; if not, just switch...
|
||||
int N2_min = min(N2, N1 - N2);
|
||||
|
||||
ans = 1;
|
||||
for (int i = 0; i < N2_min; ++i) {
|
||||
ans *= (N1 - i);
|
||||
ans /= i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline DP SIGN (const DP &a, const DP &b)
|
||||
{
|
||||
return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
|
||||
}
|
||||
|
||||
inline DP sign_of (const DP& a)
|
||||
{
|
||||
return (a >= 0.0 ? 1.0 : -1.0);
|
||||
}
|
||||
|
||||
inline int sgn_int (const int& a)
|
||||
{
|
||||
return (a >= 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
inline int sgn_DP (const DP& a)
|
||||
{
|
||||
return (a >= 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void SWAP (T& a, T& b) {T dum = a; a = b; b = dum;}
|
||||
|
||||
inline int kronecker (int a, int b)
|
||||
{
|
||||
return a == b ? 1 : 0;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool is_nan (const T& a)
|
||||
{
|
||||
return(!((a < T(0.0)) || (a >= T(0.0))));
|
||||
}
|
||||
|
||||
inline std::complex<DP> atan_cx(const std::complex<DP>& x)
|
||||
{
|
||||
return(-0.5 * II * log((1.0 + II* x)/(1.0 - II* x)));
|
||||
}
|
||||
|
||||
/**************** Gamma function *******************/
|
||||
|
||||
inline std::complex<double> ln_Gamma (std::complex<double> z)
|
||||
{
|
||||
// Implementation of Lanczos method with g = 9.
|
||||
// Coefficients from Godfrey 2001.
|
||||
|
||||
if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
|
||||
|
||||
else {
|
||||
|
||||
std::complex<double> series = 1.000000000000000174663
|
||||
+ 5716.400188274341379136/z
|
||||
- 14815.30426768413909044/(z + 1.0)
|
||||
+ 14291.49277657478554025/(z + 2.0)
|
||||
- 6348.160217641458813289/(z + 3.0)
|
||||
+ 1301.608286058321874105/(z + 4.0)
|
||||
- 108.1767053514369634679/(z + 5.0)
|
||||
+ 2.605696505611755827729/(z + 6.0)
|
||||
- 0.7423452510201416151527e-2 / (z + 7.0)
|
||||
+ 0.5384136432509564062961e-7 / (z + 8.0)
|
||||
- 0.4023533141268236372067e-8 / (z + 9.0);
|
||||
|
||||
return(0.5 * logtwoPI + (z - 0.5) * log(z + 8.5) - (z + 8.5) + log(series));
|
||||
}
|
||||
|
||||
return(log(0.0)); // never called
|
||||
}
|
||||
|
||||
inline std::complex<double> ln_Gamma_old (std::complex<double> z)
|
||||
{
|
||||
// Implementation of Lanczos method with g = 9.
|
||||
// Coefficients from Godfrey 2001.
|
||||
|
||||
if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
|
||||
|
||||
else {
|
||||
|
||||
int g = 9;
|
||||
|
||||
double p[11] = { 1.000000000000000174663,
|
||||
5716.400188274341379136,
|
||||
-14815.30426768413909044,
|
||||
14291.49277657478554025,
|
||||
-6348.160217641458813289,
|
||||
1301.608286058321874105,
|
||||
-108.1767053514369634679,
|
||||
2.605696505611755827729,
|
||||
-0.7423452510201416151527e-2,
|
||||
0.5384136432509564062961e-7,
|
||||
-0.4023533141268236372067e-8 };
|
||||
|
||||
std::complex<double> z_min_1 = z - 1.0;
|
||||
std::complex<double> series = p[0];
|
||||
for (int i = 1; i < g+2; ++i)
|
||||
series += p[i]/(z_min_1 + std::complex<double>(i));
|
||||
|
||||
return(0.5 * logtwoPI + (z_min_1 + 0.5) * log(z_min_1 + std::complex<double>(g) + 0.5)
|
||||
- (z_min_1 + std::complex<double>(g) + 0.5) + log(series));
|
||||
}
|
||||
|
||||
return(log(0.0)); // never called
|
||||
}
|
||||
|
||||
inline std::complex<double> ln_Gamma_2 (std::complex<double> z)
|
||||
{
|
||||
// Implementation of Lanczos method with g = 7.
|
||||
|
||||
if (real(z) < 0.5) return(log(PI/(sin(PI*z)) - ln_Gamma(1.0 - z)));
|
||||
|
||||
else {
|
||||
|
||||
int g = 7;
|
||||
|
||||
double p[9] = { 0.99999999999980993, 676.5203681218851, -1259.1392167224028,
|
||||
771.32342877765313, -176.61502916214059, 12.507343278686905,
|
||||
-0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7};
|
||||
|
||||
std::complex<double> z_min_1 = z - 1.0;
|
||||
std::complex<double> series = p[0];
|
||||
for (int i = 1; i < g+2; ++i)
|
||||
series += p[i]/(z_min_1 + std::complex<double>(i));
|
||||
|
||||
return(0.5 * logtwoPI + (z_min_1 + 0.5) * log(z_min_1 + std::complex<double>(g) + 0.5)
|
||||
- (z_min_1 + std::complex<double>(g) + 0.5) + log(series));
|
||||
}
|
||||
|
||||
return(log(0.0)); // never called
|
||||
}
|
||||
|
||||
/********** Partition numbers **********/
|
||||
|
||||
inline long long int Partition_Function (int n)
|
||||
{
|
||||
// Returns the value of the partition function p(n), giving the number of partitions of n into integers.
|
||||
|
||||
if (n < 0) ABACUSerror("Calling Partition_Function for n < 0.");
|
||||
else if (n == 0 || n == 1) return(1LL);
|
||||
else if (n == 2) return(2LL);
|
||||
else if (n == 3) return(3LL);
|
||||
|
||||
else { // do recursion using pentagonal numbers
|
||||
long long int pn = 0LL;
|
||||
int pentnrplus, pentnrmin; // pentagonal numbers
|
||||
for (int i = 1; true; ++i) {
|
||||
pentnrplus = (i * (3*i - 1))/2;
|
||||
pentnrmin = (i * (3*i + 1))/2;
|
||||
if (n - pentnrplus >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrplus);
|
||||
if (n - pentnrmin >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrmin);
|
||||
else break;
|
||||
}
|
||||
return(pn);
|
||||
}
|
||||
return(-1LL); // never called
|
||||
}
|
||||
|
||||
|
||||
/********** Sorting **********/
|
||||
|
||||
template <class T>
|
||||
void QuickSort (T* V, int l, int r)
|
||||
{
|
||||
int i = l, j = r;
|
||||
T pivot = V[l + (r-l)/2];
|
||||
|
||||
while (i <= j) {
|
||||
while (V[i] < pivot) i++;
|
||||
while (V[j] > pivot) j--;
|
||||
if (i <= j) {
|
||||
std::swap(V[i],V[j]);
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
};
|
||||
|
||||
if (l < j) QuickSort(V, l, j);
|
||||
if (i < r) QuickSort(V, i, r);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void QuickSort (T* V, int* index, int l, int r)
|
||||
{
|
||||
int i = l, j = r;
|
||||
T pivot = V[l + (r-l)/2];
|
||||
|
||||
while (i <= j) {
|
||||
while (V[i] < pivot) i++;
|
||||
while (V[j] > pivot) j--;
|
||||
if (i <= j) {
|
||||
std::swap(V[i],V[j]);
|
||||
std::swap(index[i],index[j]);
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
};
|
||||
|
||||
if (l < j) QuickSort(V, index, l, j);
|
||||
if (i < r) QuickSort(V, index, i, r);
|
||||
}
|
||||
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Vect.h
|
||||
File: ABACUS_Vect.h
|
||||
|
||||
Purpose: Declares vector class.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _JSC_VECT_
|
||||
#define _JSC_VECT_
|
||||
#ifndef ABACUS_VECT_H
|
||||
#define ABACUS_VECT_H
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
template <class T>
|
||||
class Vect {
|
||||
|
@ -32,7 +32,7 @@ namespace JSC {
|
|||
Vect& operator= (const T& a); // assign a to all elements
|
||||
inline T& operator[] (const int i);
|
||||
inline const T& operator[] (const int i) const;
|
||||
Vect& operator+= (const Vect& rhs);
|
||||
Vect& operator+= (const Vect& rhs);
|
||||
Vect& operator-= (const Vect& rhs);
|
||||
bool operator== (const Vect& rhs); // checks equality of size and of all elements
|
||||
bool operator!= (const Vect& rhs); // checks inequality
|
||||
|
@ -52,31 +52,31 @@ namespace JSC {
|
|||
void QuickSort (Vect<int>& index);
|
||||
~Vect();
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
Vect<T>::Vect() : dim(0), V(0) {}
|
||||
|
||||
|
||||
template <class T>
|
||||
Vect<T>::Vect (int N) : dim(N), V(new T[N]) {}
|
||||
|
||||
|
||||
template <class T>
|
||||
Vect<T>::Vect (const T& a, int N) : dim(N), V(new T[N])
|
||||
{
|
||||
for (int i = 0; i < N; ++i) V[i] = a;
|
||||
}
|
||||
|
||||
{
|
||||
for (int i = 0; i < N; ++i) V[i] = a;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Vect<T>::Vect (const T* a, int N) : dim(N), V(new T[N])
|
||||
{
|
||||
for (int i = 0; i < N; ++i) V[i] = *a++;
|
||||
}
|
||||
|
||||
{
|
||||
for (int i = 0; i < N; ++i) V[i] = *a++;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Vect<T>::Vect (const Vect<T>& rhs) : dim(rhs.dim), V(new T[dim])
|
||||
{
|
||||
for (int i = 0; i < dim; ++i) V[i] = rhs[i];
|
||||
}
|
||||
|
||||
{
|
||||
for (int i = 0; i < dim; ++i) V[i] = rhs[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Vect<T>& Vect<T>::operator= (const Vect<T>& rhs)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace JSC {
|
|||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
Vect<T>& Vect<T>::operator= (const T& a)
|
||||
{
|
||||
|
@ -100,15 +100,15 @@ namespace JSC {
|
|||
|
||||
template <class T>
|
||||
inline T& Vect<T>::operator[] (const int i)
|
||||
{
|
||||
return V[i];
|
||||
}
|
||||
|
||||
{
|
||||
return V[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T& Vect<T>::operator[] (const int i) const
|
||||
{
|
||||
return V[i];
|
||||
}
|
||||
{
|
||||
return V[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Vect<T>& Vect<T>::operator+= (const Vect<T>& rhs)
|
||||
|
@ -116,7 +116,7 @@ namespace JSC {
|
|||
for (int i = 0; i < dim; ++i) V[i] += rhs[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
Vect<T>& Vect<T>::operator-= (const Vect<T>& rhs)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ namespace JSC {
|
|||
bool Vect<T>::operator!= (const Vect<T>& rhs)
|
||||
{
|
||||
return(!((*this) == rhs));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Vect<T>::Append (const Vect<T>& rhs) // appends rhs to the vector
|
||||
|
@ -180,7 +180,7 @@ namespace JSC {
|
|||
int resized_dim = dim + nr_to_add;
|
||||
|
||||
T* resized_vect = new T[resized_dim];
|
||||
for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];
|
||||
for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];
|
||||
for (int i = dim; i < resized_dim; ++i) resized_vect[i] = T(0);
|
||||
|
||||
dim = resized_dim;
|
||||
|
@ -199,7 +199,7 @@ namespace JSC {
|
|||
int resized_dim = dim + nr_to_add;
|
||||
|
||||
T* resized_vect = new T[resized_dim];
|
||||
for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];
|
||||
for (int i = 0; i < dim; ++i) resized_vect[i] = V[i];
|
||||
for (int i = dim; i < resized_dim; ++i) resized_vect[i] = setval;
|
||||
|
||||
dim = resized_dim;
|
||||
|
@ -215,12 +215,12 @@ namespace JSC {
|
|||
|
||||
template <class T>
|
||||
inline int Vect<T>::size() const
|
||||
{
|
||||
return dim;
|
||||
}
|
||||
{
|
||||
return dim;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline double Vect<T>::norm () const
|
||||
inline double Vect<T>::norm () const
|
||||
{
|
||||
double normsq = 0.0;
|
||||
for (int i = 0; i < dim; ++i) normsq += abs(V[i]) * abs(V[i]);
|
||||
|
@ -228,7 +228,7 @@ namespace JSC {
|
|||
}
|
||||
|
||||
template <>
|
||||
inline double Vect<double>::norm () const
|
||||
inline double Vect<double>::norm () const
|
||||
{
|
||||
double normsq = 0.0;
|
||||
for (int i = 0; i < dim; ++i) normsq += V[i] * V[i];
|
||||
|
@ -236,7 +236,7 @@ namespace JSC {
|
|||
}
|
||||
|
||||
template <>
|
||||
inline double Vect<complex<double> >::norm () const
|
||||
inline double Vect<std::complex<double> >::norm () const
|
||||
{
|
||||
double normsq = 0.0;
|
||||
for (int i = 0; i < dim; ++i) normsq += std::norm(V[i]);
|
||||
|
@ -262,7 +262,7 @@ namespace JSC {
|
|||
template <class T>
|
||||
inline T Vect<T>::sum() const
|
||||
{
|
||||
T total = T(0);
|
||||
T total = T(0);
|
||||
for (int i = 0; i < dim; ++i) total += V[i];
|
||||
return total;
|
||||
}
|
||||
|
@ -275,69 +275,13 @@ namespace JSC {
|
|||
|
||||
return(index < dim);
|
||||
}
|
||||
/*
|
||||
template <class T>
|
||||
void Vect<T>::QuickSort (int l, int r)
|
||||
{
|
||||
//cout << "QuickSort called for l = " << l << "\t r = " << r << endl;
|
||||
//cout << (*this) << endl;
|
||||
//for (int ih = l; ih <= r; ++ih) cout << setprecision(16) << "ih = " << ih << "\tV[ih] = " << V[ih] << endl;
|
||||
|
||||
static T m;
|
||||
static int j;
|
||||
int i;
|
||||
|
||||
if (r > l) {
|
||||
m = V[r]; i = l-1; j = r;
|
||||
|
||||
for (;;) {
|
||||
while (V[++i] < m);
|
||||
while (V[--j] > m);
|
||||
if (i >= j) break;
|
||||
std::swap(V[i], V[j]);
|
||||
}
|
||||
std::swap(V[i], V[r]);
|
||||
|
||||
(*this).QuickSort(l, i-1);
|
||||
(*this).QuickSort(i+1, r);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
template <class T>
|
||||
void Vect<T>::QuickSort (int l, int r)
|
||||
{
|
||||
// My own version of QuickSort: add sentinels on left and right
|
||||
if (r > l) {
|
||||
int s = l + (r-l)/2; // central element index
|
||||
// Rearrange so that V[l] <= V[s] <= V[r] (sentinels on left and right)
|
||||
if (V[l] > V[r]) std::swap(V[l],V[r]);
|
||||
if (V[s] > V[r]) std::swap(V[s],V[r]);
|
||||
if (V[l] > V[s]) std::swap(V[l],V[s]);
|
||||
m = V[s]; i = l-1; j = r;
|
||||
//m = V[r]; i = l-1; j = r;
|
||||
|
||||
for (;;) {
|
||||
while (V[i] < m) i++;
|
||||
while (V[j] > m) j--;
|
||||
if (i >= j) break;
|
||||
std::swap(V[i], V[j]); // restart from indices i and j just used, in case one is pivot
|
||||
}
|
||||
//std::swap(V[i], V[r]);
|
||||
|
||||
(*this).QuickSort(l, i-1);
|
||||
(*this).QuickSort(i+1, r);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
void Vect<T>::QuickSort (int l, int r)
|
||||
{
|
||||
int i = l, j = r;
|
||||
T pivot = V[l + (r-l)/2];
|
||||
|
||||
|
||||
while (i <= j) {
|
||||
while (V[i] < pivot) i++;
|
||||
while (V[j] > pivot) j--;
|
||||
|
@ -347,7 +291,7 @@ namespace JSC {
|
|||
j--;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (l < j) (*this).QuickSort(l, j);
|
||||
if (i < r) (*this).QuickSort(i, r);
|
||||
}
|
||||
|
@ -358,71 +302,12 @@ namespace JSC {
|
|||
if ((*this).size() > 1) (*this).QuickSort (0, (*this).size() - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
template <class T>
|
||||
void Vect<T>::QuickSort (Vect<int>& index, int l, int r)
|
||||
{
|
||||
if (index.size() != (*this).size()) {
|
||||
cout << (*this).size() << "\t" << index.size() << endl;
|
||||
JSCerror("Wrong dim for index in Vect QuickSort.");
|
||||
}
|
||||
|
||||
static T m;
|
||||
static int j;
|
||||
int i;
|
||||
|
||||
if (r > l) {
|
||||
m = V[r]; i = l-1; j = r;
|
||||
|
||||
for (;;) {
|
||||
while (V[++i] < m);
|
||||
while (V[--j] > m);
|
||||
if (i >= j) break;
|
||||
std::swap(V[i], V[j]);
|
||||
std::swap(index[i], index[j]);
|
||||
}
|
||||
std::swap(V[i], V[r]);
|
||||
std::swap(index[i], index[r]);
|
||||
|
||||
(*this).QuickSort(index, l, i-1);
|
||||
(*this).QuickSort(index, i+1, r);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
template <class T>
|
||||
void Vect<T>::QuickSort (Vect<int>& index, int l, int r)
|
||||
{
|
||||
// My own version of QuickSort:
|
||||
if (r > l) {
|
||||
int s = l + (r-l)/2; // central element index
|
||||
// Rearrange so that V[l] <= V[s] <= V[r] (sentinels on left and right)
|
||||
if (V[l] > V[r]) std::swap(V[l],V[r]);
|
||||
if (V[s] > V[r]) std::swap(V[s],V[r]);
|
||||
if (V[l] > V[s]) std::swap(V[l],V[s]);
|
||||
m = V[s]; i = l-1; j = r+1;
|
||||
|
||||
for (;;) {
|
||||
while (V[++i] < m);
|
||||
while (V[--j] > m);
|
||||
if (i >= j) break;
|
||||
std::swap(index[i], index[j]);
|
||||
std::swap(V[i--], V[j++]); // restart from indices i and j just used, in case one is pivot
|
||||
}
|
||||
|
||||
(*this).QuickSort(index, l, i-1);
|
||||
(*this).QuickSort(index, i+1, r);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
void Vect<T>::QuickSort (Vect<int>& index, int l, int r)
|
||||
{
|
||||
int i = l, j = r;
|
||||
T pivot = V[l + (r-l)/2];
|
||||
|
||||
|
||||
while (i <= j) {
|
||||
while (V[i] < pivot) i++;
|
||||
while (V[j] > pivot) j--;
|
||||
|
@ -433,7 +318,7 @@ namespace JSC {
|
|||
j--;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (l < j) (*this).QuickSort(index, l, j);
|
||||
if (i < r) (*this).QuickSort(index, i, r);
|
||||
}
|
||||
|
@ -441,32 +326,32 @@ namespace JSC {
|
|||
template <class T>
|
||||
void Vect<T>::QuickSort (Vect<int>& index)
|
||||
{
|
||||
if (index.size() != (*this).size()) JSCerror("Wrong dim for index in Vect QuickSort.");
|
||||
if (index.size() != (*this).size()) ABACUSerror("Wrong dim for index in Vect QuickSort.");
|
||||
(*this).QuickSort (index, 0, (*this).size() - 1);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::ostream& operator<< (std::ostream& s, const Vect<T>& vector)
|
||||
{
|
||||
for (int i = 0; i < vector.size() - 1; ++i) s << vector[i] << " ";
|
||||
if (vector.size() >= 1) s << vector[vector.size() - 1];
|
||||
inline std::ostream& operator<< (std::ostream& s, const Vect<T>& vector)
|
||||
{
|
||||
for (int i = 0; i < vector.size() - 1; ++i) s << vector[i] << " ";
|
||||
if (vector.size() >= 1) s << vector[vector.size() - 1];
|
||||
|
||||
return (s);
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Vect<T>::~Vect<T>()
|
||||
{
|
||||
if (V != 0) delete[] V;
|
||||
}
|
||||
{
|
||||
if (V != 0) delete[] V;
|
||||
}
|
||||
|
||||
|
||||
// TYPEDEFS
|
||||
typedef JSC::Vect<int> Vect_INT;
|
||||
typedef JSC::Vect<double> Vect_DP;
|
||||
typedef JSC::Vect<complex<double> > Vect_CX;
|
||||
// TYPEDEFS
|
||||
typedef ABACUS::Vect<int> Vect_INT;
|
||||
typedef ABACUS::Vect<double> Vect_DP;
|
||||
typedef ABACUS::Vect<std::complex<double> > Vect_CX;
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,56 +2,58 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_XXX_h0.h
|
||||
|
||||
Purpose: Declares classes for XXX in zero field: Uq(sl(2)) stuff.
|
||||
File: ABACUS_XXX_VOA.h
|
||||
|
||||
Purpose: Declares classes for XXX in zero field: Vertex Operator Approach
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _XXX_h0_
|
||||
#define _XXX_h0_
|
||||
#ifndef ABACUS_XXX_VOA_H
|
||||
#define ABACUS_XXX_VOA_H
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
const DP default_req_prec = 1.0e-14;
|
||||
const int default_max_rec = 10;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
inline DP Integrand_11 (Vect_DP args)
|
||||
{
|
||||
// args[0] corresponds to t, args[1] to rho
|
||||
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]);
|
||||
}
|
||||
|
||||
{
|
||||
// args[0] corresponds to t, args[1] to rho
|
||||
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]);
|
||||
}
|
||||
|
||||
inline DP Integrand_12 (Vect_DP args)
|
||||
{
|
||||
DP expm2t = exp(-2.0*args[0]);
|
||||
return(cos(4.0 * args[0] * args[1]) * expm2t * (3.0 + expm2t)/ (args[0] * (1.0 + expm2t) * (1.0 + expm2t)));
|
||||
}
|
||||
|
||||
{
|
||||
DP expm2t = exp(-2.0*args[0]);
|
||||
return(cos(4.0 * args[0] * args[1]) * expm2t * (3.0 + expm2t)/ (args[0] * (1.0 + expm2t) * (1.0 + expm2t)));
|
||||
}
|
||||
|
||||
inline DP Integrand_2 (Vect_DP args)
|
||||
{
|
||||
DP answer = 0.0;
|
||||
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));
|
||||
else if (args[0] >= 1.0) {
|
||||
DP expm2t = exp(-2.0 * args[0]);
|
||||
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));
|
||||
}
|
||||
return(answer);
|
||||
{
|
||||
DP answer = 0.0;
|
||||
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));
|
||||
else if (args[0] >= 1.0) {
|
||||
DP expm2t = exp(-2.0 * args[0]);
|
||||
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));
|
||||
}
|
||||
|
||||
return(answer);
|
||||
}
|
||||
|
||||
inline DP Integrand_A (Vect_DP args)
|
||||
{
|
||||
// This kernel is for -ln | A_-(i\pi/2) | function
|
||||
return(exp(args[0]) * pow(sinh(args[0]/2.0), 2.0)/(args[0] * sinh(2.0*args[0]) * cosh(args[0])));
|
||||
}
|
||||
|
||||
{
|
||||
// This kernel is for -ln | A_-(i\pi/2) | function
|
||||
return(exp(args[0]) * pow(sinh(args[0]/2.0), 2.0)/(args[0] * sinh(2.0*args[0]) * cosh(args[0])));
|
||||
}
|
||||
|
||||
DP I_integral (DP rho, DP req_prec);
|
||||
|
||||
|
||||
|
@ -73,32 +75,32 @@ namespace JSC {
|
|||
DP SF_2p_check_fixed_k_sumrule_opt (DP k, DP req_prec, int Npts, I_table Itable);
|
||||
|
||||
|
||||
/********************** FOUR SPINONS **********************/
|
||||
/********************** FOUR SPINONS **********************/
|
||||
|
||||
DP Sum_norm_gl (Vect_DP rho, DP req_prec);
|
||||
DP Compute_C4 (DP req_prec);
|
||||
DP SF_contrib (Vect_DP p, DP req_prec, I_table Itable);
|
||||
DP J_fn (Vect_DP p, DP req_prec, I_table Itable);
|
||||
inline DP Jacobian_p3p4_KW (DP k, DP w, DP K, DP W)
|
||||
{
|
||||
return(1.0/sqrt(pow(twoPI * sin(0.5 * (k - K)), 2.0) - (w-W)*(w-W)));
|
||||
}
|
||||
{
|
||||
return(1.0/sqrt(pow(twoPI * sin(0.5 * (k - K)), 2.0) - (w-W)*(w-W)));
|
||||
}
|
||||
bool Set_p_given_kwKW (DP k, DP w, DP K, DP W, Vect_DP& p);
|
||||
inline DP wmin_4p (DP k)
|
||||
{
|
||||
return(PI * fabs(sin(k)));
|
||||
}
|
||||
}
|
||||
inline DP wmax_4p (DP k)
|
||||
{
|
||||
return(2.0 * PI * sqrt(2.0 * (1.0 + fabs(cos(0.5*k)))));
|
||||
}
|
||||
inline DP Wmin (DP k, DP w, DP K)
|
||||
{
|
||||
return(JSC::max(1.0e-15, JSC::max(fabs(PI * sin(K)), w - twoPI * sin(0.5 * (fabs(k-K))))));
|
||||
return(ABACUS::max(1.0e-15, ABACUS::max(fabs(PI * sin(K)), w - twoPI * sin(0.5 * (fabs(k-K))))));
|
||||
}
|
||||
inline DP Wmax (DP k, DP w, DP K)
|
||||
{
|
||||
return(JSC::min(twoPI * sin(0.5 * K), w - fabs(PI * sin(k - K))));
|
||||
return(ABACUS::min(twoPI * sin(0.5 * K), w - fabs(PI * sin(k - K))));
|
||||
}
|
||||
DP G_fn (Vect_DP args_to_G, I_table Itable);
|
||||
DP G1_fn (Vect_DP args_to_G, I_table Itable);
|
||||
|
@ -134,6 +136,6 @@ namespace JSC {
|
|||
DP Direct_J_integral_bin (int Npts_p, int Npts_o, DP req_prec, I_table Itable);
|
||||
void Smoothen_raw_SF_4p (int Npts_p, int Npts_o, DP req_prec, DP width);
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS_XXZ_VOA.h
|
||||
|
||||
Purpose: Declares classes for XXZ in zero field: Vertex Operator Approach
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef ABACUS_XXZ_VOA_H
|
||||
#define ABACUS_XXZ_VOA_H
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP I_xi_integral (DP xi, DP rho, DP req_prec, int max_nr_pts);
|
||||
|
||||
/********************* TWO SPINONS ********************/
|
||||
DP Szz_XXZ_h0_2spinons (DP k, DP omega, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_alt (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_omega (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_omega_alt (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_intomega (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_intomega_alt (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_check_sumrule (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_check_sumrule_alt (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
|
||||
DP Fixed_k_sumrule_omega_Szz_XXZ_h0_N (DP Delta, DP k);
|
||||
DP GSE_XXZ_h0 (DP Delta, DP req_prec, int max_nr_pts);
|
||||
DP Fixed_k_sumrule_omega_Szz_XXZ_h0 (DP Delta, DP k, DP req_prec, int max_nr_pts);
|
||||
DP Szz_XXZ_h0_2spinons_check_fixed_k_Szz_sumrule (DP Delta, DP k, DP req_prec, int max_nr_pts, Integral_table Itable);
|
||||
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);
|
||||
|
||||
//******************************** Functions to produce files similar to ABACUS **********************************
|
||||
void Produce_Szz_XXZ_h0_2spinons_file (DP Delta, int N, int Nomega, DP omegamax, Integral_table Itable);
|
||||
void Produce_Szz_XXZ_h0_2spinons_fixed_K_file (DP Delta, DP Kover2PI, int Nomega, Integral_table Itable);
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Young.h
|
||||
File: ABACUS_Young.h
|
||||
|
||||
Purpose: Declares Young tableau class.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _YOUNG_
|
||||
#define _YOUNG_
|
||||
#ifndef ABACUS_YOUNG_H
|
||||
#define ABACUS_YOUNG_H
|
||||
|
||||
#include "JSC_Vect.h"
|
||||
#include "ABACUS_Vect.h"
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
const int YOUNG_TABLEAU_ID_OPTION = 0;
|
||||
const long long int TABLEAU_ID_UPPER_LIMIT = 10000000LL;
|
||||
|
@ -32,7 +32,7 @@ namespace JSC {
|
|||
int* Row_L;
|
||||
int* Col_L;
|
||||
long long int id; // identification number
|
||||
long long int maxid;
|
||||
long long int maxid;
|
||||
long long int* map;
|
||||
bool map_computed;
|
||||
long long int idnr_reached;
|
||||
|
@ -59,11 +59,11 @@ namespace JSC {
|
|||
Young_Tableau& Set_Row_L (Vect<int>& Row_Lengths); // set row lengths
|
||||
Young_Tableau& Set_Col_L_given_Row_L (); // sets the Col_L array self-consistently
|
||||
Young_Tableau& Set_Row_L_given_Col_L (); // sets the Col_L array self-consistently
|
||||
long long int Compute_Descendent_id (int option, Vect<int>& Desc_Row_L, int Nrows_Desc, int Ncols_Desc,
|
||||
long long int Compute_Descendent_id (int option, Vect<int>& Desc_Row_L, int Nrows_Desc, int Ncols_Desc,
|
||||
const Young_Tableau& RefTableau);
|
||||
Young_Tableau& Compute_id(); // computes the id number of tableau
|
||||
Young_Tableau& Compute_id(int option); // computes the id number of tableau according to rule option
|
||||
Young_Tableau& Print(); // couts the tableau
|
||||
Young_Tableau& Print(); // couts the tableau
|
||||
|
||||
bool Lower_Row (int i);
|
||||
bool Raise_Row (int i);
|
||||
|
@ -104,15 +104,15 @@ namespace JSC {
|
|||
Vect<long long int> map;
|
||||
long long int idnr_reached;
|
||||
int nboxes_reached;
|
||||
|
||||
|
||||
public:
|
||||
Tableau_Map (int Nrows, int Ncols);
|
||||
void Distribute_id (int nboxes_to_dist, int level, Young_Tableau& RefTableau);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
#endif
|
|
@ -1,777 +0,0 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis.h
|
||||
|
||||
Purpose: Declares Heisenberg chain classes and functions.
|
||||
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _HEIS_
|
||||
#define _HEIS_
|
||||
|
||||
#include "JSC.h"
|
||||
|
||||
namespace JSC {
|
||||
|
||||
// First, some global constants...
|
||||
|
||||
const long long int ID_UPPER_LIMIT = 10000000LL; // max size of vectors we can define without seg fault
|
||||
const int INTERVALS_SIZE = 100000; // size of Scan_Intervals arrays
|
||||
const int NBASESMAX = 1000; // max number of bases kept
|
||||
|
||||
const DP ITER_REQ_PREC = 100.0 * MACHINE_EPS_SQ;
|
||||
//const DP ITER_REQ_PREC = MACHINE_EPS_SQ;
|
||||
|
||||
// Cutoffs on particle numbers
|
||||
//const int NPARTICLES_MAX = 24;
|
||||
//const int NHOLES_MAX = NPARTICLES_MAX/2;
|
||||
//const int MAX_RAPS_ABOVE_ZERO = 10; // max nr of rapidities above lowest type
|
||||
//const int NPARTICLES_MAX = 2;
|
||||
//const int NHOLES_MAX = 1;
|
||||
//const int MAX_TYPES_IN_BASE = 4; // maximal number of particle types we allow in bases
|
||||
const int MAXSTRINGS = 20; // maximal number of particle types we allow in bases
|
||||
//const int MAXSTRINGS = 2; // maximal number of particle types we allow in bases
|
||||
//const DP HEIS_deltaprec = 1.0e-6;//1.0e-4; // maximal string deviation allowed // DEPRECATED in ++T_9
|
||||
|
||||
const int NEXC_MAX_HEIS = 16; // maximal number of excitations (string binding/unbinding, particle-hole) considered
|
||||
|
||||
//***********************************************************************
|
||||
|
||||
class Heis_Chain {
|
||||
|
||||
public:
|
||||
DP J;
|
||||
DP Delta;
|
||||
DP anis; // acos(Delta) if Delta < 1.0, 0 if Delta == 1.0, acosh(Delta) if Delta > 1.0
|
||||
DP hz;
|
||||
int Nsites;
|
||||
int Nstrings; // how many possible strings. The following two arrays have Nstrings nonzero elements.
|
||||
int* Str_L; // vector (length M) containing the allowed string lengths. Elements that are 0 have no meaning.
|
||||
int* par; // vector (length M) containing the parities of the strings. Elements that are 0 have no meaning.
|
||||
// Parities are all +1 except for gapless XXZ subcases
|
||||
DP* si_n_anis_over_2; // for optimization: sin for XXZ, sinh for XXZ_gpd
|
||||
DP* co_n_anis_over_2; // for optimization
|
||||
DP* ta_n_anis_over_2; // for optimization
|
||||
DP prec; // precision required for computations, always put to ITER_REQ_PREC
|
||||
|
||||
public:
|
||||
Heis_Chain ();
|
||||
Heis_Chain (DP JJ, DP DD, DP hh, int NN); // contructor: simply initializes
|
||||
Heis_Chain (const Heis_Chain& RefChain); // copy constructor;
|
||||
Heis_Chain& operator= (const Heis_Chain& RefChain);
|
||||
bool operator== (const Heis_Chain& RefChain);
|
||||
bool operator!= (const Heis_Chain& RefChain);
|
||||
~Heis_Chain(); // destructor
|
||||
|
||||
public:
|
||||
//void Scan_for_Possible_Bases (int Mdown, Vect<long long int>& possible_base_id, int& nfound, int nexc_max_used,
|
||||
// int base_level_to_scan, Vect<int>& Nrapidities);
|
||||
//Vect<long long int> Possible_Bases (int Mdown); // returns a vector of possible bases
|
||||
/* Deactivated in ++G_8
|
||||
void Scan_for_Possible_Bases (int Mdown, Vect<string>& possible_base_label, int& nfound, int nexc_max_used,
|
||||
int base_level_to_scan, Vect<int>& Nrapidities);
|
||||
Vect<string> Possible_Bases (int Mdown); // returns a vector of possible bases
|
||||
*/
|
||||
};
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Heis_Base are a checked vector containing the number of rapidities of allowable types for a given state
|
||||
|
||||
class Heis_Base {
|
||||
|
||||
public:
|
||||
int Mdown; // total number of down spins
|
||||
Vect<int> Nrap; // Nrap[i] contains the number of rapidities of type i, i = 0, Nstrings - 1.
|
||||
int Nraptot; // total number of strings in this state
|
||||
Vect<DP> Ix2_infty; // Ix2_infty[i] contains the max of BAE function for the (half-)integer I[i], i = 0, Nstrings - 1.
|
||||
Vect<int> Ix2_min;
|
||||
Vect<int> Ix2_max; // Ix2_max[i] contains the integer part of 2*I_infty, with correct parity for base.
|
||||
//long long int id; // identification number
|
||||
double dimH; // dimension of sub Hilbert space associated to this base; use double to avoid max int problems.
|
||||
string baselabel; // base label
|
||||
|
||||
public:
|
||||
Heis_Base ();
|
||||
Heis_Base (const Heis_Base& RefBase); // copy constructor
|
||||
Heis_Base (const Heis_Chain& RefChain, int M); // constructs configuration with all Mdown in one-string of +1 parity
|
||||
Heis_Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities); // sets to Nrapidities vector, and checks consistency
|
||||
//Heis_Base (const Heis_Chain& RefChain, long long int id_ref);
|
||||
Heis_Base (const Heis_Chain& RefChain, string baselabel_ref);
|
||||
inline int& operator[] (const int i);
|
||||
inline const int& operator[] (const int i) const;
|
||||
Heis_Base& operator= (const Heis_Base& RefBase);
|
||||
bool operator== (const Heis_Base& RefBase);
|
||||
bool operator!= (const Heis_Base& RefBase);
|
||||
|
||||
void Compute_Ix2_limits(const Heis_Chain& RefChain); // computes the Ix2_infty and Ix2_max
|
||||
|
||||
//void Scan_for_Possible_Types (Vect<long long int>& possible_type_id, int& nfound, int base_level, Vect<int>& Nexcitations);
|
||||
//Vect<long long int> Possible_Types (); // returns a vector of possible types
|
||||
|
||||
};
|
||||
|
||||
inline int& Heis_Base::operator[] (const int i)
|
||||
{
|
||||
return Nrap[i];
|
||||
}
|
||||
|
||||
inline const int& Heis_Base::operator[] (const int i) const
|
||||
{
|
||||
return Nrap[i];
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
/*
|
||||
// Objects in class Ix2_Config carry all the I's of a given state
|
||||
|
||||
class Ix2_Config {
|
||||
|
||||
//private:
|
||||
public:
|
||||
int Nstrings;
|
||||
Vect<int> Nrap;
|
||||
int Nraptot;
|
||||
|
||||
//int** Ix2;
|
||||
Vect<Vect<int> > Ix2;
|
||||
|
||||
public:
|
||||
Ix2_Config ();
|
||||
Ix2_Config (const Heis_Chain& RefChain, int M); // constructor, puts I's to ground state
|
||||
Ix2_Config (const Heis_Chain& RefChain, const Heis_Base& base); // constructor, putting I's to lowest-energy config
|
||||
// consistent with Heis_Base configuration for chain RefChain
|
||||
Ix2_Config& operator= (const Ix2_Config& RefConfig);
|
||||
//inline int* operator[] (const int i);
|
||||
inline Vect<int> operator[] (const int i);
|
||||
//inline const int* operator[] (const int i) const;
|
||||
inline const Vect<int> operator[] (const int i) const;
|
||||
//~Ix2_Config(); // not needed, inherited from Vect
|
||||
string Return_Label (const Ix2_Config& OriginIx2);
|
||||
};
|
||||
|
||||
//inline int* Ix2_Config::operator[] (const int i)
|
||||
inline Vect<int> Ix2_Config::operator[] (const int i)
|
||||
{
|
||||
return Ix2[i];
|
||||
}
|
||||
|
||||
//inline const int* Ix2_Config::operator[] (const int i) const
|
||||
inline const Vect<int> Ix2_Config::operator[] (const int i) const
|
||||
{
|
||||
return Ix2[i];
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const Ix2_Config& RefConfig);
|
||||
*/
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Lambda carry all rapidities of a state
|
||||
|
||||
class Lambda {
|
||||
|
||||
private:
|
||||
int Nstrings;
|
||||
Vect<int> Nrap;
|
||||
int Nraptot;
|
||||
DP** lambda;
|
||||
//Vect<Vect<DP> > lambda;
|
||||
|
||||
public:
|
||||
Lambda ();
|
||||
Lambda (const Heis_Chain& RefChain, int M); // constructor, puts all lambda's to zero
|
||||
Lambda (const Heis_Chain& RefChain, const Heis_Base& base); // constructor, putting I's to lowest-energy config
|
||||
// consistent with Heis_Base configuration for chain RefChain
|
||||
Lambda& operator= (const Lambda& RefConfig);
|
||||
inline DP* operator[] (const int i);
|
||||
//inline Vect<DP> operator[] (const int i);
|
||||
inline const DP* operator[] (const int i) const;
|
||||
//inline const Vect<DP> operator[] (const int i) const;
|
||||
~Lambda();
|
||||
|
||||
};
|
||||
|
||||
inline DP* Lambda::operator[] (const int i)
|
||||
//inline Vect<DP> Lambda::operator[] (const int i)
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
inline const DP* Lambda::operator[] (const int i) const
|
||||
//inline const Vect<DP> Lambda::operator[] (const int i) const
|
||||
{
|
||||
return lambda[i];
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Ix2_Offsets carry Young tableau representations of the Ix2 configurations
|
||||
/*
|
||||
class Ix2_Offsets {
|
||||
|
||||
public:
|
||||
Heis_Base base;
|
||||
Vect<Young_Tableau> Tableau; // vector of pointers to tableaux at each level
|
||||
long long int type_id;
|
||||
long long int id; // id number of offset
|
||||
long long int maxid; // max id number allowable
|
||||
|
||||
public:
|
||||
Ix2_Offsets ();
|
||||
Ix2_Offsets (const Ix2_Offsets& RefOffset); // copy constructor
|
||||
Ix2_Offsets (const Heis_Base& RefBase, long long int req_type_id);
|
||||
Ix2_Offsets (const Heis_Base& RefBase, Vect<int> nparticles); // sets all tableaux to empty ones, with nparticles[] at each level
|
||||
Ix2_Offsets& operator= (const Ix2_Offsets& RefOffset);
|
||||
bool operator<= (const Ix2_Offsets& RefOffsets);
|
||||
bool operator>= (const Ix2_Offsets& RefOffsets);
|
||||
|
||||
public:
|
||||
void Set_to_id (long long int idnr);
|
||||
void Compute_id ();
|
||||
void Compute_type_id ();
|
||||
|
||||
public:
|
||||
bool Add_Boxes_From_Lowest (int Nboxes, bool odd_sectors); // adds Nboxes in minimal energy config, all boxes in either even or odd sectors
|
||||
|
||||
};
|
||||
|
||||
inline long long int Ix2_Offsets_type_id (Vect<int>& nparticles)
|
||||
{
|
||||
long long int type_id_here = 0ULL;
|
||||
|
||||
for (int i = 0; i < nparticles.size(); ++i)
|
||||
type_id_here += nparticles[i] * pow_ulli(10ULL, i);
|
||||
|
||||
return(type_id_here);
|
||||
}
|
||||
|
||||
long long int Find_idmin (Ix2_Offsets& scan_offsets, int particle_type, int tableau_level, int Row_L_min);
|
||||
long long int Find_idmax (Ix2_Offsets& scan_offsets, int particle_type, int tableau_level);
|
||||
*/
|
||||
//****************************************************************************
|
||||
// Objects in class Ix2_Offsets_List carry a vector of used Ix2_Offsets
|
||||
/*
|
||||
class Ix2_Offsets_List {
|
||||
|
||||
public:
|
||||
int ndef;
|
||||
Vect<Ix2_Offsets> Offsets;
|
||||
|
||||
public:
|
||||
Ix2_Offsets_List ();
|
||||
Ix2_Offsets& Return_Offsets (Heis_Base& RefBase, Vect<int> nparticles); // returns the Ix2_Offsets corresponding to nparticles[]/base
|
||||
Ix2_Offsets& Return_Offsets (Heis_Base& RefBase, long long int req_type_id);
|
||||
};
|
||||
*/
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class Heis_Bethe_State carry all information about an eigenstate
|
||||
|
||||
// Derived classes include XXZ_Bethe_State, XXX_Bethe_State, XXZ_gpd_Bethe_State
|
||||
// These contain subclass-specific functions and data.
|
||||
|
||||
class Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
Heis_Chain chain;
|
||||
Heis_Base base;
|
||||
//Ix2_Offsets offsets;
|
||||
//Ix2_Config Ix2;
|
||||
Vect<Vect<int> > Ix2;
|
||||
Lambda lambda;
|
||||
Lambda deviation; // string deviations
|
||||
Lambda BE; // Bethe equation for relevant rapidity, in the form BE = theta - (1/N)\sum ... - \pi I/N = 0
|
||||
DP diffsq; // sum of squares of rapidity differences in last iteration
|
||||
int conv; // convergence status
|
||||
DP dev; // sum of absolute values of string deviations
|
||||
int iter; // number of iterations necessary for convergence
|
||||
int iter_Newton; // number of iterations necessary for convergence (Newton method)
|
||||
DP E; // total energy
|
||||
int iK; // K = 2.0*PI * iK/Nsites
|
||||
DP K; // total momentum
|
||||
DP lnnorm; // ln of norm of reduced Gaudin matrix
|
||||
//long long int base_id;
|
||||
//long long int type_id;
|
||||
//long long int id;
|
||||
//long long int maxid;
|
||||
//int nparticles;
|
||||
string label;
|
||||
|
||||
public:
|
||||
Heis_Bethe_State ();
|
||||
Heis_Bethe_State (const Heis_Bethe_State& RefState); // copy constructor
|
||||
//Heis_Bethe_State (const Heis_Bethe_State& RefState, long long int type_id_ref); // new state with requested type_id
|
||||
Heis_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
Heis_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
//Heis_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref);
|
||||
virtual ~Heis_Bethe_State () {};
|
||||
|
||||
public:
|
||||
int Charge () { return(base.Mdown); };
|
||||
//void Set_Ix2_Offsets (const Ix2_Offsets& RefOffset); // sets the Ix2 to given offsets
|
||||
//void Set_to_id (long long int id_ref);
|
||||
//void Set_to_id (long long int id_ref, Heis_Bethe_State& RefState);
|
||||
//int Nparticles (); // counts the number of particles in state once Ix2 offsets set (so type_id is correctly set)
|
||||
//void Set_to_Label (string label_ref, const Ix2_Config& OriginIx2);
|
||||
void Set_to_Label (string label_ref, const Vect<Vect<int> >& OriginIx2);
|
||||
void Set_Label_from_Ix2 (const Vect<Vect<int> >& OriginIx2);
|
||||
bool Check_Symmetry (); // checks whether the I's are symmetrically distributed
|
||||
void Compute_diffsq (); // \sum BE[j][alpha]^2
|
||||
void Find_Rapidities (bool reset_rapidities); // Finds the rapidities
|
||||
void Find_Rapidities_Twisted (bool reset_rapidities, DP twist); // Finds the rapidities with twist added to RHS of logBE
|
||||
//void BAE_smackdown (DP max_allowed);
|
||||
//void Solve_BAE_smackdown (DP max_allowed, int maxruns);
|
||||
void Solve_BAE_bisect (int j, int alpha, DP req_prec, int itermax);
|
||||
void Iterate_BAE (DP iter_factor); // Finds new set of lambda[j][alpha] from previous one by simple iteration
|
||||
void Solve_BAE_straight_iter (DP straight_prec, int max_iter_interp, DP iter_factor);
|
||||
void Solve_BAE_extrap (DP extrap_prec, int max_iter_extrap, DP iter_factor);
|
||||
void Iterate_BAE_Newton (); // Finds new set of lambda[j][alpha] from previous one by a Newton step
|
||||
void Solve_BAE_Newton (DP Newton_prec, int max_iter_Newton);
|
||||
void Solve_BAE_with_silk_gloves (DP silk_prec, int max_iter_silk, DP iter_factor);
|
||||
void Compute_lnnorm ();
|
||||
void Compute_Momentum ();
|
||||
void Compute_All (bool reset_rapidities); // solves BAE, computes E, K and lnnorm
|
||||
|
||||
inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<Vect<int> >& OriginStateIx2)
|
||||
{
|
||||
Ix2[0][0] = Ix2[0][1] - 2;
|
||||
Ix2[0][base.Nrap[0] - 1] = Ix2[0][base.Nrap[0] - 2] + 2;
|
||||
(*this).Compute_Momentum();
|
||||
if (base.Nrap[0] == 0) return(false);
|
||||
if (iKneeded >= iK) Ix2[0][base.Nrap[0]-1] += 2*(iKneeded - iK);
|
||||
else Ix2[0][0] += 2*(iKneeded - iK);
|
||||
if (Ix2[0][0] < base.Ix2_min[0] || Ix2[0][base.Nrap[0]-1] > base.Ix2_max[0]) return(false);
|
||||
(*this).Set_Label_from_Ix2 (OriginStateIx2);
|
||||
return(true);
|
||||
}
|
||||
void Set_to_Outer_Skeleton (const Vect<Vect<int> >& OriginStateIx2) {
|
||||
Ix2[0][0] = base.Ix2_min[0] - 4;
|
||||
Ix2[0][base.Nrap[0]-1] = base.Ix2_max[0] + 4;
|
||||
(*this).Set_Label_from_Ix2 (OriginStateIx2);
|
||||
};
|
||||
|
||||
void Set_to_Closest_Matching_Ix2_fixed_Base (const Heis_Bethe_State& StateToMatch); // defined in Heis.cc
|
||||
|
||||
|
||||
// Virtual functions, all defined in the derived classes
|
||||
|
||||
public:
|
||||
virtual void Set_Free_lambdas() { JSCerror("Heis_Bethe_State::..."); } // sets the rapidities to solutions of BAEs without scattering terms
|
||||
virtual bool Check_Admissibility(char option) { JSCerror("Heis_Bethe_State::..."); return(false); }
|
||||
// verifies that we don't have a symmetrical Ix2 config with a Ix2 == 0 for a string of even length >= 2.
|
||||
virtual void Compute_BE (int j, int alpha) { JSCerror("Heis_Bethe_State::..."); }
|
||||
virtual void Compute_BE () { JSCerror("Heis_Bethe_State::..."); }
|
||||
virtual DP Iterate_BAE(int i, int alpha) { JSCerror("Heis_Bethe_State::..."); return(0.0);}
|
||||
virtual bool Check_Rapidities() { JSCerror("Heis_Bethe_State::..."); return(false); }
|
||||
virtual DP String_delta () { JSCerror("Heis_Bethe_State::..."); return(0.0); }
|
||||
virtual void Compute_Energy () { JSCerror("Heis_Bethe_State::..."); }
|
||||
virtual void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red) { JSCerror("Heis_Bethe_State::..."); }
|
||||
};
|
||||
|
||||
inline bool Is_Inner_Skeleton (Heis_Bethe_State& State) {
|
||||
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));
|
||||
};
|
||||
inline bool Is_Outer_Skeleton (Heis_Bethe_State& State) {
|
||||
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);
|
||||
};
|
||||
|
||||
inline bool Force_Descent (char whichDSF, Heis_Bethe_State& ScanState, Heis_Bethe_State& RefState, int desc_type_required, int iKmod, DP Chem_Pot)
|
||||
{
|
||||
bool force_descent = false;
|
||||
|
||||
// Force descent if energy of ScanState is lower than that of RefState
|
||||
//if (ScanState.E - RefState.E - (ScanState.base.Mdown - RefState.base.Mdown) < 0.0) return(true);
|
||||
/*
|
||||
// We force descent if
|
||||
// 1) - there exists a higher string whose quantum number is still on 0
|
||||
// AND - there is at most a single particle-hole in the 0 base level
|
||||
// AND - either the particle or the hole hasn't yet moved.
|
||||
if (ScanState.base_id/100000LL > 0) { // there is a higher string
|
||||
int type0 = ScanState.type_id % 10000;
|
||||
if (type0 == 0
|
||||
|| type0 == 101 && ScanState.offsets.Tableau[0].id * ScanState.offsets.Tableau[2].id == 0LL
|
||||
|| type0 == 110 && ScanState.offsets.Tableau[1].id * ScanState.offsets.Tableau[2].id == 0LL
|
||||
|| type0 == 1001 && ScanState.offsets.Tableau[0].id * ScanState.offsets.Tableau[3].id == 0LL
|
||||
|| type0 == 1010 && ScanState.offsets.Tableau[1].id * ScanState.offsets.Tableau[3].id == 0LL) // single p-h pair in base level 0
|
||||
for (int j = 1; j < ScanState.chain.Nstrings; ++j) {
|
||||
if (ScanState.base[j] == 1 && ScanState.Ix2[j][0] == 0) {
|
||||
force_descent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Force descent if quantum nr distribution is symmetric:
|
||||
//if (ScanState.Check_Symmetry()) force_descent = true;
|
||||
//if (desc_type_required > 8 && ScanState.Check_Symmetry()) force_descent = true;
|
||||
|
||||
// Force descent for longitudinal if we're at zero or pi momentum:
|
||||
//ScanState.Compute_Momentum();
|
||||
//if (whichDSF == 'z' && (ScanState.iK - RefState.iK) % iKmod == 0) force_descent = true;
|
||||
//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
|
||||
// Force descent for all DSFs if we're at K = 0 or PI and not conserving momentum upon descent:
|
||||
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
|
||||
|
||||
//if (force_descent) cout << "Forcing descent on state with label " << ScanState.label << endl;
|
||||
|
||||
if (ScanState.chain.Delta > 1.0) {
|
||||
/*
|
||||
// Count the nr of holes in one-strings:
|
||||
int nholes = 0;
|
||||
for (int i = 0; i < ScanState.base.Nrap[0] - 1; ++i) if (ScanState.Ix2[0][i+1] - ScanState.Ix2[0][i] != 2) nholes++;
|
||||
|
||||
if (nholes <= 2) {
|
||||
if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 2 && ScanState.base.Nrap[1] == 1) force_descent = true;
|
||||
if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 3 && ScanState.base.Nrap[2] == 1) force_descent = true;
|
||||
if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 4 && ScanState.base.Nrap[1] == 2) force_descent = true;
|
||||
}
|
||||
*/
|
||||
|
||||
if (ScanState.label.compare(0, 10, "14x1y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "14x1y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "14x1y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "14x1y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "14x1y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "14x1y1_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_0x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_1x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "12x1y2_2x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "13x2y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "13x2y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "13x2y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "13x2y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "13x2y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "13x2y1_2x1") == 0) force_descent = true;
|
||||
|
||||
if (ScanState.label.compare(0, 10, "30x1y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "30x1y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "30x1y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "30x1y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "30x1y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "30x1y1_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_0x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_1x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "28x1y2_2x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "29x2y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "29x2y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "29x2y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "29x2y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "29x2y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "29x2y1_2x1") == 0) force_descent = true;
|
||||
|
||||
if (ScanState.label.compare(0, 10, "46x1y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "46x1y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "46x1y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "46x1y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "46x1y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "46x1y1_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_0x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_1x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "44x1y2_2x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "45x2y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "45x2y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "45x2y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "45x2y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "45x2y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "45x2y1_2x1") == 0) force_descent = true;
|
||||
|
||||
|
||||
if (ScanState.label.compare(0, 10, "62x1y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "62x1y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "62x1y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "62x1y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "62x1y1_2x0") == 0) force_descent = true;
|
||||
//if (ScanState.label.compare(0, 10, "62x1y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "62x1y1_2x1") == 0
|
||||
&& (desc_type_required == 14 || desc_type_required == 13 || desc_type_required == 11 || desc_type_required == 10)) force_descent = true;
|
||||
/*
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_0x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_1x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_2x1") == 0 && desc_type_required < 2) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "60x1y2_2x2") == 0 && desc_type_required < 2) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "61x2y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "61x2y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "61x2y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "61x2y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "61x2y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "61x2y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
|
||||
*/
|
||||
|
||||
if (ScanState.label.compare(0, 11, "126x1y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "126x1y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "126x1y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "126x1y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "126x1y1_2x0") == 0) force_descent = true;
|
||||
//if (ScanState.label.compare(0, 11, "126x1y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "126x1y1_2x1") == 0
|
||||
&& (desc_type_required == 14 || desc_type_required == 13 || desc_type_required == 11 || desc_type_required == 10)) force_descent = true;
|
||||
/*
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_0x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_1x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_2x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "124x1y2_2x2") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "125x2y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "125x2y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "125x2y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "125x2y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "125x2y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 10, "125x2y1_2x1") == 0) force_descent = true;
|
||||
*/
|
||||
if (ScanState.label.compare(0, 11, "254x1y1_0x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "254x1y1_0x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "254x1y1_1x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "254x1y1_1x1") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "254x1y1_2x0") == 0) force_descent = true;
|
||||
if (ScanState.label.compare(0, 11, "254x1y1_2x1") == 0 && desc_type_required < 2) force_descent = true;
|
||||
|
||||
// Do not force descent a state with rapidities outside of fundamental interval:
|
||||
/*
|
||||
for (int j = 0; j < ScanState.chain.Nstrings; ++j) {
|
||||
// Logic: allow rapidities -PI/2 <= lambda <= PI/2 (including boundaries)
|
||||
if (ScanState.base.Nrap[j] > 0 &&
|
||||
(ScanState.lambda[j][0] < -PI/2 || ScanState.lambda[j][ScanState.base.Nrap[j] - 1] > PI/2))
|
||||
force_descent = false;
|
||||
|
||||
// rapidities should also be ordered as the quantum numbers:
|
||||
for (int alpha = 1; alpha < ScanState.base.Nrap[j]; ++alpha)
|
||||
if (ScanState.lambda[j][alpha - 1] >= ScanState.lambda[j][alpha])
|
||||
force_descent = false;
|
||||
}
|
||||
*/
|
||||
//if (force_descent) cout << "Forcing descent on state with label " << ScanState.label << endl;
|
||||
} // if Delta > 1
|
||||
|
||||
//if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 2 && ScanState.base.Nrap[1] == 1 && ScanState.Ix2[1][0] == 0) force_descent = true;
|
||||
//if (ScanState.base.Nrap[0] == ScanState.base.Mdown - 3 && ScanState.base.Nrap[2] == 1 && ScanState.Ix2[2][0] == 0) force_descent = true;
|
||||
//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;
|
||||
|
||||
return(force_descent);
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const Heis_Bethe_State& state);
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXZ_Bethe_State carry all extra information pertaining to XXZ gapless
|
||||
|
||||
class XXZ_Bethe_State : public Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
Lambda sinhlambda;
|
||||
Lambda coshlambda;
|
||||
Lambda tanhlambda;
|
||||
|
||||
public:
|
||||
XXZ_Bethe_State ();
|
||||
XXZ_Bethe_State (const XXZ_Bethe_State& RefState); // copy constructor
|
||||
XXZ_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
//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
|
||||
|
||||
public:
|
||||
XXZ_Bethe_State& operator= (const XXZ_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinhlambda();
|
||||
void Compute_coshlambda();
|
||||
void Compute_tanhlambda();
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
DP String_delta ();
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXZ specific functions:
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState);
|
||||
XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState);
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXX_Bethe_State carry all extra information pertaining to XXX antiferromagnet
|
||||
|
||||
class XXX_Bethe_State : public Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
XXX_Bethe_State ();
|
||||
XXX_Bethe_State (const XXX_Bethe_State& RefState); // copy constructor
|
||||
XXX_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
//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
|
||||
|
||||
public:
|
||||
XXX_Bethe_State& operator= (const XXX_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan
|
||||
DP String_delta ();
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXX specific functions
|
||||
public:
|
||||
bool Check_Finite_rap ();
|
||||
|
||||
};
|
||||
|
||||
XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState);
|
||||
XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState);
|
||||
|
||||
//****************************************************************************
|
||||
|
||||
// Objects in class XXZ_gpd_Bethe_State carry all extra information pertaining to XXZ gapped antiferromagnets
|
||||
|
||||
class XXZ_gpd_Bethe_State : public Heis_Bethe_State {
|
||||
|
||||
public:
|
||||
Lambda sinlambda;
|
||||
Lambda coslambda;
|
||||
Lambda tanlambda;
|
||||
|
||||
public:
|
||||
XXZ_gpd_Bethe_State ();
|
||||
XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState); // copy constructor
|
||||
XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M); // constructor to ground-state configuration
|
||||
XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& base); // constructor to lowest-energy config with base
|
||||
//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
|
||||
|
||||
public:
|
||||
XXZ_gpd_Bethe_State& operator= (const XXZ_gpd_Bethe_State& RefState);
|
||||
|
||||
public:
|
||||
void Set_Free_lambdas(); // sets the rapidities to solutions of BAEs without scattering terms
|
||||
void Compute_sinlambda();
|
||||
void Compute_coslambda();
|
||||
void Compute_tanlambda();
|
||||
int Weight(); // weight function for contributions cutoff
|
||||
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.
|
||||
void Compute_BE (int j, int alpha);
|
||||
void Compute_BE ();
|
||||
DP Iterate_BAE(int i, int j);
|
||||
void Iterate_BAE_Newton();
|
||||
bool Check_Rapidities(); // checks that all rapidities are not nan and are in interval ]-PI/2, PI/2]
|
||||
DP String_delta ();
|
||||
void Compute_Energy ();
|
||||
//void Compute_Momentum ();
|
||||
void Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red);
|
||||
|
||||
// XXZ_gpd specific functions
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
|
||||
XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState);
|
||||
|
||||
//***********************************************
|
||||
|
||||
// Function declarations
|
||||
|
||||
// in M_vs_H.cc
|
||||
DP Ezero (DP Delta, int N, int M);
|
||||
DP H_vs_M (DP Delta, int N, int M);
|
||||
DP HZmin (DP Delta, int N, int M, Vect_DP& Ezero_ref);
|
||||
int M_vs_H (DP Delta, int N, DP HZ);
|
||||
|
||||
DP X_avg (char xyorz, DP Delta, int N, int M);
|
||||
|
||||
DP Chemical_Potential (const Heis_Bethe_State& RefState);
|
||||
DP Particle_Hole_Excitation_Cost (char whichDSF, Heis_Bethe_State& AveragingState);
|
||||
|
||||
//DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded);
|
||||
DP Sumrule_Factor (char whichDSF, Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
void Evaluate_F_Sumrule (string prefix, char whichDSF, const Heis_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax);
|
||||
|
||||
complex<DP> ln_Sz_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
|
||||
complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B);
|
||||
|
||||
complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
|
||||
// From Antoine Klauser:
|
||||
complex<DP> ln_Szz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
complex<DP> ln_Szm_p_Smz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
complex<DP> ln_Smm_ME (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
|
||||
complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
|
||||
complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B);
|
||||
|
||||
// The following functions have become member functions.
|
||||
//DP String_delta (XXZ_Bethe_State& state);
|
||||
//DP String_delta (XXX_Bethe_State& state);
|
||||
//DP String_delta (XXZ_gpd_Bethe_State& state);
|
||||
|
||||
//DP Compute_Form_Factor_Entry (char whichDSF, Heis_Bethe_State& LeftState, Heis_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
||||
// XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
||||
XXZ_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
||||
// XXX_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
||||
XXX_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
||||
// XXZ_gpd_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile);
|
||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
||||
XXZ_gpd_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile);
|
||||
|
||||
// For geometric quench:
|
||||
complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B);
|
||||
|
||||
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,
|
||||
int N_2, int iKmin, int iKmax, int Max_Secs, bool refine);
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Infprec.h
|
||||
|
||||
Purpose: Declarations for infinite precision arithmetic classes.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
|
||||
#ifndef _JSC_INFPREC_
|
||||
#define _JSC_INFPREC_
|
||||
|
||||
namespace JSC {
|
||||
|
||||
class infprec_int {
|
||||
|
||||
private:
|
||||
int nintrep; // number of integers used in representation
|
||||
int baseint; // fundamental int
|
||||
Vect<unsigned int> xint; // extra integers
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
#endif
|
|
@ -1,440 +0,0 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_Matrix.h
|
||||
|
||||
Purpose: Declares square matrix class.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _MATRIX_
|
||||
#define _MATRIX_
|
||||
|
||||
namespace JSC {
|
||||
|
||||
|
||||
// CLASS DEFINITIONS
|
||||
|
||||
template <class T>
|
||||
class SQMat {
|
||||
|
||||
private:
|
||||
int dim;
|
||||
T** M;
|
||||
|
||||
public:
|
||||
SQMat (int N); // initializes all elements of this n by n matrix to zero
|
||||
SQMat (const SQMat& rhs); // copy constructor
|
||||
SQMat (const T& a, int N); // initialize to diagonal matrix with value a (NOT like in NR !!!)
|
||||
SQMat (const SQMat& a, const SQMat& b); // initialize to tensor product of a and b
|
||||
SQMat (const SQMat& a, int row_id, int col_id); // init by cutting row row_id and col col_id
|
||||
void Print ();
|
||||
SQMat& operator= (const SQMat& rhs); // assignment
|
||||
SQMat& operator= (const T& a); // assign 1 to diagonal elements (NOT like in NR !!!)
|
||||
inline T* operator[] (const int i); // subscripting: pointer to row i
|
||||
inline const T* operator[] (const int i) const;
|
||||
SQMat& operator+= (const T& a);
|
||||
SQMat& operator+= (const SQMat& a);
|
||||
SQMat& operator-= (const T& a);
|
||||
SQMat& operator-= (const SQMat& a);
|
||||
SQMat& operator*= (const T& a);
|
||||
SQMat& operator*= (const SQMat& a);
|
||||
inline int size() const;
|
||||
~SQMat();
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (int N) : dim(N) , M(new T*[N])
|
||||
{
|
||||
M[0] = new T[N*N];
|
||||
for (int i = 1; i < N; i++) M[i] = M[i-1] + N;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const SQMat& rhs) : dim(rhs.dim) , M(new T*[dim])
|
||||
{
|
||||
int i,j;
|
||||
M[0] = new T[dim*dim];
|
||||
for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
|
||||
for (i = 0; i < dim; i++)
|
||||
for (j = 0; j < dim; j++) M[i][j] = rhs[i][j];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const T& a, int N) : dim(N) , M(new T*[dim])
|
||||
{
|
||||
int i, j;
|
||||
M[0] = new T[dim*dim];
|
||||
for (i = 1; i < dim; i++) M[i] = M[i-1] + dim;
|
||||
for (i = 0; i < dim; i++) {
|
||||
for (j = 0; j < dim; j++) M[i][j] = T(0);
|
||||
M[i][i] = a;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const SQMat& a, const SQMat& b) : dim (a.dim * b.dim) , M(new T*[a.dim * b.dim])
|
||||
{
|
||||
M[0] = new T[a.dim * b.dim * a.dim * b.dim];
|
||||
|
||||
for (int i = 1; i < a.dim * b.dim; ++i) M[i] = M[i-1] + a.dim * b.dim;
|
||||
|
||||
for (int i1 = 0; i1 < a.dim; ++i1) {
|
||||
|
||||
for (int i2 = 0; i2 < a.dim; ++i2) {
|
||||
|
||||
for (int j1 = 0; j1 < b.dim; ++j1) {
|
||||
|
||||
for (int j2 = 0; j2 < b.dim; ++j2) {
|
||||
|
||||
M[i1 * (b.dim) + j1][i2 * (b.dim) + j2] = a[i1][i2] * b[j1][j2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::SQMat (const SQMat&a, int row_id, int col_id) : dim (a.dim - 1) , M(new T*[dim])
|
||||
{
|
||||
if (dim == 0) {
|
||||
JSCerror("Error: chopping a row and col from size one matrix.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
M[0] = new T[dim * dim];
|
||||
|
||||
for (int i = 1; i < dim; ++i) M[i] = M[i-1] + dim;
|
||||
|
||||
for (int i = 0; i < row_id; ++i)
|
||||
for (int j = 0; j < col_id; ++j) M[i][j] = a[i][j];
|
||||
for (int i = row_id; i < dim; ++i)
|
||||
for (int j = 0; j < col_id; ++j) M[i][j] = a[i+1][j];
|
||||
for (int i = 0; i < row_id; ++i)
|
||||
for (int j = col_id; j < dim; ++j) M[i][j] = a[i][j+1];
|
||||
for (int i = row_id; i < dim; ++i)
|
||||
for (int j = col_id; j < dim; ++j) M[i][j] = a[i+1][j+1];
|
||||
|
||||
}
|
||||
|
||||
// operators
|
||||
template <class T>
|
||||
void SQMat<T>::Print ()
|
||||
{
|
||||
cout << endl;
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) cout << M[i][j] << " ";
|
||||
cout << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator= (const SQMat<T>& rhs)
|
||||
{
|
||||
if (this != &rhs) {
|
||||
if (dim != rhs.dim) {
|
||||
JSCerror("Assignment between matrices of different dimensions. Bailing out.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dim; ++i)
|
||||
for (int j = 0; j < dim; ++j) M[i][j] = rhs[i][j];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator= (const T& a)
|
||||
{
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j)
|
||||
M[i][j] = T(0);
|
||||
M[i][i] = a;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T* SQMat<T>::operator[] (const int i)
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T* SQMat<T>::operator[] (const int i) const
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator+= (const T& a)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dim; ++i) M[i][i] += a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator+= (const SQMat<T>& a)
|
||||
{
|
||||
if (dim != a.dim) {
|
||||
JSCerror("Incompatible matrix sizes in matrix operator +.");
|
||||
exit(1);
|
||||
}
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
M[i][j] += a[i][j];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator-= (const T& a)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dim; ++i) M[i][i] -= a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator-= (const SQMat<T>& a)
|
||||
{
|
||||
if (dim != a.dim) {
|
||||
JSCerror("Incompatible matrix sizes in matrix operator +.");
|
||||
exit(1);
|
||||
}
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
M[i][j] -= a[i][j];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator*= (const T& a)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dim; ++i) for (int j = 0; j < dim; ++j) M[i][j] *= a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>& SQMat<T>::operator*= (const SQMat<T>& a)
|
||||
{
|
||||
|
||||
if (dim != a.dim) {
|
||||
JSCerror("Incompatible matrix sizes in matrix operator *.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SQMat<T> leftarg(*this); // use copy constructor.
|
||||
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
|
||||
M[i][j] = 0.0;
|
||||
|
||||
for (int k = 0; k < dim; ++k) {
|
||||
|
||||
M[i][j] += leftarg[i][k] * a[k][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int SQMat<T>::size() const
|
||||
{
|
||||
return dim;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SQMat<T>::~SQMat()
|
||||
{
|
||||
if (M != 0) {
|
||||
delete[] (M[0]);
|
||||
delete[] (M);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*****************************
|
||||
|
||||
template <class T>
|
||||
class RecMat {
|
||||
|
||||
private:
|
||||
int nrows;
|
||||
int ncols;
|
||||
T** M;
|
||||
|
||||
public:
|
||||
RecMat (int Nrows, int Ncols); // initializes all elements of this n by n matrix to zero
|
||||
RecMat (const T& a, int Nrows, int Ncols);
|
||||
RecMat (const RecMat& rhs); // copy constructor
|
||||
void Print ();
|
||||
RecMat& operator= (const RecMat& rhs); // assignment
|
||||
inline T* operator[] (const int i); // subscripting: pointer to row i
|
||||
inline const T* operator[] (const int i) const;
|
||||
inline int nr_rows() const;
|
||||
inline int nr_cols() const;
|
||||
~RecMat();
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::RecMat (int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
|
||||
{
|
||||
M[0] = new T[Nrows*Ncols];
|
||||
for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
|
||||
|
||||
for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) M[i][j] = T(0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::RecMat (const T& a, int Nrows, int Ncols) : nrows(Nrows), ncols(Ncols), M(new T*[Nrows])
|
||||
{
|
||||
M[0] = new T[Nrows*Ncols];
|
||||
for (int i = 1; i < Nrows; i++) M[i] = M[i-1] + Ncols;
|
||||
|
||||
for (int i = 0; i < Nrows; i++) for (int j = 0; j < Ncols; j++) {
|
||||
if (i == j) M[i][i] = a;
|
||||
else M[i][j] = T(0);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::RecMat (const RecMat& rhs) : nrows(rhs.nrows), ncols(rhs.ncols), M(new T*[nrows])
|
||||
{
|
||||
int i,j;
|
||||
M[0] = new T[nrows*ncols];
|
||||
for (i = 1; i < nrows; i++) M[i] = M[i-1] + ncols;
|
||||
for (i = 0; i < nrows; i++)
|
||||
for (j = 0; j < ncols; j++) M[i][j] = rhs[i][j];
|
||||
}
|
||||
|
||||
// operators
|
||||
template <class T>
|
||||
void RecMat<T>::Print ()
|
||||
{
|
||||
cout << endl;
|
||||
for (int i = 0; i < nrows; ++i) {
|
||||
for (int j = 0; j < ncols; ++j) cout << M[i][j] << " ";
|
||||
cout << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>& RecMat<T>::operator= (const RecMat<T>& rhs)
|
||||
{
|
||||
if (this != &rhs) {
|
||||
if (nrows != rhs.nrows || ncols != rhs.ncols) {
|
||||
if (M != 0) {
|
||||
delete[] (M[0]);
|
||||
delete[] (M);
|
||||
}
|
||||
nrows = rhs.nrows;
|
||||
ncols = rhs.ncols;
|
||||
M = new T*[nrows];
|
||||
M[0] = new T[nrows * ncols];
|
||||
}
|
||||
|
||||
for (int i = 0; i < nrows; ++i)
|
||||
for (int j = 0; j < ncols; ++j) M[i][j] = rhs[i][j];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T* RecMat<T>::operator[] (const int i)
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T* RecMat<T>::operator[] (const int i) const
|
||||
{
|
||||
return M[i];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int RecMat<T>::nr_rows() const
|
||||
{
|
||||
return nrows;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int RecMat<T>::nr_cols() const
|
||||
{
|
||||
return ncols;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::ostream& operator<< (std::ostream& s, const RecMat<T>& matrix)
|
||||
{
|
||||
for (int i = 0; i < matrix.nr_rows(); ++i) {
|
||||
for (int j = 0; j < matrix.nr_cols(); ++j) s << matrix[i][j] << " ";
|
||||
s << endl;
|
||||
}
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
RecMat<T>::~RecMat()
|
||||
{
|
||||
if (M != 0) {
|
||||
delete[] (M[0]);
|
||||
delete[] (M);
|
||||
}
|
||||
}
|
||||
|
||||
// TYPEDEFS:
|
||||
|
||||
typedef JSC::SQMat<DP> SQMat_DP;
|
||||
typedef JSC::SQMat<complex<double> > SQMat_CX;
|
||||
|
||||
|
||||
// FUNCTION DEFINITIONS
|
||||
|
||||
// Functions in src/MATRIX directory
|
||||
|
||||
DP det_LU (SQMat_DP a);
|
||||
DP lndet_LU (SQMat_DP a);
|
||||
complex<DP> lndet_LU_dstry (SQMat_DP& a);
|
||||
complex<DP> det_LU_CX (SQMat_CX a);
|
||||
complex<DP> lndet_LU_CX (SQMat_CX a);
|
||||
complex<DP> lndet_LU_CX_dstry (SQMat_CX& a);
|
||||
void eigsrt (Vect_DP& d, SQMat_DP& v);
|
||||
void balanc (SQMat_DP& a);
|
||||
void elmhes (SQMat_DP& a);
|
||||
void gaussj (SQMat_DP& a, SQMat_DP& b);
|
||||
void hqr (SQMat_DP& a, Vect_CX& wri);
|
||||
void jacobi (SQMat_DP& a, Vect_DP& d, SQMat_DP& v, int& nrot);
|
||||
void lubksb (SQMat_DP& a, Vect_INT& indx, Vect_DP& b);
|
||||
void lubksb_CX (SQMat_CX& a, Vect_INT& indx, Vect_CX& b);
|
||||
void ludcmp (SQMat_DP& a, Vect_INT& indx, DP& d);
|
||||
void ludcmp_CX (SQMat_CX& a, Vect_INT& indx, DP& d);
|
||||
DP pythag(DP a, DP b);
|
||||
void tqli(Vect_DP& d, Vect_DP& e, SQMat_DP& z);
|
||||
void tred2 (SQMat_DP& a, Vect_DP& d, Vect_DP& e);
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
#endif
|
|
@ -1,36 +0,0 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_NRG.h
|
||||
|
||||
Purpose: Declares NRG-related classes and functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _NRG_
|
||||
#define _NRG_
|
||||
|
||||
#include "JSC.h"
|
||||
|
||||
namespace JSC {
|
||||
|
||||
DP K_Weight_integrand (Vect_DP args); // weighing function for state selection
|
||||
|
||||
//void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
|
||||
// int weighing_option, DP (*weight_integrand_fn) (Vect_DP), Vect_DP& args_to_weight_integrand);
|
||||
void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
|
||||
//int weighing_option, DP (*weight_integrand_fn) (Vect_DP), Vect_DP& args_to_weight_integrand)
|
||||
int weighing_option, Vect<complex <DP> >& FT_of_potential);
|
||||
|
||||
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,
|
||||
int weighing_option, int label_left_begin, int label_left_end, int label_right_begin, int label_right_end,
|
||||
int block_option, DP* DFF_block_1, DP* DFF_block_2, Vect_DP Kweight);
|
||||
|
||||
}
|
||||
|
||||
#endif // _NRG_
|
1263
include/JSC_Scan.h
1263
include/JSC_Scan.h
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
Load Diff
|
@ -1,86 +0,0 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_XXZ_h0.h
|
||||
|
||||
Purpose: Declares classes for XXZ in zero field: quantum group stuff.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _XXZ_h0_
|
||||
#define _XXZ_h0_
|
||||
|
||||
#include "JSC.h"
|
||||
|
||||
//const DP default_req_prec = 1.0e-14;
|
||||
//const int default_max_rec = 10;
|
||||
|
||||
namespace JSC {
|
||||
|
||||
/*
|
||||
inline DP Integrand_xi_11 (Vect_DP args)
|
||||
{
|
||||
// args[0] corresponds to t, args[1] to rho, args[2] to xi
|
||||
//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]);
|
||||
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))
|
||||
+ 2.0 * pow(sin(2.0 * args[0] * args[1]), 2.0))/args[0]);
|
||||
}
|
||||
|
||||
inline DP Integrand_xi_12 (Vect_DP args)
|
||||
{
|
||||
DP expm2t = exp(-2.0*args[0]);
|
||||
DP expm2txi = exp(-2.0*args[0]*args[2]);
|
||||
//return(cos(4.0 * args[0] * args[1]) * expm2t * (3.0 + expm2t)/ (args[0] * (1.0 + expm2t) * (1.0 + expm2t)));
|
||||
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)));
|
||||
}
|
||||
*/
|
||||
/*
|
||||
inline DP Integrand_xi_2 (Vect_DP args)
|
||||
{
|
||||
DP answer = 0.0;
|
||||
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));
|
||||
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));
|
||||
else if (args[0] >= 1.0) {
|
||||
DP expm2t = exp(-2.0 * args[0]);
|
||||
DP expm2txi = exp(-2.0*args[0]*args[2]);
|
||||
//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));
|
||||
answer = 8.0 * ((1.0 - expm2t*expm2txi)/(1.0 - expm2t*expm2txi)) * expm2t *
|
||||
pow(sin(2.0 * args[0] * args[1]), 2.0)/(args[0] * (1.0 - expm2t) * (1.0 + expm2t) * (1.0 + expm2t));
|
||||
}
|
||||
return(answer);
|
||||
}
|
||||
*/
|
||||
|
||||
DP I_xi_integral (DP xi, DP rho, DP req_prec, int max_nr_pts);
|
||||
|
||||
|
||||
/********************* TWO SPINONS ********************/
|
||||
DP Szz_XXZ_h0_2spinons (DP k, DP omega, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_alt (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_omega (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_omega_alt (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_intomega (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_intomega_alt (Vect_DP args, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_check_sumrule (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
|
||||
DP Szz_XXZ_h0_2spinons_check_sumrule_alt (DP Delta, DP req_prec, int max_nr_pts, Integral_table Itable);
|
||||
DP Fixed_k_sumrule_omega_Szz_XXZ_h0_N (DP Delta, DP k);
|
||||
DP GSE_XXZ_h0 (DP Delta, DP req_prec, int max_nr_pts);
|
||||
DP Fixed_k_sumrule_omega_Szz_XXZ_h0 (DP Delta, DP k, DP req_prec, int max_nr_pts);
|
||||
DP Szz_XXZ_h0_2spinons_check_fixed_k_Szz_sumrule (DP Delta, DP k, DP req_prec, int max_nr_pts, Integral_table Itable);
|
||||
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);
|
||||
|
||||
//******************************** Functions to produce files similar to ABACUS **********************************
|
||||
void Produce_Szz_XXZ_h0_2spinons_file (DP Delta, int N, int Nomega, DP omegamax, Integral_table Itable);
|
||||
void Produce_Szz_XXZ_h0_2spinons_fixed_K_file (DP Delta, DP Kover2PI, int Nomega, Integral_table Itable);
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
#endif
|
|
@ -1,485 +0,0 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: JSC_util.h
|
||||
|
||||
Purpose: Defines basic math functions.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _JSC_UTIL_H_
|
||||
#define _JSC_UTIL_H_
|
||||
|
||||
#include "JSC.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef double DP;
|
||||
|
||||
// Global constants
|
||||
|
||||
const double PI = 3.141592653589793238462643;
|
||||
const double sqrtPI = sqrt(PI);
|
||||
const double twoPI = 2.0*PI;
|
||||
const double logtwoPI = log(twoPI);
|
||||
const double Euler_Mascheroni = 0.577215664901532860606;
|
||||
const double Gamma_min_0p5 = -2.0 * sqrt(PI);
|
||||
const complex<double> II(0.0,1.0); // Shorthand for i
|
||||
|
||||
const DP MACHINE_EPS = numeric_limits<DP>::epsilon();
|
||||
const DP MACHINE_EPS_SQ = pow(MACHINE_EPS, 2.0);
|
||||
|
||||
// Now for some basic math utilities:
|
||||
|
||||
namespace JSC {
|
||||
|
||||
// File checks:
|
||||
|
||||
inline bool file_exists (const char* filename)
|
||||
{
|
||||
fstream file;
|
||||
file.open(filename);
|
||||
bool exists = !file.fail();
|
||||
file.close();
|
||||
|
||||
return(exists);
|
||||
}
|
||||
|
||||
// Error handler:
|
||||
|
||||
inline void JSCerror (const string error_text)
|
||||
// my error handler
|
||||
{
|
||||
cerr << "Run-time error... " << endl;
|
||||
cerr << error_text << endl;
|
||||
cerr << "Exiting to system..." << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct Divide_by_zero {};
|
||||
|
||||
|
||||
// Basics: min, max, fabs
|
||||
|
||||
template<class T>
|
||||
inline const T max (const T& a, const T& b) { return a > b ? (a) : (b); }
|
||||
|
||||
template<class T>
|
||||
inline const T min (const T& a, const T& b) { return a > b ? (b) : (a); }
|
||||
|
||||
template<class T>
|
||||
inline const T fabs (const T& a) { return a >= 0 ? (a) : (-a); }
|
||||
|
||||
inline long long int pow_lli (const long long int& base, const int& exp)
|
||||
{
|
||||
long long int answer = base;
|
||||
if (exp == 0) answer = 1LL;
|
||||
else for (int i = 1; i < exp; ++i) answer *= base;
|
||||
return(answer);
|
||||
}
|
||||
|
||||
inline unsigned long long int pow_ulli (const unsigned long long int& base, const int& exp)
|
||||
{
|
||||
unsigned long long int answer = base;
|
||||
if (exp == 0) answer = 1ULL;
|
||||
for (int i = 1; i < exp; ++i) answer *= base;
|
||||
return(answer);
|
||||
}
|
||||
|
||||
inline int fact (const int& N)
|
||||
{
|
||||
int ans = 0;
|
||||
|
||||
if (N < 0) {
|
||||
cerr << "Error: factorial of negative number. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 1;
|
||||
else ans = N * fact(N-1);
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline DP ln_fact (const int& N)
|
||||
{
|
||||
DP ans = 0.0;
|
||||
|
||||
if (N < 0) {
|
||||
cerr << "Error: factorial of negative number. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 0.0;
|
||||
else ans = log(DP(N)) + ln_fact(N-1);
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline long long int fact_lli (const int& N)
|
||||
{
|
||||
long long int ans = 0;
|
||||
|
||||
if (N < 0) {
|
||||
cerr << "Error: factorial of negative number. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 1;
|
||||
else ans = fact_lli(N-1) * N;
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline long long int fact_ulli (const int& N)
|
||||
{
|
||||
unsigned long long int ans = 0;
|
||||
|
||||
if (N < 0) {
|
||||
cerr << "Error: factorial of negative number. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if ( N == 1 || N == 0) ans = 1;
|
||||
else ans = fact_ulli(N-1) * N;
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline int choose (const int& N1, const int& N2)
|
||||
{
|
||||
// returns N1 choose N2
|
||||
|
||||
int ans = 0;
|
||||
if (N1 < N2) {
|
||||
cout << "Error: N1 smaller than N2 in choose. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 1;
|
||||
else if (N1 < 12) ans = fact(N1)/(fact(N2) * fact(N1 - N2));
|
||||
else {
|
||||
ans = 1;
|
||||
int mult = N1;
|
||||
while (mult > max(N2, N1 - N2)) ans *= mult--;
|
||||
ans /= fact(min(N2, N1 - N2));
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline DP ln_choose (const int& N1, const int& N2)
|
||||
{
|
||||
// returns the log of N1 choose N2
|
||||
|
||||
DP ans = 0.0;
|
||||
if (N1 < N2) {
|
||||
cout << "Error: N1 smaller than N2 in choose. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 0.0;
|
||||
else ans = ln_fact(N1) - ln_fact(N2) - ln_fact(N1 - N2);
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
|
||||
inline long long int choose_lli (const int& N1, const int& N2)
|
||||
{
|
||||
// returns N1 choose N2
|
||||
|
||||
long long int ans = 0;
|
||||
if (N1 < N2) {
|
||||
cout << "Error: N1 smaller than N2 in choose. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 1;
|
||||
else if (N1 < 12) ans = fact_lli(N1)/(fact_lli(N2) * fact_lli(N1 - N2));
|
||||
else {
|
||||
// Make sure that N2 is less than or equal to N1/2; if not, just switch...
|
||||
int N2_min = min(N2, N1 - N2);
|
||||
|
||||
ans = 1;
|
||||
for (int i = 0; i < N2_min; ++i) {
|
||||
ans *= (N1 - i);
|
||||
ans /= i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline unsigned long long int choose_ulli (const int& N1, const int& N2)
|
||||
{
|
||||
// returns N1 choose N2
|
||||
|
||||
unsigned long long int ans = 0;
|
||||
if (N1 < N2) {
|
||||
cout << "Error: N1 smaller than N2 in choose. Exited." << endl;
|
||||
exit(1);
|
||||
}
|
||||
else if (N1 == N2) ans = 1;
|
||||
else if (N1 < 12) ans = fact_ulli(N1)/(fact_ulli(N2) * fact_ulli(N1 - N2));
|
||||
else {
|
||||
// Make sure that N2 is less than or equal to N1/2; if not, just switch...
|
||||
int N2_min = min(N2, N1 - N2);
|
||||
|
||||
ans = 1;
|
||||
for (int i = 0; i < N2_min; ++i) {
|
||||
ans *= (N1 - i);
|
||||
ans /= i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
||||
inline DP SIGN (const DP &a, const DP &b)
|
||||
{
|
||||
return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
|
||||
}
|
||||
|
||||
inline DP sign_of (const DP& a)
|
||||
{
|
||||
return (a >= 0.0 ? 1.0 : -1.0);
|
||||
}
|
||||
|
||||
inline int sgn_int (const int& a)
|
||||
{
|
||||
return (a >= 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
inline int sgn_DP (const DP& a)
|
||||
{
|
||||
return (a >= 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void SWAP (T& a, T& b) {T dum = a; a = b; b = dum;}
|
||||
|
||||
inline int kronecker (int a, int b)
|
||||
{
|
||||
return a == b ? 1 : 0;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool is_nan (const T& a)
|
||||
{
|
||||
return(!((a < T(0.0)) || (a >= T(0.0))));
|
||||
}
|
||||
|
||||
inline complex<DP> atan_cx(const complex<DP>& x)
|
||||
{
|
||||
return(-0.5 * II * log((1.0 + II* x)/(1.0 - II* x)));
|
||||
}
|
||||
|
||||
/**************** Gamma function *******************/
|
||||
|
||||
inline complex<double> ln_Gamma (complex<double> z)
|
||||
{
|
||||
// Implementation of Lanczos method with g = 9.
|
||||
// Coefficients from Godfrey 2001.
|
||||
|
||||
if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
|
||||
|
||||
else {
|
||||
|
||||
complex<double> series = 1.000000000000000174663
|
||||
+ 5716.400188274341379136/z
|
||||
- 14815.30426768413909044/(z + 1.0)
|
||||
+ 14291.49277657478554025/(z + 2.0)
|
||||
- 6348.160217641458813289/(z + 3.0)
|
||||
+ 1301.608286058321874105/(z + 4.0)
|
||||
- 108.1767053514369634679/(z + 5.0)
|
||||
+ 2.605696505611755827729/(z + 6.0)
|
||||
- 0.7423452510201416151527e-2 / (z + 7.0)
|
||||
+ 0.5384136432509564062961e-7 / (z + 8.0)
|
||||
- 0.4023533141268236372067e-8 / (z + 9.0);
|
||||
|
||||
return(0.5 * logtwoPI + (z - 0.5) * log(z + 8.5) - (z + 8.5) + log(series));
|
||||
}
|
||||
|
||||
return(log(0.0)); // never called
|
||||
}
|
||||
|
||||
inline complex<double> ln_Gamma_old (complex<double> z)
|
||||
{
|
||||
// Implementation of Lanczos method with g = 9.
|
||||
// Coefficients from Godfrey 2001.
|
||||
|
||||
if (real(z) < 0.5) return(log(PI/(sin(PI*z))) - ln_Gamma(1.0 - z));
|
||||
|
||||
else {
|
||||
|
||||
int g = 9;
|
||||
|
||||
double p[11] = { 1.000000000000000174663,
|
||||
5716.400188274341379136,
|
||||
-14815.30426768413909044,
|
||||
14291.49277657478554025,
|
||||
-6348.160217641458813289,
|
||||
1301.608286058321874105,
|
||||
-108.1767053514369634679,
|
||||
2.605696505611755827729,
|
||||
-0.7423452510201416151527e-2,
|
||||
0.5384136432509564062961e-7,
|
||||
-0.4023533141268236372067e-8 };
|
||||
|
||||
complex<double> z_min_1 = z - 1.0;
|
||||
complex<double> series = p[0];
|
||||
for (int i = 1; i < g+2; ++i)
|
||||
series += p[i]/(z_min_1 + complex<double>(i));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
return(log(0.0)); // never called
|
||||
}
|
||||
|
||||
inline complex<double> ln_Gamma_2 (complex<double> z)
|
||||
{
|
||||
// Implementation of Lanczos method with g = 7.
|
||||
|
||||
if (real(z) < 0.5) return(log(PI/(sin(PI*z)) - ln_Gamma(1.0 - z)));
|
||||
|
||||
else {
|
||||
|
||||
int g = 7;
|
||||
|
||||
double p[9] = { 0.99999999999980993, 676.5203681218851, -1259.1392167224028,
|
||||
771.32342877765313, -176.61502916214059, 12.507343278686905,
|
||||
-0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7};
|
||||
|
||||
complex<double> z_min_1 = z - 1.0;
|
||||
complex<double> series = p[0];
|
||||
for (int i = 1; i < g+2; ++i)
|
||||
series += p[i]/(z_min_1 + complex<double>(i));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
return(log(0.0)); // never called
|
||||
}
|
||||
|
||||
/********** Partition numbers **********/
|
||||
|
||||
inline long long int Partition_Function (int n)
|
||||
{
|
||||
// Returns the value of the partition function p(n), giving the number of partitions of n into integers.
|
||||
|
||||
if (n < 0) JSCerror("Calling Partition_Function for n < 0.");
|
||||
else if (n == 0 || n == 1) return(1LL);
|
||||
else if (n == 2) return(2LL);
|
||||
else if (n == 3) return(3LL);
|
||||
|
||||
else { // do recursion using pentagonal numbers
|
||||
long long int pn = 0LL;
|
||||
int pentnrplus, pentnrmin; // pentagonal numbers
|
||||
for (int i = 1; true; ++i) {
|
||||
pentnrplus = (i * (3*i - 1))/2;
|
||||
pentnrmin = (i * (3*i + 1))/2;
|
||||
//cout << "\ti = " << i << "pnrp = " << pentnrplus << "\tpnrm = " << pentnrmin << endl;
|
||||
if (n - pentnrplus >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrplus);
|
||||
if (n - pentnrmin >= 0) pn += (i % 2 ? 1LL : -1LL) * Partition_Function (n - pentnrmin);
|
||||
else break;
|
||||
}
|
||||
return(pn);
|
||||
}
|
||||
return(-1LL); // never called
|
||||
}
|
||||
|
||||
|
||||
/********** Sorting **********/
|
||||
|
||||
/*
|
||||
template<class item_type>
|
||||
void QuickSort (item_type* a, int l, int r)
|
||||
{
|
||||
static item_type m;
|
||||
static int j;
|
||||
int i;
|
||||
|
||||
if (r > l) {
|
||||
m = a[r]; i = l-1; j = r;
|
||||
for (;;) {
|
||||
while (a[++i] < m);
|
||||
while (a[--j] > m);
|
||||
if (i >= j) break;
|
||||
std::swap(a[i], a[j]);
|
||||
}
|
||||
std::swap(a[i], a[r]);
|
||||
QuickSort(a, l, i-1);
|
||||
QuickSort(a, i+1, r);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
void QuickSort (T* V, int l, int r)
|
||||
{
|
||||
int i = l, j = r;
|
||||
T pivot = V[l + (r-l)/2];
|
||||
|
||||
while (i <= j) {
|
||||
while (V[i] < pivot) i++;
|
||||
while (V[j] > pivot) j--;
|
||||
if (i <= j) {
|
||||
std::swap(V[i],V[j]);
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
};
|
||||
|
||||
if (l < j) QuickSort(V, l, j);
|
||||
if (i < r) QuickSort(V, i, r);
|
||||
}
|
||||
|
||||
/*
|
||||
template<class item_type>
|
||||
void QuickSort (item_type* a, int* idx, int l, int r)
|
||||
{
|
||||
static item_type m;
|
||||
static int j;
|
||||
int i;
|
||||
|
||||
if (r > l) {
|
||||
m = a[r]; i = l-1; j = r;
|
||||
for (;;) {
|
||||
while (a[++i] < m);
|
||||
while (a[--j] > m);
|
||||
if (i >= j) break;
|
||||
std::swap(a[i], a[j]);
|
||||
std::swap(idx[i], idx[j]);
|
||||
}
|
||||
std::swap(a[i], a[r]);
|
||||
std::swap(idx[i], idx[r]);
|
||||
QuickSort(a, idx, l, i-1);
|
||||
QuickSort(a, idx, i+1, r);
|
||||
}
|
||||
}
|
||||
*/
|
||||
template <class T>
|
||||
void QuickSort (T* V, int* index, int l, int r)
|
||||
{
|
||||
int i = l, j = r;
|
||||
T pivot = V[l + (r-l)/2];
|
||||
|
||||
while (i <= j) {
|
||||
while (V[i] < pivot) i++;
|
||||
while (V[j] > pivot) j--;
|
||||
if (i <= j) {
|
||||
std::swap(V[i],V[j]);
|
||||
std::swap(index[i],index[j]);
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
};
|
||||
|
||||
if (l < j) QuickSort(V, index, l, j);
|
||||
if (i < r) QuickSort(V, index, i, r);
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
#endif // _JS_UTIL_H_
|
|
@ -1,6 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,26 +12,25 @@ Purpose: defines functions in Base class,
|
|||
providing a unified base object for all
|
||||
Bethe Ansatz integrable models.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function definitions: class Base
|
||||
|
||||
Base::Base () : Charge(0), Nrap(Vect<int>()), Nraptot(0), Ix2_infty(Vect<DP>()),
|
||||
Ix2_max(Vect<int>()), id(0LL) {}
|
||||
|
||||
|
||||
Base::Base (int N) : Charge(N), Nrap(Vect<int>(N,1)), Nraptot(N), Ix2_infty(Vect<DP>(1.0e+100,1)),
|
||||
Ix2_max(Vect<int>(LONG_LONG_MAX, 1)), id(N) {}
|
||||
|
||||
Base::Base (const Base& RefBase) // copy constructor
|
||||
: Charge(RefBase.Charge), Nrap(Vect<int>(RefBase.Nrap.size())), Nraptot(RefBase.Nraptot),
|
||||
Ix2_infty(Vect<DP>(RefBase.Ix2_infty.size())), Ix2_max(Vect<int>(RefBase.Ix2_max.size())), id(RefBase.id)
|
||||
: Charge(RefBase.Charge), Nrap(Vect<int>(RefBase.Nrap.size())), Nraptot(RefBase.Nraptot),
|
||||
Ix2_infty(Vect<DP>(RefBase.Ix2_infty.size())), Ix2_max(Vect<int>(RefBase.Ix2_max.size())), id(RefBase.id)
|
||||
{
|
||||
for (int i = 0; i < Nrap.size(); ++i) {
|
||||
Nrap[i] = RefBase.Nrap[i];
|
||||
|
@ -40,7 +41,7 @@ namespace JSC {
|
|||
|
||||
/*
|
||||
// DEPRECATED
|
||||
Base::Base (const Heis_Chain& RefChain, int M)
|
||||
Base::Base (const Heis_Chain& RefChain, int M)
|
||||
: Charge(M), Nrap(Vect<int>(RefChain.Nstrings)), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings))
|
||||
{
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nrap[i] = 0;
|
||||
|
@ -48,17 +49,17 @@ namespace JSC {
|
|||
|
||||
Nraptot = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
|
||||
|
||||
|
||||
// The id of this is zero by definition
|
||||
id = 0LL;
|
||||
|
||||
// Now compute the Ix2_infty numbers
|
||||
|
||||
|
||||
(*this).Compute_Ix2_limits(RefChain);
|
||||
|
||||
}
|
||||
*/
|
||||
Base::Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities)
|
||||
Base::Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities)
|
||||
: Charge(0), Nrap(Nrapidities), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings)),
|
||||
id (0LL)
|
||||
{
|
||||
|
@ -66,16 +67,16 @@ namespace JSC {
|
|||
// Check consistency of Nrapidities vector with RefChain
|
||||
|
||||
//if (RefChain.Nstrings != Nrapidities.size()) cout << "error: Nstrings = " << RefChain.Nstrings << "\tNrap.size = " << Nrapidities.size() << endl;
|
||||
|
||||
if (RefChain.Nstrings != Nrapidities.size()) JSCerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
|
||||
if (RefChain.Nstrings != Nrapidities.size()) ABACUSerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
int Mcheck = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Mcheck += RefChain.Str_L[i] * Nrap[i];
|
||||
Charge = Mcheck;
|
||||
|
||||
|
||||
Nraptot = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
|
||||
|
||||
|
||||
// Compute id
|
||||
id += Nrapidities[0];
|
||||
long long int factor = 100000LL;
|
||||
|
@ -87,10 +88,10 @@ namespace JSC {
|
|||
// Now compute the Ix2_infty numbers
|
||||
|
||||
(*this).Compute_Ix2_limits(RefChain);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Base::Base (const Heis_Chain& RefChain, long long int id_ref)
|
||||
Base::Base (const Heis_Chain& RefChain, long long int id_ref)
|
||||
: Charge(0), Nrap(Vect<int>(RefChain.Nstrings)), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings)),
|
||||
id (id_ref)
|
||||
{
|
||||
|
@ -108,18 +109,18 @@ namespace JSC {
|
|||
//id = id_ref;
|
||||
|
||||
//cout << "In Base constructor: id_ref = " << id_ref << " and Nrapidities = " << Nrap << endl;
|
||||
|
||||
|
||||
// Check consistency of Nrapidities vector with RefChain
|
||||
|
||||
//if (RefChain.Nstrings != Nrap.size()) JSCerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
//if (RefChain.Nstrings != Nrap.size()) ABACUSerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
int Mcheck = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Mcheck += RefChain.Str_L[i] * Nrap[i];
|
||||
Charge = Mcheck;
|
||||
|
||||
|
||||
Nraptot = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
|
||||
|
||||
|
||||
// Now compute the Ix2_infty numbers
|
||||
|
||||
(*this).Compute_Ix2_limits(RefChain);
|
||||
|
@ -138,7 +139,7 @@ namespace JSC {
|
|||
}
|
||||
return(*this);
|
||||
}
|
||||
|
||||
|
||||
bool Base::operator== (const Base& RefBase)
|
||||
{
|
||||
bool answer = (Nrap == RefBase.Nrap);
|
||||
|
@ -159,39 +160,39 @@ namespace JSC {
|
|||
if ((RefChain.Delta > 0.0) && (RefChain.Delta < 1.0)) {
|
||||
|
||||
// Compute the Ix2_infty numbers
|
||||
|
||||
|
||||
DP sum1 = 0.0;
|
||||
DP sum2 = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
for (int k = 0; k < RefChain.Nstrings; ++k) {
|
||||
|
||||
|
||||
sum2 = 0.0;
|
||||
|
||||
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])
|
||||
|
||||
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])
|
||||
- 0.5 * fabs(RefChain.Str_L[j] - RefChain.Str_L[k]) * RefChain.anis));
|
||||
sum2 += 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
sum2 += 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
- 0.5 * (RefChain.Str_L[j] + RefChain.Str_L[k]) * RefChain.anis));
|
||||
|
||||
for (int a = 1; a < JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]); ++a)
|
||||
sum2 += 2.0 * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
|
||||
for (int a = 1; a < ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]); ++a)
|
||||
sum2 += 2.0 * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
- 0.5 * (fabs(RefChain.Str_L[j] - RefChain.Str_L[k]) + 2.0*a) * RefChain.anis));
|
||||
|
||||
|
||||
sum1 += (Nrap[k] - ((j == k) ? 1 : 0)) * sum2;
|
||||
}
|
||||
|
||||
Ix2_infty[j] = (1.0/PI) * fabs(RefChain.Nsites * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j])
|
||||
|
||||
Ix2_infty[j] = (1.0/PI) * fabs(RefChain.Nsites * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j])
|
||||
- 0.5 * RefChain.Str_L[j] * RefChain.anis)) - sum1);
|
||||
|
||||
|
||||
} // The Ix2_infty are now set.
|
||||
|
||||
// Now compute the Ix2_max limits
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
Ix2_max[j] = int(floor(Ix2_infty[j])); // sets basic integer
|
||||
|
||||
// Reject formally infinite rapidities (i.e. if Delta is root of unity)
|
||||
|
@ -205,7 +206,7 @@ namespace JSC {
|
|||
if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
while (Ix2_max[j] > RefChain.Nsites) {
|
||||
Ix2_max[j] -= 2;
|
||||
Ix2_max[j] -= 2;
|
||||
}
|
||||
}
|
||||
} // if XXZ gapless
|
||||
|
@ -213,41 +214,41 @@ namespace JSC {
|
|||
else if (RefChain.Delta == 1.0) {
|
||||
|
||||
// Compute the Ix2_infty numbers
|
||||
|
||||
|
||||
int sum1 = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
sum1 = 0;
|
||||
|
||||
|
||||
for (int k = 0; k < RefChain.Nstrings; ++k) {
|
||||
|
||||
sum1 += Nrap[k] * (2 * JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
|
||||
sum1 += Nrap[k] * (2 * ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
//Ix2_infty[j] = (RefChain.Nsites - 1.0 + 2.0 * RefChain.Str_L[j] - sum1);
|
||||
Ix2_infty[j] = (RefChain.Nsites + 1.0 - sum1); // to get counting right...
|
||||
|
||||
|
||||
} // The Ix2_infty are now set.
|
||||
|
||||
|
||||
// Now compute the Ix2_max limits
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
Ix2_max[j] = int(floor(Ix2_infty[j])); // sets basic integer
|
||||
|
||||
// Give the correct parity to Ix2_max
|
||||
|
||||
|
||||
// If Nrap is even, Ix2_max must be odd. If odd, then even.
|
||||
|
||||
if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
// If Ix2_max equals Ix2_infty, we reduce it by 2:
|
||||
|
||||
|
||||
if (Ix2_max[j] == int(Ix2_infty[j])) Ix2_max[j] -= 2;
|
||||
|
||||
|
||||
while (Ix2_max[j] > RefChain.Nsites) {
|
||||
Ix2_max[j] -= 2;
|
||||
Ix2_max[j] -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,40 +257,40 @@ namespace JSC {
|
|||
else if (RefChain.Delta > 1.0) {
|
||||
|
||||
// Compute the Ix2_infty numbers
|
||||
|
||||
|
||||
int sum1 = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
sum1 = 0;
|
||||
|
||||
|
||||
for (int k = 0; k < RefChain.Nstrings; ++k) {
|
||||
|
||||
sum1 += Nrap[k] * (2 * JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
|
||||
sum1 += Nrap[k] * (2 * ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
Ix2_infty[j] = (RefChain.Nsites - 1 + 2 * RefChain.Str_L[j] - sum1);
|
||||
|
||||
|
||||
} // The Ix2_infty are now set.
|
||||
|
||||
|
||||
// Now compute the Ix2_max limits
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
Ix2_max[j] = int(floor(Ix2_infty[j])); // sets basic integer
|
||||
|
||||
// Give the correct parity to Ix2_max
|
||||
|
||||
|
||||
// If Nrap is even, Ix2_max must be odd. If odd, then even.
|
||||
|
||||
if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
|
||||
// If Ix2_max equals Ix2_infty, we reduce it by 2:
|
||||
|
||||
//if (Ix2_max[j] == Ix2_infty[j]) Ix2_max[j] -= 2;
|
||||
|
||||
while (Ix2_max[j] > RefChain.Nsites) {
|
||||
Ix2_max[j] -= 2;
|
||||
Ix2_max[j] -= 2;
|
||||
}
|
||||
|
||||
// Fudge, for strings:
|
||||
|
@ -304,4 +305,4 @@ namespace JSC {
|
|||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,18 +12,17 @@ Purpose: defines functions in Bethe_State class,
|
|||
providing a unified object for eigenstates of all
|
||||
Bethe Ansatz integrable models.
|
||||
|
||||
|
||||
|
||||
IN DEVELOPMENT
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
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) :
|
||||
base_id(base_id_ref), type_id(type_id_ref), id(id_ref), maxid(maxid_ref) {}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006-9.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: src/BETHE/Offsets.cc
|
||||
|
||||
Purpose: defines functions in Offsets class.
|
||||
|
||||
|
||||
Last modified: 19/10/2009
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function definitions: class Offsets
|
||||
|
||||
|
@ -31,7 +28,7 @@ namespace JSC {
|
|||
for (int i = 0; i < 2 * base.Nrap.size() + 2; ++i) Tableau[i] = RefOffset.Tableau[i];
|
||||
}
|
||||
|
||||
Offsets::Offsets (const Heis_Base& RefBase, long long int req_type_id)
|
||||
Offsets::Offsets (const Heis_Base& RefBase, long long int req_type_id)
|
||||
// sets all tableaux to empty ones, with nparticles(req_type_id) at each level
|
||||
{
|
||||
// Build nparticles vector from req_type_id
|
||||
|
@ -47,9 +44,9 @@ namespace JSC {
|
|||
|
||||
// Check if we've got the right vector...
|
||||
long long int idcheck = Offsets_type_id (nparticles);
|
||||
if (idcheck != req_type_id) JSCerror("idcheck != req_type_id in Offsets constructor.");
|
||||
if (idcheck != req_type_id) ABACUSerror("idcheck != req_type_id in Offsets constructor.");
|
||||
|
||||
(*this) = Offsets(RefBase, nparticles);
|
||||
(*this) = Offsets(RefBase, nparticles);
|
||||
}
|
||||
|
||||
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 {
|
|||
|
||||
// Checks on nparticles vector:
|
||||
|
||||
if (nparticles.size() != 2 * base.Nrap.size() + 2) JSCerror("Wrong nparticles.size in Offsets constructor.");
|
||||
|
||||
//if (base.Nrap[0] != (nparticles[3] + nparticles[2] + base.Mdown - nparticles[0] - nparticles[1])) JSCerror("Wrong Nrap[0] in Offsets constructor.");
|
||||
if (nparticles.size() != 2 * base.Nrap.size() + 2) ABACUSerror("Wrong nparticles.size in Offsets constructor.");
|
||||
|
||||
//if (base.Nrap[0] != (nparticles[3] + nparticles[2] + base.Mdown - nparticles[0] - nparticles[1])) ABACUSerror("Wrong Nrap[0] in Offsets constructor.");
|
||||
if (nparticles[3] + nparticles[2] != nparticles[0] + nparticles[1]) {
|
||||
cout << nparticles[0] << "\t" << nparticles[1] << "\t" << nparticles[2] << "\t" << nparticles[3] << endl;
|
||||
JSCerror("Wrong Npar[0-3] in Offsets constructor.");
|
||||
ABACUSerror("Wrong Npar[0-3] in Offsets constructor.");
|
||||
}
|
||||
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
|
||||
if (base.Nrap[base_level] != nparticles[2*base_level + 2] + nparticles[2*base_level + 3]) {
|
||||
cout << base_level << "\t" << base.Nrap[base_level] << "\t" << nparticles[2*base_level + 2] << "\t" << nparticles[2*base_level + 3] << endl;
|
||||
JSCerror("Wrong Nrap[] in Offsets constructor.");
|
||||
ABACUSerror("Wrong Nrap[] in Offsets constructor.");
|
||||
}
|
||||
|
||||
// nparticles[0,1]: number of holes on R and L side in GS interval
|
||||
if (nparticles[0] > (base.Nrap[0] + 1)/2) JSCerror("nparticles[0] too large in Offsets constructor.");
|
||||
if (nparticles[1] > base.Nrap[0]/2) JSCerror("nparticles[1] too large in Offsets constructor.");
|
||||
if (nparticles[0] > (base.Nrap[0] + 1)/2) ABACUSerror("nparticles[0] too large in Offsets constructor.");
|
||||
if (nparticles[1] > base.Nrap[0]/2) ABACUSerror("nparticles[1] too large in Offsets constructor.");
|
||||
|
||||
// nparticles[2,3]: number of particles of type 0 on R and L side out of GS interval
|
||||
if (nparticles[2] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) JSCerror("nparticles[2] too large in Offsets constructor.");
|
||||
if (nparticles[3] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) JSCerror("nparticles[3] too large in Offsets constructor.");
|
||||
if (nparticles[2] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) ABACUSerror("nparticles[2] too large in Offsets constructor.");
|
||||
if (nparticles[3] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) ABACUSerror("nparticles[3] too large in Offsets constructor.");
|
||||
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
|
||||
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)
|
||||
//|| (nparticles[2*base_level + 3] > 0 && nparticles[2*base_level + 3] > (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2)) {
|
||||
|| (nparticles[2*base_level + 3] > 0
|
||||
|| (nparticles[2*base_level + 3] > 0
|
||||
&& nparticles[2*base_level + 3] > base.Ix2_max[base_level] + 1 - (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)) {
|
||||
cout << base_level << "\t" << nparticles[2*base_level + 2] << "\t" << (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2
|
||||
<< "\t" << nparticles[2*base_level + 3] << "\t" << (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2
|
||||
<< "\t" << nparticles[2*base_level + 3] << "\t" << (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2
|
||||
<< "\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)
|
||||
//<< "\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)
|
||||
<< "\t" << (nparticles[2*base_level + 3] > 0) << "\t"
|
||||
<< "\t" << (nparticles[2*base_level + 3] > 0) << "\t"
|
||||
<< (nparticles[2*base_level + 3] > base.Ix2_max[base_level] + 1 - (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
|
||||
<< endl;
|
||||
JSCerror("nparticles too large in Offsets constructor.");
|
||||
ABACUSerror("nparticles too large in Offsets constructor.");
|
||||
}
|
||||
|
||||
|
||||
// Check sum of rapidities
|
||||
|
||||
// Holes in GS interval
|
||||
|
@ -104,14 +101,14 @@ namespace JSC {
|
|||
// Particles of type 0 out of GS interval
|
||||
Tableau[2] = Young_Tableau(nparticles[2], (base.Ix2_max[0] - base.Nrap[0] + 1)/2 - nparticles[2], Tableau[0]);
|
||||
Tableau[3] = Young_Tableau(nparticles[3], (base.Ix2_max[0] - base.Nrap[0] + 1)/2 - nparticles[3], Tableau[2]);
|
||||
|
||||
|
||||
// Tableaux of index i = 2,...: data about string type i/2-1.
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++base_level) {
|
||||
Tableau[2*base_level + 2] = Young_Tableau(nparticles[2*base_level + 2],
|
||||
Tableau[2*base_level + 2] = Young_Tableau(nparticles[2*base_level + 2],
|
||||
//(base.Ix2_max[base_level] - ((base.Nrap[base_level]) % 2) + 2)/2 - nparticles[2*base_level + 2], Tableau[2]);
|
||||
//(base.Ix2_max[base_level] - base.Nrap[base_level] % 2 + 2)/2 - nparticles[2*base_level + 2], Tableau[2]);
|
||||
(base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2))/2 + 1 - nparticles[2*base_level + 2], Tableau[2]);
|
||||
Tableau[2*base_level + 3] = Young_Tableau(nparticles[2*base_level + 3],
|
||||
Tableau[2*base_level + 3] = Young_Tableau(nparticles[2*base_level + 3],
|
||||
//(base.Ix2_max[base_level] - base.Nrap[base_level] % 2)/2 - nparticles[2*base_level + 3], Tableau[3]);
|
||||
(base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2 + 1 - nparticles[2*base_level + 3], Tableau[3]);
|
||||
}
|
||||
|
@ -147,11 +144,11 @@ namespace JSC {
|
|||
for (int level = 0; level < 4; ++level) { // check fundamental level only
|
||||
//for (int level = 0; level < 2 * base.Nrap.size() + 2; ++level) {
|
||||
// First check whether all rows which exist in both tableaux satisfy rule:
|
||||
for (int tableau_level = 0; tableau_level < JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] > RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
for (int tableau_level = 0; tableau_level < ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] > RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
answer = false;
|
||||
// Now check whether there exist extra rows violating rule:
|
||||
for (int tableau_level = JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < Tableau[level].Nrows; ++tableau_level)
|
||||
for (int tableau_level = ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < Tableau[level].Nrows; ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] > 0) answer = false;
|
||||
}
|
||||
|
||||
|
@ -167,11 +164,11 @@ namespace JSC {
|
|||
for (int level = 0; level < 4; ++level) { // check fundamental level only
|
||||
//for (int level = 0; level < 2 * base.Nrap.size() + 2; ++level) {
|
||||
// First check whether all rows which exist in both tableaux satisfy rule:
|
||||
for (int tableau_level = 0; tableau_level < JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] < RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
for (int tableau_level = 0; tableau_level < ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] < RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
answer = false;
|
||||
// Now check whether there exist extra rows violating rule:
|
||||
for (int tableau_level = JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < RefOffsets.Tableau[level].Nrows; ++tableau_level)
|
||||
for (int tableau_level = ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < RefOffsets.Tableau[level].Nrows; ++tableau_level)
|
||||
if (RefOffsets.Tableau[level].Row_L[tableau_level] > 0) answer = false;
|
||||
}
|
||||
|
||||
|
@ -190,13 +187,13 @@ namespace JSC {
|
|||
|
||||
void Offsets::Set_to_id (long long int idnr)
|
||||
{
|
||||
// The idnr of the Offset is given by
|
||||
// The idnr of the Offset is given by
|
||||
// sub_id[0] + (total number of tableaux of type 0) * (sub_id[1] + (total number of tableaux of type 1) * (sub_id[2] + ...
|
||||
// + total number of tableaux of type (2*base.Nrap.size()) * sub_id[2*base.Nrap.size() + 1]
|
||||
|
||||
if (idnr > maxid) {
|
||||
cout << idnr << "\t" << maxid << endl;
|
||||
JSCerror("idnr too large in offsets.Set_to_id.");
|
||||
ABACUSerror("idnr too large in offsets.Set_to_id.");
|
||||
}
|
||||
|
||||
id = idnr;
|
||||
|
@ -223,7 +220,7 @@ namespace JSC {
|
|||
|
||||
for (int i = 0; i <= 2*base.Nrap.size() + 1; ++i) {
|
||||
//cout << "level = " << i << " Tableau.id = " << sub_id[i] << endl;
|
||||
if ((Tableau[i].Nrows * Tableau[i].Ncols == 0) && (sub_id[i] != 0)) JSCerror("index too large in offset.Set_to_id.");
|
||||
if ((Tableau[i].Nrows * Tableau[i].Ncols == 0) && (sub_id[i] != 0)) ABACUSerror("index too large in offset.Set_to_id.");
|
||||
if (Tableau[i].id != sub_id[i]) Tableau[i].Set_to_id(sub_id[i]);
|
||||
}
|
||||
|
||||
|
@ -235,7 +232,7 @@ namespace JSC {
|
|||
void Offsets::Compute_id ()
|
||||
{
|
||||
long long int prod_maxid = 1LL;
|
||||
|
||||
|
||||
id = 0LL;
|
||||
|
||||
for (int i = 0; i < 2*base.Nrap.size() + 2; ++i) {
|
||||
|
@ -251,14 +248,14 @@ namespace JSC {
|
|||
// this function provides the full set of descendents (either at the same momentum if
|
||||
// fixed_iK == true, or not) by returning a vector of all descendent id's (leaving the
|
||||
// base and type invariant), which can then be used for further calculations.
|
||||
|
||||
|
||||
// This set of descendents is meant to be used when calculating either partition functions
|
||||
// or zero-temperature correlation functions.
|
||||
|
||||
// IMPORTANT ASSUMPTIONS:
|
||||
|
||||
// IMPORTANT ASSUMPTIONS:
|
||||
// - all even sectors consistently increase/decrease momentum for increasing tableau row length
|
||||
// - all odd sectors consistently decrease/increase momentum for increasing tableau row length
|
||||
|
||||
|
||||
// FOR FIXED MOMENTUM:
|
||||
// all tableau levels `above' the lowest occupied one are descended as for fixed_iK == false,
|
||||
// and the lowest sector's highest tableau level's row length is modified (increased or decreased by one
|
||||
|
@ -269,9 +266,9 @@ namespace JSC {
|
|||
Vect<Young_Tableau> Tableau_ref = (*this).Tableau;
|
||||
Vect<Young_Tableau> Tableau_desc = Tableau_ref;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c) 2006.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,15 +10,13 @@ Combinatorics.cc
|
|||
|
||||
Defines all class related to combinatorics.
|
||||
|
||||
LAST MODIFIED: 04/09/06
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
Choose_Table::Choose_Table ()
|
||||
: Npower(0ULL), Npowerp1(1ULL), table(new unsigned long long int[1])
|
||||
|
@ -33,7 +31,7 @@ namespace JSC {
|
|||
|
||||
// We can only go up to ULL_MAX:
|
||||
if (log(DP(ULLONG_MAX)) < DP(Npowerp1) * log(2.0))
|
||||
JSCerror("Choose_Table: too large to contruct.");
|
||||
ABACUSerror("Choose_Table: too large to contruct.");
|
||||
|
||||
table = new unsigned long long int[dim];
|
||||
|
||||
|
@ -62,8 +60,8 @@ namespace JSC {
|
|||
|
||||
unsigned long long int Choose_Table::choose(int N, int M)
|
||||
{
|
||||
if (N < 0 || N > Npower) JSCerror("N out of bounds in choose(N,M).");
|
||||
if (M < 0 || M > Npower) JSCerror("M out of bounds in choose(N,M).");
|
||||
if (N < 0 || N > Npower) ABACUSerror("N out of bounds in choose(N,M).");
|
||||
if (M < 0 || M > Npower) ABACUSerror("M out of bounds in choose(N,M).");
|
||||
|
||||
return(table[Npowerp1 * N + M]);
|
||||
}
|
||||
|
@ -86,4 +84,4 @@ namespace JSC {
|
|||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,18 +10,17 @@ File: 2CBG_ThLim.cc
|
|||
|
||||
Purpose: solves the TBA equations for the 2-component Bose gas
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
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).");
|
||||
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).");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP mu = atof(argv[2]);
|
||||
|
@ -30,10 +29,10 @@ int main(int argc, const char* argv[])
|
|||
int Max_Secs = 60 * atoi(argv[5]);
|
||||
bool Save_data = bool(atoi(argv[6]));
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (Omega <= 0.0) JSCerror("Give a strictly positive Omega, otherwise the algorithm cannot converge.");
|
||||
if (kBT <= 0.0) JSCerror("Negative T ? You must be a string theorist.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (Omega <= 0.0) ABACUSerror("Give a strictly positive Omega, otherwise the algorithm cannot converge.");
|
||||
if (kBT <= 0.0) ABACUSerror("Negative T ? You must be a string theorist.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Analyze_RAW_File.cc
|
||||
|
||||
Purpose: give some statistics for the matrix element distribution in a raw file.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 4) {
|
||||
if (argc != 4) {
|
||||
cout << "Argument needed: rawfile, iKmin, iKmax." << endl;
|
||||
JSCerror("");
|
||||
ABACUSerror("");
|
||||
}
|
||||
|
||||
const char* rawfilename = argv[1];
|
||||
|
@ -33,7 +33,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.open(rawfilename);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
DP omega;
|
||||
|
@ -72,7 +72,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
RAW_infile.close();
|
||||
|
||||
cout << "Inverse participation ratio: \t" << sumFF4/(sumFFsq*sumFFsq) << endl;
|
||||
cout << "Inverse participation ratio: \t" << sumFF4/(sumFFsq*sumFFsq) << endl;
|
||||
// Entropy is -sum (FFsq/sumFFsq) * ln(FFsq/sumFFsq) = sum (FFsq lnFFsq - FFsq ln sumFFsq)/sumFFsq
|
||||
cout << "Entropy: \t" << -(sumFFsqlnFFsq - sumFFsq * log(sumFFsq))/sumFFsq << endl;
|
||||
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Check_RAW_File.cc
|
||||
|
||||
Purpose: from a .raw_srt file, check that nonzero momentum states
|
||||
Purpose: from a .raw_srt file, check that nonzero momentum states
|
||||
appear (only) twice, and zero momentum ones (only) once.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 7) { // print out some instructions
|
||||
cout << "Usage of Check_RAW_File executable: provide the following arguments:" << endl;
|
||||
|
@ -29,7 +29,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
char* rawfilename = argv[1];
|
||||
int iKmin = atoi(argv[2]);
|
||||
int iKmax = atoi(argv[3]);
|
||||
int iKmax = atoi(argv[3]);
|
||||
int sympoint = atoi(argv[4]);
|
||||
DP FFmin = atof(argv[5]);
|
||||
int check_option = atoi(argv[6]);
|
||||
|
@ -38,7 +38,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.open(rawfilename);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open sorted RAW_infile... ");
|
||||
ABACUSerror("Could not open sorted RAW_infile... ");
|
||||
}
|
||||
|
||||
DP omega_next, omega, omega_prev;
|
||||
|
@ -88,14 +88,14 @@ int main(int argc, char* argv[])
|
|||
// << omega_next << "\t" << iK_next << "\t" << FF_next << "\t" << label_next << endl;
|
||||
line++;
|
||||
|
||||
if (label.compare(label_next) == 0)
|
||||
if (label.compare(label_next) == 0)
|
||||
cout << "Identical labels around line " << line << ": " << endl
|
||||
<< omega << "\t" << iK << "\t" << FF << "\t" << dev << "\t" << label << endl;
|
||||
|
||||
if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
|
||||
if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
&& fabs((FF - FF_prev)/(FF + FF_prev)) > 1.0e-6 && fabs((FF - FF_next)/(FF + FF_next)) > 1.0e-6) {
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
//<< omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << conv_prev << "\t" << label_prev << endl
|
||||
<< omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << dev_prev << "\t" << label_prev << endl
|
||||
//<< omega << "\t" << iK << "\t" << FF << "\t" << conv << "\t" << label << endl
|
||||
|
@ -119,10 +119,10 @@ int main(int argc, char* argv[])
|
|||
cin >> a;
|
||||
}
|
||||
|
||||
if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
&& fabs((omega - omega_prev)/(omega + omega_prev)) > 1.0e-6 && fabs((omega - omega_next)/(omega + omega_next)) > 1.0e-6) {
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
<< omega_prev << "\t" << iK_prev << "\t" << dev_prev << "\t" << label_prev << endl
|
||||
<< omega << "\t" << iK << "\t" << dev << "\t" << label << endl
|
||||
<< omega_next << "\t" << iK_next << "\t" << dev_next << "\t" << label_next << endl;
|
||||
|
@ -144,4 +144,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for Heisenberg spin-1/2 chain
|
||||
Purpose: main function for ABACUS for Heisenberg spin-1/2 chain
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 8) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
argsfile.open(argv[1]);
|
||||
if (argsfile.fail()) {
|
||||
cout << argv[1] << endl;
|
||||
JSCerror("Could not open arguments file.");
|
||||
ABACUSerror("Could not open arguments file.");
|
||||
}
|
||||
|
||||
char junk[256];
|
||||
|
@ -134,9 +134,8 @@ int main(int argc, char* argv[])
|
|||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, refine);
|
||||
}
|
||||
|
||||
else JSCerror("Wrong number of arguments to Heis_DSF executable.");
|
||||
else ABACUSerror("Wrong number of arguments to Heis_DSF executable.");
|
||||
*/
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_GeneralState.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for Heisenberg spin-1/2 chain
|
||||
Purpose: main function for ABACUS for Heisenberg spin-1/2 chain
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
|
||||
}
|
||||
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
@ -111,7 +111,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
|
||||
AveragingState.Compute_All(true);
|
||||
|
||||
|
||||
// Perform the scan:
|
||||
Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
|
||||
AveragingState.Compute_All(true);
|
||||
|
||||
|
||||
// Perform the scan:
|
||||
Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
}
|
||||
|
@ -130,4 +130,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc != 8) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
|
||||
DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time + 300) JSCerror("Please allow more time in Heis_DSF_par.");
|
||||
if (Max_Secs <= supercycle_time + 300) ABACUSerror("Please allow more time in Heis_DSF_par.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
// IMPORTANT PRECONDITION: no flags are being raised in General_Scan in parallel mode, so
|
||||
// the preinitializing serial run must be extensive enough to have flagged all base/type s necessary.
|
||||
|
||||
|
@ -83,30 +82,30 @@ int main(int argc, char *argv[])
|
|||
if (rank == 0)
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, nr_processors);
|
||||
|
||||
|
||||
//cout << "rank " << rank << " done preparing, ready to scan." << endl;
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
|
||||
supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
|
||||
//cout << "rank " << rank << " finished scanning, reached wrapup stage." << endl;
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
if (rank == 0)
|
||||
// Now that everybody is done, digest data into unique files
|
||||
if (rank == 0)
|
||||
Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, nr_processors);
|
||||
|
||||
//cout << "rank " << rank << " passed wrapup stage." << endl;
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
@ -117,4 +116,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par_Prepare executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 9 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Prepare.");
|
||||
if (argc != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -64,12 +63,11 @@ int main(int argc, char *argv[])
|
|||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par_Run.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par_Run executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Run.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Run.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
|
@ -69,12 +68,12 @@ int main(int argc, char *argv[])
|
|||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in Heis_DSF_par_Run.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in Heis_DSF_par_Run.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
|
@ -87,12 +86,12 @@ int main(int argc, char *argv[])
|
|||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
|
@ -100,21 +99,21 @@ int main(int argc, char *argv[])
|
|||
|
||||
while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
|
||||
supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
@ -124,4 +123,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare or Wrapup
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++G parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUSG parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 9 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
|
||||
if (argc != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -64,12 +63,11 @@ int main(int argc, char *argv[])
|
|||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,13 +12,14 @@ Purpose: Produces sets of data files for correlations, increasing system size a
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include <omp.h>
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 7) { // provide some info
|
||||
|
@ -45,7 +46,7 @@ int main(int argc, char* argv[])
|
|||
DP kBT = atof(argv[ia++]);
|
||||
DP target_sumrule = atof(argv[ia++]);
|
||||
int Max_Secs = atoi(argv[ia++]);
|
||||
|
||||
|
||||
|
||||
//clock_t StartTime = clock();
|
||||
double StartTime = omp_get_wtime();
|
||||
|
@ -76,9 +77,9 @@ int main(int argc, char* argv[])
|
|||
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
SRC_stringstream << ".src";
|
||||
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
||||
|
||||
|
||||
fstream srcfile;
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
if (srcfile.fail()) {
|
||||
srsat = 0.0;
|
||||
refine = false;
|
||||
|
@ -92,7 +93,7 @@ int main(int argc, char* argv[])
|
|||
ActualTime = omp_get_wtime();
|
||||
Secs_left = int(Max_Secs - (ActualTime - StartTime));
|
||||
|
||||
if (srsat < target_sumrule && Secs_left > Max_Secs/2)
|
||||
if (srsat < target_sumrule && Secs_left > Max_Secs/2)
|
||||
// Improve the icmin calculation by one chunk:
|
||||
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Secs_left, target_sumrule, refine);
|
||||
|
||||
|
@ -107,10 +108,9 @@ int main(int argc, char* argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
} // while there is time
|
||||
} // while there is time
|
||||
|
||||
} // else if arguments given OK
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for LiebLin gas
|
||||
Purpose: main function for ABACUS for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 11) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_GeneralState.cc
|
||||
|
||||
Purpose: function for ABACUS++ for LiebLin gas, on general states
|
||||
Purpose: function for ABACUS for LiebLin gas, on general states
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 11) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
|
@ -83,10 +83,10 @@ int main(int argc, char* argv[])
|
|||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine, 0, 1);
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine);
|
||||
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
// int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors)
|
||||
// Simplified function call of the above:
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
// int Max_Secs, DP target_sumrule, bool refine)
|
||||
Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine);
|
||||
|
||||
|
@ -94,4 +94,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_GeneralState_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -29,9 +28,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmax = atoi(argv[n++]);
|
||||
//kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_GeneralState_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_GeneralState_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -83,7 +82,7 @@ int main(int argc, char *argv[])
|
|||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
|
@ -98,9 +97,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Split up thread list into chunks, one per processor
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_GeneralState_par_Run.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -29,9 +28,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmax = atoi(argv[n++]);
|
||||
//kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
|
@ -72,14 +71,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= 120) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
if (Max_Secs <= 120) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
|
||||
int Max_Secs_used = Max_Secs - 120;
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
|
@ -95,18 +94,18 @@ int main(int argc, char *argv[])
|
|||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
//cout << i << "\t" << Ix2_input[i] << endl;
|
||||
}
|
||||
|
||||
|
||||
// Now define the AveragingState
|
||||
LiebLin_Bethe_State AveragingState(c_int, L, N);
|
||||
AveragingState.Ix2 = Ix2_input;
|
||||
AveragingState.Compute_All(true);
|
||||
|
||||
|
||||
|
||||
Vect<int> rank (paralevel);
|
||||
Vect<int> nr_processors (paralevel);
|
||||
|
@ -117,31 +116,31 @@ int main(int argc, char *argv[])
|
|||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
|
||||
|
||||
//while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
|
||||
if (Max_Secs_used > 0) {
|
||||
if (Max_Secs_used > 0) {
|
||||
|
||||
// Barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
// supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
} // while (tnow - tstart...
|
||||
|
@ -150,4 +149,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -29,9 +28,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmax = atoi(argv[n++]);
|
||||
//kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -81,7 +80,7 @@ int main(int argc, char *argv[])
|
|||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
|
@ -93,12 +92,11 @@ int main(int argc, char *argv[])
|
|||
AveragingState.Ix2 = Ix2_input;
|
||||
//AveragingState.Compute_All(true);
|
||||
*/
|
||||
|
||||
|
||||
// Digest files into a unique one for the latest paralevel:
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for LiebLin gas
|
||||
Purpose: main function for ABACUS for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 13) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
//cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
|
||||
cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
|
||||
|
@ -81,4 +81,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc != 12) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
|
||||
cout << "int supercycle_time \t\t time for one supercycle (in seconds)" << endl;
|
||||
|
@ -66,21 +65,21 @@ int main(int argc, char *argv[])
|
|||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
|
@ -106,27 +105,27 @@ int main(int argc, char *argv[])
|
|||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, MosesState, defaultScanStatename, iKmin, iKmax, supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
if (rank == 0)
|
||||
|
||||
if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
@ -136,4 +135,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 12) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par_Prepare executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int paralevel" << endl;
|
||||
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[])
|
|||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 12 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -73,24 +72,23 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
||||
|
||||
// Split the sea:
|
||||
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
|
||||
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
|
||||
|
||||
|
||||
MosesState.Compute_All (true);
|
||||
|
||||
|
||||
// Handy default name:
|
||||
stringstream defaultScanStatename_strstream;
|
||||
defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
|
||||
string defaultScanStatename = defaultScanStatename_strstream.str();
|
||||
|
||||
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 13) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par_Run executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int paralevel" << endl;
|
||||
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[])
|
|||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 13 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 13 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
|
@ -75,12 +74,12 @@ int main(int argc, char *argv[])
|
|||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
|
@ -95,33 +94,33 @@ int main(int argc, char *argv[])
|
|||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
||||
|
||||
// Split the sea:
|
||||
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
|
||||
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
|
||||
|
||||
|
||||
MosesState.Compute_All (true);
|
||||
|
||||
|
||||
// Handy default name:
|
||||
stringstream defaultScanStatename_strstream;
|
||||
defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
|
||||
string defaultScanStatename = defaultScanStatename_strstream.str();
|
||||
|
||||
|
||||
//cout << "rank " << rank_here << " out of " << nr_processors_here << " waiting at barrier." << endl;
|
||||
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
|
||||
while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
|
||||
|
||||
|
@ -129,27 +128,27 @@ int main(int argc, char *argv[])
|
|||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, MosesState, defaultScanStatename, iKmin, iKmax, supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
//if (rank == 0)
|
||||
|
||||
//if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
@ -159,4 +158,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_MosesState_par_Wrapup.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 12) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int paralevel" << endl;
|
||||
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[])
|
|||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 12 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -73,24 +72,23 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
||||
|
||||
// Split the sea:
|
||||
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
|
||||
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
|
||||
|
||||
|
||||
MosesState.Compute_All (true);
|
||||
|
||||
|
||||
// Handy default name:
|
||||
stringstream defaultScanStatename_strstream;
|
||||
defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
|
||||
string defaultScanStatename = defaultScanStatename_strstream.str();
|
||||
|
||||
|
||||
|
||||
|
||||
// Digest files into a unique one for the latest paralevel:
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_over_Ensemble.cc
|
||||
|
||||
Purpose: main function for ABACUS++T for LiebLin gas, averaging over an Ensemble.
|
||||
Purpose: main function for ABACUS for LiebLin gas, averaging over an Ensemble.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
// Now perform the DSF calculation over each state in the ensemble, distributing the time according to the weight
|
||||
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors)
|
||||
//Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, int(Max_Secs * ensemble.weight[ns]), 1.0e+6, refine, 0, 1);
|
||||
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[])
|
|||
Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
|
||||
FSR_string = FSR_stringstream.str(); const char* FSR_Cstr = FSR_string.c_str();
|
||||
|
||||
|
||||
DP Chem_Pot = 0.0;
|
||||
|
||||
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[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,19 +12,19 @@ Purpose: main function for ABACUS for LiebLin gas, averaging over an Ensemble,
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
int Max_Secs = atoi(argv[8]);
|
||||
bool refine = (atoi(argv[9]) == 1);
|
||||
|
||||
if (refine == false) JSCerror("Please run the serial version of LiebLin_DSF_over_Ensemble first.");
|
||||
if (refine == false) ABACUSerror("Please run the serial version of LiebLin_DSF_over_Ensemble first.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
|
||||
// Start by constructing (or loading) the state ensemble.
|
||||
|
@ -91,16 +91,16 @@ int main(int argc, char* argv[])
|
|||
|
||||
/* Original implementation: Scan always called serially. Superseded by version below, using successive parallel scans on each state in the ensemble.
|
||||
int nDSFperproc = ensemble.nstates/nr_processors + 1;
|
||||
//if (ensemble.nstates % nr_processors) JSCerror("Use nr_processors * integer multiple == ensemble.nstates in LiebLin_DSF_over_Ensemble_par.");
|
||||
|
||||
// Processor with rank r does all
|
||||
//if (ensemble.nstates % nr_processors) ABACUSerror("Use nr_processors * integer multiple == ensemble.nstates in LiebLin_DSF_over_Ensemble_par.");
|
||||
|
||||
// Processor with rank r does all
|
||||
|
||||
int ns;
|
||||
int Max_Secs_used = Max_Secs/nDSFperproc;
|
||||
|
||||
for (int ir = 0; ir < nDSFperproc; ++ir) {
|
||||
ns = rank + ir * nr_processors;
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors)
|
||||
if (ns < ensemble.nstates) {
|
||||
//cout << "Processor rank " << rank << " going for ns = " << ns << " out of " << ensemble.nstates << endl;
|
||||
|
@ -117,13 +117,13 @@ int main(int argc, char* argv[])
|
|||
|
||||
DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs_used <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
|
||||
if (Max_Secs_used <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
|
||||
|
||||
// Main loop over ensemble:
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
|
||||
tstart = MPI::Wtime();
|
||||
DP tnow = MPI::Wtime();
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
string defaultScanStatename = ensemble.state[ns].label;
|
||||
|
||||
|
@ -133,31 +133,31 @@ int main(int argc, char* argv[])
|
|||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
//supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, supercycle_time, 1.0e+6, refine, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
if (rank == 0)
|
||||
|
||||
if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
||||
} // while (tnow - tstart...
|
||||
|
||||
} // for ns
|
||||
|
@ -174,9 +174,9 @@ int main(int argc, char* argv[])
|
|||
Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
|
||||
FSR_string = FSR_stringstream.str(); const char* FSR_Cstr = FSR_string.c_str();
|
||||
|
||||
|
||||
DP Chem_Pot = 0.0;
|
||||
|
||||
|
||||
Evaluate_F_Sumrule (whichDSF, c_int, L, N, kBT, ensemble.nstates, Chem_Pot, iKmin, iKmax, FSR_Cstr);
|
||||
}
|
||||
|
||||
|
@ -188,4 +188,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
|
@ -86,27 +85,27 @@ int main(int argc, char *argv[])
|
|||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
if (rank == 0)
|
||||
|
||||
if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
@ -116,4 +115,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmax = atoi(argv[n++]);
|
||||
kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -66,12 +65,11 @@ int main(int argc, char *argv[])
|
|||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Run.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Run executable: " << endl;
|
||||
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;
|
||||
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;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmax = atoi(argv[n++]);
|
||||
kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Run.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Run.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
|
@ -65,14 +64,14 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
Max_Secs = atoi(argv[n++]);
|
||||
|
||||
if (Max_Secs < 120) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
if (Max_Secs < 120) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
|
||||
int Max_Secs_used = Max_Secs - 120;
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
|
@ -85,12 +84,12 @@ int main(int argc, char *argv[])
|
|||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
|
@ -100,21 +99,20 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
Max_Secs_used, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
MPI::Finalize();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Wrapup.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare or Wrapup
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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;
|
||||
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[])
|
|||
iKmax = atoi(argv[n++]);
|
||||
kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Wrapup.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Wrapup.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
|
@ -66,12 +65,11 @@ int main(int argc, char *argv[])
|
|||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Digest files into a unique one for the latest paralevel:
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,18 +12,18 @@ Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 6) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
int N = atoi(argv[4]);
|
||||
DP kBT = atof(argv[5]);
|
||||
|
||||
//if (whichDSF != 'd') JSCerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
//if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
|
||||
// Delta is the number of sites involved in the smoothing of the entropy
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
|
||||
// Construct the finite-size saddle-point state:
|
||||
//LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
|
||||
|
@ -73,11 +73,11 @@ int main(int argc, char* argv[])
|
|||
estate.Compute_All(false);
|
||||
cout << spstate << endl;
|
||||
cout << estate;
|
||||
if (whichDSF == 'd')
|
||||
if (whichDSF == 'd')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
|
||||
else if (whichDSF == 'o')
|
||||
else if (whichDSF == 'o')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
|
||||
else if (whichDSF == 'g')
|
||||
else if (whichDSF == 'g')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
|
||||
|
||||
//cout << "Another try ? (1 == yes, 0 == no)" << endl;
|
||||
|
@ -89,4 +89,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,18 +12,18 @@ Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 6) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
int N = atoi(argv[4]);
|
||||
DP kBT = atof(argv[5]);
|
||||
|
||||
//if (whichDSF != 'd') JSCerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
//if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
|
||||
// Delta is the number of sites involved in the smoothing of the entropy
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
|
||||
// Construct the finite-size saddle-point state:
|
||||
//LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
|
||||
|
@ -73,11 +73,11 @@ int main(int argc, char* argv[])
|
|||
estate.Compute_All(false);
|
||||
cout << spstate << endl;
|
||||
cout << estate;
|
||||
if (whichDSF == 'd')
|
||||
if (whichDSF == 'd')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
|
||||
else if (whichDSF == 'o')
|
||||
else if (whichDSF == 'o')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
|
||||
else if (whichDSF == 'g')
|
||||
else if (whichDSF == 'g')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
|
||||
|
||||
cout << "Another try ? (1 == yes, 0 == no)" << endl;
|
||||
|
@ -89,4 +89,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,13 +12,14 @@ Purpose: Produces sets of data files for correlations.
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include <omp.h>
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 11) { // provide some info
|
||||
|
@ -50,7 +51,7 @@ int main(int argc, char* argv[])
|
|||
DP kBT = atof(argv[ia++]);
|
||||
int Max_Hrs = atoi(argv[ia++]);
|
||||
|
||||
// Individual computations are split into chuncks of Max_Hrs/(Nc * 4)
|
||||
// Individual computations are split into chuncks of Max_Hrs/(Nc * 4)
|
||||
//int Max_Secs = (Max_Hrs * 900)/Nc;
|
||||
int Max_Secs = (Max_Hrs * 2700)/Nc; // to minimize wrapping up & restarting time
|
||||
|
||||
|
@ -63,13 +64,13 @@ int main(int argc, char* argv[])
|
|||
double ActualTime = omp_get_wtime();
|
||||
|
||||
DP c_int;
|
||||
DP target_sumrule = 1.0;
|
||||
DP target_sumrule = 1.0;
|
||||
|
||||
//while (double(ActualTime - StartTime)/CLOCKS_PER_SEC < double(3600 * Max_Hrs - Max_Secs)) {
|
||||
while (ActualTime - StartTime < double(3600 * Max_Hrs - Max_Secs)) {
|
||||
|
||||
Vect<DP> srsat(0.0, Nc);
|
||||
Vect<bool> refine(false, Nc);
|
||||
Vect<bool> refine(false, Nc);
|
||||
DP srmin = 1.0;
|
||||
int icmin = 0;
|
||||
|
||||
|
@ -80,9 +81,9 @@ int main(int argc, char* argv[])
|
|||
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
SRC_stringstream << ".src";
|
||||
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
||||
|
||||
|
||||
fstream srcfile;
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
if (srcfile.fail()) {
|
||||
srsat[ic] = 0.0;
|
||||
refine[ic] = false;
|
||||
|
@ -97,9 +98,9 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
srcfile.close();
|
||||
|
||||
} // for ic
|
||||
} // for ic
|
||||
|
||||
cout << "srsat min found: " << srmin << "\t for c = " << c_int_max/pow(cfact, icmin) << ". Now refining this."
|
||||
cout << "srsat min found: " << srmin << "\t for c = " << c_int_max/pow(cfact, icmin) << ". Now refining this."
|
||||
//<< " Time left: " << 3600* Max_Hrs - (ActualTime - StartTime)/CLOCKS_PER_SEC << " seconds." << endl;
|
||||
<< " Time left: " << 3600* Max_Hrs - (ActualTime - StartTime) << " seconds." << endl;
|
||||
|
||||
|
@ -109,7 +110,7 @@ int main(int argc, char* argv[])
|
|||
//ActualTime = clock();
|
||||
ActualTime = omp_get_wtime();
|
||||
|
||||
} // while there is time
|
||||
} // while there is time
|
||||
|
||||
cout << "Wrapping up, time's up." << endl;
|
||||
|
||||
|
@ -117,4 +118,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,13 +12,14 @@ Purpose: Produces sets of data files for correlations, increasing system size a
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include <omp.h>
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 9) { // provide some info
|
||||
|
@ -46,7 +47,7 @@ int main(int argc, char* argv[])
|
|||
DP kBT = atof(argv[ia++]);
|
||||
DP target_sumrule = atof(argv[ia++]);
|
||||
int Max_minutes = atoi(argv[ia++]);
|
||||
|
||||
|
||||
|
||||
//clock_t StartTime = clock();
|
||||
double StartTime = omp_get_wtime();
|
||||
|
@ -57,7 +58,7 @@ int main(int argc, char* argv[])
|
|||
int Secs_left = 60* Max_minutes;
|
||||
|
||||
int iN = 0;
|
||||
|
||||
|
||||
while (Secs_left > 0) {
|
||||
|
||||
iN += 1;
|
||||
|
@ -72,9 +73,9 @@ int main(int argc, char* argv[])
|
|||
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
SRC_stringstream << ".src";
|
||||
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
||||
|
||||
|
||||
fstream srcfile;
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
if (srcfile.fail()) {
|
||||
srsat = 0.0;
|
||||
refine = false;
|
||||
|
@ -95,10 +96,9 @@ int main(int argc, char* argv[])
|
|||
|
||||
cout << "Done with N = " << N << ". Time left = " << Secs_left << " seconds." << endl;
|
||||
|
||||
} // while there is time
|
||||
} // while there is time
|
||||
|
||||
} // else if arguments given OK
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: Compute the Q(x)^2 expectation value for LiebLin, where Q(x) = \int_0^
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_Qsqx executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
// Force Npts_x
|
||||
//Npts_x = L;
|
||||
|
||||
if (whichDSF != 'd') JSCerror("Must use whichDSF == d in LiebLin_Fourier_ssf_to_Qsqx");
|
||||
if (whichDSF != 'd') ABACUSerror("Must use whichDSF == d in LiebLin_Fourier_ssf_to_Qsqx");
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
|
@ -59,7 +59,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// We also read the f-sumrule file, to correct for missing intensity.
|
||||
|
@ -70,7 +70,7 @@ int main(int argc, char* argv[])
|
|||
FSR_infile.open(FSR_Cstr);
|
||||
if (FSR_infile.fail()) {
|
||||
cout << FSR_Cstr << endl;
|
||||
JSCerror("Could not open FSR_infile... ");
|
||||
ABACUSerror("Could not open FSR_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
|||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
|
@ -100,7 +100,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.close();
|
||||
|
||||
// Reset proper normalization:
|
||||
DP normalization = twoPI * L;
|
||||
DP normalization = twoPI * L;
|
||||
for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
|
||||
|
||||
|
||||
|
@ -121,15 +121,15 @@ int main(int argc, char* argv[])
|
|||
// Reset proper normalization: 1/L from space FT,
|
||||
FT[ix] *= 2.0*L/(PI * PI);
|
||||
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
|
||||
// so SSF becomes N/L.
|
||||
// We thus need to correct above by adding
|
||||
// \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
|
||||
// Resumming carefully:
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
DP t_max = atof(argv[9]);
|
||||
|
||||
// Momentum business: use symmetry
|
||||
if (iKmin != 0) JSCerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
|
@ -60,7 +60,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// We also read the f-sumrule file, to correct for missing intensity.
|
||||
|
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
|||
FSR_infile.open(FSR_Cstr);
|
||||
if (FSR_infile.fail()) {
|
||||
cout << FSR_Cstr << endl;
|
||||
JSCerror("Could not open FSR_infile... ");
|
||||
ABACUSerror("Could not open FSR_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
|
@ -79,7 +79,7 @@ int main(int argc, char* argv[])
|
|||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open TFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
|
@ -103,11 +103,11 @@ int main(int argc, char* argv[])
|
|||
|
||||
while (RAW_infile.peek() != EOF) {
|
||||
RAW_infile >> omega >> iK >> FF >> dev >> label;
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += FF * FF * exp(II * omega * tlattice[it]);
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
|
||||
}
|
||||
RAW_infile.close();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
DP t_max = atof(argv[9]);
|
||||
|
||||
// Momentum business: use symmetry
|
||||
if (iKmin != 0) JSCerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
|
||||
ifstream RAW_infile;
|
||||
//RAW_infile.open(RAW_Cstr);
|
||||
|
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
|||
if (RAW_infile.fail()) {
|
||||
//cout << RAW_Cstr << endl;
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
|
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
|
|||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open TFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
|
@ -89,11 +89,11 @@ int main(int argc, char* argv[])
|
|||
|
||||
while (RAW_infile.peek() != EOF) {
|
||||
RAW_infile >> omega >> iK >> FF >> dev >> label;
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += FF * FF * exp(II * omega * tlattice[it]);
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
|
||||
}
|
||||
RAW_infile.close();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
|
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// We also read the f-sumrule file, to correct for missing intensity.
|
||||
|
@ -68,7 +68,7 @@ int main(int argc, char* argv[])
|
|||
FSR_infile.open(FSR_Cstr);
|
||||
if (FSR_infile.fail()) {
|
||||
cout << FSR_Cstr << endl;
|
||||
JSCerror("Could not open FSR_infile... ");
|
||||
ABACUSerror("Could not open FSR_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
|
@ -76,7 +76,7 @@ int main(int argc, char* argv[])
|
|||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
|
@ -98,7 +98,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.close();
|
||||
|
||||
// Reset proper normalization:
|
||||
DP normalization = twoPI * L;
|
||||
DP normalization = twoPI * L;
|
||||
for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
|
||||
|
||||
// We now refine the SSF in the following way.
|
||||
|
@ -142,23 +142,23 @@ int main(int argc, char* argv[])
|
|||
FTre[ix] /= L;
|
||||
FTim[ix] /= L;
|
||||
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
|
||||
// so SSF becomes N/L.
|
||||
// We thus need to correct above by adding
|
||||
// \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
|
||||
// Resumming carefully:
|
||||
if (whichDSF == 'd') {
|
||||
FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
}
|
||||
}
|
||||
|
||||
// Since iKmax and iKmin are finite, we need to average over an interval of
|
||||
// Since iKmax and iKmin are finite, we need to average over an interval of
|
||||
// deltax such that (2\pi/L) iKmax deltax = 2\pi, with deltax == deltaix * L/Npts_x
|
||||
// so deltaix = (Npts_x/L) * (L/iKmax)
|
||||
// so deltaix = (Npts_x/L) * (L/iKmax)
|
||||
/*
|
||||
int deltaix = 0*int(Npts_x/(2.0*iKmax));
|
||||
cout << "deltaix = " << deltaix << endl;
|
||||
|
@ -167,8 +167,8 @@ int main(int argc, char* argv[])
|
|||
Vect_DP FTimavg(0.0, Npts_x);
|
||||
for (int ix = 0; ix < Npts_x; ++ix) {
|
||||
for (int ix2 = -deltaix; ix2 < deltaix; ++ix2) {
|
||||
FTreavg[ix] += FTre[JSC::min(JSC::max(0, ix + ix2), Npts_x - 1)];
|
||||
FTimavg[ix] += FTim[JSC::min(JSC::max(0, ix + ix2), Npts_x - 1)];
|
||||
FTreavg[ix] += FTre[ABACUS::min(ABACUS::max(0, ix + ix2), Npts_x - 1)];
|
||||
FTimavg[ix] += FTim[ABACUS::min(ABACUS::max(0, ix + ix2), Npts_x - 1)];
|
||||
}
|
||||
FTreavg[ix] /= (2*deltaix + 1);
|
||||
FTimavg[ix] /= (2*deltaix + 1);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
|
||||
//stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
//string prefix = filenameprefix.str();
|
||||
//string prefix = filenameprefix.str();
|
||||
|
||||
//stringstream RAW_stringstream; string RAW_string;
|
||||
//RAW_stringstream << prefix << ".raw";
|
||||
|
@ -61,7 +61,7 @@ int main(int argc, char* argv[])
|
|||
if (RAW_infile.fail()) {
|
||||
//cout << RAW_Cstr << endl;
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// Define the output file name: use the RAW file name but with different suffix
|
||||
|
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
|||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
|
@ -93,7 +93,7 @@ int main(int argc, char* argv[])
|
|||
RAW_infile.close();
|
||||
|
||||
// Reset proper normalization:
|
||||
DP normalization = twoPI * L;
|
||||
DP normalization = twoPI * L;
|
||||
for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
|
||||
|
||||
|
||||
|
@ -117,16 +117,16 @@ int main(int argc, char* argv[])
|
|||
FTre[ix] /= L;
|
||||
FTim[ix] /= L;
|
||||
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
|
||||
// so SSF becomes N/L.
|
||||
// We thus need to correct above by adding
|
||||
// \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
|
||||
// Resumming carefully:
|
||||
//if (whichDSF == 'd') {
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
// * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
// * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,18 +12,18 @@ Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 8) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
}
|
||||
|
||||
else { // (argc == 6), correct nr of arguments
|
||||
|
@ -45,7 +45,7 @@ int main(int argc, char* argv[])
|
|||
int DIl = atoi(argv[6]);
|
||||
int DIr = atoi(argv[7]);
|
||||
|
||||
if (whichDSF != 'd') JSCerror("Other options not implemented yet in LiebLin_Moses_tester");
|
||||
if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in LiebLin_Moses_tester");
|
||||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
@ -76,4 +76,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -13,18 +13,18 @@ Purpose: Analyzes the distribution of matrix element values in a RAW file,
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_RAW_File_Stats executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
DP kBT = atof(argv[7]);
|
||||
int AgSize = atoi(argv[8]);
|
||||
|
||||
if (AgSize < 2) JSCerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
if (AgSize < 2) ABACUSerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
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[])
|
|||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
stringstream STAT_stringstream; string STAT_string;
|
||||
|
@ -66,9 +66,9 @@ int main(int argc, char* argv[])
|
|||
STAT_string = STAT_stringstream.str(); const char* STAT_Cstr = STAT_string.c_str();
|
||||
|
||||
ofstream STATfile;
|
||||
STATfile.open(STAT_Cstr);
|
||||
STATfile.open(STAT_Cstr);
|
||||
if (STATfile.fail()) {
|
||||
cout << STAT_Cstr << endl; JSCerror("Could not open STATfile.");
|
||||
cout << STAT_Cstr << endl; ABACUSerror("Could not open STATfile.");
|
||||
}
|
||||
|
||||
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[])
|
|||
DP Chem_Pot = Chemical_Potential (AveragingState);
|
||||
//DP sumrule_factor = Sumrule_Factor (whichDSF, AveragingState, Chem_Pot, fixed_iK, iKneeded);
|
||||
Vect<DP> sumrule_factor(iKmax - iKmin + 1);
|
||||
for (int ik = 0; ik < iKmax - iKmin + 1; ++ik)
|
||||
for (int ik = 0; ik < iKmax - iKmin + 1; ++ik)
|
||||
sumrule_factor[ik] = Sumrule_Factor (whichDSF, AveragingState, Chem_Pot, ik, ik);
|
||||
// Normalize by total number of considered momenta
|
||||
DP correction_factor = 1.0/(iKmax - iKmin + 1);
|
||||
|
@ -92,7 +92,7 @@ int main(int argc, char* argv[])
|
|||
DP ME;
|
||||
DP dev;
|
||||
string label;
|
||||
|
||||
|
||||
int nread = 0;
|
||||
|
||||
DP srcont = 0.0;
|
||||
|
@ -106,11 +106,11 @@ int main(int argc, char* argv[])
|
|||
|
||||
RAW_infile >> omega >> iK >> ME >> dev >> label;
|
||||
nread++;
|
||||
|
||||
|
||||
if (iK >= iKmin && iK <= iKmax) {
|
||||
srcont = omega * ME * ME * sumrule_factor[iK - iKmin];
|
||||
abssrcont = fabs(srcont);
|
||||
maxsrcont = JSC::max(maxsrcont, abssrcont);
|
||||
maxsrcont = ABACUS::max(maxsrcont, abssrcont);
|
||||
totsrcont += srcont;
|
||||
accumulatedsrcont += srcont;
|
||||
naccounted++;
|
||||
|
@ -123,7 +123,7 @@ int main(int argc, char* argv[])
|
|||
totsrcont = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RAW_infile.close();
|
||||
STATfile.close();
|
||||
}
|
||||
|
@ -131,4 +131,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,19 +10,18 @@ File: LiebLin_TBA.cc
|
|||
|
||||
Purpose: solves the TBA equations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
//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).");
|
||||
if (argc != 6) JSCerror("Wrong number of arguments. Use c(best to set to 1), mu, kBT, req_diff, Max_Secs");
|
||||
//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).");
|
||||
if (argc != 6) ABACUSerror("Wrong number of arguments. Use c(best to set to 1), mu, kBT, req_diff, Max_Secs");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP mu = atof(argv[2]);
|
||||
|
@ -30,9 +29,9 @@ int main(int argc, const char* argv[])
|
|||
DP req_diff = atof(argv[4]);
|
||||
int Max_Secs = atoi(argv[5]);
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) JSCerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) ABACUSerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,19 +10,18 @@ File: LiebLin_TBA_fixed_nbar.cc
|
|||
|
||||
Purpose: solves the TBA equations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
//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).");
|
||||
if (argc != 6) JSCerror("Wrong number of arguments. Use c(best to set to 1), nbar, kBT, req_diff, Max_Secs");
|
||||
//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).");
|
||||
if (argc != 6) ABACUSerror("Wrong number of arguments. Use c(best to set to 1), nbar, kBT, req_diff, Max_Secs");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP nbar = atof(argv[2]);
|
||||
|
@ -30,9 +29,9 @@ int main(int argc, const char* argv[])
|
|||
DP req_diff = atof(argv[4]);
|
||||
int Max_Secs = atoi(argv[5]);
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) JSCerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) ABACUSerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,18 +10,17 @@ File: LiebLin_TBA_fixed_nbar_ebar.cc
|
|||
|
||||
Purpose: solves the TBA equations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
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).");
|
||||
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).");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP nbar = atof(argv[2]);
|
||||
|
@ -30,8 +29,8 @@ int main(int argc, const char* argv[])
|
|||
int Max_Secs = atoi(argv[5]);
|
||||
bool Save_data = bool(atoi(argv[6]));
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ODSLF_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for spinless fermions related to Heisenberg spin-1/2 chain
|
||||
Purpose: main function for ABACUS for spinless fermions related to Heisenberg spin-1/2 chain
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << "Usage of ODSLF_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
}
|
||||
|
||||
|
||||
else JSCerror("Wrong number of arguments to ODSLF_DSF executable.");
|
||||
else ABACUSerror("Wrong number of arguments to ODSLF_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Sort_RAW_File.cc
|
||||
|
||||
Purpose: produce a sorted .raw file.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 4) {
|
||||
if (argc != 4) {
|
||||
cout << "Arguments needed: rawfile, whichDSF, whichsorting." << endl;
|
||||
JSCerror("");
|
||||
ABACUSerror("");
|
||||
}
|
||||
|
||||
const char* rawfilename = argv[1];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -13,18 +13,18 @@ Purpose: Analyzes the distribution of matrix element values in a RAW file,
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 3) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of RAW_File_Stats executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << endl << "string RAW file name" << endl;
|
||||
|
@ -35,13 +35,13 @@ int main(int argc, char* argv[])
|
|||
const char* rawfilename = argv[1];
|
||||
int AgSize = atoi(argv[2]);
|
||||
|
||||
if (AgSize < 2) JSCerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
if (AgSize < 2) ABACUSerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
|
||||
ifstream RAW_infile;
|
||||
RAW_infile.open(rawfilename);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
stringstream STAT_stringstream; string STAT_string;
|
||||
|
@ -49,9 +49,9 @@ int main(int argc, char* argv[])
|
|||
STAT_string = STAT_stringstream.str(); const char* STAT_Cstr = STAT_string.c_str();
|
||||
|
||||
ofstream STATfile;
|
||||
STATfile.open(STAT_Cstr);
|
||||
STATfile.open(STAT_Cstr);
|
||||
if (STATfile.fail()) {
|
||||
cout << STAT_Cstr << endl; JSCerror("Could not open STATfile.");
|
||||
cout << STAT_Cstr << endl; ABACUSerror("Could not open STATfile.");
|
||||
}
|
||||
|
||||
DP omega;
|
||||
|
@ -59,7 +59,7 @@ int main(int argc, char* argv[])
|
|||
DP ME;
|
||||
DP dev;
|
||||
string label;
|
||||
|
||||
|
||||
int nread = 0;
|
||||
|
||||
DP srcont = 0.0;
|
||||
|
@ -73,10 +73,10 @@ int main(int argc, char* argv[])
|
|||
|
||||
RAW_infile >> omega >> iK >> ME >> dev >> label;
|
||||
nread++;
|
||||
|
||||
|
||||
srcont = ME * ME;
|
||||
abssrcont = fabs(srcont);
|
||||
maxsrcont = JSC::max(maxsrcont, abssrcont);
|
||||
maxsrcont = ABACUS::max(maxsrcont, abssrcont);
|
||||
totsrcont += srcont;
|
||||
accumulatedsrcont += srcont;
|
||||
naccounted++;
|
||||
|
@ -88,7 +88,7 @@ int main(int argc, char* argv[])
|
|||
totsrcont = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RAW_infile.close();
|
||||
STATfile.close();
|
||||
}
|
||||
|
@ -96,4 +96,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,13 +12,13 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13 && argc != 14) { // Print out instructions
|
||||
//if (strcmp(argv[1],"help") == 0) { // Output some instructions
|
||||
|
@ -26,7 +26,7 @@ int main(int argc, char* argv[])
|
|||
cout << "Provide arguments using one of the following options:" << endl << endl;
|
||||
cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax DiK kBT ommin ommax Nom gwidth" << endl << endl;
|
||||
cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
|
||||
//else JSCerror("Incomprehensible arguments in Smoothen_Heis_DSF executable.");
|
||||
//else ABACUSerror("Incomprehensible arguments in Smoothen_Heis_DSF executable.");
|
||||
}
|
||||
|
||||
else if (argc == 13) { // !fixed_iK
|
||||
|
@ -45,7 +45,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, kBT, 0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
DP denom_sum_K = 1.0/N;
|
||||
|
@ -74,7 +74,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, fixed_iK, iKneeded, 0.0, 0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
int iKmin = iKneeded;
|
||||
|
@ -84,7 +84,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
*/
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
DP denom_sum_K = L;
|
||||
|
@ -69,7 +69,7 @@ int main(int argc, char* argv[])
|
|||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
//sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
|
@ -88,14 +88,14 @@ int main(int argc, char* argv[])
|
|||
DP ommax = atof(argv[8]);
|
||||
int Nom = atoi(argv[9]);
|
||||
DP gwidth = atof(argv[10]);
|
||||
|
||||
|
||||
//bool fixed_iK = true;
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 0.0);
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, iKneeded, iKneeded, 0.0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
int iKmin = iKneeded;
|
||||
|
@ -105,7 +105,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
*/
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, defaultScanStatename);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
DP denom_sum_K = L;
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
|||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
//sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
|
@ -97,14 +97,14 @@ int main(int argc, char* argv[])
|
|||
DP ommax = atof(argv[8]);
|
||||
int Nom = atoi(argv[9]);
|
||||
DP gwidth = atof(argv[10]);
|
||||
|
||||
|
||||
//bool fixed_iK = true;
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 0.0);
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, iKneeded, iKneeded, 0.0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
int iKmin = iKneeded;
|
||||
|
@ -114,7 +114,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
*/
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 15) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF_MosesState executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
cout << "DP L \t\t\t Length of the system" << endl;
|
||||
cout << "int N \t\t\t Number of particles" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers" << endl;
|
||||
//cout << "DP kBT \t\t Temperature" << endl;
|
||||
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[])
|
|||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, defaultScanStatename);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
|
||||
|
||||
|
@ -84,14 +84,14 @@ int main(int argc, char* argv[])
|
|||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
//sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
//cout << "Smoothing: sumcheck = " << sumcheck << endl;
|
||||
}
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: produces .dsfs and .ssf files from a .raw file
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF_Scaled executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
//DP denom_sum_K = L;
|
||||
|
@ -69,14 +69,14 @@ int main(int argc, char* argv[])
|
|||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
//sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
//cout << "Smoothing: sumcheck = " << sumcheck << endl;
|
||||
}
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from an ensemble of .raw files
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF_over_Ensemble executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
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[])
|
|||
|
||||
}
|
||||
|
||||
else if (argc == 13) {
|
||||
else if (argc == 13) {
|
||||
char whichDSF = *argv[1];
|
||||
DP c_int = atof(argv[2]);
|
||||
DP L = atof(argv[3]);
|
||||
|
@ -60,7 +60,7 @@ int main(int argc, char* argv[])
|
|||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
DP denom_sum_K = L;
|
||||
|
@ -85,16 +85,16 @@ int main(int argc, char* argv[])
|
|||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
// Define the raw input file name:
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
string prefix = filenameprefix.str();
|
||||
//Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
string prefix = filenameprefix.str();
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
//RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
||||
rawfilename[ns] = RAW_stringstream.str();
|
||||
}
|
||||
|
||||
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK,
|
||||
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK,
|
||||
ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -12,13 +12,13 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
|||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 10 && argc != 11) { // Print out instructions
|
||||
//if (strcmp(argv[1],"help") == 0) { // Output some instructions
|
||||
|
@ -26,7 +26,7 @@ int main(int argc, char* argv[])
|
|||
cout << "Provide arguments using one of the following options:" << endl << endl;
|
||||
cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax ommin ommax Nom gwidth" << endl << endl;
|
||||
cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
|
||||
//else JSCerror("Incomprehensible arguments in Smoothen_ODSLF_DSF executable.");
|
||||
//else ABACUSerror("Incomprehensible arguments in Smoothen_ODSLF_DSF executable.");
|
||||
}
|
||||
|
||||
else if (argc == 11) { // !fixed_iK
|
||||
|
@ -43,7 +43,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
stringstream filenameprefix;
|
||||
ODSLF_Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, 0.0, 0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
|
||||
|
@ -69,7 +69,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, fixed_iK, iKneeded, 0.0, 0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
int iKmin = iKneeded;
|
||||
|
@ -78,5 +78,5 @@ int main(int argc, char* argv[])
|
|||
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, gwidth, normalization) << endl;
|
||||
}
|
||||
|
||||
else JSCerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
else ABACUSerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
}
|
||||
|
|
|
@ -1,43 +1,42 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS++G_2_testing.cc
|
||||
|
||||
Purpose: testing of ABACUS++2
|
||||
File: XXZ_gpd_StagSz_h0.cc
|
||||
|
||||
Purpose: Compute the staggered magentization of XXZ_gpd in zero field.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main( int argc, char* argv[])
|
||||
int main( int argc, char* argv[])
|
||||
{
|
||||
if (!(argc == 3 || argc == 5)) { // provide some info
|
||||
cout << endl << "This code computes the (1/N) (-1)^j S^z_j on-site staggered magnetization for XXZ_gpd in zero field." << endl;
|
||||
cout << "First option: provide two arguments: anisotropy Delta (> 1) and system size N (even)." << endl;
|
||||
cout << "Second option: provide five arguments: system size N (even), Delta min, Delta max, NDelta." << endl;
|
||||
cout << "The output is Delta, N, stag mag, energy gap." << endl;
|
||||
JSCerror("");
|
||||
ABACUSerror("");
|
||||
}
|
||||
else if (argc == 3) {
|
||||
DP Delta = atof(argv[1]);
|
||||
if (Delta <= 1.0) JSCerror("Provide Delta > 1.");
|
||||
if (Delta <= 1.0) ABACUSerror("Provide Delta > 1.");
|
||||
int N = atoi(argv[2]);
|
||||
if (N % 2) JSCerror("Provide an even Delta.");
|
||||
if (N % 2) ABACUSerror("Provide an even Delta.");
|
||||
int M = N/2;
|
||||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Heis_Base gbase(chain, M);
|
||||
|
||||
XXZ_gpd_Bethe_State gstate(chain, gbase);
|
||||
|
@ -54,9 +53,9 @@ int main( int argc, char* argv[])
|
|||
XXZ_gpd_Bethe_State estategap(chain, basegap);
|
||||
estategap.Compute_All(true);
|
||||
|
||||
if (!gstate.conv) JSCerror("Ground state did not converge.");
|
||||
if (!estate.conv) JSCerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) JSCerror("Gap state did not converge.");
|
||||
if (!gstate.conv) ABACUSerror("Ground state did not converge.");
|
||||
if (!estate.conv) ABACUSerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) ABACUSerror("Gap state did not converge.");
|
||||
|
||||
cout << Delta << "\t" << N << "\t" << setprecision(12) << exp(real(ln_Sz_ME (gstate, estate)))/sqrt(N) << "\t" << estategap.E - gstate.E << endl;
|
||||
|
||||
|
@ -65,14 +64,14 @@ int main( int argc, char* argv[])
|
|||
else if (argc == 5) { // Do a scan in Delta
|
||||
|
||||
int N = atoi(argv[1]);
|
||||
if (N % 2) JSCerror("Provide an even Delta.");
|
||||
if (N % 2) ABACUSerror("Provide an even Delta.");
|
||||
int M = N/2;
|
||||
|
||||
DP Deltamin = atof(argv[2]);
|
||||
if (Deltamin <= 1.0) JSCerror("Provide Deltamin > 1.");
|
||||
if (Deltamin <= 1.0) ABACUSerror("Provide Deltamin > 1.");
|
||||
|
||||
DP Deltamax = atof(argv[3]);
|
||||
if (Deltamin <= 1.0) JSCerror("Provide Deltamax > Deltamin.");
|
||||
if (Deltamin <= 1.0) ABACUSerror("Provide Deltamax > Deltamin.");
|
||||
|
||||
int NDelta = atoi(argv[4]);
|
||||
|
||||
|
@ -82,29 +81,29 @@ int main( int argc, char* argv[])
|
|||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Heis_Base gbase(chain, M);
|
||||
|
||||
|
||||
XXZ_gpd_Bethe_State gstate(chain, gbase);
|
||||
gstate.Compute_All(true);
|
||||
|
||||
|
||||
XXZ_gpd_Bethe_State estate(chain, gbase);
|
||||
estate.Ix2[0][0] = M+1; // umklapp excitation
|
||||
estate.Compute_All(true);
|
||||
|
||||
|
||||
stringstream basestrstream;
|
||||
basestrstream << M-2 << "x1";
|
||||
string basestr = basestrstream.str();
|
||||
Heis_Base basegap(chain, basestr);
|
||||
XXZ_gpd_Bethe_State estategap(chain, basegap);
|
||||
estategap.Compute_All(true);
|
||||
|
||||
if (!gstate.conv) JSCerror("Ground state did not converge.");
|
||||
if (!estate.conv) JSCerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) JSCerror("Gap state did not converge.");
|
||||
|
||||
|
||||
if (!gstate.conv) ABACUSerror("Ground state did not converge.");
|
||||
if (!estate.conv) ABACUSerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) ABACUSerror("Gap state did not converge.");
|
||||
|
||||
cout << Delta << "\t" << N << "\t" << setprecision(12) << exp(real(ln_Sz_ME (gstate, estate)))/sqrt(N) << "\t" << estategap.E - gstate.E << endl;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2007.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: mrqmin.cc
|
||||
File: covsrt.cc
|
||||
|
||||
Purpose: Nonlinear fitting
|
||||
|
||||
Last modified: 14/08/07
|
||||
Purpose: covsrt algorithm
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit)
|
||||
void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,15 +10,13 @@ File: lin_reg.cc
|
|||
|
||||
Purpose: Linear regression
|
||||
|
||||
Last modified: 11/05/07
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void lin_reg (Vect_DP x, Vect_DP y, Vect_DP sigma, DP& a, DP& b, DP& chisq)
|
||||
{
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2007.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: mrqmin.cc
|
||||
File: mrq.cc
|
||||
|
||||
Purpose: Nonlinear fitting
|
||||
|
||||
Last modified: 14/08/07
|
||||
Purpose: mrqmin and mrqcof algorithms
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
Vect<bool>& ia, SQMat_DP& covar, SQMat_DP& alpha, DP& chisq,
|
||||
void funcs(const DP, Vect_DP&, DP&, Vect_DP&), DP& alambda)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: polint.cc
|
||||
|
||||
Purpose: Polynomial interpolation
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
|
||||
void ABACUS::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
|
||||
{
|
||||
// Polynomial interpolation/extrapolation, NR page 113.
|
||||
|
||||
|
@ -25,7 +39,7 @@ void JSC::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
|
|||
ho = xa[i] - x;
|
||||
hp = xa[i+m] - x;
|
||||
w = c[i+1] - d[i];
|
||||
if ((den = ho-hp) == 0.0) JSCerror("Error in routine polint.");
|
||||
if ((den = ho-hp) == 0.0) ABACUSerror("Error in routine polint.");
|
||||
den = w/den;
|
||||
d[i] = hp * den;
|
||||
c[i] = ho * den;
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: polint_cx.cc
|
||||
|
||||
Purpose: Polynomial interpolation
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy)
|
||||
void ABACUS::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy)
|
||||
{
|
||||
// Polynomial interpolation/extrapolation, NR page 113.
|
||||
|
||||
|
@ -26,7 +40,7 @@ void JSC::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y,
|
|||
ho = xa[i] - x;
|
||||
hp = xa[i+m] - x;
|
||||
w = c[i+1] - d[i];
|
||||
if ((den = ho-hp) == 0.0) JSCerror("Error in routine polint_cx.");
|
||||
if ((den = ho-hp) == 0.0) ABACUSerror("Error in routine polint_cx.");
|
||||
den = w/den;
|
||||
d[i] = hp * den;
|
||||
c[i] = ho * den;
|
||||
|
|
455
src/HEIS/Heis.cc
455
src/HEIS/Heis.cc
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
Load Diff
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,19 +10,20 @@ File: src/HEIS/Heis_Chem_Pot.cc
|
|||
|
||||
Purpose: calculates the chemical potential.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
using namespace std;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP Ezero (DP Delta, int N, int M)
|
||||
{
|
||||
// Returns the energy of the ground state with M down spins
|
||||
|
||||
if (M < 0 || M > N/2) JSCerror("M out of bounds in Ezero.");
|
||||
|
||||
if (M < 0 || M > N/2) ABACUSerror("M out of bounds in Ezero.");
|
||||
|
||||
DP E = -1.0; // sentinel value
|
||||
|
||||
if (M == 0) E = N * Delta/4.0;
|
||||
|
@ -30,32 +31,32 @@ namespace JSC {
|
|||
else {
|
||||
|
||||
Heis_Chain BD1(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Vect_INT Nrapidities_groundstate(0, BD1.Nstrings);
|
||||
|
||||
|
||||
Nrapidities_groundstate[0] = M;
|
||||
|
||||
|
||||
Heis_Base baseconfig_groundstate(BD1, Nrapidities_groundstate);
|
||||
|
||||
|
||||
if ((Delta > 0.0) && (Delta < 1.0)) {
|
||||
XXZ_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta == 1.0) {
|
||||
XXX_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta > 1.0) {
|
||||
XXZ_gpd_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
else JSCerror("Anisotropy out of bounds in Ezero.");
|
||||
|
||||
else ABACUSerror("Anisotropy out of bounds in Ezero.");
|
||||
}
|
||||
|
||||
return(E);
|
||||
|
@ -67,7 +68,7 @@ namespace JSC {
|
|||
|
||||
DP H = 0.0;
|
||||
|
||||
if (2*M == N) H = 0.0;
|
||||
if (2*M == N) H = 0.0;
|
||||
|
||||
else if (Delta <= 1.0) H = Ezero (Delta, N, M - 1) - Ezero (Delta, N, M);
|
||||
|
||||
|
@ -78,7 +79,7 @@ namespace JSC {
|
|||
{
|
||||
if (M < 0 || M > N/2 - 1) {
|
||||
cout << "M = " << M << endl;
|
||||
JSCerror("M out of bounds in HZmin.");
|
||||
ABACUSerror("M out of bounds in HZmin.");
|
||||
}
|
||||
|
||||
if (Ezero_ref[M] == -1.0) Ezero_ref[M] = Ezero(Delta, N, M);
|
||||
|
@ -91,7 +92,7 @@ namespace JSC {
|
|||
{
|
||||
// Returns the value of M for given field HZ
|
||||
|
||||
if (HZ < 0.0) JSCerror("Please use a positive field in M_vs_H.");
|
||||
if (HZ < 0.0) ABACUSerror("Please use a positive field in M_vs_H.");
|
||||
|
||||
else if (HZ == 0.0) return(N/2);
|
||||
|
||||
|
@ -109,7 +110,7 @@ namespace JSC {
|
|||
if (HZ >= 1.0 + Delta) M_actual = 0; // saturation
|
||||
|
||||
else {
|
||||
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
|
@ -117,15 +118,15 @@ namespace JSC {
|
|||
|
||||
if (HZmin_actual > HZ) M_actual += M_step;
|
||||
else if (HZmax_actual <= HZ) M_actual -= M_step;
|
||||
|
||||
|
||||
M_step = (M_step + 1)/2;
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
// << "\tHZmin_actual = " << HZmin_actual << "\tHZmax_actual = " << HZmax_actual << "\tHZ = " << HZ << "\t" << M_found << endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,15 +10,14 @@ File: src/HEIS/Heis_Matrix_Element_Contrib.cc
|
|||
|
||||
Purpose: handles the generic call for a matrix element.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_Bethe_State& LeftState,
|
||||
//XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||
|
@ -50,7 +49,7 @@ namespace JSC {
|
|||
}
|
||||
else if (whichDSF == 'p')
|
||||
ME = exp(real(ln_Smin_ME (LeftState, RightState)));
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = 0.0;
|
||||
|
||||
|
@ -157,7 +156,7 @@ namespace JSC {
|
|||
else if (whichDSF == 'q') // Geometric quench
|
||||
//ME_CX = ln_Overlap (LeftState, RightState);
|
||||
ME_CX = ln_Overlap (RightState, LeftState);
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = 0.0;
|
||||
if (is_nan(norm(ME_CX))) ME_CX = -100.0;
|
||||
|
@ -254,7 +253,7 @@ namespace JSC {
|
|||
|
||||
sum1 = 0;
|
||||
for (int k = 0; k < LeftState.chain.Nstrings; ++k)
|
||||
sum1 += LeftState.base.Nrap[k] * (2 * JSC::min(LeftState.chain.Str_L[j], LeftState.chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
sum1 += LeftState.base.Nrap[k] * (2 * ABACUS::min(LeftState.chain.Str_L[j], LeftState.chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
// This almost does it: only missing are the states with one on -PI/2 and one on PI/2
|
||||
if (LeftState.base.Nrap[j] >= 1
|
||||
&& (LeftState.Ix2[j][0] <= -(LeftState.chain.Nsites - sum1)
|
||||
|
@ -324,7 +323,7 @@ namespace JSC {
|
|||
}
|
||||
else if (whichDSF == 'p')
|
||||
ME = exp(real(ln_Smin_ME (LeftState, RightState)));
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = 0.0;
|
||||
|
||||
|
@ -376,4 +375,4 @@ namespace JSC {
|
|||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,14 +10,13 @@ File: src/HEIS/Heis_Sumrules.cc
|
|||
|
||||
Purpose: defines sumrule factors for Heisenberg
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
DP X_avg (char xyorz, DP Delta, int N, int M)
|
||||
{
|
||||
|
@ -29,24 +28,24 @@ namespace JSC {
|
|||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
// Define the base: chain, Mdown
|
||||
Heis_Base gbase(chain, M);
|
||||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain2(1.0, Delta + eps_Delta, 0.0, N);
|
||||
|
||||
|
||||
// Define the base: chain, Mdown
|
||||
Heis_Base gbase2(chain2, M);
|
||||
|
||||
|
||||
DP E0_Delta = 0.0;
|
||||
DP E0_Delta_eps = 0.0;
|
||||
DP E0_Delta_eps = 0.0;
|
||||
|
||||
if (Delta > 0.0 && Delta < 1.0) {
|
||||
|
||||
// Define the ground state
|
||||
XXZ_Bethe_State gstate(chain, gbase);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate.Compute_All(true);
|
||||
|
||||
|
@ -54,7 +53,7 @@ namespace JSC {
|
|||
|
||||
// Define the ground state
|
||||
XXZ_Bethe_State gstate2(chain2, gbase2);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate2.Compute_All(true);
|
||||
|
||||
|
@ -64,7 +63,7 @@ namespace JSC {
|
|||
else if (Delta == 1.0) {
|
||||
// Define the ground state
|
||||
XXX_Bethe_State gstate(chain, gbase);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate.Compute_All(true);
|
||||
|
||||
|
@ -72,7 +71,7 @@ namespace JSC {
|
|||
|
||||
// Define the ground state
|
||||
XXZ_gpd_Bethe_State gstate2(chain2, gbase2); // need XXZ_gpd here
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate2.Compute_All(true);
|
||||
|
||||
|
@ -82,7 +81,7 @@ namespace JSC {
|
|||
else if (Delta > 1.0) {
|
||||
// Define the ground state
|
||||
XXZ_gpd_Bethe_State gstate(chain, gbase);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate.Compute_All(true);
|
||||
|
||||
|
@ -90,14 +89,14 @@ namespace JSC {
|
|||
|
||||
// Define the ground state
|
||||
XXZ_gpd_Bethe_State gstate2(chain2, gbase2);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate2.Compute_All(true);
|
||||
|
||||
E0_Delta_eps = gstate2.E;
|
||||
}
|
||||
|
||||
else JSCerror("Wrong anisotropy in S1_sumrule_factor.");
|
||||
else ABACUSerror("Wrong anisotropy in S1_sumrule_factor.");
|
||||
|
||||
DP answer = 0.0;
|
||||
//if (xyorz == 'x' || xyorz == 'y') answer = 0.5 * (E0_Delta - Delta * (E0_Delta_eps - E0_Delta)/eps_Delta);
|
||||
|
@ -106,7 +105,7 @@ namespace JSC {
|
|||
// Careful for z ! Hamiltonian defined as S^z S^z - 1/4, so add back N/4:
|
||||
else if (xyorz == 'z') answer = (E0_Delta_eps - E0_Delta)/eps_Delta + 0.25 * N;
|
||||
|
||||
else JSCerror("option not implemented in X_avg.");
|
||||
else ABACUSerror("option not implemented in X_avg.");
|
||||
|
||||
return(answer);
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ namespace JSC {
|
|||
else if (mporz == 'b') sumrule = 1.0;
|
||||
else if (mporz == 'c') sumrule = 1.0;
|
||||
|
||||
else JSCerror("option not implemented in S1_sumrule_factor.");
|
||||
else ABACUSerror("option not implemented in S1_sumrule_factor.");
|
||||
|
||||
//return(1.0/sumrule);
|
||||
return(1.0/(sumrule + 1.0e-16)); // sumrule is 0 for iK == 0 or N
|
||||
|
@ -153,7 +152,7 @@ namespace JSC {
|
|||
else if (mporz == 'b') sumrule = 1.0;
|
||||
else if (mporz == 'c') sumrule = 1.0;
|
||||
|
||||
else JSCerror("option not implemented in S1_sumrule_factor.");
|
||||
else ABACUSerror("option not implemented in S1_sumrule_factor.");
|
||||
|
||||
return(1.0/(sumrule + 1.0e-16)); // sumrule is 0 for iK == 0 or N
|
||||
}
|
||||
|
@ -166,7 +165,7 @@ namespace JSC {
|
|||
//if (!fixed_iK) {
|
||||
if (iKmin != iKmax) {
|
||||
if (whichDSF == 'Z') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'm')
|
||||
else if (whichDSF == 'm')
|
||||
sumrule_factor = 1.0/AveragingState.base.Mdown;
|
||||
else if (whichDSF == 'z') sumrule_factor = 1.0/(0.25 * AveragingState.chain.Nsites);
|
||||
else if (whichDSF == 'p') sumrule_factor = 1.0/(AveragingState.chain.Nsites - AveragingState.base.Mdown);
|
||||
|
@ -175,33 +174,33 @@ namespace JSC {
|
|||
else if (whichDSF == 'c') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'q') sumrule_factor = 1.0;
|
||||
|
||||
else JSCerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
}
|
||||
//else if (fixed_iK) {
|
||||
else if (iKmin == iKmax) {
|
||||
if (whichDSF == 'Z') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'm' || whichDSF == 'z' || whichDSF == 'p')
|
||||
else if (whichDSF == 'm' || whichDSF == 'z' || whichDSF == 'p')
|
||||
//sumrule_factor = S1_sumrule_factor (whichDSF, AveragingState.chain.Delta, AveragingState.chain.Nsites, AveragingState.base.Mdown, iKneeded);
|
||||
sumrule_factor = S1_sumrule_factor (whichDSF, AveragingState.chain.Delta, AveragingState.chain.Nsites, AveragingState.base.Mdown, Chem_Pot, iKmax);
|
||||
else if (whichDSF == 'a') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'b') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'c') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'q') sumrule_factor = 1.0;
|
||||
|
||||
else JSCerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
|
||||
else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return(sumrule_factor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Evaluate_F_Sumrule (string prefix, char whichDSF, const Heis_Bethe_State& AveragingState, DP Chem_Pot, int iKmin_ref, int iKmax_ref)
|
||||
{
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
||||
|
||||
stringstream FSR_stringstream; string FSR_string;
|
||||
|
@ -210,15 +209,15 @@ namespace JSC {
|
|||
|
||||
ifstream infile;
|
||||
infile.open(RAW_Cstr);
|
||||
if(infile.fail()) JSCerror("Could not open raw input file in Evaluate_F_Sumrule(Heis...).");
|
||||
if(infile.fail()) ABACUSerror("Could not open raw input file in Evaluate_F_Sumrule(Heis...).");
|
||||
|
||||
int iKmin = 0;
|
||||
int iKmax = AveragingState.chain.Nsites;
|
||||
int iKmod = AveragingState.chain.Nsites;
|
||||
|
||||
// We run through the data file to chech the f sumrule at each positive momenta:
|
||||
//Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
//Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
|
||||
DP omega, ME;
|
||||
int iK, iKexc;
|
||||
|
@ -252,4 +251,4 @@ namespace JSC {
|
|||
outfile.close();
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006-9.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -10,21 +10,20 @@ File: M_vs_H.cc
|
|||
|
||||
Purpose: field to and from magnetization for Heisenberg
|
||||
|
||||
Last modified: 21/10/09
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
using namespace std;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP Ezero (DP Delta, int N, int M)
|
||||
{
|
||||
// Returns the energy of the ground state with M down spins
|
||||
|
||||
if (M < 0 || M > N/2) JSCerror("M out of bounds in Ezero.");
|
||||
|
||||
if (M < 0 || M > N/2) ABACUSerror("M out of bounds in Ezero.");
|
||||
|
||||
DP E = -1.0; // sentinel value
|
||||
|
||||
if (M == 0) E = N * Delta/4.0;
|
||||
|
@ -32,32 +31,32 @@ namespace JSC {
|
|||
else {
|
||||
|
||||
Heis_Chain BD1(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Vect_INT Nrapidities_groundstate(0, BD1.Nstrings);
|
||||
|
||||
|
||||
Nrapidities_groundstate[0] = M;
|
||||
|
||||
|
||||
Heis_Base baseconfig_groundstate(BD1, Nrapidities_groundstate);
|
||||
|
||||
|
||||
if ((Delta > 0.0) && (Delta < 1.0)) {
|
||||
XXZ_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta == 1.0) {
|
||||
XXX_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta > 1.0) {
|
||||
XXZ_gpd_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
else JSCerror("Anisotropy out of bounds in Ezero.");
|
||||
|
||||
else ABACUSerror("Anisotropy out of bounds in Ezero.");
|
||||
}
|
||||
|
||||
return(E);
|
||||
|
@ -69,7 +68,7 @@ namespace JSC {
|
|||
|
||||
DP H = 0.0;
|
||||
|
||||
if (2*M == N) H = 0.0;
|
||||
if (2*M == N) H = 0.0;
|
||||
|
||||
else if (Delta <= 1.0) H = Ezero (Delta, N, M - 1) - Ezero (Delta, N, M);
|
||||
|
||||
|
@ -80,7 +79,7 @@ namespace JSC {
|
|||
{
|
||||
if (M < 0 || M > N/2 - 1) {
|
||||
cout << "M = " << M << endl;
|
||||
JSCerror("M out of bounds in HZmin.");
|
||||
ABACUSerror("M out of bounds in HZmin.");
|
||||
}
|
||||
|
||||
if (Ezero_ref[M] == -1.0) Ezero_ref[M] = Ezero(Delta, N, M);
|
||||
|
@ -93,7 +92,7 @@ namespace JSC {
|
|||
{
|
||||
// Returns the value of M for given field HZ
|
||||
|
||||
if (HZ < 0.0) JSCerror("Please use a positive field in M_vs_H.");
|
||||
if (HZ < 0.0) ABACUSerror("Please use a positive field in M_vs_H.");
|
||||
|
||||
else if (HZ == 0.0) return(N/2);
|
||||
|
||||
|
@ -111,7 +110,7 @@ namespace JSC {
|
|||
if (HZ >= 1.0 + Delta) M_actual = 0; // saturation
|
||||
|
||||
else {
|
||||
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
|
@ -119,15 +118,15 @@ namespace JSC {
|
|||
|
||||
if (HZmin_actual > HZ) M_actual += M_step;
|
||||
else if (HZmax_actual <= HZ) M_actual -= M_step;
|
||||
|
||||
|
||||
M_step = (M_step + 1)/2;
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
// << "\tHZmin_actual = " << HZmin_actual << "\tHZmax_actual = " << HZmax_actual << "\tHZ = " << HZ << "\t" << M_found << endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
|
@ -12,11 +12,11 @@ Purpose: Defines all functions for XXX_Bethe_State
|
|||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function prototypes
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace JSC {
|
|||
|
||||
// Function definitions: class XXX_Bethe_State
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State ()
|
||||
XXX_Bethe_State::XXX_Bethe_State ()
|
||||
: Heis_Bethe_State()
|
||||
{};
|
||||
|
||||
|
@ -35,22 +35,22 @@ namespace JSC {
|
|||
: Heis_Bethe_State(RefState)
|
||||
{
|
||||
}
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M)
|
||||
{
|
||||
if (RefChain.Delta != 1.0) {
|
||||
cout << setprecision(16) << RefChain.Delta << endl;
|
||||
JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
}
|
||||
}
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase)
|
||||
{
|
||||
if (RefChain.Delta != 1.0) {
|
||||
cout << setprecision(16) << RefChain.Delta << endl;
|
||||
JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -59,7 +59,7 @@ namespace JSC {
|
|||
{
|
||||
if (RefChain.Delta != 1.0) {
|
||||
cout << setprecision(16) << RefChain.Delta << endl;
|
||||
JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -104,13 +104,13 @@ namespace JSC {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool XXX_Bethe_State::Check_Admissibility(char option)
|
||||
{
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
|
||||
// and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
|
||||
|
||||
|
@ -122,9 +122,9 @@ namespace JSC {
|
|||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
// The following line puts answer to true if there is at least one higher string with zero Ix2
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) && !(chain.Str_L[j] % 2))
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) && !(chain.Str_L[j] % 2))
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
// NOTE: if base[j] == 0, Zero_at_level[j] remains false.
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ namespace JSC {
|
|||
// Checks that we have strings of equal length modulo 2 with Ix2 == 0, so equal rapidities, and inadmissibility
|
||||
for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
|
||||
for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
string_coincidence = true;
|
||||
}
|
||||
/*
|
||||
|
@ -147,8 +147,8 @@ namespace JSC {
|
|||
|
||||
// Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
|
||||
if (!answer) {
|
||||
E = 0.0;
|
||||
|
@ -170,15 +170,15 @@ namespace JSC {
|
|||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
|
||||
BE[j][alpha] = 2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
|
||||
|
@ -190,18 +190,18 @@ namespace JSC {
|
|||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
|
||||
BE[j][alpha] = 2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ namespace JSC {
|
|||
{
|
||||
// Returns a new iteration value for lambda[j][alpha] given BE[j][alpha]
|
||||
|
||||
return(0.5 * chain.Str_L[j] * tan(0.5 *
|
||||
return(0.5 * chain.Str_L[j] * tan(0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
|
||||
(2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - BE[j][alpha])
|
||||
));
|
||||
|
@ -231,10 +231,10 @@ namespace JSC {
|
|||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX(lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
|
@ -283,10 +283,10 @@ namespace JSC {
|
|||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ namespace JSC {
|
|||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(*this).Build_Reduced_Gaudin_Matrix (Gaudin);
|
||||
|
||||
for (int i = 0; i < base.Nraptot; ++i) dlambda[i] = - RHSBAE[i];
|
||||
|
@ -334,7 +334,7 @@ namespace JSC {
|
|||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) nonan *= !is_nan(lambda[j][alpha]);
|
||||
|
||||
|
||||
return nonan;
|
||||
}
|
||||
|
||||
|
@ -362,48 +362,48 @@ namespace JSC {
|
|||
for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
|
||||
|
||||
ln_deltadiff = 0.0;
|
||||
|
||||
|
||||
for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if ((*this).chain.Str_L[j] > 1) { // else the BAE are already 1
|
||||
|
||||
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))
|
||||
/((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
log_BAE_reg += log((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
) - II );
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
log_BAE_reg -= log(((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
|
||||
)
|
||||
)
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
) + II );
|
||||
}
|
||||
|
||||
// The regular LHS of BAE is now defined. Now sum up the deltas...
|
||||
|
||||
|
||||
if (a == 1) ln_deltadiff[0] = - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
|
||||
|
||||
} // if ((*this).chain.Str_L[j] > 1)
|
||||
|
||||
|
||||
} // for (int a = 1; ...
|
||||
|
||||
for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
|
||||
deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
|
||||
delta += fabs(deltadiff[a]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // alpha sum
|
||||
} // j sum
|
||||
|
||||
|
@ -418,7 +418,7 @@ namespace JSC {
|
|||
void XXX_Bethe_State::Compute_Energy ()
|
||||
{
|
||||
DP sum = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
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 {
|
|||
}
|
||||
|
||||
sum *= - chain.J * 2.0;
|
||||
|
||||
|
||||
E = sum;
|
||||
|
||||
return;
|
||||
|
@ -462,7 +462,7 @@ namespace JSC {
|
|||
void XXX_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
int index_jalpha;
|
||||
int index_kbeta;
|
||||
|
@ -482,24 +482,24 @@ namespace JSC {
|
|||
|
||||
for (int kp = 0; kp < chain.Nstrings; ++kp) {
|
||||
for (int betap = 0; betap < base[kp]; ++betap) {
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXX
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXX
|
||||
+= ddlambda_Theta_XXX (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp]);
|
||||
}
|
||||
}
|
||||
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * chain.Str_L[j]/(lambda[j][alpha] * lambda[j][alpha] + 0.25 * chain.Str_L[j] * chain.Str_L[j])
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * chain.Str_L[j]/(lambda[j][alpha] * lambda[j][alpha] + 0.25 * chain.Str_L[j] * chain.Str_L[j])
|
||||
- sum_hbar_XXX);
|
||||
}
|
||||
|
||||
else {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> ( 2.0/(pow(lambda[j][alpha] - lambda[k][beta], 2.0) + 1.0));
|
||||
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> (ddlambda_Theta_XXX (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k]));
|
||||
}
|
||||
index_kbeta++;
|
||||
|
@ -520,7 +520,7 @@ namespace JSC {
|
|||
if (fabs(lambda[j][alpha]) > 1.0e6) answer = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(answer);
|
||||
}
|
||||
|
||||
|
@ -533,12 +533,12 @@ namespace JSC {
|
|||
DP result;
|
||||
|
||||
if ((nj == 1) && (nk == 1)) result = 2.0 * atan(lambda);
|
||||
|
||||
|
||||
else {
|
||||
|
||||
result = (nj == nk) ? 0.0 : 2.0 * atan(2.0 * lambda/fabs(nj - nk));
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 4.0 * atan(2.0 * lambda/(fabs(nj - nk) + 2*a));
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 4.0 * atan(2.0 * lambda/(fabs(nj - nk) + 2*a));
|
||||
|
||||
result += 2.0 * atan(2.0 * lambda/(nj + nk));
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ namespace JSC {
|
|||
|
||||
DP result = (nj == nk) ? 0.0 : DP(n)/(lambda * lambda + 0.25 * n * n);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * (n + 2.0*a)
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * (n + 2.0*a)
|
||||
/ (lambda * lambda + 0.25 * (n + 2.0*a) * (n + 2.0*a));
|
||||
|
||||
result += DP(nj + nk)/(lambda * lambda + 0.25 * (nj + nk) * (nj + nk));
|
||||
|
@ -564,7 +564,7 @@ namespace JSC {
|
|||
{
|
||||
DP result = (nj == nk) ? 0.0 : DP(nj - nk)/(lambda * lambda + 0.25 * (nj - nk) * (nj - nk));
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a)
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a)
|
||||
/ (lambda * lambda + 0.25 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a));
|
||||
|
||||
result += DP(nj + nk)/(lambda * lambda + 0.25 * (nj + nk) * (nj + nk));
|
||||
|
@ -575,8 +575,8 @@ namespace JSC {
|
|||
|
||||
XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState)
|
||||
{
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] + 1;
|
||||
|
@ -586,10 +586,10 @@ namespace JSC {
|
|||
XXX_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
|
||||
for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
|
||||
|
@ -602,7 +602,7 @@ namespace JSC {
|
|||
XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState)
|
||||
{
|
||||
if (RefState.base.Nrap[0] == 0)
|
||||
JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] - 1;
|
||||
|
@ -612,7 +612,7 @@ namespace JSC {
|
|||
XXX_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Remove midmost and shift quantum numbers by half-integer towards removed one:
|
||||
|
@ -622,5 +622,5 @@ namespace JSC {
|
|||
return(ReturnState);
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
|
@ -12,11 +12,11 @@ Purpose: Defines all functions for XXZ_Bethe_State
|
|||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function prototypes
|
||||
|
||||
|
@ -30,12 +30,12 @@ namespace JSC {
|
|||
|
||||
// Function definitions: class XXZ_Bethe_State
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinhlambda(Lambda(chain, 1)), coshlambda(Lambda(chain, 1)), tanhlambda(Lambda(chain, 1))
|
||||
XXZ_Bethe_State::XXZ_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinhlambda(Lambda(chain, 1)), coshlambda(Lambda(chain, 1)), tanhlambda(Lambda(chain, 1))
|
||||
{};
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const XXZ_Bethe_State& RefState) // copy constructor
|
||||
: Heis_Bethe_State(RefState), sinhlambda(Lambda(RefState.chain, RefState.base)), coshlambda(Lambda(RefState.chain, RefState.base)),
|
||||
: Heis_Bethe_State(RefState), sinhlambda(Lambda(RefState.chain, RefState.base)), coshlambda(Lambda(RefState.chain, RefState.base)),
|
||||
tanhlambda(Lambda(RefState.chain, RefState.base))
|
||||
{
|
||||
// copy arrays into new ones
|
||||
|
@ -50,29 +50,29 @@ namespace JSC {
|
|||
}
|
||||
//cout << "Done calling XXZ state copy constructor." << endl;
|
||||
}
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
sinhlambda(Lambda(RefChain, M)), coshlambda(Lambda(RefChain, M)), tanhlambda(Lambda(RefChain, M))
|
||||
{
|
||||
//cout << "Here in XXZ BS constructor." << endl;
|
||||
//cout << (*this).lambda[0][0] << endl;
|
||||
//cout << "OK" << endl;
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
}
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase),
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase),
|
||||
sinhlambda(Lambda(RefChain, RefBase)), coshlambda(Lambda(RefChain, RefBase)), tanhlambda(Lambda(RefChain, RefBase))
|
||||
{
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
}
|
||||
/*
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref)
|
||||
: Heis_Bethe_State(RefChain, base_id_ref, type_id_ref),
|
||||
sinhlambda(Lambda(chain, base)), coshlambda(Lambda(chain, base)), tanhlambda(Lambda(chain, base))
|
||||
{
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -130,13 +130,13 @@ namespace JSC {
|
|||
lambda[i][alpha] = atanh(x/sqrt(1.0 + x*x)); // lambda then always initiated real
|
||||
}
|
||||
|
||||
else JSCerror("Invalid parities in Set_Free_lambdas.");
|
||||
else ABACUSerror("Invalid parities in Set_Free_lambdas.");
|
||||
//cout << tan(chain.Str_L[i] * 0.5 * chain.anis) << endl;
|
||||
//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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ namespace JSC {
|
|||
|
||||
bool XXZ_Bethe_State::Check_Admissibility(char option)
|
||||
{
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
|
||||
// and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
|
||||
|
||||
|
@ -179,9 +179,9 @@ namespace JSC {
|
|||
bool higher_string_on_zero = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
// The following line puts answer to true if there is at least one higher string with zero Ix2
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] >= 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] >= 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
// NOTE: if base[j] == 0, Zero_at_level[j] remains false.
|
||||
}
|
||||
|
||||
|
@ -192,12 +192,12 @@ namespace JSC {
|
|||
bool string_coincidence = false;
|
||||
for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
|
||||
for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (chain.par[j1] == chain.par[j2]) && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (chain.par[j1] == chain.par[j2]) && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
string_coincidence = true;
|
||||
}
|
||||
|
||||
bool M_odd_and_onep_on_zero = false;
|
||||
if (option == 'z') { // for Sz, if M is odd, exclude symmetric states with a 1+ on zero
|
||||
if (option == 'z') { // for Sz, if M is odd, exclude symmetric states with a 1+ on zero
|
||||
// (zero rapidities in left and right states, so FF det not defined).
|
||||
bool is_ground_state = base.Nrap[0] == base.Mdown && Ix2[0][0] == -(base.Mdown - 1) && Ix2[0][base.Mdown-1] == base.Mdown - 1;
|
||||
if (Zero_at_level[0] && (base.Mdown % 2) && !is_ground_state) M_odd_and_onep_on_zero = true;
|
||||
|
@ -212,8 +212,8 @@ namespace JSC {
|
|||
|
||||
// Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
|
||||
if (!answer) {
|
||||
E = 0.0;
|
||||
|
@ -233,18 +233,18 @@ namespace JSC {
|
|||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < base[k]; ++beta) {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
: -2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]])) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
|
||||
}
|
||||
|
@ -257,22 +257,22 @@ namespace JSC {
|
|||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < base[k]; ++beta) {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
: -2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]])) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
|
||||
//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 {
|
|||
|
||||
DP XXZ_Bethe_State::Iterate_BAE (int j, int alpha)
|
||||
{
|
||||
// Returns a new iteration value for lambda[j][alpha] given tanhlambda and BE Lambdas
|
||||
// Returns a new iteration value for lambda[j][alpha] given tanhlambda and BE Lambdas
|
||||
// Assumes that tanhlambda[][] and BE[][] have been computed.
|
||||
|
||||
DP new_lambda = 0.0;
|
||||
DP arg = 0.0;
|
||||
|
||||
if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]]
|
||||
* tan(0.5 *
|
||||
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
|
||||
(2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) - BE[j][alpha])
|
||||
);
|
||||
|
||||
else if (chain.par[j] == -1) arg = -tan(0.5 *
|
||||
|
||||
else if (chain.par[j] == -1) arg = -tan(0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites)
|
||||
(-2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]]) - BE[j][alpha]))
|
||||
/chain.ta_n_anis_over_2[chain.Str_L[j]];
|
||||
|
||||
|
||||
if (fabs(arg) < 1.0) {
|
||||
new_lambda = atanh(arg);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
new_lambda = lambda[j][alpha]; // back to drawing board...
|
||||
int block = 0; // counter to prevent runaway while loop
|
||||
int block = 0; // counter to prevent runaway while loop
|
||||
DP new_tanhlambda = 0.0;
|
||||
DP sumtheta = 0.0;
|
||||
arg = 10.0; // reset value to start while loop
|
||||
arg = 10.0; // reset value to start while loop
|
||||
while ((fabs(arg) > 1.0) && (block++ < 100)) { // recompute the diverging root on its own...
|
||||
new_lambda *= 1.01; // try to go slowly towards infinity...
|
||||
new_tanhlambda = tanh(new_lambda);
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((new_tanhlambda - tanhlambda[k][beta])/((1.0 - new_tanhlambda * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta]),
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((new_tanhlambda - tanhlambda[k][beta])/((1.0 - new_tanhlambda * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
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);
|
||||
|
||||
|
||||
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]];
|
||||
|
||||
else JSCerror("Invalid parities in Iterate_BAE.");
|
||||
|
||||
else ABACUSerror("Invalid parities in Iterate_BAE.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (fabs(arg) < 1.0) {
|
||||
new_lambda = atanh(arg);
|
||||
}
|
||||
|
||||
|
||||
//else cout << "Rapidity blows up !\t" << lambda[j][alpha] << "\t" << new_lambda << endl;
|
||||
} // else
|
||||
|
||||
|
@ -346,7 +346,7 @@ namespace JSC {
|
|||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) nonan *= !is_nan(lambda[j][alpha]);
|
||||
|
||||
|
||||
return nonan;
|
||||
}
|
||||
|
||||
|
@ -360,8 +360,8 @@ namespace JSC {
|
|||
for (int i = 0; i < (*this).chain.Nstrings; ++i) if ((*this).chain.Str_L[i] > 1) occupied_strings += (*this).base.Nrap[i];
|
||||
|
||||
//if ((*this).conv == 0) delta = 1.0;
|
||||
|
||||
if (occupied_strings == 0) delta = 0.0;
|
||||
|
||||
if (occupied_strings == 0) delta = 0.0;
|
||||
|
||||
else {
|
||||
|
||||
|
@ -369,56 +369,56 @@ namespace JSC {
|
|||
Vect_DP deltadiff(0.0, 1000); // contains |delta^{a, a+1}|
|
||||
|
||||
complex<DP> log_BAE_reg = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < (*this).chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
|
||||
|
||||
ln_deltadiff = 0.0;
|
||||
|
||||
|
||||
for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if ((*this).chain.Str_L[j] > 1) { // else the BAE are already 1
|
||||
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sinh((*this).lambda[j][alpha]
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sinh((*this).lambda[j][alpha]
|
||||
+ 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
/sinh((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j])));
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
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 )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[k])) - II * (*this).chain.anis));
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
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 )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[k])) + II * (*this).chain.anis));
|
||||
}
|
||||
|
||||
// The regular LHS of BAE is now defined. Now sum up the deltas...
|
||||
|
||||
|
||||
if (a == 1) ln_deltadiff[0] = - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
|
||||
|
||||
} // if ((*this).chain.Str_L[j] > 1)
|
||||
|
||||
|
||||
} // for (int a = 1; ...
|
||||
|
||||
for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
|
||||
deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
|
||||
delta += fabs(deltadiff[a]);
|
||||
}
|
||||
}
|
||||
|
||||
} // alpha sum
|
||||
} // j sum
|
||||
|
@ -434,7 +434,7 @@ namespace JSC {
|
|||
void XXZ_Bethe_State::Compute_Energy ()
|
||||
{
|
||||
DP sum = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
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 {
|
|||
}
|
||||
|
||||
sum *= - chain.J * sin(chain.anis);
|
||||
|
||||
|
||||
E = sum;
|
||||
|
||||
return;
|
||||
|
@ -477,7 +477,7 @@ namespace JSC {
|
|||
void XXZ_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
int index_jalpha;
|
||||
int index_kbeta;
|
||||
|
@ -502,26 +502,26 @@ namespace JSC {
|
|||
|
||||
for (int kp = 0; kp < chain.Nstrings; ++kp) {
|
||||
for (int betap = 0; betap < base[kp]; ++betap) {
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp], chain.par[j], chain.par[kp],
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp], chain.par[j], chain.par[kp],
|
||||
chain.si_n_anis_over_2);
|
||||
}
|
||||
}
|
||||
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= 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);
|
||||
}
|
||||
|
||||
else {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> ((chain.par[j] * chain.par[k] == 1)
|
||||
? chain.si_n_anis_over_2[4]/(pow(sinhlambda[j][alpha] * coshlambda[k][beta]
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> ((chain.par[j] * chain.par[k] == 1)
|
||||
? chain.si_n_anis_over_2[4]/(pow(sinhlambda[j][alpha] * coshlambda[k][beta]
|
||||
- coshlambda[j][alpha] * sinhlambda[k][beta], 2.0) + sinzetasq)
|
||||
: chain.si_n_anis_over_2[4]/(-pow(coshlambda[j][alpha] * coshlambda[k][beta]
|
||||
: chain.si_n_anis_over_2[4]/(-pow(coshlambda[j][alpha] * coshlambda[k][beta]
|
||||
- sinhlambda[j][alpha] * sinhlambda[k][beta], 2.0) + sinzetasq) );
|
||||
else
|
||||
else
|
||||
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],
|
||||
chain.par[j], chain.par[k], chain.si_n_anis_over_2));
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ namespace JSC {
|
|||
|
||||
else if (par == -1) result = -2.0 * atan(tanhlambda * tannzetaover2);
|
||||
|
||||
else JSCerror("Faulty parity in fbar_XXZ.");
|
||||
else ABACUSerror("Faulty parity in fbar_XXZ.");
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@ -556,12 +556,12 @@ namespace JSC {
|
|||
DP result = 0.0;
|
||||
|
||||
if ((nj == 1) && (nk == 1)) result = fbar_XXZ(tanhlambda, parj*park, tannzetaover2[2]);
|
||||
|
||||
|
||||
else {
|
||||
|
||||
result = (nj == nk) ? 0.0 : fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk)]);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk) + 2*a]);
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk) + 2*a]);
|
||||
|
||||
result += fbar_XXZ(tanhlambda, parj*park, tannzetaover2[nj + nk]);
|
||||
}
|
||||
|
@ -577,16 +577,16 @@ namespace JSC {
|
|||
|
||||
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));
|
||||
|
||||
else JSCerror("Faulty parity in hbar_XXZ.");
|
||||
else ABACUSerror("Faulty parity in hbar_XXZ.");
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
DP ddlambda_Theta_XXZ (DP lambda, int nj, int nk, int parj, int park, DP* si_n_anis_over_2)
|
||||
{
|
||||
DP result = (nj == nk) ? 0.0 : hbar_XXZ(lambda, fabs(nj - nk), parj*park, si_n_anis_over_2);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
result += hbar_XXZ(lambda, nj + nk, parj*park, si_n_anis_over_2);
|
||||
|
||||
|
@ -596,8 +596,8 @@ namespace JSC {
|
|||
|
||||
XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState)
|
||||
{
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] + 1;
|
||||
|
@ -607,10 +607,10 @@ namespace JSC {
|
|||
XXZ_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
|
||||
for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
|
||||
|
@ -623,7 +623,7 @@ namespace JSC {
|
|||
XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState)
|
||||
{
|
||||
if (RefState.base.Nrap[0] == 0)
|
||||
JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] - 1;
|
||||
|
@ -633,7 +633,7 @@ namespace JSC {
|
|||
XXZ_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Remove midmost and shift quantum numbers by half-integer towards removed one:
|
||||
|
@ -642,5 +642,5 @@ namespace JSC {
|
|||
|
||||
return(ReturnState);
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
|
@ -12,12 +12,11 @@ Purpose: Defines all functions for XXZ_gpd_Bethe_State
|
|||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function prototypes
|
||||
|
||||
|
@ -31,14 +30,14 @@ namespace JSC {
|
|||
|
||||
// Function definitions: class XXZ_gpd_Bethe_State
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinlambda(Lambda(chain, 1)), coslambda(Lambda(chain, 1)), tanlambda(Lambda(chain, 1))
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinlambda(Lambda(chain, 1)), coslambda(Lambda(chain, 1)), tanlambda(Lambda(chain, 1))
|
||||
{};
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState) // copy constructor
|
||||
: Heis_Bethe_State(RefState),
|
||||
sinlambda(Lambda(RefState.chain, RefState.base)), coslambda(Lambda(RefState.chain, RefState.base)),
|
||||
tanlambda(Lambda(RefState.chain, RefState.base))
|
||||
: Heis_Bethe_State(RefState),
|
||||
sinlambda(Lambda(RefState.chain, RefState.base)), coslambda(Lambda(RefState.chain, RefState.base)),
|
||||
tanlambda(Lambda(RefState.chain, RefState.base))
|
||||
{
|
||||
// copy arrays into new ones
|
||||
|
||||
|
@ -50,27 +49,27 @@ namespace JSC {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
sinlambda(Lambda(RefChain, M)), coslambda(Lambda(RefChain, M)), tanlambda(Lambda(RefChain, M))
|
||||
{
|
||||
if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
}
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase),
|
||||
sinlambda(Lambda(RefChain, RefBase)), coslambda(Lambda(RefChain, RefBase)),
|
||||
tanlambda(Lambda(RefChain, RefBase))
|
||||
sinlambda(Lambda(RefChain, RefBase)), coslambda(Lambda(RefChain, RefBase)),
|
||||
tanlambda(Lambda(RefChain, RefBase))
|
||||
{
|
||||
if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
}
|
||||
/*
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref)
|
||||
: Heis_Bethe_State(RefChain, base_id_ref, type_id_ref),
|
||||
sinlambda(Lambda(chain, base)), coslambda(Lambda(chain, base)), tanlambda(Lambda(chain, base))
|
||||
{
|
||||
if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
}
|
||||
*/
|
||||
XXZ_gpd_Bethe_State& XXZ_gpd_Bethe_State::operator= (const XXZ_gpd_Bethe_State& RefState)
|
||||
|
@ -119,7 +118,7 @@ namespace JSC {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -155,7 +154,7 @@ namespace JSC {
|
|||
|
||||
bool XXZ_gpd_Bethe_State::Check_Admissibility(char option)
|
||||
{
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
|
||||
// and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
|
||||
|
||||
|
@ -163,18 +162,18 @@ namespace JSC {
|
|||
Vect<bool> Zero_at_level(false, chain.Nstrings); // whether there exists an Ix2 == 0 at a given level
|
||||
|
||||
/*
|
||||
Vect<bool> min_Ix2_max_busy(false, chain.Nstrings);
|
||||
Vect<bool> min_Ix2_max_busy(false, chain.Nstrings);
|
||||
Vect<bool> plus_Ix2_max_busy(false, chain.Nstrings);
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
if (Ix2[j][alpha] == -base.Ix2_max[j]) min_Ix2_max_busy[j] = true;
|
||||
if (Ix2[j][alpha] == base.Ix2_max[j]) plus_Ix2_max_busy[j] = true;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// State is not admissible if this is false: -N/2 + 1 \leq \sum I^j_{\alpha} \leq N
|
||||
// State is not admissible if this is false: -N/2 + 1 \leq \sum I^j_{\alpha} \leq N
|
||||
int sum_all_Ix2 = 0;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
sum_all_Ix2 += Ix2[j][alpha];
|
||||
}
|
||||
|
@ -190,13 +189,13 @@ namespace JSC {
|
|||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
sum1 = 0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
sum1 += base[k] * (2 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
sum1 += base[k] * (2 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
}
|
||||
// Define limits...
|
||||
//if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
// This almost does it: only missing are the states with one on -PI/2 and one on PI/2
|
||||
if (base[j] >= 1 && (Ix2[j][0] <= -(chain.Nsites - sum1) ||
|
||||
if (base[j] >= 1 && (Ix2[j][0] <= -(chain.Nsites - sum1) ||
|
||||
(Ix2[j][base[j] - 1] - Ix2[j][0]) > 2*(chain.Nsites - sum1))) {
|
||||
//cout << "\tAn Ix2 is out of interval at level " << j << endl;
|
||||
//cout << Ix2[j][base[j] - 1] << "\t" << Ix2[j][0] << "\t" << chain.Nsites << "\t" << sum1 << endl;
|
||||
|
@ -215,19 +214,19 @@ namespace JSC {
|
|||
/*
|
||||
// State is not admissible if all min_Ix2_max are busy simultaneously:
|
||||
bool any_min_Ix2_max_free = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && !min_Ix2_max_busy[j]) any_min_Ix2_max_free = true;
|
||||
if (!any_min_Ix2_max_free) return(false);
|
||||
*/
|
||||
/*
|
||||
// State is not admissible if -Ix2_max, -Ix2_max + 2, ..., -Ix2_max + 2*(Str_L - 1) are busy:
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][0] <= -base.Ix2_max[j] + 2*(chain.Str_L[j] - 1))
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][0] <= -base.Ix2_max[j] + 2*(chain.Str_L[j] - 1))
|
||||
return(false);
|
||||
// Almost correct with above !
|
||||
// Almost correct with above !
|
||||
// State is not admissible if Ix2_max - 2, ..., Ix2_max - 2*(Str_L - 2) are busy (NB: one slot more than on left):
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][base[j] - 1] >= base.Ix2_max[j] - 2*(chain.Str_L[j] - 2))
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][base[j] - 1] >= base.Ix2_max[j] - 2*(chain.Str_L[j] - 2))
|
||||
return(false);
|
||||
*/
|
||||
|
||||
|
@ -242,9 +241,9 @@ namespace JSC {
|
|||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
// The following line puts answer to true if there is at least one higher string with zero Ix2
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
// NOTE: if base[j] == 0, Zero_at_level[j] remains false.
|
||||
}
|
||||
|
||||
|
@ -254,7 +253,7 @@ namespace JSC {
|
|||
// Checks that we have strings of equal length modulo 2 and same parity with Ix2 == 0, so equal rapidities, and inadmissibility
|
||||
for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
|
||||
for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
string_coincidence = true;
|
||||
}
|
||||
|
||||
|
@ -274,8 +273,8 @@ namespace JSC {
|
|||
|
||||
// Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
|
||||
if (!answer) {
|
||||
E = 0.0;
|
||||
|
@ -296,26 +295,26 @@ namespace JSC {
|
|||
tanlambda[j][alpha] = tan(lambda[j][alpha]);
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI))
|
||||
- (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
}
|
||||
|
||||
void XXZ_gpd_Bethe_State::Compute_BE ()
|
||||
{
|
||||
|
@ -324,29 +323,29 @@ namespace JSC {
|
|||
(*this).Compute_tanlambda();
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI))
|
||||
- (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DP XXZ_gpd_Bethe_State::Iterate_BAE (int j, int alpha)
|
||||
|
@ -354,17 +353,17 @@ namespace JSC {
|
|||
// Returns a new iteration value for lambda[j][alpha] given tanlambda[][] and BE[][]
|
||||
// Assumes that tanlambda[][] and BE[][] have been computed.
|
||||
|
||||
DP arg0 = 0.5 * (2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
DP arg0 = 0.5 * (2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI)) - BE[j][alpha]);
|
||||
DP arg = chain.ta_n_anis_over_2[chain.Str_L[j]] * tan(
|
||||
arg0
|
||||
//0.5 *
|
||||
//0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
|
||||
//(2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
//(2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
// + PI * floor(0.5 + lambda[j][alpha]/PI)) - BE[j][alpha])
|
||||
);
|
||||
|
||||
return(atan(arg)
|
||||
return(atan(arg)
|
||||
//+ PI * floor(0.5 + arg0)
|
||||
//0.5 * (Ix2[j][alpha] + sumtheta/PI)/(chain.Nsites)
|
||||
+ PI * floor(0.5 + arg0/PI)
|
||||
|
@ -388,15 +387,15 @@ namespace JSC {
|
|||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
@ -449,27 +448,27 @@ namespace JSC {
|
|||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
RHSBAE[index] = chain.Nsites * 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
RHSBAE[index] = chain.Nsites * 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI))
|
||||
// )
|
||||
- sumtheta - PI*Ix2[j][alpha];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(*this).Build_Reduced_Gaudin_Matrix (Gaudin);
|
||||
|
||||
for (int i = 0; i < base.Nraptot; ++i) dlambda[i] = - RHSBAE[i];
|
||||
|
@ -516,8 +515,8 @@ namespace JSC {
|
|||
bool nonan = true;
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (nonan) nonan = ((!is_nan(lambda[j][alpha]))
|
||||
//&& (lambda[j][alpha] > -0.5*PI*chain.Str_L[j])
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (nonan) nonan = ((!is_nan(lambda[j][alpha]))
|
||||
//&& (lambda[j][alpha] > -0.5*PI*chain.Str_L[j])
|
||||
//&& (lambda[j][alpha] <= 0.5*PI*chain.Str_L[j])
|
||||
);
|
||||
|
||||
|
@ -557,53 +556,53 @@ namespace JSC {
|
|||
Vect_DP deltadiff(0.0, 1000); // contains |delta^{a, a+1}|
|
||||
|
||||
complex<DP> log_BAE_reg = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < (*this).chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
|
||||
|
||||
ln_deltadiff = 0.0;
|
||||
|
||||
|
||||
for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if ((*this).chain.Str_L[j] > 1) { // else the BAE are already 1
|
||||
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis
|
||||
* ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0))
|
||||
/sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
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 ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
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 ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
- II * (*this).chain.anis));
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
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 ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
+ II * (*this).chain.anis));
|
||||
}
|
||||
|
||||
// The regular LHS of BAE is now defined. Now sum up the deltas...
|
||||
|
||||
|
||||
if (a == 1) ln_deltadiff[0] = -real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
|
||||
|
||||
} // if ((*this).chain.Str_L[j] > 1)
|
||||
|
||||
|
||||
} // for (int a = 1; ...
|
||||
|
||||
for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
|
||||
deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
|
||||
delta += fabs(deltadiff[a]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // alpha sum
|
||||
} // j sum
|
||||
|
||||
|
@ -618,7 +617,7 @@ namespace JSC {
|
|||
void XXZ_gpd_Bethe_State::Compute_Energy ()
|
||||
{
|
||||
DP sum = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
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 {
|
|||
}
|
||||
|
||||
sum *= chain.J * sinh(chain.anis);
|
||||
|
||||
|
||||
E = sum;
|
||||
|
||||
return;
|
||||
|
@ -662,7 +661,7 @@ namespace JSC {
|
|||
void XXZ_gpd_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
int index_jalpha;
|
||||
int index_kbeta;
|
||||
|
@ -687,24 +686,24 @@ namespace JSC {
|
|||
|
||||
for (int kp = 0; kp < chain.Nstrings; ++kp) {
|
||||
for (int betap = 0; betap < base[kp]; ++betap) {
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp],
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp],
|
||||
chain.si_n_anis_over_2);
|
||||
}
|
||||
}
|
||||
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * hbar_XXZ_gpd (lambda[j][alpha], chain.Str_L[j], chain.si_n_anis_over_2) - sum_hbar_XXZ);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> (chain.si_n_anis_over_2[4]/(pow(sinlambda[j][alpha] * coslambda[k][beta]
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> (chain.si_n_anis_over_2[4]/(pow(sinlambda[j][alpha] * coslambda[k][beta]
|
||||
- coslambda[j][alpha] * sinlambda[k][beta], 2.0) + sinhetasq));
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j],
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j],
|
||||
chain.Str_L[k], chain.si_n_anis_over_2));
|
||||
}
|
||||
index_kbeta++;
|
||||
|
@ -732,12 +731,12 @@ namespace JSC {
|
|||
DP result;
|
||||
|
||||
if ((nj == 1) && (nk == 1)) result = fbar_XXZ_gpd(tanlambda, tanhnetaover2[2]);
|
||||
|
||||
|
||||
else {
|
||||
|
||||
result = (nj == nk) ? 0.0 : fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk)]);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk) + 2*a]);
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk) + 2*a]);
|
||||
|
||||
result += fbar_XXZ_gpd(tanlambda, tanhnetaover2[nj + nk]);
|
||||
}
|
||||
|
@ -749,12 +748,12 @@ namespace JSC {
|
|||
{
|
||||
return (si_n_anis_over_2[2*n]/(pow(sin(lambda), 2.0) + pow(si_n_anis_over_2[n], 2.0)));
|
||||
}
|
||||
|
||||
|
||||
DP ddlambda_Theta_XXZ_gpd (DP lambda, int nj, int nk, DP* si_n_anis_over_2)
|
||||
{
|
||||
DP result = (nj == nk) ? 0.0 : hbar_XXZ_gpd(lambda, fabs(nj - nk), si_n_anis_over_2);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
result += hbar_XXZ_gpd(lambda, nj + nk, si_n_anis_over_2);
|
||||
|
||||
|
@ -764,8 +763,8 @@ namespace JSC {
|
|||
|
||||
XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState)
|
||||
{
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] + 1;
|
||||
|
@ -775,10 +774,10 @@ namespace JSC {
|
|||
XXZ_gpd_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
|
||||
for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
|
||||
|
@ -791,7 +790,7 @@ namespace JSC {
|
|||
XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState)
|
||||
{
|
||||
if (RefState.base.Nrap[0] == 0)
|
||||
JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] - 1;
|
||||
|
@ -801,7 +800,7 @@ namespace JSC {
|
|||
XXZ_gpd_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Remove midmost and shift quantum numbers by half-integer towards removed one:
|
||||
|
@ -810,5 +809,5 @@ namespace JSC {
|
|||
|
||||
return(ReturnState);
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Overlap_XXX.cc
|
||||
|
||||
Purpose: compute the overlap between an on-shell and an off-shell states
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
|
@ -22,9 +27,9 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
|||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
|||
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)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
|
@ -71,7 +76,7 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
// The A and B states can contain strings.
|
||||
|
||||
// IMPORTANT ASSUMPTIONS:
|
||||
// - State B is an eigenstate of the model on which the overlap measure is defined
|
||||
// - State B is an eigenstate of the model on which the overlap measure is defined
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
|
@ -92,12 +97,12 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
/*
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm((A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
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)
|
|||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
|
||||
// ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
|
||||
|
||||
|
@ -132,7 +137,7 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
// ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
|
||||
|
||||
// Now proceed to build the Hm2P matrix
|
||||
|
@ -153,12 +158,12 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
//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)) *
|
||||
// (A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
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)
|
|||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
//Prod_powerN = pow((B.lambda[k][beta] + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (B.chain.Nsites));
|
||||
Prod_powerN = pow((B.lambda[k][beta] + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (A.chain.Nsites)); // careful !
|
||||
Prod_powerN = pow((B.lambda[k][beta] + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (A.chain.Nsites)); // careful !
|
||||
|
||||
Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2
|
||||
//- two_over_A_lambda_sq_plus_1over2sq * exp(II*im_ln_Fn_F_B_0[k][beta]);
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
//sum2 = 0.0;
|
||||
|
||||
|
||||
//for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
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
|
||||
|
||||
//Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_lambda_sq_plus_1over2sq);
|
||||
Hm2P[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
@ -232,22 +237,22 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
|
||||
/*
|
||||
complex<DP> ln_form_factor_sq = log(0.25 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
// + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
|
||||
// + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
|
||||
+ 2.0 * det
|
||||
- A.lnnorm - B.lnnorm;
|
||||
|
||||
//cout << "ln_SZ: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
//cout << "ln_SZ: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
// << "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
|
||||
|
||||
return(ln_form_factor_sq);
|
||||
*/
|
||||
complex<DP> ln_overlap = 0.5 * (-ln_prod3 + ln_prod4) + det - 0.5 * (A.lnnorm + B.lnnorm);
|
||||
|
||||
cout << "ln_overlap: " << endl << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
cout << "ln_overlap: " << endl << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
<< "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
|
||||
|
||||
return(ln_overlap);
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,8 +1,23 @@
|
|||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Smin_ME_XXX.cc
|
||||
|
||||
Purpose: compute the S^- matrix elemment for XXX
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
|
@ -12,12 +27,12 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
|||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
|
@ -50,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
|||
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)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
|
@ -62,11 +77,11 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
|
||||
// Check that the two states are compatible
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Smin matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Smin matrix element.");
|
||||
|
||||
// Check that A and B are Mdown-compatible:
|
||||
// Check that A and B are Mdown-compatible:
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 1) JSCerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown + 1) ABACUSerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
|
||||
// Some convenient arrays
|
||||
|
||||
|
@ -82,12 +97,12 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
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)
|
|||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
|
||||
// ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
|
||||
|
||||
|
@ -131,7 +146,7 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
// ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
|
||||
|
||||
// Now proceed to build the Hm matrix
|
||||
|
@ -152,10 +167,10 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
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)) *
|
||||
|
||||
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)) *
|
||||
(A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
|
||||
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)
|
|||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
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)
|
|||
Hm[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2;
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
/*
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
*/
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)));
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
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
|
||||
|
||||
Hm[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
@ -236,4 +251,4 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
|||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
|
@ -1,8 +1,23 @@
|
|||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Smin_ME_XXZ.cc
|
||||
|
||||
Purpose: compute the S^- matrix elemment for XXZ
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
|
@ -25,19 +40,19 @@ inline complex<DP> ln_Fn_F (XXZ_Bethe_State& B, int k, int beta, int b)
|
|||
|
||||
arg = B.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
absarg = abs(arg);
|
||||
/*
|
||||
/*
|
||||
prod_temp *= 0.5 * //done later...
|
||||
((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * (B.chain.par[k] - B.chain.par[j]))
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
+ B.chain.co_n_anis_over_2[absarg] * (B.chain.par[k] - B.chain.par[j])) );
|
||||
*/
|
||||
|
||||
prod_temp *= ((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= ((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * par_comb_1 - sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * par_comb_2)
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * par_comb_1 + B.chain.co_n_anis_over_2[absarg] * par_comb_2));
|
||||
}
|
||||
|
||||
|
@ -73,16 +88,16 @@ inline complex<DP> ln_Fn_G (XXZ_Bethe_State& A, XXZ_Bethe_State& B, int k, int b
|
|||
absarg = abs(arg);
|
||||
/*
|
||||
prod_temp *= 0.5 * //done later...
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg] * (B.chain.par[k] - A.chain.par[j])) );
|
||||
*/
|
||||
prod_temp *= ((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= ((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg] * par_comb_1 - sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * par_comb_2)
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * par_comb_1 + A.chain.co_n_anis_over_2[absarg] * par_comb_2));
|
||||
|
||||
if (counter++ > 100) { // we do at most 100 products before taking a log
|
||||
|
@ -103,17 +118,17 @@ inline complex<DP> Fn_K (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_
|
|||
int absarg2 = abs(arg2);
|
||||
|
||||
return(4.0/(
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg1] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg1) * A.chain.si_n_anis_over_2[absarg1] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg1) * A.chain.si_n_anis_over_2[absarg1] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg1] * (B.chain.par[k] - A.chain.par[j])) )
|
||||
*
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg2] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg2) * A.chain.si_n_anis_over_2[absarg2] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg2) * A.chain.si_n_anis_over_2[absarg2] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg2] * (B.chain.par[k] - A.chain.par[j])) )
|
||||
));
|
||||
|
@ -123,8 +138,8 @@ inline complex<DP> Fn_K (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_
|
|||
inline complex<DP> Fn_L (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return (sinh(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
+ 0.25 * II * PI * complex<DP>(-A.chain.par[j] + B.chain.par[k])))
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
+ 0.25 * II * PI * complex<DP>(-A.chain.par[j] + B.chain.par[k])))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
|
@ -135,14 +150,14 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
|
||||
// Check that the two states are compatible
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXZ_Chains in Smin matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXZ_Chains in Smin matrix element.");
|
||||
|
||||
// Check that A and B are Mdown-compatible:
|
||||
// Check that A and B are Mdown-compatible:
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 1) {
|
||||
cout << "A.base.Mdown = " << A.base.Mdown << "\tB.base.Mdown = " << B.base.Mdown << endl;
|
||||
cout << "A: " << A << endl << "B: " << B << endl;
|
||||
JSCerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
ABACUSerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
}
|
||||
|
||||
// Compute the sinh and cosh of rapidities
|
||||
|
@ -166,13 +181,13 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(sinh(A.lambda[i][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[i]))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(sinh(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
|
@ -199,7 +214,7 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1); // assume only one-strings here
|
||||
|
||||
ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.anis)));
|
||||
|
@ -210,7 +225,7 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.anis)));
|
||||
|
||||
// Now proceed to build the Hm matrix
|
||||
|
@ -232,11 +247,11 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
one_over_A_sinhlambda_sq_plus_sinzetaover2sq = 1.0/((sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
* (sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ pow(sin(0.5*A.chain.anis), 2.0));
|
||||
|
@ -249,12 +264,12 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
|
||||
// use simplified code for one-string here: original form of Hm matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
:
|
||||
|
@ -265,59 +280,59 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
Hm[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2;
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
/*
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
*/
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]] + logabssinzeta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinzeta);
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinzeta);
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
Hm[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_sinhlambda_sq_plus_sinzetaover2sq;
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_sinhlambda_sq_plus_sinzetaover2sq;
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
complex<DP> ln_ME_sq = log(1.0 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
complex<DP> ln_ME_sq = log(1.0 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
+ 2.0 * real(lndet_LU_CX_dstry(Hm)) + logabssinzeta - A.lnnorm - B.lnnorm;
|
||||
|
||||
//return(ln_ME_sq);
|
||||
|
@ -325,4 +340,4 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
|||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
불러오는 중...
Reference in New Issue