12.2. VARIATIONAL MONTE CARLO FOR QUANTUM MECHANICAL SYSTEMS227
double alpha , variance , err or ;
alpha = 0 .5 charge ;
for ( i =1; i <= max_variations ; i ++){
alpha += 0 . 1 ;
variance = cumulative_e2 [ i ] cumulative_e [ i ] cumulative_e [ i ] ;
e rr o r = s qr t ( variance / number_cycles ) ;
o f i l e < < s e t i o s f l a g s ( ios : : showpoint | ios : : uppercase ) ;
o f i l e < < setw (15) < < se t p r e c i s ion (8) < < alpha ;
o f i l e < < setw (15) < < se t p r e c i s ion (8) < < cumulative_e [ i ] ;
o f i l e < < setw (15) < < se t p r e c i s ion (8) < < variance ;
o f i l e < < setw (15) < < se t p r e c i s ion (8) < < e rro r < < endl ;
}
/ / f clos e ( o u t p u t _ f i l e ) ;
} / / end of fun ctio n output
In the program above one has to the possibility to study both the hydrogen atom and the
helium atom by setting the number of particles to either 1 or 2. In addition, we have not used the
analytic expression for the kinetic energy in the evaluation of the local energy. Rather, we have
used the numerical expression of Eq. (3.15), i.e.,
in order to compute
(12.75)
The variable
is a chosen step length. For helium, since it is rather easy to evaluate the local
energy, the above is an unnecessary complication. However, for many-electron or other many-
particle systems, the derivation of an analytic expression for the kinetic energy can be quite
involved, and the numerical evaluation of the kinetic energy using Eq. (3.15) may result in a
simpler code and/or even a faster one. The way we have rewritten Schrödinger’s equation results
in energies given by atomic units. If we wish to convert these energies into more familiar units
like electronvolt (eV), we have to multiply our reults with
where eV, the binding
energy of the hydrogen atom. Using Eq. (12.72) for the trial wave function, we obtain an energy
minimum at
. The ground state is in atomic units or eV. The
experimental value is eV. Obviously,improvements to the wave function such as including
the ’cusp’-condition for the two electrons as well, see Eq. (12.73), could improve our agreement
with experiment. We note that the effective charge is less than the charge of the nucleus. We
can interpret this reduction as an effective way of incorporating the repulsive electron-electron
interaction. Finally, since we do not have the exact wave function, we see from Fig. 12.4 that the
variance is not zero at the energy minimum.