amber dihedral to lammps

Hello Wei. is correct. if you want you can look at the frcmod (force modification file). Use parmchk -a option to get all the parameters for your system and compare with Or use (comes with antechamber) use
printanlges, printdihedrals, printbonds and printLJmatrix options to get the force parameters.

Good luck

I was trying to use the GAFF force field in LAMMPS, and I used the tool to convert the Amber data file to a LAMMPS data file.
One thing I noticed about the dihedral parameters is that in GAFF, the dihedral interaction is defined with a "1/2" factor in the constant term (see

The only complete documentation I found to explain the format of the
gaff.dat file was here:

According to this documentation, the dihedral energy U(phi) is:

                           (PK/IDIVF) * (1 + cos(PN*phi - PHASE))

PN = the last column of gaff.dat (dihedrals section)
PHASE = the 2nd-to-last column of gaff.dat
PK = the 3rd-to-last column of gaff.dat
IDIVF = the 4th-to-last column of gaff.dat

If I am using the wrong formula (interpreting gaff.dat the wrong way),
please let me know.

Hello Wei. is correct.

Hi Arun
   I'm curious to know if the dihedral coeffs generated using
moltemplate's look correct to you. I'm using some confusing
documentation to generate them (see above) and I'd love to know if I
made a mistake. (I am working on fixing improper atom order, by the
way. Thanks for that bug report.), and in the meantime, the dihedral (harmonic style) in LAMMPS doesn't have the "1/2". So intuitively, for one same dihedral, the value showing in a Amber data file should be 2 times larger than that in a LAMMPS data file. However, the LAMMPS data file generated by the amb2lmp tool gives the same value as in the Amber .top file.

Is it correct? I also checked the parameter values in the "" file in moltemplate (but didn't use it), it should also yield the same value as the amb2lmp tool.

--- regarding moltemplate ---

The "" file which comes with moltemplate uses "dihedral_style
fourier" instead of "dihedral_style harmonic". The original gaff.dat
is converted to using the formula above, along with the
documentation for dihedral_style fourier:

Btw, is there some way to compute the energy of one specific dihedral in LAMMPS. I noticed the "compute pe/atom" command, but one atom is always involved in more than one dihedrals. How to deal with that?

I don't know how to calculate this during the simulation without
editing the LAMMPS code. However it's not difficult to do this after
you run the simulation (post-processing).

  After running the simulation, assign the dihedral you care about to
a different type number (by modifying the data file, or using the set

Then use the LAMMPS' "rerun" command to read a trajectory that you
created earlier, and recalculate the dihedral energy at each frame in
the trajectory

When you do this, set all the coeffs for other dihedral interactions
to zero (leaving the coeffs for that dihedral alone). Then print the
total dihedral energy using something like:

thermo_style custom step edihed


Hi Arun,

Thanks for your reply.

It’s true that from these we can see the amb2lmp tool gives the same values as the original Amber parameters. But the problem is that I’m not sure these numerical values have the same meaning in Amber and LAMMPS data file. You can see here( and also the original GAFF paper that the dihedral constant term is written as Vn/2. Does those numbers displayed in the Amber data file (either using to see or directly find them in the .top file) mean Vn only or Vn/2 as a whole? If the former case, the value yielded by the amb2lmp tool should be halved since in LAMMPS it’s clearly only a ‘K’ as the constant.

It’s more like an Amber question actually, but I found this when using the amb2lmp tool so asked here…



Hi Andrew and Arun,

I think I found the answer from here (, things about the dihedral are on P.9).
So according to equation (4) there, the result by both the amber2lammps tool and moltemplate are right (at least for those dihedrals only have one Fourier term; I don't have a multi-Fourier-term dihedral in my data so can't validate, but I would expect correct results since the interpretation is right and an extra term is essentially the same thing).

Thank Andrew again for the detailed tutorial for computing the dihedral energy.


Wei Ding

Thanks Wei and Arun for checking these dihedral and improper
interactions. I really appreciate and depend on feedback like that.
(I'm working on putting Arun's improper suggestions into moltemplate