25#include "./base/base_uses.f90"
31 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_harris_types'
35 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: rvecs
39 CHARACTER(LEN=default_string_length) :: basis_type =
"NDef"
40 TYPE(rho_vec_type),
ALLOCATABLE,
DIMENSION(:, :) :: rhovec
41 TYPE(rho_vec_type),
ALLOCATABLE,
DIMENSION(:, :) :: intvec
44 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: basptr
45 LOGICAL :: frozen = .false.
49 REAL(kind=
dp) :: eharris = 0.0_dp
50 REAL(kind=
dp) :: eband = 0.0_dp
51 REAL(kind=
dp) :: exc_correction = 0.0_dp
52 REAL(kind=
dp) :: eh_correction = 0.0_dp
53 REAL(kind=
dp) :: ewald_correction = 0.0_dp
54 REAL(kind=
dp) :: dispersion = 0.0_dp
55 REAL(kind=
dp) :: trial_dm = 0.0_dp
56 REAL(kind=
dp) :: direct_harris = 0.0_dp
57 REAL(kind=
dp) :: direct_difference = 0.0_dp
67 INTEGER :: energy_functional = 0
68 INTEGER :: density_source = 0
69 INTEGER :: orbital_basis = 0
70 CHARACTER(LEN=default_string_length) :: density_filename =
""
71 INTEGER :: fit_max_iter = 50
72 INTEGER :: fit_max_backtrack = 20
73 INTEGER :: fit_method = 0
74 REAL(kind=
dp) :: fit_eps = 1.0e-3_dp
75 REAL(kind=
dp) :: fit_step_size = 1.0_dp
76 REAL(kind=
dp) :: fit_temperature = 0.0_dp
77 REAL(kind=
dp) :: fit_relative_entropy_weight = 1.0e-3_dp
78 LOGICAL :: density_fit_ready = .false.
79 LOGICAL :: density_target_ready = .false.
80 LOGICAL :: direct_density_matrix_energy = .false.
92 LOGICAL :: debug_forces = .false.
93 LOGICAL :: debug_stress = .false.
112 INTEGER,
INTENT(IN) :: iounit
116 WRITE (unit=iounit, fmt=
"(/,(T2,A))")
"HARRIS MODEL ENERGY INFORMATION"
117 WRITE (unit=iounit, fmt=
"((T3,A,T56,F25.14))") &
118 "Harris model energy: ", energy%eharris, &
119 "Band energy: ", energy%eband, &
120 "Hartree correction energy: ", energy%eh_correction, &
121 "XC correction energy: ", energy%exc_correction, &
122 "Ewald sum correction energy: ", energy%ewald_correction, &
123 "Dispersion energy (pair potential): ", energy%dispersion
134 INTEGER,
INTENT(IN) :: iounit
138 WRITE (unit=iounit, fmt=
"(/,(T2,A))")
"HARRIS DIRECT DENSITY MATRIX ENERGY INFORMATION"
139 WRITE (unit=iounit, fmt=
"((T3,A,T56,F25.14))") &
140 "Consistent trial-DM energy: ", energy%trial_dm, &
141 "Harris-like fitted-DM/cube energy: ", energy%direct_harris, &
142 "Trial-DM minus Harris-like energy: ", energy%direct_difference
157 local_particles, nspin)
159 CHARACTER(LEN=*) :: basis_type
160 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
163 INTEGER,
INTENT(IN) :: nspin
165 INTEGER :: iatom, ikind, iptr, ispin, natom, nkind, &
166 nparticle_local, nsgf
167 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of, nbasf
171 CALL harris_rhoin_release(rhoin)
173 rhoin%basis_type = basis_type
177 atom_of_kind=atom_of_kind, kind_of=kind_of)
178 natom =
SIZE(atom_of_kind)
179 nkind =
SIZE(qs_kind_set)
181 ALLOCATE (nbasf(nkind))
183 qs_kind => qs_kind_set(ikind)
184 CALL get_qs_kind(qs_kind, basis_set=basis_set, basis_type=basis_type)
189 ALLOCATE (rhoin%basptr(natom, 2))
192 ikind = kind_of(iatom)
193 rhoin%basptr(iatom, 1) = iptr
194 iptr = iptr + nbasf(ikind)
195 rhoin%basptr(iatom, 2) = iptr - 1
197 rhoin%nbas = iptr - 1
199 ALLOCATE (rhoin%rhovec(nkind, nspin))
203 nparticle_local = local_particles%n_el(ikind)
204 ALLOCATE (rhoin%rhovec(ikind, ispin)%rvecs(nsgf, nparticle_local))
208 ALLOCATE (rhoin%intvec(nkind, nspin))
212 nparticle_local = local_particles%n_el(ikind)
213 ALLOCATE (rhoin%intvec(ikind, ispin)%rvecs(nsgf, nparticle_local))
230 IF (
ASSOCIATED(harris_env))
THEN
232 CALL harris_rhoin_release(harris_env%rhoin)
234 IF (
ASSOCIATED(harris_env%vh_rspace%pw_grid))
THEN
235 CALL harris_env%vh_rspace%release()
237 IF (
ASSOCIATED(harris_env%density_fit_rspace%pw_grid))
THEN
238 CALL harris_env%density_fit_rspace%release()
240 IF (
ASSOCIATED(harris_env%density_target_rspace%pw_grid))
THEN
241 CALL harris_env%density_target_rspace%release()
243 IF (
ASSOCIATED(harris_env%vxc_rspace))
THEN
244 DO iab = 1,
SIZE(harris_env%vxc_rspace)
245 CALL harris_env%vxc_rspace(iab)%release()
247 DEALLOCATE (harris_env%vxc_rspace)
250 DEALLOCATE (harris_env)
261 SUBROUTINE harris_rhoin_release(rhoin)
266 IF (
ALLOCATED(rhoin%rhovec))
THEN
267 DO i = 1,
SIZE(rhoin%rhovec, 2)
268 DO j = 1,
SIZE(rhoin%rhovec, 1)
269 IF (
ALLOCATED(rhoin%rhovec(j, i)%rvecs))
THEN
270 DEALLOCATE (rhoin%rhovec(j, i)%rvecs)
274 DEALLOCATE (rhoin%rhovec)
276 IF (
ALLOCATED(rhoin%intvec))
THEN
277 DO i = 1,
SIZE(rhoin%intvec, 2)
278 DO j = 1,
SIZE(rhoin%intvec, 1)
279 IF (
ALLOCATED(rhoin%intvec(j, i)%rvecs))
THEN
280 DEALLOCATE (rhoin%intvec(j, i)%rvecs)
284 DEALLOCATE (rhoin%intvec)
286 IF (
ALLOCATED(rhoin%basptr))
THEN
287 DEALLOCATE (rhoin%basptr)
289 rhoin%basis_type =
"NDef"
292 rhoin%frozen = .false.
294 END SUBROUTINE harris_rhoin_release
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum, ccon)
...
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Types needed for a for a Harris model calculation.
subroutine, public harris_env_release(harris_env)
...
subroutine, public harris_rhoin_init(rhoin, basis_type, qs_kind_set, atomic_kind_set, local_particles, nspin)
...
subroutine, public harris_print_direct_energy(iounit, energy)
Prints the two direct fitted-density-matrix energy evaluations.
subroutine, public harris_print_energy(iounit, energy)
...
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Provides all information about an atomic kind.
structure to store local (to a processor) ordered lists of integers.
Contains information on the Harris method.
Provides all information about a quickstep kind.