getE()

function E=getE(W)

Input:

Global variables:

Output:

Modify getE() to accept variable fillings as above. Note that, because getE() now simply passes gbl_f to getn(), there is nothing to change for the calculation of the electron density and associated terms. The calculation of the kinetic energy, however, must change. In our matrix language, the new expression is

\begin{displaymath}
T=-\frac{1}{2} \mbox{Tr\,}\left( (\mbox{\bf Diag\,} \vec f) \left(Y^\dagger
L Y \right)\right),
\end{displaymath}

where $Y$ is the matrix of expansion coefficients for the orthonormal wave functions.
Hint: The extra parentheses in the above expression limit the size of and number computations required in evaluating intermediate expressions.



Tomas Arias 2007-04-26