View source: R/density.sampling.functions.R
sample.orbital.density | R Documentation |
Sample the wave function's density
sample.orbital.density(
nqn,
lqn,
mqn,
orb.func.info,
printQ = FALSE,
algorithm = "ais",
type = "serial",
num.processes = 1
)
nqn |
n quantum number |
lqn |
l quantum number |
mqn |
m quantum number |
orb.func.info |
Orbital pdfs info generated by splined.sqorb.functs() |
algorithm |
Can be "ais" or "mcmc" |
type |
Can be "serial" or "parallel" |
Sample the wave function's density and plot corresponding r,theta, phi (x,y,z) values. Can do MCMC, or AIS. MCMC and AIS chains can be run in parallel for extra speed.
orbital sample matrix (num.sample-rows by 3-columns)
XXXXX
library(che302r)
library(parallel)
library(doSNOW)
library(rgl)
#Pick an orbital:
n <- 1
l <- 0
m <- (0)
# Create squared orbital functions for sampling
orb.sq.funcs <- splined.sqorb.functs(n, l, m, r.max = 320, num.knots = 1000)
rax <- orb.sq.funcs$r.axis
R.sq <- orb.sq.funcs$R.sq.func
plot(rax, rax^2 * R.sq(rax), typ="l")
#Sample the orbital density:
#detectCores() # Number of processors available
#density.samples <- sample.orbital.density(n, l, m, printQ = T, orb.func.info = orb.sq.funcs, algorithm="ais", type="parallel", num.processes = 4)
# Sample in cartesian coordinates
x <- density.samples[,1]
y <- density.samples[,2]
z <- density.samples[,3]
#Plot the sampled orbital density:
#2D
plot(x,y)
plot(x,z)
plot(y,z)
#3D
plot3d(x,y,z,type="s",radius=1.5,xlab="x",ylab="y",zlab="z")
# 3D slices
plot3d(x,y,rep(0,length(z)),type="s",radius=0.5,xlab="x",ylab="y",zlab="z")
plot3d(x,rep(0,length(y)),z,type="s",radius=0.5,xlab="x",ylab="y",zlab="z")
plot3d(rep(0,length(x)), y, z,type="s",radius=0.5,xlab="x",ylab="y",zlab="z")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.