74#include "./base/base_uses.f90"
79 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
80 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_create'
103 force_env_section, qmmm_section, subsys_section, use_motion_section, prev_subsys, &
111 LOGICAL,
INTENT(IN) :: use_motion_section
113 LOGICAL,
INTENT(in),
OPTIONAL :: ignore_outside_box
115 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_env_create'
117 CHARACTER(len=default_string_length), &
118 DIMENSION(:),
POINTER :: qm_atom_type
119 INTEGER :: center_i, delta_charge, handle, iw, iw2, &
120 orig_charge, qmmm_coupl_type, &
122 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index, mm_link_atoms, &
124 LOGICAL :: add_mm_charges, explicit, &
125 move_mm_charges, nocompatibility, &
126 qmmm_link, qmmm_link_imomm, shell_model
127 REAL(
dp),
DIMENSION(:),
POINTER :: mm_atom_chrg, mm_el_pot_radius, &
128 mm_el_pot_radius_corr
129 REAL(kind=
dp) :: eps_mm_rspace
130 REAL(kind=
dp),
DIMENSION(3) :: abc_mm, abc_qm
131 REAL(kind=
dp),
DIMENSION(:),
POINTER :: fist_scale_charge_link, &
135 TYPE(
cell_type),
POINTER :: mm_cell, qm_cell_small, super_cell
146 print_gen, print_section, qmmm_periodic
148 CALL timeset(routinen, handle)
150 NULLIFY (qm_atom_index, mm_atom_index, qm_atom_type)
151 NULLIFY (qmmm_env_qm, subsys_mm, subsys_qm, mm_cell, qm_cell_small, cell_section)
152 NULLIFY (mm_atom_chrg, mm_el_pot_radius, qmmm_env_mm, fist_env)
153 NULLIFY (mm_link_atoms, mm_link_scale_factor, qmmm_links, added_charges, added_shells)
154 NULLIFY (fist_scale_charge_link, print_section, fist_nonbond_env)
155 NULLIFY (print_gen, logger, mm_el_pot_radius_corr, super_cell, pw_env)
163 IF (.NOT.
ASSOCIATED(subsys_section))
THEN
173 ALLOCATE (qmmm_env_qm)
175 ALLOCATE (qmmm_env_mm)
183 mm_link_scale_factor, &
184 fist_scale_charge_link, &
188 qmmm_env_mm%qm_atom_index => qm_atom_index
189 qmmm_env_mm%mm_link_atoms => mm_link_atoms
190 qmmm_env_mm%mm_link_scale_factor => mm_link_scale_factor
191 qmmm_env_mm%fist_scale_charge_link => fist_scale_charge_link
192 qmmm_env_mm%qmmm_coupl_type = qmmm_coupl_type
193 qmmm_env_mm%qmmm_link = qmmm_link
197 qmmm_env_qm%center_qm_subsys = .false.
198 qmmm_env_qm%center_qm_subsys0 = .false.
200 qmmm_env_qm%center_qm_subsys = .false.
201 qmmm_env_qm%center_qm_subsys0 = .true.
203 qmmm_env_qm%center_qm_subsys = .true.
204 qmmm_env_qm%center_qm_subsys0 = .true.
206 cpabort(
"Unknown type of CENTER! ")
214 qmmm_env_qm%compatibility = .NOT. nocompatibility
218 i_val=qmmm_env_qm%par_scheme)
222 qmmm_env_qm%periodic = explicit
224 IF (qmmm_env_qm%periodic) qmmm_env_qm%multipole = .true.
229 IF (qmmm_env_qm%periodic .AND. qmmm_env_qm%multipole)
CALL cite_reference(
laino2006)
231 IF (qmmm_env_qm%periodic) &
232 CALL cp_warn(__location__, &
233 "QMMM periodic calculation with coupling NONE was requested! "// &
234 "Switching off the periodic keyword since periodic and non-periodic "// &
235 "calculation with coupling NONE represent the same method! ")
236 qmmm_env_qm%periodic = .false.
243 CALL fist_env_set(fist_env, qmmm=.true., qmmm_env=qmmm_env_mm)
244 CALL fist_init(fist_env, root_section, para_env, force_env_section, &
245 subsys_section, use_motion_section, prev_subsys=prev_subsys)
249 CALL fist_env_get(fist_env, subsys=subsys_mm, cell=mm_cell)
250 mm_cell%tag =
"CELL_MM"
252 CALL read_cell(qm_cell_small, qm_cell_small, cell_section=cell_section, &
253 check_for_ref=.false., para_env=para_env)
254 qm_cell_small%tag =
"CELL_QM"
269 qmmm_env_qm%qm_atom_index => qm_atom_index
270 qmmm_env_qm%mm_atom_index => mm_atom_index
271 qmmm_env_qm%eps_mm_rspace = eps_mm_rspace
272 qmmm_env_qm%qmmm_coupl_type = qmmm_coupl_type
273 qmmm_env_qm%qmmm_link = qmmm_link
274 qmmm_env_qm%num_qm_atoms =
SIZE(qm_atom_index)
275 qmmm_env_qm%num_mm_atoms =
SIZE(mm_atom_index)
276 IF (qmmm_env_qm%image_charge)
THEN
277 qmmm_env_qm%num_image_mm_atoms =
SIZE(qmmm_env_qm%image_charge_pot%image_mm_list)
283 IF (
ASSOCIATED(mm_link_atoms))
THEN
284 ALLOCATE (qmmm_env_qm%mm_link_atoms(
SIZE(mm_link_atoms)))
285 qmmm_env_qm%mm_link_atoms = mm_link_atoms
289 WRITE (iw,
'(A,I26)')
" Number of QM atoms: ", qmmm_env_qm%num_qm_atoms
290 WRITE (iw,
'(A,I26)')
" Number of MM atoms: ", qmmm_env_qm%num_mm_atoms
291 IF (qmmm_env_qm%image_charge)
THEN
292 WRITE (iw,
'(A,I8)')
" Number of MM atoms with image charge: ", &
293 qmmm_env_qm%num_image_mm_atoms
297 CALL get_cell(qm_cell_small, abc=abc_qm)
300 IF (qmmm_env_qm%image_charge)
THEN
301 IF (any(abs(abc_mm - abc_qm) > 1.0e-12)) &
302 cpabort(
"QM and MM box need to have the same size when using image charges")
306 CALL fist_env_get(fist_env, fist_nonbond_env=fist_nonbond_env)
307 ALLOCATE (mm_atom_chrg(
SIZE(mm_atom_index)))
308 ALLOCATE (mm_el_pot_radius(
SIZE(mm_atom_index)))
309 ALLOCATE (mm_el_pot_radius_corr(
SIZE(mm_atom_index)))
310 mm_atom_chrg = 0.0_dp
311 mm_el_pot_radius = 0.0_dp
312 mm_el_pot_radius_corr = 0.0_dp
315 charges=fist_nonbond_env%charges, &
316 mm_atom_chrg=mm_atom_chrg, &
317 mm_el_pot_radius=mm_el_pot_radius, &
318 mm_el_pot_radius_corr=mm_el_pot_radius_corr, &
319 mm_atom_index=mm_atom_index, &
320 mm_link_atoms=mm_link_atoms, &
321 mm_link_scale_factor=mm_link_scale_factor, &
322 added_shells=added_shells, &
323 shell_model=shell_model)
325 qmmm_env_qm%mm_atom_chrg => mm_atom_chrg
326 qmmm_env_qm%mm_el_pot_radius => mm_el_pot_radius
327 qmmm_env_qm%mm_el_pot_radius_corr => mm_el_pot_radius_corr
328 qmmm_env_qm%added_shells => added_shells
330 qmmm_link_imomm = .false.
333 mm_el_pot_radius_corr, mm_atom_index, iw)
334 qmmm_env_qm%qmmm_links => qmmm_links
340 mm_atom_chrg, mm_el_pot_radius, mm_el_pot_radius_corr, &
341 added_charges, mm_atom_index)
342 qmmm_env_qm%move_mm_charges = move_mm_charges
343 qmmm_env_qm%add_mm_charges = add_mm_charges
344 qmmm_env_qm%added_charges => added_charges
345 IF (
ASSOCIATED(qmmm_links%imomm)) qmmm_link_imomm = (
SIZE(qmmm_links%imomm) /= 0)
349 mm_el_pot_radius_corr, qmmm_env_qm%added_charges, &
350 qmmm_env_qm%added_shells, qmmm_section, nocompatibility, shell_model)
351 IF (qmmm_env_qm%image_charge)
THEN
361 big_subsys=subsys_mm, small_para_env=para_env, &
362 small_cell=qm_cell_small, sub_atom_index=qm_atom_index, &
363 sub_atom_kind_name=qm_atom_type, para_env=para_env, &
364 force_env_section=force_env_section, subsys_section=subsys_section, &
365 ignore_outside_box=ignore_outside_box)
370 CALL qs_init(qs_env, para_env, root_section, globenv=globenv, cp_subsys=subsys_qm, &
371 qmmm=.true., qmmm_env_qm=qmmm_env_qm, &
372 force_env_section=force_env_section, &
373 subsys_section=subsys_section, &
374 use_motion_section=use_motion_section)
377 IF (qmmm_env_qm%periodic)
THEN
378 IF (.NOT.
ASSOCIATED(super_cell))
THEN
379 ALLOCATE (super_cell)
381 CALL cell_clone(mm_cell, super_cell, tag=
"SUPER_CELL")
382 CALL set_qs_env(qs_env, super_cell=super_cell, qmmm_periodic=qmmm_env_qm%periodic)
388 extension=
".qmmmLog")
391 "PRINT%PROGRAM_BANNER")
398 mm_atom_chrg=mm_atom_chrg, &
399 added_charges=qmmm_env_qm%added_charges, &
400 added_shells=qmmm_env_qm%added_shells, &
401 print_section=print_section, &
402 qmmm_section=qmmm_section)
408 added_charges=qmmm_env_qm%added_charges, &
409 added_shells=qmmm_env_qm%added_shells, &
410 print_section=print_section)
421 qm_cell_small=qm_cell_small, &
425 added_charges=qmmm_env_qm%added_charges, &
426 added_shells=qmmm_env_qm%added_shells, &
427 qmmm_periodic=qmmm_periodic, &
428 print_section=print_section, &
429 mm_atom_chrg=mm_atom_chrg)
434 dr=pw_env%pw_pools(pw_env%auxbas_grid)%pool%pw_grid%dr)
439 qmmm_env%qs_env => qs_env
440 qmmm_env%fist_env => fist_env
441 qmmm_env%qm => qmmm_env_qm
444 DEALLOCATE (qm_atom_type)
446 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.
recursive subroutine, public read_cell(cell, cell_ref, use_ref_cell, cell_section, topology_section, check_for_ref, para_env)
...
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, mimic, 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, sab_cneo, 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, xcint_weights, 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, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_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, do_rixs, tb_tblite)
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, mimic, 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, rhoz_cneo_set, 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, do_rixs, tb_tblite)
Set the QUICKSTEP environment.
subroutine, public qs_init(qs_env, para_env, root_section, globenv, cp_subsys, kpoint_env, 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