Commit 6f9a2245 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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

parent 5bf8e1bc
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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]);
}
+1 −0
Original line number Diff line number Diff line
@@ -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;
+10 −0
Original line number Diff line number Diff line
@@ -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]);
}
+1 −0
Original line number Diff line number Diff line
@@ -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;
+15 −3
Original line number Diff line number Diff line
@@ -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]);
}
Loading