diff --git a/src/potential_file_reader.cpp b/src/potential_file_reader.cpp index a8aa0adb43..379a2ba2fc 100644 --- a/src/potential_file_reader.cpp +++ b/src/potential_file_reader.cpp @@ -34,10 +34,10 @@ PotentialFileReader::PotentialFileReader(LAMMPS *lmp, Pointers(lmp), reader(nullptr), filename(filename), - potential_name(potential_name) + filetype(potential_name + " potential") { if (comm->me != 0) { - error->one(FLERR, "PotentialFileReader should only be called by proc 0!"); + error->one(FLERR, "FileReader should only be called by proc 0!"); } try { @@ -112,7 +112,7 @@ TextFileReader * PotentialFileReader::open_potential(const std::string& path) { utils::logmesg(lmp, fmt::format("Reading potential file {} with DATE: {}", filename, date)); } - return new TextFileReader(filepath, potential_name + " potential"); + return new TextFileReader(filepath, filetype); } /* ---------------------------------------------------------------------- @@ -121,7 +121,7 @@ TextFileReader * PotentialFileReader::open_potential(const std::string& path) { ------------------------------------------------------------------------- */ std::string PotentialFileReader::get_potential_date(const std::string & path) { - TextFileReader reader(path, potential_name + " potential"); + TextFileReader reader(path, filetype); reader.ignore_comments = false; char * line = nullptr; diff --git a/src/potential_file_reader.h b/src/potential_file_reader.h index 0d3d52acfe..d2861c0a18 100644 --- a/src/potential_file_reader.h +++ b/src/potential_file_reader.h @@ -26,19 +26,20 @@ namespace LAMMPS_NS { class PotentialFileReader : protected Pointers { + protected: TextFileReader * reader; std::string filename; - std::string potential_name; + std::string filetype; TextFileReader * open_potential(const std::string& path); std::string get_potential_date(const std::string & path); public: PotentialFileReader(class LAMMPS *lmp, const std::string &filename, const std::string &potential_name); - ~PotentialFileReader(); + virtual ~PotentialFileReader(); void skip_line(); - char * next_line(int nparams); + char * next_line(int nparams = 0); void next_dvector(int n, double * list); };