Learn R Programming

Rpdb (version 2.2)

cellProperties: Properties of a Unit Cell

Description

Compute the Cartesian coordinates of lattice vectors, the volume or the density of a unit cell.

Usage

cell.coords(...)
## S3 method for class 'default':
cell.coords(abc, abg = c(90, 90, 90), digits = 3, ...)
## S3 method for class 'cryst1':
cell.coords(x, digits = 3, \dots)
## S3 method for class 'pdb':
cell.coords(x, digits = 3, \dots)

cell.volume(...) ## S3 method for class 'cryst1': cell.volume(x, ...) ## S3 method for class 'pdb': cell.volume(x, ...)

cell.density(...) ## S3 method for class 'default': cell.density(masses, volume, ...) ## S3 method for class 'pdb': cell.density(x, ...)

Arguments

abc
a length 3 numeric vector containing the length of the a, b and c lattice vectors.
abg
a length 3 numeric vector containing the angles (degrees) between the a, b and c lattice vectors (alpha, beta, gamma).
digits
an integer used to round the lattice vectors coordinates.
x
an R object containing lattice parameters.
masses
a numeric vector containing atomic masses.
volume
a single element numeric vector containing the volume of the unit cell in Angstrom cube.
...
further arguments passed to or from other methods.

Value

  • cell.coords returns a 3x3 matrix containing the Cartesian coordinates of lattice vectors arranged by columns. cell.volume returns a single element numeric vector containing the volume of the unit cell in Angstrom cube. cell.density returns a single element numeric vector containing the density of the unit cell in g.cm-3.

Details

cell.coords is a generic function which computes a 3x3 matrix whose columns contrain the Cartesian coordinates of lattice vectors. The 'a' and 'b' vectors are assumed to be respectively along the x-axis and in the xy-plane. The default method takes directly the lattice parameters as arguments. For objects of class cryst1 the lattice parameters are first extracted from the object and then the default method is called. For objects of class pdb the lattice parameters are extracted from their cryst1 component and the default method is called.

cell.volume is a generic function to compute the volume of a unit cell. For objects of class cryst1, the unit cell parameters are directly used to compute the volume. For objects of class pdb, their cryst1 component is used.

cell.density is a generic function to compute the density of a unit cell. For objects of class pdb: First the volume of the unit cell is calculated by calling the cell.volume function on the cryst1 component of the pdb object. Then the element names are converted into element symbols using the toSymbols function and their masses are taken from the elements data set. Finally the density is calculated using the sum of the atomic masses and the volume of the unit cell.

See Also

cryst1, pdb, xyz2abc

Examples

Run this code
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
cell.volume(x)
cell.density(x)
cell.coords(x)

Run the code above in your browser using DataLab