add write_data() support to 4 more dihedral styles, which completes the set

This commit is contained in:
Axel Kohlmeyer
2018-04-23 16:56:19 -04:00
parent 5bf8e1bc5b
commit 6f9a2245d2
8 changed files with 48 additions and 3 deletions

View File

@ -332,3 +332,13 @@ void DihedralHelix::read_restart(FILE *fp)
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralHelix::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ndihedraltypes; i++)
fprintf(fp,"%d %g %g %g\n",i,aphi[i],bphi[i],cphi[i]);
}

View File

@ -33,6 +33,7 @@ class DihedralHelix : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
double *aphi,*bphi,*cphi;

View File

@ -331,3 +331,13 @@ void DihedralMultiHarmonic::read_restart(FILE *fp)
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralMultiHarmonic::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ndihedraltypes; i++)
fprintf(fp,"%d %g %g %g %g %g\n",i,a1[i],a2[i],a3[i],a4[i],a5[i]);
}

View File

@ -33,6 +33,7 @@ class DihedralMultiHarmonic : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
double *a1,*a2,*a3,*a4,*a5;

View File

@ -26,6 +26,7 @@
#include "force.h"
#include "update.h"
#include "memory.h"
#include "math_const.h"
#include "error.h"
using namespace LAMMPS_NS;
@ -285,9 +286,9 @@ void DihedralCosineShiftExp::coeff(int narg, char **arg)
doExpansion[i]=(fabs(a_)<0.001);
umin[i] = umin_;
a[i] = a_;
cost[i] = cos(theta0_*3.14159265/180);
sint[i] = sin(theta0_*3.14159265/180);
theta[i] = theta0_*3.14159265/180;
cost[i] = cos(theta0_*MathConst::MY_PI/180.0);
sint[i] = sin(theta0_*MathConst::MY_PI/180.0);
theta[i] = theta0_*MathConst::MY_PI/180.0;
if (!doExpansion[i]) opt1[i]=umin_/(exp(a_)-1);
@ -338,3 +339,14 @@ void DihedralCosineShiftExp::read_restart(FILE *fp)
if (!doExpansion[i]) opt1[i]=umin[i]/(exp(a[i])-1);
}
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralCosineShiftExp::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ndihedraltypes; i++)
fprintf(fp,"%d %g %g %g\n",i,umin[i],
theta[i]*180.0/MathConst::MY_PI,a[i]);
}

View File

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

View File

@ -333,3 +333,12 @@ void DihedralQuadratic::read_restart(FILE *fp)
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralQuadratic::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ndihedraltypes; i++)
fprintf(fp,"%d %g %g \n",i,k[i],phi0[i]*180.0/MY_PI);
}

View File

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