Getting started

The objective of this tutorial is to give a basic idea of how Octopus works.

Generating the input file

With a text editor, create a text file called inp containing the following text:


CalculationMode = gs

%Coordinates
 'H' | 0 | 0 | 0
%

Spacing = 0.25 * angstrom
Radius = 4.0 * angstrom

This is the simplest example of an Octopus input file:

The reason this input file can be so simple is that Octopus comes with default values for the simulation parameters, and a set of default pseudopotentials for several elements (for properly converged calculations you might need to adjust these parameters, though).

To get a general idea of the format of the Octopus input file, go and read the page about the Input file in the manual.

The documentation for each input variable can be found in the variable reference online, and can also be accessed via the oct-help utility.

Running Octopus

Once you have written your input file, run the octopus command (using mpirun and perhaps a job script if you are using the parallel version). If everything goes correctly, you should see several lines of output in the terminal (if you don’t, there must be a problem with your installation). As this is probably the first time you run Octopus, we will examine the most important parts of the output.

Be aware that the precise values you find in the output might differ from the ones in the tutorial text. This can be due to updates in the code, or also changes in the compilation and run configuration.



    <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
                                ___
                             .-'   `'.
                            /         \
                            |         ;
                            |         |           ___.--,
                   _.._     |0) ~ (0) |    _.---'`__.-( (_.
            __.--'`_.. '.__.\    '--. \_.-' ,.--'`     `""`
           ( ,.--'`   ',__ /./;   ;, '.__.'`    __
           _`) )  .---.__.' / |   |\   \__..--""  """--.,_
          `---' .'.''-._.-'`_./  /\ '.  \ _.-~~~````~~~-._`-.__.'
                | |  .' _.-' |  |  \  \  '.               `~---`
                 \ \/ .'     \  \   '. '-._)
                  \/ /        \  \    `=.__`~-.
             jgs  / /\         `) )    / / `"".`\
            , _.-'.'\ \        / /    ( (     / /
             `--~`   ) )    .-'.'      '.'.  | (
                    (/`    ( (`          ) )  '-;
                     `      '-;         (-'

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

    <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

                           Running octopus

Version                : 15.0
Commit                 : 0bdc036117
Configuration time     : 2024-10-16T15:15:18
Configuration options  :  openmp mpi libxc_fxc libxc_kxc
Optional libraries     : cgal metis
Architecture           : x86_64
C compiler             : /usr/bin/cc
C compiler flags       :
C++ compiler           : /usr/bin/c++
C++ compiler flags     :
Fortran compiler       : /usr/bin/gfortran (GCC version 12.2.0)
Fortran compiler flags : -O3 -march=native -fno-var-tracking-assignments -ffree-line-length-none

          The octopus is swimming in cfelm-pcx65043 (Linux)


            Calculation started on 2024/10/16 at 15:40:35

Note that it also gives you the revision number, the compiler, and the compiler flags used. You should always include this information when submitting a bug report!

Just running the command octopus will write the output directly to the terminal. To have a saved copy of the output, it is generally advisable to redirect the output into a file, and to capture the standard error stream as well, which can be done like this: octopus &> log . That would create a file called log containing all output including warnings and errors in their context.

Analyzing the results

After finishing the calculation you will find a series of files in the directory you ran:


% ls
  exec inp restart static

For the moment we will ignore the ‘‘’exec’’’ and ‘‘‘restart’’’ directories and focus on the static/info file, which contains the detailed results of the ground-state calculation. If you open that file, first you will see some parameters of the calculations (that we already got from the output) and then the calculated energies and eigenvalues in Hartrees:


 Eigenvalues [H]
  #st  Spin   Eigenvalue      Occupation
    1   --    -0.233013       1.000000
 
 Energy [H]:
       Total       =        -0.44637705
       Free        =        -0.44637705
       -----------
       Ion-ion     =         0.00000000
       Eigenvalues =        -0.23301327
       Hartree     =         0.28415332
       Int[n*v_xc] =        -0.30429841
       Exchange    =        -0.19375604
       Correlation =        -0.03975282
       vanderWaals =         0.00000000
       Delta XC    =         0.00000000
       Entropy     =         1.38629436
       -TS         =        -0.00000000
       Kinetic     =         0.41780616
       External    =        -0.91483022
       Non-local   =         0.00000000

Since by default Octopus does a spin-unpolarized density-functional-theory calculation with the local-density approximation, our results differ from the exact total energy of 0.5 H. Our exchange-correlation functional can be set by the variable XCFunctional, using the set provided by the libxc library.

Extra

If you want to improve the LDA results, you can try to repeat the calculation with spin-polarization:


 SpinComponents = spin_polarized

And if you want to obtain the exact Schödinger equation result (something possible only for very simple systems like this one) you have to remove the self-interaction error (a problem of the LDA). Since we only have one electron the simplest way to do it for this case is to use independent electrons:


 TheoryLevel = independent_particles

A more general way would be to include self-interaction correction.