Conversation
|
Check if this works for triclinic boxes. From Irfan: There might also be code in MDAnalysis that does the math also working for triclinic boxes. |
…e runners for the matrix
|
pre-commit.ci autofix |
IAlibay
left a comment
There was a problem hiding this comment.
Couple of small things - main question is about the fractional to cartesian return, should that be on box or box.T?
|
|
||
| # this only works for orthogonal boxes | ||
| ag.positions -= np.rint(vec / box) * box | ||
| frac = np.linalg.solve(box.T, vec) # fractional coordinates |
There was a problem hiding this comment.
This seems to make sense.
However I'm not 100% sure about the shift calculation below, do you have a reference for this / where it was inspired from?
There was a problem hiding this comment.
This was inspired from the wrap_positions function here:
https://gitlab.com/ase/ase/-/blob/master/ase/geometry/geometry.py
| assert_allclose( | ||
| output["protein_RMSD"][0][:6], | ||
| [0, 30.620948, 31.158894, 1.045068, 30.735975, 30.999849], | ||
| [0, 1.089747, 1.006143, 1.045068, 1.476353, 1.332893], |
There was a problem hiding this comment.
Were these hand calculated or just a regression test for how the numbers changed?
There was a problem hiding this comment.
This is just a regression test for how the numbers changed.
There was a problem hiding this comment.
Ok - not here but maybe when you move things to separate classes, it might be good to have at least one test where you hand verify the accuracy. I find that this can be important in sanity checking things.
| # this only works for orthogonal boxes | ||
| ag.positions -= np.rint(vec / box) * box | ||
| frac = np.linalg.solve(box.T, vec) # fractional coordinates | ||
| shift = np.dot(np.round(frac), box) # nearest image, then compute shift |
There was a problem hiding this comment.
Looking at https://www.homepages.ucl.ac.uk/~rmhajc0/frorth.pdf, should this not be applied to box.T here? (equation 17)
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
|
I realized that the test for the |
IAlibay
left a comment
There was a problem hiding this comment.
This looks good to me! Let's see how it goes in practice :)
Fixes #30