143 lines
6.0 KiB
C++
143 lines
6.0 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS++ library.
|
|
|
|
Copyright (c)
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: Heis_DSF.cc
|
|
|
|
Purpose: main function for ABACUS++ for Heisenberg spin-1/2 chain
|
|
|
|
***********************************************************/
|
|
|
|
#include "JSC.h"
|
|
|
|
using namespace std;
|
|
using namespace JSC;
|
|
|
|
|
|
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 << "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 << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: 0 and N" << 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;
|
|
cout << "Heis_DSF z 1.0 100 40 0 100 600 1.0 0" << endl << endl;
|
|
}
|
|
|
|
else if (argc == 8) { // !fixed_iK
|
|
int ctr = 1;
|
|
char whichDSF = *argv[ctr++];
|
|
DP Delta = atof(argv[ctr++]);
|
|
int N = atoi(argv[ctr++]);
|
|
int M = atoi(argv[ctr++]);
|
|
//int iKmin = atoi(argv[5]);
|
|
//int iKmax = atoi(argv[6]);
|
|
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;
|
|
//Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, target_sumrule, refine, 0, 1);
|
|
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, target_sumrule, refine);
|
|
}
|
|
|
|
|
|
|
|
// The argument given is the name of the standard args_Heis_DSF arguments file
|
|
|
|
/*
|
|
if (argc == 2) { // Used an input file to provide the arguments
|
|
|
|
if (strcmp(argv[1],"help") == 0) { // Output some instructions
|
|
cout << "Usage of Heis_DSF executable: " << endl;
|
|
cout << endl << "Provide arguments by either using one of the three following options:" << endl << endl;
|
|
cout << "1) via an argument file (see the template `args_Heis_DSF' in directory src/EXECS/), for example" << endl << endl;
|
|
cout << "Heis_DSF args_Heis_DSF" << endl << endl;
|
|
cout << "2) with arguments (for general momenta scan) whichDSF Delta N M iKmin iKmax Max_Secs refine, for example" << endl << endl;
|
|
cout << "Heis_DSF z 0.9 100 40 0 50 600 0" << endl << endl;
|
|
cout << "3) with arguments (for general momenta scan) whichDSF Delta N M iKneeded Max_Secs refine, for example" << endl << endl;
|
|
cout << "Heis_DSF z 0.9 100 40 20 600 0" << endl << endl;
|
|
}
|
|
|
|
else { // read argument file
|
|
|
|
ifstream argsfile;
|
|
argsfile.open(argv[1]);
|
|
if (argsfile.fail()) {
|
|
cout << argv[1] << endl;
|
|
JSCerror("Could not open arguments file.");
|
|
}
|
|
|
|
char junk[256];
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
char whichDSF; argsfile >> whichDSF;
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
DP Delta; argsfile >> Delta;
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
int N; argsfile >> N;
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
int M; argsfile >> M;
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
//bool fixed_iK; argsfile >> fixed_iK;
|
|
//while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
//int iKneeded; argsfile >> iKneeded;
|
|
int iKmin, iKmax; argsfile >> iKmin >> iKmax;
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
int Max_Secs; argsfile >> Max_Secs;
|
|
while (argsfile.peek() == '#' || argsfile.peek() == '\t' || argsfile.peek() == ' ' || argsfile.peek() == '\n') argsfile.getline(junk, 256);
|
|
bool refine; argsfile >> refine;
|
|
|
|
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, refine);
|
|
}
|
|
} // if (argc == 2)
|
|
|
|
else if (argc == 8) { // fixed_iK
|
|
char whichDSF = *argv[1];
|
|
DP Delta = atof(argv[2]);
|
|
int N = atoi(argv[3]);
|
|
int M = atoi(argv[4]);
|
|
int iKneeded = atoi(argv[5]);
|
|
int Max_Secs = atoi(argv[6]);
|
|
bool refine = (atoi(argv[7]) == 1);
|
|
|
|
//Scan_Heis (whichDSF, Delta, N, M, iKneeded, Max_Secs, refine);
|
|
Scan_Heis (whichDSF, Delta, N, M, iKneeded, iKneeded, Max_Secs, refine);
|
|
}
|
|
|
|
else if (argc == 9) { // !fixed_iK
|
|
char whichDSF = *argv[1];
|
|
DP Delta = atof(argv[2]);
|
|
int N = atoi(argv[3]);
|
|
int M = atoi(argv[4]);
|
|
int iKmin = atoi(argv[5]);
|
|
int iKmax = atoi(argv[6]);
|
|
int Max_Secs = atoi(argv[7]);
|
|
bool refine = (atoi(argv[8]) == 1);
|
|
|
|
//Scan_Heis (whichDSF, Delta, N, M, iKneeded, Max_Secs, refine);
|
|
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, refine);
|
|
}
|
|
|
|
else JSCerror("Wrong number of arguments to Heis_DSF executable.");
|
|
*/
|
|
|
|
return(0);
|
|
}
|
|
|