MDAnalysis / UserGuide

User Guide for MDAnalysis
https://userguide.mdanalysis.org
22 stars 31 forks source link

An error in the example on the MDAnalysis user guide webpage #344

Closed Tennisatw closed 7 months ago

Tennisatw commented 7 months ago

When calculating the Hydrogen bond autocorrelation on the MDAnalysis user guide webpage, there is an error in the code block for fitting the Hydrogen bond time constant. The page is this.

The ninth code block on the website is written as: params, fit_t, fit_ac = fit_biexponential(tau_frames, hbond_lifetime) But it should actually be: params, fit_t, fit_ac = fit_biexponential(tau_times, hbond_lifetime)

Since the fitting uses this formula: A np.exp(-t / tau1) + B np.exp(-t / tau2), the units of t and tau1 should be the same, so it should be tau_times. However, because the dt of the simulation trajectory in the example is 1ps, it causes tau_frames and tau_times to be the same, making the time constant calculation results of the example appear normal.

The reason I did not use the maintenance method provided in your user guide is that this method is too complicated for chemical practitioners (as opposed to computer practitioners).

hmacdope commented 7 months ago

Thanks for the report @Tennisatw, makes sense to me, I will make the change.

hmacdope commented 7 months ago

I will transfer this issue to the user guide.

Tennisatw commented 7 months ago

Thank you very much.