13#include "./base/base_uses.f90"
18 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'optimize_basis_types'
29 TYPE exp_constraint_type
30 INTEGER :: const_type = -1
31 REAL(kind=
dp) :: llim = -1.0_dp, ulim = -1.0_dp
32 REAL(kind=
dp) :: init = -1.0_dp, var_fac = -1.0_dp
33 END TYPE exp_constraint_type
40 INTEGER :: lmin = -1, lmax = -1, nexp = -1
41 INTEGER :: n = -1, ncon_tot = -1, nl = -1
42 INTEGER,
DIMENSION(:),
ALLOCATABLE :: l
43 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: coeff
44 LOGICAL,
DIMENSION(:, :),
ALLOCATABLE :: opt_coeff
45 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: coeff_x_ind
46 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: exps
47 LOGICAL,
DIMENSION(:),
ALLOCATABLE :: opt_exps
48 INTEGER,
DIMENSION(:),
ALLOCATABLE :: exp_x_ind
49 LOGICAL,
DIMENSION(:),
ALLOCATABLE :: exp_has_const
50 TYPE(exp_constraint_type),
DIMENSION(:), &
51 ALLOCATABLE :: exp_const
56 CHARACTER(LEN=default_string_length) :: basis_name =
""
64 LOGICAL,
DIMENSION(:),
ALLOCATABLE :: in_use
65 END TYPE use_contr_type
69 CHARACTER(LEN=default_string_length) :: basis_name =
""
70 INTEGER :: reference_set = -1
71 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: remove_contr
72 INTEGER :: nsets = -1, ncontr = -1
73 INTEGER,
DIMENSION(:),
ALLOCATABLE :: remove_set
74 LOGICAL,
DIMENSION(:),
ALLOCATABLE :: in_use_set
75 TYPE(use_contr_type),
DIMENSION(:),
ALLOCATABLE :: use_contr
84 CHARACTER(LEN=default_string_length) :: basis_name =
""
85 CHARACTER(LEN=default_string_length) :: element =
""
86 INTEGER :: nbasis_deriv = -1
88 ALLOCATABLE :: deriv_info
90 END TYPE kind_basis_type
94 INTEGER,
DIMENSION(:),
ALLOCATABLE :: member_list
95 END TYPE comp_group_type
102 TYPE(comp_group_type),
DIMENSION(:),
ALLOCATABLE :: comp_group
103 INTEGER :: ntraining_sets = -1
104 INTEGER :: ncombinations = -1
105 LOGICAL :: use_condition_number = .false.
106 INTEGER,
DIMENSION(:),
POINTER :: group_partition => null()
107 INTEGER :: n_groups_created = -1
108 INTEGER,
DIMENSION(:),
ALLOCATABLE :: sub_sources
109 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: combination
110 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: fval_weight
111 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: condition_weight
113 REAL(kind=
dp) :: occupied_weight = 1.0_dp
114 REAL(kind=
dp) :: virtual_weight = 1.0_dp
115 REAL(kind=
dp) :: empty_overlap_weight = 1.0_dp
116 REAL(kind=
dp) :: gap_weight = 1.0e-3_dp
117 REAL(kind=
dp) :: coefficient_weight = 1.0e-3_dp
118 REAL(kind=
dp) :: gap_energy_scale = 0.0_dp
119 REAL(kind=
dp) :: virtual_energy_cutoff = 0.0_dp
120 REAL(kind=
dp) :: virtual_energy_smoothing = 0.0_dp
121 LOGICAL :: quiet_output = .false.
122 INTEGER :: nkind = -1
123 INTEGER :: write_frequency = -1
124 INTEGER :: nbasis_deriv_types = -1
125 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: x_opt
126 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: x_initial
128 CHARACTER(LEN=default_path_length),
DIMENSION(:),
ALLOCATABLE :: training_input
129 CHARACTER(LEN=default_path_length),
DIMENSION(:),
ALLOCATABLE :: training_dir
130 CHARACTER(LEN=default_path_length) :: work_basis_file =
""
131 CHARACTER(LEN=default_path_length) :: output_basis_file =
""
132 CHARACTER(LEN=default_path_length) :: template_basis_file =
""
133 TYPE(kind_basis_type),
DIMENSION(:),
ALLOCATABLE :: kind_basis
134 INTEGER :: opt_id = -1
150 INTEGER :: igroup, ikind
152 IF (
ASSOCIATED(opt_bas%group_partition))
DEALLOCATE (opt_bas%group_partition)
153 IF (
ALLOCATED(opt_bas%sub_sources))
DEALLOCATE (opt_bas%sub_sources)
154 IF (
ALLOCATED(opt_bas%combination))
DEALLOCATE (opt_bas%combination)
155 IF (
ALLOCATED(opt_bas%x_opt))
DEALLOCATE (opt_bas%x_opt)
156 IF (
ALLOCATED(opt_bas%x_initial))
DEALLOCATE (opt_bas%x_initial)
157 IF (
ALLOCATED(opt_bas%training_input))
DEALLOCATE (opt_bas%training_input)
158 IF (
ALLOCATED(opt_bas%training_dir))
DEALLOCATE (opt_bas%training_dir)
159 IF (
ALLOCATED(opt_bas%fval_weight))
DEALLOCATE (opt_bas%fval_weight)
160 IF (
ALLOCATED(opt_bas%condition_weight))
DEALLOCATE (opt_bas%condition_weight)
162 IF (
ALLOCATED(opt_bas%comp_group))
THEN
163 DO igroup = 1,
SIZE(opt_bas%comp_group)
164 IF (
ALLOCATED(opt_bas%comp_group(igroup)%member_list))
DEALLOCATE (opt_bas%comp_group(igroup)%member_list)
166 DEALLOCATE (opt_bas%comp_group)
169 IF (
ALLOCATED(opt_bas%kind_basis))
THEN
170 DO ikind = 1,
SIZE(opt_bas%kind_basis)
171 CALL deallocate_kind_basis(opt_bas%kind_basis(ikind))
173 DEALLOCATE (opt_bas%kind_basis)
184 SUBROUTINE deallocate_kind_basis(kind)
185 TYPE(kind_basis_type) :: kind
187 INTEGER :: ibasis, icont, iinfo, iset
189 IF (
ALLOCATED(kind%deriv_info))
THEN
190 DO iinfo = 0,
SIZE(kind%deriv_info) - 1
191 IF (
ALLOCATED(kind%deriv_info(iinfo)%remove_contr))
DEALLOCATE (kind%deriv_info(iinfo)%remove_contr)
192 IF (
ALLOCATED(kind%deriv_info(iinfo)%remove_set))
DEALLOCATE (kind%deriv_info(iinfo)%remove_set)
193 IF (
ALLOCATED(kind%deriv_info(iinfo)%in_use_set))
DEALLOCATE (kind%deriv_info(iinfo)%in_use_set)
194 IF (
ALLOCATED(kind%deriv_info(iinfo)%use_contr))
THEN
195 DO icont = 1,
SIZE(kind%deriv_info(iinfo)%use_contr)
196 IF (
ALLOCATED(kind%deriv_info(iinfo)%use_contr(icont)%in_use))
THEN
197 DEALLOCATE (kind%deriv_info(iinfo)%use_contr(icont)%in_use)
200 DEALLOCATE (kind%deriv_info(iinfo)%use_contr)
203 DEALLOCATE (kind%deriv_info)
206 IF (
ALLOCATED(kind%flex_basis))
THEN
207 DO ibasis = 0,
SIZE(kind%flex_basis) - 1
208 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset))
THEN
209 DO iset = 1,
SIZE(kind%flex_basis(ibasis)%subset)
210 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%l))
THEN
211 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%l)
213 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%coeff))
THEN
214 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%coeff)
216 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%opt_coeff))
THEN
217 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%opt_coeff)
219 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%coeff_x_ind))
THEN
220 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%coeff_x_ind)
222 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%exps))
THEN
223 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%exps)
225 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%opt_exps))
THEN
226 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%opt_exps)
228 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%exp_x_ind))
THEN
229 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%exp_x_ind)
231 IF (
ALLOCATED(kind%flex_basis(ibasis)%subset(iset)%exp_const))
THEN
232 DEALLOCATE (kind%flex_basis(ibasis)%subset(iset)%exp_const)
235 DEALLOCATE (kind%flex_basis(ibasis)%subset)
238 DEALLOCATE (kind%flex_basis)
241 END SUBROUTINE deallocate_kind_basis
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
integer, parameter, public method_mo_fit_occ
subroutine, public deallocate_basis_optimization_type(opt_bas)
Deallocate everything which was allocated before. Note not all arrays are used depending on the type ...
integer, parameter, public method_mo_fit_occ_virtual
type containing all information needed for basis matching