diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index 25049b8ec255b2308b17dd2427e7983b283ce29b..8def32bb3533e6587abffadb16a7b13e0339b7d4 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -342,11 +342,10 @@ void DihedralNHarmonic::read_restart(FILE *fp) 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, (j < nterms[i] - 1) ? "%f " : "%f", a[i][j]); } fprintf(fp, "\n"); }