Determining the torsion energy profile of butadiene by molecular dynamics
I really only want to make a comment, but it is too long...

Your equation $n_i = \exp^{-E_i/RT}/N$ does not make sense to me.

I agree with 
\begin{equation}
P_i = \frac{\exp ^{-E_i/RT}}{Z}
\end{equation}

where $Z = \sum \exp ^{-E_i/RT}$ is the configurational partition function.

I can also accept that using a histogram, you could say $P_i = n_i/N$ where $n_i$ is number of samples in that bin, and N is total samples.

I do not see however how

\begin{equation}
n_i N = \exp ^{-E_i/RT}
\end{equation}

This does not make sense to me. Perhaps you could swap $P_i$ for $n_i/N$ so that you have
\begin{equation}
P_i =\frac{n_i}{N} = \frac{\exp ^{-E_i/RT}}{Z}
\end{equation}

which could lead to
\begin{equation}
n_i = \frac{N}{Z}\exp ^{-E_i/RT}
\end{equation}

Which could be rearranged to get
\begin{equation}
E_i =-RT \ln \left(\frac{n_i }{N}Z\right) 
\end{equation}

If you are comparing to a reference energy then you could get

\begin{eqnarray}
E_i - E_{\rm ref} = \Delta E_{\rm i,ref} &amp;=&amp;-RT \ln \left(\frac{n_i }{N}Z\right) +RT \ln \left(\frac{n_{\rm ref} }{N}Z\right) \\
&amp;=&amp; -RT\ln \left(\frac{n_i }{n_{\rm ref}}\right)
\end{eqnarray}

It would be interesting to see if this works? I don't have the raw data, so I cannot try it (I also don't have the time, only the interest).