# cellProperties: Properties of a Unit Cell In Rpdb: Read, Write, Visualize and Manipulate PDB Files

 cellProperties R Documentation

## 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(...)

## Default S3 method:
cell.coords(abc, abg = c(90, 90, 90), digits = 3, ...)

## S3 method for class 'cryst1'
cell.coords(x, digits = 3, ...)

## S3 method for class 'pdb'
cell.coords(x, digits = 3, ...)

cell.volume(...)

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

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

cell.density(...)

## Default S3 method:
cell.density(masses, volume, ...)

## S3 method for class 'pdb'
cell.density(x, ...)
``````

### Arguments

 `...` further arguments passed to or from other methods. `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.

### 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.

### 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.

`cryst1`, `pdb`, `xyz2abc`

### Examples

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

``````

Rpdb documentation built on Sept. 28, 2023, 5:07 p.m.