Add the missing header file, and remove unnecessary fclose

This commit is contained in:
Yaser Afshar
2020-11-17 08:27:18 -06:00
parent 4e2a1efdf9
commit fc140af115

View File

@ -68,6 +68,7 @@
#include "update.h"
#include "fmt/format.h"
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
@ -274,9 +275,11 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con
if ((int)species.size() != atom->ntypes)
error->one(FLERR,"Incorrect args for KIM_SET_TYPE_PARAMETERS command");
FILE *fp;
fp = fopen(filename.c_str(),"r");
if (fp == nullptr) error->one(FLERR,"Parameter file not found");
FILE *fp = nullptr;
if (comm->me == 0) {
fp = fopen(filename.c_str(),"r");
if (fp == nullptr) error->one(FLERR,"Parameter file not found");
}
char line[MAXLINE], *ptr;
int n, eof = 0;
@ -312,7 +315,6 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con
input->one(fmt::format("set type {} charge {}",ia+1,words[1]));
}
}
fclose(fp);
}
/* ---------------------------------------------------------------------- */