Rpdb (version 2.2)

xyz2abc: From Cartesian to Fractional Coordinates and Vis Versa

Description

Converts Cartesian coordinates into fractional coordinates and vice versa.

Usage

xyz2abc(...) abc2xyz(...)
"xyz2abc"(x, cryst1, ...) "abc2xyz"(x, cryst1, ...)
"xyz2abc"(x, cryst1, ...) "abc2xyz"(x, cryst1, ...)
"xyz2abc"(x, cryst1 = x$cryst1, ...) "abc2xyz"(x, cryst1 = x$cryst1, ...)
"xyz2abc"(x, cryst1, ...) "abc2xyz"(x, cryst1, ...)

Arguments

...
arguments passed to methods.
x
an R object containing atomic coordinates.
cryst1
an object of class cryst1.

Value

Return an object of the same class as x, with atomic coordinates expressed in a different basis set.

Details

For atoms and pdb objects, the atomic coordinates are first extracted from x using the coords function. Then, using the periodic boundary conditions stored into cryst1, the coordinates are converted from Cartesian to fractional (for the xyz2abc functions) or from fractional to Cartesian (for the abc2xyz functions) coordinates. Finally, for atoms and pdb objects, the new atomic coordinates are reassigned to the original x object using the coords<- function and x is returned.

See Also

basis, coords, atoms, pdb, cryst1

Examples

Run this code
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
basis(x)
x <- xyz2abc(x)
basis(x)
x <- abc2xyz(x)
basis(x)

## Not run: 
# 
# # This example return an error because the coordinates stored
# # into the PDB file are already Cartesian coordinates.
# x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
# x <- abc2xyz(x)
# ## End(Not run)

Run the code above in your browser using DataCamp Workspace