| distances | R Documentation |
Computes inter-atomic distance vectors.
distances(...)
dist.point(...)
## Default S3 method:
distances(
dx1 = numeric(0),
dx2 = numeric(0),
dx3 = numeric(0),
basis = "xyz",
...
)
## S3 method for class 'coords'
distances(x, sel1, sel2, ...)
## S3 method for class 'atoms'
distances(x, sel1, sel2, ...)
## S3 method for class 'connect'
distances(x, data, ...)
## S3 method for class 'pdb'
distances(x, sel1, sel2, ...)
## Default S3 method:
dist.point(data, x, y = NULL, z = NULL, subset = NULL, ...)
is.distances(x)
norm(...)
## S3 method for class 'distances'
norm(x, type = "xyz", ...)
## S3 method for class 'connect'
norm(x, data, type = "xyz", ...)
... |
further arguments passed to or from other methods. |
dx1, dx2, dx3 |
numeric arrays containing the first, second and third components of the distance vectors. |
basis |
a single element character vector indicating the type of basis vector used to express the coordinates. |
x, y, z |
an R object containing atomic coordinates, or a a connect object (for the corresponding method); |
sel1, sel2 |
integer or logical vectors defining two atomic selections between which the distance vectors are computed. |
data |
an object of type pdb, atoms or coords, containing atomic coordinates. |
subset |
enables sub-setting the coords object; |
type |
a single element character vector indicating how to project the distances vectors before computing the norms. See details. |
The purpose of the ‘distances’ class is to store the inter-atomic
distance vectors and facilitate their manipulation when passing from the
Cartesian to fractional references and vice versa.
The default method of the distances function is actually a builder
allowing to create a ‘distances’ object from its different components, i.e.:
dx1, dx2, dx3, and basis.
All the arguments have to be specified except 'basis' which
by default is set to "xyz" (Cartesian reference).
For objects of class ‘coords’, ‘atoms’, ‘pdb’,
two sets of atomic coordinates, defined by sel1 and sel2,
are extracted and inter-atomic distance vectors are computed
between these two sets.
For objects of class ‘connect’, distances are computed for the atoms
specified by the ‘connect’ object.
The method for the ‘dist.point’ function computes the inter-atomic distances between the atoms and a specified point.
The method of the norm function for objects of class ‘distances’
computes the norm of the distances vectors.
type specify how to project the distance vectors before
computing the norms. By default no projection is perform.
The three dx, dy, and dz components of the distance vectors
are used to compute the norm.
type can take the following values:
x: The distance vectors are projected over x.
y: The distance vectors are projected over y.
z: The distance vectors are projected over z.
xy: The distance vectors are projected in the xy-plan.
yz: The distance vectors are projected in the yz-plan.
zx: The distance vectors are projected in the zx-plan.
xyz: The distance vectors are not projected (The three components of the distance vectors are used to compute the norm).
is.distances tests if x is an object of class ‘distances’;
the test is limited to the class attribute.
The distances and dist.point functions return an object
of class ‘distances’ containing inter-atomic distance vectors.
The norm function return an array, with the same dimensions as
the dx1, dx2, dx3 components of the ‘distances’ object
for which the norms have been computed, containing the norm of the distance vectors.
is.distances returns TRUE if x is an object of class ‘distances’
and FALSE otherwise.
coords, basis, xyz2abc, abc2xyz
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb", package="Rpdb"))
is.DCB7 <- x$atoms$resname == "DCB" & x$atoms$resid == 7
is.DCB8 <- x$atoms$resname == "DCB" & x$atoms$resid == 8
d <- distances(x, is.DCB7, is.DCB8)
norm(d, type = "xyz")
norm(d, type = "xy")
norm(d, type = "x")
d <- dist.point(x, c(0,0,0), subset = is.DCB7)
norm(d, type = "xyz")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.