/********************************************************** This software is part of J.-S. Caux's ABACUS library. Copyright (c) J.-S. Caux. ----------------------------------------------------------- File: Check_RAW_File.cc Purpose: from a .raw_srt file, check that nonzero momentum states appear (only) twice, and zero momentum ones (only) once. ***********************************************************/ #include "ABACUS.h" using namespace std; using namespace ABACUS; int main(int argc, char* argv[]) { if (argc != 7) { // print out some instructions cout << "Usage of Check_RAW_File executable: provide the following arguments:" << endl; cout << "(sorted!) raw file name, iKmin, iKmax, sympoint, FFmin, check_option." << endl; cout << "Check option: 0 == check for missing states, " "1 == check for multiply-appearing states." << endl; } char* rawfilename = argv[1]; int iKmin = atoi(argv[2]); int iKmax = atoi(argv[3]); int sympoint = atoi(argv[4]); DP FFmin = atof(argv[5]); int check_option = atoi(argv[6]); ifstream RAW_infile; RAW_infile.open(rawfilename); if (RAW_infile.fail()) { cout << rawfilename << endl; ABACUSerror("Could not open sorted RAW_infile... "); } DP omega_next, omega, omega_prev; int iK_next, iK, iK_prev; DP FF_next, FF, FF_prev; DP dev_next, dev, dev_prev; string label_next, label, label_prev; if (check_option > 1) { FF = 0.0; FF_prev = 0.0; FF_next = 0.0; FFmin = -1.0; } RAW_infile >> omega >> iK; if (check_option <= 1) RAW_infile >> FF; RAW_infile >> dev; RAW_infile >> label; RAW_infile >> omega_next >> iK_next; if (check_option <= 1) RAW_infile >> FF_next; RAW_infile >> dev_next; RAW_infile >> label_next; int line = 1; char a; while (fabs(FF) > FFmin && RAW_infile.peek() != EOF) { omega_prev = omega; iK_prev = iK; FF_prev = FF; dev_prev = dev; label_prev = label; omega = omega_next; iK = iK_next; FF = FF_next; dev = dev_next; label = label_next; RAW_infile >> omega_next >> iK_next; if (check_option <= 1) RAW_infile >> FF_next; // for non-Z checks RAW_infile >> dev_next; RAW_infile >> label_next; line++; if (label.compare(label_next) == 0) cout << "Identical labels around line " << line << ": " << endl << omega << "\t" << iK << "\t" << FF << "\t" << dev << "\t" << label << endl; if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax && fabs((FF - FF_prev)/(FF + FF_prev)) > 1.0e-6 && fabs((FF - FF_next)/(FF + FF_next)) > 1.0e-6) { cout << "State missing around line " << line << ": " << endl << omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << dev_prev << "\t" << label_prev << endl << omega << "\t" << iK << "\t" << FF << "\t" << dev << "\t" << label << endl << omega_next << "\t" << iK_next << "\t" << FF_next << "\t" << dev_next << "\t" << label_next << endl; cin >> a; } if (check_option == 1 && iK_prev == iK && iK == iK_next && fabs((omega - omega_prev)/(omega + omega_prev)) < 1.0e-8 && fabs((omega - omega_next)/(omega + omega_next)) < 1.0e-8 && fabs((FF - FF_prev)/(FF + FF_prev)) < 1.0e-8 && fabs((FF - FF_next)/(FF + FF_next)) < 1.0e-8) { cout << "Triple state around line " << line << ": " << endl << omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << dev_prev << "\t" << label_prev << endl << omega << "\t" << iK << "\t" << FF << "\t" << dev << "\t" << label << endl << omega_next << "\t" << iK_next << "\t" << FF_next << "\t" << dev_next << "\t" << label_next << endl; cin >> a; } if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax && fabs((omega - omega_prev)/(omega + omega_prev)) > 1.0e-6 && fabs((omega - omega_next)/(omega + omega_next)) > 1.0e-6) { cout << "State missing around line " << line << ": " << endl << omega_prev << "\t" << iK_prev << "\t" << dev_prev << "\t" << label_prev << endl << omega << "\t" << iK << "\t" << dev << "\t" << label << endl << omega_next << "\t" << iK_next << "\t" << dev_next << "\t" << label_next << endl; cin >> a; } if (check_option == 3 && iK_prev == iK && iK == iK_next && fabs((omega - omega_prev)/(omega + omega_prev)) < 1.0e-8 && fabs((omega - omega_next)/(omega + omega_next)) < 1.0e-8) { cout << "Triple state around line " << line << ": " << endl << omega_prev << "\t" << iK_prev << "\t" << dev_prev << "\t" << label_prev << endl << omega << "\t" << iK << "\t" << dev << "\t" << label << endl << omega_next << "\t" << iK_next << "\t" << dev_next << "\t" << label_next << endl; cin >> a; } } return(0); }