crystal: Create 'crystal' Object

View source: R/crystal.R

crystalR Documentation

Create ‘crystal’ Object

Description

Create an object of class ‘crystal’ containing the unit cell parameters and the name of the space group to associate with an object of class ‘pdb’.

Usage

crystal(...)

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

## Default S3 method:
crystal(abc, abg = c(90, 90, 90), sgroup = "P1", ...)

is.crystal(x)

Arguments

...

further arguments passed to or from other methods.

x

an R object to be tested or from whom to extract the crystal structure.

abc

a numeric vector of length 3 containing the norms of the lattice vectors a, b and c.

abg

a numeric vector of length 3 containing the angles between the lattice vectors \alpha, \beta and \gamma.

sgroup

a character string giving the Hermann-Mauguin symbol of the space group.

Details

crystal is a generic function to create objects of class ‘crystal’. The purpose of this class is to store CRYST1 records from PDB files which contain the unit cell parameters and the name of the space group of a molecular system stored in a PDB file. The default method of the crystal function creates an object of class ‘crystal’ from its different components, i.e.: abc, abg and sgroup. At least abc has to be specified.

The S3 method for objects of class ‘pdb’ extracts the crystal structure from the respective object.

is.crystal tests if an object is of class ‘crystal’, i.e. if it has a “class” attribute equal to crystal.

Value

Function crystal returns a list of class ‘crystal’ with the following components:

abc

a numeric vector of length 3 containing the norms of the lattice vectors a, b and c.

abg

a numeric vector of length 3 containing the angles between the lattice vectors \alpha, \beta and \gamma.

sgroup

a character string giving the Hermann-Mauguin symbol of the space group.

Function is.crystal returns TRUE if x is an object of class ‘crystal’ and FALSE otherwise.

See Also

cell.coords, pdb

Examples

x <- crystal(abc = c(10, 10, 10), abg = c(90,90,90), sgroup = "P1")
is.crystal(x)
 

Rpdb documentation built on May 12, 2026, 5:06 p.m.