Atomsel¶
This is the low-level (non object-oriented) interface to atom selection objects.
Basic actions¶
To create a new atomsel: .. currentmodule:: vmd.atomsel .. automethod:: __init__
Atomsel objects have attributes. New in vmd-python > 3.0.0, you can access these attributes directly from the atomsel object to both get and set! For example:
protein = atomsel("protein")
protein.chain = "A"
Here are basic methods working with an atom selection object:
update |
Recompute which atoms in the molecule belong to this selection. |
write |
Write atoms in this selection to a file of the given type |
Fitting selections to each other¶
These methods can be used to move selections around or calculate the differences between them.
fit |
Compute the transformation matrix for the root-mean-square (RMS) alignment of this selection to the one given. |
moveby |
Shift the selection by a vector |
move |
Apply a coordinate transformation to the selection. |
Numerical calculations¶
Many calculations can be performed on atomsel objects. For speed, the following are implemented internally in C:
center |
Get the coordinates of the center of the selection, optionally with weights on the selection atoms |
centerperresidue |
Get the coordinates of the center of each residue in the selection, optionally weighted by weight |
contacts |
Finds all atoms in selection within a given distance of any atom in the given selection that are not directly bonded to it. |
hbonds |
Get hydrogen bonds present in current frame of selection using simple geometric criteria. |
minmax |
Get minimum and maximum coordinates for selected atoms |
rgyr |
Calculate the radius of gyration of this selection |
rmsd |
Calculate the root-mean-square distance (RMSD) between selections. |
rmsdQCP |
Calculate the root-mean-square distance (RMSD) between selection after rotating them optimally |
rmsdperresidue |
Get the per-residue root-mean-square (RMS) distance between selections |
rmsf |
Measures the root-mean-square fluctuation (RMSF) along a trajectory on a per-atom basis. |
rmsfperresidue |
Measures the root-mean-square fluctuation (RMSF) along a trajectory on a per-residue basis. |
sasa |
Get solvent accessible surface area of selection |
Attributes¶
There are many attributes, some of which are changeable by the user. To get them, use:
list_attributes |
List available atom attributes |
Here are the atomselection attributes that may be get or set using this module. If the attribute refers to some inherent feature of the atom (such as “backbone”), using the get function returns a list of booleans.
If changing attributes, make sure to call update() on the atom selection to ensure that changes are applied to your atom selection.
Molecule attributes¶
These attributes describe the atom selection itself, and may be assigned to.
bonds |
For each atom in selection, a list of the indices of atoms to which it is bonded. |
frame |
Get the frame an atomsel object references. |
molid |
The molecule ID the selection is associated with |
Per-atom attributes¶
These attributes are features characteristic of an atom:
name
: Atom nametype
: Atom typeindex
: Atom index, counting from 1serial
: Atom index, counting from 0mass
: Atomic massatomicnumber
: Atomic numberelement
: Atomic elementaltloc
: Alternate atom location, if presentinsertion
: Atom insertion codenumbonds
: Number of bonds atom participates in. Does not take into account bond orderbeta
: Beta factor for the atom, if presentoccupancy
: Occupancy of the atom, if presentcharge
: Charge on the atom, if presentradius
: The radius of the atom. Used in SASA calculations and visualization
Per-atom spatial attributes¶
These attributes deal mostly with the coordinates of the atoms
x
,y
andz
: X, Y, or Z coordinate of the atomvx
,vy
, andvz
: X, Y, or Z velocity of the atom, if presentufx
,ufy
, andufz
: X, Y, or Z force on the atom, if present
Context attributes¶
These attributes give information about the atom in the context of its environment.
residue
: Internal residue number to which atom belongs, counting from 0.resid
: Residue ID to which atom belongs, using canonical numbering if present in input moleculeresname
: Residue name to which atom belongschain
: Chain to which atom belongs, usually a single lettersegname
: Segment name to which atom belongs, if presentsegid
: Segment index to which atom belongsfragment
: Molecular fragment to which atom belongs, counting from 0pfrag
: Protein fragment to which atom belongs, counting from 0. If atom is not part of a protein fragment, is set to -1nfrag
: Nucleic acid fragment to which atom belongs, counting from 0. If atom is not part of a nucleic acid, is set to -1phi
: Phi backbone angle for the residue this atom is inpsi
: Psi backbone angel for the residue this atom is inbackbone
: If the atom is part of a protein backbonesidechain
: If the atom is in a protein sidechainprotein
: If the atom is part of a proteinnucleic
: If the atom is part of a nucleic acidwater
orwaters
: If the atom is watervmd_fast_hydrogen
: True if the atom is hydrogen, faster than using element.
Secondary structure attributes¶
If there is no secondary structure information parsed from the input molecule file, the accuracy of these attributes depends on the quality of predicted secondary structure by VMD or STRIDE.
The DSSP classification corresponding to each keyword is also listed.
helix
: G,H,I If the atom is part of a helixalpha_helix
: H If the atom is part of an alpha helixhelix_3_10
: G If the atom is part of a 3 10 helixpi_helix
: I If the atom is part of a pi helixsheet
,betasheet
, orbeta_sheet
: E,B If the atom is part of a beta sheetextended_beta
: E If the atom is part of an extended sheetbridge_beta
: B If the atom is part of an isolated beta bridgeturn
: T If the atom is part of a hydrogen-bonded turncoil
: C If the atom is part of any other secondary structure conformationstructure
: The DSSP classification of the secondary structurepucker
: The amount of pucker on a ring, designed for carbohydrates
Volumetric attributes¶
These fields are populated when there is a volumetric dataset loaded into the molecule. Otherwise, they’re all NaN.
volindex0
throughvolindex7
: Indices into volumetric dataset for atomvol0
throughvol7
: Volume value at this atominterpvol0
throughinterpvol7
: Interpolated volume value at this atom
Custom attributes¶
These fields can be used to assign per-atom data of your choice:
- user
, user2
, user3
, user4
: Four floating-point fields for your data
- flag1
through flag7
: Seven boolean fields for your data