Octopus
vtau_mixer.F90
Go to the documentation of this file.
1!! Copyright (C) 2022 N. Tancogne-Dejean
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
22 use debug_oct_m
23 use global_oct_m
26 use mix_oct_m
29 use types_oct_m
30 use xc_oct_m
31
32 implicit none
33
34 private
35
36 public :: &
44
45 type vtau_mixer_t
46 private
47 logical :: apply = .false.
48
49 type(mixfield_t) :: field
50 end type vtau_mixer_t
51
52contains
53
54 ! ---------------------------------------------------------
55 subroutine vtau_mixer_init_auxmixer(namespace, mixer, smix, hm, np, nspin)
56 type(namespace_t), intent(in) :: namespace
57 type(vtau_mixer_t), intent(inout) :: mixer
58 type(mix_t), intent(inout) :: smix
59 type(hamiltonian_elec_t), intent(in) :: hm
60 integer, intent(in) :: np
61 integer, intent(in) :: nspin
62
64
65 if (family_is_mgga_with_exc(hm%xc) .and. hm%theory_level == generalized_kohn_sham_dft) then
66
67 mixer%apply = .true.
68
69 call mixfield_init(smix, mixer%field, np, nspin, mix_d3(smix), type_float)
70 call mixfield_clear(mix_scheme(smix), mixer%field)
71 call mix_add_auxmixfield(namespace, smix, mixer%field)
72
73 end if
74
76 end subroutine vtau_mixer_init_auxmixer
77
78 ! ---------------------------------------------------------
79 subroutine vtau_mixer_clear(mixer, smix)
80 type(vtau_mixer_t), intent(inout) :: mixer
81 type(mix_t), intent(inout) :: smix
82
83 if (.not. mixer%apply) return
84 push_sub(vtau_mixer_clear)
85
86 call mixfield_clear(mix_scheme(smix), mixer%field)
87
88 pop_sub(vtau_mixer_clear)
89 end subroutine vtau_mixer_clear
90
91 ! ---------------------------------------------------------
92 subroutine vtau_mixer_end(mixer, smix)
93 type(vtau_mixer_t), intent(inout) :: mixer
94 type(mix_t), intent(inout) :: smix
95
96 if (.not. mixer%apply) return
97 push_sub(vtau_mixer_end)
98
99 call mixfield_end(smix, mixer%field)
100
101 pop_sub(vtau_mixer_end)
102 end subroutine vtau_mixer_end
103
104 ! ---------------------------------------------------------
105 subroutine vtau_mixer_set_vout(mixer, hm)
106 type(vtau_mixer_t), intent(inout) :: mixer
107 type(hamiltonian_elec_t), intent(in) :: hm
108
109 if (.not. mixer%apply) return
110 push_sub(vtau_mixer_set_vout)
111
112 call mixfield_set_vout(mixer%field, hm%vtau)
113
115 end subroutine vtau_mixer_set_vout
116
117 ! ---------------------------------------------------------
118 subroutine vtau_mixer_set_vin(mixer, hm)
119 type(vtau_mixer_t), intent(inout) :: mixer
120 type(hamiltonian_elec_t), intent(in) :: hm
121
122 if (.not. mixer%apply) return
123 push_sub(vtau_mixer_set_vin)
124
125 call mixfield_set_vin(mixer%field, hm%vtau)
126
127 pop_sub(vtau_mixer_set_vin)
128 end subroutine vtau_mixer_set_vin
129
130 ! ---------------------------------------------------------
131 subroutine vtau_mixer_get_vnew(mixer, hm)
132 type(vtau_mixer_t), intent(in) :: mixer
133 type(hamiltonian_elec_t), intent(inout) :: hm
134
135 if (.not. mixer%apply) return
136 push_sub(vtau_mixer_get_vnew)
137
138 call mixfield_get_vnew(mixer%field, hm%vtau)
139
141 end subroutine vtau_mixer_get_vnew
143
144end module vtau_mixer_oct_m
integer, parameter, public generalized_kohn_sham_dft
subroutine, public mixfield_end(smix, mixfield)
Deallocate all arrays of a mixfield instance.
Definition: mix.F90:878
integer pure function, public mix_scheme(this)
Definition: mix.F90:780
subroutine, public mixfield_init(smix, mixfield, d1, d2, d3, func_type)
Initialise all attributes of a mixfield instance.
Definition: mix.F90:834
subroutine, public mix_add_auxmixfield(namespace, smix, mixfield)
Definition: mix.F90:815
subroutine, public mixfield_clear(scheme, mixfield)
Zero all potential and field attributes of a mixfield instance.
Definition: mix.F90:915
integer pure function, public mix_d3(this)
Definition: mix.F90:786
type(type_t), public type_float
Definition: types.F90:133
subroutine, public vtau_mixer_end(mixer, smix)
Definition: vtau_mixer.F90:186
subroutine, public vtau_mixer_init_auxmixer(namespace, mixer, smix, hm, np, nspin)
Definition: vtau_mixer.F90:149
subroutine, public vtau_mixer_set_vout(mixer, hm)
Definition: vtau_mixer.F90:199
subroutine, public vtau_mixer_get_vnew(mixer, hm)
Definition: vtau_mixer.F90:225
subroutine, public vtau_mixer_clear(mixer, smix)
Definition: vtau_mixer.F90:173
subroutine, public vtau_mixer_set_vin(mixer, hm)
Definition: vtau_mixer.F90:212
Definition: xc.F90:114
logical pure function, public family_is_mgga_with_exc(xcs)
Is the xc function part of the mGGA family with an energy functional.
Definition: xc.F90:592
int true(void)