Description Usage Arguments Examples
mol_view_lines
1 | mol_view_lines(mol)
|
mol |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
mol_view_lines <- function(mol) {
x <- double(2)
y <- double(2)
z <- double(2)
nbonds <- length(mol$bonds)
for (ibond in 1:nbonds) {
bond <- mol$bonds[[ibond]]
at1 <- bond$at1
at2 <- bond$at2
atom1 <- mol$atoms[[at1]]
atom2 <- mol$atoms[[at2]]
mx <- (atom1$x + atom2$x) / 2
my <- (atom1$y + atom2$y) / 2
mz <- (atom1$z + atom2$z) / 2
x[1] <- atom1$x
x[2] <- mx
y[1] <- atom1$y
y[2] <- my
z[1] <- atom1$z
z[2] <- mz
lines3d(x, y, z, color=PT.Color[[atom1$el]])
x[1] <- atom2$x
y[1] <- atom2$y
z[1] <- atom2$z
lines3d(x, y, z, color=PT.Color[[atom2$el]])
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.