ISISNeutronMuon / MDANSE

MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments
https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx
GNU General Public License v3.0
19 stars 4 forks source link

[BUG] Documentation of Radius Of Gyration does not agree with the code #404

Closed ChiCheng45 closed 3 months ago

ChiCheng45 commented 3 months ago

Description of the error The documentation of Radius Of Gyration does not agree with the code. The formulas used in the code and documentation are not the same.

Suggested fix Change the documentation so that it is the same as what is in the code, since the code follows with the formula by IUPAC https://doi.org/10.1351/goldbook.R05121 and https://charmm-gui.org/?doc=lecture&module=scientific&lesson=10.

Additional details Documentation: image

Code:

...
    if masses is None:
        masses = np.ones((coords.shape[0]), dtype=np.float64)

    com = center_of_mass(coords, masses)

    rog = np.sum(np.sum((coords - com) ** 2, axis=1) * masses) / np.sum(masses)

    if root:
        rog = np.sqrt(rog)

    return rog