|
@@ -230,6 +230,7 @@ namespace ABACUS {
|
230
|
230
|
int Max_Secs_used = int(0.9 * Max_Secs); // we don't start any new ithread loop beyond this point
|
231
|
231
|
int Max_Secs_alert = int(0.95 * Max_Secs); // we break any ongoing ithread loop beyond this point
|
232
|
232
|
|
|
233
|
+ /* TO_STR
|
233
|
234
|
stringstream filenameprefix;
|
234
|
235
|
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT,
|
235
|
236
|
AveragingState, SeedScanState, defaultScanStatename);
|
|
@@ -239,7 +240,14 @@ namespace ABACUS {
|
239
|
240
|
filenameprefix << "_" << rank[r] << "_" << nr_processors[r];
|
240
|
241
|
|
241
|
242
|
string prefix = filenameprefix.str();
|
|
243
|
+ */
|
|
244
|
+ string prefix = Data_Filename(whichDSF, iKmin, iKmax, kBT,
|
|
245
|
+ AveragingState, SeedScanState, defaultScanStatename);
|
|
246
|
+ if (in_parallel)
|
|
247
|
+ for (int r = 0; r < paralevel; ++r)
|
|
248
|
+ prefix += "_" + to_string(rank[r]) + "_" + to_string(nr_processors[r]);
|
242
|
249
|
|
|
250
|
+ /* TO_STR
|
243
|
251
|
stringstream filenameprefix_prevparalevel;
|
244
|
252
|
// without the rank and nr_processors of the highest paralevel
|
245
|
253
|
|
|
@@ -249,7 +257,15 @@ namespace ABACUS {
|
249
|
257
|
filenameprefix << "_" << rank[r] << "_" << nr_processors[r];
|
250
|
258
|
|
251
|
259
|
string prefix_prevparalevel = filenameprefix_prevparalevel.str();
|
|
260
|
+ */
|
|
261
|
+ // without the rank and nr_processors of the highest paralevel
|
|
262
|
+ string prefix_prevparalevel = Data_Filename(whichDSF, iKmin, iKmax, kBT,
|
|
263
|
+ AveragingState, SeedScanState, defaultScanStatename);
|
|
264
|
+ if (in_parallel)
|
|
265
|
+ for (int r = 0; r < paralevel - 1; ++r)
|
|
266
|
+ prefix_prevparalevel += "_" + to_string(rank[r]) + "_" + to_string(nr_processors[r]);
|
252
|
267
|
|
|
268
|
+ /* TO_STR
|
253
|
269
|
stringstream RAW_stringstream; string RAW_string;
|
254
|
270
|
stringstream INADM_stringstream; string INADM_string;
|
255
|
271
|
stringstream CONV0_stringstream; string CONV0_string;
|
|
@@ -280,55 +296,66 @@ namespace ABACUS {
|
280
|
296
|
SUM_string = SUM_stringstream.str(); const char* SUM_Cstr = SUM_string.c_str();
|
281
|
297
|
|
282
|
298
|
THRDIR_string = THRDIR_stringstream.str();
|
|
299
|
+ */
|
|
300
|
+ string RAW_str = prefix + ".raw";
|
|
301
|
+ string INADM_str = prefix + ".inadm";
|
|
302
|
+ string CONV0_str = prefix + ".conv0";
|
|
303
|
+ string STAT_str = prefix + ".stat";
|
|
304
|
+ string LOG_str = prefix + ".log";
|
|
305
|
+ string THR_str = prefix + ".thr";
|
|
306
|
+ string THRDIR_str = prefix + "_thrdir";
|
|
307
|
+ string SRC_str = prefix + ".src";
|
|
308
|
+ string SUM_str = prefix + ".sum";
|
|
309
|
+
|
283
|
310
|
|
284
|
311
|
fstream RAW_outfile;
|
285
|
|
- if (!refine || in_parallel) RAW_outfile.open(RAW_Cstr, fstream::out | fstream::trunc);
|
286
|
|
- else RAW_outfile.open(RAW_Cstr, fstream::out | fstream::app);
|
|
312
|
+ if (!refine || in_parallel) RAW_outfile.open(RAW_str, fstream::out | fstream::trunc);
|
|
313
|
+ else RAW_outfile.open(RAW_str, fstream::out | fstream::app);
|
287
|
314
|
if (RAW_outfile.fail()) {
|
288
|
|
- cout << RAW_Cstr << endl;
|
|
315
|
+ cout << RAW_str << endl;
|
289
|
316
|
ABACUSerror("Could not open RAW_outfile... ");
|
290
|
317
|
}
|
291
|
318
|
RAW_outfile.precision(16);
|
292
|
319
|
|
293
|
320
|
fstream INADM_outfile;
|
294
|
|
- if (!refine || in_parallel) INADM_outfile.open(INADM_Cstr, fstream::out | fstream::trunc);
|
295
|
|
- else INADM_outfile.open(INADM_Cstr, fstream::out | fstream::app);
|
|
321
|
+ if (!refine || in_parallel) INADM_outfile.open(INADM_str, fstream::out | fstream::trunc);
|
|
322
|
+ else INADM_outfile.open(INADM_str, fstream::out | fstream::app);
|
296
|
323
|
if (INADM_outfile.fail()) ABACUSerror("Could not open INADM_outfile... ");
|
297
|
324
|
INADM_outfile.precision(16);
|
298
|
325
|
|
299
|
326
|
fstream CONV0_outfile;
|
300
|
|
- if (!refine || in_parallel) CONV0_outfile.open(CONV0_Cstr, fstream::out | fstream::trunc);
|
301
|
|
- else CONV0_outfile.open(CONV0_Cstr, fstream::out | fstream::app);
|
|
327
|
+ if (!refine || in_parallel) CONV0_outfile.open(CONV0_str, fstream::out | fstream::trunc);
|
|
328
|
+ else CONV0_outfile.open(CONV0_str, fstream::out | fstream::app);
|
302
|
329
|
if (CONV0_outfile.fail()) ABACUSerror("Could not open CONV0_outfile... ");
|
303
|
330
|
CONV0_outfile.precision(16);
|
304
|
331
|
|
305
|
332
|
fstream STAT_outfile;
|
306
|
|
- if (!refine || in_parallel) STAT_outfile.open(STAT_Cstr, fstream::out | fstream::trunc);
|
307
|
|
- else STAT_outfile.open(STAT_Cstr, fstream::out | fstream::app);
|
|
333
|
+ if (!refine || in_parallel) STAT_outfile.open(STAT_str, fstream::out | fstream::trunc);
|
|
334
|
+ else STAT_outfile.open(STAT_str, fstream::out | fstream::app);
|
308
|
335
|
if (STAT_outfile.fail()) ABACUSerror("Could not open STAT_outfile... ");
|
309
|
336
|
STAT_outfile.precision(8);
|
310
|
337
|
|
311
|
338
|
ofstream LOG_outfile;
|
312
|
339
|
if (!in_parallel) {
|
313
|
|
- if (!refine) LOG_outfile.open(LOG_Cstr, fstream::out | fstream::trunc);
|
314
|
|
- else LOG_outfile.open(LOG_Cstr, fstream::out | fstream::app);
|
|
340
|
+ if (!refine) LOG_outfile.open(LOG_str, fstream::out | fstream::trunc);
|
|
341
|
+ else LOG_outfile.open(LOG_str, fstream::out | fstream::app);
|
315
|
342
|
if (LOG_outfile.fail()) ABACUSerror("Could not open LOG_outfile... ");
|
316
|
343
|
LOG_outfile.precision(16);
|
317
|
344
|
}
|
318
|
345
|
else { // in_parallel
|
319
|
|
- LOG_outfile.open(LOG_Cstr, fstream::out | fstream::trunc);
|
|
346
|
+ LOG_outfile.open(LOG_str, fstream::out | fstream::trunc);
|
320
|
347
|
if (LOG_outfile.fail()) ABACUSerror("Could not open LOG_outfile... ");
|
321
|
348
|
LOG_outfile.precision(16);
|
322
|
349
|
}
|
323
|
350
|
|
324
|
351
|
Scan_Info scan_info;
|
325
|
352
|
|
326
|
|
- if (!refine) mkdir(THRDIR_string.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
327
|
|
- Scan_Thread_Data paused_thread_data (THRDIR_string, refine);
|
|
353
|
+ if (!refine) mkdir(THRDIR_str.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
|
354
|
+ Scan_Thread_Data paused_thread_data (THRDIR_str, refine);
|
328
|
355
|
|
329
|
356
|
if (refine) {
|
330
|
357
|
paused_thread_data.Load();
|
331
|
|
- if (!in_parallel) scan_info.Load(SRC_Cstr);
|
|
358
|
+ if (!in_parallel) scan_info.Load(SRC_str);
|
332
|
359
|
}
|
333
|
360
|
|
334
|
361
|
Scan_Info scan_info_before = scan_info; // for LOG file
|
|
@@ -338,7 +365,7 @@ namespace ABACUS {
|
338
|
365
|
Scan_State_List<Tstate> ScanStateList (whichDSF, SeedScanState);
|
339
|
366
|
ScanStateList.Populate_List(whichDSF, SeedScanState);
|
340
|
367
|
|
341
|
|
- if (refine && !in_parallel) ScanStateList.Load_Info (SUM_Cstr);
|
|
368
|
+ if (refine && !in_parallel) ScanStateList.Load_Info (SUM_str);
|
342
|
369
|
else if (in_parallel && rank.sum() == 0) {}; // do nothing, keep info in the higher .sum file!
|
343
|
370
|
|
344
|
371
|
DP Chem_Pot = Chemical_Potential (AveragingState);
|
|
@@ -807,7 +834,7 @@ namespace ABACUS {
|
807
|
834
|
CONV0_outfile.close();
|
808
|
835
|
STAT_outfile.close();
|
809
|
836
|
|
810
|
|
- scan_info.Save(SRC_Cstr);
|
|
837
|
+ scan_info.Save(SRC_str);
|
811
|
838
|
|
812
|
839
|
Scan_Info scan_info_refine = scan_info;
|
813
|
840
|
scan_info_refine -= scan_info_before;
|
|
@@ -850,7 +877,7 @@ namespace ABACUS {
|
850
|
877
|
|
851
|
878
|
ScanStateList.Order_in_SRC ();
|
852
|
879
|
|
853
|
|
- ScanStateList.Save_Info (SUM_Cstr);
|
|
880
|
+ ScanStateList.Save_Info (SUM_str);
|
854
|
881
|
|
855
|
882
|
|
856
|
883
|
// Evaluate f-sumrule:
|
|
@@ -890,16 +917,19 @@ namespace ABACUS {
|
890
|
917
|
// Construct the finite-size saddle-point state:
|
891
|
918
|
// if we refine, read the quantum numbers of the saddle point state (and seed sps) from the sps file:
|
892
|
919
|
|
|
920
|
+ /* TO_STR
|
893
|
921
|
stringstream SPS_stringstream; string SPS_string;
|
894
|
922
|
Data_File_Name (SPS_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
895
|
923
|
SPS_stringstream << ".sps";
|
896
|
924
|
SPS_string = SPS_stringstream.str(); const char* SPS_Cstr = SPS_string.c_str();
|
|
925
|
+ */
|
|
926
|
+ string SPS_str = Data_Filename (whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "") + ".sps";
|
897
|
927
|
|
898
|
928
|
fstream spsfile;
|
899
|
|
- if (refine) spsfile.open(SPS_Cstr, fstream::in);
|
900
|
|
- else spsfile.open(SPS_Cstr, fstream::out | fstream::trunc);
|
|
929
|
+ if (refine) spsfile.open(SPS_str, fstream::in);
|
|
930
|
+ else spsfile.open(SPS_str, fstream::out | fstream::trunc);
|
901
|
931
|
if (spsfile.fail()) {
|
902
|
|
- cout << SPS_Cstr << endl; ABACUSerror("Could not open spsfile.");
|
|
932
|
+ cout << SPS_str << endl; ABACUSerror("Could not open spsfile.");
|
903
|
933
|
}
|
904
|
934
|
|
905
|
935
|
LiebLin_Bethe_State spstate;
|