Octopus
pseudo.F90
Go to the documentation of this file.
1!! Copyright (C) 2018 X. Andrade
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the Lesser GNU General Public License as published by
5!! the Free Software Foundation; either version 3, 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
19#include "global.h"
20
21module pseudo_oct_m
22 use, intrinsic :: iso_fortran_env
23
24 implicit none
25
26 private
27
28 public :: &
29 pseudo_t, &
32 pseudo_end, &
53 pseudo_dij, &
55 pseudo_qij, &
69
70 !the following sets of values have to match with those on base.hpp
71 integer, parameter, public :: &
72 PSEUDO_TYPE_ULTRASOFT = 30, &
76
77 integer, parameter, public :: &
78 PSEUDO_STATUS_SUCCESS = 0, &
85
86 integer, parameter, public :: &
87 PSEUDO_FORMAT_FILE_NOT_FOUND = 773, &
89 pseudo_format_upf1 = 775, &
90 pseudo_format_upf2 = 776, &
91 pseudo_format_qso = 777, &
92 pseudo_format_psml = 778, &
94 pseudo_format_cpi = 780, &
95 pseudo_format_fhi = 781, &
96 pseudo_format_hgh = 782, &
98
99 ! we only define these values here, the specific functionals are
100 ! obtained from libxc
101 integer, parameter, public :: &
102 PSEUDO_EXCHANGE_UNKNOWN = -2, &
104
105 integer, parameter, public :: &
106 PSEUDO_CORRELATION_UNKNOWN = -2, &
108
109 type pseudo_t
110 private
111 integer(int64) :: dummy
112 end type pseudo_t
113
114 interface
115
116 ! -------------------------------------------------
117
118 integer function pseudo_detect_format(filename) bind(c)
119 use iso_c_binding
120 import :: pseudo_t
121 implicit none
122
123 character(kind=c_char), intent(in) :: filename(*)
124 end function pseudo_detect_format
125
126 ! -------------------------------------------------
127
128 subroutine pseudo_init(pseudo, filename, fmt, ierr)
129 use iso_c_binding
130 import :: pseudo_t
131 implicit none
132
133 type(pseudo_t), intent(out) :: pseudo
134 character(kind=c_char), intent(in) :: filename(*)
135 integer, intent(in) :: fmt
136 integer, intent(out) :: ierr
137 end subroutine pseudo_init
138
139 ! -------------------------------------------------
140
141 subroutine pseudo_end(pseudo)
142 import :: pseudo_t
143 implicit none
144
145 type(pseudo_t), intent(inout) :: pseudo
146 end subroutine pseudo_end
147
148 ! -------------------------------------------------
150 integer function pseudo_type(pseudo)
151 import :: pseudo_t
152 implicit none
153
154 type(pseudo_t), intent(in) :: pseudo
155 end function pseudo_type
156
157 ! -------------------------------------------------
159 integer function pseudo_format(pseudo)
160 import :: pseudo_t
161 implicit none
162
163 type(pseudo_t), intent(in) :: pseudo
164 end function pseudo_format
165
166 ! -------------------------------------------------
167
168 real(real64) function pseudo_valence_charge(pseudo)
169 import :: pseudo_t
170 import :: real64
171 implicit none
172
173 type(pseudo_t), intent(in) :: pseudo
174 end function pseudo_valence_charge
175
176 ! -------------------------------------------------
178 real(real64) function pseudo_mesh_spacing(pseudo)
179 import :: pseudo_t
180 import :: real64
181 implicit none
182
183 type(pseudo_t), intent(in) :: pseudo
184 end function pseudo_mesh_spacing
185
186 ! -------------------------------------------------
187
188 integer function pseudo_mesh_size(pseudo)
189 import :: pseudo_t
190 implicit none
191
192 type(pseudo_t), intent(in) :: pseudo
193 end function pseudo_mesh_size
194
195 ! -------------------------------------------------
196
197 real(real64) function pseudo_mass(pseudo)
198 import :: pseudo_t
199 import :: real64
200 implicit none
201
202 type(pseudo_t), intent(in) :: pseudo
203 end function pseudo_mass
204
205 ! -------------------------------------------------
206
207 integer function pseudo_lmax(pseudo)
208 import :: pseudo_t
209 implicit none
210
211 type(pseudo_t), intent(in) :: pseudo
212 end function pseudo_lmax
214 ! -------------------------------------------------
215
216 integer function pseudo_llocal(pseudo)
217 import :: pseudo_t
218 implicit none
219
220 type(pseudo_t), intent(in) :: pseudo
221 end function pseudo_llocal
223 ! -------------------------------------------------
224
225 integer function pseudo_nchannels(pseudo)
226 import :: pseudo_t
227 implicit none
228
229 type(pseudo_t), intent(in) :: pseudo
230 end function pseudo_nchannels
232 ! -------------------------------------------------
233
234 integer function pseudo_nprojectors(pseudo)
235 import :: pseudo_t
236 implicit none
237
238 type(pseudo_t), intent(in) :: pseudo
239 end function pseudo_nprojectors
241 ! -------------------------------------------------
242
243 integer function pseudo_nprojectors_per_l(pseudo, l)
244 import :: pseudo_t
245 implicit none
246
247 type(pseudo_t), intent(in) :: pseudo
248 integer, intent(in) :: l
249 end function pseudo_nprojectors_per_l
251 ! -------------------------------------------------
252
253 subroutine pseudo_grid(pseudo, grid)
254 import :: pseudo_t
255 import :: real64
256 implicit none
257
258 type(pseudo_t), intent(in) :: pseudo
259 real(real64), intent(out) :: grid
260 end subroutine pseudo_grid
261
262 ! -------------------------------------------------
263
264 subroutine pseudo_grid_weights(pseudo, weight)
265 import :: pseudo_t
266 import :: real64
267 implicit none
268
269 type(pseudo_t), intent(in) :: pseudo
270 real(real64), intent(out) :: weight
271 end subroutine pseudo_grid_weights
272
273 ! -------------------------------------------------
274
275 subroutine pseudo_local_potential(pseudo, local_potential)
276 import :: pseudo_t
277 import :: real64
278 implicit none
280 type(pseudo_t), intent(in) :: pseudo
281 real(real64), intent(out) :: local_potential
282 end subroutine pseudo_local_potential
283
284 ! -------------------------------------------------
285
286 subroutine pseudo_projector(pseudo, l, ic, projector)
287 import :: pseudo_t
288 import :: real64
289 implicit none
290
291 type(pseudo_t), intent(in) :: pseudo
292 integer, intent(in) :: l
293 integer, intent(in) :: ic
294 real(real64), intent(out) :: projector
295 end subroutine pseudo_projector
296
297 ! -------------------------------------------------
298
299 real(real64) function pseudo_dij(pseudo, l, ic, jc)
300 import :: pseudo_t
301 import :: real64
302 implicit none
303
304 type(pseudo_t), intent(in) :: pseudo
305 integer, intent(in) :: l
306 integer, intent(in) :: ic
307 integer, intent(in) :: jc
308 end function pseudo_dij
309
310 ! -------------------------------------------------
311
312 real(real64) function pseudo_qij(pseudo, l, ic, jc)
313 import :: pseudo_t
314 import :: real64
315 implicit none
316
317 type(pseudo_t), intent(in) :: pseudo
318 integer, intent(in) :: l
319 integer, intent(in) :: ic
320 integer, intent(in) :: jc
321 end function pseudo_qij
322
323 ! -------------------------------------------------
324
325 integer function pseudo_radial_augmentation_lmax(pseudo)
326 import :: pseudo_t
327 implicit none
328
329 type(pseudo_t), intent(in) :: pseudo
331
332 ! -------------------------------------------------
333
334 subroutine pseudo_radial_augmentation(pseudo, i, j, ltot, augmentation)
335 import :: pseudo_t
336 import :: real64
337 implicit none
338
339 type(pseudo_t), intent(in) :: pseudo
340 integer, intent(in) :: i
341 integer, intent(in) :: j
342 integer, intent(in) :: ltot
343 real(real64), intent(out) :: augmentation
344 end subroutine pseudo_radial_augmentation
345
346 ! -------------------------------------------------
348 subroutine pseudo_radial_potential(pseudo, l, radial_potential)
349 import :: pseudo_t
350 import :: real64
351 implicit none
352
353 type(pseudo_t), intent(in) :: pseudo
354 integer, intent(in) :: l
355 real(real64), intent(inout) :: radial_potential
356 end subroutine pseudo_radial_potential
357
358 ! -------------------------------------------------
359
360 subroutine pseudo_radial_function(pseudo, l, radial_function)
361 import :: pseudo_t
362 import :: real64
363 implicit none
364
365 type(pseudo_t), intent(in) :: pseudo
366 integer, intent(in) :: l
367 real(real64), intent(out) :: radial_function
368 end subroutine pseudo_radial_function
369
370 ! -------------------------------------------------
372 subroutine pseudo_nlcc_density(pseudo, nlcc_density)
373 import :: pseudo_t
374 import :: real64
375 implicit none
376
377 type(pseudo_t), intent(in) :: pseudo
378 real(real64), intent(out) :: nlcc_density
379 end subroutine pseudo_nlcc_density
380
381 ! -------------------------------------------------
382
383 subroutine pseudo_density(pseudo, density)
384 import :: pseudo_t
385 import :: real64
386 implicit none
387
388 type(pseudo_t), intent(in) :: pseudo
389 real(real64), intent(out) :: density
390 end subroutine pseudo_density
391
392 ! -------------------------------------------------
393
394 integer function pseudo_nwavefunctions(pseudo)
395 import :: pseudo_t
396 implicit none
398 type(pseudo_t), intent(in) :: pseudo
399 end function pseudo_nwavefunctions
400
401 ! -------------------------------------------------
402
403 subroutine pseudo_wavefunction(pseudo, index, n, l, occ, wf)
404 import :: pseudo_t
405 import :: real64
406 implicit none
407
408 type(pseudo_t), intent(in) :: pseudo
409 integer, intent(in) :: index
410 integer, intent(out) :: n
411 integer, intent(out) :: l
412 real(real64), intent(out) :: occ
413 real(real64), intent(out) :: wf
414 end subroutine pseudo_wavefunction
415
416 ! -------------------------------------------------
417
418 integer function pseudo_exchange(pseudo)
419 import :: pseudo_t
420 implicit none
421
422 type(pseudo_t), intent(in) :: pseudo
423 end function pseudo_exchange
424
425 ! -------------------------------------------------
426
427 integer function pseudo_correlation(pseudo)
428 import :: pseudo_t
429 implicit none
430
431 type(pseudo_t), intent(in) :: pseudo
433
434 ! -------------------------------------------------
435
436 integer function pseudo_projector_2j(pseudo, l, ic)
437 import :: pseudo_t
438 implicit none
439
440 type(pseudo_t), intent(in) :: pseudo
441 integer, intent(in) :: l
442 integer, intent(in) :: ic
443 end function pseudo_projector_2j
445 ! -------------------------------------------------
446
447 integer function pseudo_wavefunction_2j(pseudo, ii)
448 import :: pseudo_t
449 implicit none
450
451 type(pseudo_t), intent(in) :: pseudo
452 integer, intent(in) :: ii
453 end function pseudo_wavefunction_2j
454
455 end interface
456
457contains
458
459 ! -------------------------------------------------
460
461 logical function pseudo_has_nlcc(pseudo)
462 type(pseudo_t), intent(in) :: pseudo
463
464 interface
465 integer function pseudo_has_nlcc_low(pseudo)
466 import :: pseudo_t
467 implicit none
468
469 type(pseudo_t), intent(in) :: pseudo
470 end function pseudo_has_nlcc_low
471 end interface
472
473 pseudo_has_nlcc = (pseudo_has_nlcc_low(pseudo) /= 0)
474
475 end function pseudo_has_nlcc
476
477 ! -------------------------------------------------
478
479 logical function pseudo_has_density(pseudo)
480 type(pseudo_t), intent(in) :: pseudo
481
482 interface
483 integer function pseudo_has_density_low(pseudo)
484 import :: pseudo_t
485 implicit none
486
487 type(pseudo_t), intent(in) :: pseudo
488 end function pseudo_has_density_low
489 end interface
491 pseudo_has_density = (pseudo_has_density_low(pseudo) /= 0)
492
493 end function pseudo_has_density
494
495
496 ! -------------------------------------------------
497
498 logical function pseudo_has_qij_integrals(pseudo)
499 type(pseudo_t), intent(in) :: pseudo
500
501 interface
502 integer function pseudo_has_qij_integrals_low(pseudo)
503 import :: pseudo_t
504 implicit none
505
506 type(pseudo_t), intent(in) :: pseudo
507 end function pseudo_has_qij_integrals_low
508 end interface
509
510 pseudo_has_qij_integrals = (pseudo_has_qij_integrals_low(pseudo) /= 0)
511
512 end function pseudo_has_qij_integrals
513
514
515 ! -------------------------------------------------
516
517 logical function pseudo_has_radial_augmentation(pseudo)
518 type(pseudo_t), intent(in) :: pseudo
520 interface
521 integer function pseudo_has_radial_augmentation_low(pseudo)
522 import :: pseudo_t
523 implicit none
524
525 type(pseudo_t), intent(in) :: pseudo
526 end function pseudo_has_radial_augmentation_low
527 end interface
528
529 pseudo_has_radial_augmentation = (pseudo_has_radial_augmentation_low(pseudo) /= 0)
530
532
534 ! -------------------------------------------------
535
537 type(pseudo_t), intent(in) :: pseudo
538
539 interface
540 integer function pseudo_radial_augmentation_has_angular_channels_low(pseudo)
541 import :: pseudo_t
542 implicit none
543
544 type(pseudo_t), intent(in) :: pseudo
545 end function pseudo_radial_augmentation_has_angular_channels_low
546 end interface
547
549 (pseudo_radial_augmentation_has_angular_channels_low(pseudo) /= 0)
550
552
553
554 ! -------------------------------------------------
555
556 logical pure function pseudo_has_total_angular_momentum(pseudo)
557 type(pseudo_t), intent(in) :: pseudo
558
559 interface
560 integer pure function pseudo_has_total_angular_momentum_low(pseudo)
561 import :: pseudo_t
562 implicit none
563
564 type(pseudo_t), intent(in) :: pseudo
565 end function pseudo_has_total_angular_momentum_low
566 end interface
567
568 pseudo_has_total_angular_momentum = (pseudo_has_total_angular_momentum_low(pseudo) /= 0)
569
571
572 ! -------------------------------------------------
573
574 logical function pseudo_has_radial_function(pseudo, l)
575 type(pseudo_t), intent(in) :: pseudo
576 integer, intent(in) :: l
577
578 interface
579 integer function pseudo_has_radial_function_low(pseudo, l)
580 import :: pseudo_t
581 implicit none
582
583 type(pseudo_t), intent(in) :: pseudo
584 integer, intent(in) :: l
585 end function pseudo_has_radial_function_low
586 end interface
587
588 pseudo_has_radial_function = (pseudo_has_radial_function_low(pseudo, l) /= 0)
590 end function pseudo_has_radial_function
591
592end module pseudo_oct_m
593
594!! Local Variables:
595!! mode: f90
596!! coding: utf-8
597!! End:
integer, parameter, public pseudo_type_kleinman_bylander
Definition: pseudo.F90:143
logical function, public pseudo_has_radial_function(pseudo, l)
Definition: pseudo.F90:647
integer, parameter, public pseudo_format_qso
Definition: pseudo.F90:158
logical function, public pseudo_has_density(pseudo)
Definition: pseudo.F90:552
integer, parameter, public pseudo_format_hgh
Definition: pseudo.F90:158
integer, parameter, public pseudo_format_upf2
Definition: pseudo.F90:158
logical function, public pseudo_has_radial_augmentation(pseudo)
Definition: pseudo.F90:590
integer, parameter, public pseudo_type_paw
Definition: pseudo.F90:143
logical function, public pseudo_has_nlcc(pseudo)
Definition: pseudo.F90:534
integer, parameter, public pseudo_format_cpi
Definition: pseudo.F90:158
integer, parameter, public pseudo_status_unsupported_type
Definition: pseudo.F90:149
integer, parameter, public pseudo_status_file_not_found
Definition: pseudo.F90:149
integer, parameter, public pseudo_type_semilocal
Definition: pseudo.F90:143
logical function, public pseudo_has_qij_integrals(pseudo)
Definition: pseudo.F90:571
integer, parameter, public pseudo_format_psp8
Definition: pseudo.F90:158
integer, parameter, public pseudo_status_unsupported_type_ultrasoft
Definition: pseudo.F90:149
logical function, public pseudo_radial_augmentation_has_angular_channels(pseudo)
Definition: pseudo.F90:609
logical pure function, public pseudo_has_total_angular_momentum(pseudo)
Definition: pseudo.F90:629
integer, parameter, public pseudo_format_psf
Definition: pseudo.F90:158
integer, parameter, public pseudo_status_unknown_format
Definition: pseudo.F90:149
integer, parameter, public pseudo_status_unsupported_type_paw
Definition: pseudo.F90:149
integer, parameter, public pseudo_format_fhi
Definition: pseudo.F90:158
integer, parameter, public pseudo_correlation_any
Definition: pseudo.F90:177
integer, parameter, public pseudo_format_upf1
Definition: pseudo.F90:158
integer, parameter, public pseudo_format_unknown
Definition: pseudo.F90:158
integer, parameter, public pseudo_status_format_not_supported
Definition: pseudo.F90:149
integer, parameter, public pseudo_exchange_any
Definition: pseudo.F90:173
integer, parameter, public pseudo_format_psml
Definition: pseudo.F90:158