Infrared Spectrum Calculation Tutorial

For the calculation of infrared spectrum, in fact, as long as you have the evolution data of the dipole moment of the system, it is a very common requirement to calculate the autocorrelation function, and then calculate the Fourier transform of the autocorrelation function. Many programs and software can be implemented. Skilled, you can write your own code for analysis. But most people don't have this ability, so we still recommend using GROMACS's own analysis tools to achieve their goals. GROMACS program documentation, autocorrelation function or spectrum/power spectrum calculation tools mainly include gmx analyze, gmx dipoles, gmx dos, gmx velacc. Most of these tools can be used for autocorrelation analysis, but the focus is different. The most common is the gmx analyze program, and the closest to our needs is gmx velacc, which can do speed autocorrelation functions, and there is an -os option. Give the spectrum directly, and this tool can analyze the spectrum of any group by using the group index file, which is convenient for specifying the spectrum.


What we need to calculate is the spectrum of the autocorrelation function of the current vector vq. Therefore, we first need to multiply the velocity of each particle in trr by its charge, and replace v in trr with vq. You can use the following command to output system tpr corresponding pqr file:

gmx editconf -f *.tpr- mead *.pqr

Due to the tpr is a binary format, it is not easy to process directly, so the simpler method is to first use the following command to convert it to a normal text format, and then analyze the charge information in it.

gmx dump -s *.tpr

Finally, we can use the trr file after replacing the speed value to calculate the spectrum.


Take the SPC flexible water model as an example. The initial configuration uses GROMACS's own spc216.gro for NPT simulation, with a time step of 2 fs and a simulation time of 100 ps. The first 50 ps is pre-balanced and the last 50 ps is analyzed. Due to the limited total time, So the resulting spectral resolution is not very high, but it is sufficient as an example.

Autocorrelation function of vq

Autocorrelation function of vq

Infrared spectrum of the system

Infrared spectrum of the system


  • Calculating the spectrum based on the correlation function is not only the Fourier transform method. Another commonly used method is the maximum entropy method.
  • To calculate the spectrum, it is best not to use rigid simulation or constraints during simulation, otherwise, the obtained spectrum only contains the low-frequency part, and the details of the high-frequency part are missing.


Vishal Agarwal, George W. Huber, W. Curtis Conner, Scott M. Auerbach; J. Chem. Phys. 2011, 135(13):134506.

* It should be noted that our service is only used for research, not for clinical use.




© 2021 CD ComputaBio. All rights reserved.