1! This file is part of xtb.
2!
3! Copyright (C) 2017-2020 Stefan Grimme
4!
5! xtb is free software: you can redistribute it and/or modify it under
6! the terms of the GNU Lesser General Public License as published by
7! the Free Software Foundation, either version 3 of the License, or
8! (at your option) any later version.
9!
10! xtb is distributed in the hope that it will be useful,
11! but WITHOUT ANY WARRANTY; without even the implied warranty of
12! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13! GNU Lesser General Public License for more details.
14!
15! You should have received a copy of the GNU Lesser General Public License
16! along with xtb.  If not, see <https://www.gnu.org/licenses/>.
17
18module xtb_type_param
19   use xtb_mctc_accuracy, only : wp
20   implicit none
21
22   public :: dftd_parameter
23   public :: TxTBParameter
24   public ::  scc_parameter
25
26   public :: chrg_parameter
27   private
28
29   type :: TxTBParameter
30      real(wp) :: kshell(0:3) = 0.0_wp
31      real(wp) :: ksp = 0.0_wp
32      real(wp) :: ksd = 0.0_wp
33      real(wp) :: kpd = 0.0_wp
34      real(wp) :: kdiff = 0.0_wp
35      real(wp) :: kdiffa = 0.0_wp
36      real(wp) :: kdiffb = 0.0_wp
37      real(wp) :: enshell(0:3) = 0.0_wp
38      real(wp) :: enscale4 = 0.0_wp
39      real(wp) :: cnshell(2, 0:3) = 0.0_wp
40      real(wp) :: gam3shell(2, 0:3) = 0.0_wp
41      real(wp) :: srbshift = 0.0_wp
42      real(wp) :: srbpre = 0.0_wp
43      real(wp) :: srbexp = 0.0_wp
44      real(wp) :: srbken = 0.0_wp
45      real(wp) :: wllscal = 0.0_wp
46      real(wp) :: gscal = 0.0_wp
47      real(wp) :: zcnf = 0.0_wp
48      real(wp) :: tscal = 0.0_wp
49      real(wp) :: kcn = 0.0_wp
50      real(wp) :: fpol = 0.0_wp
51      real(wp) :: ken = 0.0_wp
52      real(wp) :: lshift = 0.0_wp
53      real(wp) :: lshifta = 0.0_wp
54      real(wp) :: split = 0.0_wp
55      real(wp) :: zqf = 0.0_wp
56      real(wp) :: alphaj = 0.0_wp
57      real(wp) :: kexpo = 0.0_wp
58      real(wp) :: dispa = 0.0_wp
59      real(wp) :: dispb = 0.0_wp
60      real(wp) :: dispc = 0.0_wp
61      real(wp) :: dispatm = 0.0_wp
62      real(wp) :: xbdamp = 0.0_wp
63      real(wp) :: xbrad = 0.0_wp
64      real(wp) :: aesshift = 0.0_wp
65      real(wp) :: aesexp = 0.0_wp
66      real(wp) :: aesrmax = 0.0_wp
67      real(wp) :: aesdmp3 = 0.0_wp
68      real(wp) :: aesdmp5 = 0.0_wp
69      real(wp) :: ipeashift = 0.0_wp
70      real(wp) :: renscale = 0.0_wp
71   end type TxTBParameter
72
73   type :: dftd_parameter
74      real(wp) :: s6  = -1.0_wp
75      real(wp) :: s8  = -1.0_wp
76      real(wp) :: s10 =  0.0_wp
77      real(wp) :: a1  = -1.0_wp
78      real(wp) :: a2  = -1.0_wp
79      real(wp) :: s9  =  1.0_wp
80      integer  :: alp = 16
81      ! for MBD@rsSCS
82      real(wp) :: beta = 1.0_wp
83   end type dftd_parameter
84
85   type :: scc_parameter
86      real(wp) :: gam3l(0:3)
87      real(wp) :: ipshift
88      real(wp) :: eashift
89      real(wp) :: g_a
90      real(wp) :: g_c
91      real(wp) :: wf
92   end type scc_parameter
93
94   type chrg_parameter
95      integer  :: n
96      real(wp),allocatable :: en(:)
97      real(wp),allocatable :: gam(:)
98      real(wp),allocatable :: kappa(:)
99      real(wp),allocatable :: alpha(:)
100      real(wp),allocatable :: dpol(:)
101      real(wp),allocatable :: beta(:)
102   contains
103      procedure :: allocate => allocate_chrgeq
104      procedure :: deallocate => deallocate_chrgeq
105   end type chrg_parameter
106
107contains
108
109subroutine allocate_chrgeq(self,n,extended)
110   implicit none
111   class(chrg_parameter) :: self
112   integer,intent(in) :: n
113   logical,intent(in),optional :: extended
114   logical :: multipoles
115   if (present(extended)) then
116      multipoles = extended
117   else
118      multipoles = .false.
119   endif
120   call self%deallocate
121   allocate( self%en(n),    source = 0.0_wp )
122   allocate( self%gam(n),   source = 0.0_wp )
123   allocate( self%kappa(n), source = 0.0_wp )
124   allocate( self%alpha(n), source = 0.0_wp )
125   if (multipoles) then
126   allocate( self%dpol(n),  source = 0.0_wp )
127   allocate( self%beta(n),  source = 0.0_wp )
128   endif
129end subroutine allocate_chrgeq
130
131subroutine deallocate_chrgeq(self)
132   implicit none
133   class(chrg_parameter) :: self
134   if (allocated(self%en))    deallocate(self%en)
135   if (allocated(self%gam))   deallocate(self%gam)
136   if (allocated(self%kappa)) deallocate(self%kappa)
137   if (allocated(self%alpha)) deallocate(self%alpha)
138   if (allocated(self%dpol))  deallocate(self%dpol)
139   if (allocated(self%beta))  deallocate(self%beta)
140end subroutine deallocate_chrgeq
141
142end module xtb_type_param
143