MDAnalysis / pmda

Parallel algorithms for MDAnalysis
https://www.mdanalysis.org/pmda/
Other
31 stars 22 forks source link

Wrong results from InterRDF_s when given 'density=True' #120

Closed VOD555 closed 4 years ago

VOD555 commented 4 years ago

Expected behaviour

Give correct single-atom to single-atom RDF when given 'density=True'.

Actual behaviour

The rdf will be 1/N of the correct value. Where N = nA * nB, and nA, nB are the number of atoms in atomgroup A and atomgroup B.

Code to reproduce the behaviour

import MDAnalysis as mda
from MDAnalysisTests.datafiles import GRO_MEMPROT, XTC_MEMPROT
u = mda.Universe(GRO_MEMPROT, XTC_MEMPROT)

s1 = u.select_atoms('name ZND and resid 289')
s2 = u.select_atoms('(name OD1 or name OD2) and resid 51 and sphzone 5.0
                         (resid 289)')
s3 = u.select_atoms('name ZND and (resid 291 or resid 292)')
s4 = u.select_atoms('(name OD1 or name OD2) and sphzone 5.0 (resid 291)')
ags = [[s1, s2], [s3, s4]]

rdf = InterRDF_s(u, ags, density=True)
rdf.run()

....

Currently version of PMDA:

0.2.1

orbeckst commented 4 years ago

Given https://github.com/MDAnalysis/mdanalysis/blob/3d952829949a5e67682fa387f9945e0b1ed6319e/package/MDAnalysis/analysis/rdf.py#L343-L352 this also seems to be incorrect in MDAnalysis.analysis.rdf – please raise an issue there!