1

After reading through the documentation I still have not been able to figure out a way to select one specific atom in my pdb file with MDAnalysis.

For my project I am essentially pulling a chloride through a membrane channel in an applied electric field. I want to use MDAnalysis to specifically select this one chloride that is being pushed through the channel. Unfortunately this is not the only chloride in the same system or even segment so selecting a resname or segment isn't going to be useful in identifying which chloride I would like to track. Essentially with MDAnalysis I am going to be running a calculation that uses the trajectory of that one specific chloride to calculate the displacement charge function. I am having difficulty writing code to tell MDAnalysis that I want that specific chloride.

The way I have distinguished this in NAMD was by using an index number but I cannot find a way in their documentation to use this number within MDAnalysis and would really appreciate if someone has experience using the pdb index number rather than segnames and ids, or linking the relevant page to the documentation if it exists.

Thanks!

2 Answers2

2

Unfortunately this is not yet documented, but as of 2.0.0dev0 you can also use the id keyword in addition to index and bynum. This might be more straightforward, as id corresponds directly to the number in the "serial" column in the PDB format. For example:

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import PDB
u = mda.Universe(PDB)
atom_with_serial_10_in_pdb = u.select_atoms("id 10")[0]

or

atom_with_serial_10_in_pdb = u.atoms[u.atoms.ids == 10][0]
orbeckst
  • 3,189
  • 1
  • 17
  • 14
Lily
  • 31
  • 1
1

bynum 7:10 which is a 1-based inclusive index

index 7 which is a 0-based index

For example, atomi7 = universe.select_atoms("index 7")

Relevant documentation:

mateuszb
  • 1,072
  • 13
  • 26