Algorithms

Work in progress!

In Octopus, many operations, such as time propagations, geometry optimization, etc. are implemented in terms of algorithms. An algorithm, in general, contains a set of instructions, which are performed in a well-defined order.

Algorithm container

The algorithm_t class itself, is only an extention of the linked list.

Definition of algorithm_t

Algorithmic operations can be added with the function add_operation(). Examples are discussed in the section Propagators.

Algorithm iterator

Definition of algorithm_iterator_t

Algorithmic operations

Definition of algorithmic_operation_t

Some global algorithmic steps are defined in multisystem/propagator.F90:


  ! Known propagation operations
  character(len=ALGO_LABEL_LEN), public, parameter ::   &
    SKIP                 = 'SKIP',                      &
    FINISHED             = 'FINISHED',                  &
    UPDATE_INTERACTIONS  = 'UPDATE_INTERACTIONS',       &
    START_SCF_LOOP       = 'START_SCF_LOOP',            &
    END_SCF_LOOP         = 'END_SCF_LOOP',              &
    STORE_CURRENT_STATUS = 'STORE_CURRENT_STATUS'

  type(algorithmic_operation_t), public, parameter :: &
    OP_SKIP                 = algorithmic_operation_t(SKIP, 'Skipping propagation step'), &
    OP_FINISHED             = algorithmic_operation_t(FINISHED,             'Propagation step finished'), &
    OP_UPDATE_INTERACTIONS  = algorithmic_operation_t(UPDATE_INTERACTIONS,  'Propagation step - Updating interactions'),     &
    OP_START_SCF_LOOP       = algorithmic_operation_t(START_SCF_LOOP,       'Starting SCF loop'),         &
    OP_END_SCF_LOOP         = algorithmic_operation_t(END_SCF_LOOP,         'End of SCF iteration'),      &
    OP_STORE_CURRENT_STATUS = algorithmic_operation_t(STORE_CURRENT_STATUS, 'Store current status')

Derived propagators can then add their own steps, such as e.g. in multisystem/propagator_verlet.F90:


  ! Specific verlet propagation operations identifiers
  character(len=30), public, parameter ::      &
    VERLET_START       = 'VERLET_START',       &
    VERLET_FINISH      = 'VERLET_FINISH',      &
    VERLET_UPDATE_POS  = 'VERLET_UPDATE_POS',  &
    VERLET_COMPUTE_ACC = 'VERLET_COMPUTE_ACC', &
    VERLET_COMPUTE_VEL = 'VERLET_COMPUTE_VEL'

  ! Specific verlet propagation operations
  type(algorithmic_operation_t), public, parameter :: &
    OP_VERLET_START       = algorithmic_operation_t(VERLET_START,       'Starting Verlet propagation'),               &
    OP_VERLET_FINISH      = algorithmic_operation_t(VERLET_FINISH,      'Finishing Verlet propagation'),              &
    OP_VERLET_UPDATE_POS  = algorithmic_operation_t(VERLET_UPDATE_POS,  'Propagation step - Updating positions'),     &
    OP_VERLET_COMPUTE_ACC = algorithmic_operation_t(VERLET_COMPUTE_ACC, 'Propagation step - Computing acceleration'), &
    OP_VERLET_COMPUTE_VEL = algorithmic_operation_t(VERLET_COMPUTE_VEL, 'Propagation step - Computing velocity')

It is important to stress here, that one algorithmic step, in general, does not advance any clock. Clocks are only advanced in steps which update the corresponding entity, which could be a system, an exposed quantity or an interaction. It is therefore quite common, that at a specific state of the algorithm, clocks or different entities have different values.