Skip to content
Snippets Groups Projects
Commit 1d970d3c authored by Jakub Krajniak's avatar Jakub Krajniak Committed by Axel Kohlmeyer
Browse files

dihedral_nharmonic: added writing coefficient by write_data

(cherry picked from commit 618f5c6aa52a41035391654af74c335dd0adf33e)
parent 42d43016
No related branches found
No related tags found
No related merge requests found
......@@ -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");
}
}
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment