31.12.2013 Views

Numerical Methods in Quantum Mechanics - Dipartimento di Fisica

Numerical Methods in Quantum Mechanics - Dipartimento di Fisica

Numerical Methods in Quantum Mechanics - Dipartimento di Fisica

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The code requires the number N of sp<strong>in</strong>s and the number nup of up sp<strong>in</strong>s,<br />

computes the <strong>di</strong>mension nhil of the Hilbert space. It then proceeds to the<br />

label<strong>in</strong>g of the states, us<strong>in</strong>g a trick often employed for sp<strong>in</strong>-1/2 systems: an<br />

<strong>in</strong>teger <strong>in</strong>dex k, runn<strong>in</strong>g from 1 to 2 N −1, conta<strong>in</strong>s <strong>in</strong> its i−th bit the <strong>in</strong>formation<br />

(0=down, 1=up) for the i−th sp<strong>in</strong>. Of course this works only up to 32 sp<strong>in</strong>s,<br />

for default <strong>in</strong>tegers (or 64 sp<strong>in</strong>s for INTEGER(8)). The <strong>in</strong>teger k is stored <strong>in</strong>to<br />

array states for the states <strong>in</strong> the required Hilbert space.<br />

The Hamiltonian matrix is then filled (the code does not takes advantage of<br />

sparseness) and the number of nonzero matrix elements counted. For the S + S −<br />

and S − S + terms <strong>in</strong> the Hamiltonian, only matrix elements as <strong>in</strong> 11.5 and 11.6,<br />

respectively, are calculated. We remark that the l<strong>in</strong>e<br />

k = states(ii)+2**(j-1)-2**(i-1)<br />

is a quick-and-<strong>di</strong>rty way to calculate the <strong>in</strong>dex for the state obta<strong>in</strong>ed by flipp<strong>in</strong>g<br />

down sp<strong>in</strong> i and flipp<strong>in</strong>g up sp<strong>in</strong> j <strong>in</strong> state states(ii). 4<br />

We then proceed to the generation of the Lanczos cha<strong>in</strong>. The number nl of<br />

cha<strong>in</strong> steps (should not exceed nhil) is prompted for and read from term<strong>in</strong>al.<br />

The start<strong>in</strong>g vector is filled with random numbers. Note the new BLAS rout<strong>in</strong>es<br />

dnrm2 and dgemv: the former calculates the module of a vector, the latter a<br />

matrix-vector product and is used to calculate H|v〉.<br />

The Hamiltonian <strong>in</strong> tri<strong>di</strong>agonal form (conta<strong>in</strong>ed <strong>in</strong> the two arrays d and e)<br />

is then <strong>di</strong>agonalized by the LAPACK rout<strong>in</strong>e dsterf, that actually f<strong>in</strong>ds only<br />

the eigenvalues. The lowest eigenvalues is then pr<strong>in</strong>ted for <strong>in</strong>creas<strong>in</strong>g values of<br />

the <strong>di</strong>mension of the tri<strong>di</strong>agonal matrix, up to nl, so that the convergence of<br />

the Lanczos cha<strong>in</strong> can be estimated. You can mo<strong>di</strong>fy the code to pr<strong>in</strong>t more<br />

eigenvalues.<br />

As a f<strong>in</strong>al check, the matrix is <strong>di</strong>agonalized us<strong>in</strong>g the conventional algorithm<br />

(rout<strong>in</strong>e dspev). Note how much slower this f<strong>in</strong>al step is than the rest of the<br />

calculation! Once you are confident that the Lanczos cha<strong>in</strong> works, you can<br />

speed up the calculations by comment<strong>in</strong>g out the exact <strong>di</strong>agonalization step.<br />

The limit<strong>in</strong>g factor will become the size of the Hamiltonian matrix.<br />

11.4.1 Computer Laboratory<br />

• Exam<strong>in</strong>e the convergence of the Lanczos procedure to the exact energy<br />

• For the antiferromagnetic case, verify that the ground state has zero magnetization.<br />

Plot the ground-state energy E 0 and the first excited state E 1<br />

as a function of N. Try to verify if the gap E − E 0 has a 1/N dependence.<br />

• For the ferromagnetic case, verify that the ground state has all sp<strong>in</strong>s<br />

aligned. Note that the ground state will have the same energy no matter<br />

what total magnetization you choose! This is a consequence of the<br />

rotational <strong>in</strong>variance of the Heisenberg Hamiltonian. Verify that the case<br />

with N − 1 sp<strong>in</strong>s up corresponds to the sp<strong>in</strong>-wave solution, Eq.(11.11).<br />

You will need to pr<strong>in</strong>t all eigenvalues.<br />

4 A more elegant but hardly more transparent way would be to <strong>di</strong>rectly manipulate the<br />

correspond<strong>in</strong>g bits.<br />

83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!