Skip to content

Commit 079fd0c

Browse files
Fix: check restart file reading and fix MPI datatype mismatch for bool flag (#7660)
* fix: resolve undefined variable and early termination in aveElecStatPot.py Refactored input file handling to check for 'ElecStaticPot.cube' in subdirectories. Added error handling for missing input files. * Fix file reading and MPI_Bcast type * Update msst.cpp * Fix file reading condition in fire.cpp * Fix file reading condition in msst.cpp
1 parent 854103e commit 079fd0c

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

source/source_md/fire.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,16 @@ void FIRE::restart(const std::string& global_readin_dir)
131131
if (ok)
132132
{
133133
file >> step_rst_ >> md_tfirst >> alpha >> negative_count >> dt_max >> md_dt;
134+
if(!file)
135+
{
136+
ok = false;
137+
}
134138
file.close();
135139
}
136140
}
137141

138142
#ifdef __MPI
139-
MPI_Bcast(&ok, 1, MPI_INT, 0, MPI_COMM_WORLD);
143+
MPI_Bcast(&ok, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD);
140144
#endif
141145

142146
if (!ok)

source/source_md/msst.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,16 @@ void MSST::restart(const std::string& global_readin_dir)
210210
if (ok)
211211
{
212212
file >> step_rst_ >> md_tfirst >> omega[mdp.msst_direction] >> e0 >> v0 >> p0 >> lag_pos;
213+
if(!file)
214+
{
215+
ok = false;
216+
}
213217
file.close();
214218
}
215219
}
216220

217221
#ifdef __MPI
218-
MPI_Bcast(&ok, 1, MPI_INT, 0, MPI_COMM_WORLD);
222+
MPI_Bcast(&ok, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD);
219223
#endif
220224

221225
if (!ok)

0 commit comments

Comments
 (0)