LCOV - code coverage report
Current view: top level - src - cp_control_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:92574dc) Lines: 97.3 % 225 219
Test Date: 2026-09-24 01:27:39 Functions: 41.5 % 65 27

            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 useful for Maxwell equation evaluation of external potential
     490              : ! **************************************************************************************************
     491              :    TYPE maxwell_control_type
     492              :       LOGICAL                              :: log_test = .FALSE.
     493              :       INTEGER                              :: int_test = 0
     494              :       REAL(KIND=dp)                        :: real_test = 0.0_dp
     495              :    END TYPE maxwell_control_type
     496              : 
     497              : ! **************************************************************************************************
     498              : ! \brief Control parameters for a QUICKSTEP and KIM-GORDON calculation ***
     499              : !        eps_pgf_orb: Cutoff value for the interaction of the primitive
     500              : !                     Gaussian-type functions (primitive basis functions).
     501              : ! **************************************************************************************************
     502              :    TYPE qs_control_type
     503              :       INTEGER                              :: method_id = 0
     504              :       REAL(KIND=dp)                        :: eps_core_charge = 0.0_dp, &
     505              :                                               eps_kg_orb = 0.0_dp, &
     506              :                                               eps_pgf_orb = 0.0_dp, &
     507              :                                               eps_ppl = 0.0_dp, &
     508              :                                               eps_ppnl = 0.0_dp, &
     509              :                                               eps_rho_gspace = 0.0_dp, &
     510              :                                               eps_rho_rspace = 0.0_dp, &
     511              :                                               eps_filter_matrix = 0.0_dp, &
     512              :                                               eps_gvg_rspace = 0.0_dp, &
     513              :                                               progression_factor = 0.0_dp, &
     514              :                                               relative_cutoff = 0.0_dp
     515              :       LOGICAL                              :: do_almo_scf = .FALSE.
     516              :       LOGICAL                              :: do_ls_scf = .FALSE.
     517              :       LOGICAL                              :: do_kg = .FALSE.
     518              :       LOGICAL                              :: commensurate_mgrids = .FALSE.
     519              :       LOGICAL                              :: realspace_mgrids = .FALSE.
     520              :       LOGICAL                              :: gapw = .FALSE., gapw_xc = .FALSE., gpw = .FALSE., pao = .FALSE.
     521              :       LOGICAL                              :: lrigpw = .FALSE., rigpw = .FALSE.
     522              :       LOGICAL                              :: lri_optbas = .FALSE.
     523              :       LOGICAL                              :: ofgpw = .FALSE.
     524              :       LOGICAL                              :: dftb = .FALSE.
     525              :       LOGICAL                              :: xtb = .FALSE.
     526              :       LOGICAL                              :: semi_empirical = .FALSE.
     527              :       LOGICAL                              :: mulliken_restraint = .FALSE.
     528              :       LOGICAL                              :: ddapc_restraint = .FALSE.
     529              :       LOGICAL                              :: ddapc_restraint_is_spin = .FALSE.
     530              :       LOGICAL                              :: ddapc_explicit_potential = .FALSE.
     531              :       LOGICAL                              :: cdft = .FALSE.
     532              :       LOGICAL                              :: et_coupling_calc = .FALSE.
     533              :       LOGICAL                              :: s2_restraint = .FALSE.
     534              :       INTEGER                              :: do_ppl_method = 0
     535              :       INTEGER                              :: wf_interpolation_method_nr = 0
     536              :       INTEGER                              :: wf_extrapolation_order = 0
     537              :       INTEGER                              :: periodicity = 0
     538              :       REAL(KIND=dp)                        :: pairlist_radius = 0.0_dp
     539              :       REAL(KIND=dp)                        :: cutoff = 0.0_dp
     540              :       REAL(KIND=dp), DIMENSION(:), POINTER :: e_cutoff => NULL()
     541              :       TYPE(mulliken_restraint_type), &
     542              :          POINTER                           :: mulliken_restraint_control => NULL()
     543              :       TYPE(ddapc_restraint_type), &
     544              :          DIMENSION(:), POINTER             :: ddapc_restraint_control => NULL()
     545              :       TYPE(cdft_control_type), POINTER     :: cdft_control => NULL()
     546              :       TYPE(s2_restraint_type), POINTER     :: s2_restraint_control => NULL()
     547              :       TYPE(dftb_control_type), POINTER     :: dftb_control => NULL()
     548              :       TYPE(xtb_control_type), POINTER      :: xtb_control => NULL()
     549              :       TYPE(semi_empirical_control_type), &
     550              :          POINTER                           :: se_control => NULL()
     551              :       TYPE(gapw_control_type), POINTER     :: gapw_control => NULL()
     552              :       TYPE(pw_grid_option)                 :: pw_grid_opt = pw_grid_option()
     553              :       LOGICAL                              :: skip_load_balance_distributed = .FALSE.
     554              :       ! Types of subsystems for embedding
     555              :       LOGICAL                              :: ref_embed_subsys = .FALSE.
     556              :       LOGICAL                              :: cluster_embed_subsys = .FALSE.
     557              :       LOGICAL                              :: high_level_embed_subsys = .FALSE.
     558              :       LOGICAL                              :: dfet_embedded = .FALSE.
     559              :       LOGICAL                              :: dmfet_embedded = .FALSE.
     560              :    END TYPE qs_control_type
     561              : 
     562              : ! **************************************************************************************************
     563              : ! \brief Control parameters for the SCCS models
     564              : ! **************************************************************************************************
     565              :    TYPE sccs_control_type
     566              :       LOGICAL                              :: sccs_activated = .FALSE., &
     567              :                                               saa_activated = .FALSE.
     568              :       INTEGER                              :: derivative_method = 0, &
     569              :                                               max_iter = 0, &
     570              :                                               method_id = 0
     571              :       REAL(KIND=dp)                        :: alpha_solvent = 0.0_dp, &
     572              :                                               beta = 0.0_dp, &
     573              :                                               beta_solvent = 0.0_dp, &
     574              :                                               delta_rho = 0.0_dp, &
     575              :                                               eps_sccs = 0.0_dp, &
     576              :                                               eps_scf = 0.0_dp, &
     577              :                                               epsilon_solvent = 0.0_dp, &
     578              :                                               gamma_solvent = 0.0_dp, &
     579              :                                               mixing = 0.0_dp, &
     580              :                                               rho_zero = 0.0_dp, &
     581              :                                               rho_max = 0.0_dp, &
     582              :                                               rho_min = 0.0_dp, &
     583              :                                               f0 = 0.0_dp, &
     584              :                                               delta_eta = 0.0_dp, &
     585              :                                               alpha_zeta = 0.0_dp, &
     586              :                                               delta_zeta = 0.0_dp, &
     587              :                                               R_solv = 0.0_dp
     588              :    END TYPE sccs_control_type
     589              : 
     590              : ! **************************************************************************************************
     591              : ! \brief Control parameters for simplified Tamm Dancoff approximation (sTDA)
     592              : ! \par  ATTRIBUTES
     593              : ! \par  NOTES
     594              : ! **************************************************************************************************
     595              :    TYPE stda_control_type
     596              :       LOGICAL                                :: do_ewald = .FALSE.
     597              :       LOGICAL                                :: do_exchange = .FALSE.
     598              :       REAL(KIND=dp)                          :: hfx_fraction = 0.0_dp
     599              :       REAL(KIND=dp)                          :: eps_td_filter = 0.0_dp
     600              :       REAL(KIND=dp)                          :: mn_alpha = 0.0_dp
     601              :       REAL(KIND=dp)                          :: mn_beta = 0.0_dp
     602              :       REAL(KIND=dp)                          :: coulomb_sr_cut = 0.0_dp
     603              :       REAL(KIND=dp)                          :: coulomb_sr_eps = 0.0_dp
     604              :    END TYPE stda_control_type
     605              : 
     606              : ! **************************************************************************************************
     607              : ! \brief Control parameters for smeared occupation
     608              : ! \par  ATTRIBUTES
     609              : ! \par  NOTES
     610              : ! **************************************************************************************************
     611              :    TYPE smeared_type
     612              :       REAL(KIND=dp), DIMENSION(:), POINTER :: fermia => NULL()
     613              :       REAL(KIND=dp), DIMENSION(:, :), POINTER :: fermib => NULL()
     614              :    END TYPE smeared_type
     615              : 
     616              : ! **************************************************************************************************
     617              : ! \brief Control parameters for the planar averaged Hartree potential
     618              : ! **************************************************************************************************
     619              :    TYPE paep_control_type
     620              :       INTEGER                              :: surf_normal = 0
     621              :    END TYPE paep_control_type
     622              : 
     623              : ! **************************************************************************************************
     624              : ! \brief Control parameters for the planar counter charge density
     625              : ! **************************************************************************************************
     626              :    TYPE pcc_control_type
     627              :       INTEGER                              :: surf_normal = 0
     628              :       REAL(KIND=dp)                        :: dist_edge = 0.0_dp, &
     629              :                                               gau_a = 0.0_dp, &
     630              :                                               gau_c = 0.0_dp, &
     631              :                                               charge = 0.0_dp
     632              :    END TYPE pcc_control_type
     633              : 
     634              : ! **************************************************************************************************
     635              : ! \brief Control parameters for a Time-Dependent DFT calculation.
     636              : ! **************************************************************************************************
     637              :    TYPE tddfpt2_control_type
     638              :       !> compute TDDFPT excitation energies and oscillator strengths
     639              :       LOGICAL                              :: enabled = .FALSE.
     640              :       !> number of excited states to converge
     641              :       INTEGER                              :: nstates = 0
     642              :       !> maximal number of iterations to be performed
     643              :       INTEGER                              :: niters = 0
     644              :       !> maximal number of Krylov space vectors
     645              :       INTEGER                              :: nkvs = 0
     646              :       !> number of unoccupied (virtual) molecular orbitals to consider
     647              :       INTEGER                              :: nlumo = 0
     648              :       !> minimal number of MPI processes to be used per excited state
     649              :       INTEGER                              :: nprocs = 0
     650              :       !> type of kernel function/approximation to use
     651              :       INTEGER                              :: kernel = 0
     652              :       !> type of spin excitations to compute
     653              :       INTEGER                              :: spinflip = 0
     654              :       !> for full kernel, do we have HFX/ADMM
     655              :       LOGICAL                              :: do_hfx = .FALSE.
     656              :       LOGICAL                              :: do_admm = .FALSE.
     657              :       !> for full kernel, do we have short-range/long-range HFX and/or Kxc potential
     658              :       LOGICAL                              :: do_hfxsr = .FALSE.
     659              :       LOGICAL                              :: hfxsr_re_int = .TRUE.
     660              :       INTEGER                              :: hfxsr_primbas = 0
     661              :       LOGICAL                              :: do_hfxlr = .FALSE.
     662              :       REAL(KIND=dp)                        :: hfxlr_rcut = 0.0_dp, hfxlr_scale = 0.0_dp
     663              :       LOGICAL                              :: do_exck = .FALSE.
     664              :       !> options used in sTDA calculation (Kernel)
     665              :       TYPE(stda_control_type)              :: stda_control = stda_control_type()
     666              :       !> algorithm to correct orbital energies
     667              :       INTEGER                              :: oe_corr = 0
     668              :       !> eigenvalue shifts
     669              :       REAL(KIND=dp)                        :: ev_shift = 0.0_dp, eos_shift = 0.0_dp
     670              :       !> active orbitals
     671              :       INTEGER, DIMENSION(2)                :: nactive = -1
     672              :       !> target accuracy
     673              :       REAL(kind=dp)                        :: conv = 0.0_dp
     674              :       !> the smallest excitation amplitude to print
     675              :       REAL(kind=dp)                        :: min_excitation_amplitude = 0.0_dp
     676              :       !> threshold which controls when two wave functions considered to be orthogonal:
     677              :       !> maxabs(Ci^T * S * Cj) <= orthogonal_eps
     678              :       REAL(kind=dp)                        :: orthogonal_eps = 0.0_dp
     679              :       !> read guess wave functions from restart file if exists
     680              :       LOGICAL                              :: is_restart = .FALSE.
     681              :       !> compute triplet excited states using spin-unpolarised molecular orbitals
     682              :       LOGICAL                              :: rks_triplets = .FALSE.
     683              :       !> local resolution of identity for Coulomb contribution
     684              :       LOGICAL                              :: do_lrigpw = .FALSE.
     685              :       !> smeared occupation
     686              :       LOGICAL                              :: do_smearing = .FALSE.
     687              :       !> dynamical correlation
     688              :       LOGICAL                              :: do_bse = .FALSE.
     689              :       LOGICAL                              :: do_bse_w_only = .FALSE.
     690              :       LOGICAL                              :: do_bse_gw_only = .FALSE.
     691              :       ! automatic generation of auxiliary basis for LRI-TDDFT
     692              :       INTEGER                              :: auto_basis_p_lri_aux = 1
     693              :       !> use symmetric definition of ADMM Kernel correction
     694              :       LOGICAL                              :: admm_symm = .FALSE.
     695              :       !> Use/Ignore possible ADMM Kernel XC correction
     696              :       LOGICAL                              :: admm_xc_correction = .FALSE.
     697              :       ! Compute exciton descriptors
     698              :       LOGICAL                              :: do_exciton_descriptors = .FALSE.
     699              :       LOGICAL                              :: do_directional_exciton_descriptors = .FALSE.
     700              :       LOGICAL                              :: do_directional_exciton_crosscorrelation = .FALSE.
     701              :       !
     702              :       ! DIPOLE_MOMENTS subsection
     703              :       !
     704              :       ! form of the dipole operator used to compute oscillator strengths
     705              :       INTEGER                              :: dipole_form = 0
     706              :       !> type of the reference point used for calculation of electrostatic dipole moments
     707              :       INTEGER                              :: dipole_reference = 0
     708              :       !> user-defined reference point
     709              :       REAL(kind=dp), DIMENSION(:), POINTER :: dipole_ref_point => NULL()
     710              :       !
     711              :       ! SOC subsection
     712              :       LOGICAL                              :: do_soc = .FALSE.
     713              :       !
     714              :       ! MGRID subsection
     715              :       !
     716              :       !> number of plain-wave grids
     717              :       INTEGER                              :: mgrid_ngrids = 0
     718              :       !> create commensurate grids (progression factor and cutoff values of sub-grids will be ignored)
     719              :       LOGICAL                              :: mgrid_commensurate_mgrids = .FALSE.
     720              :       !> signals that MGRID section has been explicitly given. Other mgrid_* variables
     721              :       !> are not initialised when it is equal to .FALSE. as in this case the default
     722              :       !> set of plain-wave grids will be used
     723              :       LOGICAL                              :: mgrid_is_explicit = .FALSE.
     724              :       !> same as qs_control%realspace_mgrids
     725              :       LOGICAL                              :: mgrid_realspace_mgrids = .FALSE.
     726              :       !> do not perform load balancing
     727              :       LOGICAL                              :: mgrid_skip_load_balance = .FALSE.
     728              :       !> cutoff value at the finest grid level
     729              :       REAL(kind=dp)                        :: mgrid_cutoff = 0.0_dp
     730              :       !> cutoff at the next grid level will be smaller then the cutoff
     731              :       !> at the current grid by this number of times
     732              :       REAL(kind=dp)                        :: mgrid_progression_factor = 0.0_dp
     733              :       !> cutoff that determines to which grid a particular Gaussian function will be mapped
     734              :       REAL(kind=dp)                        :: mgrid_relative_cutoff = 0.0_dp
     735              :       !> manually provided the list of cutoff values for each grid level
     736              :       !> (when it is null(), the cutoff values will be assigned automatically)
     737              :       REAL(kind=dp), DIMENSION(:), POINTER :: mgrid_e_cutoff => NULL()
     738              :       !> Parameter for smeared occupation TDA
     739              :       TYPE(smeared_type), DIMENSION(:), POINTER :: smeared_occup => NULL()
     740              :    END TYPE tddfpt2_control_type
     741              : 
     742              : ! **************************************************************************************************
     743              : !> \brief
     744              : ! **************************************************************************************************
     745              :    TYPE rixs_control_type
     746              : 
     747              :       LOGICAL                              :: enabled = .FALSE.
     748              :       INTEGER                              :: core_states = 0
     749              :       INTEGER                              :: valence_states = 0
     750              : 
     751              :       TYPE(tddfpt2_control_type), POINTER     :: tddfpt2_control => NULL()
     752              :       TYPE(xas_tdp_control_type), POINTER     :: xas_tdp_control => NULL()
     753              : 
     754              :    END TYPE rixs_control_type
     755              : 
     756              : ! **************************************************************************************************
     757              : ! \brief Control parameters for a DFT calculation
     758              : ! \par History
     759              : !      10.2019 added variables related to surface dipole correction [Soumya Ghosh]
     760              : ! **************************************************************************************************
     761              :    TYPE dft_control_type
     762              :       TYPE(admm_control_type), POINTER     :: admm_control => NULL()
     763              :       TYPE(period_efield_type), POINTER    :: period_efield => NULL()
     764              :       TYPE(qs_control_type), POINTER       :: qs_control => NULL()
     765              :       TYPE(rtp_control_type), POINTER      :: rtp_control => NULL()
     766              :       TYPE(sccs_control_type), POINTER     :: sccs_control => NULL()
     767              :       TYPE(tddfpt2_control_type), POINTER  :: tddfpt2_control => NULL()
     768              :       TYPE(rixs_control_type), POINTER     :: rixs_control => NULL()
     769              :       TYPE(xas_control_type), POINTER      :: xas_control => NULL()
     770              :       TYPE(expot_control_type), POINTER    :: expot_control => NULL()
     771              :       TYPE(maxwell_control_type), POINTER  :: maxwell_control => NULL()
     772              :       TYPE(smeagol_control_type), POINTER  :: smeagol_control => NULL()
     773              :       TYPE(paep_control_type), POINTER     :: paep_control => NULL()
     774              :       TYPE(pcc_control_type), POINTER      :: pcc_control => NULL()
     775              :       TYPE(efield_p_type), POINTER, &
     776              :          DIMENSION(:)                      :: efield_fields => NULL()
     777              :       TYPE(hairy_probes_type), POINTER, &
     778              :          DIMENSION(:)                      :: probe => NULL()
     779              :       INTEGER                              :: nspins = 0, &
     780              :                                               charge = 0, &
     781              :                                               multiplicity = 0, &
     782              :                                               sic_method_id = 0, &
     783              :                                               plus_u_method_id = 0, &
     784              :                                               dir_surf_dip = 0, &
     785              :                                               nimages = 1
     786              :       INTEGER                              :: sic_list_id = 0
     787              :       INTEGER                              :: auto_basis_ri_aux = 1, &
     788              :                                               auto_basis_aux_fit = 1, &
     789              :                                               auto_basis_lri_aux = 1, &
     790              :                                               auto_basis_p_lri_aux = 1, &
     791              :                                               auto_basis_ri_hxc = 1, &
     792              :                                               auto_basis_ri_xas = 1, &
     793              :                                               auto_basis_ri_hfx = 1, &
     794              :                                               localize_each = 1, &
     795              :                                               mtlr_ikind = 1, &
     796              :                                               mtlr_initialization_mode = mtlr_initialization_unresolved, &
     797              :                                               max_mtlr_iter = 10
     798              :       REAL(KIND=dp)                        :: eps_u_j_loop = 0.01_dp, &
     799              :                                               relax_multiplicity = 0.0_dp, &
     800              :                                               sic_scaling_a = 0.0_dp, &
     801              :                                               sic_scaling_b = 0.0_dp, &
     802              :                                               pos_dir_surf_dip = 0.0_dp, &
     803              :                                               perturbation_strength = 0.0_dp, &
     804              :                                               trq(2) = 0.0_dp, &
     805              :                                               vhxc(2) = 0.0_dp
     806              :       LOGICAL                              :: do_xas_calculation = .FALSE., &
     807              :                                               do_xas_tdp_calculation = .FALSE., &
     808              :                                               drho_by_collocation = .FALSE., &
     809              :                                               use_kinetic_energy_density = .FALSE., &
     810              :                                               restricted = .FALSE., &
     811              :                                               roks = .FALSE., &
     812              :                                               uks = .FALSE., &
     813              :                                               lsd = .FALSE., &
     814              :                                               dft_plus_u = .FALSE., &
     815              :                                               mtlr_u_j = .FALSE., &
     816              :                                               mtlr_reference_scf = .FALSE., &
     817              :                                               mtlr_reference_scf_explicit = .FALSE., &
     818              :                                               apply_efield = .FALSE., &
     819              :                                               apply_efield_field = .FALSE., &
     820              :                                               apply_vector_potential = .FALSE., &
     821              :                                               apply_period_efield = .FALSE., &
     822              :                                               apply_external_potential = .FALSE., &
     823              :                                               eval_external_potential = .FALSE., &
     824              :                                               do_admm = .FALSE., &
     825              :                                               do_admm_dm = .FALSE., &
     826              :                                               do_admm_mo = .FALSE., &
     827              :                                               smear = .FALSE., &
     828              :                                               low_spin_roks = .FALSE., &
     829              :                                               apply_external_density = .FALSE., &
     830              :                                               read_external_density = .FALSE., &
     831              :                                               apply_external_vxc = .FALSE., &
     832              :                                               read_external_vxc = .FALSE., &
     833              :                                               correct_surf_dip = .FALSE., &
     834              :                                               surf_dip_correct_switch = .FALSE., &
     835              :                                               switch_surf_dip = .FALSE., &
     836              :                                               correct_el_density_dip = .FALSE., &
     837              :                                               do_sccs = .FALSE., &
     838              :                                               apply_embed_pot = .FALSE., &
     839              :                                               apply_dmfet_pot = .FALSE., &
     840              :                                               hairy_probes = .FALSE., &
     841              :                                               do_paep = .FALSE., &
     842              :                                               do_pcc = .FALSE., &
     843              :                                               ! If true, then no other XC functionals are allowed
     844              :                                               use_gauxc = .FALSE., &
     845              :                                               mtlr_dft_with_perturbation = .FALSE.
     846              :    END TYPE dft_control_type
     847              : 
     848              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp_control_types'
     849              : 
     850              :    ! Public data types
     851              : 
     852              :    PUBLIC :: dft_control_type, &
     853              :              qs_control_type, &
     854              :              gapw_control_type, &
     855              :              tddfpt2_control_type, &
     856              :              rixs_control_type, &
     857              :              proj_mo_type, &
     858              :              efield_type, &
     859              :              mulliken_restraint_type, &
     860              :              ddapc_restraint_type, &
     861              :              dftb_control_type, &
     862              :              xtb_control_type, &
     863              :              xtb_reference_cli_type, &
     864              :              semi_empirical_control_type, &
     865              :              s2_restraint_type, &
     866              :              admm_control_type, &
     867              :              maxwell_control_type, &
     868              :              expot_control_type, &
     869              :              rtp_control_type, &
     870              :              sccs_control_type, &
     871              :              stda_control_type, &
     872              :              smeared_type, &
     873              :              hairy_probes_type, &
     874              :              paep_control_type, &
     875              :              pcc_control_type
     876              : 
     877              :    ! Public subroutines
     878              : 
     879              :    PUBLIC :: dft_control_release, &
     880              :              dft_control_create, &
     881              :              admm_control_create, &
     882              :              admm_control_release, &
     883              :              maxwell_control_create, &
     884              :              expot_control_create, &
     885              :              ddapc_control_create, &
     886              :              rixs_control_create, &
     887              :              rixs_control_release
     888              : 
     889              : CONTAINS
     890              : 
     891              : ! **************************************************************************************************
     892              : !> \brief create  the mulliken_restraint_type
     893              : !> \param mulliken_restraint_control ...
     894              : !> \par History
     895              : !>      02.2005 created [Joost VandeVondele]
     896              : ! **************************************************************************************************
     897         9142 :    SUBROUTINE mulliken_control_create(mulliken_restraint_control)
     898              :       TYPE(mulliken_restraint_type), INTENT(OUT)         :: mulliken_restraint_control
     899              : 
     900         9142 :       mulliken_restraint_control%strength = 0.1_dp
     901         9142 :       mulliken_restraint_control%target = 1.0_dp
     902              :       mulliken_restraint_control%natoms = 0
     903              :       NULLIFY (mulliken_restraint_control%atoms)
     904         9142 :    END SUBROUTINE mulliken_control_create
     905              : 
     906              : ! **************************************************************************************************
     907              : !> \brief release the mulliken_restraint_type
     908              : !> \param mulliken_restraint_control ...
     909              : !> \par History
     910              : !>      02.2005 created [Joost VandeVondele]
     911              : ! **************************************************************************************************
     912         9142 :    SUBROUTINE mulliken_control_release(mulliken_restraint_control)
     913              :       TYPE(mulliken_restraint_type), INTENT(INOUT)       :: mulliken_restraint_control
     914              : 
     915         9142 :       IF (ASSOCIATED(mulliken_restraint_control%atoms)) THEN
     916            2 :          DEALLOCATE (mulliken_restraint_control%atoms)
     917              :       END IF
     918         9142 :       mulliken_restraint_control%strength = 0.0_dp
     919         9142 :       mulliken_restraint_control%target = 0.0_dp
     920         9142 :       mulliken_restraint_control%natoms = 0
     921         9142 :    END SUBROUTINE mulliken_control_release
     922              : 
     923              : ! **************************************************************************************************
     924              : !> \brief create the ddapc_restraint_type
     925              : !> \param ddapc_restraint_control ...
     926              : !> \par History
     927              : !>      02.2006 created [Joost VandeVondele]
     928              : ! **************************************************************************************************
     929           18 :    SUBROUTINE ddapc_control_create(ddapc_restraint_control)
     930              :       TYPE(ddapc_restraint_type), INTENT(OUT)            :: ddapc_restraint_control
     931              : 
     932              :       ddapc_restraint_control%density_type = do_full_density
     933           18 :       ddapc_restraint_control%strength = 0.1_dp
     934              :       ddapc_restraint_control%ddapc_order_p = 0.0_dp
     935           18 :       ddapc_restraint_control%functional_form = -1
     936           18 :       ddapc_restraint_control%target = 1.0_dp
     937              :       ddapc_restraint_control%natoms = 0
     938              :       NULLIFY (ddapc_restraint_control%atoms)
     939              :       NULLIFY (ddapc_restraint_control%coeff)
     940              : 
     941           18 :    END SUBROUTINE ddapc_control_create
     942              : 
     943              : ! **************************************************************************************************
     944              : !> \brief release the ddapc_restraint_type
     945              : !> \param ddapc_restraint_control ...
     946              : !> \par History
     947              : !>      02.2006 created [Joost VandeVondele]
     948              : ! **************************************************************************************************
     949           18 :    SUBROUTINE ddapc_control_release(ddapc_restraint_control)
     950              :       TYPE(ddapc_restraint_type), INTENT(INOUT)          :: ddapc_restraint_control
     951              : 
     952           18 :       IF (ASSOCIATED(ddapc_restraint_control%atoms)) THEN
     953           18 :          DEALLOCATE (ddapc_restraint_control%atoms)
     954              :       END IF
     955           18 :       IF (ASSOCIATED(ddapc_restraint_control%coeff)) THEN
     956           18 :          DEALLOCATE (ddapc_restraint_control%coeff)
     957              :       END IF
     958           18 :       ddapc_restraint_control%strength = 0.0_dp
     959           18 :       ddapc_restraint_control%target = 0.0_dp
     960           18 :       ddapc_restraint_control%natoms = 0
     961           18 :    END SUBROUTINE ddapc_control_release
     962              : 
     963              : ! **************************************************************************************************
     964              : !> \brief create the s2_restraint_type
     965              : !> \param s2_restraint_control ...
     966              : !> \par History
     967              : !>      03.2006 created [Joost VandeVondele]
     968              : ! **************************************************************************************************
     969         9142 :    SUBROUTINE s2_control_create(s2_restraint_control)
     970              :       TYPE(s2_restraint_type), INTENT(OUT)               :: s2_restraint_control
     971              : 
     972         9142 :       s2_restraint_control%strength = 0.1_dp
     973              :       s2_restraint_control%s2_order_p = 0.0_dp
     974         9142 :       s2_restraint_control%functional_form = -1
     975         9142 :       s2_restraint_control%target = 1.0_dp
     976         9142 :    END SUBROUTINE s2_control_create
     977              : 
     978              : ! **************************************************************************************************
     979              : !> \brief release the s2_restraint_type
     980              : !> \param s2_restraint_control ...
     981              : !> \par History
     982              : !>      03.2006 created [Joost VandeVondele]
     983              : ! **************************************************************************************************
     984         9142 :    SUBROUTINE s2_control_release(s2_restraint_control)
     985              :       TYPE(s2_restraint_type), INTENT(INOUT)             :: s2_restraint_control
     986              : 
     987         9142 :       s2_restraint_control%strength = 0.0_dp
     988         9142 :       s2_restraint_control%target = 0.0_dp
     989         9142 :    END SUBROUTINE s2_control_release
     990              : 
     991              : ! **************************************************************************************************
     992              : !> \brief allocates and perform a very basic initialization
     993              : !> \param dft_control the object to create
     994              : !> \par History
     995              : !>      02.2003 created [fawzi]
     996              : !> \author fawzi
     997              : ! **************************************************************************************************
     998        54852 :    SUBROUTINE dft_control_create(dft_control)
     999              :       TYPE(dft_control_type), INTENT(OUT)                :: dft_control
    1000              : 
    1001              :       NULLIFY (dft_control%xas_control)
    1002              :       NULLIFY (dft_control%qs_control)
    1003              :       NULLIFY (dft_control%tddfpt2_control)
    1004              :       NULLIFY (dft_control%rixs_control)
    1005              :       NULLIFY (dft_control%efield_fields)
    1006              :       NULLIFY (dft_control%period_efield)
    1007              :       NULLIFY (dft_control%admm_control)
    1008              :       NULLIFY (dft_control%expot_control)
    1009              :       NULLIFY (dft_control%maxwell_control)
    1010              :       NULLIFY (dft_control%smeagol_control)
    1011              :       NULLIFY (dft_control%rtp_control)
    1012              :       NULLIFY (dft_control%sccs_control)
    1013              :       NULLIFY (dft_control%probe)
    1014              :       NULLIFY (dft_control%paep_control)
    1015              :       NULLIFY (dft_control%pcc_control)
    1016              :       dft_control%do_sccs = .FALSE.
    1017              :       dft_control%apply_embed_pot = .FALSE.
    1018              :       dft_control%apply_dmfet_pot = .FALSE.
    1019              :       dft_control%hairy_probes = .FALSE.
    1020              :       dft_control%do_pcc = .FALSE.
    1021              :       dft_control%do_paep = .FALSE.
    1022         9142 :       CALL qs_control_create(dft_control%qs_control)
    1023         9142 :       CALL tddfpt2_control_create(dft_control%tddfpt2_control)
    1024         9142 :       CALL rixs_control_create(dft_control%rixs_control)
    1025         9142 :       CALL smeagol_control_create(dft_control%smeagol_control)
    1026         9142 :    END SUBROUTINE dft_control_create
    1027              : 
    1028              : ! **************************************************************************************************
    1029              : !> \brief ...
    1030              : !> \param dft_control ...
    1031              : !> \par History
    1032              : !>      02.2003 created [fawzi]
    1033              : !> \author fawzi
    1034              : ! **************************************************************************************************
    1035         9142 :    SUBROUTINE dft_control_release(dft_control)
    1036              :       TYPE(dft_control_type), INTENT(INOUT)              :: dft_control
    1037              : 
    1038              :       INTEGER                                            :: i
    1039              : 
    1040         9142 :       CALL qs_control_release(dft_control%qs_control)
    1041         9142 :       CALL tddfpt2_control_release(dft_control%tddfpt2_control)
    1042         9142 :       CALL rixs_control_release(dft_control%rixs_control) ! maybe check first if allocated
    1043         9142 :       IF (ASSOCIATED(dft_control%xas_control)) THEN
    1044           42 :          CALL xas_control_release(dft_control%xas_control)
    1045           42 :          DEALLOCATE (dft_control%xas_control)
    1046              :       END IF
    1047         9142 :       CALL admm_control_release(dft_control%admm_control)
    1048         9142 :       CALL expot_control_release(dft_control%expot_control)
    1049         9142 :       CALL maxwell_control_release(dft_control%maxwell_control)
    1050         9142 :       CALL smeagol_control_release(dft_control%smeagol_control)
    1051         9142 :       CALL efield_fields_release(dft_control%efield_fields)
    1052         9142 :       IF (ASSOCIATED(dft_control%probe)) THEN
    1053           12 :          DO i = 1, SIZE(dft_control%probe)
    1054           12 :             DEALLOCATE (dft_control%probe(i)%atom_ids)
    1055              :          END DO
    1056            4 :          DEALLOCATE (dft_control%probe)
    1057              :       END IF
    1058         9142 :       IF (ASSOCIATED(dft_control%sccs_control)) DEALLOCATE (dft_control%sccs_control)
    1059         9142 :       IF (ASSOCIATED(dft_control%period_efield)) THEN
    1060           76 :          DEALLOCATE (dft_control%period_efield)
    1061              :       END IF
    1062         9142 :       IF (ASSOCIATED(dft_control%rtp_control)) THEN
    1063          324 :          CALL proj_mo_list_release(dft_control%rtp_control%proj_mo_list)
    1064          324 :          DEALLOCATE (dft_control%rtp_control)
    1065              :       END IF
    1066         9142 :       IF (ASSOCIATED(dft_control%pcc_control)) DEALLOCATE (dft_control%pcc_control)
    1067         9142 :       IF (ASSOCIATED(dft_control%paep_control)) DEALLOCATE (dft_control%paep_control)
    1068              : 
    1069         9142 :    END SUBROUTINE dft_control_release
    1070              : 
    1071              : ! **************************************************************************************************
    1072              : !> \brief ...
    1073              : !> \param qs_control ...
    1074              : ! **************************************************************************************************
    1075         9142 :    SUBROUTINE qs_control_create(qs_control)
    1076              :       TYPE(qs_control_type), POINTER                     :: qs_control
    1077              : 
    1078         9142 :       CPASSERT(.NOT. ASSOCIATED(qs_control))
    1079        36568 :       ALLOCATE (qs_control)
    1080              : 
    1081              :       NULLIFY (qs_control%e_cutoff)
    1082              :       NULLIFY (qs_control%gapw_control)
    1083              :       NULLIFY (qs_control%mulliken_restraint_control)
    1084              :       NULLIFY (qs_control%ddapc_restraint_control)
    1085              :       NULLIFY (qs_control%s2_restraint_control)
    1086              :       NULLIFY (qs_control%se_control)
    1087              :       NULLIFY (qs_control%dftb_control)
    1088              :       NULLIFY (qs_control%xtb_control)
    1089              :       NULLIFY (qs_control%cdft_control)
    1090              :       NULLIFY (qs_control%ddapc_restraint_control)
    1091              : 
    1092         9142 :       ALLOCATE (qs_control%mulliken_restraint_control)
    1093         9142 :       CALL mulliken_control_create(qs_control%mulliken_restraint_control)
    1094         9142 :       ALLOCATE (qs_control%s2_restraint_control)
    1095         9142 :       CALL s2_control_create(qs_control%s2_restraint_control)
    1096         9142 :       ALLOCATE (qs_control%gapw_control)
    1097         9142 :       CALL se_control_create(qs_control%se_control)
    1098         9142 :       CALL dftb_control_create(qs_control%dftb_control)
    1099         9142 :       CALL xtb_control_create(qs_control%xtb_control)
    1100        27426 :       ALLOCATE (qs_control%cdft_control)
    1101         9142 :       CALL cdft_control_create(qs_control%cdft_control)
    1102         9142 :    END SUBROUTINE qs_control_create
    1103              : 
    1104              : ! **************************************************************************************************
    1105              : !> \brief ...
    1106              : !> \param qs_control ...
    1107              : ! **************************************************************************************************
    1108         9142 :    SUBROUTINE qs_control_release(qs_control)
    1109              :       TYPE(qs_control_type), POINTER                     :: qs_control
    1110              : 
    1111              :       INTEGER                                            :: i
    1112              : 
    1113         9142 :       IF (ASSOCIATED(qs_control)) THEN
    1114         9142 :          CALL mulliken_control_release(qs_control%mulliken_restraint_control)
    1115         9142 :          DEALLOCATE (qs_control%mulliken_restraint_control)
    1116         9142 :          CALL s2_control_release(qs_control%s2_restraint_control)
    1117         9142 :          DEALLOCATE (qs_control%s2_restraint_control)
    1118         9142 :          CALL se_control_release(qs_control%se_control)
    1119         9142 :          CALL dftb_control_release(qs_control%dftb_control)
    1120         9142 :          CALL xtb_control_release(qs_control%xtb_control)
    1121         9142 :          IF (ASSOCIATED(qs_control%cdft_control)) THEN
    1122         9142 :             CALL cdft_control_release(qs_control%cdft_control)
    1123         9142 :             DEALLOCATE (qs_control%cdft_control)
    1124              :          END IF
    1125              : 
    1126         9142 :          IF (ASSOCIATED(qs_control%e_cutoff)) THEN
    1127         9142 :             DEALLOCATE (qs_control%e_cutoff)
    1128              :          END IF
    1129         9142 :          IF (ASSOCIATED(qs_control%gapw_control)) THEN
    1130         9142 :             IF (ASSOCIATED(qs_control%gapw_control%aw)) THEN
    1131          288 :                DEALLOCATE (qs_control%gapw_control%aw)
    1132              :             END IF
    1133         9142 :             DEALLOCATE (qs_control%gapw_control)
    1134              :          END IF
    1135         9142 :          IF (ASSOCIATED(qs_control%ddapc_restraint_control)) THEN
    1136           32 :             DO i = 1, SIZE(qs_control%ddapc_restraint_control)
    1137           32 :                CALL ddapc_control_release(qs_control%ddapc_restraint_control(i))
    1138              :             END DO
    1139           14 :             DEALLOCATE (qs_control%ddapc_restraint_control)
    1140              :          END IF
    1141         9142 :          DEALLOCATE (qs_control)
    1142              :       END IF
    1143         9142 :    END SUBROUTINE qs_control_release
    1144              : 
    1145              : ! **************************************************************************************************
    1146              : !> \brief allocate control options for Time-Dependent Density Functional Theory calculation
    1147              : !> \param tddfpt_control an object to create
    1148              : !> \par History
    1149              : !>    * 05.2016 created [Sergey Chulkov]
    1150              : ! **************************************************************************************************
    1151        36600 :    SUBROUTINE tddfpt2_control_create(tddfpt_control)
    1152              :       TYPE(tddfpt2_control_type), POINTER                :: tddfpt_control
    1153              : 
    1154              :       CHARACTER(len=*), PARAMETER :: routineN = 'tddfpt2_control_create'
    1155              : 
    1156              :       INTEGER                                            :: handle
    1157              : 
    1158        18300 :       CPASSERT(.NOT. ASSOCIATED(tddfpt_control))
    1159        18300 :       CALL timeset(routineN, handle)
    1160              : 
    1161        73200 :       ALLOCATE (tddfpt_control)
    1162              :       tddfpt_control%do_soc = .FALSE.
    1163              : 
    1164        18300 :       CALL timestop(handle)
    1165        18300 :    END SUBROUTINE tddfpt2_control_create
    1166              : 
    1167              : ! **************************************************************************************************
    1168              : !> \brief release memory allocated for TDDFT control options
    1169              : !> \param tddfpt_control an object to release
    1170              : !> \par History
    1171              : !>    * 05.2016 created [Sergey Chulkov]
    1172              : ! **************************************************************************************************
    1173        18300 :    SUBROUTINE tddfpt2_control_release(tddfpt_control)
    1174              :       TYPE(tddfpt2_control_type), POINTER                :: tddfpt_control
    1175              : 
    1176              :       CHARACTER(len=*), PARAMETER :: routineN = 'tddfpt2_control_release'
    1177              : 
    1178              :       INTEGER                                            :: handle
    1179              : 
    1180        18300 :       CALL timeset(routineN, handle)
    1181              : 
    1182        18300 :       IF (ASSOCIATED(tddfpt_control)) THEN
    1183        18300 :          DEALLOCATE (tddfpt_control)
    1184              :       END IF
    1185              : 
    1186        18300 :       CALL timestop(handle)
    1187        18300 :    END SUBROUTINE tddfpt2_control_release
    1188              : 
    1189              : ! **************************************************************************************************
    1190              : !> \brief Creates and initializes the rixs_control_type
    1191              : !> \param rixs_control the type to initialize
    1192              : ! **************************************************************************************************
    1193         9158 :    SUBROUTINE rixs_control_create(rixs_control)
    1194              :       TYPE(rixs_control_type), POINTER                   :: rixs_control
    1195              : 
    1196         9158 :       CPASSERT(.NOT. ASSOCIATED(rixs_control))
    1197         9158 :       ALLOCATE (rixs_control)
    1198              : 
    1199              :       NULLIFY (rixs_control%tddfpt2_control)
    1200         9158 :       CALL tddfpt2_control_create(rixs_control%tddfpt2_control)
    1201         9158 :       NULLIFY (rixs_control%xas_tdp_control)
    1202         9158 :       CALL xas_tdp_control_create(rixs_control%xas_tdp_control)
    1203              : 
    1204         9158 :    END SUBROUTINE rixs_control_create
    1205              : 
    1206              : ! **************************************************************************************************
    1207              : !> \brief Releases the rixs_control_type
    1208              : !> \param rixs_control ...
    1209              : ! **************************************************************************************************
    1210         9158 :    SUBROUTINE rixs_control_release(rixs_control)
    1211              :       TYPE(rixs_control_type), POINTER                   :: rixs_control
    1212              : 
    1213         9158 :       IF (ASSOCIATED(rixs_control)) THEN
    1214         9158 :          CALL tddfpt2_control_release(rixs_control%tddfpt2_control)
    1215         9158 :          CALL xas_tdp_control_release(rixs_control%xas_tdp_control)
    1216              : 
    1217         9158 :          DEALLOCATE (rixs_control)
    1218              :       END IF
    1219              : 
    1220         9158 :    END SUBROUTINE rixs_control_release
    1221              : 
    1222              : ! **************************************************************************************************
    1223              : !> \brief ...
    1224              : !> \param proj_mo_list ...
    1225              : ! **************************************************************************************************
    1226          324 :    SUBROUTINE proj_mo_list_release(proj_mo_list)
    1227              :       TYPE(proj_mo_p_type), DIMENSION(:), POINTER        :: proj_mo_list
    1228              : 
    1229              :       INTEGER                                            :: i, mo_ref_nbr
    1230              : 
    1231          324 :       IF (ASSOCIATED(proj_mo_list)) THEN
    1232           50 :          DO i = 1, SIZE(proj_mo_list)
    1233           50 :             IF (ASSOCIATED(proj_mo_list(i)%proj_mo)) THEN
    1234           46 :                IF (ALLOCATED(proj_mo_list(i)%proj_mo%ref_mo_index)) THEN
    1235           46 :                   DEALLOCATE (proj_mo_list(i)%proj_mo%ref_mo_index)
    1236              :                END IF
    1237           46 :                IF (ALLOCATED(proj_mo_list(i)%proj_mo%mo_ref)) THEN
    1238          192 :                   DO mo_ref_nbr = 1, SIZE(proj_mo_list(i)%proj_mo%mo_ref)
    1239          192 :                      CALL cp_fm_release(proj_mo_list(i)%proj_mo%mo_ref(mo_ref_nbr))
    1240              :                   END DO
    1241           46 :                   DEALLOCATE (proj_mo_list(i)%proj_mo%mo_ref)
    1242              :                END IF
    1243           46 :                IF (ALLOCATED(proj_mo_list(i)%proj_mo%td_mo_index)) THEN
    1244           46 :                   DEALLOCATE (proj_mo_list(i)%proj_mo%td_mo_index)
    1245              :                END IF
    1246           46 :                IF (ALLOCATED(proj_mo_list(i)%proj_mo%td_mo_occ)) THEN
    1247           46 :                   DEALLOCATE (proj_mo_list(i)%proj_mo%td_mo_occ)
    1248              :                END IF
    1249           46 :                DEALLOCATE (proj_mo_list(i)%proj_mo)
    1250              :             END IF
    1251              :          END DO
    1252            4 :          DEALLOCATE (proj_mo_list)
    1253              :       END IF
    1254          324 :    END SUBROUTINE proj_mo_list_release
    1255              : 
    1256              : ! **************************************************************************************************
    1257              : !> \brief ...
    1258              : !> \param efield_fields ...
    1259              : ! **************************************************************************************************
    1260         9142 :    SUBROUTINE efield_fields_release(efield_fields)
    1261              :       TYPE(efield_p_type), DIMENSION(:), POINTER         :: efield_fields
    1262              : 
    1263              :       INTEGER                                            :: i
    1264              : 
    1265         9142 :       IF (ASSOCIATED(efield_fields)) THEN
    1266          684 :          DO i = 1, SIZE(efield_fields)
    1267          684 :             IF (ASSOCIATED(efield_fields(i)%efield)) THEN
    1268          342 :                IF (ASSOCIATED(efield_fields(i)%efield%envelop_r_vars)) THEN
    1269           14 :                   DEALLOCATE (efield_fields(i)%efield%envelop_r_vars)
    1270              :                END IF
    1271          342 :                IF (ASSOCIATED(efield_fields(i)%efield%envelop_i_vars)) THEN
    1272          328 :                   DEALLOCATE (efield_fields(i)%efield%envelop_i_vars)
    1273              :                END IF
    1274          342 :                IF (ASSOCIATED(efield_fields(i)%efield%polarisation)) THEN
    1275          342 :                   DEALLOCATE (efield_fields(i)%efield%polarisation)
    1276              :                END IF
    1277          342 :                DEALLOCATE (efield_fields(i)%efield)
    1278              :             END IF
    1279              :          END DO
    1280          342 :          DEALLOCATE (efield_fields)
    1281              :       END IF
    1282         9142 :    END SUBROUTINE efield_fields_release
    1283              : 
    1284              : ! **************************************************************************************************
    1285              : !> \brief ...
    1286              : !> \param dftb_control ...
    1287              : ! **************************************************************************************************
    1288         9142 :    SUBROUTINE dftb_control_create(dftb_control)
    1289              :       TYPE(dftb_control_type), POINTER                   :: dftb_control
    1290              : 
    1291         9142 :       CPASSERT(.NOT. ASSOCIATED(dftb_control))
    1292        91420 :       ALLOCATE (dftb_control)
    1293              : 
    1294              :       NULLIFY (dftb_control%sk_pair_list)
    1295         9142 :    END SUBROUTINE dftb_control_create
    1296              : 
    1297              : ! **************************************************************************************************
    1298              : !> \brief ...
    1299              : !> \param dftb_control ...
    1300              : ! **************************************************************************************************
    1301         9142 :    SUBROUTINE dftb_control_release(dftb_control)
    1302              :       TYPE(dftb_control_type), POINTER                   :: dftb_control
    1303              : 
    1304         9142 :       IF (ASSOCIATED(dftb_control)) THEN
    1305         9142 :          IF (ASSOCIATED(dftb_control%sk_pair_list)) THEN
    1306          298 :             DEALLOCATE (dftb_control%sk_pair_list)
    1307              :          END IF
    1308         9142 :          DEALLOCATE (dftb_control)
    1309              :       END IF
    1310         9142 :    END SUBROUTINE dftb_control_release
    1311              : 
    1312              : ! **************************************************************************************************
    1313              : !> \brief ...
    1314              : !> \param xtb_control ...
    1315              : ! **************************************************************************************************
    1316         9142 :    SUBROUTINE xtb_control_create(xtb_control)
    1317              :       TYPE(xtb_control_type), POINTER                    :: xtb_control
    1318              : 
    1319         9142 :       CPASSERT(.NOT. ASSOCIATED(xtb_control))
    1320        63994 :       ALLOCATE (xtb_control)
    1321              : 
    1322              :       NULLIFY (xtb_control%kab_param)
    1323              :       NULLIFY (xtb_control%kab_vals)
    1324              :       NULLIFY (xtb_control%kab_types)
    1325              :       NULLIFY (xtb_control%nonbonded)
    1326              :       NULLIFY (xtb_control%rcpair)
    1327              :       NULLIFY (xtb_control%spinpol_type)
    1328              :       NULLIFY (xtb_control%spinpol_vals)
    1329              : 
    1330         9142 :    END SUBROUTINE xtb_control_create
    1331              : 
    1332              : ! **************************************************************************************************
    1333              : !> \brief ...
    1334              : !> \param xtb_control ...
    1335              : ! **************************************************************************************************
    1336         9142 :    SUBROUTINE xtb_control_release(xtb_control)
    1337              :       TYPE(xtb_control_type), POINTER                    :: xtb_control
    1338              : 
    1339         9142 :       IF (ASSOCIATED(xtb_control)) THEN
    1340         9142 :          IF (ASSOCIATED(xtb_control%kab_param)) THEN
    1341            2 :             DEALLOCATE (xtb_control%kab_param)
    1342              :          END IF
    1343         9142 :          IF (ASSOCIATED(xtb_control%kab_vals)) THEN
    1344            2 :             DEALLOCATE (xtb_control%kab_vals)
    1345              :          END IF
    1346         9142 :          IF (ASSOCIATED(xtb_control%kab_types)) THEN
    1347            2 :             DEALLOCATE (xtb_control%kab_types)
    1348              :          END IF
    1349         9142 :          IF (ASSOCIATED(xtb_control%rcpair)) THEN
    1350         1040 :             DEALLOCATE (xtb_control%rcpair)
    1351              :          END IF
    1352         9142 :          IF (ASSOCIATED(xtb_control%nonbonded)) THEN
    1353            6 :             CALL pair_potential_p_release(xtb_control%nonbonded)
    1354              :          END IF
    1355         9142 :          IF (ASSOCIATED(xtb_control%spinpol_type)) THEN
    1356            2 :             DEALLOCATE (xtb_control%spinpol_type)
    1357              :          END IF
    1358         9142 :          IF (ASSOCIATED(xtb_control%spinpol_vals)) THEN
    1359            2 :             DEALLOCATE (xtb_control%spinpol_vals)
    1360              :          END IF
    1361         9142 :          DEALLOCATE (xtb_control)
    1362              :       END IF
    1363         9142 :    END SUBROUTINE xtb_control_release
    1364              : 
    1365              : ! **************************************************************************************************
    1366              : !> \brief ...
    1367              : !> \param se_control ...
    1368              : ! **************************************************************************************************
    1369         9142 :    SUBROUTINE se_control_create(se_control)
    1370              :       TYPE(semi_empirical_control_type), POINTER         :: se_control
    1371              : 
    1372         9142 :       CPASSERT(.NOT. ASSOCIATED(se_control))
    1373        45710 :       ALLOCATE (se_control)
    1374         9142 :    END SUBROUTINE se_control_create
    1375              : 
    1376              : ! **************************************************************************************************
    1377              : !> \brief ...
    1378              : !> \param se_control ...
    1379              : ! **************************************************************************************************
    1380         9142 :    SUBROUTINE se_control_release(se_control)
    1381              :       TYPE(semi_empirical_control_type), POINTER         :: se_control
    1382              : 
    1383         9142 :       IF (ASSOCIATED(se_control)) THEN
    1384         9142 :          DEALLOCATE (se_control)
    1385              :       END IF
    1386         9142 :    END SUBROUTINE se_control_release
    1387              : 
    1388              : ! **************************************************************************************************
    1389              : !> \brief ...
    1390              : !> \param admm_control ...
    1391              : ! **************************************************************************************************
    1392          524 :    SUBROUTINE admm_control_create(admm_control)
    1393              :       TYPE(admm_control_type), POINTER                   :: admm_control
    1394              : 
    1395          524 :       CPASSERT(.NOT. ASSOCIATED(admm_control))
    1396         2620 :       ALLOCATE (admm_control)
    1397              : 
    1398          524 :    END SUBROUTINE admm_control_create
    1399              : 
    1400              : ! **************************************************************************************************
    1401              : !> \brief ...
    1402              : !> \param admm_control ...
    1403              : ! **************************************************************************************************
    1404         9146 :    SUBROUTINE admm_control_release(admm_control)
    1405              :       TYPE(admm_control_type), POINTER                   :: admm_control
    1406              : 
    1407         9146 :       IF (ASSOCIATED(admm_control)) THEN
    1408          564 :          DEALLOCATE (admm_control)
    1409              :       END IF
    1410         9146 :    END SUBROUTINE admm_control_release
    1411              : 
    1412              : ! **************************************************************************************************
    1413              : !> \brief ...
    1414              : !> \param expot_control ...
    1415              : ! **************************************************************************************************
    1416           16 :    SUBROUTINE expot_control_create(expot_control)
    1417              :       TYPE(expot_control_type), POINTER                  :: expot_control
    1418              : 
    1419           16 :       CPASSERT(.NOT. ASSOCIATED(expot_control))
    1420           16 :       ALLOCATE (expot_control)
    1421              :       expot_control%read_from_cube = .FALSE.
    1422              :       expot_control%maxwell_solver = .FALSE.
    1423           16 :       expot_control%static = .TRUE.
    1424           16 :       expot_control%scaling_factor = 1.0_dp
    1425              : 
    1426           16 :    END SUBROUTINE expot_control_create
    1427              : 
    1428              : ! **************************************************************************************************
    1429              : !> \brief ...
    1430              : !> \param expot_control ...
    1431              : ! **************************************************************************************************
    1432         9142 :    SUBROUTINE expot_control_release(expot_control)
    1433              :       TYPE(expot_control_type), POINTER                  :: expot_control
    1434              : 
    1435         9142 :       IF (ASSOCIATED(expot_control)) THEN
    1436           16 :          DEALLOCATE (expot_control)
    1437              :       END IF
    1438              : 
    1439         9142 :    END SUBROUTINE expot_control_release
    1440              : 
    1441              : ! **************************************************************************************************
    1442              : !> \brief ...
    1443              : !> \param maxwell_control ...
    1444              : ! **************************************************************************************************
    1445            0 :    SUBROUTINE maxwell_control_create(maxwell_control)
    1446              :       TYPE(maxwell_control_type), POINTER                :: maxwell_control
    1447              : 
    1448            0 :       CPASSERT(.NOT. ASSOCIATED(maxwell_control))
    1449            0 :       ALLOCATE (maxwell_control)
    1450              : 
    1451            0 :    END SUBROUTINE maxwell_control_create
    1452              : 
    1453              : ! **************************************************************************************************
    1454              : !> \brief ...
    1455              : !> \param maxwell_control ...
    1456              : ! **************************************************************************************************
    1457         9142 :    SUBROUTINE maxwell_control_release(maxwell_control)
    1458              :       TYPE(maxwell_control_type), POINTER                :: maxwell_control
    1459              : 
    1460         9142 :       IF (ASSOCIATED(maxwell_control)) THEN
    1461            0 :          DEALLOCATE (maxwell_control)
    1462              :       END IF
    1463              : 
    1464         9142 :    END SUBROUTINE maxwell_control_release
    1465              : 
    1466            0 : END MODULE cp_control_types
        

Generated by: LCOV version 2.0-1