# So, I found a FORTRAN thing that calculates the time dependent shroedinger equation.

Ok here I’m thinking, “Oh, it’ll be easy to find a program that calculates this, look at the code and it’ll unravel the processes going on”. lol. not *quite* that easy.

Still, well written code is commented so even if I can’t read code, reading the programmers comments is always enlightening… usually.. sometimes.

So, I found a FORTRAN thing that calculates the time dependent shroedinger equation. This is just a part of it. Getting rid of the code and leaving just comments… it gives SOME clue that it’s a can of worms here.

! Construct ADT to contain nonzero blocks of block tridiagonal
! Atom-field Hamiltonian
! Exploit the block tri-diagonal structure of the Hamiltonian Matrix
! construct and read data into trihm structure
! Execute before the first time step

! add Hamiltonian and dipole blocks into structure:
! Arnoldi_Lanczos Procedure for a given time step
! Strategy:
! (1) matrix-vector multiply for real block tridiagonal matrix
! [stored in structure trihm] and complex vector
! (2) Shared memory parallelism using OpenMP
! (3) Use pointers to minimize the need to shift data
! Arnoldi loop starts here. Must be sequential

! Modified Gram-Schmidt orthogonalization scheme.
! check norm:
! Update size of the Krylov subspace:
! Only vectors with norms > smallest norm will be kept
! If cid_krylov = ‘ENTIRE_LOOP’`=> whole Arnoldi loop is performed;
! and no vectors with norm smaller than smallestnorm available.
! If cid_krylov = ‘EXIT___LOOP’, it means the norm of one vector is
! smaller than smallestnorm adn triggers an exit of the loop.
! Building the Hamiltonian matrix in the Krylov subspace;
! Hamiltonian in Krylov subspace is Real Symmetric Tridiagonal matrix

! Diagonalizing the Tridiagonal Hamitonian matrix in Krylov subspace;
! Obtain eigenvaluess and eigenvectors of tridiagonal matrix:
! henergy = diag els of tridiagonal matrix
! sub_hmattrid = sub-diagonal els of matrix
! eigenvect = orthog matrix used in the reduction to tridiagonal

! Obtain eigenvalues and eigenvectors of tridiagonal matrix:
! henergy = diag els of tridiagonal matrix
! sub_hmattrid = sub-diagonal els of matrix
! eigenvect = orthog matrix used in the reduction to tridiagonal

! Final output is ‘array_temp_2′;
! Normalizing the wave function for output;
!
! If the results are reasonable, generally, the ‘temp’ given below
! will be unity. Be careful, in some cases, the ‘temp’ for the first
! Krylov vector is NOT unity. This is a signal of a poor setting of
! the parameter ‘smallestnorm’. If this happens, ‘smallestnorm’ is
! too small. A warning message will be issued.
! In this case, a vector with the norm of almost zero value is included
! in the Krylov iteration. That could cause problems in the next
! Krylov iteration. Something to be avoided!