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