Closed RodenLuo closed 5 months ago
Thanks for the PR Roden. This may fix it it, but also changes the default behaviour of the trap (and therefore breaks backward compatibility), which is something I don't like too much. I think this should be controlled by a key in the input. I'm pretty busy with teaching these days, but I'll try to come up with a solution.
Fix #71.
Hi Lorenzo, Thanks for the guidance on the issue. I believe this PR fixes it. Below is a short description of what's happening.
https://github.com/lorenzo-rovigatti/oxDNA/blob/a6214b99b64806d322e110c3d84fce4bbe9815f2/src/Backends/SimBackend.cpp#L535-L542
The above code snippet is executed if
fix_diffusion = true
even atstep == 0
. It means the positions of NTs might be shifted at the very beginning. This makes it hard to set thepos0
parameter for harmonic traps. This PR solves the issue by shifting thepos0
of the external forces of an NT using its recordedp->_pos_shift
and the box sides. The attached files in #71 can be used to test the issue and the fix.I believe the "rotating harmonic trap" will suffer from the same issue. But I do not have a use case to test. So, I have only fixed the "harmonic trap". If this PR is accepted, the same fix might need to be applied to the "rotating harmonic trap".