Octopus
perturbation_kdotp.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
24 use debug_oct_m
26 use global_oct_m
27 use grid_oct_m
29 use ions_oct_m
31 use math_oct_m
32 use mesh_oct_m
36 use parser_oct_m
40 use space_oct_m
47
48 implicit none
49
50 private
51 public :: &
53
54 type, extends(perturbation_t) :: perturbation_kdotp_t
55 private
56 integer :: vel_method
57 logical :: use_nonlocalpps
58 type(ions_t), pointer :: ions => null()
59 contains
60 procedure :: copy_to => perturbation_kdotp_copy
61 generic :: assignment(=) => copy_to
62 procedure :: info => perturbation_kdotp_info
63 procedure :: dapply => dperturbation_kdotp_apply
64 procedure :: zapply => zperturbation_kdotp_apply
65 procedure :: dapply_order_2 => dperturbation_kdotp_apply_order_2
66 procedure :: zapply_order_2 => zperturbation_kdotp_apply_order_2
69
70 interface perturbation_kdotp_t
71 procedure perturbation_kdotp_constructor
72 end interface perturbation_kdotp_t
73
74
75contains
76
77 ! ---------------------------------------------------------
82 function perturbation_kdotp_constructor(namespace, ions) result(pert)
83 class(perturbation_kdotp_t), pointer :: pert
84 type(namespace_t), intent(in) :: namespace
85 type(ions_t), target, intent(in) :: ions
86
88
89 safe_allocate(pert)
90
91 call perturbation_kdotp_init(pert, namespace, ions)
92
95
96
97 ! --------------------------------------------------------------------
98 subroutine perturbation_kdotp_init(this, namespace, ions)
99 type(perturbation_kdotp_t), intent(out) :: this
100 type(namespace_t), intent(in) :: namespace
101 type(ions_t), target, intent(in) :: ions
102
104
105 this%dir = -1
106 this%dir2 = -1
107
108 this%ions => ions
109
110 !%Variable KdotPUseNonLocalPseudopotential
111 !%Type logical
112 !%Default true
113 !%Section Linear Response::KdotP
114 !%Description
115 !% For testing purposes, set to false to ignore the term <math>-i \left[\vec{r}, V\right]</math> in
116 !% the <math>\vec{k} \cdot \vec{p}</math> perturbation, which is due to non-local pseudopotentials.
117 !%End
118 call messages_obsolete_variable(namespace, 'KdotP_UseNonLocalPseudopotential', 'KdotPUseNonLocalPseudopotential')
119 call parse_variable(namespace, 'KdotPUseNonLocalPseudopotential', .true., this%use_nonlocalpps)
120
121 !%Variable KdotPVelMethod
122 !%Type integer
123 !%Default grad_vel
124 !%Section Linear Response::KdotP
125 !%Description
126 !% Method of velocity calculation.
127 !%Option grad_vel 0
128 !% <math>-i \left(\nabla + \left[r, V_{\rm nl} \right] \right)</math>
129 !%Option hcom_vel 1
130 !% As a commutator of the position operator and Hamiltonian, <math>-i \left[ r, H \right]</math>.
131 !%End
132 call parse_variable(namespace, 'KdotPVelMethod', option__kdotpvelmethod__grad_vel, this%vel_method)
133
135 end subroutine perturbation_kdotp_init
136
137 ! --------------------------------------------------------------------
138 subroutine perturbation_kdotp_finalize(this)
139 type(perturbation_kdotp_t), intent(inout) :: this
140
142
143 nullify(this%ions)
144
146 end subroutine perturbation_kdotp_finalize
147
148 ! --------------------------------------------------------------------
149 subroutine perturbation_kdotp_copy(this, source)
150 class(perturbation_kdotp_t), intent(out) :: this
151 class(perturbation_kdotp_t), intent(in) :: source
154
155 call perturbation_copy(this, source)
156 this%ions => source%ions
158 this%use_nonlocalpps = source%use_nonlocalpps
159 this%vel_method = source%vel_method
163
164 ! --------------------------------------------------------------------
165 subroutine perturbation_kdotp_info(this)
166 class(perturbation_kdotp_t), intent(in) :: this
167
169
170 if (.not. this%use_nonlocalpps) then
171 write(message(1), '(a)') 'Ignoring non-local pseudopotential term.'
172 call messages_info(1)
173 end if
174
176 end subroutine perturbation_kdotp_info
178#include "undef.F90"
179#include "real.F90"
180#include "perturbation_kdotp_inc.F90"
181
182#include "undef.F90"
183#include "complex.F90"
184#include "perturbation_kdotp_inc.F90"
185
187
188!! Local Variables:
189!! mode: f90
190!! coding: utf-8
191!! End:
Module implementing boundary conditions in Octopus.
Definition: boundaries.F90:124
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
This module implements the underlying real-space grid.
Definition: grid.F90:119
This module is intended to contain "only mathematical" functions and procedures.
Definition: math.F90:117
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:120
subroutine, public messages_obsolete_variable(namespace, name, rep)
Definition: messages.F90:1000
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:162
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:594
subroutine zperturbation_kdotp_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
d^2/dki dkj (-(1/2) ki kj [ri,[rj,H]]) = for i = j : 1 - [ri,[rj,Vnl]] for i != j : -(1/2) [ri,...
subroutine perturbation_kdotp_copy(this, source)
subroutine zperturbation_kdotp_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_kdotp_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
d^2/dki dkj (-(1/2) ki kj [ri,[rj,H]]) = for i = j : 1 - [ri,[rj,Vnl]] for i != j : -(1/2) [ri,...
class(perturbation_kdotp_t) function, pointer perturbation_kdotp_constructor(namespace, ions)
The factory routine (or constructor) allocates a pointer of the corresponding type and then calls the...
subroutine perturbation_kdotp_init(this, namespace, ions)
subroutine perturbation_kdotp_finalize(this)
subroutine perturbation_kdotp_info(this)
subroutine dperturbation_kdotp_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, public perturbation_copy(this, source)
This module handles spin dimensions of the states and the k-point distribution.
int true(void)