73#include "./base/base_uses.f90"
78 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
79 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_create'
102 force_env_section, qmmm_section, subsys_section, use_motion_section, prev_subsys, &
110 LOGICAL,
INTENT(IN) :: use_motion_section
112 LOGICAL,
INTENT(in),
OPTIONAL :: ignore_outside_box
114 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_env_create'
116 CHARACTER(len=default_string_length), &
117 DIMENSION(:),
POINTER :: qm_atom_type
118 INTEGER :: center_i, delta_charge, handle, iw, iw2, &
119 orig_charge, qmmm_coupl_type, &
121 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index, mm_link_atoms, &
123 LOGICAL :: add_mm_charges, explicit, &
124 move_mm_charges, nocompatibility, &
125 qmmm_link, qmmm_link_imomm, shell_model
126 REAL(
dp),
DIMENSION(:),
POINTER :: mm_atom_chrg, mm_el_pot_radius, &
127 mm_el_pot_radius_corr
128 REAL(kind=
dp) :: eps_mm_rspace
129 REAL(kind=
dp),
DIMENSION(3) :: abc_mm, abc_qm
130 REAL(kind=
dp),
DIMENSION(:),
POINTER :: fist_scale_charge_link, &
134 TYPE(
cell_type),
POINTER :: mm_cell, qm_cell_small, super_cell
145 print_section, qmmm_periodic
147 CALL timeset(routinen, handle)
149 NULLIFY (qm_atom_index, mm_atom_index, qm_atom_type)
150 NULLIFY (qmmm_env_qm, subsys_mm, subsys_qm, mm_cell, qm_cell_small)
151 NULLIFY (mm_atom_chrg, mm_el_pot_radius, qmmm_env_mm, fist_env)
152 NULLIFY (mm_link_atoms, mm_link_scale_factor, qmmm_links, added_charges, added_shells)
153 NULLIFY (fist_scale_charge_link, print_section, fist_nonbond_env)
154 NULLIFY (print_gen, logger, mm_el_pot_radius_corr, super_cell, pw_env)
162 IF (.NOT.
ASSOCIATED(subsys_section))
THEN
172 ALLOCATE (qmmm_env_qm)
174 ALLOCATE (qmmm_env_mm)
182 mm_link_scale_factor, &
183 fist_scale_charge_link, &
187 qmmm_env_mm%qm_atom_index => qm_atom_index
188 qmmm_env_mm%mm_link_atoms => mm_link_atoms
189 qmmm_env_mm%mm_link_scale_factor => mm_link_scale_factor
190 qmmm_env_mm%fist_scale_charge_link => fist_scale_charge_link
191 qmmm_env_mm%qmmm_coupl_type = qmmm_coupl_type
192 qmmm_env_mm%qmmm_link = qmmm_link
196 qmmm_env_qm%center_qm_subsys = .false.
197 qmmm_env_qm%center_qm_subsys0 = .false.
199 qmmm_env_qm%center_qm_subsys = .false.
200 qmmm_env_qm%center_qm_subsys0 = .true.
202 qmmm_env_qm%center_qm_subsys = .true.
203 qmmm_env_qm%center_qm_subsys0 = .true.
205 cpabort(
"Unknown type of CENTER! ")
213 qmmm_env_qm%compatibility = .NOT. nocompatibility
217 i_val=qmmm_env_qm%par_scheme)
221 qmmm_env_qm%periodic = explicit
223 IF (qmmm_env_qm%periodic) qmmm_env_qm%multipole = .true.
228 IF (qmmm_env_qm%periodic .AND. qmmm_env_qm%multipole)
CALL cite_reference(
laino2006)
230 IF (qmmm_env_qm%periodic) &
231 CALL cp_warn(__location__, &
232 "QMMM periodic calculation with coupling NONE was requested! "// &
233 "Switching off the periodic keyword since periodic and non-periodic "// &
234 "calculation with coupling NONE represent the same method! ")
235 qmmm_env_qm%periodic = .false.
242 CALL fist_env_set(fist_env, qmmm=.true., qmmm_env=qmmm_env_mm)
243 CALL fist_init(fist_env, root_section, para_env, force_env_section, &
244 subsys_section, use_motion_section, prev_subsys=prev_subsys)
245 CALL fist_env_get(fist_env, subsys=subsys_mm, cell=mm_cell)
246 mm_cell%tag =
"CELL_MM"
261 qmmm_env_qm%qm_atom_index => qm_atom_index
262 qmmm_env_qm%mm_atom_index => mm_atom_index
263 qmmm_env_qm%eps_mm_rspace = eps_mm_rspace
264 qmmm_env_qm%qmmm_coupl_type = qmmm_coupl_type
265 qmmm_env_qm%qmmm_link = qmmm_link
266 qmmm_env_qm%num_qm_atoms =
SIZE(qm_atom_index)
267 qmmm_env_qm%num_mm_atoms =
SIZE(mm_atom_index)
268 IF (qmmm_env_qm%image_charge)
THEN
269 qmmm_env_qm%num_image_mm_atoms =
SIZE(qmmm_env_qm%image_charge_pot%image_mm_list)
275 IF (
ASSOCIATED(mm_link_atoms))
THEN
276 ALLOCATE (qmmm_env_qm%mm_link_atoms(
SIZE(mm_link_atoms)))
277 qmmm_env_qm%mm_link_atoms = mm_link_atoms
281 WRITE (iw,
'(A,I26)')
" Number of QM atoms: ", qmmm_env_qm%num_qm_atoms
282 WRITE (iw,
'(A,I26)')
" Number of MM atoms: ", qmmm_env_qm%num_mm_atoms
283 IF (qmmm_env_qm%image_charge)
THEN
284 WRITE (iw,
'(A,I8)')
" Number of MM atoms with image charge: ", &
285 qmmm_env_qm%num_image_mm_atoms
289 CALL get_cell(qm_cell_small, abc=abc_qm)
292 IF (qmmm_env_qm%image_charge)
THEN
293 IF (any(abs(abc_mm - abc_qm) > 1.0e-12)) &
294 cpabort(
"QM and MM box need to have the same size when using image charges")
298 CALL fist_env_get(fist_env, fist_nonbond_env=fist_nonbond_env)
299 ALLOCATE (mm_atom_chrg(
SIZE(mm_atom_index)))
300 ALLOCATE (mm_el_pot_radius(
SIZE(mm_atom_index)))
301 ALLOCATE (mm_el_pot_radius_corr(
SIZE(mm_atom_index)))
302 mm_atom_chrg = 0.0_dp
303 mm_el_pot_radius = 0.0_dp
304 mm_el_pot_radius_corr = 0.0_dp
307 charges=fist_nonbond_env%charges, &
308 mm_atom_chrg=mm_atom_chrg, &
309 mm_el_pot_radius=mm_el_pot_radius, &
310 mm_el_pot_radius_corr=mm_el_pot_radius_corr, &
311 mm_atom_index=mm_atom_index, &
312 mm_link_atoms=mm_link_atoms, &
313 mm_link_scale_factor=mm_link_scale_factor, &
314 added_shells=added_shells, &
315 shell_model=shell_model)
317 qmmm_env_qm%mm_atom_chrg => mm_atom_chrg
318 qmmm_env_qm%mm_el_pot_radius => mm_el_pot_radius
319 qmmm_env_qm%mm_el_pot_radius_corr => mm_el_pot_radius_corr
320 qmmm_env_qm%added_shells => added_shells
322 qmmm_link_imomm = .false.
325 mm_el_pot_radius_corr, mm_atom_index, iw)
326 qmmm_env_qm%qmmm_links => qmmm_links
332 mm_atom_chrg, mm_el_pot_radius, mm_el_pot_radius_corr, &
333 added_charges, mm_atom_index)
334 qmmm_env_qm%move_mm_charges = move_mm_charges
335 qmmm_env_qm%add_mm_charges = add_mm_charges
336 qmmm_env_qm%added_charges => added_charges
337 IF (
ASSOCIATED(qmmm_links%imomm)) qmmm_link_imomm = (
SIZE(qmmm_links%imomm) /= 0)
341 mm_el_pot_radius_corr, qmmm_env_qm%added_charges, &
342 qmmm_env_qm%added_shells, qmmm_section, nocompatibility, shell_model)
343 IF (qmmm_env_qm%image_charge)
THEN
353 big_subsys=subsys_mm, small_para_env=para_env, &
354 small_cell=qm_cell_small, sub_atom_index=qm_atom_index, &
355 sub_atom_kind_name=qm_atom_type, para_env=para_env, &
356 force_env_section=force_env_section, subsys_section=subsys_section, &
357 ignore_outside_box=ignore_outside_box)
362 CALL qs_init(qs_env, para_env, root_section, globenv=globenv, cp_subsys=subsys_qm, &
363 cell=qm_cell_small, qmmm=.true., qmmm_env_qm=qmmm_env_qm, &
364 force_env_section=force_env_section, subsys_section=subsys_section, &
365 use_motion_section=use_motion_section)
368 IF (qmmm_env_qm%periodic)
THEN
369 IF (.NOT.
ASSOCIATED(super_cell))
THEN
370 ALLOCATE (super_cell)
372 CALL cell_clone(mm_cell, super_cell, tag=
"SUPER_CELL")
373 CALL set_qs_env(qs_env, super_cell=super_cell, qmmm_periodic=qmmm_env_qm%periodic)
379 extension=
".qmmmLog")
382 "PRINT%PROGRAM_BANNER")
389 mm_atom_chrg=mm_atom_chrg, &
390 added_charges=qmmm_env_qm%added_charges, &
391 added_shells=qmmm_env_qm%added_shells, &
392 print_section=print_section, &
393 qmmm_section=qmmm_section)
399 added_charges=qmmm_env_qm%added_charges, &
400 added_shells=qmmm_env_qm%added_shells, &
401 print_section=print_section)
412 qm_cell_small=qm_cell_small, &
416 added_charges=qmmm_env_qm%added_charges, &
417 added_shells=qmmm_env_qm%added_shells, &
418 qmmm_periodic=qmmm_periodic, &
419 print_section=print_section, &
420 mm_atom_chrg=mm_atom_chrg)
425 dr=pw_env%pw_pools(pw_env%auxbas_grid)%pool%pw_grid%dr)
430 qmmm_env%qs_env => qs_env
431 qmmm_env%fist_env => fist_env
432 qmmm_env%qm => qmmm_env_qm
435 DEALLOCATE (qm_atom_type)
437 CALL timestop(handle)
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public laino2006
integer, save, public golze2013
integer, save, public laino2005
Handles all functions related to the CELL.
subroutine, public write_cell(cell, subsys_section, tag)
Write the cell parameters to the output unit.
Handles all functions related to the CELL.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_clone(cell_in, cell_out, tag)
Clone cell variable.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
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,...
Initialize a small environment for a particular calculation.
subroutine, public create_small_subsys(small_subsys, big_subsys, small_cell, small_para_env, sub_atom_index, sub_atom_kind_name, para_env, force_env_section, subsys_section, ignore_outside_box)
updates the molecule information of the given subsys
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public fist_env_get(fist_env, atomic_kind_set, particle_set, ewald_pw, local_particles, local_molecules, molecule_kind_set, molecule_set, cell, cell_ref, ewald_env, fist_nonbond_env, thermo, para_env, subsys, qmmm, qmmm_env, input, shell_model, shell_model_ad, shell_particle_set, core_particle_set, multipoles, results, exclusions, efield)
Purpose: Get the FIST environment.
subroutine, public fist_env_create(fist_env, para_env)
allocates and intitializes a fist_env
subroutine, public fist_env_set(fist_env, atomic_kind_set, particle_set, ewald_pw, local_particles, local_molecules, molecule_kind_set, molecule_set, cell_ref, ewald_env, fist_nonbond_env, thermo, subsys, qmmm, qmmm_env, input, shell_model, shell_model_ad, exclusions, efield)
Set the FIST environment.
initialize fist environment
subroutine, public fist_init(fist_env, root_section, para_env, force_env_section, subsys_section, use_motion_section, prev_subsys)
reads the input and database file for fist
Define type storing the global information of a run. Keep the amount of stored data small....
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Interface to the message passing library MPI.
container for various plainwaves related things
Initialize a QM/MM calculation.
subroutine, public qmmm_env_create(qmmm_env, root_section, para_env, globenv, force_env_section, qmmm_section, subsys_section, use_motion_section, prev_subsys, ignore_outside_box)
...
Initialize a QM/MM calculation.
subroutine, public setup_qmmm_vars_qm(qmmm_section, qmmm_env, subsys_mm, qm_atom_type, qm_atom_index, mm_atom_index, qm_cell_small, qmmm_coupl_type, eps_mm_rspace, qmmm_link, para_env)
...
subroutine, public setup_qmmm_links(qmmm_section, qmmm_links, mm_el_pot_radius, mm_el_pot_radius_corr, mm_atom_index, iw)
this routine sets up all variables to treat qmmm links
subroutine, public qmmm_init_gaussian_type(qmmm_env_qm, para_env, mm_atom_chrg, qs_env, added_charges, added_shells, print_section, qmmm_section)
...
subroutine, public move_or_add_atoms(qmmm_section, move_mm_charges, add_mm_charges, mm_atom_chrg, mm_el_pot_radius, mm_el_pot_radius_corr, added_charges, mm_atom_index)
this routine sets up all variables to treat qmmm links
subroutine, public assign_mm_charges_and_radius(subsys, charges, mm_atom_chrg, mm_el_pot_radius, mm_el_pot_radius_corr, mm_atom_index, mm_link_atoms, mm_link_scale_factor, added_shells, shell_model)
Assigns charges and radius to evaluate the MM electrostatic potential.
subroutine, public setup_origin_mm_cell(qmmm_section, qmmm_env, qm_cell_small, dr)
this routine sets up the origin of the MM cell respect to the origin of the QM cell....
subroutine, public qmmm_init_periodic_potential(qmmm_env_qm, qm_cell_small, mm_cell, para_env, qs_env, added_charges, added_shells, qmmm_periodic, print_section, mm_atom_chrg)
...
subroutine, public print_qmmm_charges(mm_atom_index, mm_atom_chrg, mm_el_pot_radius, mm_el_pot_radius_corr, added_charges, added_shells, qmmm_section, nocompatibility, shell_model)
Print info on charges generating the qmmm potential..
subroutine, public print_qmmm_links(qmmm_section, qmmm_links)
Print info on qm/mm links.
subroutine, public setup_qmmm_vars_mm(qmmm_section, qmmm_env, qm_atom_index, mm_link_atoms, mm_link_scale_factor, fist_scale_charge_link, qmmm_coupl_type, qmmm_link)
...
subroutine, public print_image_charge_info(qmmm_env, qmmm_section)
Print info on image charges.
subroutine, public qmmm_init_potential(qmmm_env_qm, mm_cell, added_charges, added_shells, print_section)
...
A collection of methods to treat the QM/MM links.
subroutine, public qmmm_link_imomm_coord(qmmm_links, particles, qm_atom_index)
correct the position for qm/mm IMOMM link type
sets variables for the qmmm pool of pw_types
subroutine, public qmmm_pw_grid_init(qmmm_env, pw_env)
Initialize the qmmm pool of pw_r3d_rs_type. Then Main difference w.r.t. QS pw_r3d_rs_type pools is th...
subroutine, public qmmm_env_mm_create(qmmm_env)
...
subroutine, public qmmm_env_qm_create(qmmm_env)
...
subroutine, public add_set_release(added_charges)
deallocates the add_set_release
Basic container type for QM/MM.
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 qs_env_create(qs_env, globenv)
allocates and intitializes a qs_env
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 qs_init(qs_env, para_env, root_section, globenv, cp_subsys, kpoint_env, cell, cell_ref, qmmm, qmmm_env_qm, force_env_section, subsys_section, use_motion_section, silent)
Read the input and the database files for the setup of the QUICKSTEP environment.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represents a system: atoms, molecules, their pos,vel,...
contains the initially parsed file and the initial parallel environment
stores all the informations relevant to an mpi environment
contained for different pw related things
parameters for core-shell model potentials