homework-01
homework-01
Departamento de Física
Lectures by Pedro Borlido, Tiago Cerqueira
• The solution of the problem was tested on an a machine with an M1 processor, and the worst
runtime for a single run was about 15 min. The actual running times will depend on your
system but they should be at most around this order of magnitude.
• Although the total run time of the calculations might at times be longer than the practical
classes, use this time wisely. There is no need for you to wait looking at the screen for all
calculations to be over when you could be doing something else...
• Please read the text carefully. If you find any typos/mistakes, please let us know.
1 Introduction
Hydrogen, besides being the simplest atom, is also a staple of quantum mechanics’ courses every-
where. This system is one of few for which the Schrödinger equation can be exactly solved analit-
ically, which is done by separation of variables and passing to spherical (or some times parabolic)
coordinates. We can also define the hydrogen atom in other dimensions, for example in 1D. One
would expect that this would make the problem much easier to solve, but the dimension reduction
leaves us with a potential,
1
V (x) = − , (1)
|x|
with a non-integrable singularity at the origin. As such, it is not possible to find a direct solution to
this problem...
However, the problematic point in the domain of the problem can be avoided in several ways, the
most common of which is to use modified versions of the Coulomb kernel. One example of a soft
Coulomb potential is built with the cartesian metric, defined as
1
V (x) = − p , (2)
a2 + x2
which has the advantage of being differentiable everywhere. These potentials can then be studied in
the a → 0 limit, or the a constant could even be fitted to reproduce some experimental value. The
1
Estrutura Electrónica e Modelação Computacional Homework - 01
purpose of the present exercise is to study this system in 1D using octopus. Please use a = 1 for
the remaining of the exercise!
The goal of this homework is to study the first 9 excited states of this 1D hydrogen atom. This
means using octopus to obtain accurate numerical results for this system.
2 Preliminaries
2.1 Input
To solve this problem, you will have to apply the concepts of the practical classes: build an input file,
convergence with respect to the spacing and radius size of the real space grid used by octopus...
Before starting, to ensure that youy calculations are correct, we add a few flags, the meaning of
which will become clearer in later classes.
Whenever running octopus for the purposes of this homework, add the following flags to your
input file and keep them unless otherwise specified:
Eigensolver = cg
MaximumIter = 5000
ExtraStates = 15
OutputWfsNumber = "1-10"
ConvEigenError = true
EigensolverTolerance = 1e-6
EigensolverMaxIter = 60
As you have seen, octopus solves the Schrodinger equation in an iterative manner, the so-called
self consistent cycle. This is extremely useful for integro-diferential equations (e.g. the Hartree-
Fock euqations), although for simple systems like this one you could simply one-shot diagonalize
the discretized Hamiltonian. Overall, at this point you can think of the entire process simply as an
interative diagonalization. Before starting, make sure to use the following flags on your input files:
• Eigensolver = cg: this specifies the algorithm used to solve the underlying eigenvalue
problem. In this case we choose a particular implementation of the conjugated gradient algo-
rithm.
• MaximumIter = 5000: this defines the maximum number of iterations to be done. Here we
set it at 5000 for safety.
• ExtraStates = 15: we will be adding 15 empty states to the calculation. Although we will
not use all of them, adding more states helps with the convergence of the ones lower in energy
at the cost of slower calculations.
Page 2
Estrutura Electrónica e Modelação Computacional Homework - 01
• OutputWfsNumber = "1-10": this flag specifies the range of wavefunctions to output. Here
we will only be using the first ten.
• ConvEigenError = true: this flag means that the calculation will not be considered con-
verged unless all states have individual errors less than EigensolverTolerance.
In practice we choose to use these flags to minimize the error coming from the eigensolver, i.e., you
can assume that the error on the calculation of the eigenvalues is around 1e-5.
2.2 Convergence
As you have seen from the practical classes, in order to solve the Schrodinger equation, octopus
approximates the differential problem by discretizing the real space line and transforming it into
a matrix problem (this is acutally true for most techniques). In doing this we make use of some
approximations which introduce errors in the results, which can be minimized by adequatly choosing
some cutoff parameters. For octopus, the two most relevant parameters are the spacing and the
radius of the simulation box (this is true for the type of problems we are dealing with; in reality
several other exist). If you had infinite computer power, the choice for these parameters would be
trivial (spacing to 0 and radius to ∞ recover the exact results) but since this is not the case, you
have to use coarser cutoffs and incur in a certain error on the quantities you are interested in.
For a given system, assume that a certain property of interest has the exact value A∗ . Now, for a
given set of cutoff parameters - here just radius R and spacing h - the actual value you compute will
in general be different: let’s call that A(R, h). The absolute error in this quantity for the chosen (R, h)
is then:
δ(R, h) = |A∗ − A(R, h)| . (3)
If improving the cutoffs systematically leads to a reduction of the error then you can say that
at the (R, h) cutoffs the calculation of property A is converged within δ(R, h) of the real value.
The choice of δ depends on the accuracy you need for your work and the computer resources you
can afford. This represents a delicate balance, and once you set your desired accuracy, you should
use the coarsest cutoff criteria that satisfy it in order to save computer time. In addition to this, there
are several different measures of error so be carefull of stating explicitly what you are considering
for your work.
The above definition is useful if you know the actual solution to your problem, but if that is the case
you have no real problem to begin with (e.g. the harmonic oscillator problem of Class 2). In practical
situations where you do not know A∗ some weaker arguments must be used:
Page 3
Estrutura Electrónica e Modelação Computacional Homework - 01
• Sometimes the qualitative behaviour of the convergence is known (e.g. the quantity might
converge exponentially) and it becomes easy to extrapolate the converged value. This is not
common. . .
• More often, you just improve the cutoffs and check the evolution of the values. After a cer-
tain while the variations on the target quantity become significantly smaller than a your error
threshold and you can stop the convergence procedure.
3 Questions
Answer the following questions regaring the numerical and physical aspect of the problem. Remem-
ber that you must justify your answers adequately (convergence tests, wavefunctions/densities plots,
inputs, etc.) Remember to use a = 1!
(a) Study the evolution of the eigenvalues with respect to the radius and the spacing. How do
these quantities evolve with respect to the cutoff parameters? (Hint: you can do a simple loop
as specified at the end of the script)
(b) For which values of radius and spacing are the first 10 eigenvalues converged? (Hint: do not
forget the considerations above; take into consideration the scale of the quantities at hand)
(c) Using the parameters you found for convergence, compute the 10 first states of this system.
What are the eigenvalues of the 1D hydrogen atom up to the 9th excited state?
(d) We now move on to the wavefunctions. Since this is a finite system, how should the wavefunc-
tion behave in the x → ∞ limit?
(e) Look at the wavefunctions you computed for the ground state and 9-th excited state, calculated
with the radius and spacing found for the convergence of the energy. Which regions of behaviour
can you distinguish?
(f) Do the wave functions decay with the expected behaviour? What do you conclude about the
used cutoff parameters?
(g) What can you say about the nature of the wavefunctions of this system? Can they be grouped
according to some characteristic? Do they share some properties of the 3D radial wavefunction?
(h) Considering the form of the 3D hydrogen spectra, put foward an educated guess on the form of
the spectra for the 1D case. In case you fit any coefficients, plase indicate which data was used
for this purpose.
Page 4