Octopus
perturbation_electric.F90
Go to the documentation of this file.
1!! Copyright (C) 2007 X. Andrade
2!! Copyright (C) 2021 N. Tancogne-Dejean
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
23 use batch_oct_m
25 use comm_oct_m
26 use debug_oct_m
27 use global_oct_m
28 use grid_oct_m
30 use mesh_oct_m
35 use space_oct_m
38 use types_oct_m
40
41 implicit none
42
43 private
44 public :: &
47
49 private
50 contains
51 procedure :: copy => perturbation_electric_copy
52 generic :: assignment(=) => copy
53 procedure :: info => perturbation_electric_info
54 procedure :: dapply => dperturbation_electric_apply
55 procedure :: zapply => zperturbation_electric_apply
56 procedure :: apply_batch => perturbation_electric_apply_batch
57 procedure :: dapply_order_2 => dperturbation_electric_apply_order_2
58 procedure :: zapply_order_2 => zperturbation_electric_apply_order_2
61
63 procedure perturbation_electric_constructor
64 end interface perturbation_electric_t
65
66contains
67
68 ! ---------------------------------------------------------
73 function perturbation_electric_constructor(namespace) result(pert)
74 class(perturbation_electric_t), pointer :: pert
75 type(namespace_t), intent(in) :: namespace
76
78
79 safe_allocate(pert)
80
81 call perturbation_electric_init(pert, namespace)
82
85
86 ! --------------------------------------------------------------------
87 subroutine perturbation_electric_init(this, namespace)
88 type(perturbation_electric_t), intent(out) :: this
89 type(namespace_t), intent(in) :: namespace
90
92
93 this%dir = -1
94 this%dir2 = -1
95
97 end subroutine perturbation_electric_init
98
99 ! --------------------------------------------------------------------
100 subroutine perturbation_electric_finalize(this)
101 type(perturbation_electric_t), intent(inout) :: this
102
104
106 end subroutine perturbation_electric_finalize
107
108 ! --------------------------------------------------------------------
109 subroutine perturbation_electric_copy(this, source)
110 class(perturbation_electric_t), intent(out) :: this
111 class(perturbation_electric_t), intent(in) :: source
112
114
115 call perturbation_copy(this, source)
116
118 end subroutine perturbation_electric_copy
119
120
121 ! --------------------------------------------------------------------
122 subroutine perturbation_electric_info(this)
123 class(perturbation_electric_t), intent(in) :: this
124
126
128 end subroutine perturbation_electric_info
129
130 ! --------------------------------------------------------------------------
131 subroutine perturbation_electric_apply_batch(this, namespace, space, gr, hm, f_in, f_out)
132 class(perturbation_electric_t), intent(in) :: this
133 type(namespace_t), intent(in) :: namespace
134 class(space_t), intent(in) :: space
135 type(grid_t), intent(in) :: gr
136 type(hamiltonian_elec_t), intent(in) :: hm
137 type(wfs_elec_t), intent(in) :: f_in
138 type(wfs_elec_t), intent(inout) :: f_out
139
141
142 ! electric does not need it since (e^-ikr)r(e^ikr) = r
144 assert(f_in%status() == f_out%status())
145
146 call batch_mul_mf(gr%np, gr%x_t(:, this%dir), f_in, f_out)
152#include "undef.F90"
153#include "real.F90"
154#include "perturbation_electric_inc.F90"
155
156#include "undef.F90"
157#include "complex.F90"
158#include "perturbation_electric_inc.F90"
159
161
162!! Local Variables:
163!! mode: f90
164!! coding: utf-8
165!! End:
batchified multiplication by mesh function with optional conjugation:
Definition: batch_ops.F90:254
This module implements batches of mesh functions.
Definition: batch.F90:135
This module implements common operations on batches of mesh functions.
Definition: batch_ops.F90:118
This module implements the underlying real-space grid.
Definition: grid.F90:119
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:120
subroutine, public perturbation_electric_init(this, namespace)
subroutine zperturbation_electric_apply(this, namespace, space, gr, hm, ik, f_in, f_out, set_bc)
Returns f_out = H' f_in, where H' is perturbation Hamiltonian Note that e^ikr phase is applied to f_i...
subroutine perturbation_electric_finalize(this)
class(perturbation_electric_t) function, pointer perturbation_electric_constructor(namespace)
The factory routine (or constructor) allocates a pointer of the corresponding type and then calls the...
subroutine zperturbation_electric_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
subroutine perturbation_electric_copy(this, source)
subroutine perturbation_electric_apply_batch(this, namespace, space, gr, hm, f_in, f_out)
subroutine dperturbation_electric_apply(this, namespace, space, gr, hm, ik, f_in, f_out, set_bc)
Returns f_out = H' f_in, where H' is perturbation Hamiltonian Note that e^ikr phase is applied to f_i...
subroutine dperturbation_electric_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
subroutine, public perturbation_copy(this, source)
This module handles spin dimensions of the states and the k-point distribution.