Octopus
perturbation_magnetic.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
26 use comm_oct_m
27 use debug_oct_m
29 use global_oct_m
30 use grid_oct_m
32 use ions_oct_m
34 use lda_u_oct_m
35 use math_oct_m
36 use mesh_oct_m
40 use mpi_oct_m
42 use parser_oct_m
47 use space_oct_m
54 use xc_oct_m
55
56 implicit none
57
58 private
59 public :: &
61
62 integer, public, parameter :: &
63 GAUGE_GIPAW = 1, &
64 gauge_icl = 2
65
67 private
68 integer :: gauge
69 type(ions_t), pointer :: ions => null()
70 contains
71 procedure :: copy_to => perturbation_magnetic_copy
72 generic :: assignment(=) => copy_to
73 procedure :: info => perturbation_magnetic_info
74 procedure :: dapply => dperturbation_magnetic_apply
75 procedure :: zapply => zperturbation_magnetic_apply
76 procedure :: dapply_order_2 => dperturbation_magnetic_apply_order_2
77 procedure :: zapply_order_2 => zperturbation_magnetic_apply_order_2
80
82 procedure perturbation_magnetic_constructor
83 end interface perturbation_magnetic_t
84
85
86contains
87 ! ---------------------------------------------------------
92 function perturbation_magnetic_constructor(namespace, ions) result(pert)
93 class(perturbation_magnetic_t), pointer :: pert
94 type(namespace_t), intent(in) :: namespace
95 type(ions_t), target, intent(in) :: ions
96
98
99 safe_allocate(pert)
100
101 call perturbation_magnetic_init(pert, namespace, ions)
102
105
106
107 ! --------------------------------------------------------------------
108 subroutine perturbation_magnetic_init(this, namespace, ions)
109 type(perturbation_magnetic_t), intent(out) :: this
110 type(namespace_t), intent(in) :: namespace
111 type(ions_t), target, intent(in) :: ions
112
114
115 this%dir = -1
116 this%dir2 = -1
117
118 this%ions => ions
119
120 !%Variable MagneticGaugeCorrection
121 !%Type integer
122 !%Default gipaw
123 !%Section Linear Response
124 !%Description
125 !% For magnetic linear response: how to handle gauge-invariance in the description
126 !% of the coupling of electrons to the magnetic field.
127 !%Option none 0
128 !% No correction.
129 !%Option gipaw 1
130 !% GIPAW correction: C Pickard and F Mauri, <i>Phys. Rev. Lett.</i> <b>91</b>, 196401 (2003).
131 !%Option icl 2
132 !% ICL correction: S Ismail-Beigi, EK Chang, and SG Louie, <i>Phys. Rev. Lett.</i> <b>87</b>, 087402 (2001).
133 !%End
134
135 call parse_variable(namespace, 'MagneticGaugeCorrection', gauge_gipaw, this%gauge)
136 if (.not. varinfo_valid_option('MagneticGaugeCorrection', this%gauge)) then
137 call messages_input_error(namespace, 'MagneticGaugeCorrection')
138 end if
139
141 end subroutine perturbation_magnetic_init
142
143 ! --------------------------------------------------------------------
144 subroutine perturbation_magnetic_finalize(this)
145 type(perturbation_magnetic_t), intent(inout) :: this
146
148
150 end subroutine perturbation_magnetic_finalize
151
152 ! --------------------------------------------------------------------
153 subroutine perturbation_magnetic_copy(this, source)
154 class(perturbation_magnetic_t), intent(out) :: this
155 class(perturbation_magnetic_t), intent(in) :: source
156
158
159 call perturbation_copy(this, source)
160 this%ions => source%ions
162 this%gauge = source%gauge
163
167 ! --------------------------------------------------------------------
169 class(perturbation_magnetic_t), intent(in) :: this
172
174 end subroutine perturbation_magnetic_info
175
176
177#include "undef.F90"
178#include "real.F90"
179#include "perturbation_magnetic_inc.F90"
180
181#include "undef.F90"
182#include "complex.F90"
183#include "perturbation_magnetic_inc.F90"
184
186
187!! Local Variables:
188!! mode: f90
189!! coding: utf-8
190!! End:
This module implements batches of mesh functions.
Definition: batch.F90:133
This module implements common operations on batches of mesh functions.
Definition: batch_ops.F90:116
Module implementing boundary conditions in Octopus.
Definition: boundaries.F90:122
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
This module implements the underlying real-space grid.
Definition: grid.F90:117
This module is intended to contain "only mathematical" functions and procedures.
Definition: math.F90:115
This module defines functions over batches of mesh functions.
Definition: mesh_batch.F90:116
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:118
subroutine, public messages_input_error(namespace, var, details, row, column)
Definition: messages.F90:723
subroutine zperturbation_magnetic_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...
class(perturbation_magnetic_t) function, pointer perturbation_magnetic_constructor(namespace, ions)
The factory routine (or constructor) allocates a pointer of the corresponding type and then calls the...
subroutine zperturbation_magnetic_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
subroutine dperturbation_magnetic_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...
integer, parameter, public gauge_icl
subroutine dperturbation_magnetic_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
subroutine perturbation_magnetic_copy(this, source)
subroutine perturbation_magnetic_finalize(this)
subroutine perturbation_magnetic_init(this, namespace, ions)
subroutine, public perturbation_copy(this, source)
This module handles spin dimensions of the states and the k-point distribution.
Definition: xc.F90:114