function E=getE(W)
Input:
- W: Expansion coefficients for
unconstrained wave functions, stored as an
matrix
Global variables:
- gbl_Vdual: Dual potential coefficients stored as a
column vector.
- gbl_f: State fillings stored as an
column vector.
Output:
- E: Energies summed over
states
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
where
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
2006-04-26