Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief Defines control structures, which contain the parameters and the
10 : !> settings for the DFT-based calculations.
11 : ! **************************************************************************************************
12 : MODULE cp_control_types
13 : USE cp_fm_types, ONLY: cp_fm_release,&
14 : cp_fm_type
15 : USE eeq_input, ONLY: eeq_solver_type
16 : USE input_constants, ONLY: do_full_density,&
17 : rtp_bse_ham_G0W0,&
18 : rtp_method_tddft,&
19 : tblite_scc_mixer_auto,&
20 : use_mom_ref_coac
21 : USE kinds, ONLY: default_path_length,&
22 : default_string_length,&
23 : dp
24 : USE pair_potential_types, ONLY: pair_potential_p_release,&
25 : pair_potential_p_type
26 : USE qs_cdft_types, ONLY: cdft_control_create,&
27 : cdft_control_release,&
28 : cdft_control_type
29 : USE smeagol_control_types, ONLY: smeagol_control_create,&
30 : smeagol_control_release,&
31 : smeagol_control_type
32 : USE xas_control, ONLY: xas_control_release,&
33 : xas_control_type
34 : USE xas_tdp_types, ONLY: xas_tdp_control_create,&
35 : xas_tdp_control_release,&
36 : xas_tdp_control_type
37 : #include "./base/base_uses.f90"
38 :
39 : IMPLICIT NONE
40 :
41 : PRIVATE
42 :
43 : !***************************************************************************************************
44 : !\brief Control parameters for hairy-probes DFT
45 : !***************************************************************************************************
46 : TYPE hairy_probes_type
47 : REAL(KIND=dp) :: alpha = 0.0_dp ! solution probes parameter
48 : REAL(KIND=dp) :: mu = 0.0_dp ! chemical potenatial of electrons in reservoir
49 : REAL(KIND=dp) :: T = 0.0_dp ! temperature of electrons in reservoir
50 : REAL(KIND=dp) :: eps_hp = 0.0_dp ! tolerance for accuracy checks on occupation numbers
51 : INTEGER :: natoms = 0, &
52 : last_ao = 0, &
53 : first_ao = 0
54 : INTEGER, DIMENSION(:), POINTER :: atom_ids => NULL() ! atom ids to which the probes are attached
55 : END TYPE hairy_probes_type
56 :
57 : ! **************************************************************************************************
58 : ! \brief Control parameters for pw grids
59 : ! **************************************************************************************************
60 : TYPE pw_grid_option
61 : LOGICAL :: spherical = .FALSE.
62 : LOGICAL :: fullspace = .FALSE.
63 : INTEGER, DIMENSION(2) :: distribution_layout = 0
64 : INTEGER :: blocked = 0
65 : END TYPE pw_grid_option
66 :
67 : ! **************************************************************************************************
68 : ! \brief parameters for EMD/RTP calculations involving MO projections
69 : ! **************************************************************************************************
70 : TYPE proj_mo_type
71 : INTEGER, DIMENSION(:), ALLOCATABLE :: ref_mo_index
72 : INTEGER :: ref_mo_spin = 1
73 : INTEGER :: ref_nlumo = 0
74 : LOGICAL :: sum_on_all_ref = .FALSE.
75 : INTEGER, DIMENSION(:), ALLOCATABLE :: td_mo_index
76 : REAL(dp), DIMENSION(:), ALLOCATABLE :: td_mo_occ
77 : INTEGER :: td_mo_spin = 1
78 : LOGICAL :: sum_on_all_td = .FALSE.
79 : CHARACTER(LEN=default_path_length) :: ref_mo_file_name = ""
80 : LOGICAL :: propagate_ref = .FALSE.
81 : TYPE(cp_fm_type), DIMENSION(:), &
82 : ALLOCATABLE :: mo_ref
83 : END TYPE proj_mo_type
84 :
85 : TYPE proj_mo_p_type
86 : TYPE(proj_mo_type), POINTER :: proj_mo => NULL()
87 : END TYPE proj_mo_p_type
88 :
89 : ! **************************************************************************************************
90 : ! \brief Control parameters for REAL_TIME_PROPAGATION calculations
91 : ! **************************************************************************************************
92 : TYPE rtp_control_type
93 : LOGICAL :: converged = .FALSE.
94 : REAL(KIND=dp) :: eps_ener = 0.0_dp
95 : INTEGER :: max_iter = 0
96 : INTEGER :: mat_exp = 0
97 : INTEGER :: propagator = 0
98 : LOGICAL :: fixed_ions = .FALSE.
99 : INTEGER :: rtp_method = rtp_method_tddft
100 : INTEGER :: rtbse_ham = rtp_bse_ham_G0W0
101 : INTEGER :: initial_wfn = 0
102 : REAL(dp) :: eps_exp = 0.0_dp
103 : LOGICAL :: initial_step = .FALSE.
104 : LOGICAL :: hfx_redistribute = .FALSE.
105 : INTEGER :: aspc_order = 0
106 : INTEGER :: sc_check_start = 0
107 : LOGICAL :: apply_wfn_mix_init_restart = .FALSE.
108 : LOGICAL :: apply_delta_pulse = .FALSE.
109 : LOGICAL :: apply_delta_pulse_mag = .FALSE.
110 : LOGICAL :: periodic = .FALSE.
111 : LOGICAL :: linear_scaling = .FALSE.
112 : LOGICAL :: write_restart = .FALSE.
113 : INTEGER :: mcweeny_max_iter = 0
114 : INTEGER :: acc_ref = 0
115 : REAL(dp) :: mcweeny_eps = 0.0_dp
116 : INTEGER, DIMENSION(3) :: delta_pulse_direction = 0
117 : REAL(KIND=dp) :: delta_pulse_scale = 0.0_dp
118 : LOGICAL :: velocity_gauge = .FALSE.
119 : REAL(KIND=dp), DIMENSION(3) :: field = 0.0_dp
120 : REAL(KIND=dp), DIMENSION(3) :: vec_pot = 0.0_dp
121 : LOGICAL :: nl_gauge_transform = .FALSE.
122 : LOGICAL :: is_proj_mo = .FALSE.
123 : TYPE(proj_mo_p_type), DIMENSION(:), &
124 : POINTER :: proj_mo_list => NULL()
125 : ! Switch to turn on moments trace saving
126 : LOGICAL :: save_local_moments = .FALSE.
127 : INTEGER :: moment_trace_ref_type = use_mom_ref_coac
128 : REAL(dp), DIMENSION(:), POINTER :: moment_trace_user_ref_point => NULL()
129 : REAL(dp) :: ft_damping = -1.0_dp
130 : REAL(dp) :: ft_t0 = 0.0_dp
131 : ! Index 1 : number of the element, Index 2 : coordinates
132 : ! e.g. if xx and xz elements are to be printed
133 : ! print_pol_elements(1,1) = 1
134 : ! print_pol_elements(1,2) = 1
135 : ! print_pol_elements(2,1) = 1
136 : ! print_pol_elements(2,2) = 3
137 : INTEGER, DIMENSION(:, :), POINTER :: print_pol_elements => NULL()
138 : LOGICAL :: pade_requested = .FALSE.
139 : REAL(dp) :: pade_e_min = 0.0_dp
140 : REAL(dp) :: pade_e_step = 0.02_dp
141 : REAL(dp) :: pade_e_max = 100.0_dp
142 : REAL(dp) :: pade_fit_e_min = 0.0_dp
143 : REAL(dp) :: pade_fit_e_max = 300.0_dp
144 : END TYPE rtp_control_type
145 :
146 : ! **************************************************************************************************
147 : ! \brief Control parameters for DFTB calculations
148 : ! **************************************************************************************************
149 : TYPE dftb_control_type
150 : LOGICAL :: self_consistent = .FALSE.
151 : LOGICAL :: orthogonal_basis = .FALSE.
152 : LOGICAL :: dispersion = .FALSE.
153 : INTEGER :: tblite_scc_mixer = tblite_scc_mixer_auto
154 : INTEGER :: dispersion_type = 0
155 : LOGICAL :: dftb3_diagonal = .FALSE.
156 : LOGICAL :: hb_sr_damp = .FALSE.
157 : REAL(KIND=dp) :: hb_sr_para = 0.0_dp
158 : REAL(KIND=dp) :: tblite_mixer_damping = 0.4_dp
159 : REAL(KIND=dp) :: eps_disp = 0.0_dp
160 : REAL(KIND=dp) :: epscn = 0.0_dp
161 : REAL(KIND=dp) :: exp_pre = 0.0_dp
162 : REAL(KIND=dp) :: scaling = 0.0_dp
163 : REAL(KIND=dp) :: rcdisp = 0.0_dp
164 : REAL(KIND=dp), DIMENSION(3) :: sd3 = 0.0_dp
165 : REAL(KIND=dp), DIMENSION(4) :: sd3bj = 0.0_dp
166 : LOGICAL :: do_ewald = .FALSE.
167 : CHARACTER(LEN=default_path_length) :: sk_file_path = ""
168 : CHARACTER(LEN=default_path_length) :: sk_file_list = ""
169 : CHARACTER(LEN=default_string_length), &
170 : DIMENSION(:, :), POINTER :: sk_pair_list => NULL()
171 : CHARACTER(LEN=default_path_length) :: uff_force_field = ""
172 : CHARACTER(LEN=default_path_length) :: dispersion_parameter_file = ""
173 : END TYPE dftb_control_type
174 :
175 : ! **************************************************************************************************
176 : ! \brief Control parameters for xTB calculations
177 : ! **************************************************************************************************
178 : TYPE xtb_reference_cli_type
179 : LOGICAL :: enabled = .FALSE.
180 : LOGICAL :: check_energy = .TRUE.
181 : LOGICAL :: check_forces = .TRUE.
182 : LOGICAL :: check_virial = .FALSE.
183 : LOGICAL :: keep_files = .FALSE.
184 : LOGICAL :: stop_on_error = .FALSE.
185 : INTEGER :: iterations = 250
186 : REAL(KIND=dp) :: accuracy = 1.0_dp
187 : REAL(KIND=dp) :: error_limit = 1.0E-8_dp
188 : CHARACTER(LEN=default_path_length) :: program_name = "tblite"
189 : CHARACTER(LEN=default_path_length) :: work_directory = "."
190 : CHARACTER(LEN=default_path_length) :: prefix = "tblite-reference"
191 : END TYPE xtb_reference_cli_type
192 :
193 : TYPE xtb_control_type
194 : !
195 : INTEGER :: gfn_type = 1
196 : !
197 : LOGICAL :: do_ewald = .FALSE.
198 : LOGICAL :: do_tblite = .FALSE.
199 : !
200 : INTEGER :: sto_ng = 0
201 : INTEGER :: h_sto_ng = 0
202 : INTEGER :: tblite_method = 0
203 : INTEGER :: tblite_scc_mixer = tblite_scc_mixer_auto
204 : REAL(KIND=dp) :: tblite_mixer_damping = 0.4_dp
205 : !
206 : INTEGER :: vdw_type = -1
207 : CHARACTER(LEN=default_path_length) :: parameter_file_path = ""
208 : CHARACTER(LEN=default_path_length) :: parameter_file_name = ""
209 : !
210 : CHARACTER(LEN=default_path_length) :: dispersion_parameter_file = ""
211 : REAL(KIND=dp) :: epscn = 0.0_dp
212 : REAL(KIND=dp) :: rcdisp = 0.0_dp
213 : REAL(KIND=dp) :: s6 = 0.0_dp, s8 = 0.0_dp
214 : REAL(KIND=dp) :: a1 = 0.0_dp, a2 = 0.0_dp
215 : !
216 : REAL(KIND=dp) :: ks = 0.0_dp, kp = 0.0_dp, kd = 0.0_dp, ksp = 0.0_dp, k2sh = 0.0_dp
217 : REAL(KIND=dp) :: kg = 0.0_dp, kf = 0.0_dp
218 : REAL(KIND=dp) :: kcns = 0.0_dp, kcnp = 0.0_dp, kcnd = 0.0_dp
219 : REAL(KIND=dp) :: ken = 0.0_dp
220 : REAL(KIND=dp) :: ksen = 0.0_dp, kpen = 0.0_dp, kden = 0.0_dp
221 : REAL(KIND=dp) :: ben = 0.0_dp
222 : REAL(KIND=dp) :: kxr = 0.0_dp, kx2 = 0.0_dp
223 : REAL(KIND=dp) :: enscale = 0.0_dp
224 : !
225 : LOGICAL :: xb_interaction = .FALSE.
226 : LOGICAL :: do_nonbonded = .FALSE.
227 : LOGICAL :: coulomb_interaction = .FALSE.
228 : LOGICAL :: coulomb_lr = .FALSE.
229 : LOGICAL :: tb3_interaction = .FALSE.
230 : LOGICAL :: check_atomic_charges = .FALSE.
231 : LOGICAL :: var_dipole = .FALSE.
232 : !
233 : REAL(KIND=dp) :: xb_radius = 0.0_dp
234 : REAL(KIND=dp) :: coulomb_sr_cut = 0.0_dp
235 : REAL(KIND=dp) :: coulomb_sr_eps = 0.0_dp
236 : !
237 : CHARACTER(LEN=default_string_length), &
238 : DIMENSION(:, :), POINTER :: kab_param => NULL()
239 : INTEGER, DIMENSION(:, :), POINTER :: kab_types => NULL()
240 : INTEGER :: kab_nval = 0
241 : REAL, DIMENSION(:), POINTER :: kab_vals => NULL()
242 : !
243 : TYPE(pair_potential_p_type), POINTER :: nonbonded => NULL()
244 : REAL(KIND=dp) :: eps_pair = 0.0_dp
245 : REAL(KIND=dp), DIMENSION(:, :), &
246 : POINTER :: rcpair => NULL()
247 : !
248 : ! SRB terms
249 : REAL(KIND=dp) :: ksrb = 0.0_dp, esrb = 0.0_dp, gscal = 0.0_dp
250 : REAL(KIND=dp) :: c1srb = 0.0_dp, c2srb = 0.0_dp, shift = 0.0_dp
251 : !
252 : ! EN shift in EEQ (molecular=1 or crystaline=2)
253 : INTEGER :: enshift_type = 1
254 : TYPE(eeq_solver_type) :: eeq_sparam ! parameters for EEQ solver
255 : TYPE(xtb_reference_cli_type) :: reference_cli
256 : END TYPE xtb_control_type
257 :
258 : ! **************************************************************************************************
259 : ! \brief Control parameters for semi empirical calculations
260 : ! **************************************************************************************************
261 : TYPE semi_empirical_control_type
262 : LOGICAL :: orthogonal_basis = .FALSE.
263 : LOGICAL :: analytical_gradients = .FALSE.
264 : LOGICAL :: force_kdsod_EX = .FALSE.
265 : LOGICAL :: do_ewald = .FALSE., do_ewald_r3 = .FALSE., do_ewald_gks = .FALSE.
266 : INTEGER :: integral_screening = 0, periodic_type = 0
267 : INTEGER :: max_multipole = 0
268 : INTEGER :: ga_ncells = 0
269 : REAL(KIND=dp) :: delta = 0.0_dp
270 : ! Dispersion pair potential
271 : LOGICAL :: dispersion = .FALSE.
272 : REAL(KIND=dp) :: rcdisp = 0.0_dp
273 : REAL(KIND=dp) :: epscn = 0.0_dp
274 : REAL(KIND=dp), DIMENSION(3) :: sd3 = 0.0_dp
275 : CHARACTER(LEN=default_path_length) :: dispersion_parameter_file = ""
276 : ! Parameters controlling the evaluation of the integrals
277 : REAL(KIND=dp) :: cutoff_lrc = 0.0_dp, taper_lrc = 0.0_dp, range_lrc = 0.0_dp
278 : REAL(KIND=dp) :: cutoff_cou = 0.0_dp, taper_cou = 0.0_dp, range_cou = 0.0_dp
279 : REAL(KIND=dp) :: cutoff_exc = 0.0_dp, taper_exc = 0.0_dp, range_exc = 0.0_dp
280 : REAL(KIND=dp) :: taper_scr = 0.0_dp, range_scr = 0.0_dp
281 : END TYPE semi_empirical_control_type
282 :
283 : ! **************************************************************************************************
284 : ! \brief Control parameters for GAPW method within QUICKSTEP ***
285 : ! **************************************************************************************************
286 : TYPE gapw_control_type
287 : INTEGER :: basis_1c = 0
288 : REAL(KIND=dp) :: eps_fit = 0.0_dp, &
289 : eps_iso = 0.0_dp, &
290 : eps_Vrho0 = 0.0_dp, &
291 : eps_svd = 0.0_dp, &
292 : eps_cpc = 0.0_dp
293 : INTEGER :: ladd_rho0 = 0, &
294 : lmax_rho0 = 0, &
295 : lmax_sphere = 0, &
296 : quadrature = 0
297 : LOGICAL :: accurate_xcint = .FALSE.
298 : REAL(KIND=dp) :: aweights = 0.0_dp
299 : REAL(KIND=dp), DIMENSION(:), POINTER :: aw => NULL()
300 : LOGICAL :: alpha0_hard_from_input = .FALSE., &
301 : force_paw = .FALSE., &
302 : non_paw_atoms = .FALSE., &
303 : nopaw_as_gpw = .FALSE.
304 : REAL(KIND=dp) :: alpha0_hard = 0.0_dp
305 : REAL(KIND=dp) :: max_rad_local = 0.0_dp
306 : END TYPE gapw_control_type
307 :
308 : ! **************************************************************************************************
309 : ! \brief parameters for calculations involving a time dependent electric field
310 : ! **************************************************************************************************
311 : TYPE efield_type
312 : REAL(KIND=dp) :: actual_time = 0.0_dp
313 : REAL(KIND=dp), DIMENSION(:), POINTER :: polarisation => NULL()
314 : INTEGER :: envelop_id = 0
315 : REAL(KIND=dp), DIMENSION(:), POINTER :: envelop_r_vars => NULL()
316 : INTEGER, DIMENSION(:), POINTER :: envelop_i_vars => NULL()
317 : REAL(KIND=dp) :: strength = 0.0_dp
318 : REAL(KIND=dp) :: phase_offset = 0.0_dp
319 : REAL(KIND=dp) :: wavelength = 0.0_dp
320 : REAL(KIND=dp), DIMENSION(3) :: vec_pot_initial = 0.0_dp
321 : END TYPE efield_type
322 :
323 : TYPE efield_p_type
324 : TYPE(efield_type), POINTER :: efield => NULL()
325 : END TYPE efield_p_type
326 :
327 : ! **************************************************************************************************
328 : ! \brief parameters for calculations involving a time dependent electric field
329 : ! **************************************************************************************************
330 : TYPE period_efield_type
331 : LOGICAL :: displacement_field = .FALSE.
332 : REAL(KIND=dp), DIMENSION(3) :: polarisation = 0.0_dp
333 : REAL(KIND=dp), DIMENSION(3) :: d_filter = 0.0_dp
334 : REAL(KIND=dp) :: strength = 0.0_dp
335 : REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: strength_list
336 : INTEGER :: start_frame = 0
337 : INTEGER :: end_frame = -1
338 : END TYPE period_efield_type
339 :
340 : ! **************************************************************************************************
341 : ! \brief some parameters useful for mulliken_restraints
342 : ! **************************************************************************************************
343 : TYPE mulliken_restraint_type
344 : REAL(KIND=dp) :: strength = 0.0_dp
345 : REAL(KIND=dp) :: TARGET = 0.0_dp
346 : INTEGER :: natoms = 0
347 : INTEGER, POINTER, DIMENSION(:) :: atoms => NULL()
348 : END TYPE mulliken_restraint_type
349 :
350 : ! **************************************************************************************************
351 : ! \brief some parameters useful for ddapc_restraints
352 : ! **************************************************************************************************
353 : TYPE ddapc_restraint_type
354 : INTEGER :: ref_count = 0
355 : REAL(KIND=dp) :: strength = 0.0_dp
356 : REAL(KIND=dp) :: TARGET = 0.0_dp
357 : REAL(KIND=dp) :: ddapc_order_p = 0.0_dp
358 : INTEGER :: functional_form = 0
359 : INTEGER :: natoms = 0
360 : INTEGER, POINTER, DIMENSION(:) :: atoms => NULL()
361 : REAL(KIND=dp), POINTER, DIMENSION(:) :: coeff => NULL()
362 : INTEGER :: density_type = 0
363 : END TYPE ddapc_restraint_type
364 :
365 : ! **************************************************************************************************
366 : ! \brief some parameters useful for s2_restraints
367 : ! **************************************************************************************************
368 : TYPE s2_restraint_type
369 : REAL(KIND=dp) :: strength = 0.0_dp
370 : REAL(KIND=dp) :: TARGET = 0.0_dp
371 : REAL(KIND=dp) :: s2_order_p = 0.0_dp
372 : INTEGER :: functional_form = 0
373 : END TYPE s2_restraint_type
374 :
375 : ! **************************************************************************************************
376 : ! \brief some parameters useful for auxiliary density matrix method
377 : ! **************************************************************************************************
378 : TYPE admm_block_type
379 : INTEGER, DIMENSION(:), ALLOCATABLE :: list
380 : END TYPE admm_block_type
381 :
382 : TYPE admm_control_type
383 : REAL(KIND=dp) :: eps_filter = 0.0_dp
384 : INTEGER :: admm_type = 0
385 : INTEGER :: purification_method = 0
386 : INTEGER :: method = 0
387 : LOGICAL :: charge_constrain = .FALSE.
388 : INTEGER :: scaling_model = 0
389 : INTEGER :: aux_exch_func = 0
390 : LOGICAL :: aux_exch_func_param = .FALSE.
391 : REAL(KIND=dp), DIMENSION(3) :: aux_x_param = 0.0_dp
392 : TYPE(admm_block_type), DIMENSION(:), &
393 : ALLOCATABLE :: blocks
394 : END TYPE admm_control_type
395 :
396 : ! **************************************************************************************************
397 : ! \brief Parameters for external potential
398 : ! **************************************************************************************************
399 : TYPE expot_control_type
400 : LOGICAL :: read_from_cube = .FALSE.
401 : LOGICAL :: maxwell_solver = .FALSE.
402 : LOGICAL :: static = .FALSE.
403 : REAL(KIND=dp) :: scaling_factor = 0.0_dp
404 : END TYPE expot_control_type
405 :
406 : ! **************************************************************************************************
407 : ! \brief Parameters useful for Maxwell equation evaluation of external potential
408 : ! **************************************************************************************************
409 : TYPE maxwell_control_type
410 : LOGICAL :: log_test = .FALSE.
411 : INTEGER :: int_test = 0
412 : REAL(KIND=dp) :: real_test = 0.0_dp
413 : END TYPE maxwell_control_type
414 :
415 : ! **************************************************************************************************
416 : ! \brief Control parameters for a QUICKSTEP and KIM-GORDON calculation ***
417 : ! eps_pgf_orb: Cutoff value for the interaction of the primitive
418 : ! Gaussian-type functions (primitive basis functions).
419 : ! **************************************************************************************************
420 : TYPE qs_control_type
421 : INTEGER :: method_id = 0
422 : REAL(KIND=dp) :: eps_core_charge = 0.0_dp, &
423 : eps_kg_orb = 0.0_dp, &
424 : eps_pgf_orb = 0.0_dp, &
425 : eps_ppl = 0.0_dp, &
426 : eps_ppnl = 0.0_dp, &
427 : eps_rho_gspace = 0.0_dp, &
428 : eps_rho_rspace = 0.0_dp, &
429 : eps_filter_matrix = 0.0_dp, &
430 : eps_gvg_rspace = 0.0_dp, &
431 : progression_factor = 0.0_dp, &
432 : relative_cutoff = 0.0_dp
433 : LOGICAL :: do_almo_scf = .FALSE.
434 : LOGICAL :: do_ls_scf = .FALSE.
435 : LOGICAL :: do_kg = .FALSE.
436 : LOGICAL :: commensurate_mgrids = .FALSE.
437 : LOGICAL :: realspace_mgrids = .FALSE.
438 : LOGICAL :: gapw = .FALSE., gapw_xc = .FALSE., gpw = .FALSE., pao = .FALSE.
439 : LOGICAL :: lrigpw = .FALSE., rigpw = .FALSE.
440 : LOGICAL :: lri_optbas = .FALSE.
441 : LOGICAL :: ofgpw = .FALSE.
442 : LOGICAL :: dftb = .FALSE.
443 : LOGICAL :: xtb = .FALSE.
444 : LOGICAL :: semi_empirical = .FALSE.
445 : LOGICAL :: mulliken_restraint = .FALSE.
446 : LOGICAL :: ddapc_restraint = .FALSE.
447 : LOGICAL :: ddapc_restraint_is_spin = .FALSE.
448 : LOGICAL :: ddapc_explicit_potential = .FALSE.
449 : LOGICAL :: cdft = .FALSE.
450 : LOGICAL :: et_coupling_calc = .FALSE.
451 : LOGICAL :: s2_restraint = .FALSE.
452 : INTEGER :: do_ppl_method = 0
453 : INTEGER :: wf_interpolation_method_nr = 0
454 : INTEGER :: wf_extrapolation_order = 0
455 : INTEGER :: periodicity = 0
456 : REAL(KIND=dp) :: pairlist_radius = 0.0_dp
457 : REAL(KIND=dp) :: cutoff = 0.0_dp
458 : REAL(KIND=dp), DIMENSION(:), POINTER :: e_cutoff => NULL()
459 : TYPE(mulliken_restraint_type), &
460 : POINTER :: mulliken_restraint_control => NULL()
461 : TYPE(ddapc_restraint_type), &
462 : DIMENSION(:), POINTER :: ddapc_restraint_control => NULL()
463 : TYPE(cdft_control_type), POINTER :: cdft_control => NULL()
464 : TYPE(s2_restraint_type), POINTER :: s2_restraint_control => NULL()
465 : TYPE(dftb_control_type), POINTER :: dftb_control => NULL()
466 : TYPE(xtb_control_type), POINTER :: xtb_control => NULL()
467 : TYPE(semi_empirical_control_type), &
468 : POINTER :: se_control => NULL()
469 : TYPE(gapw_control_type), POINTER :: gapw_control => NULL()
470 : TYPE(pw_grid_option) :: pw_grid_opt = pw_grid_option()
471 : LOGICAL :: skip_load_balance_distributed = .FALSE.
472 : ! Types of subsystems for embedding
473 : LOGICAL :: ref_embed_subsys = .FALSE.
474 : LOGICAL :: cluster_embed_subsys = .FALSE.
475 : LOGICAL :: high_level_embed_subsys = .FALSE.
476 : LOGICAL :: dfet_embedded = .FALSE.
477 : LOGICAL :: dmfet_embedded = .FALSE.
478 : END TYPE qs_control_type
479 :
480 : ! **************************************************************************************************
481 : ! \brief Control parameters for the SCCS models
482 : ! **************************************************************************************************
483 : TYPE sccs_control_type
484 : LOGICAL :: sccs_activated = .FALSE.
485 : INTEGER :: derivative_method = 0, &
486 : max_iter = 0, &
487 : method_id = 0
488 : REAL(KIND=dp) :: alpha_solvent = 0.0_dp, &
489 : beta = 0.0_dp, &
490 : beta_solvent = 0.0_dp, &
491 : delta_rho = 0.0_dp, &
492 : eps_sccs = 0.0_dp, &
493 : eps_scf = 0.0_dp, &
494 : epsilon_solvent = 0.0_dp, &
495 : gamma_solvent = 0.0_dp, &
496 : mixing = 0.0_dp, &
497 : rho_zero = 0.0_dp, &
498 : rho_max = 0.0_dp, &
499 : rho_min = 0.0_dp
500 : END TYPE sccs_control_type
501 :
502 : ! **************************************************************************************************
503 : ! \brief Control parameters for simplified Tamm Dancoff approximation (sTDA)
504 : ! \par ATTRIBUTES
505 : ! \par NOTES
506 : ! **************************************************************************************************
507 : TYPE stda_control_type
508 : LOGICAL :: do_ewald = .FALSE.
509 : LOGICAL :: do_exchange = .FALSE.
510 : REAL(KIND=dp) :: hfx_fraction = 0.0_dp
511 : REAL(KIND=dp) :: eps_td_filter = 0.0_dp
512 : REAL(KIND=dp) :: mn_alpha = 0.0_dp
513 : REAL(KIND=dp) :: mn_beta = 0.0_dp
514 : REAL(KIND=dp) :: coulomb_sr_cut = 0.0_dp
515 : REAL(KIND=dp) :: coulomb_sr_eps = 0.0_dp
516 : END TYPE stda_control_type
517 :
518 : ! **************************************************************************************************
519 : ! \brief Control parameters for smeared occupation
520 : ! \par ATTRIBUTES
521 : ! \par NOTES
522 : ! **************************************************************************************************
523 : TYPE smeared_type
524 : REAL(KIND=dp), DIMENSION(:), POINTER :: fermia => NULL()
525 : REAL(KIND=dp), DIMENSION(:, :), POINTER :: fermib => NULL()
526 : END TYPE smeared_type
527 :
528 : ! **************************************************************************************************
529 : ! \brief Control parameters for a Time-Dependent DFT calculation.
530 : ! **************************************************************************************************
531 : TYPE tddfpt2_control_type
532 : !> compute TDDFPT excitation energies and oscillator strengths
533 : LOGICAL :: enabled = .FALSE.
534 : !> number of excited states to converge
535 : INTEGER :: nstates = 0
536 : !> maximal number of iterations to be performed
537 : INTEGER :: niters = 0
538 : !> maximal number of Krylov space vectors
539 : INTEGER :: nkvs = 0
540 : !> number of unoccupied (virtual) molecular orbitals to consider
541 : INTEGER :: nlumo = 0
542 : !> minimal number of MPI processes to be used per excited state
543 : INTEGER :: nprocs = 0
544 : !> type of kernel function/approximation to use
545 : INTEGER :: kernel = 0
546 : !> type of spin excitations to compute
547 : INTEGER :: spinflip = 0
548 : !> for full kernel, do we have HFX/ADMM
549 : LOGICAL :: do_hfx = .FALSE.
550 : LOGICAL :: do_admm = .FALSE.
551 : !> for full kernel, do we have short-range/long-range HFX and/or Kxc potential
552 : LOGICAL :: do_hfxsr = .FALSE.
553 : LOGICAL :: hfxsr_re_int = .TRUE.
554 : INTEGER :: hfxsr_primbas = 0
555 : LOGICAL :: do_hfxlr = .FALSE.
556 : REAL(KIND=dp) :: hfxlr_rcut = 0.0_dp, hfxlr_scale = 0.0_dp
557 : LOGICAL :: do_exck = .FALSE.
558 : !> options used in sTDA calculation (Kernel)
559 : TYPE(stda_control_type) :: stda_control = stda_control_type()
560 : !> algorithm to correct orbital energies
561 : INTEGER :: oe_corr = 0
562 : !> eigenvalue shifts
563 : REAL(KIND=dp) :: ev_shift = 0.0_dp, eos_shift = 0.0_dp
564 : !> active orbitals
565 : INTEGER, DIMENSION(2) :: nactive = -1
566 : !> target accuracy
567 : REAL(kind=dp) :: conv = 0.0_dp
568 : !> the smallest excitation amplitude to print
569 : REAL(kind=dp) :: min_excitation_amplitude = 0.0_dp
570 : !> threshold which controls when two wave functions considered to be orthogonal:
571 : !> maxabs(Ci^T * S * Cj) <= orthogonal_eps
572 : REAL(kind=dp) :: orthogonal_eps = 0.0_dp
573 : !> read guess wave functions from restart file if exists
574 : LOGICAL :: is_restart = .FALSE.
575 : !> compute triplet excited states using spin-unpolarised molecular orbitals
576 : LOGICAL :: rks_triplets = .FALSE.
577 : !> local resolution of identity for Coulomb contribution
578 : LOGICAL :: do_lrigpw = .FALSE.
579 : !> smeared occupation
580 : LOGICAL :: do_smearing = .FALSE.
581 : !> dynamical correlation
582 : LOGICAL :: do_bse = .FALSE.
583 : LOGICAL :: do_bse_w_only = .FALSE.
584 : LOGICAL :: do_bse_gw_only = .FALSE.
585 : ! automatic generation of auxiliary basis for LRI-TDDFT
586 : INTEGER :: auto_basis_p_lri_aux = 1
587 : !> use symmetric definition of ADMM Kernel correction
588 : LOGICAL :: admm_symm = .FALSE.
589 : !> Use/Ignore possible ADMM Kernel XC correction
590 : LOGICAL :: admm_xc_correction = .FALSE.
591 : ! Compute exciton descriptors
592 : LOGICAL :: do_exciton_descriptors = .FALSE.
593 : LOGICAL :: do_directional_exciton_descriptors = .FALSE.
594 : !
595 : ! DIPOLE_MOMENTS subsection
596 : !
597 : ! form of the dipole operator used to compute oscillator strengths
598 : INTEGER :: dipole_form = 0
599 : !> type of the reference point used for calculation of electrostatic dipole moments
600 : INTEGER :: dipole_reference = 0
601 : !> user-defined reference point
602 : REAL(kind=dp), DIMENSION(:), POINTER :: dipole_ref_point => NULL()
603 : !
604 : ! SOC subsection
605 : LOGICAL :: do_soc = .FALSE.
606 : !
607 : ! MGRID subsection
608 : !
609 : !> number of plain-wave grids
610 : INTEGER :: mgrid_ngrids = 0
611 : !> create commensurate grids (progression factor and cutoff values of sub-grids will be ignored)
612 : LOGICAL :: mgrid_commensurate_mgrids = .FALSE.
613 : !> signals that MGRID section has been explicitly given. Other mgrid_* variables
614 : !> are not initialised when it is equal to .FALSE. as in this case the default
615 : !> set of plain-wave grids will be used
616 : LOGICAL :: mgrid_is_explicit = .FALSE.
617 : !> same as qs_control%realspace_mgrids
618 : LOGICAL :: mgrid_realspace_mgrids = .FALSE.
619 : !> do not perform load balancing
620 : LOGICAL :: mgrid_skip_load_balance = .FALSE.
621 : !> cutoff value at the finest grid level
622 : REAL(kind=dp) :: mgrid_cutoff = 0.0_dp
623 : !> cutoff at the next grid level will be smaller then the cutoff
624 : !> at the current grid by this number of times
625 : REAL(kind=dp) :: mgrid_progression_factor = 0.0_dp
626 : !> cutoff that determines to which grid a particular Gaussian function will be mapped
627 : REAL(kind=dp) :: mgrid_relative_cutoff = 0.0_dp
628 : !> manually provided the list of cutoff values for each grid level
629 : !> (when it is null(), the cutoff values will be assigned automatically)
630 : REAL(kind=dp), DIMENSION(:), POINTER :: mgrid_e_cutoff => NULL()
631 : !> Parameter for smeared occupation TDA
632 : TYPE(smeared_type), DIMENSION(:), POINTER :: smeared_occup => NULL()
633 : END TYPE tddfpt2_control_type
634 :
635 : ! **************************************************************************************************
636 : !> \brief
637 : ! **************************************************************************************************
638 : TYPE rixs_control_type
639 :
640 : LOGICAL :: enabled = .FALSE.
641 : INTEGER :: core_states = 0
642 : INTEGER :: valence_states = 0
643 :
644 : TYPE(tddfpt2_control_type), POINTER :: tddfpt2_control => NULL()
645 : TYPE(xas_tdp_control_type), POINTER :: xas_tdp_control => NULL()
646 :
647 : END TYPE rixs_control_type
648 :
649 : ! **************************************************************************************************
650 : ! \brief Control parameters for a DFT calculation
651 : ! \par History
652 : ! 10.2019 added variables related to surface dipole correction [Soumya Ghosh]
653 : ! **************************************************************************************************
654 : TYPE dft_control_type
655 : TYPE(admm_control_type), POINTER :: admm_control => NULL()
656 : TYPE(period_efield_type), POINTER :: period_efield => NULL()
657 : TYPE(qs_control_type), POINTER :: qs_control => NULL()
658 : TYPE(rtp_control_type), POINTER :: rtp_control => NULL()
659 : TYPE(sccs_control_type), POINTER :: sccs_control => NULL()
660 : TYPE(tddfpt2_control_type), POINTER :: tddfpt2_control => NULL()
661 : TYPE(rixs_control_type), POINTER :: rixs_control => NULL()
662 : TYPE(xas_control_type), POINTER :: xas_control => NULL()
663 : TYPE(expot_control_type), POINTER :: expot_control => NULL()
664 : TYPE(maxwell_control_type), POINTER :: maxwell_control => NULL()
665 : TYPE(smeagol_control_type), POINTER :: smeagol_control => NULL()
666 : TYPE(efield_p_type), POINTER, &
667 : DIMENSION(:) :: efield_fields => NULL()
668 : TYPE(hairy_probes_type), POINTER, &
669 : DIMENSION(:) :: probe => NULL()
670 : INTEGER :: nspins = 0, &
671 : charge = 0, &
672 : multiplicity = 0, &
673 : sic_method_id = 0, &
674 : plus_u_method_id = 0, &
675 : dir_surf_dip = 0, &
676 : nimages = 1
677 : INTEGER :: sic_list_id = 0
678 : INTEGER :: auto_basis_ri_aux = 1, &
679 : auto_basis_aux_fit = 1, &
680 : auto_basis_lri_aux = 1, &
681 : auto_basis_p_lri_aux = 1, &
682 : auto_basis_ri_hxc = 1, &
683 : auto_basis_ri_xas = 1, &
684 : auto_basis_ri_hfx = 1
685 : REAL(KIND=dp) :: relax_multiplicity = 0.0_dp, &
686 : sic_scaling_a = 0.0_dp, &
687 : sic_scaling_b = 0.0_dp, &
688 : pos_dir_surf_dip = 0.0_dp
689 : LOGICAL :: do_xas_calculation = .FALSE., &
690 : do_xas_tdp_calculation = .FALSE., &
691 : drho_by_collocation = .FALSE., &
692 : use_kinetic_energy_density = .FALSE., &
693 : restricted = .FALSE., &
694 : roks = .FALSE., &
695 : uks = .FALSE., &
696 : lsd = .FALSE., &
697 : dft_plus_u = .FALSE., &
698 : apply_efield = .FALSE., &
699 : apply_efield_field = .FALSE., &
700 : apply_vector_potential = .FALSE., &
701 : apply_period_efield = .FALSE., &
702 : apply_external_potential = .FALSE., &
703 : eval_external_potential = .FALSE., &
704 : do_admm = .FALSE., &
705 : do_admm_dm = .FALSE., &
706 : do_admm_mo = .FALSE., &
707 : smear = .FALSE., &
708 : low_spin_roks = .FALSE., &
709 : apply_external_density = .FALSE., &
710 : read_external_density = .FALSE., &
711 : apply_external_vxc = .FALSE., &
712 : read_external_vxc = .FALSE., &
713 : correct_surf_dip = .FALSE., &
714 : surf_dip_correct_switch = .FALSE., &
715 : switch_surf_dip = .FALSE., &
716 : correct_el_density_dip = .FALSE., &
717 : do_sccs = .FALSE., &
718 : apply_embed_pot = .FALSE., &
719 : apply_dmfet_pot = .FALSE., &
720 : hairy_probes = .FALSE.
721 : END TYPE dft_control_type
722 :
723 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp_control_types'
724 :
725 : ! Public data types
726 :
727 : PUBLIC :: dft_control_type, &
728 : qs_control_type, &
729 : gapw_control_type, &
730 : tddfpt2_control_type, &
731 : rixs_control_type, &
732 : proj_mo_type, &
733 : efield_type, &
734 : mulliken_restraint_type, &
735 : ddapc_restraint_type, &
736 : dftb_control_type, &
737 : xtb_control_type, &
738 : xtb_reference_cli_type, &
739 : semi_empirical_control_type, &
740 : s2_restraint_type, &
741 : admm_control_type, &
742 : maxwell_control_type, &
743 : expot_control_type, &
744 : rtp_control_type, &
745 : sccs_control_type, &
746 : stda_control_type, &
747 : smeared_type, &
748 : hairy_probes_type
749 :
750 : ! Public subroutines
751 :
752 : PUBLIC :: dft_control_release, &
753 : dft_control_create, &
754 : admm_control_create, &
755 : admm_control_release, &
756 : maxwell_control_create, &
757 : expot_control_create, &
758 : ddapc_control_create, &
759 : rixs_control_create, &
760 : rixs_control_release
761 :
762 : CONTAINS
763 :
764 : ! **************************************************************************************************
765 : !> \brief create the mulliken_restraint_type
766 : !> \param mulliken_restraint_control ...
767 : !> \par History
768 : !> 02.2005 created [Joost VandeVondele]
769 : ! **************************************************************************************************
770 7971 : SUBROUTINE mulliken_control_create(mulliken_restraint_control)
771 : TYPE(mulliken_restraint_type), INTENT(OUT) :: mulliken_restraint_control
772 :
773 7971 : mulliken_restraint_control%strength = 0.1_dp
774 7971 : mulliken_restraint_control%target = 1.0_dp
775 : mulliken_restraint_control%natoms = 0
776 : NULLIFY (mulliken_restraint_control%atoms)
777 7971 : END SUBROUTINE mulliken_control_create
778 :
779 : ! **************************************************************************************************
780 : !> \brief release the mulliken_restraint_type
781 : !> \param mulliken_restraint_control ...
782 : !> \par History
783 : !> 02.2005 created [Joost VandeVondele]
784 : ! **************************************************************************************************
785 7970 : SUBROUTINE mulliken_control_release(mulliken_restraint_control)
786 : TYPE(mulliken_restraint_type), INTENT(INOUT) :: mulliken_restraint_control
787 :
788 7970 : IF (ASSOCIATED(mulliken_restraint_control%atoms)) &
789 2 : DEALLOCATE (mulliken_restraint_control%atoms)
790 7970 : mulliken_restraint_control%strength = 0.0_dp
791 7970 : mulliken_restraint_control%target = 0.0_dp
792 7970 : mulliken_restraint_control%natoms = 0
793 7970 : END SUBROUTINE mulliken_control_release
794 :
795 : ! **************************************************************************************************
796 : !> \brief create the ddapc_restraint_type
797 : !> \param ddapc_restraint_control ...
798 : !> \par History
799 : !> 02.2006 created [Joost VandeVondele]
800 : ! **************************************************************************************************
801 18 : SUBROUTINE ddapc_control_create(ddapc_restraint_control)
802 : TYPE(ddapc_restraint_type), INTENT(OUT) :: ddapc_restraint_control
803 :
804 : ddapc_restraint_control%density_type = do_full_density
805 18 : ddapc_restraint_control%strength = 0.1_dp
806 : ddapc_restraint_control%ddapc_order_p = 0.0_dp
807 18 : ddapc_restraint_control%functional_form = -1
808 18 : ddapc_restraint_control%target = 1.0_dp
809 : ddapc_restraint_control%natoms = 0
810 : NULLIFY (ddapc_restraint_control%atoms)
811 : NULLIFY (ddapc_restraint_control%coeff)
812 :
813 18 : END SUBROUTINE ddapc_control_create
814 :
815 : ! **************************************************************************************************
816 : !> \brief release the ddapc_restraint_type
817 : !> \param ddapc_restraint_control ...
818 : !> \par History
819 : !> 02.2006 created [Joost VandeVondele]
820 : ! **************************************************************************************************
821 18 : SUBROUTINE ddapc_control_release(ddapc_restraint_control)
822 : TYPE(ddapc_restraint_type), INTENT(INOUT) :: ddapc_restraint_control
823 :
824 18 : IF (ASSOCIATED(ddapc_restraint_control%atoms)) &
825 18 : DEALLOCATE (ddapc_restraint_control%atoms)
826 18 : IF (ASSOCIATED(ddapc_restraint_control%coeff)) &
827 18 : DEALLOCATE (ddapc_restraint_control%coeff)
828 18 : ddapc_restraint_control%strength = 0.0_dp
829 18 : ddapc_restraint_control%target = 0.0_dp
830 18 : ddapc_restraint_control%natoms = 0
831 18 : END SUBROUTINE ddapc_control_release
832 :
833 : ! **************************************************************************************************
834 : !> \brief create the s2_restraint_type
835 : !> \param s2_restraint_control ...
836 : !> \par History
837 : !> 03.2006 created [Joost VandeVondele]
838 : ! **************************************************************************************************
839 7971 : SUBROUTINE s2_control_create(s2_restraint_control)
840 : TYPE(s2_restraint_type), INTENT(OUT) :: s2_restraint_control
841 :
842 7971 : s2_restraint_control%strength = 0.1_dp
843 : s2_restraint_control%s2_order_p = 0.0_dp
844 7971 : s2_restraint_control%functional_form = -1
845 7971 : s2_restraint_control%target = 1.0_dp
846 7971 : END SUBROUTINE s2_control_create
847 :
848 : ! **************************************************************************************************
849 : !> \brief release the s2_restraint_type
850 : !> \param s2_restraint_control ...
851 : !> \par History
852 : !> 03.2006 created [Joost VandeVondele]
853 : ! **************************************************************************************************
854 7970 : SUBROUTINE s2_control_release(s2_restraint_control)
855 : TYPE(s2_restraint_type), INTENT(INOUT) :: s2_restraint_control
856 :
857 7970 : s2_restraint_control%strength = 0.0_dp
858 7970 : s2_restraint_control%target = 0.0_dp
859 7970 : END SUBROUTINE s2_control_release
860 :
861 : ! **************************************************************************************************
862 : !> \brief allocates and perform a very basic initialization
863 : !> \param dft_control the object to create
864 : !> \par History
865 : !> 02.2003 created [fawzi]
866 : !> \author fawzi
867 : ! **************************************************************************************************
868 7971 : SUBROUTINE dft_control_create(dft_control)
869 : TYPE(dft_control_type), INTENT(OUT) :: dft_control
870 :
871 : NULLIFY (dft_control%xas_control)
872 : NULLIFY (dft_control%qs_control)
873 : NULLIFY (dft_control%tddfpt2_control)
874 : NULLIFY (dft_control%rixs_control)
875 : NULLIFY (dft_control%efield_fields)
876 : NULLIFY (dft_control%period_efield)
877 : NULLIFY (dft_control%admm_control)
878 : NULLIFY (dft_control%expot_control)
879 : NULLIFY (dft_control%maxwell_control)
880 : NULLIFY (dft_control%smeagol_control)
881 : NULLIFY (dft_control%rtp_control)
882 : NULLIFY (dft_control%sccs_control)
883 : NULLIFY (dft_control%probe)
884 : dft_control%do_sccs = .FALSE.
885 : dft_control%apply_embed_pot = .FALSE.
886 : dft_control%apply_dmfet_pot = .FALSE.
887 : dft_control%hairy_probes = .FALSE.
888 7971 : CALL qs_control_create(dft_control%qs_control)
889 7971 : CALL tddfpt2_control_create(dft_control%tddfpt2_control)
890 7971 : CALL rixs_control_create(dft_control%rixs_control)
891 7971 : CALL smeagol_control_create(dft_control%smeagol_control)
892 7971 : END SUBROUTINE dft_control_create
893 :
894 : ! **************************************************************************************************
895 : !> \brief ...
896 : !> \param dft_control ...
897 : !> \par History
898 : !> 02.2003 created [fawzi]
899 : !> \author fawzi
900 : ! **************************************************************************************************
901 7970 : SUBROUTINE dft_control_release(dft_control)
902 : TYPE(dft_control_type), INTENT(INOUT) :: dft_control
903 :
904 : INTEGER :: i
905 :
906 7970 : CALL qs_control_release(dft_control%qs_control)
907 7970 : CALL tddfpt2_control_release(dft_control%tddfpt2_control)
908 7970 : CALL rixs_control_release(dft_control%rixs_control) ! maybe check first if allocated
909 7970 : IF (ASSOCIATED(dft_control%xas_control)) THEN
910 42 : CALL xas_control_release(dft_control%xas_control)
911 42 : DEALLOCATE (dft_control%xas_control)
912 : END IF
913 7970 : CALL admm_control_release(dft_control%admm_control)
914 7970 : CALL expot_control_release(dft_control%expot_control)
915 7970 : CALL maxwell_control_release(dft_control%maxwell_control)
916 7970 : CALL smeagol_control_release(dft_control%smeagol_control)
917 7970 : CALL efield_fields_release(dft_control%efield_fields)
918 7970 : IF (ASSOCIATED(dft_control%probe)) THEN
919 12 : DO i = 1, SIZE(dft_control%probe)
920 12 : DEALLOCATE (dft_control%probe(i)%atom_ids)
921 : END DO
922 4 : DEALLOCATE (dft_control%probe)
923 : END IF
924 7970 : IF (ASSOCIATED(dft_control%sccs_control)) DEALLOCATE (dft_control%sccs_control)
925 7970 : IF (ASSOCIATED(dft_control%period_efield)) THEN
926 76 : DEALLOCATE (dft_control%period_efield)
927 : END IF
928 7970 : IF (ASSOCIATED(dft_control%rtp_control)) THEN
929 252 : CALL proj_mo_list_release(dft_control%rtp_control%proj_mo_list)
930 252 : DEALLOCATE (dft_control%rtp_control)
931 : END IF
932 :
933 7970 : END SUBROUTINE dft_control_release
934 :
935 : ! **************************************************************************************************
936 : !> \brief ...
937 : !> \param qs_control ...
938 : ! **************************************************************************************************
939 7971 : SUBROUTINE qs_control_create(qs_control)
940 : TYPE(qs_control_type), POINTER :: qs_control
941 :
942 7971 : CPASSERT(.NOT. ASSOCIATED(qs_control))
943 31884 : ALLOCATE (qs_control)
944 :
945 : NULLIFY (qs_control%e_cutoff)
946 : NULLIFY (qs_control%gapw_control)
947 : NULLIFY (qs_control%mulliken_restraint_control)
948 : NULLIFY (qs_control%ddapc_restraint_control)
949 : NULLIFY (qs_control%s2_restraint_control)
950 : NULLIFY (qs_control%se_control)
951 : NULLIFY (qs_control%dftb_control)
952 : NULLIFY (qs_control%xtb_control)
953 : NULLIFY (qs_control%cdft_control)
954 : NULLIFY (qs_control%ddapc_restraint_control)
955 :
956 7971 : ALLOCATE (qs_control%mulliken_restraint_control)
957 7971 : CALL mulliken_control_create(qs_control%mulliken_restraint_control)
958 7971 : ALLOCATE (qs_control%s2_restraint_control)
959 7971 : CALL s2_control_create(qs_control%s2_restraint_control)
960 7971 : ALLOCATE (qs_control%gapw_control)
961 7971 : CALL se_control_create(qs_control%se_control)
962 7971 : CALL dftb_control_create(qs_control%dftb_control)
963 7971 : CALL xtb_control_create(qs_control%xtb_control)
964 23913 : ALLOCATE (qs_control%cdft_control)
965 7971 : CALL cdft_control_create(qs_control%cdft_control)
966 7971 : END SUBROUTINE qs_control_create
967 :
968 : ! **************************************************************************************************
969 : !> \brief ...
970 : !> \param qs_control ...
971 : ! **************************************************************************************************
972 7970 : SUBROUTINE qs_control_release(qs_control)
973 : TYPE(qs_control_type), POINTER :: qs_control
974 :
975 : INTEGER :: i
976 :
977 7970 : IF (ASSOCIATED(qs_control)) THEN
978 7970 : CALL mulliken_control_release(qs_control%mulliken_restraint_control)
979 7970 : DEALLOCATE (qs_control%mulliken_restraint_control)
980 7970 : CALL s2_control_release(qs_control%s2_restraint_control)
981 7970 : DEALLOCATE (qs_control%s2_restraint_control)
982 7970 : CALL se_control_release(qs_control%se_control)
983 7970 : CALL dftb_control_release(qs_control%dftb_control)
984 7970 : CALL xtb_control_release(qs_control%xtb_control)
985 7970 : IF (ASSOCIATED(qs_control%cdft_control)) THEN
986 7970 : CALL cdft_control_release(qs_control%cdft_control)
987 7970 : DEALLOCATE (qs_control%cdft_control)
988 : END IF
989 :
990 7970 : IF (ASSOCIATED(qs_control%e_cutoff)) THEN
991 7970 : DEALLOCATE (qs_control%e_cutoff)
992 : END IF
993 7970 : IF (ASSOCIATED(qs_control%gapw_control)) THEN
994 7970 : IF (ASSOCIATED(qs_control%gapw_control%aw)) THEN
995 242 : DEALLOCATE (qs_control%gapw_control%aw)
996 : END IF
997 7970 : DEALLOCATE (qs_control%gapw_control)
998 : END IF
999 7970 : IF (ASSOCIATED(qs_control%ddapc_restraint_control)) THEN
1000 32 : DO i = 1, SIZE(qs_control%ddapc_restraint_control)
1001 32 : CALL ddapc_control_release(qs_control%ddapc_restraint_control(i))
1002 : END DO
1003 14 : DEALLOCATE (qs_control%ddapc_restraint_control)
1004 : END IF
1005 7970 : DEALLOCATE (qs_control)
1006 : END IF
1007 7970 : END SUBROUTINE qs_control_release
1008 :
1009 : ! **************************************************************************************************
1010 : !> \brief allocate control options for Time-Dependent Density Functional Theory calculation
1011 : !> \param tddfpt_control an object to create
1012 : !> \par History
1013 : !> * 05.2016 created [Sergey Chulkov]
1014 : ! **************************************************************************************************
1015 31916 : SUBROUTINE tddfpt2_control_create(tddfpt_control)
1016 : TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1017 :
1018 : CHARACTER(len=*), PARAMETER :: routineN = 'tddfpt2_control_create'
1019 :
1020 : INTEGER :: handle
1021 :
1022 15958 : CPASSERT(.NOT. ASSOCIATED(tddfpt_control))
1023 15958 : CALL timeset(routineN, handle)
1024 :
1025 63832 : ALLOCATE (tddfpt_control)
1026 : tddfpt_control%do_soc = .FALSE.
1027 :
1028 15958 : CALL timestop(handle)
1029 15958 : END SUBROUTINE tddfpt2_control_create
1030 :
1031 : ! **************************************************************************************************
1032 : !> \brief release memory allocated for TDDFT control options
1033 : !> \param tddfpt_control an object to release
1034 : !> \par History
1035 : !> * 05.2016 created [Sergey Chulkov]
1036 : ! **************************************************************************************************
1037 15956 : SUBROUTINE tddfpt2_control_release(tddfpt_control)
1038 : TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1039 :
1040 : CHARACTER(len=*), PARAMETER :: routineN = 'tddfpt2_control_release'
1041 :
1042 : INTEGER :: handle
1043 :
1044 15956 : CALL timeset(routineN, handle)
1045 :
1046 15956 : IF (ASSOCIATED(tddfpt_control)) THEN
1047 15956 : DEALLOCATE (tddfpt_control)
1048 : END IF
1049 :
1050 15956 : CALL timestop(handle)
1051 15956 : END SUBROUTINE tddfpt2_control_release
1052 :
1053 : ! **************************************************************************************************
1054 : !> \brief Creates and initializes the rixs_control_type
1055 : !> \param rixs_control the type to initialize
1056 : ! **************************************************************************************************
1057 7987 : SUBROUTINE rixs_control_create(rixs_control)
1058 : TYPE(rixs_control_type), POINTER :: rixs_control
1059 :
1060 7987 : CPASSERT(.NOT. ASSOCIATED(rixs_control))
1061 7987 : ALLOCATE (rixs_control)
1062 :
1063 : NULLIFY (rixs_control%tddfpt2_control)
1064 7987 : CALL tddfpt2_control_create(rixs_control%tddfpt2_control)
1065 7987 : NULLIFY (rixs_control%xas_tdp_control)
1066 7987 : CALL xas_tdp_control_create(rixs_control%xas_tdp_control)
1067 :
1068 7987 : END SUBROUTINE rixs_control_create
1069 :
1070 : ! **************************************************************************************************
1071 : !> \brief Releases the rixs_control_type
1072 : !> \param rixs_control ...
1073 : ! **************************************************************************************************
1074 7986 : SUBROUTINE rixs_control_release(rixs_control)
1075 : TYPE(rixs_control_type), POINTER :: rixs_control
1076 :
1077 7986 : IF (ASSOCIATED(rixs_control)) THEN
1078 7986 : CALL tddfpt2_control_release(rixs_control%tddfpt2_control)
1079 7986 : CALL xas_tdp_control_release(rixs_control%xas_tdp_control)
1080 :
1081 7986 : DEALLOCATE (rixs_control)
1082 : END IF
1083 :
1084 7986 : END SUBROUTINE rixs_control_release
1085 :
1086 : ! **************************************************************************************************
1087 : !> \brief ...
1088 : !> \param proj_mo_list ...
1089 : ! **************************************************************************************************
1090 252 : SUBROUTINE proj_mo_list_release(proj_mo_list)
1091 : TYPE(proj_mo_p_type), DIMENSION(:), POINTER :: proj_mo_list
1092 :
1093 : INTEGER :: i, mo_ref_nbr
1094 :
1095 252 : IF (ASSOCIATED(proj_mo_list)) THEN
1096 50 : DO i = 1, SIZE(proj_mo_list)
1097 50 : IF (ASSOCIATED(proj_mo_list(i)%proj_mo)) THEN
1098 46 : IF (ALLOCATED(proj_mo_list(i)%proj_mo%ref_mo_index)) &
1099 46 : DEALLOCATE (proj_mo_list(i)%proj_mo%ref_mo_index)
1100 46 : IF (ALLOCATED(proj_mo_list(i)%proj_mo%mo_ref)) THEN
1101 192 : DO mo_ref_nbr = 1, SIZE(proj_mo_list(i)%proj_mo%mo_ref)
1102 192 : CALL cp_fm_release(proj_mo_list(i)%proj_mo%mo_ref(mo_ref_nbr))
1103 : END DO
1104 46 : DEALLOCATE (proj_mo_list(i)%proj_mo%mo_ref)
1105 : END IF
1106 46 : IF (ALLOCATED(proj_mo_list(i)%proj_mo%td_mo_index)) &
1107 46 : DEALLOCATE (proj_mo_list(i)%proj_mo%td_mo_index)
1108 46 : IF (ALLOCATED(proj_mo_list(i)%proj_mo%td_mo_occ)) &
1109 46 : DEALLOCATE (proj_mo_list(i)%proj_mo%td_mo_occ)
1110 46 : DEALLOCATE (proj_mo_list(i)%proj_mo)
1111 : END IF
1112 : END DO
1113 4 : DEALLOCATE (proj_mo_list)
1114 : END IF
1115 252 : END SUBROUTINE proj_mo_list_release
1116 :
1117 : ! **************************************************************************************************
1118 : !> \brief ...
1119 : !> \param efield_fields ...
1120 : ! **************************************************************************************************
1121 7970 : SUBROUTINE efield_fields_release(efield_fields)
1122 : TYPE(efield_p_type), DIMENSION(:), POINTER :: efield_fields
1123 :
1124 : INTEGER :: i
1125 :
1126 7970 : IF (ASSOCIATED(efield_fields)) THEN
1127 616 : DO i = 1, SIZE(efield_fields)
1128 616 : IF (ASSOCIATED(efield_fields(i)%efield)) THEN
1129 308 : IF (ASSOCIATED(efield_fields(i)%efield%envelop_r_vars)) THEN
1130 10 : DEALLOCATE (efield_fields(i)%efield%envelop_r_vars)
1131 : END IF
1132 308 : IF (ASSOCIATED(efield_fields(i)%efield%envelop_i_vars)) THEN
1133 298 : DEALLOCATE (efield_fields(i)%efield%envelop_i_vars)
1134 : END IF
1135 308 : IF (ASSOCIATED(efield_fields(i)%efield%polarisation)) &
1136 308 : DEALLOCATE (efield_fields(i)%efield%polarisation)
1137 308 : DEALLOCATE (efield_fields(i)%efield)
1138 : END IF
1139 : END DO
1140 308 : DEALLOCATE (efield_fields)
1141 : END IF
1142 7970 : END SUBROUTINE efield_fields_release
1143 :
1144 : ! **************************************************************************************************
1145 : !> \brief ...
1146 : !> \param dftb_control ...
1147 : ! **************************************************************************************************
1148 7971 : SUBROUTINE dftb_control_create(dftb_control)
1149 : TYPE(dftb_control_type), POINTER :: dftb_control
1150 :
1151 7971 : CPASSERT(.NOT. ASSOCIATED(dftb_control))
1152 79710 : ALLOCATE (dftb_control)
1153 :
1154 : NULLIFY (dftb_control%sk_pair_list)
1155 7971 : END SUBROUTINE dftb_control_create
1156 :
1157 : ! **************************************************************************************************
1158 : !> \brief ...
1159 : !> \param dftb_control ...
1160 : ! **************************************************************************************************
1161 7970 : SUBROUTINE dftb_control_release(dftb_control)
1162 : TYPE(dftb_control_type), POINTER :: dftb_control
1163 :
1164 7970 : IF (ASSOCIATED(dftb_control)) THEN
1165 7970 : IF (ASSOCIATED(dftb_control%sk_pair_list)) THEN
1166 254 : DEALLOCATE (dftb_control%sk_pair_list)
1167 : END IF
1168 7970 : DEALLOCATE (dftb_control)
1169 : END IF
1170 7970 : END SUBROUTINE dftb_control_release
1171 :
1172 : ! **************************************************************************************************
1173 : !> \brief ...
1174 : !> \param xtb_control ...
1175 : ! **************************************************************************************************
1176 7971 : SUBROUTINE xtb_control_create(xtb_control)
1177 : TYPE(xtb_control_type), POINTER :: xtb_control
1178 :
1179 7971 : CPASSERT(.NOT. ASSOCIATED(xtb_control))
1180 7971 : ALLOCATE (xtb_control)
1181 :
1182 : NULLIFY (xtb_control%kab_param)
1183 : NULLIFY (xtb_control%kab_vals)
1184 : NULLIFY (xtb_control%kab_types)
1185 : NULLIFY (xtb_control%nonbonded)
1186 : NULLIFY (xtb_control%rcpair)
1187 :
1188 7971 : END SUBROUTINE xtb_control_create
1189 :
1190 : ! **************************************************************************************************
1191 : !> \brief ...
1192 : !> \param xtb_control ...
1193 : ! **************************************************************************************************
1194 7970 : SUBROUTINE xtb_control_release(xtb_control)
1195 : TYPE(xtb_control_type), POINTER :: xtb_control
1196 :
1197 7970 : IF (ASSOCIATED(xtb_control)) THEN
1198 7970 : IF (ASSOCIATED(xtb_control%kab_param)) THEN
1199 2 : DEALLOCATE (xtb_control%kab_param)
1200 : END IF
1201 7970 : IF (ASSOCIATED(xtb_control%kab_vals)) THEN
1202 2 : DEALLOCATE (xtb_control%kab_vals)
1203 : END IF
1204 7970 : IF (ASSOCIATED(xtb_control%kab_types)) THEN
1205 2 : DEALLOCATE (xtb_control%kab_types)
1206 : END IF
1207 7970 : IF (ASSOCIATED(xtb_control%rcpair)) THEN
1208 960 : DEALLOCATE (xtb_control%rcpair)
1209 : END IF
1210 7970 : IF (ASSOCIATED(xtb_control%nonbonded)) THEN
1211 6 : CALL pair_potential_p_release(xtb_control%nonbonded)
1212 : END IF
1213 7970 : DEALLOCATE (xtb_control)
1214 : END IF
1215 7970 : END SUBROUTINE xtb_control_release
1216 :
1217 : ! **************************************************************************************************
1218 : !> \brief ...
1219 : !> \param se_control ...
1220 : ! **************************************************************************************************
1221 7971 : SUBROUTINE se_control_create(se_control)
1222 : TYPE(semi_empirical_control_type), POINTER :: se_control
1223 :
1224 7971 : CPASSERT(.NOT. ASSOCIATED(se_control))
1225 39855 : ALLOCATE (se_control)
1226 7971 : END SUBROUTINE se_control_create
1227 :
1228 : ! **************************************************************************************************
1229 : !> \brief ...
1230 : !> \param se_control ...
1231 : ! **************************************************************************************************
1232 7970 : SUBROUTINE se_control_release(se_control)
1233 : TYPE(semi_empirical_control_type), POINTER :: se_control
1234 :
1235 7970 : IF (ASSOCIATED(se_control)) THEN
1236 7970 : DEALLOCATE (se_control)
1237 : END IF
1238 7970 : END SUBROUTINE se_control_release
1239 :
1240 : ! **************************************************************************************************
1241 : !> \brief ...
1242 : !> \param admm_control ...
1243 : ! **************************************************************************************************
1244 514 : SUBROUTINE admm_control_create(admm_control)
1245 : TYPE(admm_control_type), POINTER :: admm_control
1246 :
1247 514 : CPASSERT(.NOT. ASSOCIATED(admm_control))
1248 2570 : ALLOCATE (admm_control)
1249 :
1250 514 : END SUBROUTINE admm_control_create
1251 :
1252 : ! **************************************************************************************************
1253 : !> \brief ...
1254 : !> \param admm_control ...
1255 : ! **************************************************************************************************
1256 7974 : SUBROUTINE admm_control_release(admm_control)
1257 : TYPE(admm_control_type), POINTER :: admm_control
1258 :
1259 7974 : IF (ASSOCIATED(admm_control)) THEN
1260 554 : DEALLOCATE (admm_control)
1261 : END IF
1262 7974 : END SUBROUTINE admm_control_release
1263 :
1264 : ! **************************************************************************************************
1265 : !> \brief ...
1266 : !> \param expot_control ...
1267 : ! **************************************************************************************************
1268 16 : SUBROUTINE expot_control_create(expot_control)
1269 : TYPE(expot_control_type), POINTER :: expot_control
1270 :
1271 16 : CPASSERT(.NOT. ASSOCIATED(expot_control))
1272 16 : ALLOCATE (expot_control)
1273 : expot_control%read_from_cube = .FALSE.
1274 : expot_control%maxwell_solver = .FALSE.
1275 16 : expot_control%static = .TRUE.
1276 16 : expot_control%scaling_factor = 1.0_dp
1277 :
1278 16 : END SUBROUTINE expot_control_create
1279 :
1280 : ! **************************************************************************************************
1281 : !> \brief ...
1282 : !> \param expot_control ...
1283 : ! **************************************************************************************************
1284 7970 : SUBROUTINE expot_control_release(expot_control)
1285 : TYPE(expot_control_type), POINTER :: expot_control
1286 :
1287 7970 : IF (ASSOCIATED(expot_control)) THEN
1288 16 : DEALLOCATE (expot_control)
1289 : END IF
1290 :
1291 7970 : END SUBROUTINE expot_control_release
1292 :
1293 : ! **************************************************************************************************
1294 : !> \brief ...
1295 : !> \param maxwell_control ...
1296 : ! **************************************************************************************************
1297 0 : SUBROUTINE maxwell_control_create(maxwell_control)
1298 : TYPE(maxwell_control_type), POINTER :: maxwell_control
1299 :
1300 0 : CPASSERT(.NOT. ASSOCIATED(maxwell_control))
1301 0 : ALLOCATE (maxwell_control)
1302 :
1303 0 : END SUBROUTINE maxwell_control_create
1304 :
1305 : ! **************************************************************************************************
1306 : !> \brief ...
1307 : !> \param maxwell_control ...
1308 : ! **************************************************************************************************
1309 7970 : SUBROUTINE maxwell_control_release(maxwell_control)
1310 : TYPE(maxwell_control_type), POINTER :: maxwell_control
1311 :
1312 7970 : IF (ASSOCIATED(maxwell_control)) THEN
1313 0 : DEALLOCATE (maxwell_control)
1314 : END IF
1315 :
1316 7970 : END SUBROUTINE maxwell_control_release
1317 :
1318 0 : END MODULE cp_control_types
|