Describe the bug
When running calculations with calculation = md and enabling out_alllog = 1, the generated log filenames are incorrectly formatted as running_md_1.log (rank 0) and running_scf_2.log (rank 1), while the expected behavior should be running_md_[rank].log for all ranks.
Debugging reveals that PARAM.inp.calculation is not properly broadcasted across MPI ranks: rank 0 correctly reads md, but other ranks default to scf. This inconsistency occurs in read_set_globalv.cpp during log filename generation. I added a line to output PARAM.inp.calculation used to generate log files:
// set the global log file
bool out_alllog = inp.out_alllog;
#ifdef __MPI
// because log_file is different for each rank, so we need to bcast the out_alllog
Parallel_Common::bcast_bool(out_alllog);
#endif
if (out_alllog)
{
std::cerr << "PARAM.inp.calculation = " << PARAM.inp.calculation << std::endl;
PARAM.sys.log_file = "running_" + PARAM.inp.calculation + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log";
}
else
{
PARAM.sys.log_file = "running_" + PARAM.inp.calculation + ".log";
}
And the output reads
PARAM.inp.calculation = md
PARAM.inp.calculation = scf
Expected behavior
No response
To Reproduce
No response
Environment
No response
Additional Context
No response
Task list for Issue attackers (only for developers)
Describe the bug
When running calculations with
calculation = mdand enablingout_alllog = 1, the generated log filenames are incorrectly formatted asrunning_md_1.log(rank 0) andrunning_scf_2.log(rank 1), while the expected behavior should berunning_md_[rank].logfor all ranks.Debugging reveals that
PARAM.inp.calculationis not properly broadcasted across MPI ranks: rank 0 correctly readsmd, but other ranks default toscf. This inconsistency occurs inread_set_globalv.cppduring log filename generation. I added a line to outputPARAM.inp.calculationused to generate log files:And the output reads
Expected behavior
No response
To Reproduce
No response
Environment
No response
Additional Context
No response
Task list for Issue attackers (only for developers)