merge.coords {Rpdb} | R Documentation |
Merging Molecular Systems
Description
Merge two objects contaning atomic coordinates
Usage
## S3 method for class 'coords'
merge(x, y, ...)
## S3 method for class 'atoms'
merge(x, y, reindex = TRUE, ...)
## S3 method for class 'pdb'
merge(x, y, reindex = TRUE, ...)
Arguments
x , y |
objects of class 'coords' to be merged. |
... |
further arguments passed to or from other methods. |
reindex |
a single element logical vector indicating if residue and element IDs have to be reindexed after merging. |
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.
Value
Return an 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.
See Also
coords
, atoms
, pdb
,
basis
, merge
, merge.data.frame
Examples
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 returns an error.
c2 <- coords(9:11, 12:14, 15:17, basis = "abc")
try(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)