This material has been prepared and made freely available by the financial support of National Science Foundation (CAREER, CHE-0844448 and CHE-1118616) and Camille and Henry Dreyfus Foundation, Inc. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author and do not necessarily reflect the views of the sponsoring agencies. © So Hirata, University of Illinois at Urbana-Champaign.

 

CHM 548 PROGRAMMING HOMEWORK 1

(1) Write a program that solves the one-dimensional Schrödinger equation for an arbitrary bound potential using a finite-difference method.

(2) Solve the particle in a box problem numerically with this program and compare the results with the analytical solutions. Plot the wave functions if possible.

(3) Solve the particle in a finite depth well problem. Examine the degree of permeation of wave functions into the wall.

(4) Solve the particle in a box problem with a rectangular barrier in the middle. Observe the tunneling splitting of energies.

(5) Solve the harmonic and Morse oscillator problems. Compute Franck–Condon factors across two (displaced) potentials and simulate a vibrational progression in an electronic absorption spectrum.

 

SCS computer clusters (request an account)

LINUX tutorial (a common operating system for scientific computing)

Vi tutorial (a widely used text editor on Linux)

Fortran 90 tutorial

C/C++ tutorial

Numerical Recipes (theories and sample codes of numerical analysis)

Gnuplot (a graphics utility)

Software Carpentry (software engineering tutorials)
OpenMP (thread parallel programming tool)

MPI (message-passing parallel programming tool)

BLAS, LAPACK, LINPACK (linear algebra libraries)

 

Fortran77/90/95

mkdir proj1

$ cd proj1

cp /home/sohirata/CHEM548/project1/tqli.f .

cp /home/sohirata/CHEM548/project1/pythag.f .

cp /home/sohirata/CHEM548/project1/sort.f .

$ vi oned.f

ls

oned.f  pythag.f  sort.f  tqli.f

mpif90 -o oned oned.f pythag.f sort.f tqli.f

ls

oned  oned.f  pythag.f  sort.f  tqli.f

./oned 

 mass =    100.000000000000

 analytical

           1  4.934825280000000E-002

           2  0.197393011200000

           3  0.444134275200000

           4  0.789572044800000

           5   1.23370632000000

 numerical

           1  4.740917256227306E-002

           2  0.189590824936438

           3  0.426407405556491

           4  0.757629809675279

           5   1.18293760100845

 

C/C++

mkdir proj1

cd proj1

cp /home/sohirata/CHEM548/project1/tqli.f .

cp /home/sohirata/CHEM548/project1/pythag.f .

cp /home/sohirata/CHEM548/project1/sort.f .

$ vi oned.c

mpif90 -o oned oned.c  pythag.f sort.f tqli.f

ls

oned  oned.c  oned.f  pythag.f  sort.f  tqli.f 

./oned

mass = 100.000000

analytical

1    0.0493482528

2    0.1973930112

3    0.4441342752

4    0.7895720448

5    1.2337063200

numerical

1    0.0474091726

2    0.1895908249

3    0.4264074056

4    0.7576298097

5    1.1829376010

 

BLAS/LAPACK/LINPACK (instead of Numerical Recipes; read header comment lines in LAPACK files for instruction; for example, DGEEV in dgeev.f of LAPACK performs diagonalization of a real nonsymmetric matrix.)

$ cp /home/sohirata/blas.tar.gz .
$ tar xvf blas.tar.gz
$ cd blas
$ make
$ cd ../lapack
$ make
$ cd ../linpack
$ make
$ ranlib lapack/lapack.a blas/blas.a linpack/linpack.a
...
$
mpif90 -o oned oned.f lapack/lapack.a blas/blas.a linpack/linpack.a

 

MPI
$ cp /home/sohirata/mpitest.tar.gz .
$ tar xvf mpitest.tar
$ cd mpitest
$ mpicc -o hello hello.c
$ mpiexec -n 4 ./hello

 

OPENMP
$ cp /home/sohirata/openmp.tar.gz .
$ tar xvf openmp.tar
$ cd openmp
$ mpif90 -fopenmp -o hello hello.f
$ ./hello