I have noticed some discrepancies between USER-MISC/dihedral_quadratic.cpp and the other dihedral routines.

My lammps repository was last updated on 9th July 2013.

The angle calculated in dihedral_quadratic is of opposite sign to all other dihedral calculations.

In the documentation it is stated that the angle (second coefficient) should be inputted in degrees, this never gets converted to radians and appears to be combined with the internal angle, calculated in radians.

Again in the documentation the units of the first coefficient is given as Energy, whereas all other commands state Energy/radian^2.

I have attempted to rectify these issues, the git diff of my changes is included below.

Thanks,

Sally

index 06391b7…38684eb 100644

— a/src/USER-MISC/dihedral_quadratic.cpp

+++ b/src/USER-MISC/dihedral_quadratic.cpp

@@ -18,6 +18,7 @@

#include “lmptype.h”

#include “math.h”

+#include “math_const.h”

#include “stdlib.h”

#include “dihedral_quadratic.h”

#include “atom.h”

@@ -184,7 +185,7 @@ void DihedralQuadratic::compute(int eflag, int vflag)

// pd = dp/dc

phi = acos©;

- if (dx < 0.0) phi *= -1.0;

- if (dx > 0.0) phi *= -1.0;

si = sin(phi);

double dphi = phi-phi0[type];

@@ -296,7 +297,7 @@ void DihedralQuadratic::coeff(int narg, char **arg)

int count = 0;

for (int i = ilo; i <= ihi; i++) {

k[i] = k_one;

- phi0[i] = phi0_one*MY_PI/180.0;

setflag[i] = 1;

count++;

}

I have noticed some discrepancies between USER-MISC/dihedral_quadratic.cpp

and the other dihedral routines.

My lammps repository was last updated on 9th July 2013.

please note, contributions in USER-MISC are generally not checked,

except by their authors.

the name of the contributor should be listed in the file, so it is

recommended to contact this person for clarification and/or to get any

changes/corrections "approved".

axel.

Thanks Sally

If possible, it would be nice to keep all dihedral angle code using

the "IUPAC/IUB convention"

(shown here)

http://lammps.sandia.gov/doc/dihedral_style.html

If you have made changes to dihedral_quadratic.cpp to keep this

consistent and to fix the angle units, that's great. In my opinion at

least, we should incorporate them.

Thanks for posting

Andrew

If you want to post or send me a few lines of input script containing

a working dihedral_style and dihedral_coeff command, I am happy to

verify the code is consistent with the sign change and units.

Hi,

Would it be possible to incorporate the changes below as indicated by

Sally last year for dihedral_quadratic.cpp into the trunk?

Note that dihedral_quadratic.cpp is derived from dihedral_helix.cpp.

On 19-6-2012 there was a change made in the latter file

(http://git.icms.temple.edu/git/?p=lammps-ro.git;a=commitdiff;h=a559ad0c45e

506080a3ffca7b374060e0eeaaee6), which did not progress to

dihedral_quadratic.cpp. This involves the change Œdx<0¹ to Œdx>0¹ (given

below), and affects the dihedral convention.

The other change given below is about the constant phi0. According to the

manual (http://lammps.sandia.gov/doc/dihedral_quadratic.html) it should be

given in degrees, but the code assumes it is in radians. The diff below

brings the code in accordance with the manual.

Moreover, there is a typo in the manual, as also indicated below. For the

sake of clarity the unit for the prefactor ŒK¹, should be energy/radian^2,

conform http://lammps.sandia.gov/doc/angle_harmonic.html, and not just

energy.

Thanks,

Bart