89 INTEGER :: nspins = 0, natoms = 0
90 INTEGER :: nelectron_total = 0
91 INTEGER,
DIMENSION(2) :: nelectron_spin = 0
92 REAL(kind=
dp),
DIMENSION(2) :: mu_spin = 0.0_dp
93 REAL(kind=
dp),
DIMENSION(2) :: homo_spin = 0.0_dp
94 REAL(kind=
dp),
DIMENSION(2) :: lumo_spin = 0.0_dp
97 TYPE(ls_mat_history_type) :: scf_history = ls_mat_history_type(matrix=null())
98 INTEGER :: extrapolation_order = -1
100 LOGICAL :: has_unit_metric = .false.
102 LOGICAL :: curvy_steps = .false.
103 INTEGER :: s_preconditioner_type = 0
104 INTEGER :: s_inversion_type = 0
105 INTEGER :: purification_method = 0
106 INTEGER :: sign_method = 0
107 INTEGER :: sign_order = 0
108 LOGICAL :: sign_symmetric = .false.
109 INTEGER :: submatrix_sign_method = -1
110 INTEGER :: s_sqrt_method = 0
111 INTEGER :: s_sqrt_order = 0
113 LOGICAL :: needs_s_inv = .false., has_s_preconditioner = .false., fixed_mu = .false., &
114 dynamic_threshold = .false., check_s_inv = .false.
115 LOGICAL :: restart_read = .false., restart_write = .false., non_monotonic = .false.
116 REAL(kind=
dp) :: eps_filter = 0.0_dp, eps_scf = 0.0_dp
118 REAL(kind=
dp) :: eps_lanczos = 0.0_dp
119 INTEGER :: max_iter_lanczos = 0
121 REAL(kind=
dp) :: mixing_fraction = 0.0_dp
122 INTEGER :: max_scf = 0
123 LOGICAL :: ls_diis = .false.
124 INTEGER :: iter_ini_diis = 0
125 INTEGER :: nmixing = 0, max_diis = 0
126 REAL(kind=
dp) :: eps_diis = 0.0_dp
127 REAL(kind=
dp) :: energy_init = 0.0_dp
129 TYPE(dbcsr_type) :: matrix_s_inv
130 TYPE(dbcsr_type) :: matrix_s
131 TYPE(dbcsr_type) :: matrix_bs_sqrt, matrix_bs_sqrt_inv
132 TYPE(dbcsr_type) :: matrix_s_sqrt, matrix_s_sqrt_inv
133 TYPE(dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_ks
134 TYPE(dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_p
136 LOGICAL :: report_all_sparsities = .false., perform_mu_scan = .false., use_s_sqrt = .false.
140 matrix_psave=null(), matrix_bch=null())
142 TYPE(chebyshev_type) :: chebyshev = chebyshev_type()
144 LOGICAL :: do_rho_mixing = .false.
145 INTEGER :: density_mixing_method = 0
148 LOGICAL :: do_transport = .false.
149 LOGICAL :: do_pexsi = .false.
151 LOGICAL :: calculate_forces = .false.
156 LOGICAL :: do_pao = .false.
174 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf_release'
176 INTEGER :: handle, ispin, istore
178 CALL timeset(routinen, handle)
182 DEALLOCATE (ls_scf_env%ls_mstruct%atom_to_molecule)
185 DO istore = 1, min(ls_scf_env%scf_history%istore, ls_scf_env%scf_history%nstore)
186 DO ispin = 1,
SIZE(ls_scf_env%scf_history%matrix, 1)
187 CALL dbcsr_release(ls_scf_env%scf_history%matrix(ispin, istore))
190 DEALLOCATE (ls_scf_env%scf_history%matrix)
192 IF (
ALLOCATED(ls_scf_env%matrix_p))
THEN
193 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
194 CALL dbcsr_release(ls_scf_env%matrix_p(ispin))
196 DEALLOCATE (ls_scf_env%matrix_p)
199 IF (
ASSOCIATED(ls_scf_env%chebyshev%print_key_dos)) &
201 IF (
ASSOCIATED(ls_scf_env%chebyshev%print_key_cube)) &
203 IF (
ASSOCIATED(ls_scf_env%chebyshev%min_energy))
THEN
204 DEALLOCATE (ls_scf_env%chebyshev%min_energy)
206 IF (
ASSOCIATED(ls_scf_env%chebyshev%max_energy))
THEN
207 DEALLOCATE (ls_scf_env%chebyshev%max_energy)
210 IF (
ASSOCIATED(ls_scf_env%mixing_store))
THEN
212 DEALLOCATE (ls_scf_env%mixing_store)
215 IF (ls_scf_env%do_pexsi)
THEN
219 IF (ls_scf_env%do_pao) &
222 DEALLOCATE (ls_scf_env)
224 CALL timestop(handle)