Learn R Programming

Rpdb (version 2.1)

merge.coords: Merging Molecular Systems

Description

Merge two objects contaning atomic coordinates

Usage

## S3 method for class 'coords':
merge(x, y, \dots)

## S3 method for class 'atoms': merge(x, y, reindex = TRUE, \dots)

## S3 method for class 'pdb': merge(x, y, reindex = TRUE, ...)

Arguments

x, y
objects of class 'coords' to be merged.
reindex
a single element logical vector indicating if residue and element IDs have to be reindexed after merging.
...
further arguments passed to or from other methods.

Value

  • Return a n object of the same class as x and y merging x and y. If x and y have different basis attributes an error is returned.

Details

To merge x and y they must have the same basis attributes (see basis).

For objects of class coords and atoms the atomic coordinates are directly merged by row.

For objects of class pdb, the atoms and conect components of the two pdb objects are merged by row and the cryst1 components of x is used to build the returned object.

For objects of class atoms and pdb the residue and element IDs of y are shifted to avoid any confusion with those of x. If reindex==TRUE the reindex function is called to reinitialize the indexing of the returned object.

See Also

coords, atoms, pdb, basis, merge, merge.data.frame

Examples

Run this code
c1 <- coords( 1:3 ,  4:6 ,  7:9 , basis = "xyz")
c2 <- coords(10:12, 13:15, 16:18, basis = "xyz")
merge(c1,c2)

## Merging objects with different basis sets return an error.
c2 <- coords(9:11, 12:14, 15:17, basis = "abc")
merge(c1,c2)

## Prepare a Pentacene/C70 dimer
C70 <- read.pdb(system.file("examples/C70.pdb",package="Rpdb"))
Pen <- read.pdb(system.file("examples/Pentacene.pdb",package="Rpdb"))
x <- merge(Tz(C70, 3.5, thickness=0.5),Pen)

Run the code above in your browser using DataLab