-
Notifications
You must be signed in to change notification settings - Fork 0
/
m_libpaw_defs.F90
160 lines (136 loc) · 5.56 KB
/
m_libpaw_defs.F90
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
!!****m* ABINIT/m_libpaw_defs
!! NAME
!! m_libpaw_defs
!!
!! FUNCTION
!! Several definitions used in libPAW: named constants, physical constants, datatypes
!!
!! COPYRIGHT
!! Copyright (C) 2000-2022 ABINIT group
!! This file is distributed under the terms of the
!! GNU General Public License, see ~abinit/COPYING
!! or http://www.gnu.org/copyleft/gpl.txt .
!!
!! NOTES
!! This file comes directly from defs_basis.F90 module delivered with ABINIT.
!!
!! FOR DEVELOPPERS: in order to preserve the portability of libPAW library,
!! please consult ~abinit/src/??_libpaw/libpaw-coding-rules.txt
!!
!! SOURCE
module m_libpaw_defs
implicit none
!Double precision real/complex subtypes
!-----------------------------------------------
integer, parameter :: dp=kind(1.0d0) !Nb of bytes related to DP real numbers
integer, parameter :: dpc=kind((1.0_dp,1.0_dp)) !Nb of bytes related to DP complex numbers
!Real constants
!-----------------------------------------------
real(dp), parameter :: zero=0._dp
real(dp), parameter :: one=1._dp
real(dp), parameter :: two=2._dp
real(dp), parameter :: three=3._dp
real(dp), parameter :: four =4._dp
real(dp), parameter :: six =6._dp
real(dp), parameter :: seven=7._dp
real(dp), parameter :: eight=8._dp
real(dp), parameter :: nine =9._dp
real(dp), parameter :: ten =10._dp
real(dp), parameter :: half=one/two
real(dp), parameter :: third=one/three
real(dp), parameter :: two_thirds=two/three
real(dp), parameter :: four_thirds=four/three
real(dp), parameter :: quarter=one/four
real(dp), parameter :: three_quarters=three/four
real(dp), parameter :: eighth=one/eight
real(dp), parameter :: ninth=one/nine
real(dp), parameter :: sqrt2=1.4142135623730950488016887242096939_dp
real(dp), parameter :: sqrt3=1.7320508075688772935274463415058739_dp
real(dp), parameter :: sqrthalf=0.70710678118654752440084436210484697_dp
real(dp), parameter :: pi=3.141592653589793238462643383279502884197_dp
real(dp), parameter :: piinv=one/pi
real(dp), parameter :: two_pi=two*pi
real(dp), parameter :: four_pi=four*pi
real(dp), parameter :: tol3= 0.001_dp
real(dp), parameter :: tol6= 0.000001_dp
real(dp), parameter :: tol8= 0.00000001_dp
real(dp), parameter :: tol9= 0.000000001_dp
real(dp), parameter :: tol10=0.0000000001_dp
real(dp), parameter :: tol12=0.000000000001_dp
real(dp), parameter :: tol14=0.00000000000001_dp
real(dp), parameter :: tol16=0.0000000000000001_dp
real(dp), parameter :: half_sqrt2=0.70710678118654752440084436210484697_dp
!Complex constants
!-----------------------------------------------
complex(dpc), parameter :: czero=(0._dp,0._dp) ! 0 (complex)
complex(dpc), parameter :: cone =(1._dp,0._dp) ! 1 (complex)
complex(dpc), parameter :: j_dpc = dcmplx(0.d0,1.d0) ! j (complex)
!Character constants
!-----------------------------------------------
character(len=1), parameter :: ch10 = char(10) ! carriage return
integer, parameter :: fnlen=264 ! maximum length of file name variables
integer, parameter :: strlen=2000000 ! maximum length of input string
!UNIX unit numbers
!-----------------------------------------------
integer, save :: ab_out= 7 ! output file
integer, save :: std_out=6 ! standard output
integer, parameter :: std_err=0 ! standard error
integer, parameter :: tmp_unit=9,tmp_unit2=10 ! units for temporary files
!Real physical constants
!-----------------------------------------------
real(dp), parameter :: Bohr_Ang=0.52917720859_dp ! 1 Bohr, in Angstrom
real(dp), parameter :: Ha_eV=27.21138386_dp ! 1 Hartree, in eV
real(dp), parameter :: InvFineStruct=137.035999679_dp ! Inverse of fine structure constant
real(dp), parameter :: FineStructureConstant2=0.000053251354478_dp ! Square of fine structure
!A collection of small datatypes for ragged arrays
!-----------------------------------------------
type coeffi1_type !A small datatype for ragged integer 1D-arrays
integer, allocatable :: value(:)
end type coeffi1_type
type coeff1_type !A small datatype for ragged real 1D-arrays
real(dp), allocatable :: value(:)
end type coeff1_type
type coeff2_type !A small datatype for ragged real 2D-arrays
real(dp), allocatable :: value(:,:)
end type coeff2_type
type coeff3_type !A small datatype for ragged real 3D-arrays
real(dp), allocatable :: value(:,:,:)
end type coeff3_type
!Small functions used in cpp macros
!-----------------------------------------------
public :: to_array
interface to_array
module procedure to_array1
module procedure to_array2
module procedure to_array3
module procedure to_array4
module procedure to_array5
module procedure to_array6
end interface to_array
contains
function to_array1(i1) result(arr)
integer :: i1,arr(1)
arr=(/i1/)
end function to_array1
function to_array2(i1,i2) result(arr)
integer :: i1,i2,arr(2)
arr=(/i1,i2/)
end function to_array2
function to_array3(i1,i2,i3) result(arr)
integer :: i1,i2,i3,arr(3)
arr=(/i1,i2,i3/)
end function to_array3
function to_array4(i1,i2,i3,i4) result(arr)
integer :: i1,i2,i3,i4,arr(4)
arr=(/i1,i2,i3,i4/)
end function to_array4
function to_array5(i1,i2,i3,i4,i5) result(arr)
integer :: i1,i2,i3,i4,i5,arr(5)
arr=(/i1,i2,i3,i4,i5/)
end function to_array5
function to_array6(i1,i2,i3,i4,i5,i6) result(arr)
integer :: i1,i2,i3,i4,i5,i6,arr(6)
arr=(/i1,i2,i3,i4,i5,i6/)
end function to_array6
end module m_libpaw_defs
!!***