Fourier dihedrals (dihedral type 5) are broken
The manual mentions in several places that Gromacs supports specifying dihedrals using Fourier coefficients (at least Section 4.2.12 and Table 5.4), but they don't really seem to work: specifying one in the topology file does create a dihedral term, but after running grompp, all the coefficients are zero, no matter what actually is in the topology. Happens with both git master and release-4-0-patches. Can be worked around using R-B dihedrals in the topology, but annoying nonetheless.
I can provide a topology file to reproduce this, but a look at the code quickly shows what's the problem: in src/gmxlib/tpxio.c, function do_iparams() clearly writes/reads the coefficients for F_FOURDIHS improperly. The fix should be straightforward, unless there are other places in the code where Fourier dihedrals are not implemented. If no one knows of such places, I can just commit a fix. If there are, a warning should be added to grompp. Looking at the commit log, they never seem to have worked, at least not in the master branch (the broken implementation has been there ~7 years).
#1 Updated by Erik Lindahl about 10 years ago
That should be fixed of course; I think one of the reasons could be that this was a temporary "hack", but we later realized it's a much better idea to convert the Fourier dihedrals to R-B, instead of calling cos() 3-4 times for each dihedral. I'm open to either option, but for performance reasons it's probably smart to at least have an option for converting to R-B internally.
#3 Updated by Teemu Murtola about 10 years ago
I committed a fix for the read/write routines to both git master and release-4-0-patches. For me, the fixed code gives essentially identical energies when comparing to a system where I did the conversion to R-B dihedrals manually in the topology, so it seems to work ok. gmxdump also gives back the same Fourier coefficients I put in, so the conversion formulas in the code should be ok.