Octopus
matter.F90
Go to the documentation of this file.
1!! Copyright (C) 2021 Micael Oliveira
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
23module matter_oct_m
24 use debug_oct_m
26 use global_oct_m
27 use ions_oct_m
32 implicit none
33
34 private
35 public :: &
37
43 type, extends(multisystem_t) :: matter_t
44 class(electrons_t), pointer :: electrons => null()
45 class(ions_t), pointer :: ions => null()
46 contains
47 final :: matter_finalizer
48 end type matter_t
49
50 interface matter_t
51 procedure matter_constructor
52 end interface matter_t
53
54contains
55
56 ! ---------------------------------------------------------------------------------------
57 function matter_constructor(namespace) result(matter)
58 type(namespace_t), intent(in) :: namespace
59 class(matter_t), pointer :: matter
60
61 push_sub(matter_constructor)
62
63 safe_allocate(matter)
64
65 matter%namespace = namespace
66
67 matter%ions => ions_t(namespace_t("ions", parent=matter%namespace))
68 matter%electrons => electrons_t(namespace_t("electrons", parent=matter%namespace))
69
70 call matter%list%add(matter%ions)
71 call matter%list%add(matter%electrons)
72
73 pop_sub(matter_constructor)
74 end function matter_constructor
75
76 ! ---------------------------------------------------------
77 subroutine matter_finalizer(this)
78 type(matter_t), intent(inout) :: this
79
80 push_sub(matter_finalizer)
81
82 call multisystem_end(this)
83 nullify(this%electrons)
84 nullify(this%ions)
85
86 pop_sub(matter_finalizer)
87 end subroutine matter_finalizer
88
89end module matter_oct_m
This module defines a container system for electrons and ions.
Definition: matter.F90:116
subroutine matter_finalizer(this)
Definition: matter.F90:171
class(matter_t) function, pointer matter_constructor(namespace)
Definition: matter.F90:151
This module implements the abstract multisystem class.
recursive subroutine, public multisystem_end(this)
Class describing the electron system.
Definition: electrons.F90:214
container class for for electrons and ions
Definition: matter.F90:136
the abstract multisystem class