Remove deprecated files; make sure data output is precision 16
This commit is contained in:
parent
7fb3e6d3b4
commit
0c893c89f7
|
@ -3,3 +3,5 @@
|
||||||
*~
|
*~
|
||||||
|
|
||||||
*tar.gz
|
*tar.gz
|
||||||
|
|
||||||
|
TEST/*
|
30
Makefile
30
Makefile
|
@ -22,9 +22,17 @@ SRCDIR = $(BASEDIR)src/
|
||||||
EXECSDIR = $(BASEDIR)src/EXECS/
|
EXECSDIR = $(BASEDIR)src/EXECS/
|
||||||
BINDIR = $(BASEDIR)bin/
|
BINDIR = $(BASEDIR)bin/
|
||||||
|
|
||||||
|
# Set the compiler choice
|
||||||
|
#CXX = g++
|
||||||
|
CXX = /usr/local/bin/g++
|
||||||
|
MPICXX = mpicxx
|
||||||
|
|
||||||
|
|
||||||
#COMPILE = g++ -Wall -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -stdlib=libstdc++
|
#COMPILE = g++ -Wall -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -stdlib=libstdc++
|
||||||
#COMPILE = g++ -Wall -I$(BASEDIR)include/ -L$(LIBDIR) -O3
|
#COMPILE = g++ -Wall -I$(BASEDIR)include/ -L$(LIBDIR) -O3
|
||||||
COMPILE = g++ -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
#COMPILE = g++ -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
||||||
|
COMPILE = $(CXX) -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
||||||
|
#COMPILE = clang++ -std=c++17 -Weverything -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
||||||
#COMPILE_MPI = mpicxx -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -stdlib=libstdc++
|
#COMPILE_MPI = mpicxx -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -stdlib=libstdc++
|
||||||
COMPILE_MPI = mpicxx -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
|
#COMPILE_OMP = g++ -I$(BASEDIR)include/ -L$(LIBDIR) -O3 -w -fopenmp
|
||||||
|
@ -120,8 +128,8 @@ lib$(VERSION).a : $(Objects_ALL)
|
||||||
$(COMPILE) $(EXECSDIR)Heis_DSF_GeneralState.cc -o $(BINDIR)Heis_DSF_GeneralState -l$(VERSION)
|
$(COMPILE) $(EXECSDIR)Heis_DSF_GeneralState.cc -o $(BINDIR)Heis_DSF_GeneralState -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)Smoothen_Heis_DSF.cc -o $(BINDIR)Smoothen_Heis_DSF -l$(VERSION)
|
$(COMPILE) $(EXECSDIR)Smoothen_Heis_DSF.cc -o $(BINDIR)Smoothen_Heis_DSF -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)XXZ_gpd_StagSz_h0.cc -o $(BINDIR)XXZ_gpd_StagSz_h0 -l$(VERSION)
|
$(COMPILE) $(EXECSDIR)XXZ_gpd_StagSz_h0.cc -o $(BINDIR)XXZ_gpd_StagSz_h0 -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)ODSLF_DSF.cc -o $(BINDIR)ODSLF_DSF -l$(VERSION)
|
# $(COMPILE) $(EXECSDIR)ODSLF_DSF.cc -o $(BINDIR)ODSLF_DSF -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)Smoothen_ODSLF_DSF.cc -o $(BINDIR)Smoothen_ODSLF_DSF -l$(VERSION)
|
# $(COMPILE) $(EXECSDIR)Smoothen_ODSLF_DSF.cc -o $(BINDIR)Smoothen_ODSLF_DSF -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)Check_RAW_File.cc -o $(BINDIR)Check_RAW_File -l$(VERSION)
|
$(COMPILE) $(EXECSDIR)Check_RAW_File.cc -o $(BINDIR)Check_RAW_File -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)Analyze_RAW_File.cc -o $(BINDIR)Analyze_RAW_File -l$(VERSION)
|
$(COMPILE) $(EXECSDIR)Analyze_RAW_File.cc -o $(BINDIR)Analyze_RAW_File -l$(VERSION)
|
||||||
$(COMPILE) $(EXECSDIR)RAW_File_Stats.cc -o $(BINDIR)RAW_File_Stats -l$(VERSION)
|
$(COMPILE) $(EXECSDIR)RAW_File_Stats.cc -o $(BINDIR)RAW_File_Stats -l$(VERSION)
|
||||||
|
@ -382,17 +390,9 @@ $(OBJDIR)General_Scan_Parallel.o : General_Scan_Parallel.cc $(Headers_all)
|
||||||
$(OBJDIR)Particle_Hole_Excitation_Cost.o : Particle_Hole_Excitation_Cost.cc $(Headers_all)
|
$(OBJDIR)Particle_Hole_Excitation_Cost.o : Particle_Hole_Excitation_Cost.cc $(Headers_all)
|
||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
#$(OBJDIR)Offsets.o : Offsets.cc $(Headers_all)
|
|
||||||
# $(COMPILE) -c $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)Scan_Info.o : Scan_Info.cc $(Headers_all)
|
$(OBJDIR)Scan_Info.o : Scan_Info.cc $(Headers_all)
|
||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
#$(OBJDIR)Scan_State_List.o : Scan_State_List.cc $(Headers_all)
|
|
||||||
# $(COMPILE) -c $< -o $@
|
|
||||||
|
|
||||||
#$(OBJDIR)Scan_Thread_List.o : Scan_Thread_List.cc $(Headers_all)
|
|
||||||
#$(OBJDIR)Scan_Thread_Set.o : Scan_Thread_Set.cc $(Headers_all)
|
|
||||||
$(OBJDIR)Scan_Thread_Data.o : Scan_Thread_Data.cc $(Headers_all)
|
$(OBJDIR)Scan_Thread_Data.o : Scan_Thread_Data.cc $(Headers_all)
|
||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
|
@ -451,14 +451,6 @@ $(OBJDIR)Young_Tableau.o : Young_Tableau.cc $(Headers_all)
|
||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
############################################
|
|
||||||
|
|
||||||
#executables :
|
|
||||||
# $(COMPILE) $(EXECSDIR)LiebLin_DSF.cc -o $(BINDIR)LiebLin_DSF -l$(VERSION)
|
|
||||||
# $(COMPILE) $(EXECSDIR)Smoothen_LiebLin_DSF.cc -o $(BINDIR)Smoothen_LiebLin_DSF -l$(VERSION)
|
|
||||||
# $(COMPILE) $(EXECSDIR)Heis_DSF.cc -o $(BINDIR)Heis_DSF -l$(VERSION)
|
|
||||||
# $(COMPILE) $(EXECSDIR)Smoothen_Heis_DSF.cc -o $(BINDIR)Smoothen_Heis_DSF -l$(VERSION)
|
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Executables (parallel versions)
|
# Executables (parallel versions)
|
||||||
|
|
||||||
|
|
237
README.md
237
README.md
|
@ -1,16 +1,41 @@
|
||||||
# ABACUS
|
# ABACUS
|
||||||
|
|
||||||
Copyright (c) J.-S. Caux
|
Copyright (c) J.-S. Caux.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ABACUS is a general set of algorithms for dealing with Bethe Ansatz-solvable systems including:
|
||||||
|
|
||||||
|
* Lieb-Liniger (delta-)interacting bosons
|
||||||
|
* Heisenberg spin chains
|
||||||
|
* Isotropic antiferromagnet (XXX)
|
||||||
|
* Anisotropic gapless antiferromagnet (XXZ, 0 < Delta < 1)
|
||||||
|
* Anisotropic gapped antiferromagnet (XXZ_gpd, Delta > 1)
|
||||||
|
* Interacting fermions (Jordan-Wigner'd XXZ)
|
||||||
|
|
||||||
|
The principal purposes of ABACUS are:
|
||||||
|
* to construct Bethe eigenstates
|
||||||
|
* to compute (dynamical) correlation functions of basic observables
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
From the base directory, simply run
|
||||||
|
```
|
||||||
|
$ make
|
||||||
|
```
|
||||||
|
This will produce all executables, together with a library `ABACUS_[vn]` where vn is of the form [digit][character].
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Previous versions
|
Previous versions
|
||||||
=================
|
=================
|
||||||
|
Development of ABACUS started around 2004 and has known an embarrassingly large number of versions.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
Here under are some notes on major versions and overhauls of the codebase.
|
||||||
## ABACUS++G_8 [started 2015 02 20] [published 2015 04 04]
|
|
||||||
|
#### ABACUS++G_8
|
||||||
|
_[started 2015 02 20] [published 2015 04 04]_
|
||||||
|
|
||||||
Building up on ++G_7.
|
Building up on ++G_7.
|
||||||
|
|
||||||
|
@ -19,54 +44,57 @@ Objectives:
|
||||||
- facilitate use of OpenMP, by removing the recursive aspect of descending. DONE.
|
- facilitate use of OpenMP, by removing the recursive aspect of descending. DONE.
|
||||||
|
|
||||||
- improve memory use. DONE.
|
- improve memory use. DONE.
|
||||||
Replace in-memory Scan_Thread_Set by on-disk Scan_Thread_Data.
|
Replace in-memory `Scan_Thread_Set` by on-disk `Scan_Thread_Data`.
|
||||||
Uses Scan_Thread structure.
|
Uses `Scan_Thread` structure.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
- OpenMP is implemented.
|
- OpenMP is implemented.
|
||||||
- Scanning on spin chains is now implemented.
|
- Scanning on spin chains is now implemented.
|
||||||
- Scan_Info's Nfull now contains the sub-Hilbert space dimension (for spin chains; type == double)
|
- `Scan_Info`'s `Nfull` now contains the sub-Hilbert space dimension (for spin chains; `type == double`)
|
||||||
- Added the .stat file in General_Scan, containing info about expected data value and actually obtained one
|
- Added the .stat file in `General_Scan`, containing info about expected data value and actually obtained one
|
||||||
- Timing is more strictly enforced, using OpenMP wtime().
|
- Timing is more strictly enforced, using OpenMP `wtime()`.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- a first implementation using OpenMP is archived as ABACUS++G_8_v1.tar.gz package.
|
- a first implementation using OpenMP is archived as ABACUS++G_8_v1.tar.gz package.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
#### ABACUS++G_7
|
||||||
ABACUS++G_7 [published 2015 01 17]
|
_[published 2015 01 17]_
|
||||||
|
|
||||||
Building up on ++G_6.
|
Building up on ++G_6.
|
||||||
- Now using 15 types of descendents, enabling fixed iK scanning with increasing ph nrs.
|
- Now using 15 types of descendents, enabling fixed iK scanning with increasing ph nrs.
|
||||||
- Scan_Thread_List replaced by Scan_Thread_Set (to optimize performance and threads storage)
|
- `Scan_Thread_List` replaced by `Scan_Thread_Set` (to optimize performance and threads storage)
|
||||||
|
|
||||||
Works well for LiebLin, including at finite T.
|
Works well for LiebLin, including at finite T.
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- implement scanning for spin chains (scanning over bases still missing for generic AveragingState)
|
- implement scanning for spin chains (scanning over bases still missing for generic `AveragingState`)
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
ABACUS++G_6 [started 2015 01]
|
|
||||||
|
|
||||||
Simple scanning: iK stepped up, iK stepped down (from ++G_5).
|
#### ABACUS++G_6
|
||||||
|
_[started 2015 01]_
|
||||||
|
|
||||||
|
Simple scanning: `iK` stepped up, `iK` stepped down (from ++G_5).
|
||||||
Fixed momentum scanning is thus implemented.
|
Fixed momentum scanning is thus implemented.
|
||||||
|
|
||||||
Version 6.0: [published 2015 01 16]
|
###### Version 6.0: _[published 2015 01 16]_
|
||||||
- uses 8 types of descendents
|
- uses 8 types of descendents
|
||||||
- Works well for LiebLin, including finite T.
|
- Works well for LiebLin, including finite T.
|
||||||
|
|
||||||
Version 6.1: proto version of ++G_7
|
###### Version 6.1: proto version of ++G_7
|
||||||
- uses greater nr of descendents, 15, enforcing strict ph nr increase
|
- uses greater nr of descendents, 15, enforcing strict ph nr increase
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
ABACUS++G_5 [started 2014 12 11] [abandoned 2015 01, except for version 5.0 (great for GS of LiebLin)]
|
#### ABACUS++G_5
|
||||||
|
_[started 2014 12 11] [abandoned 2015 01, except for version 5.0 (great for GS of LiebLin)]_
|
||||||
|
|
||||||
Fundamental rewriting of scanning protocol.
|
Fundamental rewriting of scanning protocol.
|
||||||
|
|
||||||
Version 5.0 works very well for ground state correlations of Lieb-Liniger.
|
Version 5.0 works very well for ground state correlations of Lieb-Liniger.
|
||||||
Heis: still bugged.
|
Heis: still bugged.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
ABACUS++G_4 [started 2014 12 08] [abandoned 2014 12 11]
|
#### ABACUS++G_4
|
||||||
|
_[started 2014 12 08] [abandoned 2014 12 11]_
|
||||||
|
|
||||||
Nontrivial bug: descending with inner and outer skeletons does not always
|
Nontrivial bug: descending with inner and outer skeletons does not always
|
||||||
preserve number of p-h excitations. Fatal for large c in LiebLin.
|
preserve number of p-h excitations. Fatal for large c in LiebLin.
|
||||||
|
@ -79,33 +107,32 @@ TODO:
|
||||||
- For XXX: inclusion of infinite rapidities as genuine particle type
|
- For XXX: inclusion of infinite rapidities as genuine particle type
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
#### ABACUS++G_3
|
||||||
ABACUS++G_3 [started 2014 11 10] [closed 2014 12 08]
|
_[started 2014 11 10] [closed 2014 12 08]_
|
||||||
|
|
||||||
- Change of naming convention: LiebLin instead of Bose or 1DBG.
|
- Change of naming convention: LiebLin instead of Bose or 1DBG.
|
||||||
- For LiebLin: changed rapidity naming convention: now lambdaoc, to make rescaling \lambda/c explicit
|
- For LiebLin: changed rapidity naming convention: now `lambdaoc`, to make rescaling lambda/c explicit
|
||||||
- Improved small c algorithm for LiebLin
|
- Improved small c algorithm for LiebLin
|
||||||
- Fixed momentum scanning implemented using inner and outer skeleton logic
|
- Fixed momentum scanning implemented using inner and outer skeleton logic
|
||||||
|
|
||||||
------------------------------------------------------------------
|
#### ABACUS++G_2
|
||||||
ABACUS++G_2 [closed 2014 11 10]
|
_[closed 2014 11 10] [2013 09 20]_
|
||||||
[2013 09 20]
|
|
||||||
- Scanning is now automatically over remaining pair of excitations; facilitates fixed iK scans
|
- Scanning is now automatically over remaining pair of excitations; facilitates fixed iK scans
|
||||||
- Threads are now over states with NScan-2 particles, intermediate states then include all Nscan states fulfilling the momentum constraints
|
- Threads are now over states with NScan-2 particles, intermediate states then include all Nscan states fulfilling the momentum constraints
|
||||||
- Scanning for spin chains implemented (general states; also parallel). Needs further testing. Seems to work for ground state.
|
- Scanning for spin chains implemented (general states; also parallel). Needs further testing. Seems to work for ground state.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
ABACUS++G_1.1
|
|
||||||
|
|
||||||
[2013 09 06]
|
#### ABACUS++G_1.1
|
||||||
|
_[2013 09 06]_
|
||||||
|
|
||||||
Changed parallel version for Bose:
|
Changed parallel version for Bose:
|
||||||
- supercycle time is now an argument to functions
|
- supercycle time is now an argument to functions
|
||||||
- split the 'Prepare', 'Run' and 'Wrapup' into separate executables
|
- split the `Prepare`, `Run` and `Wrapup` into separate executables
|
||||||
- added the 'filenamesuffix' argument to parallel functions
|
- added the `filenamesuffix` argument to parallel functions
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
ABACUS++G_1
|
#### ABACUS++G_1
|
||||||
|
|
||||||
New labelling and descending implemented for arbitrary states with strings, e.g. spin chains.
|
New labelling and descending implemented for arbitrary states with strings, e.g. spin chains.
|
||||||
|
|
||||||
|
@ -119,53 +146,82 @@ Include string deviation value in Bethe_State objects and in RAW files. Form fac
|
||||||
Changed sum rules for LiebLin density-density: now using f-sumrule from iKmin to iKmax.
|
Changed sum rules for LiebLin density-density: now using f-sumrule from iKmin to iKmax.
|
||||||
|
|
||||||
|
|
||||||
Earlier notes for ABACUS++T:
|
#### Earlier notes for ABACUS++T
|
||||||
##############################################################
|
|
||||||
|
|
||||||
Notable changes from ABACUS++:
|
Notable changes from ABACUS++:
|
||||||
|
|
||||||
- The state labelling is now done with a single `string' label, detailing the base, nr of particle-hole excitations (as compared to a reference scan state) and Ix2 changes. The number of particle-hole excitations is therefore not limited anymore, and (for LiebLin) there is no upper momentum limit. See the src/State_Label.cc file for the implementation details.
|
- The state labelling is now done with a single `string` label, detailing the base, nr of particle-hole excitations (as compared to a reference scan state) and `Ix2` changes. The number of particle-hole excitations is therefore not limited anymore, and (for LiebLin) there is no upper momentum limit. See the `src/State_Label.cc` file for the implementation details.
|
||||||
|
|
||||||
- The state scanning procedure (i.e. the descendents logic) is now implemented solely at the level of the quantum numbers, following a recursive logic in which excitations are created at the right, then left Fermi boundary and allowed to propagate deeper outside/inside as the tree is climbed.
|
- The state scanning procedure (i.e. the descendents logic) is now implemented solely at the level of the quantum numbers, following a recursive logic in which excitations are created at the right, then left Fermi boundary and allowed to propagate deeper outside/inside as the tree is climbed.
|
||||||
|
|
||||||
- Since the labelling and descending are now completely general, dynamical correlations not only on ground states but also on arbitrary excited states can be computed efficiently. This thus allows to deal with finite temperature correlations.
|
- Since the labelling and descending are now completely general, dynamical correlations not only on ground states but also on arbitrary excited states can be computed efficiently. This thus allows to deal with finite temperature correlations.
|
||||||
|
|
||||||
|
|
||||||
##############################################################
|
|
||||||
|
|
||||||
IMPROVEMENTS YET TO BE IMPLEMENTED:
|
|
||||||
|
|
||||||
- Some form of binning to make very large runs possible.
|
|
||||||
Possibility: post-processing of the .raw file, joining together contributions at given iK and (about) same energy into effective ones and saving those into a pre-defined matrix format.
|
|
||||||
Difficulties: the size of the .raw file is of the order of the .thr one, which must be kept.
|
|
||||||
|
|
||||||
##############################################################
|
|
||||||
|
|
||||||
VERSIONS: NOTES
|
|
||||||
|
|
||||||
Important conventions:
|
Important conventions:
|
||||||
|
|
||||||
- Versions are numbered with two integers, [VERSION].[SUBVERSION]
|
- Versions are numbered with two integers, [VERSION].[SUBVERSION]
|
||||||
- Changes in subversion number indicate `internal' revisions which do not change any of the external conventions, data file structures, etc. Data produced with version V.S can be `polished' with version V.S' with S' != S.
|
- Changes in subversion number indicate internal revisions which do not change any of the external conventions, data file structures, etc. Data produced with version V.S can be polished with version V.S' with S' != S.
|
||||||
- Changes in version number indicate a larger scale revision affecting the conventions. Data produced with earlier versions are then deprecated.
|
- Changes in version number indicate a larger scale revision affecting the conventions. Data produced with earlier versions are then deprecated.
|
||||||
|
|
||||||
---------------------------------------------------------------
|
|
||||||
|
|
||||||
ABACUS++T_1.0 [published 23 June 2011]
|
|
||||||
|
|
||||||
First version of new setup and logic for ABACUS. Implementation of all basic new ideas for state labelling and descending.
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
#### ABACUS++T_9
|
||||||
|
_[in development][abandoned]_
|
||||||
|
|
||||||
ABACUS++T_2.0 [in progress][*ABANDONED*]
|
Scanning over ensembles.
|
||||||
|
|
||||||
Attempt at implementing fixed-momentum-based scanning.
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
#### ABACUS++T_8.0
|
||||||
|
|
||||||
ABACUS++T_3.0 [published 1 Nov 2011]
|
Changed labels slightly, to avoid identifying empty string with integer 0.
|
||||||
|
All labels with at least one excitation are now strictly nonempty.
|
||||||
|
|
||||||
|
|
||||||
|
#### ABACUS++T_7.0
|
||||||
|
_[published 1 Dec 2011]_
|
||||||
|
|
||||||
|
Optimization of runtime memory use and of output files sizes.
|
||||||
|
|
||||||
|
Labels: introduction of compressed labels (used in raw and thr files).
|
||||||
|
Removed conv boolean from raw file (all states in this file have converged).
|
||||||
|
Threads: removed omega and iK (changed `General_Scan` accordingly), use compressed labels.
|
||||||
|
|
||||||
|
Scanning function: it's now possible to give a default file name when invoking
|
||||||
|
`General_Scan` (and thus `Scan_Bose`, etc). This is done to avoid stupidly long file
|
||||||
|
names when calculating correlators over `AveragingState`s which are far from
|
||||||
|
the ground state.
|
||||||
|
|
||||||
|
|
||||||
|
#### ABACUS++T_6.0
|
||||||
|
_[published 21 Nov 2011]_
|
||||||
|
|
||||||
|
The scanning is now also done over the hole positions.
|
||||||
|
Upon the creation of a particle-hole, only hole positions at the edges of
|
||||||
|
blocks of contiguous `Ix2` in `OriginState` are used.
|
||||||
|
The holes are then scanned moving towards the center of the blocks.
|
||||||
|
|
||||||
|
There are now thus 3 types of scanning:
|
||||||
|
0: over holes
|
||||||
|
1: over particles
|
||||||
|
2: adding a p-h pair
|
||||||
|
|
||||||
|
|
||||||
|
#### ABACUS++T_5.0
|
||||||
|
_[published 4 Nov 2011]_
|
||||||
|
|
||||||
|
Introduced two types of threads, separating scanning over fixed particle-hole numbers
|
||||||
|
and adding a p-h.
|
||||||
|
|
||||||
|
|
||||||
|
#### ABACUS++T_4.0 [published 1 Nov 2011]
|
||||||
|
|
||||||
|
Modification to the labeling logic:
|
||||||
|
states are now always labeled using the AveragingState's quantum numbers,
|
||||||
|
even if their bases are different. The form of the `State_Label` is thus changed.
|
||||||
|
|
||||||
|
|
||||||
|
#### ABACUS++T_3.0
|
||||||
|
_[published 1 Nov 2011]_
|
||||||
|
|
||||||
New, simpler logic for descendents: the hole positions are scanned immediately
|
New, simpler logic for descendents: the hole positions are scanned immediately
|
||||||
upon creation of a new particle-hole pair; the hole positions are then kept fixed
|
upon creation of a new particle-hole pair; the hole positions are then kept fixed
|
||||||
|
@ -176,60 +232,17 @@ Problems:
|
||||||
the extra particle in the AveragingState is not scanned to. Version 4 will
|
the extra particle in the AveragingState is not scanned to. Version 4 will
|
||||||
address this problem.
|
address this problem.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
|
|
||||||
ABACUS++T_4.0 [published 1 Nov 2011]
|
#### ABACUS++T_2.0
|
||||||
|
_[in progress][abandoned]_
|
||||||
|
|
||||||
Modification to the labeling logic:
|
Attempt at implementing fixed-momentum-based scanning.
|
||||||
states are now always labeled using the AveragingState's quantum numbers,
|
|
||||||
even if their bases are different. The form of the State_Label is thus changed.
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
#### ABACUS++T_1.0
|
||||||
|
_[published 23 June 2011]_
|
||||||
|
|
||||||
ABACUS++T_5.0 [published 4 Nov 2011]
|
First version of new setup and logic for ABACUS. Implementation of all basic new ideas for state labelling and descending.
|
||||||
|
|
||||||
Introduced two types of threads, separating scanning over fixed particle-hole numbers
|
|
||||||
and adding a p-h.
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
|
|
||||||
ABACUS++T_6.0 [published 21 Nov 2011]
|
|
||||||
|
|
||||||
The scanning is now also done over the hole positions.
|
|
||||||
Upon the creation of a particle-hole, only hole positions at the edges of
|
|
||||||
blocks of contiguous Ix2 in OriginState are used.
|
|
||||||
The holes are then scanned moving towards the center of the blocks.
|
|
||||||
|
|
||||||
There are now thus 3 types of scanning:
|
|
||||||
0: over holes
|
|
||||||
1: over particles
|
|
||||||
2: adding a p-h pair
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
|
|
||||||
ABACUS++T_7.0 [published 1 Dec 2011]]
|
|
||||||
|
|
||||||
Optimization of runtime memory use and of output files sizes.
|
|
||||||
|
|
||||||
Labels: introduction of compressed labels (used in raw and thr files).
|
|
||||||
Removed conv boolean from raw file (all states in this file have converged).
|
|
||||||
Threads: removed omega and iK (changed General_Scan accordingly), use compressed labels.
|
|
||||||
|
|
||||||
Scanning function: it's now possible to give a default file name when invoking
|
|
||||||
General_Scan (and thus Scan_Bose, etc). This is done to avoid stupidly long file
|
|
||||||
names when calculating correlators over AveragingStates which are far from
|
|
||||||
the ground state.
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
|
|
||||||
ABACUS++T_8.0
|
|
||||||
|
|
||||||
Changed labels slightly, to avoid identifying empty string with integer 0.
|
|
||||||
All labels with at least one excitation are now strictly nonempty.
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
### Earlier versions
|
||||||
|
Earlier version of ABACUS are not documented here. The whole history is available in J.-S. Caux's private backfiles.
|
||||||
ABACUS++T_9 [in development][abandoned]
|
|
||||||
|
|
||||||
Scanning over ensembles.
|
|
||||||
|
|
|
@ -20,11 +20,11 @@ using namespace JSC;
|
||||||
|
|
||||||
namespace JSC {
|
namespace JSC {
|
||||||
|
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_Bethe_State& LeftState,
|
||||||
//XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
//XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
||||||
// XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
// XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_Bethe_State& LeftState,
|
||||||
XXZ_Bethe_State& RightState, DP Chem_Pot, stringstream& DAT_outfile)
|
XXZ_Bethe_State& RightState, DP Chem_Pot, stringstream& DAT_outfile)
|
||||||
{
|
{
|
||||||
// This function prints the matrix information to the fstream,
|
// This function prints the matrix information to the fstream,
|
||||||
|
@ -61,20 +61,21 @@ namespace JSC {
|
||||||
while(iKout < 0) iKout += RightState.chain.Nsites;
|
while(iKout < 0) iKout += RightState.chain.Nsites;
|
||||||
while(iKout >= RightState.chain.Nsites) iKout -= RightState.chain.Nsites;
|
while(iKout >= RightState.chain.Nsites) iKout -= RightState.chain.Nsites;
|
||||||
|
|
||||||
|
DAT_outfile << setprecision(16);
|
||||||
// Print information to fstream:
|
// Print information to fstream:
|
||||||
if (iKout >= iKmin && iKout <= iKmax) {
|
if (iKout >= iKmin && iKout <= iKmax) {
|
||||||
if (whichDSF == 'Z') {
|
if (whichDSF == 'Z') {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
|
@ -92,11 +93,11 @@ namespace JSC {
|
||||||
return(data_value);
|
return(data_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXX_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXX_Bethe_State& LeftState,
|
||||||
//XXX_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
//XXX_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
||||||
//XXX_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
//XXX_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXX_Bethe_State& LeftState,
|
||||||
XXX_Bethe_State& RightState, DP Chem_Pot, stringstream& DAT_outfile)
|
XXX_Bethe_State& RightState, DP Chem_Pot, stringstream& DAT_outfile)
|
||||||
{
|
{
|
||||||
// This function prints the matrix element information to the fstream,
|
// This function prints the matrix element information to the fstream,
|
||||||
|
@ -137,7 +138,7 @@ namespace JSC {
|
||||||
if (LeftState.base.Mdown == RightState.base.Mdown - 1) { // two infinite rapidities, use rescaled S^- matrix element instead of S^+
|
if (LeftState.base.Mdown == RightState.base.Mdown - 1) { // two infinite rapidities, use rescaled S^- matrix element instead of S^+
|
||||||
nrinfrap = 2;
|
nrinfrap = 2;
|
||||||
// Correction factor for MEsq: Smffsq to Spffsq = 2/((N - 2M + 2) (N - 2M + 1))
|
// Correction factor for MEsq: Smffsq to Spffsq = 2/((N - 2M + 2) (N - 2M + 1))
|
||||||
ME = sqrt(2.0/((RightState.chain.Nsites - 2*RightState.base.Mdown + 2.0) * (RightState.chain.Nsites - 2*RightState.base.Mdown + 1.0)))
|
ME = sqrt(2.0/((RightState.chain.Nsites - 2*RightState.base.Mdown + 2.0) * (RightState.chain.Nsites - 2*RightState.base.Mdown + 1.0)))
|
||||||
* exp(real(ln_Smin_ME (RightState, LeftState)));
|
* exp(real(ln_Smin_ME (RightState, LeftState)));
|
||||||
}
|
}
|
||||||
else if (LeftState.base.Mdown == RightState.base.Mdown) { // one infinite rapidity, use rescaled S^z matrix element instead of S^+
|
else if (LeftState.base.Mdown == RightState.base.Mdown) { // one infinite rapidity, use rescaled S^z matrix element instead of S^+
|
||||||
|
@ -170,29 +171,30 @@ namespace JSC {
|
||||||
while(iKout < 0) iKout += RightState.chain.Nsites;
|
while(iKout < 0) iKout += RightState.chain.Nsites;
|
||||||
while(iKout >= RightState.chain.Nsites) iKout -= RightState.chain.Nsites;
|
while(iKout >= RightState.chain.Nsites) iKout -= RightState.chain.Nsites;
|
||||||
|
|
||||||
|
DAT_outfile << setprecision(16);
|
||||||
// Print information to fstream:
|
// Print information to fstream:
|
||||||
if (iKout >= iKmin && iKout <= iKmax) {
|
if (iKout >= iKmin && iKout <= iKmax) {
|
||||||
if (whichDSF == 'Z') {
|
if (whichDSF == 'Z') {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown + nrinfrap - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown + nrinfrap - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
else if (whichDSF == 'q') {
|
else if (whichDSF == 'q') {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown + nrinfrap - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown + nrinfrap - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
<< real(ME_CX) << "\t" << imag(ME_CX) - twoPI * int(imag(ME_CX)/twoPI + 1.0e-10) << "\t"
|
<< real(ME_CX) << "\t" << imag(ME_CX) - twoPI * int(imag(ME_CX)/twoPI + 1.0e-10) << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown + nrinfrap - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown + nrinfrap - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +205,7 @@ namespace JSC {
|
||||||
//DP data_value = (iKout == 0 ? 1.0 : 2.0) * MEsq;
|
//DP data_value = (iKout == 0 ? 1.0 : 2.0) * MEsq;
|
||||||
if (whichDSF == 'Z') // use 1/(1 + omega)
|
if (whichDSF == 'Z') // use 1/(1 + omega)
|
||||||
data_value = 1.0/(1.0 + LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot);
|
data_value = 1.0/(1.0 + LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot);
|
||||||
else if (whichDSF == 'q')
|
else if (whichDSF == 'q')
|
||||||
data_value = exp(2.0 * real(ME_CX));
|
data_value = exp(2.0 * real(ME_CX));
|
||||||
else if (fixed_iK) // data value is MEsq * omega:
|
else if (fixed_iK) // data value is MEsq * omega:
|
||||||
data_value = ME * ME * (LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot);
|
data_value = ME * ME * (LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot);
|
||||||
|
@ -211,11 +213,11 @@ namespace JSC {
|
||||||
return(data_value);
|
return(data_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_gpd_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_gpd_Bethe_State& LeftState,
|
||||||
//XXZ_gpd_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
//XXZ_gpd_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
||||||
// XXZ_gpd_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
// XXZ_gpd_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, XXZ_gpd_Bethe_State& LeftState,
|
||||||
XXZ_gpd_Bethe_State& RightState, DP Chem_Pot, stringstream& DAT_outfile)
|
XXZ_gpd_Bethe_State& RightState, DP Chem_Pot, stringstream& DAT_outfile)
|
||||||
{
|
{
|
||||||
// This function prints the matrix element information to the fstream,
|
// This function prints the matrix element information to the fstream,
|
||||||
|
@ -233,7 +235,7 @@ namespace JSC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool fixed_iK = (iKmin == iKmax);
|
bool fixed_iK = (iKmin == iKmax);
|
||||||
|
|
||||||
|
|
||||||
// If any of the rapidities outside of fundamental interval -pi/2 < lambda <= pi/2, set matrix element to zero.
|
// If any of the rapidities outside of fundamental interval -pi/2 < lambda <= pi/2, set matrix element to zero.
|
||||||
bool rap_in_fundamental = true;
|
bool rap_in_fundamental = true;
|
||||||
|
@ -254,9 +256,9 @@ namespace JSC {
|
||||||
for (int k = 0; k < LeftState.chain.Nstrings; ++k)
|
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 * JSC::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
|
// 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
|
if (LeftState.base.Nrap[j] >= 1
|
||||||
&& (LeftState.Ix2[j][0] <= -(LeftState.chain.Nsites - sum1)
|
&& (LeftState.Ix2[j][0] <= -(LeftState.chain.Nsites - sum1)
|
||||||
|| (LeftState.Ix2[j][LeftState.base.Nrap[j] - 1] - LeftState.Ix2[j][0])
|
|| (LeftState.Ix2[j][LeftState.base.Nrap[j] - 1] - LeftState.Ix2[j][0])
|
||||||
> 2*(LeftState.chain.Nsites - sum1)))
|
> 2*(LeftState.chain.Nsites - sum1)))
|
||||||
rap_in_fundamental = false;
|
rap_in_fundamental = false;
|
||||||
*/
|
*/
|
||||||
|
@ -267,7 +269,7 @@ namespace JSC {
|
||||||
// rap_in_fundamental = false;
|
// rap_in_fundamental = false;
|
||||||
//}
|
//}
|
||||||
/*
|
/*
|
||||||
if (LeftState.base.Nrap[j] > 0 &&
|
if (LeftState.base.Nrap[j] > 0 &&
|
||||||
((LeftState.lambda[j][LeftState.base.Nrap[j] - 1] - LeftState.lambda[j][0] >= PI)
|
((LeftState.lambda[j][LeftState.base.Nrap[j] - 1] - LeftState.lambda[j][0] >= PI)
|
||||||
|| LeftState.lambda[j][0] < -0.5*PI + 1.0e-10
|
|| LeftState.lambda[j][0] < -0.5*PI + 1.0e-10
|
||||||
|| LeftState.lambda[j][LeftState.base.Nrap[j] - 1] > 0.5*PI
|
|| LeftState.lambda[j][LeftState.base.Nrap[j] - 1] > 0.5*PI
|
||||||
|
@ -279,7 +281,7 @@ namespace JSC {
|
||||||
rap_in_fundamental = false;
|
rap_in_fundamental = false;
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
if (LeftState.base.Nrap[j] > 0 &&
|
if (LeftState.base.Nrap[j] > 0 &&
|
||||||
((LeftState.lambda[j][LeftState.base.Nrap[j] - 1] - LeftState.lambda[j][0] >= PI)
|
((LeftState.lambda[j][LeftState.base.Nrap[j] - 1] - LeftState.lambda[j][0] >= PI)
|
||||||
//|| (LeftState.base.Nrap[j] == 1 && fabs(LeftState.lambda[j][0]) > 0.5*PI)
|
//|| (LeftState.base.Nrap[j] == 1 && fabs(LeftState.lambda[j][0]) > 0.5*PI)
|
||||||
))
|
))
|
||||||
|
@ -287,10 +289,10 @@ namespace JSC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Logic: allow rapidities -PI/2 <= lambda <= PI/2 (including boundaries)
|
// Logic: allow rapidities -PI/2 <= lambda <= PI/2 (including boundaries)
|
||||||
if (LeftState.base.Nrap[j] > 0 &&
|
if (LeftState.base.Nrap[j] > 0 &&
|
||||||
(LeftState.lambda[j][0] < -PI/2 || LeftState.lambda[j][LeftState.base.Nrap[j] - 1] > PI/2))
|
(LeftState.lambda[j][0] < -PI/2 || LeftState.lambda[j][LeftState.base.Nrap[j] - 1] > PI/2))
|
||||||
rap_in_fundamental = false;
|
rap_in_fundamental = false;
|
||||||
if (RightState.base.Nrap[j] > 0 &&
|
if (RightState.base.Nrap[j] > 0 &&
|
||||||
(RightState.lambda[j][0] < -PI/2 || RightState.lambda[j][RightState.base.Nrap[j] - 1] > PI/2))
|
(RightState.lambda[j][0] < -PI/2 || RightState.lambda[j][RightState.base.Nrap[j] - 1] > PI/2))
|
||||||
rap_in_fundamental = false;
|
rap_in_fundamental = false;
|
||||||
|
|
||||||
|
@ -334,20 +336,21 @@ namespace JSC {
|
||||||
while(iKout < 0) iKout += RightState.chain.Nsites;
|
while(iKout < 0) iKout += RightState.chain.Nsites;
|
||||||
while(iKout >= RightState.chain.Nsites) iKout -= RightState.chain.Nsites;
|
while(iKout >= RightState.chain.Nsites) iKout -= RightState.chain.Nsites;
|
||||||
|
|
||||||
|
DAT_outfile << setprecision(16);
|
||||||
// Print information to fstream:
|
// Print information to fstream:
|
||||||
if (iKout >= iKmin && iKout <= iKmax) {
|
if (iKout >= iKmin && iKout <= iKmax) {
|
||||||
if (whichDSF == 'Z') {
|
if (whichDSF == 'Z') {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << setprecision(16) << LeftState.E - RightState.E - (LeftState.base.Mdown - RightState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< setprecision(3) << LeftState.dev << "\t"
|
<< setprecision(3) << LeftState.dev << "\t"
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,11 @@ using namespace JSC;
|
||||||
|
|
||||||
namespace JSC {
|
namespace JSC {
|
||||||
|
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, LiebLin_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, LiebLin_Bethe_State& LeftState,
|
||||||
// LiebLin_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile)
|
// 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,
|
//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)
|
// 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,
|
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)
|
LiebLin_Bethe_State& RefState, DP Chem_Pot, stringstream& DAT_outfile)
|
||||||
{
|
{
|
||||||
// This function prints the matrix element information to the fstream,
|
// This function prints the matrix element information to the fstream,
|
||||||
|
@ -45,7 +45,7 @@ namespace JSC {
|
||||||
ME = real(exp(ln_Psi_ME (LeftState, RefState)));
|
ME = real(exp(ln_Psi_ME (LeftState, RefState)));
|
||||||
else if (whichDSF == 'g')
|
else if (whichDSF == 'g')
|
||||||
ME = real(exp(ln_Psi_ME (RefState, LeftState)));
|
ME = real(exp(ln_Psi_ME (RefState, LeftState)));
|
||||||
else if (whichDSF == 'q') // geometrical quench
|
else if (whichDSF == 'q') // geometrical quench
|
||||||
//ME_CX = (LiebLin_Twisted_ln_Overlap(1.0, RefState.lambdaoc, RefState.lnnorm, LeftState));
|
//ME_CX = (LiebLin_Twisted_ln_Overlap(1.0, RefState.lambdaoc, RefState.lnnorm, LeftState));
|
||||||
//ME_CX = (LiebLin_ln_Overlap(RefState.lambdaoc, RefState.lnnorm, LeftState));
|
//ME_CX = (LiebLin_ln_Overlap(RefState.lambdaoc, RefState.lnnorm, LeftState));
|
||||||
ME_CX = LiebLin_ln_Overlap(LeftState.lambdaoc, LeftState.lnnorm, RefState);
|
ME_CX = LiebLin_ln_Overlap(LeftState.lambdaoc, LeftState.lnnorm, RefState);
|
||||||
|
@ -56,66 +56,67 @@ namespace JSC {
|
||||||
// The product is ME_CX * ME = e^{-\delta S_e} \langle \rho_{sp} | g2 (x=0) | \rho_{sp} + e \rangle
|
// The product is ME_CX * ME = e^{-\delta S_e} \langle \rho_{sp} | g2 (x=0) | \rho_{sp} + e \rangle
|
||||||
// and is the first half of the t-dep expectation value formula coming from the Quench Action formalism
|
// and is the first half of the t-dep expectation value formula coming from the Quench Action formalism
|
||||||
}
|
}
|
||||||
else if (whichDSF == 'C') { // BEC to finite c quench: overlap
|
else if (whichDSF == 'C') { // BEC to finite c quench: overlap
|
||||||
ME_CX = exp(2.0* ln_Overlap_with_BEC (LeftState)); // overlap sq part
|
ME_CX = exp(2.0* ln_Overlap_with_BEC (LeftState)); // overlap sq part
|
||||||
ME = 0.0;
|
ME = 0.0;
|
||||||
}
|
}
|
||||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||||
|
|
||||||
if (is_nan(ME)) ME = (whichDSF == 'Z') ? 1.0e+200 : 0.0;
|
if (is_nan(ME)) ME = (whichDSF == 'Z') ? 1.0e+200 : 0.0;
|
||||||
if (is_nan(norm(ME_CX))) ME_CX = -100.0;
|
if (is_nan(norm(ME_CX))) ME_CX = -100.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DAT_outfile << setprecision(16);
|
||||||
// Print information to fstream:
|
// Print information to fstream:
|
||||||
if (LeftState.iK - RefState.iK >= iKmin && LeftState.iK - RefState.iK <= iKmax) {
|
if (LeftState.iK - RefState.iK >= iKmin && LeftState.iK - RefState.iK <= iKmax) {
|
||||||
if (whichDSF == 'Z') {
|
if (whichDSF == 'Z') {
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
||||||
<< LeftState.iK - RefState.iK
|
<< LeftState.iK - RefState.iK
|
||||||
//<< "\t" << LeftState.conv
|
//<< "\t" << LeftState.conv
|
||||||
<< 0 << "\t" // This is the deviation, here always 0
|
<< 0 << "\t" // This is the deviation, here always 0
|
||||||
<< "\t" << LeftState.label;
|
<< "\t" << LeftState.label;
|
||||||
}
|
}
|
||||||
else if (whichDSF == 'q') {
|
else if (whichDSF == 'q') {
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
||||||
<< LeftState.iK - RefState.iK << "\t"
|
<< LeftState.iK - RefState.iK << "\t"
|
||||||
<< real(ME_CX) << "\t" << imag(ME_CX) - twoPI * int(imag(ME_CX)/twoPI + 1.0e-10) << "\t"
|
<< real(ME_CX) << "\t" << imag(ME_CX) - twoPI * int(imag(ME_CX)/twoPI + 1.0e-10) << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< 0 << "\t" // This is the deviation, here always 0
|
<< 0 << "\t" // This is the deviation, here always 0
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
else if (whichDSF == '1') {
|
else if (whichDSF == '1') {
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
||||||
<< LeftState.iK - RefState.iK << "\t"
|
<< LeftState.iK - RefState.iK << "\t"
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< 0 << "\t" // This is the deviation, here always 0
|
<< 0 << "\t" // This is the deviation, here always 0
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
DAT_outfile << "\t" << Momentum_Right_Excitations(LeftState) << "\t" << Momentum_Left_Excitations(LeftState);
|
DAT_outfile << "\t" << Momentum_Right_Excitations(LeftState) << "\t" << Momentum_Left_Excitations(LeftState);
|
||||||
//cout << Momentum_Right_Excitations(LeftState) << "\t" << Momentum_Left_Excitations(LeftState);
|
//cout << Momentum_Right_Excitations(LeftState) << "\t" << Momentum_Left_Excitations(LeftState);
|
||||||
}
|
}
|
||||||
else if (whichDSF == 'B') { // BEC to finite c > 0 quench; g2 (x=0)
|
else if (whichDSF == 'B') { // BEC to finite c > 0 quench; g2 (x=0)
|
||||||
if (fabs(real(ME_CX) * ME) > 1.0e-100)
|
if (fabs(real(ME_CX) * ME) > 1.0e-100)
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E << "\t"
|
||||||
<< LeftState.iK - RefState.iK << "\t"
|
<< LeftState.iK - RefState.iK << "\t"
|
||||||
<< real(ME_CX) << "\t" // the overlap is always real
|
<< real(ME_CX) << "\t" // the overlap is always real
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< 0 << "\t" // This is the deviation, here always 0 // omit this here
|
//<< 0 << "\t" // This is the deviation, here always 0 // omit this here
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
else if (whichDSF == 'C') { // BEC to finite c, overlap sq
|
else if (whichDSF == 'C') { // BEC to finite c, overlap sq
|
||||||
if (fabs(real(ME_CX)) > 1.0e-100)
|
if (fabs(real(ME_CX)) > 1.0e-100)
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E << "\t"
|
||||||
<< LeftState.iK - RefState.iK << "\t"
|
<< LeftState.iK - RefState.iK << "\t"
|
||||||
<< real(ME_CX) << "\t" // the overlap is always real
|
<< real(ME_CX) << "\t" // the overlap is always real
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< 0 << "\t" // This is the deviation, here always 0 // omit this here
|
//<< 0 << "\t" // This is the deviation, here always 0 // omit this here
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot << "\t"
|
||||||
<< LeftState.iK - RefState.iK << "\t"
|
<< LeftState.iK - RefState.iK << "\t"
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< 0 << "\t" // This is the deviation, here always 0
|
<< 0 << "\t" // This is the deviation, here always 0
|
||||||
<< LeftState.label;
|
<< LeftState.label;
|
||||||
}
|
}
|
||||||
|
@ -126,36 +127,36 @@ namespace JSC {
|
||||||
if (whichDSF == 'Z') // use 1/(1 + omega)
|
if (whichDSF == 'Z') // use 1/(1 + omega)
|
||||||
data_value = 1.0/(1.0 + LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot);
|
data_value = 1.0/(1.0 + LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot);
|
||||||
else if (whichDSF == 'd' || whichDSF == '1') {
|
else if (whichDSF == 'd' || whichDSF == '1') {
|
||||||
if (fixed_iK)
|
if (fixed_iK)
|
||||||
/*
|
/*
|
||||||
// use omega * MEsq/iK^2
|
// use omega * MEsq/iK^2
|
||||||
//data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot)
|
//data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot)
|
||||||
// MEsq/JSC::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK))
|
// MEsq/JSC::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK))
|
||||||
//: 0.0;
|
//: 0.0;
|
||||||
*/
|
*/
|
||||||
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState DEPRECATED ++G_1, USE abs_data_value
|
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState DEPRECATED ++G_1, USE abs_data_value
|
||||||
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME;
|
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME;
|
||||||
else if (!fixed_iK) // use ME if momentum in fundamental window -iK_UL <= iK <= iK_UL
|
else if (!fixed_iK) // use ME if momentum in fundamental window -iK_UL <= iK <= iK_UL
|
||||||
//data_value = abs(LeftState.iK - RefState.iK) <= RefState.Tableau[0].Ncols ? // this last nr is iK_UL
|
//data_value = abs(LeftState.iK - RefState.iK) <= RefState.Tableau[0].Ncols ? // this last nr is iK_UL
|
||||||
//MEsq : 0.0;
|
//MEsq : 0.0;
|
||||||
//data_value = (LeftState.iK - RefState.iK == 0 ? 1.0 : 2.0) * MEsq;
|
//data_value = (LeftState.iK - RefState.iK == 0 ? 1.0 : 2.0) * MEsq;
|
||||||
//data_value = ME * ME;
|
//data_value = ME * ME;
|
||||||
// use omega * MEsq/iK^2
|
// use omega * MEsq/iK^2
|
||||||
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState DEPRECATED ++G_1, USE abs_data_value
|
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState DEPRECATED ++G_1, USE abs_data_value
|
||||||
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME/JSC::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK));
|
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME/JSC::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK));
|
||||||
}
|
}
|
||||||
else if (whichDSF == 'g' || whichDSF == 'o') {
|
else if (whichDSF == 'g' || whichDSF == 'o') {
|
||||||
if (fixed_iK)
|
if (fixed_iK)
|
||||||
/*
|
/*
|
||||||
// use omega * MEsq/((k^2 - mu + 4 c N/L)/L)
|
// use omega * MEsq/((k^2 - mu + 4 c N/L)/L)
|
||||||
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot)
|
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot)
|
||||||
* MEsq/((((LeftState.K - RefState.K) * (LeftState.K - RefState.K) - Chem_Pot) + 4.0 * RefState.c_int * RefState.N/RefState.L)/RefState.L)
|
* MEsq/((((LeftState.K - RefState.K) * (LeftState.K - RefState.K) - Chem_Pot) + 4.0 * RefState.c_int * RefState.N/RefState.L)/RefState.L)
|
||||||
: 0.0;
|
: 0.0;
|
||||||
*/
|
*/
|
||||||
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState
|
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState
|
||||||
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME;
|
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME;
|
||||||
else if (!fixed_iK) { // simply use MEsq if momentum in fundamental window -iK_UL <= iK <= iK_UL
|
else if (!fixed_iK) { // simply use MEsq if momentum in fundamental window -iK_UL <= iK <= iK_UL
|
||||||
//data_value = abs(LeftState.iK - RefState.iK) <= RefState.Tableau[0].Ncols ? // this last nr is iK_UL
|
//data_value = abs(LeftState.iK - RefState.iK) <= RefState.Tableau[0].Ncols ? // this last nr is iK_UL
|
||||||
//MEsq : 0.0;
|
//MEsq : 0.0;
|
||||||
//data_value = (LeftState.iK - RefState.iK == 0 ? 1.0 : 2.0) * MEsq;
|
//data_value = (LeftState.iK - RefState.iK == 0 ? 1.0 : 2.0) * MEsq;
|
||||||
data_value = ME * ME;
|
data_value = ME * ME;
|
||||||
|
@ -165,9 +166,9 @@ namespace JSC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else if (whichDSF == 'o')
|
//else if (whichDSF == 'o')
|
||||||
//data_value = abs(LeftState.iK - RefState.iK) <= RefState.Tableau[0].Ncols ? // this last nr is iK_UL
|
//data_value = abs(LeftState.iK - RefState.iK) <= RefState.Tableau[0].Ncols ? // this last nr is iK_UL
|
||||||
//MEsq : 0.0;
|
//MEsq : 0.0;
|
||||||
else if (whichDSF == 'q')
|
else if (whichDSF == 'q')
|
||||||
data_value = exp(2.0 * real(ME_CX));
|
data_value = exp(2.0 * real(ME_CX));
|
||||||
else if (whichDSF == 'B')
|
else if (whichDSF == 'B')
|
||||||
data_value = abs(ME_CX * ME)/(1.0 + sqrt(fabs(LeftState.E - RefState.E)));
|
data_value = abs(ME_CX * ME)/(1.0 + sqrt(fabs(LeftState.E - RefState.E)));
|
||||||
|
|
|
@ -20,9 +20,9 @@ using namespace JSC;
|
||||||
|
|
||||||
namespace JSC {
|
namespace JSC {
|
||||||
|
|
||||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, ODSLF_XXZ_Bethe_State& LeftState,
|
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, ODSLF_XXZ_Bethe_State& LeftState,
|
||||||
//ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile)
|
//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,
|
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)
|
ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile)
|
||||||
{
|
{
|
||||||
// This function prints the matrix element information to the fstream,
|
// This function prints the matrix element information to the fstream,
|
||||||
|
@ -55,19 +55,20 @@ namespace JSC {
|
||||||
while(iKout < 0) iKout += RefState.chain.Nsites;
|
while(iKout < 0) iKout += RefState.chain.Nsites;
|
||||||
while(iKout >= RefState.chain.Nsites) iKout -= RefState.chain.Nsites;
|
while(iKout >= RefState.chain.Nsites) iKout -= RefState.chain.Nsites;
|
||||||
|
|
||||||
|
DAT_outfile << setprecision(16);
|
||||||
// Print information to fstream:
|
// Print information to fstream:
|
||||||
if (iKout >= iKmin && iKout <= iKmax) {
|
if (iKout >= iKmin && iKout <= iKmax) {
|
||||||
if (whichDSF == 'Z') {
|
if (whichDSF == 'Z') {
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< LeftState.base_id << "\t" << LeftState.type_id << "\t" << LeftState.id;
|
<< LeftState.base_id << "\t" << LeftState.type_id << "\t" << LeftState.id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot << "\t"
|
DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot << "\t"
|
||||||
<< iKout << "\t"
|
<< iKout << "\t"
|
||||||
<< ME << "\t"
|
<< ME << "\t"
|
||||||
//<< LeftState.conv << "\t"
|
//<< LeftState.conv << "\t"
|
||||||
<< LeftState.base_id << "\t" << LeftState.type_id << "\t" << LeftState.id;
|
<< LeftState.base_id << "\t" << LeftState.type_id << "\t" << LeftState.id;
|
||||||
}
|
}
|
||||||
} // if iKmin <= iKout <= iKmax
|
} // if iKmin <= iKout <= iKmax
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,466 +0,0 @@
|
||||||
/**********************************************************
|
|
||||||
|
|
||||||
This software is part of J.-S. Caux's ABACUS library.
|
|
||||||
|
|
||||||
Copyright (c).
|
|
||||||
|
|
||||||
-----------------------------------------------------------
|
|
||||||
|
|
||||||
File: Scan_Thread_List.cc
|
|
||||||
|
|
||||||
Purpose: defines all functions for Scan_Thread_List class.
|
|
||||||
|
|
||||||
|
|
||||||
***********************************************************/
|
|
||||||
|
|
||||||
#include "JSC.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace JSC;
|
|
||||||
|
|
||||||
namespace JSC {
|
|
||||||
|
|
||||||
Scan_Thread_List::Scan_Thread_List()
|
|
||||||
{
|
|
||||||
dim = 2;
|
|
||||||
nthreads_tot = 0;
|
|
||||||
nthreads_done = 0;
|
|
||||||
//omega = Vect<float>(1.0e+6, dim);
|
|
||||||
//iK = Vect_INT(0, dim);
|
|
||||||
//abs_data_value = Vect_DP (0.0, Nentries);
|
|
||||||
abs_data_value = Vect<float> (0.0, dim);
|
|
||||||
label = Vect<string> (dim);
|
|
||||||
type = Vect<int> (dim);
|
|
||||||
isdone = Vect<bool> (false, dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
Scan_Thread_List::Scan_Thread_List (int Nentries)
|
|
||||||
{
|
|
||||||
dim = Nentries;
|
|
||||||
nthreads_tot = 0;
|
|
||||||
nthreads_done = 0;
|
|
||||||
////omega = Vect_DP(1.0e+6, Nentries);
|
|
||||||
//omega = Vect<float>(1.0e+6, Nentries);
|
|
||||||
//iK = Vect_INT(0, Nentries);
|
|
||||||
//abs_data_value = Vect_DP (0.0, Nentries);
|
|
||||||
abs_data_value = Vect<float> (0.0, Nentries);
|
|
||||||
label = Vect<string> (Nentries);
|
|
||||||
type = Vect<int> (Nentries);
|
|
||||||
isdone = Vect<bool> (false, Nentries);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Scan_Thread_List::Increase_Size (int nr_to_add) // resizes the vectors to accommodate up to nr_to_add additional entries
|
|
||||||
{
|
|
||||||
dim += nr_to_add;
|
|
||||||
// Nentries stays the same
|
|
||||||
|
|
||||||
//cout << "Called Increase_Size with nr_to_add = " << nr_to_add << endl;
|
|
||||||
try {
|
|
||||||
//omega.Increase_Size (nr_to_add);
|
|
||||||
//iK.Increase_Size (nr_to_add);
|
|
||||||
abs_data_value.Increase_Size (nr_to_add);
|
|
||||||
//cout << "Increasing size of label" << endl;
|
|
||||||
label.Increase_Size (nr_to_add, "");
|
|
||||||
//cout << "Done increasing size of label" << endl;
|
|
||||||
type.Increase_Size (nr_to_add);
|
|
||||||
isdone.Increase_Size (nr_to_add, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (bad_alloc) {
|
|
||||||
cout << "dim " << dim << "\tnr_to_add " << nr_to_add << endl;
|
|
||||||
JSCerror("Memory allocation failed in Scan_Thread_List::Increase_Size.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//void Scan_Thread_List::Include_Thread (DP omega_ref, int iK_ref, DP abs_data_value_ref, string label_ref, int type_ref)
|
|
||||||
void Scan_Thread_List::Include_Thread (DP data_value_ref, string label_ref, int type_ref)
|
|
||||||
{
|
|
||||||
if (nthreads_tot > dim - 10) { // Resize the Scan_Thread_List, by doubling its size
|
|
||||||
//cout << "Resizing threads list" << endl;
|
|
||||||
(*this).Increase_Size (dim);
|
|
||||||
//cout << "Done resizing" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//cout << "Including thread for label " << label_ref << " and type " << type_ref << endl;
|
|
||||||
|
|
||||||
//omega[nthreads] = omega_ref;
|
|
||||||
//iK[nthreads] = iK_ref;
|
|
||||||
abs_data_value[nthreads_tot] = abs(data_value_ref);
|
|
||||||
label[nthreads_tot] = label_ref;
|
|
||||||
type[nthreads_tot] = type_ref;
|
|
||||||
isdone[nthreads_tot] = false;
|
|
||||||
|
|
||||||
nthreads_tot++;
|
|
||||||
|
|
||||||
if (nthreads_tot >= dim) {
|
|
||||||
(*this).Save("Threads_stopped.thr");
|
|
||||||
JSCerror("nthreads_tot >= dim in Scan_Thread_List.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_List::Order_in_abs_data_value ()
|
|
||||||
{
|
|
||||||
// Reorders all entries in decreasing order in abs_data_value
|
|
||||||
|
|
||||||
if (nthreads_tot > 1) {
|
|
||||||
|
|
||||||
Vect_INT index(dim);
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i) index[i] = i;
|
|
||||||
|
|
||||||
abs_data_value.QuickSort(index, 0, nthreads_tot - 1);
|
|
||||||
|
|
||||||
////Vect_DP omega_ordered(nthreads);
|
|
||||||
//Vect<float> omega_ordered(nthreads);
|
|
||||||
//Vect_INT iK_ordered(nthreads);
|
|
||||||
//Vect_DP abs_data_value_ordered(nthreads);
|
|
||||||
Vect<float> abs_data_value_ordered(nthreads_tot);
|
|
||||||
Vect<string> label_ordered(nthreads_tot);
|
|
||||||
Vect<int> type_ordered(nthreads_tot);
|
|
||||||
Vect<bool> isdone_ordered(nthreads_tot);
|
|
||||||
|
|
||||||
// Put data in proper order
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i) {
|
|
||||||
//omega_ordered[i] = omega[index[nthreads - 1 - i] ];
|
|
||||||
//iK_ordered[i] = iK[index[nthreads - 1 - i] ];
|
|
||||||
abs_data_value_ordered[i] = abs_data_value[nthreads_tot - 1 - i];
|
|
||||||
label_ordered[i] = label[index[nthreads_tot - 1 - i] ];
|
|
||||||
type_ordered[i] = type[index[nthreads_tot - 1 - i] ];
|
|
||||||
//sector_lowest_raisable_ordered[i] = sector_lowest_raisable[index[nthreads - 1 - i] ];
|
|
||||||
isdone_ordered[i] = isdone[index[nthreads_tot - 1 - i] ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put back in *this object:
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i) {
|
|
||||||
//omega[i] = omega_ordered[i];
|
|
||||||
//iK[i] = iK_ordered[i];
|
|
||||||
abs_data_value[i] = abs_data_value_ordered[i];
|
|
||||||
label[i] = label_ordered[i];
|
|
||||||
type[i] = type_ordered[i];
|
|
||||||
isdone[i] = isdone_ordered[i];
|
|
||||||
} // The rest are all simply 0.
|
|
||||||
|
|
||||||
// Done !
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
void Scan_Thread_List::Order_in_omega ()
|
|
||||||
{
|
|
||||||
// Reorders all entries in increasing order in omega
|
|
||||||
|
|
||||||
if (nthreads > 1) {
|
|
||||||
|
|
||||||
Vect_INT index(0, dim);
|
|
||||||
for (int i = 0; i < nthreads; ++i) index[i] = i;
|
|
||||||
|
|
||||||
omega.QuickSort(index, 0, nthreads - 1);
|
|
||||||
|
|
||||||
//Vect_DP omega_ordered(nthreads);
|
|
||||||
Vect<float> omega_ordered(nthreads);
|
|
||||||
Vect_INT iK_ordered(nthreads);
|
|
||||||
//Vect_DP abs_data_value_ordered(nthreads);
|
|
||||||
Vect<float> abs_data_value_ordered(nthreads);
|
|
||||||
Vect<string> label_ordered(nthreads);
|
|
||||||
Vect<int> type_ordered(nthreads);
|
|
||||||
|
|
||||||
// Put data in proper order
|
|
||||||
for (int i = 0; i < nthreads; ++i) {
|
|
||||||
omega_ordered[i] = omega[i];
|
|
||||||
iK_ordered[i] = iK[index[i] ];
|
|
||||||
abs_data_value_ordered[i] = abs_data_value[index[i] ];
|
|
||||||
label_ordered[i] = label[index[i] ];
|
|
||||||
type_ordered[i] = type[index[i] ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put back in *this object:
|
|
||||||
for (int i = 0; i < nthreads; ++i) {
|
|
||||||
omega[i] = omega_ordered[i];
|
|
||||||
iK[i] = iK_ordered[i];
|
|
||||||
abs_data_value[i] = abs_data_value_ordered[i];
|
|
||||||
label[i] = label_ordered[i];
|
|
||||||
type[i] = type_ordered[i];
|
|
||||||
} // The rest are all simply 0.
|
|
||||||
|
|
||||||
// Done !
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
DP Scan_Thread_List::Highest_abs_data_value_ordered (DP omega_MIN, DP omega_MAX) // returns highest abs_data_value in window omega_MIN to omega_MAX
|
|
||||||
{
|
|
||||||
// Assume that the threads have been Order_in_abs_data_value
|
|
||||||
for (int i = 0; i < nthreads; ++i)
|
|
||||||
if (omega[i] > omega_MIN && omega[i] < omega_MAX) return(abs_data_value[i]);
|
|
||||||
|
|
||||||
return(0.0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//DP Scan_Thread_List::Highest_abs_data_value (DP omega_MIN, DP omega_MAX) // returns highest abs_data_value in window omega_MIN to omega_MAX
|
|
||||||
DP Scan_Thread_List::Highest_abs_data_value () // returns highest abs_data_value
|
|
||||||
{
|
|
||||||
// Works even if list is not ordered
|
|
||||||
DP maxdatavalue = 0.0;
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i)
|
|
||||||
//if (omega[i] > omega_MIN && omega[i] < omega_MAX && abs_data_value[i] > maxdatavalue)
|
|
||||||
if (!isdone[i] && (abs_data_value[i] > maxdatavalue))
|
|
||||||
maxdatavalue = abs_data_value[i];
|
|
||||||
|
|
||||||
return(maxdatavalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
DP Scan_Thread_List::kth_highest_abs_data_value (int k) // returns the k-th highest abs_data_value in window omega_MIN to omega_MAX
|
|
||||||
{
|
|
||||||
// Works even if list is not ordered
|
|
||||||
if (k < 1) JSCerror("Give k > 1 in Scan_Thread_List::kth_Highest_abs_data_value.");
|
|
||||||
else if (k == 1 || k >= nthreads_tot) // Threads list not long enough, return the top one
|
|
||||||
//return ((*this).Highest_abs_data_value (-1.0e+10, 1.0e+10));
|
|
||||||
return ((*this).Highest_abs_data_value ());
|
|
||||||
|
|
||||||
Vect<DP> topk (0.0, k);
|
|
||||||
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i)
|
|
||||||
if (!isdone[i] && (abs_data_value[i] > topk[0])) {
|
|
||||||
topk[0] = abs_data_value[i];
|
|
||||||
topk.QuickSort(0, k-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(topk[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Scan_Thread_List::Exists_data_value_greater_than (DP value)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i)
|
|
||||||
if (abs_data_value[i] > value) return(true);
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
DP Scan_Thread_List::Lowest_omega () // returns lowest omega
|
|
||||||
{
|
|
||||||
// Assume that the threads have been Order_in_omega
|
|
||||||
return(omega[0]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void Scan_Thread_List::Merge (const Scan_Thread_List& reflist)
|
|
||||||
{
|
|
||||||
if (nthreads_tot + reflist.nthreads_tot >= dim) // JSCerror("Scan_Threads_List: too big to merge.");
|
|
||||||
//(*this).Increase_Size (reflist.nthreads);
|
|
||||||
(*this).Increase_Size (nthreads_tot/10 + reflist.nthreads_tot);
|
|
||||||
|
|
||||||
for (int i = 0; i < reflist.nthreads_tot; ++i) {
|
|
||||||
//omega[nthreads] = reflist.omega[i];
|
|
||||||
//iK[nthreads] = reflist.iK[i];
|
|
||||||
abs_data_value[nthreads_tot] = reflist.abs_data_value[i];
|
|
||||||
label[nthreads_tot] = reflist.label[i];
|
|
||||||
type[nthreads_tot] = reflist.type[i];
|
|
||||||
isdone[nthreads_tot] = reflist.isdone[i];
|
|
||||||
nthreads_tot++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* // DEACTIVATED IN ABACUS++G_2
|
|
||||||
void Scan_Thread_List::Remove_Threads (int ithread_down, int ithread_up)
|
|
||||||
{
|
|
||||||
if (ithread_down < 0 || ithread_up > nthreads) {
|
|
||||||
JSCerror("Trying to remove inexistent entries in Remove_Threads.");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < nthreads - ithread_up - 1; ++i) {
|
|
||||||
//omega[ithread_down + i] = omega[ithread_up + i + 1];
|
|
||||||
//iK[ithread_down + i] = iK[ithread_up + 1 + i];
|
|
||||||
abs_data_value[ithread_down + i] = abs_data_value[ithread_up + i + 1];
|
|
||||||
label[ithread_down + i] = label[ithread_up + i + 1];
|
|
||||||
type[ithread_down + i] = type[ithread_up + i + 1];
|
|
||||||
}
|
|
||||||
// Zero the other entries:
|
|
||||||
for (int i = nthreads - ithread_up - 1; i < nthreads; ++i) {
|
|
||||||
//omega[i] = 1.0e+6;
|
|
||||||
//iK[i] = 0;
|
|
||||||
abs_data_value[i] = 0.0;//-1.0e-30; // give a small negative value, so these are put at the very bottom of the list
|
|
||||||
label[i] = "";
|
|
||||||
type[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nthreads -= ithread_up - ithread_down + 1; // removed that many entries.
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* // DEACTIVATED IN ABACUS++G_2
|
|
||||||
int Scan_Thread_List::Remove_Threads (const Vect<bool>& threads_done)
|
|
||||||
{
|
|
||||||
// If threads_done[ithread] == true, remove from list
|
|
||||||
|
|
||||||
if (threads_done.size() != nthreads) JSCerror("Wrong size boolean vector in Scan_Thread_List::Remove_Threads.");
|
|
||||||
|
|
||||||
int nr_removed = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < nthreads; ++i) {
|
|
||||||
if (!threads_done[i]) {
|
|
||||||
//omega[i - nr_removed] = omega[i];
|
|
||||||
//iK[i - nr_removed] = iK[i];
|
|
||||||
abs_data_value[i - nr_removed] = abs_data_value[i];
|
|
||||||
label[i - nr_removed] = label[i];
|
|
||||||
type[i - nr_removed] = type[i];
|
|
||||||
|
|
||||||
}
|
|
||||||
else nr_removed++;
|
|
||||||
}
|
|
||||||
// Zero other entries:
|
|
||||||
for (int i = nthreads - nr_removed; i < nthreads; ++i) {
|
|
||||||
//omega[i] = 1.0e+6;
|
|
||||||
//iK[i] = 0;
|
|
||||||
abs_data_value[i] = 0.0;
|
|
||||||
label[i] = "";
|
|
||||||
type[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nthreads -= nr_removed;
|
|
||||||
|
|
||||||
return(nr_removed);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Scan_Thread_List::Remove_Done_Threads ()
|
|
||||||
{
|
|
||||||
// If isdone[ithread] == true, remove from list
|
|
||||||
|
|
||||||
int nr_removed = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < nthreads_tot; ++i) {
|
|
||||||
if (!isdone[i]) {
|
|
||||||
//omega[i - nr_removed] = omega[i];
|
|
||||||
//iK[i - nr_removed] = iK[i];
|
|
||||||
abs_data_value[i - nr_removed] = abs_data_value[i];
|
|
||||||
label[i - nr_removed] = label[i];
|
|
||||||
type[i - nr_removed] = type[i];
|
|
||||||
isdone[i - nr_removed] = isdone[i];
|
|
||||||
}
|
|
||||||
else nr_removed++;
|
|
||||||
}
|
|
||||||
// Zero other entries:
|
|
||||||
for (int i = nthreads_tot - nr_removed; i < nthreads_tot; ++i) {
|
|
||||||
//omega[i] = 1.0e+6;
|
|
||||||
//iK[i] = 0;
|
|
||||||
abs_data_value[i] = 0.0;
|
|
||||||
label[i] = "";
|
|
||||||
type[i] = 0;
|
|
||||||
isdone[i] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nthreads_tot -= nr_removed;
|
|
||||||
if (nthreads_done != nr_removed) {
|
|
||||||
cout << nthreads_done << "\t" << nr_removed << endl;
|
|
||||||
JSCerror("Miscount in removing threads during Remove_Done_Threads.");
|
|
||||||
}
|
|
||||||
nthreads_done = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_List::Clear ()
|
|
||||||
{
|
|
||||||
// dim is preserved
|
|
||||||
|
|
||||||
nthreads_tot = 0;
|
|
||||||
nthreads_done = 0;
|
|
||||||
////omega = Vect_DP(0.0, dim);
|
|
||||||
//omega = Vect<float> (1.0e+6, dim);
|
|
||||||
//iK = Vect_INT(0, dim);
|
|
||||||
//abs_data_value = Vect_DP (0.0, dim);
|
|
||||||
abs_data_value = Vect<float> (0.0, dim);
|
|
||||||
label = Vect<string> (dim);
|
|
||||||
type = Vect<int> (dim);
|
|
||||||
isdone = Vect<bool> (false, dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_List::Save(const char* outfile_Cstr)
|
|
||||||
{
|
|
||||||
// We save only the undone threads, so after cleanup.
|
|
||||||
(*this).Remove_Done_Threads();
|
|
||||||
|
|
||||||
ofstream outfile;
|
|
||||||
|
|
||||||
outfile.open(outfile_Cstr);
|
|
||||||
if (outfile.fail()) JSCerror("Could not open outfile... ");
|
|
||||||
outfile.precision(3);
|
|
||||||
|
|
||||||
if (nthreads_tot > 0) {
|
|
||||||
//outfile << omega[0] << "\t" << iK[0] << "\t" << abs_data_value[0] << "\t" << label[0] << "\t" << type[0];
|
|
||||||
outfile << abs_data_value[0] << "\t" << label[0] << "\t" << type[0];
|
|
||||||
for (int i = 1; i < nthreads_tot; ++i) {
|
|
||||||
//outfile << endl << omega[i] << "\t" << iK[i] << "\t" << abs_data_value[i] << "\t" << label[i] << "\t" << type[i];
|
|
||||||
outfile << endl << abs_data_value[i] << "\t" << label[i] << "\t" << type[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outfile.close();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_List::Load (const char* thrfile_Cstr)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
// Check that the data fits within limits:
|
|
||||||
struct stat statbuf;
|
|
||||||
|
|
||||||
stat (thrfile_Cstr, &statbuf);
|
|
||||||
int filesize = statbuf.st_size;
|
|
||||||
|
|
||||||
// Determine the number of entries approximately
|
|
||||||
// Don't overestimate entry_size: pretend label takes no space...
|
|
||||||
int entry_size = 2* sizeof(float) + sizeof(int);
|
|
||||||
|
|
||||||
int estimate_nr_entries = filesize/entry_size;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Get number of lines in the file:
|
|
||||||
int nrlines = 0;
|
|
||||||
ifstream infile1(thrfile_Cstr);
|
|
||||||
if(infile1.fail()) {
|
|
||||||
cout << "Could not open file " << thrfile_Cstr << " in Scan_Thread_List::Load." << endl;
|
|
||||||
JSCerror("Terminating.");
|
|
||||||
}
|
|
||||||
string dummy;
|
|
||||||
while (getline(infile1, dummy)) ++nrlines;
|
|
||||||
infile1.close();
|
|
||||||
|
|
||||||
int estimate_nr_entries = JSC::max(10, (11*nrlines)/10);
|
|
||||||
|
|
||||||
if (estimate_nr_entries > dim) {
|
|
||||||
(*this).Increase_Size (estimate_nr_entries - dim/2); // give dim/2 safety
|
|
||||||
}
|
|
||||||
|
|
||||||
ifstream infile;
|
|
||||||
infile.open(thrfile_Cstr);
|
|
||||||
if(infile.fail()) {
|
|
||||||
cout << "Could not open file " << thrfile_Cstr << " in Scan_Thread_List::Load." << endl;
|
|
||||||
JSCerror("Terminating.");
|
|
||||||
}
|
|
||||||
|
|
||||||
(*this).Clear();
|
|
||||||
|
|
||||||
DP abs_data_value_DP;
|
|
||||||
while (infile.peek() != EOF) {
|
|
||||||
//infile >> omega[nthreads];
|
|
||||||
//infile >> iK[nthreads];
|
|
||||||
//infile >> abs_data_value[nthreads]; // nasty bug: reading into float bugs when value less or more than float limits
|
|
||||||
infile >> abs_data_value_DP; // cure: first read into double, then cast to float:
|
|
||||||
abs_data_value[nthreads_tot] = float(abs_data_value_DP);
|
|
||||||
infile >> label[nthreads_tot];
|
|
||||||
infile >> type[nthreads_tot];
|
|
||||||
isdone[nthreads_tot] = false;
|
|
||||||
nthreads_tot++;
|
|
||||||
if (nthreads_tot >= dim) {
|
|
||||||
cout << "file " << thrfile_Cstr << endl << "estimate_nr_entries = " << estimate_nr_entries << "\tnrlines = " << nrlines << endl << "nthreads_tot = " << nthreads_tot << "\tdim = " << dim << endl;
|
|
||||||
JSCerror("Too many threads in input file.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
infile.close();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace JSC
|
|
|
@ -1,254 +0,0 @@
|
||||||
/**********************************************************
|
|
||||||
|
|
||||||
This software is part of J.-S. Caux's ABACUS library.
|
|
||||||
|
|
||||||
Copyright (c).
|
|
||||||
|
|
||||||
-----------------------------------------------------------
|
|
||||||
|
|
||||||
File: Scan_Thread_Set.cc
|
|
||||||
|
|
||||||
Purpose: defines all functions for Scan_Thread_Set class.
|
|
||||||
|
|
||||||
|
|
||||||
***********************************************************/
|
|
||||||
|
|
||||||
#include "JSC.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace JSC;
|
|
||||||
|
|
||||||
namespace JSC {
|
|
||||||
|
|
||||||
Scan_Thread_Set::Scan_Thread_Set()
|
|
||||||
{
|
|
||||||
dim = Vect<int> (nlists);
|
|
||||||
nthreads_tot = Vect<int> (nlists);
|
|
||||||
nthreads_done = Vect<int> (nlists);
|
|
||||||
|
|
||||||
label = Vect<Vect<string> > (nlists);
|
|
||||||
type = Vect<Vect<int> > (nlists);
|
|
||||||
isdone = Vect<Vect<bool> > (nlists);
|
|
||||||
|
|
||||||
|
|
||||||
// Give starting values to all:
|
|
||||||
for (int il = 0; il < nlists; ++il) {
|
|
||||||
dim[il] = 100;
|
|
||||||
nthreads_tot[il] = 0;
|
|
||||||
nthreads_done[il] = 0;
|
|
||||||
label[il] = Vect<string> (dim[il]);
|
|
||||||
type[il] = Vect<int> (dim[il]);
|
|
||||||
isdone[il] = Vect<bool> (false, dim[il]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Scan_Thread_Set::Increase_Size (int il, int nr_to_add) // resizes the vectors to accommodate up to nr_to_add additional entries
|
|
||||||
{
|
|
||||||
if (il < 0 || il > nlists) JSCerror("ilist out of bounds in Scan_Thread_Set::Increase_Size");
|
|
||||||
|
|
||||||
dim[il] += nr_to_add;
|
|
||||||
|
|
||||||
try {
|
|
||||||
label[il].Increase_Size (nr_to_add, "");
|
|
||||||
type[il].Increase_Size (nr_to_add);
|
|
||||||
isdone[il].Increase_Size (nr_to_add, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (bad_alloc) {
|
|
||||||
cout << "dim[il] " << dim[il] << "\tnr_to_add " << nr_to_add << endl;
|
|
||||||
JSCerror("Memory allocation failed in Scan_Thread_Set::Increase_Size.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Include_Thread (DP abs_data_value_ref, string label_ref, int type_ref)
|
|
||||||
{
|
|
||||||
// Determine which ilist index is to be used:
|
|
||||||
int il = int(-log(abs_data_value_ref)/logscale);
|
|
||||||
if (il < 0) il = 0;
|
|
||||||
if (il >= nlists) il = nlists - 1;
|
|
||||||
|
|
||||||
if (nthreads_tot[il] > dim[il] - 10) { // Resize the Scan_Thread_Set list, by doubling its size
|
|
||||||
//cout << "Resizing threads list" << endl;
|
|
||||||
(*this).Increase_Size (il, dim[il]);
|
|
||||||
//cout << "Done resizing" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//cout << "Including thread for label " << label_ref << " and type " << type_ref << endl;
|
|
||||||
|
|
||||||
label[il][nthreads_tot[il] ] = label_ref;
|
|
||||||
type[il][nthreads_tot[il] ] = type_ref;
|
|
||||||
isdone[il][nthreads_tot[il] ] = false;
|
|
||||||
|
|
||||||
nthreads_tot[il]++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Merge (const Scan_Thread_Set& refset)
|
|
||||||
{
|
|
||||||
if (nlists != refset.nlists) JSCerror("nlists don't match in Scan_Thread_Set::Merge");
|
|
||||||
|
|
||||||
for (int il = 0; il < nlists; ++il) {
|
|
||||||
|
|
||||||
if (nthreads_tot[il] + refset.nthreads_tot[il] >= dim[il])
|
|
||||||
(*this).Increase_Size (il, nthreads_tot[il]/10 + refset.nthreads_tot[il]);
|
|
||||||
|
|
||||||
for (int i = 0; i < refset.nthreads_tot[il]; ++i) {
|
|
||||||
label[il][nthreads_tot[il] ] = refset.label[il][i];
|
|
||||||
type[il][nthreads_tot[il] ] = refset.type[il][i];
|
|
||||||
isdone[il][nthreads_tot[il] ] = refset.isdone[il][i];
|
|
||||||
nthreads_tot[il]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Remove_Done_Threads (int il)
|
|
||||||
{
|
|
||||||
// If isdone[ithread] == true, remove from list
|
|
||||||
|
|
||||||
int nr_removed = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < nthreads_tot[il]; ++i) {
|
|
||||||
if (!isdone[il][i]) {
|
|
||||||
label[il][i - nr_removed] = label[il][i];
|
|
||||||
type[il][i - nr_removed] = type[il][i];
|
|
||||||
isdone[il][i - nr_removed] = isdone[il][i];
|
|
||||||
}
|
|
||||||
else nr_removed++;
|
|
||||||
}
|
|
||||||
// Zero other entries:
|
|
||||||
for (int i = nthreads_tot[il] - nr_removed; i < nthreads_tot[il]; ++i) {
|
|
||||||
label[il][i] = "";
|
|
||||||
type[il][i] = 0;
|
|
||||||
isdone[il][i] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nthreads_tot[il] -= nr_removed;
|
|
||||||
if (nthreads_done[il] != nr_removed) {
|
|
||||||
cout << nthreads_done[il] << "\t" << nr_removed << endl;
|
|
||||||
JSCerror("Miscount in removing threads during Scan_Thread_Set::Remove_Done_Threads.");
|
|
||||||
}
|
|
||||||
nthreads_done[il] = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Remove_Done_Threads ()
|
|
||||||
{
|
|
||||||
// If isdone[ithread] == true, remove from list
|
|
||||||
|
|
||||||
for (int il = 0; il < nlists; ++il)
|
|
||||||
(*this).Remove_Done_Threads(il);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Clear ()
|
|
||||||
{
|
|
||||||
for (int il = 0; il < nlists; ++il) {
|
|
||||||
|
|
||||||
nthreads_tot[il] = 0;
|
|
||||||
nthreads_done[il] = 0;
|
|
||||||
label[il] = Vect<string> (dim[il]);
|
|
||||||
type[il] = Vect<int> (dim[il]);
|
|
||||||
isdone[il] = Vect<bool> (false, dim[il]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Save(const char* outfile_Cstr)
|
|
||||||
{
|
|
||||||
// We save only the undone threads, so after cleanup.
|
|
||||||
(*this).Remove_Done_Threads();
|
|
||||||
|
|
||||||
ofstream outfile;
|
|
||||||
|
|
||||||
outfile.open(outfile_Cstr);
|
|
||||||
if (outfile.fail()) JSCerror("Could not open outfile... ");
|
|
||||||
outfile.precision(3);
|
|
||||||
|
|
||||||
//cout << "Saving threads: nthreads_tot vector is" << endl;
|
|
||||||
//for (int il = 0; il < nlists; ++il)
|
|
||||||
//if (nthreads_tot[il] > 0) cout << il << "\t" << nthreads_tot[il] << "\t";
|
|
||||||
//cout << endl;
|
|
||||||
|
|
||||||
bool started = false;
|
|
||||||
for (int il = 0; il < nlists; ++il) {
|
|
||||||
|
|
||||||
if (nthreads_tot[il] > 0) {
|
|
||||||
if (started) outfile << endl;
|
|
||||||
outfile << il << "\t" << label[il][0] << "\t" << type[il][0];
|
|
||||||
started = true;
|
|
||||||
for (int i = 1; i < nthreads_tot[il]; ++i) {
|
|
||||||
outfile << endl << il << "\t" << label[il][i] << "\t" << type[il][i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outfile.close();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scan_Thread_Set::Load (const char* thrfile_Cstr)
|
|
||||||
{
|
|
||||||
ifstream infile;
|
|
||||||
infile.open(thrfile_Cstr);
|
|
||||||
if(infile.fail()) {
|
|
||||||
cout << "Could not open file " << thrfile_Cstr << " in Scan_Thread_Set::Load." << endl;
|
|
||||||
JSCerror("Terminating.");
|
|
||||||
}
|
|
||||||
|
|
||||||
(*this).Clear();
|
|
||||||
|
|
||||||
// First count the number of elements in each list:
|
|
||||||
Vect<int> nthreads_read(0, nlists);
|
|
||||||
int il_read;
|
|
||||||
string label_read;
|
|
||||||
int type_read;
|
|
||||||
|
|
||||||
while (infile.peek() != EOF) {
|
|
||||||
infile >> il_read;
|
|
||||||
infile >> label_read;
|
|
||||||
infile >> type_read;
|
|
||||||
nthreads_read[il_read]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
infile.close();
|
|
||||||
|
|
||||||
//cout << "nthreads_read vector: " << endl;
|
|
||||||
//for (int il = 0; il < nlists; ++il)
|
|
||||||
//if (nthreads_read[il] > 0) cout << il << "\t" << nthreads_read[il] << "\t";
|
|
||||||
//cout << endl;
|
|
||||||
|
|
||||||
// Now allocate the proper sizes:
|
|
||||||
for (int il = 0; il < nlists; ++il) {
|
|
||||||
(*this).Increase_Size (il, JSC::max(0, nthreads_read[il] - dim[il] + 10));
|
|
||||||
nthreads_read[il] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read threads data in:
|
|
||||||
ifstream infile2;
|
|
||||||
infile2.open(thrfile_Cstr);
|
|
||||||
infile.seekg(0);
|
|
||||||
while (infile2.peek() != EOF) {
|
|
||||||
infile2 >> il_read;
|
|
||||||
infile2 >> label[il_read][nthreads_read[il_read] ];
|
|
||||||
infile2 >> type[il_read][nthreads_read[il_read] ];
|
|
||||||
//isdone[il_read][nthreads_read[il_read] ] = false; // no need
|
|
||||||
nthreads_tot[il_read]++;
|
|
||||||
nthreads_read[il_read]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
infile2.close();
|
|
||||||
|
|
||||||
//cout << "Loading threads: nthreads_tot vector is" << endl;
|
|
||||||
//for (int il = 0; il < nlists; ++il)
|
|
||||||
//if (nthreads_tot[il] > 0) cout << il << "\t" << nthreads_tot[il] << "\t";
|
|
||||||
//cout << endl;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace JSC
|
|
Loading…
Reference in New Issue