Download presentation
Presentation is loading. Please wait.
Published byLucy Thompson Modified over 9 years ago
1
Hydrogen Orbital 3D-data into DX format Byun Jae Duk
2
Running Program [bjdpjq@comphys DX_function]$./wavefunction.x ===================================== |Depart of physics, Dankook University | |Program calculates | | the Hydrogen-wavefunction | | (DX format) | |Written by Prof. Park Noejung and Byun Jae Duk | | (Solid State Physics Lab) | ===================================== What kind of orbital? (1s,2s,2px,2py,2pz,3s,3px,3py,3pz,3dz2,3dxz,3dyz,3dx2y2,3dxy) 2px
3
Running Program Enter the BOX size, LatX, LatY, LatZ 10 10 10 Enter the grid n1, n2, n3 10 10 10 The orbital to be calculated:2px Enter the output file name 2px_text The output file name will be : 2px_text.dx Maximum density= 0.2959440 Minimum density= -0.2959440 [bjdpjq@comphys DX_function]$ ls 2px_test.dx wavefunction.x function_DX.f90
4
DX file format object 1 class array items 1000 data follows -0.59241E-02 -0.73789E-02 -0.79514E-02 -0.69445E-02 -0.41035E-02 0.00000E+00 0.41035E-02 0.69445E-02 0.79514E-02 0.73789E-02. -0.14747E-01 -0.19478E-01 -0.22174E-01 -0.20274E-01 -0.12355E-01 0.00000E+00 0.12355E-01 0.20274E-01 0.22174E-01 0.19478E-01 attribute "dep" string "positions“ object 2 class gridpositions counts 10 10 10 origin 0.0 0.0 0.0 delta 0.000000 0.000000 1.000000 delta 0.000000 1.000000 0.000000 delta 1.000000 0.000000 0.000000 object 3 class gridconnections counts 10 10 10 attribute "elements type" string "cubes" attribute "ref" string "positions" object "electron density" class field component "data" 1 component "positions" 2 component "connections" 3
5
Program source code program main dimension Rc(3), R(3) integer n1, n2, n3 real, allocatable :: fu(:) real rad,L(3),rho(3) character (len = 7):: orbname character*20 oufina, infina, paste rbohr = 0.529177249 xpi = 4.0*atan(1.0) Znuc = 1.0 write(6,*)'==================================' write(6,*)'|Depart of physics, Dankook University |' write(6,*)'|Program calculate |' write(6,*)'| the Hydrogen-wavefunction |' write(6,*)'| (DX format) |' write(6,*)'|Written Prof.Park Noejung and Byun Jae Duk |' write(6,*)'| (Solid State Physics Lab) |' write(6,*)'==================================' write(6,*)
6
Program source code write(6,*)'What kind of orbital? ' write(6,*)'(1s,2s,2px,2py,2pz,3s,3px,3py,3pz,3dz2,3dxz,3dyz,3dx2y2,3dxy)' read(5,*)orbname write(6,*)'Enter the BOX size, LatX, LatY, LatZ' read(5,*)L(1), L(2), L(3) write(6,*)'Enter the grid n1, n2, n3' read(5,*)n1, n2, n3 write(6,*)'The orbital to be calculated:',orbname write(6,*)'Enter the output file name' read(5,*)infina oufina= paste(infina,'.dx') write(6,*)'The output file name will be : ', oufina LatX/n1 LatZ/n3 LatY/n2
7
Program source code Rc(:) = L(:)/2 indg = 0 allocate (fu(n1*n2*n3)) do k = 1,n3 do j = 1,n2 do i = 1,n1 indg = indg + 1 x = (float(i) - 1.0) * (L(1)/float(n1)); y = (float(j) - 1.0) * (L(2)/float(n2)) z = (float(k) - 1.0) * (L(3)/float(n3)) rho(1) = x; rho(2) = y; rho(3) = z rho(:) = rho(:) - Rc(:) rad = sqrt( sum(rho(:)**2.) ) fu(indg) = xphi(rad,rho,orbname) enddo; enddo; enddo
8
Program source code function xphi(rad,rho,orbname) character (len = 7):: orbname real Head,rad,rho(3) rbohr = 0.529177249 xpi = 4.0*atan(1.0) Znuc = 1.0 !.... Znuc : Atomic Number of the Atom !.... rbohr : Bohr radius xphi = 0.0 if(orbname.eq.'1s')then Head = 1./sqrt(xpi) * (Znuc/rbohr)**1.5 xphi = Head*rad * exp(-(Znuc*rad)/rbohr) elseif(orbname.eq.'2s')then Head = 1./(4.0*sqrt(2*xpi))*(Znuc/rbohr)**1.5*(2.-(Znuc*rad)/rbohr) xphi = Head*rad*exp(-(Znuc*rad)/(2.*rbohr)). End if
9
Program source code denmax = -1000; denmin = 1000 do i = 1,n1*n2*n3 wtmp = fu(i) if(wtmp.ge.denmax)denmax = wtmp if(wtmp.le.denmin)denmin = wtmp enddo write(6,*)'Maximum density=', denmax write(6,*)'Minimum density=', denmin
10
Program source code dx = L(1)/n1 dy = L(2)/n2 dz = L(3)/n3 open(19,file=oufina) rewind 19 write(19,'(a,2i5)')'#',3,2 write(19,'(a,3i5)')'#',n3,n2,n1 write(19,'(a,6f15.7)')'#',0.0,(L(1)-dz),0.0,(L(2)-dy),0.0,(L(3)-dx) write(19,'(a,i10,a)')'object 1 class array items ', n1*n2*n3,' data follows' do k = 1,n3 nxyp = (k-1)*n1*n2 write(19,'(5e15.5)')(fu(i + nxyp),i=1,n1*n2) enddo
11
Program source code write(19,'(a)')'attribute "dep" string "positions"' write(19,*) write(19,'(a,3i5)')'object 2 class gridpositions counts',n3,n2,n1 write(19,'(a)')'origin 0.0 0.0 0.0' write(19,'(a,3f12.6)')'delta ',0.0, 0.0, dz write(19,'(a,3f12.6)')'delta ',0.0, dy, 0.0 write(19,'(a,3f12.6)')'delta ',dx, 0.0, 0.0 write(19,*) write(19,'(a,3i5)')'object 3 class gridconnections counts ',n3,n2,n1 write(19,'(a)')'attribute "elements type" string "cubes"' write(19,'(a)')'attribute "ref" string "positions"' write(19,*) write(19,'(a)')'object "electron density" class field' write(19,'(a)')'component "data" 1' write(19,'(a)')'component "positions" 2' write(19,'(a)')'component "connections" 3' close(19) stop end
12
Program source code ! $Id: paste.f,v 1.4 2002/02/04 16:02:09 javier Exp $ CHARACTER*(*) FUNCTION PASTE( STR1, STR2 ) ! CONCATENATES THE STRINGS STR1 AND STR2 REMOVING ! BLANKS IN BETWEEN ! Written by J. Soler CHARACTER*(*) STR1, STR2 DO 10 L = LEN( STR1 ), 1, -1 IF (STR1(L:L).NE. ' ') GOTO 20 10 CONTINUE 20 PASTE = STR1(1:L)//STR2 END
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.