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 debug_oct_m
26 use global_oct_m
27 use grid_oct_m
29 use mesh_oct_m
34 use space_oct_m
37 use types_oct_m
39
40 implicit none
41
42 private
43 public :: &
46
48 private
49 contains
50 procedure :: copy => perturbation_electric_copy
51 generic :: assignment(=) => copy
52 procedure :: info => perturbation_electric_info
53 procedure :: dapply => dperturbation_electric_apply
54 procedure :: zapply => zperturbation_electric_apply
55 procedure :: apply_batch => perturbation_electric_apply_batch
56 procedure :: dapply_order_2 => dperturbation_electric_apply_order_2
57 procedure :: zapply_order_2 => zperturbation_electric_apply_order_2
60
62 procedure perturbation_electric_constructor
63 end interface perturbation_electric_t
64
65contains
66
67 ! ---------------------------------------------------------
72 function perturbation_electric_constructor(namespace) result(pert)
73 class(perturbation_electric_t), pointer :: pert
74 type(namespace_t), intent(in) :: namespace
75
77
78 safe_allocate(pert)
79
80 call perturbation_electric_init(pert, namespace)
81
84
85 ! --------------------------------------------------------------------
86 subroutine perturbation_electric_init(this, namespace)
87 type(perturbation_electric_t), intent(out) :: this
88 type(namespace_t), intent(in) :: namespace
89
91
92 this%dir = -1
93 this%dir2 = -1
94
96 end subroutine perturbation_electric_init
97
98 ! --------------------------------------------------------------------
99 subroutine perturbation_electric_finalize(this)
100 type(perturbation_electric_t), intent(inout) :: this
101
103
105 end subroutine perturbation_electric_finalize
106
107 ! --------------------------------------------------------------------
108 subroutine perturbation_electric_copy(this, source)
109 class(perturbation_electric_t), intent(out) :: this
110 class(perturbation_electric_t), intent(in) :: source
111
113
114 call perturbation_copy(this, source)
115
118
119
120 ! --------------------------------------------------------------------
121 subroutine perturbation_electric_info(this)
122 class(perturbation_electric_t), intent(in) :: this
123
125
127 end subroutine perturbation_electric_info
128
129 ! --------------------------------------------------------------------------
130 subroutine perturbation_electric_apply_batch(this, namespace, space, gr, hm, f_in, f_out)
131 class(perturbation_electric_t), intent(in) :: this
132 type(namespace_t), intent(in) :: namespace
133 class(space_t), intent(in) :: space
134 type(grid_t), intent(in) :: gr
135 type(hamiltonian_elec_t), intent(in) :: hm
136 type(wfs_elec_t), intent(in) :: f_in
137 type(wfs_elec_t), intent(inout) :: f_out
138
140
141 ! electric does not need it since (e^-ikr)r(e^ikr) = r
143 assert(f_in%status() == f_out%status())
144
145 call batch_mul_mf(gr%np, gr%x_t(:, this%dir), f_in, f_out)
151#include "undef.F90"
152#include "real.F90"
153#include "perturbation_electric_inc.F90"
154
155#include "undef.F90"
156#include "complex.F90"
157#include "perturbation_electric_inc.F90"
158
160
161!! Local Variables:
162!! mode: f90
163!! coding: utf-8
164!! 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.