Octopus
ground_state.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
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
26 use global_oct_m
27 use grid_oct_m
33 use output_oct_m
35 use system_oct_m
36 use v_ks_oct_m
37
38 implicit none
39
40 private
41 public :: &
44
45contains
46
47 subroutine ground_state_run_init()
48
49 push_sub(ground_state_run_init)
50
51 call calc_mode_par%set_parallelization(p_strategy_states, default = .false.)
52#ifdef HAVE_SCALAPACK
53 call calc_mode_par%set_scalapack_compat()
54#endif
55
57 end subroutine ground_state_run_init
58
59 ! ---------------------------------------------------------
60 subroutine ground_state_run(system, from_scratch)
61 class(*), intent(inout) :: system
62 logical, intent(inout) :: from_scratch
63
64 logical :: is_multisystem_supported = .true.
65 type(system_iterator_t) :: system_iter
66 class(system_t), pointer :: system2
67
68 push_sub(ground_state_run)
69
70 select type (system)
71 class is (multisystem_basic_t)
72 ! First we check if all systems are of electronic type
73 call system_iter%start(system%list)
74 do while (system_iter%has_next())
75 system2 => system_iter%get_next()
76 select type (system2)
77 type is (electrons_t)
78 ! All good
79 class default
80 is_multisystem_supported = .false.
81 message(1) = "CalculationMode = gs only implemented for electronic systems"
82 call messages_fatal(1, namespace=system2%namespace)
83 end select
84 end do
85
86 ! If the systems are all electronic, we run their ground states consecutively
87 if (is_multisystem_supported) then
88 call system_iter%start(system%list)
89 do while (system_iter%has_next())
90 system2 => system_iter%get_next()
91 select type (system2)
92 type is (electrons_t)
93 call messages_print_with_emphasis(msg="Running ground state for system "//trim(system2%namespace%get()), &
94 namespace=global_namespace)
95 message(1) = "Check log of the run in "//trim(system2%namespace%get())//"/log."
96 message(2) = ""
97 call messages_info(2, namespace=global_namespace)
98 call ground_state_run_legacy(system2, from_scratch)
100 end select
101 end do
102 end if
103
104 type is (electrons_t)
105 call ground_state_run_legacy(system, from_scratch)
106 end select
107
108 pop_sub(ground_state_run)
109 end subroutine ground_state_run
110
111 subroutine ground_state_run_legacy(electrons, from_scratch)
112 class(electrons_t), intent(inout) :: electrons
113 logical, intent(inout) :: from_scratch
116
117 call electrons_ground_state_run(electrons%namespace, electrons%mc, electrons%gr, electrons%ions, electrons%ext_partners, &
118 electrons%st, electrons%ks, electrons%hm, electrons%outp, electrons%space, from_scratch)
119
121 end subroutine ground_state_run_legacy
122
123end module ground_state_oct_m
124
125!! Local Variables:
126!! mode: f90
127!! coding: utf-8
128!! End:
This module handles the calculation mode.
type(calc_mode_par_t), public calc_mode_par
Singleton instance of parallel calculation mode.
integer, parameter, public p_strategy_states
parallelization in states
subroutine, public electrons_ground_state_run(namespace, mc, gr, ions, ext_partners, st, ks, hm, outp, space, fromScratch)
This module implements the underlying real-space grid.
Definition: grid.F90:117
subroutine, public ground_state_run_init()
subroutine ground_state_run_legacy(electrons, from_scratch)
subroutine, public ground_state_run(system, from_scratch)
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
Definition: messages.F90:930
character(len=512), private msg
Definition: messages.F90:165
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
Definition: messages.F90:624
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:160
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:420
This module handles the communicators for the various parallelization strategies.
Definition: multicomm.F90:145
This module implements the basic mulsisystem class, a container system for other systems.
type(namespace_t), public global_namespace
Definition: namespace.F90:132
this module contains the output system
Definition: output.F90:115
This module implements the abstract system type.
Definition: system.F90:118
Class describing the electron system.
Definition: electrons.F90:214
Container class for lists of system_oct_m::system_t.
int true(void)