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

Generated by: LCOV version 2.0-1