From 5745142ecc1cc8f5014e19d64d18f2f2f00c9198 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2016 22:18:53 -0400 Subject: [PATCH] angles are internally stored in radians. add conversion to and from it. --- src/angle_zero.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index df5b083e4e..375d5ad813 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -22,10 +22,12 @@ #include "atom.h" #include "force.h" #include "comm.h" +#include "math_const.h" #include "memory.h" #include "error.h" using namespace LAMMPS_NS; +using namespace MathConst; /* ---------------------------------------------------------------------- */ @@ -92,11 +94,12 @@ void AngleZero::coeff(int narg, char **arg) if (coeffflag && (narg == 2)) theta0_one = force->numeric(FLERR,arg[1]); + // convert theta0 from degrees to radians int count = 0; for (int i = ilo; i <= ihi; i++) { setflag[i] = 1; - theta0[i] = theta0_one; + theta0[i] = theta0_one/180.0 * MY_PI; count++; } @@ -140,7 +143,7 @@ void AngleZero::read_restart(FILE *fp) void AngleZero::write_data(FILE *fp) { for (int i = 1; i <= atom->nangletypes; i++) - fprintf(fp,"%d %g\n",i,theta0[i]); + fprintf(fp,"%d %g\n",i,theta0[i]/MY_PI*180.0); } /* ---------------------------------------------------------------------- */