Octopus
multisystem_basic.F90
Go to the documentation of this file.
1!! Copyright (C) 2019-2020 M. Oliveira, Heiko Appel
2!! Copyright (C) 2021 S. Ohlmann
3!!
4!! This program is free software; you can redistribute it and/or modify
5!! it under the terms of the GNU General Public License as published by
6!! the Free Software Foundation; either version 2, or (at your option)
7!! any later version.
8!!
9!! This program is distributed in the hope that it will be useful,
10!! but WITHOUT ANY WARRANTY; without even the implied warranty of
11!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12!! GNU General Public License for more details.
13!!
14!! You should have received a copy of the GNU General Public License
15!! along with this program; if not, write to the Free Software
16!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17!! 02110-1301, USA.
18!!
19
20#include "global.h"
21
25 use debug_oct_m
26 use global_oct_m
27 use io_oct_m
30 use system_oct_m
32 implicit none
33
34 private
35 public :: &
37
42 type, extends(multisystem_t) :: multisystem_basic_t
43
44 contains
46 end type multisystem_basic_t
47
48 interface multisystem_basic_t
49 procedure multisystem_basic_constructor
50 end interface multisystem_basic_t
51
52contains
53
54 ! ---------------------------------------------------------------------------------------
59 recursive function multisystem_basic_constructor(namespace, names, types, factory, calc_mode_id) result(system)
60 type(namespace_t), intent(in) :: namespace
61 class(system_factory_abst_t), intent(in) :: factory
62 character(len=128), intent(in) :: names(:)
63 integer, intent(in) :: types(:)
64 integer, intent(in) :: calc_mode_id
65 class(multisystem_basic_t), pointer :: system
66
67 integer :: is
68 class(system_t), pointer :: sys
69
71
72 allocate(system)
73 system%namespace = namespace
74
75 ! No interaction directly supported by this system (but classes that extend
76 ! it can add their own)
77 allocate(system%supported_interactions(0))
78 allocate(system%supported_interactions_as_partner(0))
79
80 do is = 1, size(names)
81 ! Create folder to store system files.
82 ! Needs to be done before creating the system as this in turn might create subfolders.
83 call io_mkdir(names(is), namespace=namespace)
84
85 ! Create system
86 sys => factory%create(namespace_t(names(is), parent=system%namespace), types(is), calc_mode_id)
87
88 ! Add system to list of systems
89 call system%list%add(sys)
90 end do
91
94
95 ! ---------------------------------------------------------
96 recursive subroutine multisystem_basic_finalizer(this)
97 type(multisystem_basic_t), intent(inout) :: this
98
100
101 call multisystem_end(this)
102
104 end subroutine multisystem_basic_finalizer
105
Definition: io.F90:116
subroutine, public io_mkdir(fname, namespace, parents)
Definition: io.F90:361
This module implements the basic mulsisystem class, a container system for other systems.
recursive class(multisystem_basic_t) function, pointer multisystem_basic_constructor(namespace, names, types, factory, calc_mode_id)
initialize a basic multisystem class
recursive subroutine multisystem_basic_finalizer(this)
This module implements the abstract multisystem class.
recursive subroutine, public multisystem_end(this)
This module defines the abstract class for the system factory.
This module implements the abstract system type.
Definition: system.F90:120
Container class for lists of system_oct_m::system_t.
the abstract multisystem class