File: xcinfo.f90

package info (click to toggle)
libxc 5.2.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 196,988 kB
  • sloc: ansic: 31,506; f90: 3,369; perl: 1,392; python: 966; makefile: 425; sh: 318
file content (51 lines) | stat: -rw-r--r-- 1,597 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
program xcinfo
  use xc_f90_lib_m

  implicit none

  TYPE(xc_f90_func_t) :: xc_func
  TYPE(xc_f90_func_info_t) :: xc_info
  TYPE(xc_f90_func_reference_t) :: xc_ref
  integer :: i, number
  character(len=120) :: s1, s2

  call xc_f90_func_init(xc_func, XC_GGA_C_PBE, XC_UNPOLARIZED)
  xc_info = xc_f90_func_get_info(xc_func)

  select case(xc_f90_func_info_get_kind(xc_info))
  case(XC_EXCHANGE)
    write(*, '(a)') 'Exchange'
  case(XC_CORRELATION)
    write(*, '(a)') 'Correlation'
  case(XC_EXCHANGE_CORRELATION)
    write(*, '(a)') 'Exchange-correlation'
  case(XC_KINETIC)
    write(*, '(a)') 'Kinetic'
  end select

  s1 = xc_f90_func_info_get_name(xc_info)
  select case(xc_f90_func_info_get_family(xc_info))
  case (XC_FAMILY_LDA);       write(s2,'(a)') "LDA"
  case (XC_FAMILY_HYB_LDA);   write(s2,'(a)') "Hybrid LDA"
  case (XC_FAMILY_GGA);       write(s2,'(a)') "GGA"
  case (XC_FAMILY_HYB_GGA);   write(s2,'(a)') "Hybrid GGA"
  case (XC_FAMILY_MGGA);      write(s2,'(a)') "MGGA"
  case (XC_FAMILY_HYB_MGGA);  write(s2,'(a)') "Hybrid MGGA"
  case (XC_FAMILY_LCA);       write(s2,'(a)') "LCA"
  end select
  write(*, '(4a)') trim(s1), ' (', trim(s2), ')'

  do i=0, XC_MAX_REFERENCES-1
     ! Get info on reference number i; can't reuse the loop variable
     ! due to Fortran restrictions for intent(inout)
     number = i
     xc_ref = xc_f90_func_info_get_references(xc_info, number)
     if( number < 0 ) then
        exit
     end if
    write(*, '(a,i1,2a)') '[', i+1, '] ', trim(xc_f90_func_reference_get_ref(xc_ref))
  end do

  call xc_f90_func_end(xc_func)

end program xcinfo