1!! Copyright (C) 2011 X. Andrade
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19subroutine X(states_elec_get_state2)(st, mesh, ist, iqn, psi)
20  type(states_elec_t), intent(in)    :: st
21  type(mesh_t),        intent(in)    :: mesh
22  integer,             intent(in)    :: ist       !< current state
23  integer,             intent(in)    :: iqn       !< current k-point
24  R_TYPE,              intent(inout) :: psi(:, :)
25
26  integer :: idim
27
28  PUSH_SUB(X(states_elec_get_state2))
29
30  do idim =  1, st%d%dim
31    call X(states_elec_get_state1)(st, mesh, idim, ist, iqn, psi(:, idim))
32  end do
33
34  POP_SUB(X(states_elec_get_state2))
35end subroutine X(states_elec_get_state2)
36
37! ------------------------------------------------------------
38
39subroutine X(states_elec_get_state1)(st, mesh, idim, ist, iqn, psi)
40  type(states_elec_t), intent(in)    :: st
41  type(mesh_t),        intent(in)    :: mesh
42  integer,             intent(in)    :: idim   !< current dimension
43  integer,             intent(in)    :: ist
44  integer,             intent(in)    :: iqn    !< current k-point
45  R_TYPE,              intent(inout) :: psi(:)
46
47  PUSH_SUB(X(states_elec_get_state1))
48
49  call batch_get_state(st%group%psib(st%group%iblock(ist, iqn), iqn), (/ist, idim/), mesh%np, psi)
50
51  POP_SUB(X(states_elec_get_state1))
52end subroutine X(states_elec_get_state1)
53
54! ------------------------------------------------------------
55
56subroutine X(states_elec_get_state4)(st, mesh, psi)
57  type(states_elec_t), intent(in)    :: st
58  type(mesh_t),        intent(in)    :: mesh
59  R_TYPE,              intent(inout) :: psi(:, :, st%st_start:, st%d%kpt%start:)
60
61  integer :: iqn, ist
62
63  PUSH_SUB(X(states_elec_get_state4))
64
65  do iqn = st%d%kpt%start, st%d%kpt%end
66    do ist = st%st_start, st%st_end
67      call states_elec_get_state(st, mesh, ist, iqn, psi(:, :, ist, iqn))
68    end do
69  end do
70
71  POP_SUB(X(states_elec_get_state4))
72end subroutine X(states_elec_get_state4)
73
74! ------------------------------------------------------------
75
76subroutine X(states_elec_get_state3)(st, mesh, iqn, psi)
77  type(states_elec_t), intent(in)    :: st
78  type(mesh_t),        intent(in)    :: mesh
79  integer,             intent(in)    :: iqn
80  R_TYPE,              intent(inout) :: psi(:, :, st%st_start:)
81
82  integer :: ist
83
84  PUSH_SUB(X(states_elec_get_state3))
85
86  do ist = st%st_start, st%st_end
87    call states_elec_get_state(st, mesh, ist, iqn, psi(:, :, ist))
88  end do
89
90  POP_SUB(X(states_elec_get_state3))
91end subroutine X(states_elec_get_state3)
92
93! ------------------------------------------------------------
94
95subroutine X(states_elec_set_state2)(st, mesh, ist, iqn, psi)
96  type(states_elec_t), intent(inout) :: st
97  type(mesh_t),        intent(in)    :: mesh
98  integer,             intent(in)    :: ist       !< current dimension
99  integer,             intent(in)    :: iqn       !< current k-point
100  R_TYPE,              intent(in)    :: psi(:, :)
101
102  integer :: idim
103
104  PUSH_SUB(X(states_elec_set_state2))
105
106  do idim =  1, st%d%dim
107    call X(states_elec_set_state1)(st, mesh, idim, ist, iqn, psi(:, idim))
108  end do
109
110  POP_SUB(X(states_elec_set_state2))
111end subroutine X(states_elec_set_state2)
112
113! ------------------------------------------------------------
114
115subroutine X(states_elec_set_state1)(st, mesh, idim, ist, iqn, psi)
116  type(states_elec_t), intent(inout) :: st
117  type(mesh_t),        intent(in)    :: mesh
118  integer,             intent(in)    :: idim   !< current dimension
119  integer,             intent(in)    :: ist    !< current state
120  integer,             intent(in)    :: iqn    !< current k-point
121  R_TYPE,              intent(in)    :: psi(:)
122
123  PUSH_SUB(X(states_elec_set_state1))
124
125  call batch_set_state(st%group%psib(st%group%iblock(ist, iqn), iqn), (/ist, idim/), mesh%np, psi)
126
127  POP_SUB(X(states_elec_set_state1))
128end subroutine X(states_elec_set_state1)
129
130! ------------------------------------------------------------
131
132subroutine X(states_elec_set_state3)(st, mesh, iqn, psi)
133  type(states_elec_t), intent(inout) :: st
134  type(mesh_t),        intent(in)    :: mesh
135  integer,             intent(in)    :: iqn
136  R_TYPE,              intent(in)    :: psi(:, :, st%st_start:)
137
138  integer :: ist
139
140  PUSH_SUB(X(states_elec_set_state3))
141
142  do ist = st%st_start, st%st_end
143    call states_elec_set_state(st, mesh, ist, iqn, psi(:, :, ist))
144  end do
145
146  POP_SUB(X(states_elec_set_state3))
147end subroutine X(states_elec_set_state3)
148
149! ------------------------------------------------------------
150
151subroutine X(states_elec_set_state4)(st, mesh, psi)
152  type(states_elec_t), intent(inout) :: st
153  type(mesh_t),        intent(in)    :: mesh
154  R_TYPE,              intent(in)    :: psi(:, :, st%st_start:, st%d%kpt%start:)
155
156  integer :: iqn, ist
157
158  PUSH_SUB(X(states_elec_set_state4))
159
160  do iqn = st%d%kpt%start, st%d%kpt%end
161    do ist = st%st_start, st%st_end
162      call states_elec_set_state(st, mesh, ist, iqn, psi(:, :, ist, iqn))
163    end do
164  end do
165
166  POP_SUB(X(states_elec_set_state4))
167end subroutine X(states_elec_set_state4)
168
169! ------------------------------------------------------------
170
171!> Returns the value of all the states in the range of points
172!> [start_point:end_point].
173
174subroutine X(states_elec_get_points1)(st, start_point, end_point, iqn, psi)
175  type(states_elec_t),  intent(in)    :: st
176  integer,              intent(in)    :: start_point
177  integer,              intent(in)    :: end_point
178  integer,              intent(in)    :: iqn
179  R_TYPE,               intent(out)   :: psi(:, :, :)
180
181  integer :: ib
182
183  PUSH_SUB(X(states_elec_get_points1))
184
185  do ib = st%group%block_start, st%group%block_end
186    call batch_get_points(st%group%psib(ib, iqn), start_point, end_point, psi)
187  end do
188
189  POP_SUB(X(states_elec_get_points1))
190end subroutine X(states_elec_get_points1)
191
192! ------------------------------------------------------------
193! ------------------------------------------------------------
194
195!> Returns the value of all the states in the range of points
196!> [start_point:end_point].
197
198subroutine X(states_elec_get_points2)(st, start_point, end_point, psi)
199  type(states_elec_t), intent(in)    :: st
200  integer,             intent(in)    :: start_point
201  integer,             intent(in)    :: end_point
202  R_TYPE,              intent(out)   :: psi(:, :, :, :)
203
204  integer :: iqn
205
206  PUSH_SUB(X(states_elec_get_points2))
207
208  do iqn = st%d%kpt%start, st%d%kpt%end
209    call X(states_elec_get_points1)(st, start_point, end_point, iqn, psi(:, :, :, iqn))
210  end do
211
212  POP_SUB(X(states_elec_get_points2))
213end subroutine X(states_elec_get_points2)
214
215!! Local Variables:
216!! mode: f90
217!! coding: utf-8
218!! End:
219