Octopus
minimizer_scf.F90
Go to the documentation of this file.
1!! Copyright (C) 2024 N. Tancogne-Dejean
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
23 use debug_oct_m
24 use global_oct_m
27
28 implicit none
29
30 private
31 public :: &
33
36 private
37 contains
38 procedure :: do_operation => minimizer_scf_do_operation
39 end type minimizer_scf_t
40
41 interface minimizer_scf_t
42 procedure minimizer_scf_constructor
43 end interface minimizer_scf_t
44
45 ! Specific SCF algorithmic operations identifiers
46 character(len=ALGO_LABEL_LEN), public, parameter :: &
47 GS_SCF_START = 'GS_SCF_START', &
48 gs_scf_finish = 'GS_SCF_FINISH', &
49 gs_scf_iteration = 'GS_SCF_ITERATION'
50
51 ! Specific SCF algorithmic operations
52 type(algorithmic_operation_t), public, parameter :: &
53 OP_GS_START = algorithmic_operation_t(gs_scf_start, 'Starting ground state SCF'), &
54 op_gs_finish = algorithmic_operation_t(gs_scf_finish, 'Finishing ground state SCF'), &
55 op_gs_scf_iteration = algorithmic_operation_t(gs_scf_iteration, 'SCF iteration for the electrons')
56
57
58
59contains
60
61 ! ---------------------------------------------------------
62 function minimizer_scf_constructor() result(this)
63 type(minimizer_scf_t), pointer :: this
64
66
67 allocate(this)
68
69 this%start_operation = op_gs_start
70 this%final_operation = op_gs_finish
71
72 call this%add_operation(op_update_couplings)
73 call this%add_operation(op_update_interactions)
74 call this%add_operation(op_gs_scf_iteration)
75 call this%add_operation(op_iteration_done)
76 call this%add_operation(op_rewind_algorithm)
77
78 this%algo_steps = 1
79
80
82 end function minimizer_scf_constructor
83
86 logical function minimizer_scf_do_operation(this, operation) result(done)
87 class(minimizer_scf_t), intent(inout) :: this
88 type(algorithmic_operation_t), intent(in) :: operation
89
90 select case(operation%id)
91 case (gs_scf_iteration) ! If we are converged, this becomes a void operation
92 if (this%finished()) done = .true.
93 case default
94 ! Nothing done yet here
95 done = .false.
96 end select
97
99
100
101end module minimizer_scf_oct_m
102
103!! Local Variables:
104!! mode: f90
105!! coding: utf-8
106!! End:
This module implements the basic elements defining algorithms.
Definition: algorithm.F90:141
type(algorithmic_operation_t), parameter, public op_iteration_done
Definition: algorithm.F90:179
type(algorithmic_operation_t), parameter, public op_rewind_algorithm
Definition: algorithm.F90:179
type(algorithmic_operation_t), parameter, public op_update_couplings
Definition: algorithm.F90:179
type(algorithmic_operation_t), parameter, public op_update_interactions
Definition: algorithm.F90:179
This module implements the basic minimizer framework.
type(algorithmic_operation_t), parameter, public op_gs_scf_iteration
character(len=algo_label_len), parameter, public gs_scf_finish
type(algorithmic_operation_t), parameter, public op_gs_finish
type(minimizer_scf_t) function, pointer minimizer_scf_constructor()
character(len=algo_label_len), parameter, public gs_scf_iteration
logical function minimizer_scf_do_operation(this, operation)
Try to perform one operation of the algorithm. Return .true. if sucessful.
Descriptor of one algorithmic operation.
Definition: algorithm.F90:163
Abstract class implementing minimizers.
Implements a minimizer algorithm for SCF calculations.
int true(void)