Problem with select_atoms #4587
Unanswered
katieesconfused
asked this question in
Q&A
Replies: 1 comment
-
A few issues,
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear MDAnalysis team and Users,
I'm trying use MDAnalysis select_atoms function to dump out atom index, frame and positions of species at the Interface of a system.
Problem : the output is WRONG, and very specifically wrong.
This is my code:
import MDAnalysis as mda
import numpy as np
topo = "/scratch/anhnguyen99/g/s/si2/nvt/p10/ps.gro"
trjnj = "/scratch/anhnguyen99/g/s/si2/nvt/p10/2nd10ns/ps2nj.xtc"
unj = mda.Universe(topo, trjnj, format='xtc',topology_format="gro")
unj.trajectory[500]
linj = unj.select_atoms("name LI and (around 5 resname PE120)", periodic = False, updating= True)
print(linj.indices)
Result:
[44338 44355 44405 44436 44446]
For demonstration I'm slicing at frame 500 in the trajectory.
The trajectory is converted to remove box periodicity using gromacs gmx trjconv -pbc nojump,
This problem persist even when I use the original wrapped trajectory.
When I visualize all of species that got selected this way, this is the result, which is INCORRECT:
![Capture](https://private-user-images.githubusercontent.com/151600565/327877752-4d30bb2f-a404-426f-b8b1-72ddd9ec0c32.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTA5ODUsIm5iZiI6MTczOTE5MDY4NSwicGF0aCI6Ii8xNTE2MDA1NjUvMzI3ODc3NzUyLTRkMzBiYjJmLWE0MDQtNDI2Zi1iOGIxLTcyZGRkOWVjMGMzMi5QTkc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxMjMxMjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNDUxYjgyZjJkNjI0ODViMzhlMDZiNGEwYjFlZGQ3ZTlhM2JhODU4YTYzN2JmNDUxM2MxNDBjOGY2MDQwOWY0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.lfDStq-amdX6ks5ifdjCByjl20rA7yRZH6Wnd1jZe6E)
When I use GROMACS gmx select, I get these indices as results:
44339 44406 44420 44441 44443 44445 44447
and this is what it looks like, which is CORRECT, for my purpose:
![corCapture](https://private-user-images.githubusercontent.com/151600565/327878275-8b185de9-6911-4132-b58b-97d6e2196cf7.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTA5ODUsIm5iZiI6MTczOTE5MDY4NSwicGF0aCI6Ii8xNTE2MDA1NjUvMzI3ODc4Mjc1LThiMTg1ZGU5LTY5MTEtNDEzMi1iNThiLTk3ZDZlMjE5NmNmNy5QTkc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxMjMxMjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZjBmNGRkYWJhZWVlZGJkYjFiNjZjODMxZDgxYzZiNTVkZDQxODIzMjkxYTc1ZjBkMTMzY2YzNjE0NzBkYjM3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.pNWGsg2SYXRY5Pu6dBGAOLBfpSFm4MZf89H3k-vlmd0)
The atoms that got selected by MDAnalysis , for some of them, the index is off by exactly 1
44338 instead of 44339
44405 instead of 44406
44446 instead of 44447
I already set period = False for geometric selection, and updating = True for dynamic selection in the trajectory.
MDAnalysis version I'm using is MDAnalysis 2.7.0.
Any help is greatly appreciated!! If you have some time to spare please help and take a look at this, I suspect there is a bug with the function select_atoms of MDAnalysis 2.7.0.
Thank you for your time, please let me know what other information I can provide to on this issue.
Anh.
Beta Was this translation helpful? Give feedback.
All reactions