@@ -167,11 +167,13 @@ TEST(CifParserTest, ReadSimpleTest)
167
167
ofs.close ();
168
168
#ifdef __MPI
169
169
}
170
+ MPI_Barrier (MPI_COMM_WORLD); // make sure the file is written
170
171
#endif
171
172
std::map<std::string, std::vector<std::string>> data;
172
173
ModuleIO::CifParser::read (" mp-2516584.cif" , data);
173
174
// delete the file
174
175
#ifdef __MPI
176
+ MPI_Barrier (MPI_COMM_WORLD); // make sure the file is already read
175
177
if (rank == 0 )
176
178
{
177
179
#endif
@@ -241,11 +243,13 @@ TEST(CifParserTest, ReadMediumTest)
241
243
ofs.close ();
242
244
#ifdef __MPI
243
245
}
246
+ MPI_Barrier (MPI_COMM_WORLD); // make sure the file is written
244
247
#endif
245
248
std::map<std::string, std::vector<std::string>> data;
246
249
ModuleIO::CifParser::read (" cod-1000065.cif" , data);
247
250
// delete the file
248
251
#ifdef __MPI
252
+ MPI_Barrier (MPI_COMM_WORLD); // make sure the file is already read
249
253
if (rank == 0 )
250
254
{
251
255
#endif
@@ -316,7 +320,6 @@ TEST(CifParserTest, WriteTest)
316
320
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
317
321
#endif
318
322
const std::string fcif = " test.cif" ;
319
- std::ofstream ofs (fcif);
320
323
const std::vector<double > abc_angles = {2.46637620 , 2.46637620 , 24.84784531 , 90.0 , 90.0 , 120.0 };
321
324
const int natom = 4 ;
322
325
const std::vector<std::string> atom_site_labels = {" C" , " C" , " C" , " C" };
@@ -325,16 +328,21 @@ TEST(CifParserTest, WriteTest)
325
328
0.333333 , 0.666667 , 0.75 ,
326
329
0.666667 , 0.333333 , 0.25 };
327
330
ModuleIO::CifParser::write (fcif,
328
- abc_angles.data (),
329
- natom,
330
- atom_site_labels.data (),
331
- atom_site_fract.data (),
332
- " # Generated during unittest of function ModuleIO::CifParser::write" ,
333
- " data_test" );
331
+ abc_angles.data (),
332
+ natom,
333
+ atom_site_labels.data (),
334
+ atom_site_fract.data (),
335
+ " # Generated during unittest of function ModuleIO::CifParser::write" ,
336
+ " data_test" ,
337
+ rank);
338
+ #ifdef __MPI
339
+ MPI_Barrier (MPI_COMM_WORLD); // make sure the file is written
340
+ #endif
334
341
std::map<std::string, std::vector<std::string>> data;
335
- ModuleIO::CifParser::read (fcif, data);
342
+ ModuleIO::CifParser::read (fcif, data, rank );
336
343
// delete the file
337
344
#ifdef __MPI
345
+ MPI_Barrier (MPI_COMM_WORLD); // make sure the file is already read
338
346
if (rank == 0 )
339
347
{
340
348
#endif
0 commit comments