Learn R Programming

Rpdb (version 2.0)

coords: The Atomic Coordinates of an Object

Description

Get or set the atomic coordinates (either Cartesian or fractional coordinates) of an object.

Usage

coords(...)

coords(x) <- value

## S3 method for class 'default': coords(x1, x2, x3, basis = "xyz", \dots)

Arguments

...
arguments passed to methods.
x1, x2, x3
a numeric vector containing the first, second and third coordinates.
basis
a single element character vector indicating the type of basis vector used to express the atomic coordinates.
x
an R object containing atomic coordinates.
value
an object of class coords.

Value

  • Return a data.frame of class coords whose columns contain the three coordinates of the atoms of a molecular system. The coordinates can either be Cartesian (basis attribute equal to "xyz") or fractional coordinates (basis attribute equal to "abc").

Details

The purpose of the coords class is to store the coordinates of a molecular system and facilitate their manipulation when passing from the Cartesian to fractional coordinates and vice versa. coords and coords<- are generic accessor and replacement functions. The default method of the accessor function is actually a builder allowing to create coords objects from its different components, i.e.: x1, x2, x3, and basis. All the arguments have to be specified except 'basis' which by default is set to "xyz" (Cartesian coordinates).

See Also

basis

Examples

Run this code
x <- coords(c(0,0),c(0,0),c(0,1), basis = "xyz")
print(x)
class(x)
cell <- cryst1(abc = c(10,10,10))
y <- xyz2abc(x,cryst1=cell)
print(y)
class(y)
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
coords(x)
coords(x$atoms)
coords(x) <- coords(x$atoms)

Run the code above in your browser using DataLab