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
20 stars 5 forks source link

[BUG] Total Pair Distribution Function is NaN #520

Open MBartkowiakSTFC opened 1 month ago

MBartkowiakSTFC commented 1 month ago

Description of the error If a trajectory contains 1 atom of a specific element, the partial PDF for this atom will be NaN, and subsequently the total PDF will also be NaN, even though other partials were all calculated correctly.

Describe the expected result It would be better if the partial PDF of the single atom was 0.

Describe the actual result The total PDF cannot be saved correctly or plotted afterwards.

Suggested fix Would an application of np.nan_to_num to the partials be justified and sufficient here?

Additional details N/A

ChiCheng45 commented 1 month ago

Are there other jobs with the same issue when a trajectory contains one atom?

I'd imagine the static structure factor and dynamic coherent structure factor might also have a similar issue.

MBartkowiakSTFC commented 1 month ago

So far my testing has confirmed that:

  1. Static structure factor is affected too.
  2. Dynamic Coherent Structure Factor is not.