Skip to content

Commit 8008191

Browse files
committed
fix : continuous writing for md when out_alllog==1
1 parent 4b9442b commit 8008191

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

source/module_base/global_file.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,20 @@ void ModuleBase::Global_File::make_dir_out(
128128
if(out_alllog)
129129
{
130130
ss << "running_" << calculation << "_" << rank + 1;
131-
open_log(GlobalV::ofs_running, ss.str(), restart);
131+
open_log(GlobalV::ofs_running, ss.str(), calculation, restart);
132132
}
133133
else
134134
{
135135
if(rank==0)
136136
{
137137
ss << "running_" << calculation;
138-
open_log(GlobalV::ofs_running, ss.str(), restart);
138+
open_log(GlobalV::ofs_running, ss.str(), calculation, restart);
139139
}
140140
}
141141

142142
if(rank==0)
143143
{
144-
open_log(GlobalV::ofs_warning, "warning", restart);
144+
open_log(GlobalV::ofs_warning, "warning", calculation, restart);
145145
}
146146
return;
147147
}
@@ -159,7 +159,7 @@ void ModuleBase::Global_File::make_dir_atom(const std::string &label)
159159
return;
160160
}
161161

162-
void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn, const bool &restart)
162+
void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart)
163163
{
164164
//----------------------------------------------------------
165165
// USE GLOBAL VARIABLE :
@@ -168,7 +168,7 @@ void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn
168168
std::stringstream ss;
169169
ss << GlobalV::global_out_dir << fn << ".log";
170170

171-
if(fn == "running_md" && restart)
171+
if((calculation == "md" || calculation == "sto-md") && restart)
172172
{
173173
ofs.open( ss.str(), ios::app );
174174
}

source/module_base/global_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Global_File
3030
//const bool out_alllog = false);
3131

3232
void make_dir_atom(const std::string &label);
33-
void open_log ( std::ofstream &ofs, const std::string &fn, const bool &restart);
33+
void open_log ( std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart);
3434
void close_log( std::ofstream &ofs, const std::string &fn);
3535
void close_all_log(const int rank, const bool out_alllog = false);
3636
}

0 commit comments

Comments
 (0)