mol_view_cylinders: mol_view_cylindres

Description Usage Arguments Examples

Description

mol_view_cylindres

Usage

1

Arguments

x

Examples

 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_cylindres <- 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
    shade3d( cylinder3d(cbind(x,y,z), radius=0.1), color=PT.Color[[atom1$el]])
    x[1] <- atom2$x
    y[1] <- atom2$y
    z[1] <- atom2$z
    shade3d( cylinder3d(cbind(x,y,z), radius=0.1), color=PT.Color[[atom2$el]])
  }
}

conmolfields documentation built on May 2, 2019, 4:18 p.m.