LCOV - code coverage report
Current view: top level - src - cp_control_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 204 210 97.1 %
Date: 2024-11-21 06:45:46 Functions: 27 55 49.1 %

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

Generated by: LCOV version 1.15