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 debug_oct_m
28 use global_oct_m
29 use grid_oct_m
31 use ions_oct_m
34 use lda_u_oct_m
35 use math_oct_m
36 use mesh_oct_m
39 use mpi_oct_m
41 use parser_oct_m
46 use space_oct_m
53 use xc_oct_m
54
55 implicit none
56
57 private
58 public :: &
60
61 integer, public, parameter :: &
62 GAUGE_GIPAW = 1, &
63 gauge_icl = 2
64
66 private
67 integer :: gauge
68 type(ions_t), pointer :: ions => null()
69 contains
70 procedure :: copy_to => perturbation_magnetic_copy
71 generic :: assignment(=) => copy_to
72 procedure :: info => perturbation_magnetic_info
73 procedure :: dapply => dperturbation_magnetic_apply
74 procedure :: zapply => zperturbation_magnetic_apply
75 procedure :: dapply_order_2 => dperturbation_magnetic_apply_order_2
76 procedure :: zapply_order_2 => zperturbation_magnetic_apply_order_2
79
81 procedure perturbation_magnetic_constructor
82 end interface perturbation_magnetic_t
83
84
85contains
86 ! ---------------------------------------------------------
91 function perturbation_magnetic_constructor(namespace, ions) result(pert)
92 class(perturbation_magnetic_t), pointer :: pert
93 type(namespace_t), intent(in) :: namespace
94 type(ions_t), target, intent(in) :: ions
95
97
98 safe_allocate(pert)
99
100 call perturbation_magnetic_init(pert, namespace, ions)
101
104
105
106 ! --------------------------------------------------------------------
107 subroutine perturbation_magnetic_init(this, namespace, ions)
108 type(perturbation_magnetic_t), intent(out) :: this
109 type(namespace_t), intent(in) :: namespace
110 type(ions_t), target, intent(in) :: ions
111
113
114 this%dir = -1
115 this%dir2 = -1
116
117 this%ions => ions
118
119 !%Variable MagneticGaugeCorrection
120 !%Type integer
121 !%Default gipaw
122 !%Section Linear Response
123 !%Description
124 !% For magnetic linear response: how to handle gauge-invariance in the description
125 !% of the coupling of electrons to the magnetic field.
126 !%Option none 0
127 !% No correction.
128 !%Option gipaw 1
129 !% GIPAW correction: C Pickard and F Mauri, <i>Phys. Rev. Lett.</i> <b>91</b>, 196401 (2003).
130 !%Option icl 2
131 !% ICL correction: S Ismail-Beigi, EK Chang, and SG Louie, <i>Phys. Rev. Lett.</i> <b>87</b>, 087402 (2001).
132 !%End
133
134 call parse_variable(namespace, 'MagneticGaugeCorrection', gauge_gipaw, this%gauge)
135 if (.not. varinfo_valid_option('MagneticGaugeCorrection', this%gauge)) then
136 call messages_input_error(namespace, 'MagneticGaugeCorrection')
137 end if
138
140 end subroutine perturbation_magnetic_init
141
142 ! --------------------------------------------------------------------
143 subroutine perturbation_magnetic_finalize(this)
144 type(perturbation_magnetic_t), intent(inout) :: this
145
147
149 end subroutine perturbation_magnetic_finalize
150
151 ! --------------------------------------------------------------------
152 subroutine perturbation_magnetic_copy(this, source)
153 class(perturbation_magnetic_t), intent(out) :: this
154 class(perturbation_magnetic_t), intent(in) :: source
155
157
158 call perturbation_copy(this, source)
159 this%ions => source%ions
161 this%gauge = source%gauge
164 end subroutine perturbation_magnetic_copy
166 ! --------------------------------------------------------------------
168 class(perturbation_magnetic_t), intent(in) :: this
173 end subroutine perturbation_magnetic_info
174
175
176#include "undef.F90"
177#include "real.F90"
178#include "perturbation_magnetic_inc.F90"
179
180#include "undef.F90"
181#include "complex.F90"
182#include "perturbation_magnetic_inc.F90"
183
185
186!! Local Variables:
187!! mode: f90
188!! coding: utf-8
189!! End:
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
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
A module to handle KS potential, without the external potential.
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_input_error(namespace, var, details, row, column)
Definition: messages.F90:691
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:120