Octopus
propagator_exp_mid_2step.F90
Go to the documentation of this file.
1!! Copyright (C) 2020 Nicolas Tancogne-Dejean, Sebastian Ohlmann, Heiko Appel
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
22 use, intrinsic :: iso_fortran_env
24 use debug_oct_m
25 use global_oct_m
27
28 implicit none
29
30 private
31 public :: &
33
35
37 private
39
41 procedure propagator_exp_mid_2step_constructor
42 end interface propagator_exp_mid_2step_t
43
44 !# doc_start exp_mid_2step_propagation_operations
45 ! Specific exponential mid-point propagation operations identifiers
46 character(len=ALGO_LABEL_LEN), public, parameter :: &
47 EXPMID_2STEP_START = 'EXPMID_2STEP_START', &
48 expmid_2step_finish = 'EXPMID_2STEP_FINISH', &
49 expmid_2step_predict_dt_2 = 'EXPMID_2STEP_PREDICT_DT_2', &
50 expmid_2step_predict_dt = 'EXPMID_2STEP_PREDICT_DT', &
51 expmid_2step_correct_dt_2 = 'EXPMID_2STEP_CORRECT_DT_2', &
52 update_hamiltonian = 'UPDATE_HAMILTONIAN'
53
54 ! Specific exponential mid-point propagation operations
55 type(algorithmic_operation_t), public, parameter :: &
56 OP_EXPMID_2STEP_START = algorithmic_operation_t(expmid_2step_start, &
57 'Starting exponential mid-point propagation'), &
59 'Finishing exponential mid-point propagation'), &
61 'Prediction step - Predicting state at dt/2 '), &
63 'Prediction step - Predicting state at dt'), &
65 'Correction step - Correcting state at dt/2'), &
67 !# doc_end
68
69contains
70
71 ! ---------------------------------------------------------
72 function propagator_exp_mid_2step_constructor(dt, predictor_corrector) result(this)
73 float, intent(in) :: dt
74 logical, intent(in) :: predictor_corrector
75 type(propagator_exp_mid_2step_t), pointer :: this
76
78
79 allocate(this)
80
81 this%predictor_corrector = predictor_corrector
82 this%start_operation = op_expmid_2step_start
83 this%final_operation = op_expmid_2step_finish
84
85 if (predictor_corrector) then
86
87 call this%add_operation(op_store_current_status)
88 call this%add_operation(op_expmid_2step_predict_dt_2) ! predict: psi(t+dt/2) = 0.5*(U_H(dt) psi(t) + psi(t)) or via extrapolation
89 call this%add_operation(op_update_couplings)
90 call this%add_operation(op_start_scf_loop)
91 call this%add_operation(op_update_interactions)
92 call this%add_operation(op_update_hamiltonian) ! update: H(t+dt/2) from psi(t+dt/2)
93 call this%add_operation(op_expmid_2step_predict_dt) ! predict: psi(t+dt) = U_H(t+dt/2) psi(t)
94 call this%add_operation(op_expmid_2step_correct_dt_2) ! correct: psi(t+dt/2) = 0.5*(psi(t+dt) + psi(t))
95 call this%add_operation(op_end_scf_loop)
96 call this%add_operation(op_iteration_done)
97 call this%add_operation(op_rewind_algorithm)
98
99 this%max_scf_count = 10
100 this%scf_tol = 1e-6_real64 ! At the moment arbitrary. This is system specific and should be adapted.
101
102 else
103
104 call this%add_operation(op_store_current_status)
105 call this%add_operation(op_expmid_2step_predict_dt_2) ! predict: psi(t+dt/2) = 0.5*(U_H(dt) psi(t) + psi(t)) or via extrapolation
106 call this%add_operation(op_update_couplings)
107 call this%add_operation(op_update_interactions)
108 call this%add_operation(op_update_hamiltonian) ! update: H(t+dt/2) from psi(t+dt/2)
109 call this%add_operation(op_expmid_2step_predict_dt) ! predict: psi(t+dt) = U_H(t+dt/2) psi(t)
110 call this%add_operation(op_update_couplings)
111 call this%add_operation(op_update_interactions)
112 call this%add_operation(op_update_hamiltonian) ! update: H(t+dt) from psi(t+dt)
113 call this%add_operation(op_iteration_done)
114 call this%add_operation(op_rewind_algorithm)
115
116 end if
117
118 ! The implicit exponential midpoint has two algorithmic steps
119 this%algo_steps = 2
121 this%dt = dt
122
125
127
128
129!! Local Variables:
130!! mode: f90
131!! coding: utf-8
132!! End:
This module implements the basic elements defining algorithms.
Definition: algorithm.F90:132
type(algorithmic_operation_t), parameter, public op_iteration_done
Definition: algorithm.F90:170
type(algorithmic_operation_t), parameter, public op_rewind_algorithm
Definition: algorithm.F90:170
type(algorithmic_operation_t), parameter, public op_update_couplings
Definition: algorithm.F90:170
type(algorithmic_operation_t), parameter, public op_update_interactions
Definition: algorithm.F90:170
character(len=algo_label_len), parameter, public expmid_2step_predict_dt
character(len=algo_label_len), parameter, public expmid_2step_finish
character(len=algo_label_len), parameter, public expmid_2step_correct_dt_2
type(algorithmic_operation_t), parameter, public op_expmid_2step_predict_dt
character(len=algo_label_len), parameter, public update_hamiltonian
type(algorithmic_operation_t), parameter, public op_update_hamiltonian
type(algorithmic_operation_t), parameter, public op_expmid_2step_finish
type(propagator_exp_mid_2step_t) function, pointer propagator_exp_mid_2step_constructor(dt, predictor_corrector)
character(len=algo_label_len), parameter, public expmid_2step_predict_dt_2
type(algorithmic_operation_t), parameter, public op_expmid_2step_predict_dt_2
type(algorithmic_operation_t), parameter, public op_expmid_2step_correct_dt_2
This module implements the basic propagator framework.
Definition: propagator.F90:108
type(algorithmic_operation_t), parameter, public op_store_current_status
Definition: propagator.F90:163
type(algorithmic_operation_t), parameter, public op_start_scf_loop
Definition: propagator.F90:163
type(algorithmic_operation_t), parameter, public op_end_scf_loop
Definition: propagator.F90:163
Descriptor of one algorithmic operation.
Definition: algorithm.F90:154
Implements the implicit exponential midpoint propagator with predictor-corrector.
Abstract class implementing propagators.
Definition: propagator.F90:129