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
29 use mpi_oct_m
33 implicit none
34
35 private
36 public :: &
38
44 type, extends(multisystem_t) :: matter_t
45 private
46 class(electrons_t), pointer :: electrons => null()
47 class(ions_t), pointer :: ions => null()
48 contains
49 final :: matter_finalizer
50 end type matter_t
51
52 interface matter_t
53 procedure matter_constructor
54 end interface matter_t
55
56contains
57
58 ! ---------------------------------------------------------------------------------------
59 function matter_constructor(namespace, grp) result(matter)
60 type(namespace_t), intent(in) :: namespace
61 type(mpi_grp_t), intent(in) :: grp
62 class(matter_t), pointer :: matter
63
64 push_sub(matter_constructor)
65
66 safe_allocate(matter)
67
68 matter%namespace = namespace
69
70 matter%ions => ions_t(namespace_t("ions", parent=matter%namespace), grp)
71 matter%electrons => electrons_t(namespace_t("electrons", parent=matter%namespace), grp)
72
73 call matter%list%add(matter%ions)
74 call matter%list%add(matter%electrons)
75
76 pop_sub(matter_constructor)
77 end function matter_constructor
78
79 ! ---------------------------------------------------------
80 subroutine matter_finalizer(this)
81 type(matter_t), intent(inout) :: this
82
83 push_sub(matter_finalizer)
84
85 call multisystem_end(this)
86 nullify(this%electrons)
87 nullify(this%ions)
88
89 pop_sub(matter_finalizer)
90 end subroutine matter_finalizer
91
92end module matter_oct_m
This module defines a container system for electrons and ions.
Definition: matter.F90:118
subroutine matter_finalizer(this)
Definition: matter.F90:176
class(matter_t) function, pointer matter_constructor(namespace, grp)
Definition: matter.F90:155
This module implements the abstract multisystem class.
recursive subroutine, public multisystem_end(this)
Class describing the electron system.
Definition: electrons.F90:221
container class for for electrons and ions
Definition: matter.F90:139
the abstract multisystem class