A few more tweaks

This commit is contained in:
Axel Kohlmeyer
2021-10-07 17:11:04 -04:00
parent 4fca127ea4
commit e12fa57794
3 changed files with 11 additions and 26 deletions

View File

@ -79,15 +79,14 @@ FixPairTracker::FixPairTracker(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg], "type/include") == 0) {
if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in fix pair/tracker command");
int ntypes = atom->ntypes;
int i, j, itype, jtype, in, jn, infield, jnfield;
int i, j, itype, jtype;
int inlo, inhi, jnlo, jnhi;
char *istr, *jstr;
if (!type_filter) {
memory->create(type_filter, ntypes + 1, ntypes + 1, "fix/pair/tracker:type_filter");
for (i = 0; i <= ntypes; i++) {
for (j = 0; j <= ntypes; j++) { type_filter[i][j] = 0; }
for (j = 0; j <= ntypes; j++) type_filter[i][j] = 0;
}
}

View File

@ -85,13 +85,7 @@ void ReaderMolfile::settings(int narg, char **arg)
if (mf->find_plugin(path)!= MFI::E_MATCH)
error->one(FLERR,"No suitable molfile plugin found");
if (screen)
fprintf(screen,"Dump reader uses molfile plugin: %s\n",
mf->get_plugin_name());
if (logfile)
fprintf(logfile,"Dump reader uses molfile plugin: %s\n",
mf->get_plugin_name());
utils::logmesg(lmp,"Dump reader uses molfile plugin: {}\n", mf->get_plugin_name());
}
}
@ -100,30 +94,22 @@ void ReaderMolfile::settings(int narg, char **arg)
only called by proc 0
------------------------------------------------------------------------- */
void ReaderMolfile::open_file(const char *file)
void ReaderMolfile::open_file(const std::string &file)
{
int rv;
char str[1024];
// close open file, if needed.
if (mf->is_open()) mf->close();
rv = mf->open(file,&natoms);
rv = mf->open(file.c_str(),&natoms);
if (rv != MFI::E_NONE) {
snprintf(str,1024,"Cannot open file %s",file);
error->one(FLERR,str);
}
if (rv != MFI::E_NONE) error->one(FLERR,"Cannot open file {}", file);
if (natoms < 1) {
snprintf(str,1024,"No atoms in file %s",file);
error->one(FLERR,str);
}
if (natoms < 1) error->one(FLERR,"No atoms in file {}", file);
memory->create(types,natoms,"reader:types");
memory->create(coords,3*natoms,"reader:coords");
if (mf->has_vels())
memory->create(vels,3*natoms,"reader:vels");
if (mf->has_vels()) memory->create(vels,3*natoms,"reader:vels");
// initialize system properties, if available
if (mf->has_props()) {

View File

@ -39,7 +39,7 @@ class ReaderMolfile : public Reader {
int &, int &, int &);
virtual void read_atoms(int, int, double **);
virtual void open_file(const char *);
virtual void open_file(const std::string &);
virtual void close_file();
private: