LCOV - code coverage report
Current view: top level - src - cp_control_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:3130539) Lines: 192 198 97.0 %
Date: 2025-05-14 06:57:18 Functions: 25 54 46.3 %

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

Generated by: LCOV version 1.15