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

Generated by: LCOV version 1.15