Draws a three-dimensional scatterplot

Share:

Description

Function to visualize a nanoparticle using rgl package.

Usage

1
2
plotPart(nanop, radius=0.4, legend=TRUE, col=NA, box=FALSE, 
    play=FALSE, atoms=NA, miller=NA, lattice=c(4.08))

Arguments

nanop

numeric matrix in which each row gives the coordinates of an atomic position in the nanoparticle. If nanop is not an object returned by simPart or displacePart attributes nAtomTypes, atomType, r, sym, and symShell must be set manually; see simPart.

radius

numeric vector or single value. Each atom on a plot is represented by a sphere. radius defines the sphere radius (radii).

legend

logical indicating whether to print plot legend.

col

numeric vector defining colours to be used for plotted items. If vector col length does not correspond to number of atom types within the particle then standard colouring scheme is used.

box

logical indicating whether to draw box and axes.

play

logical. If TRUE animation with constantly rotating particle is played.

atoms

character. If not NA specifies atoms to be displayed, see details.

miller

numeric vector, specifies Miller indices. If not NA only the plane in a particle core described by given indices is displayed. Should be given in a form c(h, k, l) for the non-hexagonal symmetry and c(h, k, i, l) for the hexagonal symmetry. Should be specified together with lattice parameter.

lattice

numeric vector indicating particle core lattice parameters. Should be given in the same form as in simPart.

Details

If only core (shell) atoms of a specific type to be plotted atoms should be set up to "core X" or "shell X", respectively. Character describing atom type "X" can be taken from attributes(part)$atomsCore or attributes(part)$atomsShell.

Value

a vector of object IDs.

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
33
34
35
36
37
38
39
40
41
42
## rgl library demands graphical terminal to be available
## uncoment all plotPart() calls for 3D visualization
## simulate particle
Au <- createAtom("Cu")
Au$name <- "Au"
Pd <- createAtom("Cu")
Pd$name <- "Pd"
part <- simPart(atoms=list(Au), atomsShell=list(Pd), rcore=8)
## 3d scatter plot
#plotPart(part, col=c(2,4))

## increase number of atom types within the particle:
Zn <- createAtom("Zn")
S <- createAtom("S")
part <- simPart(atoms=list(Zn ,S), atomsShell=list(Au), r=14, 
    rcore=12, sym="hcp", symShell="fcc", latticep=c(4.3, 7.04), 
    latticepShell=4.08)
## 3d scatter plot
#plotPart(part, col=c(2,4,3))
## play animation:
#plotPart(part, col=c(2,4,3), play=TRUE)

## plot only shell particles
#plotPart(part, col=c(2,4,3), atoms="shell Au", play=TRUE)

part <- simPart(atoms=list(Zn ,S),r=20, sym="hcp", 
    latticep=c(4.3, 7.04))
## display plane normal to z-axis:
#plotPart(part, miller=c(0, 0, 0 ,1), lattice=c(4.3, 7.04))
##S atoms:
#plotPart(part, miller=c(0, 0, 0 ,1), lattice=c(4.3, 7.04), 
#    atoms = "core S")
## save picture in a file using rgl function:
#rgl.snapshot( filename = "plane0001 S atoms.png")

Na <- createAtom("Na")
Cl <- createAtom("Cl")
part <- simPart(atoms=list(Na,Cl), sym="fcc")
#plotPart(part, miller=c(1,0,1), box=TRUE, lattice=c(4.08))
## plot only Na atoms:
#plotPart(part, miller=c(1,0,1), box=TRUE, lattice=c(4.08), 
#    atoms = "core Na")