Learn R Programming

bio3d (version 2.1-2)

com: Center of Mass

Description

Calculate the center of mass of a PDB object.

Usage

com(pdb, inds=NULL, use.mass=TRUE, ...)
com.xyz(xyz, mass=NULL)

Arguments

pdb
an object of class pdb as obtained from function read.pdb.
inds
atom and xyz coordinate indices obtained from atom.select that selects the elements of pdb upon which the calculation should be based.
use.mass
logical, if TRUE the calculation will be mass weighted (center of mass).
...
additional arguments to atom2mass.
xyz
a numeric vector of Cartesian coordinates.
mass
a numeric vector containing the masses of each atom in xyz.

Value

  • Returns the Cartesian coordinates at the center of mass.

Details

This function calculates the center of mass of the provided PDB structure. Atom names found in standard amino acids in the PDB are mapped to atom elements and their corresponding relative atomic masses.

In the case of an unknown atom name elety.custom and mass.custom can be used to map an atom to the correct atomic mass. See examples for more details.

Alternatively, the atom name will be mapped automatically to the element corresponding to the first character of the atom name. Atom names starting with character H will be mapped to hydrogen atoms.

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.

See Also

atom2mass

Examples

Run this code
## Stucture of PKA:
pdb <- read.pdb("3dnd")

## Center of mass:
com(pdb)

## Center of mass of a selection
inds <- atom.select(pdb, chain="I")
com(pdb, inds)

## Unknown atom names
pdb <- read.pdb("3dnd")
inds <- atom.select(pdb, resid="LL2")
mycom <- com(pdb, inds, rescue=TRUE)
#warnings()


## Map atom names manually
pdb <- read.pdb("3RE0")
inds <- atom.select(pdb, resno=201)

elety.cust <- list("CL2"="Cl", "PT1"="Pt")
mass.cust <- list("Cl"=35.45, "Pt"=195.08)

mycom <- com(pdb, inds, elety.custom=elety.cust, mass.custom=mass.cust,
             rescue=TRUE)

Run the code above in your browser using DataLab