36#include "./base/base_uses.f90"
42 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_ks_qmmm_methods'
65 ks_qmmm_env=ks_qmmm_env)
68 IF (.NOT.
ASSOCIATED(ks_qmmm_env))
THEN
69 ALLOCATE (ks_qmmm_env)
70 CALL qs_ks_qmmm_create(ks_qmmm_env=ks_qmmm_env, qs_env=qs_env, &
72 CALL set_qs_env(qs_env=qs_env, ks_qmmm_env=ks_qmmm_env)
85 SUBROUTINE qs_ks_qmmm_create(ks_qmmm_env, qs_env, qmmm_env)
90 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_ks_qmmm_create'
92 INTEGER :: handle, igrid
97 CALL timeset(routinen, handle)
99 NULLIFY (ks_qmmm_env%pw_env, &
100 ks_qmmm_env%cube_info)
101 NULLIFY (auxbas_pw_pool)
103 pw_env=ks_qmmm_env%pw_env)
104 CALL pw_env_get(ks_qmmm_env%pw_env, auxbas_pw_pool=auxbas_pw_pool)
107 ks_qmmm_env%pc_ener = 0.0_dp
108 ks_qmmm_env%n_evals = 0
110 CALL auxbas_pw_pool%create_pw(ks_qmmm_env%v_qmmm_rspace)
114 CALL pw_env_get(ks_qmmm_env%pw_env, pw_pools=pools)
115 ALLOCATE (cube_info(
SIZE(pools)))
116 DO igrid = 1,
SIZE(pools)
118 pools(igrid)%pool%pw_grid%dr(:), &
119 pools(igrid)%pool%pw_grid%dh(:, :), &
120 pools(igrid)%pool%pw_grid%dh_inv(:, :), &
121 pools(igrid)%pool%pw_grid%orthorhombic, &
122 qmmm_env%maxRadius(igrid))
124 ks_qmmm_env%cube_info => cube_info
126 NULLIFY (ks_qmmm_env%matrix_h)
129 CALL timestop(handle)
131 END SUBROUTINE qs_ks_qmmm_create
148 REAL(kind=
dp),
INTENT(INOUT) :: qmmm_energy
150 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_calculate_energy'
152 INTEGER :: handle, ispin, output_unit
158 CALL timeset(routinen, handle)
159 NULLIFY (dft_control, input, logger)
163 dft_control=dft_control, &
167 extension=
".qmmmLog")
168 IF (output_unit > 0)
WRITE (unit=output_unit, fmt=
"(T3,A)") &
169 "Adding QM/MM electrostatic potential to the Kohn-Sham potential."
172 DO ispin = 1, dft_control%nspins
175 IF (dft_control%qs_control%gapw)
THEN
178 cpassert(
ASSOCIATED(rho0_s_rs))
183 "QMMM%PRINT%PROGRAM_RUN_INFO")
185 CALL timestop(handle)
200 REAL(kind=
dp),
INTENT(IN) :: scale
202 CALL pw_axpy(v_qmmm, v_hartree, v_qmmm%pw_grid%dvol*scale)
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
for a given dr()/dh(r) this will provide the bounds to be used if one wants to go over a sphere-subre...
subroutine, public init_cube_info(info, dr, dh, dh_inv, ortho, max_radius)
...
Routines to efficiently handle dense polynomial in 3 variables up to a given degree....
subroutine, public init_d3_poly_module()
initialization of the cache, is called by functions in this module that use cached values
Defines the basic variable types.
integer, parameter, public dp
container for various plainwaves related things
subroutine, public pw_env_retain(pw_env)
retains the pw_env (see doc/ReferenceCounting.html)
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_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, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, 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, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Set the QUICKSTEP environment.
subroutine, public qmmm_calculate_energy(qs_env, rho, v_qmmm, qmmm_energy)
Computes the contribution to the total energy of the QM/MM electrostatic coupling.
subroutine, public qmmm_modify_hartree_pot(v_hartree, v_qmmm, scale)
Modify the hartree potential in order to include the QM/MM correction.
subroutine, public ks_qmmm_env_rebuild(qs_env, qmmm_env)
Initialize the ks_qmmm_env.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
calculation environment to calculate the ks_qmmm matrix, holds the QM/MM potential and all the needed...