136 lines
5.0 KiB
C++
136 lines
5.0 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS library.
|
|
|
|
Copyright (c) J.-S. Caux.
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: Heis_DSF_GeneralState.cc
|
|
|
|
Purpose: main function for ABACUS for Heisenberg spin-1/2 chain
|
|
|
|
***********************************************************/
|
|
|
|
#include "ABACUS.h"
|
|
|
|
using namespace std;
|
|
using namespace ABACUS;
|
|
|
|
|
|
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 << "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;
|
|
cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
|
|
cout << "int N \t\t\t Length (number of sites) of the system: "
|
|
"use positive even integer values only" << endl;
|
|
cout << "int M \t\t\t Number of down spins: use positive integer values between 1 and N/2" << endl;
|
|
cout << "char* defaultScanStatename:\t\t file [].Ix2 contains the quantum numbers "
|
|
"defining the AveragingState; used as defaultScanStatename" << endl;
|
|
cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
|
|
cout << "DP target_sumrule \t sumrule saturation you're satisfied with" << endl;
|
|
cout << "bool refine \t\t Is this a refinement of a earlier calculations ? (0 == false, 1 == true)" << endl;
|
|
cout << endl << "EXAMPLE: " << endl << endl;
|
|
}
|
|
|
|
else if (argc == 9) { // !fixed_iK
|
|
int ctr = 1;
|
|
char whichDSF = *argv[ctr++];
|
|
DP Delta = atof(argv[ctr++]);
|
|
int N = atoi(argv[ctr++]);
|
|
int M = atoi(argv[ctr++]);
|
|
char* Ix2filenameprefix = argv[ctr++];
|
|
int Max_Secs = atoi(argv[ctr++]);
|
|
DP target_sumrule = atof(argv[ctr++]);
|
|
bool refine = (atoi(argv[ctr++]) == 1);
|
|
|
|
// We systematically scan over all momentum integers (to avoid problems with Brillouin folding
|
|
int iKmin = -1000*N;
|
|
int iKmax = 1000*N;
|
|
|
|
// Read the Ix2 from the file:
|
|
// Format is:
|
|
// base_level, Nrap[base_level], \endl Ix2[base_level], repeat for all occupied base_levels...
|
|
ifstream Ix2_input_file;
|
|
stringstream filenamestrstream;
|
|
filenamestrstream << Ix2filenameprefix;
|
|
string defaultScanStatename = filenamestrstream.str();
|
|
filenamestrstream << ".Ix2";
|
|
string filenamestr = filenamestrstream.str();
|
|
const char* filename_Cstr = filenamestr.c_str();
|
|
Ix2_input_file.open(filename_Cstr);
|
|
if (Ix2_input_file.fail()) {
|
|
cout << filename_Cstr << endl;
|
|
ABACUSerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
|
|
}
|
|
|
|
Heis_Chain chain(1.0, Delta, 0.0, N);
|
|
|
|
Vect<int> Nrap_read (0, chain.Nstrings);
|
|
int level = 0;
|
|
Vect<Vect<int> > Ix2_read (chain.Nstrings);
|
|
do {
|
|
Ix2_input_file >> level;
|
|
Ix2_input_file >> Nrap_read[level];
|
|
Ix2_read[level] = Vect<int> (Nrap_read[level]);
|
|
for (int alpha = 0; alpha < Nrap_read[level]; ++alpha) Ix2_input_file >> Ix2_read[level][alpha];
|
|
} while (Ix2_input_file.peek() != EOF);
|
|
|
|
// Construct the Averaging State:
|
|
Heis_Base base (chain, Nrap_read);
|
|
|
|
int paralevel = 0;
|
|
Vect<int> rank; // dummy
|
|
Vect<int> nr_processors; // dummy
|
|
|
|
if (Delta > 0.0 && Delta < 1.0) {
|
|
XXZ_Bethe_State AveragingState (chain, base);
|
|
for (int il = 0; il < chain.Nstrings; ++il) {
|
|
if (Nrap_read[il] > 0) for (int alpha = 0; alpha < Nrap_read[il]; ++alpha)
|
|
AveragingState.Ix2[il][alpha] = Ix2_read[il][alpha];
|
|
}
|
|
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);
|
|
}
|
|
else if (Delta == 1.0) {
|
|
XXX_Bethe_State AveragingState (chain, base);
|
|
for (int il = 0; il < chain.Nstrings; ++il) {
|
|
for (int alpha = 0; alpha < Nrap_read[il]; ++alpha)
|
|
AveragingState.Ix2[il][alpha] = Ix2_read[il][alpha];
|
|
}
|
|
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);
|
|
}
|
|
else if (Delta > 1.0) {
|
|
XXZ_gpd_Bethe_State AveragingState (chain, base);
|
|
for (int il = 0; il < chain.Nstrings; ++il) {
|
|
for (int alpha = 0; alpha < Nrap_read[il]; ++alpha)
|
|
AveragingState.Ix2[il][alpha] = Ix2_read[il][alpha];
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
return(0);
|
|
}
|