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) 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 class(multisystem_basic_t), pointer :: system
65
66 integer :: is
67 class(system_t), pointer :: sys
68
70
71 allocate(system)
72 system%namespace = namespace
73
74 ! No interaction directly supported by this system (but classes that extend
75 ! it can add their own)
76 allocate(system%supported_interactions(0))
77 allocate(system%supported_interactions_as_partner(0))
78
79 do is = 1, size(names)
80 ! Create folder to store system files.
81 ! Needs to be done before creating the system as this in turn might create subfolders.
82 call io_mkdir(names(is), namespace=namespace)
83
84 ! Create system
85 sys => factory%create(namespace_t(names(is), parent=system%namespace), types(is))
86
87 ! Add system to list of systems
88 call system%list%add(sys)
89 end do
90
93
94 ! ---------------------------------------------------------
95 recursive subroutine multisystem_basic_finalizer(this)
96 type(multisystem_basic_t), intent(inout) :: this
97
99
100 call multisystem_end(this)
101
103 end subroutine multisystem_basic_finalizer
104
Definition: io.F90:114
subroutine, public io_mkdir(fname, namespace, parents)
Definition: io.F90:354
This module implements the basic mulsisystem class, a container system for other systems.
recursive subroutine multisystem_basic_finalizer(this)
recursive class(multisystem_basic_t) function, pointer multisystem_basic_constructor(namespace, names, types, factory)
initialize a basic multisystem class
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:118
Container class for lists of system_oct_m::system_t.
the abstract multisystem class