sample.density2: Importance sample orbital density

View source: R/density.sampling.functions.R

sample.density2R Documentation

Importance sample orbital density

Description

Sample the orbital wave function's density from a preset lattice of spherical coordinates

Usage

sample.density2(nqn, lqn, mqn, spherical.grid, num.samples)

Arguments

nqn

n quantum number

lqn

l quantum number

mqn

m quantum number

spherical.grid

lattice of r, theta, phi values from which to sample

num.samples

number of samples desired

Details

Sample the wave function's density and plot corresponding r,theta, phi (x,y,z) values. Uses importance sampling from a lattice of r, theta, phi values. See Cromer reference for more details. Caution, requires large lattice to sample from (spherical.grid). This was basically version 1 of an orbital density sampling procedure.

Value

orbital sample matrix (num.sample-rows by 3-columns)

References

D. Cromer, J Chem Educ. 45(10) 626-631 1968

Examples

rmax<-20
dr<-0.05
dth<-0.017
dph<-0.017
r<-seq(from=0,to=rmax,by=dr)
theta<-seq(from=0,to=pi,by=dth)
phi<-seq(from=0,to=2*pi,by=dph)
print(paste("Grid size:",length(r)*length(theta)*length(phi)))
spherical.grid.pts<-expand.grid(R=r,Theta=theta,Phi=phi) # Caution! This can get big!

#Pick an orbital:
n<-2
l<-(1)
m<-(1)

#Sample the orbital density:
num.pts<-10000
denisty.samples<-sample.density2(n, l, m, spherical.grid.pts, num.pts)
x<-denisty.samples[,1]
y<-denisty.samples[,2]
z<-denisty.samples[,3]

#Plot the sampled orbital density:
#2D
plot(x,y)
plot(x,z)
plot(y,z)

#3D with rgl
plot3d(x,y,z,type="s",radius=0.1,xlab="x",ylab="y",zlab="z")


npetraco/che302r documentation built on April 17, 2025, 10:34 p.m.