Merge pull request #1584 from akohlmey/bonded-hybrid-restart

Correct restarting of bonded hybrid styles for table styles
This commit is contained in:
Axel Kohlmeyer
2019-07-25 21:26:17 -04:00
committed by GitHub
21 changed files with 148 additions and 15 deletions

View File

@ -143,6 +143,16 @@ instructions on how to use the accelerated styles effectively.
:line
[Restart info:]
This angle style writes the settings for the "angle_style table"
command to "binary restart files"_restart.html, so a angle_style
command does not need to specified in an input script that reads a
restart file. However, the coefficient information is not stored in
the restart file, since it is tabulated in the potential files. Thus,
angle_coeff commands do need to be specified in the restart input
script.
[Restrictions:]
This angle style can only be used if LAMMPS was built with the

View File

@ -140,6 +140,16 @@ instructions on how to use the accelerated styles effectively.
:line
[Restart info:]
This bond style writes the settings for the "bond_style table"
command to "binary restart files"_restart.html, so a bond_style
command does not need to specified in an input script that reads a
restart file. However, the coefficient information is not stored in
the restart file, since it is tabulated in the potential files. Thus,
bond_coeff commands do need to be specified in the restart input
script.
[Restrictions:]
This bond style can only be used if LAMMPS was built with the MOLECULE

View File

@ -191,6 +191,16 @@ switch"_Run_options.html when you invoke LAMMPS, or you can use the
See the "Speed packages"_Speed_packages.html doc page for more
instructions on how to use the accelerated styles effectively.
[Restart info:]
This dihedral style writes the settings for the "dihedral_style table"
command to "binary restart files"_restart.html, so a dihedral_style
command does not need to specified in an input script that reads a
restart file. However, the coefficient information is not stored in
the restart file, since it is tabulated in the potential files. Thus,
dihedral_coeff commands do need to be specified in the restart input
script.
[Restrictions:]
This dihedral style can only be used if LAMMPS was built with the

View File

@ -189,6 +189,16 @@ Note that one file can contain many sections, each with a tabulated
potential. LAMMPS reads the file section by section until it finds one
that matches the specified keyword.
[Restart info:]
This dihedral style writes the settings for the "dihedral_style table/cut"
command to "binary restart files"_restart.html, so a dihedral_style
command does not need to specified in an input script that reads a
restart file. However, the coefficient information is not stored in
the restart file, since it is tabulated in the potential files. Thus,
dihedral_coeff commands do need to be specified in the restart input
script.
[Restrictions:]
This dihedral style can only be used if LAMMPS was built with the

View File

@ -278,8 +278,7 @@ double AngleTable::equilibrium_angle(int i)
void AngleTable::write_restart(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
write_restart_settings(fp);
}
/* ----------------------------------------------------------------------
@ -287,6 +286,26 @@ void AngleTable::write_restart(FILE *fp)
------------------------------------------------------------------------- */
void AngleTable::read_restart(FILE *fp)
{
read_restart_settings(fp);
allocate();
}
/* ----------------------------------------------------------------------
proc 0 writes to restart file
------------------------------------------------------------------------- */
void AngleTable::write_restart_settings(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
}
/* ----------------------------------------------------------------------
proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */
void AngleTable::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
fread(&tabstyle,sizeof(int),1,fp);
@ -294,8 +313,6 @@ void AngleTable::read_restart(FILE *fp)
}
MPI_Bcast(&tabstyle,1,MPI_INT,0,world);
MPI_Bcast(&tablength,1,MPI_INT,0,world);
allocate();
}
/* ---------------------------------------------------------------------- */

View File

@ -35,6 +35,8 @@ class AngleTable : public Angle {
double equilibrium_angle(int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
double single(int, int, int, int);
protected:

View File

@ -222,8 +222,7 @@ double BondTable::equilibrium_distance(int i)
void BondTable::write_restart(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
write_restart_settings(fp);
}
/* ----------------------------------------------------------------------
@ -231,6 +230,26 @@ void BondTable::write_restart(FILE *fp)
------------------------------------------------------------------------- */
void BondTable::read_restart(FILE *fp)
{
read_restart_settings(fp);
allocate();
}
/* ----------------------------------------------------------------------
proc 0 writes to restart file
------------------------------------------------------------------------- */
void BondTable::write_restart_settings(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
}
/* ----------------------------------------------------------------------
proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */
void BondTable::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
fread(&tabstyle,sizeof(int),1,fp);
@ -238,8 +257,6 @@ void BondTable::read_restart(FILE *fp)
}
MPI_Bcast(&tabstyle,1,MPI_INT,0,world);
MPI_Bcast(&tablength,1,MPI_INT,0,world);
allocate();
}
/* ---------------------------------------------------------------------- */

View File

@ -35,6 +35,8 @@ class BondTable : public Bond {
double equilibrium_distance(int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
double single(int, double, int, int, double &);
protected:

View File

@ -1012,8 +1012,7 @@ void DihedralTable::coeff(int narg, char **arg)
void DihedralTable::write_restart(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
write_restart_settings(fp);
}
/* ----------------------------------------------------------------------
@ -1021,6 +1020,27 @@ void DihedralTable::write_restart(FILE *fp)
------------------------------------------------------------------------- */
void DihedralTable::read_restart(FILE *fp)
{
read_restart_settings(fp);
allocate();
}
/* ----------------------------------------------------------------------
proc 0 writes to restart file
------------------------------------------------------------------------- */
void DihedralTable::write_restart_settings(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
}
/* ----------------------------------------------------------------------
proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */
void DihedralTable::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
fread(&tabstyle,sizeof(int),1,fp);
@ -1029,8 +1049,6 @@ void DihedralTable::read_restart(FILE *fp)
MPI_Bcast(&tabstyle,1,MPI_INT,0,world);
MPI_Bcast(&tablength,1,MPI_INT,0,world);
allocate();
}

View File

@ -36,6 +36,8 @@ class DihedralTable : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
double single(int type, int i1, int i2, int i3, int i4);
protected:

View File

@ -1003,8 +1003,7 @@ void DihedralTableCut::coeff(int narg, char **arg)
void DihedralTableCut::write_restart(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
write_restart_settings(fp);
}
/* ----------------------------------------------------------------------
@ -1013,8 +1012,26 @@ void DihedralTableCut::write_restart(FILE *fp)
void DihedralTableCut::read_restart(FILE *fp)
{
read_restart_settings(fp);
allocate();
}
/* ----------------------------------------------------------------------
proc 0 writes out coeffs to restart file
------------------------------------------------------------------------- */
void DihedralTableCut::write_restart_settings(FILE *fp)
{
fwrite(&tabstyle,sizeof(int),1,fp);
fwrite(&tablength,sizeof(int),1,fp);
}
/* ----------------------------------------------------------------------
proc 0 reads coeffs from restart file, bcasts them
------------------------------------------------------------------------- */
void DihedralTableCut::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
fread(&tabstyle,sizeof(int),1,fp);
fread(&tablength,sizeof(int),1,fp);

View File

@ -33,6 +33,8 @@ class DihedralTableCut : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
protected:
double *aat_k,*aat_theta0_1,*aat_theta0_2;

View File

@ -46,6 +46,8 @@ class Angle : protected Pointers {
virtual double equilibrium_angle(int) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_restart_settings(FILE *) {};
virtual void read_restart_settings(FILE *) {};
virtual void write_data(FILE *) {}
virtual double single(int, int, int, int) = 0;
virtual double memory_usage();

View File

@ -324,6 +324,7 @@ void AngleHybrid::write_restart(FILE *fp)
n = strlen(keywords[m]) + 1;
fwrite(&n,sizeof(int),1,fp);
fwrite(keywords[m],sizeof(char),n,fp);
styles[m]->write_restart_settings(fp);
}
}
@ -349,6 +350,7 @@ void AngleHybrid::read_restart(FILE *fp)
if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_angle(keywords[m],0,dummy);
styles[m]->read_restart_settings(fp);
}
}

View File

@ -48,6 +48,8 @@ class Bond : protected Pointers {
virtual double equilibrium_distance(int) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_restart_settings(FILE *) {};
virtual void read_restart_settings(FILE *) {};
virtual void write_data(FILE *) {}
virtual double single(int, double, int, int, double &) = 0;
virtual double memory_usage();

View File

@ -325,6 +325,7 @@ void BondHybrid::write_restart(FILE *fp)
n = strlen(keywords[m]) + 1;
fwrite(&n,sizeof(int),1,fp);
fwrite(keywords[m],sizeof(char),n,fp);
styles[m]->write_restart_settings(fp);
}
}
@ -350,6 +351,7 @@ void BondHybrid::read_restart(FILE *fp)
if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_bond(keywords[m],0,dummy);
styles[m]->read_restart_settings(fp);
}
}

View File

@ -45,6 +45,8 @@ class Dihedral : protected Pointers {
virtual void coeff(int, char **) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_restart_settings(FILE *) {};
virtual void read_restart_settings(FILE *) {};
virtual void write_data(FILE *) {}
virtual double memory_usage();

View File

@ -309,6 +309,7 @@ void DihedralHybrid::write_restart(FILE *fp)
n = strlen(keywords[m]) + 1;
fwrite(&n,sizeof(int),1,fp);
fwrite(keywords[m],sizeof(char),n,fp);
styles[m]->write_restart_settings(fp);
}
}
@ -334,6 +335,7 @@ void DihedralHybrid::read_restart(FILE *fp)
if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_dihedral(keywords[m],0,dummy);
styles[m]->read_restart_settings(fp);
}
}

View File

@ -45,6 +45,8 @@ class Improper : protected Pointers {
virtual void coeff(int, char **) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_restart_settings(FILE *) {};
virtual void read_restart_settings(FILE *) {};
virtual void write_data(FILE *) {}
virtual double memory_usage();

View File

@ -306,6 +306,7 @@ void ImproperHybrid::write_restart(FILE *fp)
n = strlen(keywords[m]) + 1;
fwrite(&n,sizeof(int),1,fp);
fwrite(keywords[m],sizeof(char),n,fp);
styles[m]->write_restart_settings(fp);
}
}
@ -331,6 +332,7 @@ void ImproperHybrid::read_restart(FILE *fp)
if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_improper(keywords[m],0,dummy);
styles[m]->read_restart_settings(fp);
}
}

View File

@ -61,7 +61,7 @@ class Pair : protected Pointers {
int dispersionflag; // 1 if compatible with LJ/dispersion solver
int tip4pflag; // 1 if compatible with TIP4P solver
int dipoleflag; // 1 if compatible with dipole solver
int spinflag; // 1 if compatible with spin solver
int spinflag; // 1 if compatible with spin solver
int reinitflag; // 1 if compatible with fix adapt and alike
int tail_flag; // pair_modify flag for LJ tail correction