mol_view_lines {conmolfields}R Documentation

mol_view_lines

Description

mol_view_lines

Usage

mol_view_lines(mol)

Arguments

mol

Examples

##---- 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]])
  }
}

[Package conmolfields version 0.0-19 Index]