Project

General

Profile

Bug #357

Fourier dihedrals (dihedral type 5) are broken

Added by Teemu Murtola about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Erik Lindahl
Category:
mdrun
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

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).

History

#1 Updated by Erik Lindahl about 10 years ago

Hi!

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.

#2 Updated by Berk Hess about 10 years ago

Fourier dihedrals are converted to RB by grompp.
I can remember fixing some formulas for this,
but maybe that was only in the manual and the code in convparm was correct.
So performance wise there is no issue.
We should just fixed the reading routine.

Berk

#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.

Also available in: Atom PDF