mol_view_cpk: mol_view_cpk

Description Usage Arguments Examples

Description

mol_view_cpk

Usage

1
mol_view_cpk(mol, reset=TRUE, alpha=1, rfactor=0)

Arguments

mol
reset

TRUE

alpha

1

rfactor

0

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
##---- 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_cpk <- function(mol, reset=TRUE, alpha=1, rfactor=0) {
  natoms <- length(mol$atoms)
  x <- double(natoms)
  y <- double(natoms)
  z <- double(natoms)
  colors <- double(natoms)
  radius <- double(natoms)
  for (i in 1:natoms) {
    atom <- mol$atoms[[i]]
    x[i] <- atom$x
    y[i] <- atom$y
    z[i] <- atom$z
    colors[i] <- PT.Color[[atom$el]]
    radius[i] <- PT.AtRad[[atom$el]] * rfactor
  }
  if (reset) {
    open3d()
    bg3d("white")
  }
  spheres3d(x, y, z, color=colors, radius=radius, alpha=alpha)
}

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