LCOV - code coverage report
Current view: top level - src - cp_control_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:9ccafda) Lines: 97.4 % 234 228
Test Date: 2026-10-15 00:55:44 Functions: 42.0 % 69 29

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

Generated by: LCOV version 2.0-1