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
33 implicit none
34
35 private
36 public :: &
38
43 type, extends(multisystem_t) :: multisystem_basic_t
44
45 contains
47 end type multisystem_basic_t
48
49 interface multisystem_basic_t
50 procedure multisystem_basic_constructor
51 end interface multisystem_basic_t
52
53contains
54
55 ! ---------------------------------------------------------------------------------------
60 recursive function multisystem_basic_constructor(namespace, names, types, factory, calc_mode_id) result(system)
61 type(namespace_t), intent(in) :: namespace
62 class(system_factory_abst_t), intent(in) :: factory
63 character(len=128), intent(in) :: names(:)
64 integer, intent(in) :: types(:)
65 integer, intent(in) :: calc_mode_id
66 class(multisystem_basic_t), pointer :: system
67
68 integer :: is
69 class(system_t), pointer :: sys
70
72
73 allocate(system)
74 system%namespace = namespace
75
76 ! No interaction directly supported by this system (but classes that extend
77 ! it can add their own)
78 allocate(system%supported_interactions(0))
79 allocate(system%supported_interactions_as_partner(0))
80
81 do is = 1, size(names)
82 ! Create folder to store system files.
83 ! Needs to be done before creating the system as this in turn might create subfolders.
84 call io_mkdir(names(is), namespace=namespace)
85
86 ! Create system
87 sys => factory%create(namespace_t(names(is), parent=system%namespace), types(is), calc_mode_id)
88
89 ! Add system to list of systems
90 call system%list%add(sys)
91 end do
92
95
96 ! ---------------------------------------------------------
97 recursive subroutine multisystem_basic_finalizer(this)
98 type(multisystem_basic_t), intent(inout) :: this
99
101
102 call multisystem_end(this)
103
105 end subroutine multisystem_basic_finalizer
106
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