!Program name: RECURSIVE !calculate the factorial of a number n! program recursive integer :: i, f character (len=1) :: answer Print *, 'Input the value to be factorized: ' Read *, i ! Variable function: f = factorial(i) Print *, 'The value of factorial of', i, ' is: ' Print *, f 10 Print *, 'Do you want to calculate another factorial (Y/N)?' Read *, answer If (answer == 'Y') then Print *, 'Input another value to be factorized: ' Read *, i f = factorial(i) Print *, 'The value of the factorial of ', i, ' is: ' Print *, f Go to 10 else print *, 'Ok. Goodbye.' end if end program recursive ! computes the factorial of n (n!) recursive function factorial (n) result (fac) ! function result implicit none ! dummy arguments integer :: fac integer, i
!--------------------------------------------------------------- !Program name: HYDROGEN-RADIAL !Radial equation of the hydrogen-like atom !Objective: plot the radial wave function for each n,l pair ! The equation is atomic units !--------------------------------------------------------------- !The Coulomb potential energy equation is: ! V(r) = -2Z/r ! The ceentrifugal potential equation is: ! VL=l(l+1)/r^2 ! The energy is: ! E=-2*Z/n^2 !--------------------------------------------------------------- ! Use of Numerov method to find the wave function ! Function fn from Numerov equation is ! Fn = 1 + K2*h^2/12 , where K2=-2(Veff - E) ! In the code, h is changed into dr !--------------------------------------------------------------- Program hydrogen Implicit none integer :: mesh, n, l, i, j, zeta, m, maxiter=100 Real*8 rmin, dr, zmesh, y_out_m double precision :: e, fh12, norm, eps=1.0E-6 double precision, allocatable :: r(:), r2
Comentários
Postar um comentário