Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wrap

Wrap Atomic Coordinates


Description

Wraps atomic coordinates using periodic boundary conditions.

Usage

wrap(x, ...)

## S3 method for class 'coords'
wrap(x, cryst1 = NULL, factor = NULL, ...)

## S3 method for class 'atoms'
wrap(x, cryst1 = NULL, factor = NULL, ...)

## S3 method for class 'pdb'
wrap(x, cryst1 = x$cryst1, factor = NULL, ...)

Arguments

x

an R object containing atomic coordinates to be wrapped.

cryst1

an object of class ‘cryst1’ containing periodic boundary conditions used for wrapping.

factor

a factor used to wrap the atoms by groups

...

further arguments passed to or from other methods.

Details

The wrap function translates all atoms out of the unit cell back into the unit cell using periodic boundary conditions. To do so, the wrap function first converts Cartesian into fractional coordinates. Then atoms with fractional coordinates greater than 1 or lower than 0 are respectively translated by -1 or +1. Finally, if the original atomic coordinates were Cartesian coordinates their are reconverted into Cartesian coordinates.

Value

Return a object of class ‘pdb’ with wrapped atomic coordinates.

See Also

Examples

x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))

#  Translation of the atoms along x-axis
x$atoms$x1 <- x$atoms$x1 + 10

#  Wrapping the structure
y <- wrap(x)

Rpdb

Read, Write, Visualize and Manipulate PDB Files

v2.3
GPL
Authors
Julien Idé
Initial release
2014-02-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.