Closed MBartkowiakSTFC closed 9 months ago
I tested this with another trajectory and get differences between the PACF with the old MDANSE code. It looks like there are some changes to how the coordinates were configured before calculating its correlation. See below.
The develop branch eventually calls MMTK at some point so to work out what its doing differently we need to going digging through that codebase.
Also I'm wondering about how meaningful the current implementation is since It looks like it might depend on the choice of the unit cell since it looks like the PACFs are calculated relative to the origin. It might be better to calculate the PACF using positions relative to its average position over the entire trajectory.
I would expect that the correct calculation of PACF should be unaffected by an arbitrary translation of the entire trajectory by a vector. If you agree with this, you could probably add a unit test for it.
To add complexity to it, MDANSE will handle differently the systems with and without periodic boundary conditions. So, we would need a few different inputs for testing.
I've tried adjusting the way the PACF is calculated by calculating the positions relative to the average position over the entire trajectory. The results appear more reasonable than either MDANSE versions to me and I think we should change it. For the trajectory you used above I get this.
The previous version calculated the PACF with something like this
$$\mathrm{PACF}(t) = \frac{1}{N} \sum{i}^{N} \langle R{i}(0) \cdot R_{i}(t)\rangle$$
We can see that this PACF will depend on the origin of the coordinate system since if we translate the system $R{i} \rightarrow R{i} + T$ the PACF will change. In the adjusted version I've change it to
$$\mathrm{PACF}(t) = \frac{1}{N} \sum{i}^{N} \langle \Delta R{i}(0) \cdot \Delta R_{i}(t)\rangle$$
where $\Delta R{i}(t) = R{i}(t) - R{\mathrm{avg}}$ and $R{\mathrm{avg}}$ is the average position of atom $i$ across the entire trajectory. This is similar to the positional autocorrelation function equation in the last paragraph of section 3 in https://doi.org/10.1143/PTPS.178.86.
As a part of the ongoing testing of MDANSE code I am running all the possible analysis types using the Python 2 version of MDANSE, and the new Python 3 version. The idea is to run the same analysis with the same parameters on the same trajectory, and check if they produce the same results.
So far I identified that the Position Autocorrelation Function is affected. The results produced by the protos branch are distinctly different from those of the develop branch. Should I assume that the results from the develop branch were correct?