Learn R Programming

Rpdb (version 2.2)

replicate: Replicate Atomic Coordinates

Description

Replicate atomic coordinates using periodic boundary conditions.

Usage

replicate(x, ...)
"replicate"(x, cryst1, a.ind = 0, b.ind = 0, c.ind = 0, ...)
"replicate"(x, cryst1, a.ind = 0, b.ind = 0, c.ind = 0, ...)
"replicate"(x, a.ind = 0, b.ind = 0, c.ind = 0, cryst1 = NULL, ...)

Arguments

x
an R object containing atomic coordinates to be replicated.
cryst1
an object of class ‘cryst1’ containing periodical boundary conditions used for replicating.
a.ind
a vector of integers indicating the positions of the replicated cells along the a-axis.
b.ind
a vector of integers indicating the positions of the replicated cells along the b-axis.
c.ind
a vector of integers indicating the positions of the replicated cells along the c-axis.
...
further arguments passed to or from other methods.

Value

‘pdb’ with replicated atomic coordinates.

Details

The replicate function replicate a unit cell along the lattice vectors a, b and c as as many times as indicated by the a.ind, b.ind and c.ind arguments. Discontinuous integer vectors can be used for a.ind, b.ind and c.ind to create layered supercells (See examples).

See Also

coords, atoms, pdb, cryst1

Examples

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

#  Create a 3x3 supercell
y <- replicate(x, a.ind= 0:2, b.ind = 0:2, c.ind = 0:2)

#  Create a 3x3 supercell which might need to be wrapped (some molecules are ouside the cell)
y <- replicate(x, a.ind= -1:1, b.ind = -1:1, c.ind = -1:1)

#  Create a layered supercell with a vacuum layer in the bc-plan
y <- replicate(x, a.ind= c(0,2), b.ind = 0:2, c.ind = 0:2)

Run the code above in your browser using DataLab