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

 '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.

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.233108       1.000000

Energy [H]:
      Total       =        -0.44662938
      Free        =        -0.44662938
      Ion-ion     =         0.00000000
      Eigenvalues =        -0.23310828
      Hartree     =         0.28436697
      Int[n*v_xc] =        -0.30453467
      Exchange    =        -0.19392286
      Correlation =        -0.03976595
      vanderWaals =         0.00000000
      Delta XC    =         0.00000000
      Entropy     =         1.38629436
      -TS         =        -0.00000000
      Photon ex.  =         0.00000000
      Kinetic     =         0.41886422
      External    =        -0.91617152
      Non-local   =         0.00000000
      Int[n*v_E]  =         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.


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.