mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-29 06:35:28 -04:00
potential guesses in embedding
This commit is contained in:
parent
e7ec2900eb
commit
0518633e99
12 changed files with 368 additions and 135 deletions
|
|
@ -75,15 +75,16 @@ MODULE embed_types
|
|||
max_grid_step, max_subsys_dens_diff
|
||||
INTEGER :: n_iter, i_iter, dimen_aux, last_accepted, dimen_var_aux
|
||||
REAL(KIND=dp) :: lambda, allowed_decrease, max_trad, min_trad, &
|
||||
grad_norm, vw_cutoff, vw_smooth_cutoff_range
|
||||
TYPE(pw_p_type), POINTER :: const_pot, prev_embed_pot, prev_spin_embed_pot
|
||||
grad_norm, vw_cutoff, vw_smooth_cutoff_range, eta
|
||||
TYPE(pw_p_type), POINTER :: const_pot, prev_embed_pot, prev_spin_embed_pot, pot_diff
|
||||
TYPE(pw_p_type), DIMENSION(:), POINTER :: prev_grid_grad, prev_grid_pot, prev_subsys_dens, v_w
|
||||
REAL(KIND=dp) :: reg_term, trust_rad, conv_max, conv_int, &
|
||||
conv_max_spin, conv_int_spin, step_len
|
||||
LOGICAL :: accept_step, newton_step, level_shift, steep_desc, &
|
||||
add_const_pot, converged, read_embed_pot, &
|
||||
read_embed_pot_cube, change_spin, open_shell_embed, &
|
||||
grid_opt, leeuwen, fab
|
||||
grid_opt, leeuwen, fab, Coulomb_guess, Fermi_Amaldi, &
|
||||
diff_guess
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:) :: all_nspins
|
||||
TYPE(lri_kind_type), DIMENSION(:), POINTER :: lri ! Needed to store integrals
|
||||
|
||||
|
|
|
|||
|
|
@ -116,17 +116,19 @@ MODULE force_env_methods
|
|||
release_dmfet_opt,&
|
||||
subsys_spin
|
||||
USE optimize_embedding_potential, ONLY: &
|
||||
calculate_embed_pot_grad, conv_check_embed, get_max_subsys_diff, get_prev_density, &
|
||||
init_embed_pot, make_subsys_embed_pot, opt_embed_step, prepare_embed_opt, &
|
||||
print_emb_opt_info, print_embed_restart, print_pot_simple_grid, print_rho_diff, &
|
||||
print_rho_spin_diff, read_embed_pot, release_opt_embed, step_control, &
|
||||
Coulomb_guess, calculate_embed_pot_grad, conv_check_embed, get_max_subsys_diff, &
|
||||
get_prev_density, init_embed_pot, make_subsys_embed_pot, opt_embed_step, &
|
||||
prepare_embed_opt, print_emb_opt_info, print_embed_restart, print_pot_simple_grid, &
|
||||
print_rho_diff, print_rho_spin_diff, read_embed_pot, release_opt_embed, step_control, &
|
||||
understand_spin_states
|
||||
USE particle_list_types, ONLY: particle_list_p_type,&
|
||||
particle_list_type
|
||||
USE physcon, ONLY: debye
|
||||
USE pw_env_types, ONLY: pw_env_get,&
|
||||
pw_env_type
|
||||
USE pw_methods, ONLY: pw_integral_ab,&
|
||||
USE pw_methods, ONLY: pw_copy,&
|
||||
pw_integral_ab,&
|
||||
pw_integrate_function,&
|
||||
pw_zero
|
||||
USE pw_pool_types, ONLY: pw_pool_create_pw,&
|
||||
pw_pool_give_back_pw,&
|
||||
|
|
@ -841,7 +843,7 @@ CONTAINS
|
|||
jparticle, mixing_type, my_group, &
|
||||
natom, nforce_eval, source, unit_nr
|
||||
INTEGER, DIMENSION(:), POINTER :: glob_natoms, itmplist, map_index
|
||||
LOGICAL :: converged_embed, dip_exists
|
||||
LOGICAL :: dip_exists
|
||||
REAL(KIND=dp) :: coupling_parameter, dedf, der_1, der_2, &
|
||||
dx, energy, err, lambda, lerr, &
|
||||
restraint_strength, restraint_target, &
|
||||
|
|
@ -854,14 +856,10 @@ CONTAINS
|
|||
TYPE(cp_result_type), POINTER :: loc_results, results_mix
|
||||
TYPE(cp_subsys_p_type), DIMENSION(:), POINTER :: subsystems
|
||||
TYPE(cp_subsys_type), POINTER :: subsys_mix
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(mixed_energy_type), POINTER :: mixed_energy
|
||||
TYPE(mixed_force_type), DIMENSION(:), POINTER :: global_forces
|
||||
TYPE(particle_list_p_type), DIMENSION(:), POINTER :: particles
|
||||
TYPE(particle_list_type), POINTER :: particles_mix
|
||||
TYPE(pw_env_type), POINTER :: pw_env
|
||||
TYPE(pw_p_type), POINTER :: embed_pot, spin_embed_pot
|
||||
TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
|
||||
TYPE(section_vals_type), POINTER :: force_env_section, gen_section, &
|
||||
mapping_section, mixed_section, &
|
||||
root_section
|
||||
|
|
@ -942,31 +940,6 @@ CONTAINS
|
|||
calc_force=calculate_forces, &
|
||||
skip_external_control=.TRUE.)
|
||||
|
||||
! Call DFT embedding
|
||||
IF (ASSOCIATED(force_env%sub_force_env(iforce_eval)%force_env%qs_env)) THEN
|
||||
NULLIFY (dft_control)
|
||||
CALL get_qs_env(force_env%sub_force_env(iforce_eval)%force_env%qs_env, dft_control=dft_control)
|
||||
IF (dft_control%qs_control%ref_embed_subsys) THEN
|
||||
! Now we can optimize the embedding potential
|
||||
CALL dft_embedding(force_env, iforce_eval, energies, converged_embed)
|
||||
IF (.NOT. converged_embed) CPABORT("Embedding potential optimization not converged.")
|
||||
ENDIF
|
||||
! Deallocate embedding potential on the high-level subsystem
|
||||
IF (dft_control%qs_control%high_level_embed_subsys) THEN
|
||||
CALL get_qs_env(qs_env=force_env%sub_force_env(iforce_eval)%force_env%qs_env, &
|
||||
embed_pot=embed_pot, spin_embed_pot=spin_embed_pot, pw_env=pw_env)
|
||||
CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, embed_pot%pw)
|
||||
CALL pw_release(embed_pot%pw)
|
||||
DEALLOCATE (embed_pot)
|
||||
IF (ASSOCIATED(spin_embed_pot)) THEN
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, spin_embed_pot%pw)
|
||||
CALL pw_release(spin_embed_pot%pw)
|
||||
DEALLOCATE (spin_embed_pot)
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
! Only the rank 0 process collect info for each computation
|
||||
IF (force_env%sub_force_env(iforce_eval)%force_env%para_env%mepos == &
|
||||
force_env%sub_force_env(iforce_eval)%force_env%para_env%source) THEN
|
||||
|
|
@ -1593,9 +1566,11 @@ CONTAINS
|
|||
CHARACTER(LEN=*), PARAMETER :: routineN = 'dfet_embedding', routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: cluster_subsys_num, handle, &
|
||||
i_force_eval, i_iter, i_spin, nspins, &
|
||||
nspins_subsys, output_unit
|
||||
i_force_eval, i_iter, i_spin, &
|
||||
nforce_eval, nspins, nspins_subsys, &
|
||||
output_unit
|
||||
REAL(KIND=dp) :: cluster_energy
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rhs
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(opt_embed_pot_type) :: opt_embed
|
||||
|
|
@ -1607,7 +1582,9 @@ CONTAINS
|
|||
TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
|
||||
TYPE(qs_energy_type), POINTER :: energy
|
||||
TYPE(qs_rho_type), POINTER :: rho, subsys_rho
|
||||
TYPE(section_vals_type), POINTER :: dft_section, input, opt_embed_section
|
||||
TYPE(section_vals_type), POINTER :: dft_section, embed_section, &
|
||||
force_env_section, input, &
|
||||
mapping_section, opt_embed_section
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
|
||||
|
|
@ -1646,7 +1623,9 @@ CONTAINS
|
|||
|
||||
! Initialize embedding potential
|
||||
CALL init_embed_pot(force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, embed_pot, &
|
||||
opt_embed%add_const_pot, opt_embed%const_pot, opt_embed%open_shell_embed, spin_embed_pot)
|
||||
opt_embed%add_const_pot, opt_embed%Fermi_Amaldi, opt_embed%const_pot, &
|
||||
opt_embed%open_shell_embed, spin_embed_pot, &
|
||||
opt_embed%pot_diff, opt_embed%Coulomb_guess, opt_embed%grid_opt)
|
||||
|
||||
! Read embeding potential vector from the file
|
||||
IF (opt_embed%read_embed_pot .OR. opt_embed%read_embed_pot_cube) CALL read_embed_pot( &
|
||||
|
|
@ -1714,11 +1693,46 @@ CONTAINS
|
|||
CALL print_rho_spin_diff(diff_rho_spin, 0, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
|
||||
ENDIF
|
||||
|
||||
! Construct electrostatic guess if needed
|
||||
IF (opt_embed%Coulomb_guess) THEN
|
||||
! Reveal resp charges for total system
|
||||
nforce_eval = SIZE(force_env%sub_force_env)
|
||||
NULLIFY (rhs)
|
||||
CALL get_qs_env(force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, rhs=rhs)
|
||||
! Get the mapping
|
||||
CALL force_env_get(force_env=force_env, &
|
||||
force_env_section=force_env_section)
|
||||
embed_section => section_vals_get_subs_vals(force_env_section, "EMBED")
|
||||
mapping_section => section_vals_get_subs_vals(embed_section, "MAPPING")
|
||||
|
||||
DO i_force_eval = 1, ref_subsys_number-1
|
||||
IF (i_force_eval .EQ. 1) THEN
|
||||
CALL Coulomb_guess(embed_pot, rhs, mapping_section, &
|
||||
force_env%sub_force_env(i_force_eval)%force_env%qs_env, nforce_eval, i_force_eval, opt_embed%eta)
|
||||
ELSE
|
||||
CALL Coulomb_guess(opt_embed%pot_diff, rhs, mapping_section, &
|
||||
force_env%sub_force_env(i_force_eval)%force_env%qs_env, nforce_eval, i_force_eval, opt_embed%eta)
|
||||
ENDIF
|
||||
ENDDO
|
||||
embed_pot%pw%cr3d(:, :, :) = embed_pot%pw%cr3d(:, :, :)+opt_embed%pot_diff%pw%cr3d(:, :, :)
|
||||
IF (.NOT. opt_embed%grid_opt) CALL pw_copy(embed_pot%pw, opt_embed%const_pot%pw)
|
||||
|
||||
ENDIF
|
||||
|
||||
! Difference guess
|
||||
IF (opt_embed%diff_guess) THEN
|
||||
embed_pot%pw%cr3d(:, :, :) = diff_rho_r%pw%cr3d(:, :, :)
|
||||
IF (.NOT. opt_embed%grid_opt) CALL pw_copy(embed_pot%pw, opt_embed%const_pot%pw)
|
||||
! Open shell
|
||||
IF (opt_embed%open_shell_embed) spin_embed_pot%pw%cr3d(:, :, :) = diff_rho_spin%pw%cr3d(:, :, :)
|
||||
ENDIF
|
||||
|
||||
! Calculate subsystems with trial embedding potential
|
||||
DO i_iter = 1, opt_embed%n_iter
|
||||
opt_embed%i_iter = i_iter
|
||||
|
||||
! Set the density difference as the negative reference one
|
||||
WRITE (*, *) 'embed pot norm', pw_integrate_function(fun=embed_pot%pw, oprt='ABS')
|
||||
CALL pw_zero(diff_rho_r%pw)
|
||||
CALL get_qs_env(force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, dft_control=dft_control)
|
||||
nspins = dft_control%nspins
|
||||
|
|
@ -1750,6 +1764,11 @@ CONTAINS
|
|||
opt_embed%open_shell_embed, .FALSE.)
|
||||
ENDIF
|
||||
|
||||
! Subtract Coulomb potential difference if needed
|
||||
! IF ((i_force_eval .EQ. 2) .AND. (opt_embed%Coulomb_guess)) THEN
|
||||
! embed_pot_subsys%pw%cr3d(:, :, :) = embed_pot_subsys%pw%cr3d(:, :, :)-opt_embed%pot_diff%pw%cr3d(:, :, :)
|
||||
! ENDIF
|
||||
|
||||
! Switch on external potential in the subsystems
|
||||
dft_control%apply_embed_pot = .TRUE.
|
||||
|
||||
|
|
@ -1845,7 +1864,7 @@ CONTAINS
|
|||
IF ((i_iter .GT. 1) .AND. (.NOT. opt_embed%steep_desc)) CALL step_control(opt_embed)
|
||||
|
||||
! Print density difference
|
||||
!CALL print_rho_diff(diff_rho_r, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
|
||||
CALL print_rho_diff(diff_rho_r, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
|
||||
IF (opt_embed%open_shell_embed) THEN ! Spin part
|
||||
CALL print_rho_spin_diff(diff_rho_spin, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
|
||||
ENDIF
|
||||
|
|
@ -1883,9 +1902,6 @@ CONTAINS
|
|||
DEALLOCATE (diff_rho_spin)
|
||||
ENDIF
|
||||
|
||||
! Deallocate and release opt_embed content
|
||||
CALL release_opt_embed(opt_embed)
|
||||
|
||||
CALL cp_print_key_finished_output(output_unit, logger, force_env%force_env_section, &
|
||||
"PRINT%PROGRAM_RUN_INFO")
|
||||
|
||||
|
|
@ -1900,6 +1916,10 @@ CONTAINS
|
|||
embed_pot, embed_pot_subsys, spin_embed_pot, spin_embed_pot_subsys, &
|
||||
opt_embed%open_shell_embed, opt_embed%change_spin)
|
||||
|
||||
IF (opt_embed%Coulomb_guess) THEN
|
||||
embed_pot_subsys%pw%cr3d(:, :, :) = embed_pot_subsys%pw%cr3d(:, :, :)-opt_embed%pot_diff%pw%cr3d(:, :, :)
|
||||
ENDIF
|
||||
|
||||
CALL set_qs_env(force_env%sub_force_env(ref_subsys_number+1)%force_env%qs_env, embed_pot=embed_pot_subsys)
|
||||
|
||||
IF ((opt_embed%open_shell_embed) .AND. (nspins_subsys .EQ. 2)) THEN
|
||||
|
|
@ -1914,6 +1934,9 @@ CONTAINS
|
|||
ENDIF
|
||||
ENDIF
|
||||
|
||||
! Deallocate and release opt_embed content
|
||||
CALL release_opt_embed(opt_embed)
|
||||
|
||||
! Deallocate embedding potential
|
||||
CALL pw_release(embed_pot%pw)
|
||||
DEALLOCATE (embed_pot)
|
||||
|
|
|
|||
|
|
@ -1115,5 +1115,9 @@ MODULE input_constants
|
|||
embed_level_shift = 2
|
||||
INTEGER, PARAMETER, PUBLIC :: embed_grid_bohr = 0, &
|
||||
embed_grid_angstrom = 1
|
||||
INTEGER, PARAMETER, PUBLIC :: embed_none = 0, &
|
||||
embed_diff = 1, &
|
||||
embed_fa = 2, &
|
||||
embed_resp = 3
|
||||
|
||||
END MODULE input_constants
|
||||
|
|
|
|||
|
|
@ -52,46 +52,47 @@ MODULE input_cp2k_dft
|
|||
do_method_xtb, do_pade, do_ppl_analytic, do_ppl_grid, do_pwgrid_ns_fullspace, &
|
||||
do_pwgrid_ns_halfspace, do_pwgrid_spherical, do_s2_constraint, do_s2_restraint, &
|
||||
do_se_is_kdso, do_se_is_kdso_d, do_se_is_slater, do_se_lr_ewald, do_se_lr_ewald_gks, &
|
||||
do_se_lr_ewald_r3, do_se_lr_none, do_spin_density, do_taylor, ehrenfest, &
|
||||
embed_grid_angstrom, embed_grid_bohr, embed_level_shift, embed_quasi_newton, &
|
||||
embed_steep_desc, eri_method_full_gpw, eri_method_gpw_ht, eri_operator_coulomb, &
|
||||
eri_operator_erf, eri_operator_erfc, eri_operator_gaussian, eri_operator_yukawa, gaussian, &
|
||||
general_roks, hf_model, high_spin_roks, history_guess, jacobian_fd1, &
|
||||
jacobian_fd1_backward, jacobian_fd1_central, jacobian_fd2, jacobian_fd2_backward, &
|
||||
kg_cholesky, kg_color_dsatur, kg_color_greedy, kg_ec_diagonalization, &
|
||||
kg_ec_functional_harris, kg_tnadd_atomic, kg_tnadd_embed, kg_tnadd_embed_ri, &
|
||||
kg_tnadd_none, ls_2pnt, ls_3pnt, ls_gold, ls_none, mao_basis_ext, mao_basis_orb, &
|
||||
mao_basis_prim, mao_projection, mopac_guess, no_excitations, no_guess, numerical, oe_gllb, &
|
||||
oe_lb, oe_none, oe_saop, oe_sic, op_loc_berry, op_loc_boys, op_loc_pipek, orb_dx2, &
|
||||
orb_dxy, orb_dy2, orb_dyz, orb_dz2, orb_dzx, orb_px, orb_py, orb_pz, orb_s, ot_algo_irac, &
|
||||
ot_algo_taylor_or_diag, ot_chol_irac, ot_lwdn_irac, ot_mini_broyden, ot_mini_cg, &
|
||||
ot_mini_diis, ot_mini_sd, ot_poly_irac, ot_precond_full_all, ot_precond_full_kinetic, &
|
||||
ot_precond_full_single, ot_precond_full_single_inverse, ot_precond_none, &
|
||||
ot_precond_s_inverse, ot_precond_solver_default, ot_precond_solver_direct, &
|
||||
ot_precond_solver_inv_chol, ot_precond_solver_update, outer_scf_basis_center_opt, &
|
||||
outer_scf_becke_constraint, outer_scf_cdft_constraint, outer_scf_ddapc_constraint, &
|
||||
outer_scf_hirshfeld_constraint, outer_scf_none, outer_scf_optimizer_bisect, &
|
||||
outer_scf_optimizer_broyden, outer_scf_optimizer_diis, outer_scf_optimizer_newton, &
|
||||
outer_scf_optimizer_newton_ls, outer_scf_optimizer_none, outer_scf_optimizer_sd, &
|
||||
outer_scf_optimizer_secant, outer_scf_s2_constraint, plus_u_lowdin, plus_u_mulliken, &
|
||||
plus_u_mulliken_charges, pw_interp, radius_covalent, radius_default, radius_single, &
|
||||
radius_user, radius_vdw, random_guess, real_time_propagation, ref_charge_atomic, &
|
||||
ref_charge_mulliken, rel_dkh, rel_none, rel_pot_erfc, rel_pot_full, rel_sczora_mp, &
|
||||
rel_trans_atom, rel_trans_full, rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, &
|
||||
restart_guess, rsdft_model, sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, &
|
||||
sccs_derivative_cd7, sccs_derivative_fft, sccs_fattebert_gygi, shape_function_density, &
|
||||
shape_function_gaussian, sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, &
|
||||
sic_mauri_us, sic_none, slater, smear_energy_window, smear_fermi_dirac, smear_list, &
|
||||
sparse_guess, spline3_nopbc_interp, spline3_pbc_interp, tddfpt_davidson, &
|
||||
tddfpt_excitations, tddfpt_lanczos, tddfpt_singlet, tddfpt_triplet, use_coulomb, use_diff, &
|
||||
use_no, use_restart_wfn, use_rt_restart, use_scf_wfn, wannier_projection, &
|
||||
weight_type_mass, weight_type_unit, wfi_aspc_nr, wfi_frozen_method_nr, &
|
||||
wfi_linear_p_method_nr, wfi_linear_ps_method_nr, wfi_linear_wf_method_nr, &
|
||||
wfi_ps_method_nr, wfi_use_guess_method_nr, wfi_use_prev_p_method_nr, &
|
||||
wfi_use_prev_rho_r_method_nr, wfi_use_prev_wf_method_nr, xas_1s_type, xas_2p_type, &
|
||||
xas_2s_type, xas_3d_type, xas_3p_type, xas_3s_type, xas_4d_type, xas_4f_type, xas_4p_type, &
|
||||
xas_4s_type, xas_dip_len, xas_dip_vel, xas_dscf, xas_none, xas_tp_fh, xas_tp_flex, &
|
||||
xas_tp_hh, xas_tp_xfh, xas_tp_xhh, xes_tp_val
|
||||
do_se_lr_ewald_r3, do_se_lr_none, do_spin_density, do_taylor, ehrenfest, embed_diff, &
|
||||
embed_fa, embed_grid_angstrom, embed_grid_bohr, embed_level_shift, embed_none, &
|
||||
embed_quasi_newton, embed_resp, embed_steep_desc, eri_method_full_gpw, eri_method_gpw_ht, &
|
||||
eri_operator_coulomb, eri_operator_erf, eri_operator_erfc, eri_operator_gaussian, &
|
||||
eri_operator_yukawa, gaussian, general_roks, hf_model, high_spin_roks, history_guess, &
|
||||
jacobian_fd1, jacobian_fd1_backward, jacobian_fd1_central, jacobian_fd2, &
|
||||
jacobian_fd2_backward, kg_cholesky, kg_color_dsatur, kg_color_greedy, &
|
||||
kg_ec_diagonalization, kg_ec_functional_harris, kg_tnadd_atomic, kg_tnadd_embed, &
|
||||
kg_tnadd_embed_ri, kg_tnadd_none, ls_2pnt, ls_3pnt, ls_gold, ls_none, mao_basis_ext, &
|
||||
mao_basis_orb, mao_basis_prim, mao_projection, mopac_guess, no_excitations, no_guess, &
|
||||
numerical, oe_gllb, oe_lb, oe_none, oe_saop, oe_sic, op_loc_berry, op_loc_boys, &
|
||||
op_loc_pipek, orb_dx2, orb_dxy, orb_dy2, orb_dyz, orb_dz2, orb_dzx, orb_px, orb_py, &
|
||||
orb_pz, orb_s, ot_algo_irac, ot_algo_taylor_or_diag, ot_chol_irac, ot_lwdn_irac, &
|
||||
ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, ot_poly_irac, ot_precond_full_all, &
|
||||
ot_precond_full_kinetic, ot_precond_full_single, ot_precond_full_single_inverse, &
|
||||
ot_precond_none, ot_precond_s_inverse, ot_precond_solver_default, &
|
||||
ot_precond_solver_direct, ot_precond_solver_inv_chol, ot_precond_solver_update, &
|
||||
outer_scf_basis_center_opt, outer_scf_becke_constraint, outer_scf_cdft_constraint, &
|
||||
outer_scf_ddapc_constraint, outer_scf_hirshfeld_constraint, outer_scf_none, &
|
||||
outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, outer_scf_optimizer_diis, &
|
||||
outer_scf_optimizer_newton, outer_scf_optimizer_newton_ls, outer_scf_optimizer_none, &
|
||||
outer_scf_optimizer_sd, outer_scf_optimizer_secant, outer_scf_s2_constraint, &
|
||||
plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges, pw_interp, radius_covalent, &
|
||||
radius_default, radius_single, radius_user, radius_vdw, random_guess, &
|
||||
real_time_propagation, ref_charge_atomic, ref_charge_mulliken, rel_dkh, rel_none, &
|
||||
rel_pot_erfc, rel_pot_full, rel_sczora_mp, rel_trans_atom, rel_trans_full, &
|
||||
rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, restart_guess, rsdft_model, &
|
||||
sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, &
|
||||
sccs_derivative_fft, sccs_fattebert_gygi, shape_function_density, shape_function_gaussian, &
|
||||
sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, sic_mauri_us, sic_none, &
|
||||
slater, smear_energy_window, smear_fermi_dirac, smear_list, sparse_guess, &
|
||||
spline3_nopbc_interp, spline3_pbc_interp, tddfpt_davidson, tddfpt_excitations, &
|
||||
tddfpt_lanczos, tddfpt_singlet, tddfpt_triplet, use_coulomb, use_diff, use_no, &
|
||||
use_restart_wfn, use_rt_restart, use_scf_wfn, wannier_projection, weight_type_mass, &
|
||||
weight_type_unit, wfi_aspc_nr, wfi_frozen_method_nr, wfi_linear_p_method_nr, &
|
||||
wfi_linear_ps_method_nr, wfi_linear_wf_method_nr, wfi_ps_method_nr, &
|
||||
wfi_use_guess_method_nr, wfi_use_prev_p_method_nr, wfi_use_prev_rho_r_method_nr, &
|
||||
wfi_use_prev_wf_method_nr, xas_1s_type, xas_2p_type, xas_2s_type, xas_3d_type, &
|
||||
xas_3p_type, xas_3s_type, xas_4d_type, xas_4f_type, xas_4p_type, xas_4s_type, xas_dip_len, &
|
||||
xas_dip_vel, xas_dscf, xas_none, xas_tp_fh, xas_tp_flex, xas_tp_hh, xas_tp_xfh, &
|
||||
xas_tp_xhh, xes_tp_val
|
||||
USE input_cp2k_almo, ONLY: create_almo_scf_section
|
||||
USE input_cp2k_distribution, ONLY: create_distribution_section
|
||||
USE input_cp2k_field, ONLY: create_efield_section,&
|
||||
|
|
@ -5820,7 +5821,7 @@ CONTAINS
|
|||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, __LOCATION__, name="OPT_EMBED", &
|
||||
description="This section specifies optional parameters for DFT embedding potential optimization.", &
|
||||
n_keywords=17, n_subsections=4, repeats=.FALSE.)
|
||||
n_keywords=19, n_subsections=4, repeats=.FALSE.)
|
||||
|
||||
NULLIFY (keyword)
|
||||
|
||||
|
|
@ -5919,10 +5920,26 @@ CONTAINS
|
|||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, __LOCATION__, name="ADD_CONST_POT", &
|
||||
description="Apply level shift in the "// &
|
||||
"optimization of the embedding potential.", &
|
||||
usage="ADD_CONST_POT .FALSE.", default_l_val=.FALSE.)
|
||||
CALL keyword_create(keyword, __LOCATION__, name="POT_GUESS", &
|
||||
description="Specifies the guess of the embedding "// &
|
||||
"potential. For optimization in finite basis (not grid optimization) "// &
|
||||
"in is a constant part to be added to the one in finite basis. ", &
|
||||
usage="DEGREES_OF_FREEDOM ALL", &
|
||||
enum_c_vals=s2a("NONE", "DIFF", "Fermi_Amaldi", "RESP"), &
|
||||
enum_desc=s2a("Initial guess is zero grid.", &
|
||||
"Initial density difference. A euristic but working approach.", &
|
||||
"Fermi-Amaldi potential. More rigorous than DIFF, although less efficient.", &
|
||||
"Coulomb interaction between the subsystem using RESP charges)"// &
|
||||
" on the total system."), &
|
||||
enum_i_vals=(/embed_none, embed_diff, embed_fa, embed_resp/), &
|
||||
default_i_val=embed_none)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, __LOCATION__, name="CHARGE_DISTR_WIDTH", &
|
||||
description="Width of the Gaussian representing "// &
|
||||
"point charges. To be used with ADD_COULOMB_POT.", &
|
||||
usage="CHARGE_DISTR_WIDTH 3.000", default_r_val=1.12490_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,9 @@ MODULE optimize_embedding_potential
|
|||
USE dbcsr_api, ONLY: dbcsr_p_type
|
||||
USE embed_types, ONLY: opt_embed_pot_type
|
||||
USE force_env_types, ONLY: force_env_type
|
||||
USE input_constants, ONLY: embed_grid_angstrom,&
|
||||
embed_grid_bohr,&
|
||||
embed_level_shift,&
|
||||
embed_quasi_newton,&
|
||||
embed_steep_desc
|
||||
USE input_constants, ONLY: &
|
||||
embed_diff, embed_fa, embed_grid_angstrom, embed_grid_bohr, embed_level_shift, embed_none, &
|
||||
embed_quasi_newton, embed_resp, embed_steep_desc
|
||||
USE input_section_types, ONLY: section_get_ival,&
|
||||
section_get_ivals,&
|
||||
section_get_rval,&
|
||||
|
|
@ -56,9 +54,11 @@ MODULE optimize_embedding_potential
|
|||
USE kinds, ONLY: default_path_length,&
|
||||
dp
|
||||
USE lri_environment_types, ONLY: lri_kind_type
|
||||
USE mathconstants, ONLY: pi
|
||||
USE message_passing, ONLY: mp_bcast,&
|
||||
mp_max,&
|
||||
mp_sum
|
||||
USE mixed_environment_utils, ONLY: get_subsys_map_index
|
||||
USE particle_list_types, ONLY: particle_list_type
|
||||
USE particle_types, ONLY: particle_type
|
||||
USE pw_env_types, ONLY: pw_env_get,&
|
||||
|
|
@ -66,6 +66,8 @@ MODULE optimize_embedding_potential
|
|||
USE pw_methods, ONLY: &
|
||||
pw_axpy, pw_copy, pw_derive, pw_dr2, pw_integral_ab, pw_integrate_function, pw_scale, &
|
||||
pw_transfer, pw_zero
|
||||
USE pw_poisson_methods, ONLY: pw_poisson_solve
|
||||
USE pw_poisson_types, ONLY: pw_poisson_type
|
||||
USE pw_pool_types, ONLY: pw_pool_create_pw,&
|
||||
pw_pool_give_back_pw,&
|
||||
pw_pool_type
|
||||
|
|
@ -76,7 +78,7 @@ MODULE optimize_embedding_potential
|
|||
pw_p_type,&
|
||||
pw_release,&
|
||||
pw_type
|
||||
USE qs_collocate_density, ONLY: calculate_ppl_grid,&
|
||||
USE qs_collocate_density, ONLY: calculate_rho_resp_all,&
|
||||
calculate_wavefunction
|
||||
USE qs_environment_types, ONLY: get_qs_env,&
|
||||
qs_environment_type,&
|
||||
|
|
@ -112,7 +114,7 @@ MODULE optimize_embedding_potential
|
|||
opt_embed_step, print_rho_diff, step_control, max_dens_diff, print_emb_opt_info, &
|
||||
conv_check_embed, make_subsys_embed_pot, print_embed_restart, find_aux_dimen, &
|
||||
read_embed_pot, understand_spin_states, given_embed_pot, print_rho_spin_diff, &
|
||||
print_pot_simple_grid, get_prev_density, get_max_subsys_diff
|
||||
print_pot_simple_grid, get_prev_density, get_max_subsys_diff, Coulomb_guess
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
|
@ -199,23 +201,29 @@ CONTAINS
|
|||
!> \param qs_env ...
|
||||
!> \param embed_pot ...
|
||||
!> \param add_const_pot ...
|
||||
!> \param Fermi_Amaldi ...
|
||||
!> \param const_pot ...
|
||||
!> \param open_shell_embed ...
|
||||
!> \param spin_embed_pot ...
|
||||
!> \param pot_diff ...
|
||||
!> \param Coulomb_guess ...
|
||||
!> \param grid_opt ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE init_embed_pot(qs_env, embed_pot, add_const_pot, const_pot, open_shell_embed, spin_embed_pot)
|
||||
SUBROUTINE init_embed_pot(qs_env, embed_pot, add_const_pot, Fermi_Amaldi, const_pot, open_shell_embed, &
|
||||
spin_embed_pot, pot_diff, Coulomb_guess, grid_opt)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(pw_p_type), POINTER :: embed_pot
|
||||
LOGICAL :: add_const_pot
|
||||
TYPE(pw_p_type), OPTIONAL, POINTER :: const_pot
|
||||
LOGICAL :: add_const_pot, Fermi_Amaldi
|
||||
TYPE(pw_p_type), POINTER :: const_pot
|
||||
LOGICAL :: open_shell_embed
|
||||
TYPE(pw_p_type), POINTER :: spin_embed_pot
|
||||
TYPE(pw_p_type), POINTER :: spin_embed_pot, pot_diff
|
||||
LOGICAL :: Coulomb_guess, grid_opt
|
||||
|
||||
INTEGER :: nelectrons
|
||||
INTEGER, DIMENSION(2) :: nelectron_spin
|
||||
REAL(KIND=dp) :: factor
|
||||
TYPE(pw_env_type), POINTER :: pw_env
|
||||
TYPE(pw_p_type) :: v_hartree_r_space, vppl
|
||||
TYPE(pw_p_type) :: v_hartree_r_space
|
||||
TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
|
||||
|
||||
! Extract plane waves environment
|
||||
|
|
@ -246,44 +254,49 @@ CONTAINS
|
|||
CALL pw_zero(spin_embed_pot%pw)
|
||||
ENDIF
|
||||
|
||||
! Add constant potential if requested
|
||||
IF (add_const_pot) THEN
|
||||
! First, pseudopotentials without error function
|
||||
NULLIFY (vppl%pw)
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, vppl%pw, &
|
||||
! Coulomb guess/constant potential
|
||||
IF (Coulomb_guess) THEN
|
||||
NULLIFY (pot_diff)
|
||||
ALLOCATE (pot_diff)
|
||||
NULLIFY (pot_diff%pw)
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, pot_diff%pw, &
|
||||
use_data=REALDATA3D, &
|
||||
in_space=REALSPACE)
|
||||
CALL pw_zero(pot_diff%pw)
|
||||
ENDIF
|
||||
|
||||
CALL calculate_ppl_grid(vppl, qs_env)
|
||||
|
||||
! Add Fermi-Amaldi potential on the reference density
|
||||
! Initialize constant part of the embedding potential
|
||||
IF ((add_const_pot) .AND. (.NOT. (grid_opt))) THEN
|
||||
! Now the constant potential is the Coulomb one
|
||||
NULLIFY (const_pot)
|
||||
ALLOCATE (const_pot)
|
||||
NULLIFY (const_pot%pw, v_hartree_r_space%pw)
|
||||
NULLIFY (const_pot%pw)
|
||||
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, const_pot%pw, &
|
||||
use_data=REALDATA3D, &
|
||||
in_space=REALSPACE)
|
||||
CALL pw_zero(const_pot%pw)
|
||||
ENDIF
|
||||
|
||||
! Add Fermi-Amaldi potential if requested
|
||||
IF (Fermi_Amaldi) THEN
|
||||
|
||||
! Extract Hartree potential
|
||||
NULLIFY (v_hartree_r_space%pw)
|
||||
CALL get_qs_env(qs_env=qs_env, pw_env=pw_env, &
|
||||
v_hartree_rspace=v_hartree_r_space%pw)
|
||||
CALL pw_copy(v_hartree_r_space%pw, const_pot%pw)
|
||||
CALL pw_copy(v_hartree_r_space%pw, embed_pot%pw)
|
||||
|
||||
! Calculate the number of electrons
|
||||
nelectrons = nelectron_spin(1)+nelectron_spin(2)
|
||||
factor = (REAL(nelectrons)-1.0_dp)/(REAL(nelectrons))
|
||||
!factor = (-1.0_dp)/(REAL(nelectrons))
|
||||
|
||||
! Scale the Hartree potential to get Fermi-Amaldi
|
||||
CALL pw_scale(const_pot%pw, a=factor)
|
||||
CALL pw_scale(embed_pot%pw, a=factor)
|
||||
|
||||
! Sum pseudo and Fermi-Amaldi
|
||||
CALL pw_axpy(vppl%pw, const_pot%pw)
|
||||
CALL pw_copy(const_pot%pw, embed_pot%pw)
|
||||
! Copy Fermi-Amaldi to embedding potential for basis-based optimization
|
||||
IF (.NOT. (grid_opt)) CALL pw_copy(embed_pot%pw, embed_pot%pw)
|
||||
|
||||
! Give back plane waves pool for pseudo
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, vppl%pw)
|
||||
ENDIF
|
||||
|
||||
END SUBROUTINE init_embed_pot
|
||||
|
|
@ -474,7 +487,7 @@ CONTAINS
|
|||
TYPE(opt_embed_pot_type) :: opt_embed
|
||||
TYPE(section_vals_type), POINTER :: opt_embed_section
|
||||
|
||||
INTEGER :: embed_optimizer
|
||||
INTEGER :: embed_guess, embed_optimizer
|
||||
|
||||
! Read keywords
|
||||
CALL section_vals_val_get(opt_embed_section, "REG_LAMBDA", &
|
||||
|
|
@ -498,8 +511,8 @@ CONTAINS
|
|||
CALL section_vals_val_get(opt_embed_section, "SPIN_DENS_CONV_INT", &
|
||||
r_val=opt_embed%conv_int_spin)
|
||||
|
||||
CALL section_vals_val_get(opt_embed_section, "ADD_CONST_POT", &
|
||||
l_val=opt_embed%add_const_pot)
|
||||
CALL section_vals_val_get(opt_embed_section, "CHARGE_DISTR_WIDTH", &
|
||||
r_val=opt_embed%eta)
|
||||
|
||||
CALL section_vals_val_get(opt_embed_section, "READ_EMBED_POT", &
|
||||
l_val=opt_embed%read_embed_pot)
|
||||
|
|
@ -535,6 +548,36 @@ CONTAINS
|
|||
CASE DEFAULT
|
||||
opt_embed%steep_desc = .TRUE.
|
||||
END SELECT
|
||||
|
||||
CALL section_vals_val_get(opt_embed_section, "POT_GUESS", i_val=embed_guess)
|
||||
SELECT CASE (embed_guess)
|
||||
CASE (embed_none)
|
||||
opt_embed%add_const_pot = .FALSE.
|
||||
opt_embed%Fermi_Amaldi = .FALSE.
|
||||
opt_embed%Coulomb_guess = .FALSE.
|
||||
opt_embed%diff_guess = .FALSE.
|
||||
CASE (embed_diff)
|
||||
opt_embed%add_const_pot = .TRUE.
|
||||
opt_embed%Fermi_Amaldi = .FALSE.
|
||||
opt_embed%Coulomb_guess = .FALSE.
|
||||
opt_embed%diff_guess = .TRUE.
|
||||
CASE (embed_fa)
|
||||
opt_embed%add_const_pot = .TRUE.
|
||||
opt_embed%Fermi_Amaldi = .TRUE.
|
||||
opt_embed%Coulomb_guess = .FALSE.
|
||||
opt_embed%diff_guess = .FALSE.
|
||||
CASE (embed_resp)
|
||||
opt_embed%add_const_pot = .TRUE.
|
||||
opt_embed%Fermi_Amaldi = .TRUE.
|
||||
opt_embed%Coulomb_guess = .TRUE.
|
||||
opt_embed%diff_guess = .FALSE.
|
||||
CASE DEFAULT
|
||||
opt_embed%add_const_pot = .FALSE.
|
||||
opt_embed%Fermi_Amaldi = .FALSE.
|
||||
opt_embed%Coulomb_guess = .FALSE.
|
||||
opt_embed%diff_guess = .FALSE.
|
||||
END SELECT
|
||||
|
||||
END SUBROUTINE read_opt_embed_section
|
||||
|
||||
! **************************************************************************************************
|
||||
|
|
@ -908,11 +951,16 @@ CONTAINS
|
|||
|
||||
DEALLOCATE (opt_embed%all_nspins)
|
||||
|
||||
IF (opt_embed%add_const_pot) THEN
|
||||
IF ((opt_embed%add_const_pot) .AND. (.NOT. (opt_embed%grid_opt))) THEN
|
||||
CALL pw_release(opt_embed%const_pot%pw)
|
||||
DEALLOCATE (opt_embed%const_pot)
|
||||
ENDIF
|
||||
|
||||
IF (opt_embed%Coulomb_guess) THEN
|
||||
CALL pw_release(opt_embed%pot_diff%pw)
|
||||
DEALLOCATE (opt_embed%pot_diff)
|
||||
ENDIF
|
||||
|
||||
IF (opt_embed%fab) THEN
|
||||
CALL pw_release(opt_embed%prev_embed_pot%pw)
|
||||
DEALLOCATE (opt_embed%prev_embed_pot)
|
||||
|
|
@ -928,6 +976,106 @@ CONTAINS
|
|||
|
||||
END SUBROUTINE release_opt_embed
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Calculates subsystem Coulomb potential from the RESP charges of the total system
|
||||
!> \param v_rspace ...
|
||||
!> \param rhs ...
|
||||
!> \param mapping_section ...
|
||||
!> \param qs_env ...
|
||||
!> \param nforce_eval ...
|
||||
!> \param iforce_eval ...
|
||||
!> \param eta ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE Coulomb_guess(v_rspace, rhs, mapping_section, qs_env, nforce_eval, iforce_eval, eta)
|
||||
TYPE(pw_p_type) :: v_rspace
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rhs
|
||||
TYPE(section_vals_type), POINTER :: mapping_section
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
INTEGER :: nforce_eval, iforce_eval
|
||||
REAL(KIND=dp) :: eta
|
||||
|
||||
INTEGER :: iparticle, jparticle, natom
|
||||
INTEGER, DIMENSION(:), POINTER :: map_index
|
||||
REAL(KIND=dp) :: dvol, normalize_factor
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rhs_subsys
|
||||
TYPE(particle_list_type), POINTER :: particles
|
||||
TYPE(pw_env_type), POINTER :: pw_env
|
||||
TYPE(pw_p_type) :: rho_resp, v_resp_gspace, v_resp_rspace
|
||||
TYPE(pw_poisson_type), POINTER :: poisson_env
|
||||
TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
|
||||
TYPE(qs_subsys_type), POINTER :: subsys
|
||||
|
||||
! Get available particles
|
||||
NULLIFY (subsys)
|
||||
CALL get_qs_env(qs_env=qs_env, subsys=subsys, pw_env=pw_env)
|
||||
CALL qs_subsys_get(subsys, particles=particles)
|
||||
natom = particles%n_els
|
||||
|
||||
ALLOCATE (rhs_subsys(natom))
|
||||
|
||||
NULLIFY (map_index)
|
||||
CALL get_subsys_map_index(mapping_section, natom, iforce_eval, nforce_eval, &
|
||||
map_index, .TRUE.)
|
||||
|
||||
! Mapping particles from iforce_eval environment to the embed env
|
||||
DO iparticle = 1, natom
|
||||
jparticle = map_index(iparticle)
|
||||
rhs_subsys(iparticle) = rhs(jparticle)
|
||||
END DO
|
||||
|
||||
! Prepare plane waves
|
||||
NULLIFY (auxbas_pw_pool)
|
||||
|
||||
CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
|
||||
poisson_env=poisson_env)
|
||||
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, &
|
||||
v_resp_gspace%pw, &
|
||||
use_data=COMPLEXDATA1D, &
|
||||
in_space=RECIPROCALSPACE)
|
||||
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, &
|
||||
v_resp_rspace%pw, &
|
||||
use_data=REALDATA3D, &
|
||||
in_space=REALSPACE)
|
||||
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, rho_resp%pw, &
|
||||
use_data=REALDATA3D, &
|
||||
in_space=REALSPACE)
|
||||
|
||||
! Calculate charge density
|
||||
CALL pw_zero(rho_resp%pw)
|
||||
CALL calculate_rho_resp_all(rho_resp, rhs_subsys, natom, eta, qs_env)
|
||||
|
||||
! Calculate potential
|
||||
CALL pw_zero(v_resp_gspace%pw)
|
||||
CALL pw_poisson_solve(poisson_env, rho_resp%pw, &
|
||||
vhartree=v_resp_gspace%pw)
|
||||
CALL pw_zero(v_resp_rspace%pw)
|
||||
CALL pw_transfer(v_resp_gspace%pw, v_resp_rspace%pw)
|
||||
dvol = v_resp_rspace%pw%pw_grid%dvol
|
||||
CALL pw_scale(v_resp_rspace%pw, dvol)
|
||||
normalize_factor = SQRT((eta/pi)**3)
|
||||
!normalize_factor = -2.0_dp
|
||||
CALL pw_scale(v_resp_rspace%pw, normalize_factor)
|
||||
|
||||
! Hard copy potential
|
||||
v_rspace%pw%cr3d(:, :, :) = v_resp_rspace%pw%cr3d(:, :, :)
|
||||
|
||||
! Release plane waves
|
||||
CALL pw_release(v_resp_gspace%pw)
|
||||
CALL pw_release(v_resp_rspace%pw)
|
||||
CALL pw_release(rho_resp%pw)
|
||||
|
||||
! Deallocate map_index array
|
||||
IF (ASSOCIATED(map_index)) THEN
|
||||
DEALLOCATE (map_index)
|
||||
END IF
|
||||
! Deallocate charges
|
||||
DEALLOCATE (rhs_subsys)
|
||||
|
||||
END SUBROUTINE Coulomb_guess
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Creates a subsystem embedding potential
|
||||
!> \param qs_env ...
|
||||
|
|
|
|||
|
|
@ -300,6 +300,8 @@ MODULE qs_environment_types
|
|||
TYPE(pw_p_type), POINTER :: spin_embed_pot
|
||||
! Polarizability tensor
|
||||
TYPE(polar_env_type), POINTER :: polar_env
|
||||
! Resp charges
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rhs
|
||||
END TYPE qs_environment_type
|
||||
|
||||
! **************************************************************************************************
|
||||
|
|
@ -477,6 +479,7 @@ CONTAINS
|
|||
!> \param embed_pot ...
|
||||
!> \param spin_embed_pot ...
|
||||
!> \param polar_env ...
|
||||
!> \param rhs ...
|
||||
!> \date 23.01.2002
|
||||
!> \author MK
|
||||
!> \version 1.0
|
||||
|
|
@ -507,7 +510,7 @@ CONTAINS
|
|||
lri_env, lri_density, dispersion_env, vee, rho_external, external_vxc, mask, &
|
||||
mp2_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, &
|
||||
s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, &
|
||||
gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env)
|
||||
gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, rhs)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(atomic_kind_type), DIMENSION(:), OPTIONAL, &
|
||||
POINTER :: atomic_kind_set
|
||||
|
|
@ -638,6 +641,7 @@ CONTAINS
|
|||
REAL(KIND=dp), DIMENSION(:, :), OPTIONAL, POINTER :: gradient_history, variable_history
|
||||
TYPE(pw_p_type), OPTIONAL, POINTER :: embed_pot, spin_embed_pot
|
||||
TYPE(polar_env_type), OPTIONAL, POINTER :: polar_env
|
||||
REAL(KIND=dp), DIMENSION(:), OPTIONAL, POINTER :: rhs
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'get_qs_env', routineP = moduleN//':'//routineN
|
||||
|
||||
|
|
@ -706,6 +710,9 @@ CONTAINS
|
|||
! Polarisability tensor
|
||||
IF (PRESENT(polar_env)) polar_env => qs_env%polar_env
|
||||
|
||||
! Resp charges
|
||||
IF (PRESENT(rhs)) rhs => qs_env%rhs
|
||||
|
||||
IF (PRESENT(rho_atom_set)) &
|
||||
CALL get_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
|
||||
IF (PRESENT(rho0_atom_set)) &
|
||||
|
|
@ -1015,6 +1022,7 @@ CONTAINS
|
|||
!> \param embed_pot ...
|
||||
!> \param spin_embed_pot ...
|
||||
!> \param polar_env ...
|
||||
!> \param rhs ...
|
||||
!> \date 23.01.2002
|
||||
!> \author MK
|
||||
!> \version 1.0
|
||||
|
|
@ -1033,7 +1041,7 @@ CONTAINS
|
|||
se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, &
|
||||
do_transport, transport_env, lri_env, lri_density, dispersion_env, mp2_env, kg_env, &
|
||||
kpoints, WannierCentres, almo_scf_env, gradient_history, variable_history, embed_pot, &
|
||||
spin_embed_pot, polar_env)
|
||||
spin_embed_pot, polar_env, rhs)
|
||||
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(cell_type), OPTIONAL, POINTER :: super_cell
|
||||
|
|
@ -1102,6 +1110,7 @@ CONTAINS
|
|||
REAL(KIND=dp), DIMENSION(:, :), OPTIONAL, POINTER :: gradient_history, variable_history
|
||||
TYPE(pw_p_type), OPTIONAL, POINTER :: embed_pot, spin_embed_pot
|
||||
TYPE(polar_env_type), OPTIONAL, POINTER :: polar_env
|
||||
REAL(KIND=dp), DIMENSION(:), OPTIONAL, POINTER :: rhs
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'set_qs_env', routineP = moduleN//':'//routineN
|
||||
|
||||
|
|
@ -1276,6 +1285,9 @@ CONTAINS
|
|||
IF (PRESENT(WannierCentres)) qs_env%WannierCentres => WannierCentres
|
||||
IF (PRESENT(kpoints)) CALL set_ks_env(qs_env%ks_env, kpoints=kpoints)
|
||||
|
||||
! Resp charges
|
||||
IF (PRESENT(rhs)) qs_env%rhs => rhs
|
||||
|
||||
END SUBROUTINE set_qs_env
|
||||
|
||||
! **************************************************************************************************
|
||||
|
|
@ -1506,6 +1518,11 @@ CONTAINS
|
|||
ENDDO
|
||||
DEALLOCATE (qs_env%WannierCentres)
|
||||
ENDIF
|
||||
|
||||
! Resp charges
|
||||
IF (ASSOCIATED(qs_env%rhs)) DEALLOCATE (qs_env%rhs)
|
||||
|
||||
! Embedding potentials if provided as input
|
||||
! now we are ready to deallocate the full structure
|
||||
DEALLOCATE (qs_env)
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ MODULE qs_resp
|
|||
USE qs_collocate_density, ONLY: calculate_rho_resp_all,&
|
||||
calculate_rho_resp_single
|
||||
USE qs_environment_types, ONLY: get_qs_env,&
|
||||
qs_environment_type
|
||||
qs_environment_type,&
|
||||
set_qs_env
|
||||
USE qs_kind_types, ONLY: qs_kind_type
|
||||
USE qs_subsys_types, ONLY: qs_subsys_get,&
|
||||
qs_subsys_type
|
||||
|
|
@ -144,9 +145,11 @@ CONTAINS
|
|||
output_unit
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:) :: ipiv
|
||||
LOGICAL :: has_resp
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rhs_to_save
|
||||
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
|
||||
TYPE(cell_type), POINTER :: cell
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(particle_list_type), POINTER :: particles
|
||||
TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
|
||||
TYPE(qs_subsys_type), POINTER :: subsys
|
||||
|
|
@ -226,6 +229,15 @@ CONTAINS
|
|||
CALL print_fitting_points(qs_env, resp_env)
|
||||
CALL print_pot_from_resp_charges(qs_env, resp_env, particles, natom, output_unit)
|
||||
|
||||
! In case of density functional embedding we need to save the charges to qs_env
|
||||
NULLIFY (dft_control)
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control)
|
||||
IF (dft_control%qs_control%ref_embed_subsys) THEN
|
||||
ALLOCATE (rhs_to_save(SIZE(resp_env%rhs)))
|
||||
rhs_to_save = resp_env%rhs
|
||||
CALL set_qs_env(qs_env, rhs=rhs_to_save)
|
||||
ENDIF
|
||||
|
||||
DEALLOCATE (ipiv)
|
||||
CALL resp_dealloc(resp_env, rep_sys)
|
||||
CALL cp_print_key_finished_output(output_unit, logger, resp_section, &
|
||||
|
|
|
|||
|
|
@ -189,6 +189,15 @@
|
|||
|
||||
&FORCE_EVAL
|
||||
METHOD Quickstep
|
||||
&PROPERTIES
|
||||
&RESP
|
||||
&SPHERE_SAMPLING
|
||||
AUTO_VDW_RADII_TABLE CAMBRIDGE
|
||||
AUTO_RMIN_SCALE 0.5
|
||||
AUTO_RMAX_SCALE 3.0
|
||||
&END
|
||||
&END
|
||||
&END
|
||||
&DFT
|
||||
BASIS_SET_FILE_NAME BASIS_RI_cc-TZ
|
||||
POTENTIAL_FILE_NAME HF_POTENTIALS
|
||||
|
|
@ -214,6 +223,7 @@
|
|||
DENS_CONV_MAX 0.025
|
||||
OPTIMIZER LEVEL_SHIFT
|
||||
GRID_OPT .FALSE.
|
||||
POT_GUESS RESP
|
||||
&END
|
||||
&END QS
|
||||
&SCF
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@
|
|||
DENS_CONV_MAX 0.07
|
||||
GRID_OPT .TRUE.
|
||||
TRUST_RAD 0.1
|
||||
ADD_CONST_POT .TRUE.
|
||||
POT_GUESS Fermi_Amaldi
|
||||
LEEUWEN-BAERENDS .TRUE.
|
||||
&END
|
||||
&END QS
|
||||
|
|
|
|||
|
|
@ -213,10 +213,11 @@
|
|||
&OPT_EMBED
|
||||
REG_LAMBDA 0.00001
|
||||
N_ITER 50
|
||||
DENS_CONV_INT 0.6
|
||||
DENS_CONV_MAX 0.035
|
||||
DENS_CONV_INT 0.55
|
||||
DENS_CONV_MAX 0.03
|
||||
GRID_OPT .TRUE.
|
||||
TRUST_RAD 1.0
|
||||
POT_GUESS DIFF
|
||||
&END
|
||||
&END QS
|
||||
&SCF
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ H 6.0 6.2645 7.42105263158
|
|||
TRUST_RAD 0.1
|
||||
DENS_CONV_INT 1.35
|
||||
DENS_CONV_MAX 0.2
|
||||
ADD_CONST_POT .TRUE.
|
||||
POT_GUESS Fermi_Amaldi
|
||||
OPTIMIZER LEVEL_SHIFT
|
||||
GRID_OPT .FALSE.
|
||||
&EMBED_POT_CUBE MEDIUM
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
H2O_H2_pbe.inp 11 1e-9 -18.3245846455
|
||||
H2O_H2_pbe.inp 11 1e-9 -18.3216363855
|
||||
H2O_H2_pbe_mp2.inp 11 1e-9 -18.3178512470
|
||||
H2O_H2_pbe_rpa_restart.inp 11 2e-8 -18.3610866706
|
||||
H4_H8_pbe_pbe0_const_pot.inp 11 1e-9 -3.97342905916
|
||||
H4_H8_pbe_pbe0_const_pot.inp 11 1e-9 -3.9755218059
|
||||
H_H_pbe_pbe0_triplet.inp 11 1e-9 -0.94029723471
|
||||
H_H_pbe_pbe0_triplet_restart.inp 11 1e-9 -0.94029723455
|
||||
H_H_pbe_pbe0_singlet_roks.inp 11 1e-9 -1.05060718524
|
||||
H2O_H2_pbe_grid.inp 11 1e-9 -18.3246514511
|
||||
H2O_H2_pbe_grid.inp 11 1e-9 -18.3246249755
|
||||
H_H_pbe_pbe0_triplet_grid.inp 11 1e-9 -0.94028826539
|
||||
H_H_pbe_pbe0_triplet_grid_restart_cube.inp 11 1e-9 -0.94028826537
|
||||
H_H_given_embed.inp 11 1e-9 -0.49080678947
|
||||
H2O_H2_pbe_baerends_uks.inp 11 1e-9 -18.3246545283
|
||||
H2O_H2_pbe_baerends_uks.inp 11 1e-9 -18.3246760167
|
||||
H2O_H2_pbe_FAB.inp 11 1e-9 -18.3826585434
|
||||
#EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue