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 name
  • type: Atom type
  • index: Atom index, counting from 1
  • serial: Atom index, counting from 0
  • mass: Atomic mass
  • atomicnumber: Atomic number
  • element: Atomic element
  • altloc: Alternate atom location, if present
  • insertion: Atom insertion code
  • numbonds: Number of bonds atom participates in. Does not take into account bond order
  • beta: Beta factor for the atom, if present
  • occupancy: Occupancy of the atom, if present
  • charge: Charge on the atom, if present
  • radius: 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 and z: X, Y, or Z coordinate of the atom
  • vx, vy, and vz: X, Y, or Z velocity of the atom, if present
  • ufx, ufy, and ufz: 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 molecule
  • resname: Residue name to which atom belongs
  • chain: Chain to which atom belongs, usually a single letter
  • segname: Segment name to which atom belongs, if present
  • segid: Segment index to which atom belongs
  • fragment: Molecular fragment to which atom belongs, counting from 0
  • pfrag: Protein fragment to which atom belongs, counting from 0. If atom is not part of a protein fragment, is set to -1
  • nfrag: Nucleic acid fragment to which atom belongs, counting from 0. If atom is not part of a nucleic acid, is set to -1
  • phi: Phi backbone angle for the residue this atom is in
  • psi: Psi backbone angel for the residue this atom is in
  • backbone: If the atom is part of a protein backbone
  • sidechain: If the atom is in a protein sidechain
  • protein: If the atom is part of a protein
  • nucleic: If the atom is part of a nucleic acid
  • water or waters: If the atom is water
  • vmd_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 helix
  • alpha_helix: H If the atom is part of an alpha helix
  • helix_3_10: G If the atom is part of a 3 10 helix
  • pi_helix: I If the atom is part of a pi helix
  • sheet, betasheet, or beta_sheet: E,B If the atom is part of a beta sheet
  • extended_beta: E If the atom is part of an extended sheet
  • bridge_beta: B If the atom is part of an isolated beta bridge
  • turn: T If the atom is part of a hydrogen-bonded turn
  • coil: C If the atom is part of any other secondary structure conformation
  • structure: The DSSP classification of the secondary structure
  • pucker: 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 through volindex7: Indices into volumetric dataset for atom
  • vol0 through vol7: Volume value at this atom
  • interpvol0 through interpvol7: 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