abort with an error when a pair style incorrectly advertises a restart ability

This commit is contained in:
Axel Kohlmeyer 2018-03-19 18:25:18 -04:00
parent 28a922b18b
commit 5cdc6097f4
3 changed files with 22 additions and 16 deletions

View File

@ -692,6 +692,12 @@ void Pair::compute_dummy(int eflag, int vflag)
else evflag = 0;
}
/* ---------------------------------------------------------------------- */
void Pair::read_restart(FILE *)
{
error->all(FLERR,"BUG: restartinfo=1 but no restart support in pair style");
}
/* -------------------------------------------------------------------
register a callback to a compute, so it can compute and accumulate
additional properties during the pair computation from within

View File

@ -156,7 +156,7 @@ class Pair : protected Pointers {
virtual void free_disp_tables();
virtual void write_restart(FILE *) {}
virtual void read_restart(FILE *) {}
virtual void read_restart(FILE *);
virtual void write_restart_settings(FILE *) {}
virtual void read_restart_settings(FILE *) {}
virtual void write_data(FILE *) {}

View File

@ -948,13 +948,13 @@ void ReadRestart::force_fields()
style = read_string();
force->create_pair(style,1);
delete [] style;
force->pair->read_restart(fp);
if (comm->me ==0) {
if (screen) fprintf(screen," restored pair style %s from "
if (screen) fprintf(screen," restoring pair style %s from "
"restart\n", force->pair_style);
if (logfile) fprintf(logfile," restored pair style %s from "
if (logfile) fprintf(logfile," restoring pair style %s from "
"restart\n", force->pair_style);
}
force->pair->read_restart(fp);
} else if (flag == NO_PAIR) {
style = read_string();
@ -971,49 +971,49 @@ void ReadRestart::force_fields()
style = read_string();
force->create_bond(style,1);
delete [] style;
force->bond->read_restart(fp);
if (comm->me ==0) {
if (screen) fprintf(screen," restored bond style %s from "
if (screen) fprintf(screen," restoring bond style %s from "
"restart\n", force->bond_style);
if (logfile) fprintf(logfile," restored bond style %s from "
if (logfile) fprintf(logfile," restoring bond style %s from "
"restart\n", force->bond_style);
}
force->bond->read_restart(fp);
} else if (flag == ANGLE) {
style = read_string();
force->create_angle(style,1);
delete [] style;
force->angle->read_restart(fp);
if (comm->me ==0) {
if (screen) fprintf(screen," restored angle style %s from "
if (screen) fprintf(screen," restoring angle style %s from "
"restart\n", force->angle_style);
if (logfile) fprintf(logfile," restored angle style %s from "
if (logfile) fprintf(logfile," restoring angle style %s from "
"restart\n", force->angle_style);
}
force->angle->read_restart(fp);
} else if (flag == DIHEDRAL) {
style = read_string();
force->create_dihedral(style,1);
delete [] style;
force->dihedral->read_restart(fp);
if (comm->me ==0) {
if (screen) fprintf(screen," restored dihedral style %s from "
if (screen) fprintf(screen," restoring dihedral style %s from "
"restart\n", force->dihedral_style);
if (logfile) fprintf(logfile," restored dihedral style %s from "
if (logfile) fprintf(logfile," restoring dihedral style %s from "
"restart\n", force->dihedral_style);
}
force->dihedral->read_restart(fp);
} else if (flag == IMPROPER) {
style = read_string();
force->create_improper(style,1);
delete [] style;
force->improper->read_restart(fp);
if (comm->me ==0) {
if (screen) fprintf(screen," restored improper style %s from "
if (screen) fprintf(screen," restoring improper style %s from "
"restart\n", force->improper_style);
if (logfile) fprintf(logfile," restored improper style %s from "
if (logfile) fprintf(logfile," restoring improper style %s from "
"restart\n", force->improper_style);
}
force->improper->read_restart(fp);
} else error->all(FLERR,
"Invalid flag in force field section of restart file");