Disclaimer: this question is related to my previous question, although it is much more detailed
Consider the following rotation of butadiene:
I want to determine the relative energy of each dihedral angle by molecular dynamics (MD).
My initial idea was to simulate butadiene in the NVT ensemble and use the relative frequencies of each dihedral angle to determine the relative energy. In the NVT ensemble, the probability of each microstate $P_i$ is:
$$P_i = \frac{\mathrm e^{-E/RT}}{Z}$$
Thus, I performed MD simulations in the NVT ensemble and recorded the dihedral angle periodically. With $N$ total dihedral angles, I made a histogram of the dihedral angles (e.g. a bin every 5 degrees). If we define the number of angles contained in a given bin as $n_i$, I am using the following equation:
$$n_i = \frac{\mathrm e^{-E/RT}}{N}$$
This equation can be rearranged to isolate the approximate energy associated with that dihedral angle:
$$-RT \ln(n_i N)= E$$
However, the curve obtained does not match the distribution I obtained by a simple relaxed scan of the dihedral:
Where is the problem in my method?