dihedral_nharmonic: added writing coefficient by write_data

(cherry picked from commit 618f5c6aa5)
This commit is contained in:
Jakub Krajniak 2016-11-29 12:15:39 +01:00 committed by Axel Kohlmeyer
parent 42d430168b
commit 1d970d3cdf
2 changed files with 20 additions and 1 deletions

View File

@ -35,7 +35,9 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
DihedralNHarmonic::DihedralNHarmonic(LAMMPS *lmp) : Dihedral(lmp) {}
DihedralNHarmonic::DihedralNHarmonic(LAMMPS *lmp) : Dihedral(lmp) {
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -334,3 +336,19 @@ void DihedralNHarmonic::read_restart(FILE *fp)
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralNHarmonic::write_data(FILE *fp)
{
fwrite(&nterms[1],sizeof(int),atom->ndihedraltypes,fp);
for (int i = 1; i <= atom->ndihedraltypes; i++) {
fprintf(fp, "%d %d ", i, nterms[i]);
for (int j = 0; j < nterms[i]; j++ ) {
fprintf(fp, "%f ", a[i][j]);
}
fprintf(fp, "\n");
}
}

View File

@ -33,6 +33,7 @@ class DihedralNHarmonic : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
int *nterms;