Learn R Programming

Rpdb (version 2.3.4)

translation: Translation of Atomic Coordinates

Description

Translation of Cartesian or fractional coordinates.

Usage

Txyz(...)

# S3 method for coords Txyz( obj, x = 0, y = 0, z = 0, mask = TRUE, thickness = NULL, cryst1 = NULL, ... )

# S3 method for pdb Txyz( obj, x = 0, y = 0, z = 0, mask = TRUE, thickness = NULL, cryst1 = obj$cryst1, ... )

Tabc(...)

# S3 method for coords Tabc( obj, a = 0, b = 0, c = 0, mask = TRUE, thickness = NULL, cryst1 = NULL, ... )

# S3 method for pdb Tabc( obj, a = 0, b = 0, c = 0, mask = TRUE, thickness = NULL, cryst1 = obj$cryst1, ... )

Value

An object of the same class as x with translated coordinates.

Arguments

...

further arguments passed to or from other methods.

obj

an R object containing atomic coordinates.

x

the x-component of the translation vector.

y

the y-component of the translation vector.

z

the z-component of the translation vector.

mask

a logical vector indicating the set of coordinates to which to apply the translation.

thickness

a numeric value indicating the fraction of the thicknees of the selected atom to be added to the translation vector (Usually 0, 0.5 or 1. See details).

cryst1

an object of class ‘cryst1’ use to convert Cartesian into fraction coordinates (or Vis Versa) when need.

a

the a-component of the translation vector.

b

the b-component of the translation vector.

c

the c-component of the translation vector.

Details

Txyz and Tabc are generic functions. Method for objects of class ‘coords’ first convert the coordinates into Cartesian or fractional coordinates using cryst1 if needed to performed the translation. Once translated, the coordinates are reconverted back to the orginal basis set using again cryst1. Method for objects of class ‘pdb’ first extract coordinates from the object using the function coords, perform the translation, and update the coordinates of the ‘pdb’ object using the function coords<-. The thickness argument can be use to translate selected atoms by a fraction of its thickness along the translation direction. This can be use when merging two fragments centered at the origin to build a dimer to avoid atomic overlap and set the inter-fragment distance (see examples).

See Also

Helper functions for translation along given Cartesian or lattice vector:
Tx, Ty, Tz, Ta, Tb, Tc
Passing from Cartesian to fractional coordinates (or Vis Versa):
xyz2abc, abc2xyz

Examples

Run this code
# First lets read a pdb file
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb", package="Rpdb"))
visualize(x, mode = NULL)
visualize(Txyz(x, y=10), mode = NULL)
visualize(Txyz(x, y=10, mask = x$atoms$resid==1), mode = NULL)
visualize(Tabc(x, b=1 ), mode = NULL)
visualize(Tabc(x, b=1 , mask = x$atoms$resid==1), mode = NULL)

# Lets build a C70/Pentacene dimer with an inter-molecular distance equal to 3.5
C70 <- read.pdb(system.file("examples/C70.pdb", package="Rpdb"))
Pen <- read.pdb(system.file("examples/Pentacene.pdb", package="Rpdb"))
x <- merge(C70, Pen)
visualize(x, mode = NULL)
viewXY()
visualize(Txyz(x, x=0, y=0, z=3.5, mask = x$atoms$resname == "C70", thickness=0.5), mode = NULL)
viewXY()

Run the code above in your browser using DataLab