100% found this document useful (1 vote)
1K views3 pages

Orbital Gnuplot

This document contains code to generate polar plots of atomic orbitals using Gnuplot. It defines functions for the shapes of s, p, d and f orbitals. These orbital functions are then plotted one by one to visualize their shapes in three dimensions. Labels and formatting options are set up to properly display and annotate the orbital plots.

Uploaded by

Amalia Anggreini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views3 pages

Orbital Gnuplot

This document contains code to generate polar plots of atomic orbitals using Gnuplot. It defines functions for the shapes of s, p, d and f orbitals. These orbital functions are then plotted one by one to visualize their shapes in three dimensions. Labels and formatting options are set up to properly display and annotate the orbital plots.

Uploaded by

Amalia Anggreini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
  • Setup and Configuration: Introduces the script setup for plotting polar coordinates using a specific plotting tool, configuring various parameters.
  • Hybrid Orbital Plots: Covers plotting of hybrid orbitals, providing specific commands for visualizing different orbitals based on mathematical functions.
  • Orbital Selection and Execution: Discusses how to select and execute specific plotting commands, with pauses for user interaction.

################################################################################

# make polar plots of real combinations of spherical harmonics #


# > gnuplot -persist [Link] #
# I 2001, E. Koch, MPI-FKF #
################################################################################

# set term postscript portrait enh 'Helvetica' 21


# set output '[Link]'
# set size 1.0, 0.7

# set up coordinate system #####


set view 60, 30
scale=0.9
set xrange [-scale:scale]
set yrange [-scale:scale]
set zrange [-scale:scale]
set noborder
set noxtics
set noytics
set noztics
set nokey
# coordinate axes
set arrow 1 from -scale, 0, 0 to scale, 0, 0 lw 3
set arrow 2 from 0, -scale, 0 to 0, scale, 0 lw 3
set arrow 3 from 0, 0, -scale to 0, 0, scale lw 3
set label 'x' at scale,-.25*scale,0
set label 'y' at 0,1.1*scale,-.15*scale
set label 'z' at 0.10*scale,0,scale

# polar coordinates ####


set parametric
set urange [0:pi]
set vrange [-pi:pi]
x(u,v)=sin(u)*cos(v)
y(u,v)=sin(u)*sin(v)
z(u,v)=cos(u)
set isosamples 22, 45
set hidden3d

# atomic orbitals ####


# s orbital
s(u,v)=sqrt(1.0/4.0/pi)
# p orbitals
pz(u,v)=sqrt(3.0/4.0/pi)*cos(u) # m =0
px(u,v)=sqrt(3.0/4.0/pi)*sin(u)*cos(v) # |m|=1
py(u,v)=sqrt(3.0/4.0/pi)*sin(u)*sin(v) # |m|=1
# d orbitals
d3z2m1(u,v)=sqrt( 5.0/16.0/pi)*(3.0*cos(u)**2-1.0) # m =0
dzx(u,v) =sqrt(15.0/16.0/pi)*sin(2.0*u)*cos(v) # |m|=1
dyz(u,v) =sqrt(15.0/16.0/pi)*sin(2.0*u)*sin(v) # |m|=1
dx2my2(u,v)=sqrt(15.0/16.0/pi)*sin(u)**2*cos(2.0*v) # |m|=2
dxy(u,v) =sqrt(15.0/16.0/pi)*sin(u)**2*sin(2.0*v) # |m|=2
# f orbitals
fz5z2m3 (u,v)=sqrt( 7.0/16.0/pi)*(5.0*cos(u)**2-3.0)*cos(u) # m =0
fx5z2m1 (u,v)=sqrt( 21.0/32.0/pi)*(5.0*cos(u)**2-1.0)*sin(u)*cos(v) # |m|=1
fy5z2m1 (u,v)=sqrt( 21.0/32.0/pi)*(5.0*cos(u)**2-1.0)*sin(u)*sin(v) # |m|=1
fzx2my2 (u,v)=sqrt(105.0/16.0/pi)*cos(u)*sin(u)**2*cos(2.0*v) # |m|=2
fxyz (u,v)=sqrt(105.0/16.0/pi)*cos(u)*sin(u)**2*sin(2.0*v) # |m|=2
fxx2m3y2(u,v)=sqrt( 35.0/32.0/pi)*sin(u)**3*cos(3.0*v) # |m|=3
fy3x2my2(u,v)=sqrt( 35.0/32.0/pi)*sin(u)**3*sin(3.0*v) # |m|=3

# some hybrid orbitals


# sp hybrids:
sp_1(u,v)=sqrt(1.0/2.0)*(s(u,v)+pz(u,v))
sp_2(u,v)=sqrt(1.0/2.0)*(s(u,v)-pz(u,v))
# sp2 hybrids:
sp2_1(u,v)=sqrt(1.0/3.0)*(s(u,v)+sqrt(2.0)*px(u,v))
sp2_2(u,v)=sqrt(1.0/3.0)*(s(u,v)-sqrt(1.0/2.0)*px(u,v)+sqrt(3.0/2.0)*py(u,v))
sp2_3(u,v)=sqrt(1.0/3.0)*(s(u,v)-sqrt(1.0/2.0)*px(u,v)-sqrt(3.0/2.0)*py(u,v))
# sp3 hybrids:
sp3_1(u,v)=0.5*(s(u,v)+px(u,v)+py(u,v)+pz(u,v))
sp3_2(u,v)=0.5*(s(u,v)+px(u,v)-py(u,v)-pz(u,v))
sp3_3(u,v)=0.5*(s(u,v)-px(u,v)+py(u,v)-pz(u,v))
sp3_4(u,v)=0.5*(s(u,v)-px(u,v)-py(u,v)+pz(u,v))
sp1_ny = 3
sp1_nx = 2
set multiplot layout 3,2 title "Rosa Safitri 151810301060" font ",10"
set lmargin 0
set rmargin 0
set tmargin 0
set bmargin 0
set format ''
# >>> here you choose what orbital to plot <<< #################################
orb(u,v)=s(u,v)
# plot
set size 0.4,0.4
set title "Orbital S"
pos(u,v)= orb(u,v)<0 ? 0 : orb(u,v)
neg(u,v)= orb(u,v)>0 ? 0 : -orb(u,v)
#splot neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)
#pause -1 "NEG Hit return to continue"
#splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v)
#pause -1 "POS Hit return to continue"
splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v), \
neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)

pause -1 "px Hit return to continue"


orb(u,v)=px(u,v)
# plot
set size 0.4,0.4
set title "Orbital Px"
pos(u,v)= orb(u,v)<0 ? 0 : orb(u,v)
neg(u,v)= orb(u,v)>0 ? 0 : -orb(u,v)
#splot neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)
#pause -1 "NEG Hit return to continue"
#splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v)
#pause -1 "POS Hit return to continue"
splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v), \
neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)

pause -1 "py Hit return to continue"


orb(u,v)=py(u,v)
# plot
set size 0.4,0.4
set title "Orbital Py"
pos(u,v)= orb(u,v)<0 ? 0 : orb(u,v)
neg(u,v)= orb(u,v)>0 ? 0 : -orb(u,v)
#splot neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)
#pause -1 "NEG Hit return to continue"
#splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v)
#pause -1 "POS Hit return to continue"
splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v), \
neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)

pause -1 "pz Hit return to continue"


orb(u,v)=pz(u,v)
# plot
set size 0.4,0.4
set title "Orbital Pz"
pos(u,v)= orb(u,v)<0 ? 0 : orb(u,v)
neg(u,v)= orb(u,v)>0 ? 0 : -orb(u,v)
#splot neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)
#pause -1 "NEG Hit return to continue"
#splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v)
#pause -1 "POS Hit return to continue"
splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v), \
neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)

pause -1 "dxy Hit return to continue"


orb(u,v)=dxy(u,v)
# plot
set size 0.4,0.4
set title "Orbital dxy"
pos(u,v)= orb(u,v)<0 ? 0 : orb(u,v)
neg(u,v)= orb(u,v)>0 ? 0 : -orb(u,v)
#splot neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)
#pause -1 "NEG Hit return to continue"
#splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v)
#pause -1 "POS Hit return to continue"
splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v), \
neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)

pause -1 "dyz Hit return to continue"


orb(u,v)=dyz(u,v)
# plot
set size 0.4,0.4
set title "Orbital dyz"
pos(u,v)= orb(u,v)<0 ? 0 : orb(u,v)
neg(u,v)= orb(u,v)>0 ? 0 : -orb(u,v)
#splot neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)
#pause -1 "NEG Hit return to continue"
#splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v)
#pause -1 "POS Hit return to continue"
splot pos(u,v)*x(u,v), pos(u,v)*y(u,v), pos(u,v)*z(u,v), \
neg(u,v)*x(u,v), neg(u,v)*y(u,v), neg(u,v)*z(u,v)

You might also like