Range of improper dihedral angles

LAMMPS version: 2Aug2023
OS: Ubuntu 20.04.6 LTS

The improper dihedral potential applied with improper_style harmonic (E=K(\chi-\chi_0)^2) works in the range [0, 180] degree (not [-180, 180] degree), because in line 134 of src/MOLECULE/improper_harmonic.cpp, improper dihedral angles are calculated through a function acos, not considering the signature and periodic boundary conditions. This is the same for line 218 of src/compute_improper_local.cpp.
So, when we simulate a molecule that has an improper dihedral angle showing a negative value with an equilibrium angle that is neither 0 nor 180 degree, (A) the force calculated with improper_style harmonic would be different from (B) that calculated from a harmonic potential of an improper dihedral defined in the range [-180, 180]. Is this right? I mean,
(A) Force and energy from E=K(\chi-\chi_0)^2 (0^\circ \le \chi \le180^\circ) (LAMMPS improper_harmonic)
(B) Force and energy from E=K(\chi-\chi_0)^2 (-180^\circ \le \chi \le180^\circ)

  • \chi, \chi_0 = 10, 90^\circ → (A) == (B)
  • \chi, \chi_0 = -10, 90^\circ → (A) != (B)

Because the equilibrium improper angle is basically set to 0 or 180 degrees in all-atom force fields, such as CHARMM and OPLS, in which case the calculation of improper_style harmonic may work well.
In other MD packages, GROMACS and NAMD, the range of improper dihedral angles is [-180, 180], namely, (B). So, I was a bit confused about the improper dihedral definition. I do not need any help because I am using improper_harmonic.cpp modified with reference to dihedral_quadratic.cpp. And I do not think LAMMPS needs to follow the improper dihedral definition of those MD packages. But I just feel it is better to add a definition of the range of the improper dihedral angle to the LAMMPS manual at least.
Sorry if I was missing that definition in the manual, I misunderstood the codes, and this topic was too specific for LAMMPS users.

– I forgot to write one question. Taking only positive values of improper dihedral angles is an expected behavior for improper_style harmonic and compute improper/local commands?

Miyazaki

231225_improper_check.tar.gz (79.4 KB)