New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BAT method Cartesian modifies input data #3501
Comments
By the way, I've found the BAT analysis class very helpful! I just noticed this bug recently when it created some issues for me, but it's a minor problem in a much-appreciated tool. |
@JIMonroe Hey there! The below code snippet doesn't print the same which I believe should be the case.
|
@AnirG Hey, thanks for checking this out! For me, downloading the files and then running the script I have outputs the same coordinates for the first transformation, within 1e-06 or so, as the original (see below). I just created a fresh conda environment and install of MDAnalysis and I get the same thing (though you do have to use Output:
|
@JIMonroe Looks like it. Apologies, trying it fresh gave a similar output as yours for the first transformation (probably jupyter messup). I will try to work on this issue and come up with a plausible fix. |
Great, thanks, @AnirG ! I think the simplest fix is what I described above, adding |
I would like to solve this issue, if no one is currently working on it. |
Hello @orbeckst , is @Neel-Shah-29 still working on this issue ? Or can I try coming up with a possible solution for this issue ? |
Expected behavior
When calling the
Cartesian
method of a BAT class instance to convert BAT coordinates back to Cartesian, the input BAT data should not be modified.Actual behavior
"Non-primary" torsions in the original input BAT data are modified due to issues with scope and pass-by-reference. The very easy fix is just to call
copy.deepcopy()
when defining the torsions from the input data here:mdanalysis/package/MDAnalysis/analysis/bat.py
Line 502 in 4a6aee4
Code to reproduce the behavior
Dialanine.zip
Current version of MDAnalysis
2.0.0-dev0 (looking at https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/analysis/bat.py it looks like the current code will still have the same issue)
python 3.7
BigSur, Centos7
The text was updated successfully, but these errors were encountered: