72#include "./base/base_uses.f90"
90 CHARACTER(len=*),
PARAMETER,
PRIVATE :: modulen =
'qmmm_tb_methods'
115 CHARACTER(len=*),
PARAMETER :: routinen =
'build_tb_qmmm_matrix'
117 INTEGER :: handle, i, iatom, ikind, jatom, natom, &
119 INTEGER,
DIMENSION(:),
POINTER ::
list
120 LOGICAL :: defined, do_dftb, do_xtb, found
121 REAL(kind=
dp) :: pc_ener, zeff
122 REAL(kind=
dp),
DIMENSION(0:3) :: eta_a
123 REAL(kind=
dp),
DIMENSION(:),
POINTER :: qpot
124 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: hblock, sblock
127 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_h, matrix_s
134 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
141 CALL timeset(routinen, handle)
144 dft_control=dft_control, &
145 atomic_kind_set=atomic_kind_set, &
146 particle_set=particles_qm, &
147 qs_kind_set=qs_kind_set, &
150 dftb_control => dft_control%qs_control%dftb_control
151 xtb_control => dft_control%qs_control%xtb_control
153 IF (dft_control%qs_control%dftb)
THEN
156 ELSE IF (dft_control%qs_control%xtb)
THEN
160 cpabort(
"TB method unknown")
168 ELSE IF (do_xtb)
THEN
169 CALL get_qs_env(qs_env=qs_env, ks_env=ks_env, sab_orb=sab_nl)
170 CALL build_overlap_matrix(ks_env, matrix_s, basis_type_a=
'ORB', basis_type_b=
'ORB', sab_nl=sab_nl)
173 ALLOCATE (qpot(natom))
177 nkind =
SIZE(atomic_kind_set)
182 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
184 defined=defined, eta=eta_a, natorb=natorb)
186 IF (.NOT. dftb_control%self_consistent) eta_a(0) =
eta_mm
187 IF (.NOT. defined .OR. natorb < 1) cycle
188 ELSE IF (do_xtb)
THEN
190 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
197 qmmm_env%Potentials, particles_mm, &
198 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, mm_cell, iatom, &
199 qmmm_env%spherical_cutoff, particles_qm)
201 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
203 qmmm_env%added_charges%potentials, &
204 qmmm_env%added_charges%added_particles, &
205 qmmm_env%added_charges%mm_atom_chrg, &
206 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
207 qmmm_env%spherical_cutoff, &
210 pc_ener = pc_ener + qpot(iatom)*zeff
215 CALL get_qs_env(qs_env=qs_env, ks_qmmm_env=ks_qmmm_env_loc)
216 matrix_h => ks_qmmm_env_loc%matrix_h
218 ALLOCATE (matrix_h(1)%matrix)
219 CALL dbcsr_copy(matrix_h(1)%matrix, matrix_s(1)%matrix, &
220 name=
"QMMM HAMILTONIAN MATRIX")
221 CALL dbcsr_set(matrix_h(1)%matrix, 0.0_dp)
228 row=iatom, col=jatom, block=hblock, found=found)
230 hblock = hblock - 0.5_dp*sblock*(qpot(iatom) + qpot(jatom))
234 ks_qmmm_env_loc%matrix_h => matrix_h
235 ks_qmmm_env_loc%pc_ener = pc_ener
241 CALL timestop(handle)
256 CHARACTER(len=*),
PARAMETER :: routinen =
'build_tb_qmmm_matrix_zero'
259 LOGICAL :: do_dftb, do_xtb
260 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_h, matrix_s
267 CALL timeset(routinen, handle)
269 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
271 IF (dft_control%qs_control%dftb)
THEN
274 ELSE IF (dft_control%qs_control%xtb)
THEN
278 cpabort(
"TB method unknown")
286 ELSE IF (do_xtb)
THEN
287 CALL get_qs_env(qs_env=qs_env, ks_env=ks_env, sab_orb=sab_nl)
288 CALL build_overlap_matrix(ks_env, matrix_s, basis_type_a=
'ORB', basis_type_b=
'ORB', sab_nl=sab_nl)
292 CALL get_qs_env(qs_env=qs_env, ks_qmmm_env=ks_qmmm_env_loc)
293 matrix_h => ks_qmmm_env_loc%matrix_h
295 ALLOCATE (matrix_h(1)%matrix)
296 CALL dbcsr_copy(matrix_h(1)%matrix, matrix_s(1)%matrix, &
297 name=
"QMMM HAMILTONIAN MATRIX")
298 CALL dbcsr_set(matrix_h(1)%matrix, 0.0_dp)
299 ks_qmmm_env_loc%matrix_h => matrix_h
300 ks_qmmm_env_loc%pc_ener = 0.0_dp
304 CALL timestop(handle)
325 CALL build_tb_qmmm_matrix_smeared(qs_env, qmmm_env, particles_mm, mm_cell, para_env, &
346 IF (qmmm_env%compatibility)
THEN
347 cpabort(
"Gaussian QM/MM coupling for tight-binding methods requires NOCOMPATIBILITY.")
349 CALL build_tb_qmmm_matrix_smeared(qs_env, qmmm_env, particles_mm, mm_cell, para_env, &
363 SUBROUTINE build_tb_qmmm_matrix_smeared(qs_env, qmmm_env, particles_mm, mm_cell, para_env, gaussian)
372 CHARACTER(len=*),
PARAMETER :: routinen =
'build_tb_qmmm_matrix_smeared'
374 INTEGER :: do_ipol, ewald_type, handle, i, iatom, ikind, imm, imp, indmm, ipot, jatom, &
375 natom, natorb, nkind, nmm, nonperiodic_pot_type, short_range_pot_type
376 INTEGER,
DIMENSION(:),
POINTER ::
list
377 LOGICAL :: defined, do_dftb, do_multipoles, do_xtb, &
379 REAL(kind=
dp) :: alpha, pc_ener, zeff
380 REAL(kind=
dp),
DIMENSION(0:3) :: eta_a
381 REAL(kind=
dp),
DIMENSION(2) :: rcutoff
382 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charges_mm, qpot
383 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: hblock, sblock
386 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_h, matrix_s
393 TYPE(
particle_type),
DIMENSION(:),
POINTER :: atoms_mm, particles_qm
396 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
405 CALL timeset(routinen, handle)
416 dft_control=dft_control, &
417 atomic_kind_set=atomic_kind_set, &
418 particle_set=particles_qm, &
419 qs_kind_set=qs_kind_set, &
422 dftb_control => dft_control%qs_control%dftb_control
423 xtb_control => dft_control%qs_control%xtb_control
425 IF (dft_control%qs_control%dftb)
THEN
428 ELSE IF (dft_control%qs_control%xtb)
THEN
432 cpabort(
"TB method unknown")
440 ELSE IF (do_xtb)
THEN
441 CALL get_qs_env(qs_env=qs_env, ks_env=ks_env, sab_orb=sab_nl)
442 CALL build_overlap_matrix(ks_env, matrix_s, basis_type_a=
'ORB', basis_type_b=
'ORB', sab_nl=sab_nl)
445 ALLOCATE (qpot(natom))
453 CALL ewald_env_set(ewald_env, poisson_section=poisson_section)
458 CALL ewald_pw_create(ewald_pw, ewald_env, mm_cell, mm_cell, print_section=print_section)
460 CALL ewald_env_get(ewald_env, ewald_type=ewald_type, do_multipoles=do_multipoles, do_ipol=do_ipol)
461 IF (do_multipoles) cpabort(
"No multipole force fields allowed in TB QM/MM")
462 IF (do_ipol /=
do_fist_pol_none) cpabort(
"No polarizable force fields allowed in TB QM/MM")
464 SELECT CASE (ewald_type)
466 cpabort(
"PME Ewald type not implemented for TB/QMMM")
468 DO ipot = 1,
SIZE(qmmm_env%Potentials)
469 pot => qmmm_env%Potentials(ipot)%Pot
470 nmm =
SIZE(pot%mm_atom_index)
474 ALLOCATE (charges_mm(nmm))
476 imm = pot%mm_atom_index(imp)
477 indmm = qmmm_env%mm_atom_index(imm)
478 atoms_mm(imp)%r = particles_mm(indmm)%r
479 atoms_mm(imp)%atomic_kind => particles_mm(indmm)%atomic_kind
480 charges_mm(imp) = qmmm_env%mm_atom_chrg(imm)
483 cpabort(
"Ewald not implemented for TB/QMMM")
486 CALL spme_potential(ewald_env, ewald_pw, mm_cell, atoms_mm, charges_mm, particles_qm, qpot)
489 DEALLOCATE (charges_mm)
491 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
492 DO ipot = 1,
SIZE(qmmm_env%added_charges%Potentials)
493 pot => qmmm_env%added_charges%Potentials(ipot)%Pot
494 nmm =
SIZE(pot%mm_atom_index)
498 ALLOCATE (charges_mm(nmm))
500 imm = pot%mm_atom_index(imp)
501 indmm = qmmm_env%added_charges%mm_atom_index(imm)
502 atoms_mm(imp)%r = qmmm_env%added_charges%added_particles(indmm)%r
503 atoms_mm(imp)%atomic_kind => qmmm_env%added_charges%added_particles(indmm)%atomic_kind
504 charges_mm(imp) = qmmm_env%added_charges%mm_atom_chrg(imm)
507 cpabort(
"Ewald not implemented for TB/QMMM")
510 CALL spme_potential(ewald_env, ewald_pw, mm_cell, atoms_mm, charges_mm, particles_qm, qpot)
513 DEALLOCATE (charges_mm)
516 CALL para_env%sum(qpot)
521 rcutoff(2) = 0.025_dp*rcutoff(1)
522 rcutoff(1) = 2.0_dp*rcutoff(1)
523 nkind =
SIZE(atomic_kind_set)
528 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
530 defined=defined, eta=eta_a, natorb=natorb)
532 IF (.NOT. dftb_control%self_consistent) eta_a(0) =
eta_mm
533 IF (.NOT. defined .OR. natorb < 1) cycle
534 ELSE IF (do_xtb)
THEN
536 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
542 CALL build_mm_pot(qpot(iatom), short_range_pot_type, eta_a(0), &
543 qmmm_env%Potentials, particles_mm, &
544 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, mm_cell, iatom, rcutoff, &
547 qmmm_env%Potentials, particles_mm, &
548 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, mm_cell, iatom, rcutoff, &
551 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
552 CALL build_mm_pot(qpot(iatom), short_range_pot_type, eta_a(0), &
553 qmmm_env%added_charges%potentials, &
554 qmmm_env%added_charges%added_particles, &
555 qmmm_env%added_charges%mm_atom_chrg, &
556 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, rcutoff, &
559 qmmm_env%added_charges%potentials, &
560 qmmm_env%added_charges%added_particles, &
561 qmmm_env%added_charges%mm_atom_chrg, &
562 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, rcutoff, &
565 pc_ener = pc_ener + qpot(iatom)*zeff
570 nkind =
SIZE(atomic_kind_set)
575 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
577 defined=defined, eta=eta_a, natorb=natorb)
579 IF (.NOT. dftb_control%self_consistent) eta_a(0) =
eta_mm
580 IF (.NOT. defined .OR. natorb < 1) cycle
581 ELSE IF (do_xtb)
THEN
583 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
589 CALL build_mm_pot(qpot(iatom), nonperiodic_pot_type, eta_a(0), &
590 qmmm_env%Potentials, particles_mm, &
591 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, mm_cell, iatom, &
592 qmmm_env%spherical_cutoff, particles_qm)
594 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
595 CALL build_mm_pot(qpot(iatom), nonperiodic_pot_type, eta_a(0), &
596 qmmm_env%added_charges%potentials, &
597 qmmm_env%added_charges%added_particles, &
598 qmmm_env%added_charges%mm_atom_chrg, &
599 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
600 qmmm_env%spherical_cutoff, &
603 pc_ener = pc_ener + qpot(iatom)*zeff
607 cpabort(
"Unknown Ewald type!")
611 CALL get_qs_env(qs_env=qs_env, ks_qmmm_env=ks_qmmm_env_loc)
612 matrix_h => ks_qmmm_env_loc%matrix_h
614 ALLOCATE (matrix_h(1)%matrix)
615 CALL dbcsr_copy(matrix_h(1)%matrix, matrix_s(1)%matrix, &
616 name=
"QMMM HAMILTONIAN MATRIX")
617 CALL dbcsr_set(matrix_h(1)%matrix, 0.0_dp)
624 row=iatom, col=jatom, block=hblock, found=found)
626 hblock = hblock - 0.5_dp*sblock*(qpot(iatom) + qpot(jatom))
630 ks_qmmm_env_loc%matrix_h => matrix_h
631 ks_qmmm_env_loc%pc_ener = pc_ener
637 DEALLOCATE (ewald_env)
639 DEALLOCATE (ewald_pw)
643 CALL timestop(handle)
645 END SUBROUTINE build_tb_qmmm_matrix_smeared
660 calc_force, Forces, Forces_added_charges)
667 LOGICAL,
INTENT(in),
OPTIONAL :: calc_force
668 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: forces, forces_added_charges
670 CHARACTER(len=*),
PARAMETER :: routinen =
'deriv_tb_qmmm_matrix'
672 INTEGER :: atom_a, handle, i, iatom, ikind, iqm, &
673 jatom, natom, natorb, nkind, nspins, &
675 INTEGER,
DIMENSION(:),
POINTER ::
list
676 LOGICAL :: defined, do_dftb, do_xtb, found
677 REAL(kind=
dp) :: fi, gmij, zeff
678 REAL(kind=
dp),
DIMENSION(0:3) :: eta_a
679 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mcharge, qpot
680 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: charges, dsblock, forces_qm, pblock, &
684 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_p, matrix_s
691 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
698 CALL timeset(routinen, handle)
700 NULLIFY (rho, atomic_kind_set, qs_kind_set, particles_qm)
703 atomic_kind_set=atomic_kind_set, &
704 qs_kind_set=qs_kind_set, &
705 ks_qmmm_env=ks_qmmm_env_loc, &
706 dft_control=dft_control, &
707 particle_set=particles_qm, &
708 natom=number_qm_atoms)
709 dftb_control => dft_control%qs_control%dftb_control
710 xtb_control => dft_control%qs_control%xtb_control
712 IF (dft_control%qs_control%dftb)
THEN
715 ELSE IF (dft_control%qs_control%xtb)
THEN
719 cpabort(
"TB method unknown")
725 ELSE IF (do_xtb)
THEN
726 CALL get_qs_env(qs_env=qs_env, ks_env=ks_env, sab_orb=sab_nl)
728 basis_type_a=
'ORB', basis_type_b=
'ORB', sab_nl=sab_nl)
733 nspins = dft_control%nspins
734 nkind =
SIZE(atomic_kind_set)
736 ALLOCATE (charges(number_qm_atoms, nspins))
740 ALLOCATE (mcharge(number_qm_atoms))
744 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
746 ELSE IF (do_xtb)
THEN
747 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
751 atom_a = atomic_kind_set(ikind)%atom_list(iatom)
752 mcharge(atom_a) = zeff - sum(charges(atom_a, 1:nspins))
757 ALLOCATE (qpot(number_qm_atoms))
759 ALLOCATE (forces_qm(3, number_qm_atoms))
768 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
770 defined=defined, eta=eta_a, natorb=natorb)
772 IF (.NOT. dftb_control%self_consistent) eta_a(0) =
eta_mm
773 IF (.NOT. defined .OR. natorb < 1) cycle
774 ELSE IF (do_xtb)
THEN
781 qmmm_env%Potentials, particles_mm, &
782 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, mm_cell, iatom, &
783 qmmm_env%spherical_cutoff, particles_qm)
785 qmmm_env%Potentials, particles_mm, &
786 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
787 mm_cell, iatom, forces, forces_qm(:, iqm), &
788 qmmm_env%spherical_cutoff, particles_qm)
790 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
792 qmmm_env%added_charges%potentials, &
793 qmmm_env%added_charges%added_particles, &
794 qmmm_env%added_charges%mm_atom_chrg, &
795 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
796 qmmm_env%spherical_cutoff, &
799 qmmm_env%added_charges%potentials, &
800 qmmm_env%added_charges%added_particles, &
801 qmmm_env%added_charges%mm_atom_chrg, &
802 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
803 forces_added_charges, &
804 forces_qm(:, iqm), qmmm_env%spherical_cutoff, particles_qm)
815 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
817 IF (.NOT. defined .OR. natorb < 1) cycle
818 ELSE IF (do_xtb)
THEN
823 iatom = qmmm_env%qm_atom_index(
list(i))
824 particles_mm(iatom)%f(:) = particles_mm(iatom)%f(:) + forces_qm(:, iqm)
830 IF (
SIZE(matrix_p) == 2)
THEN
831 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
832 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
839 IF (iatom == jatom) cycle
841 gmij = -0.5_dp*(qpot(iatom) + qpot(jatom))
844 row=iatom, col=jatom, block=pblock, found=found)
849 row=iatom, col=jatom, block=dsblock, found=found)
851 fi = -2.0_dp*gmij*sum(pblock*dsblock)
852 forces_qm(i, iatom) = forces_qm(i, iatom) + fi
853 forces_qm(i, jatom) = forces_qm(i, jatom) - fi
858 IF (
SIZE(matrix_p) == 2)
THEN
859 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
860 alpha_scalar=1.0_dp, beta_scalar=-1.0_dp)
864 CALL para_env%sum(forces_qm)
869 iatom = qmmm_env%qm_atom_index(iqm)
870 particles_mm(iatom)%f(:) = particles_mm(iatom)%f(:) + forces_qm(:, iqm)
878 DEALLOCATE (forces_qm)
884 CALL timestop(handle)
901 calc_force, Forces, Forces_added_charges)
908 LOGICAL,
INTENT(IN),
OPTIONAL :: calc_force
909 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: forces, forces_added_charges
911 CALL deriv_tb_qmmm_matrix_smeared(qs_env, qmmm_env, particles_mm, mm_cell, para_env, &
912 calc_force, forces, forces_added_charges,
gaussian=.false.)
928 calc_force, Forces, Forces_added_charges)
935 LOGICAL,
INTENT(IN),
OPTIONAL :: calc_force
936 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: forces, forces_added_charges
938 CALL deriv_tb_qmmm_matrix_smeared(qs_env, qmmm_env, particles_mm, mm_cell, para_env, &
939 calc_force, forces, forces_added_charges,
gaussian=.true.)
955 SUBROUTINE deriv_tb_qmmm_matrix_smeared(qs_env, qmmm_env, particles_mm, mm_cell, para_env, &
956 calc_force, Forces, Forces_added_charges, gaussian)
963 LOGICAL,
INTENT(in),
OPTIONAL :: calc_force
964 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: forces, forces_added_charges
967 CHARACTER(len=*),
PARAMETER :: routinen =
'deriv_tb_qmmm_matrix_smeared'
969 INTEGER :: atom_a, do_ipol, ewald_type, handle, i, iatom, ikind, imm, imp, indmm, ipot, iqm, &
970 jatom, natom, natorb, nkind, nmm, nonperiodic_pot_type, nspins, number_qm_atoms, &
972 INTEGER,
DIMENSION(:),
POINTER ::
list
973 LOGICAL :: defined, do_dftb, do_multipoles, do_xtb, &
975 REAL(kind=
dp) :: alpha, fi, gmij, zeff
976 REAL(kind=
dp),
DIMENSION(0:3) :: eta_a
977 REAL(kind=
dp),
DIMENSION(2) :: rcutoff
978 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charges_mm, mcharge, qpot
979 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: charges, dsblock, forces_mm, forces_qm, &
983 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_p, matrix_s
990 TYPE(
particle_type),
DIMENSION(:),
POINTER :: atoms_mm, particles_qm
993 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1002 CALL timeset(routinen, handle)
1010 IF (calc_force)
THEN
1011 NULLIFY (rho, atomic_kind_set, qs_kind_set, particles_qm)
1014 atomic_kind_set=atomic_kind_set, &
1015 qs_kind_set=qs_kind_set, &
1016 ks_qmmm_env=ks_qmmm_env_loc, &
1017 dft_control=dft_control, &
1018 particle_set=particles_qm, &
1019 natom=number_qm_atoms)
1020 dftb_control => dft_control%qs_control%dftb_control
1021 xtb_control => dft_control%qs_control%xtb_control
1023 IF (dft_control%qs_control%dftb)
THEN
1026 ELSE IF (dft_control%qs_control%xtb)
THEN
1030 cpabort(
"TB method unknown")
1036 ELSE IF (do_xtb)
THEN
1037 CALL get_qs_env(qs_env=qs_env, ks_env=ks_env, sab_orb=sab_nl)
1039 basis_type_a=
'ORB', basis_type_b=
'ORB', sab_nl=sab_nl)
1043 nspins = dft_control%nspins
1044 nkind =
SIZE(atomic_kind_set)
1046 ALLOCATE (charges(number_qm_atoms, nspins))
1050 ALLOCATE (mcharge(number_qm_atoms))
1054 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
1056 ELSE IF (do_xtb)
THEN
1057 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
1061 atom_a = atomic_kind_set(ikind)%atom_list(iatom)
1062 mcharge(atom_a) = zeff - sum(charges(atom_a, 1:nspins))
1065 DEALLOCATE (charges)
1067 ALLOCATE (qpot(number_qm_atoms))
1069 ALLOCATE (forces_qm(3, number_qm_atoms))
1074 ALLOCATE (ewald_env)
1076 CALL ewald_env_set(ewald_env, poisson_section=poisson_section)
1081 CALL ewald_pw_create(ewald_pw, ewald_env, mm_cell, mm_cell, print_section=print_section)
1083 CALL ewald_env_get(ewald_env, ewald_type=ewald_type, do_multipoles=do_multipoles, do_ipol=do_ipol)
1084 IF (do_multipoles) cpabort(
"No multipole force fields allowed in DFTB QM/MM")
1085 IF (do_ipol /=
do_fist_pol_none) cpabort(
"No polarizable force fields allowed in DFTB QM/MM")
1087 SELECT CASE (ewald_type)
1089 cpabort(
"PME Ewald type not implemented for DFTB/QMMM")
1091 DO ipot = 1,
SIZE(qmmm_env%Potentials)
1092 pot => qmmm_env%Potentials(ipot)%Pot
1093 nmm =
SIZE(pot%mm_atom_index)
1097 ALLOCATE (charges_mm(nmm))
1099 imm = pot%mm_atom_index(imp)
1100 indmm = qmmm_env%mm_atom_index(imm)
1101 atoms_mm(imp)%r = particles_mm(indmm)%r
1102 atoms_mm(imp)%atomic_kind => particles_mm(indmm)%atomic_kind
1103 charges_mm(imp) = qmmm_env%mm_atom_chrg(imm)
1106 ALLOCATE (forces_mm(3, nmm))
1109 cpabort(
"Ewald not implemented for DFTB/QMMM")
1112 CALL spme_potential(ewald_env, ewald_pw, mm_cell, atoms_mm, charges_mm, &
1115 CALL spme_forces(ewald_env, ewald_pw, mm_cell, atoms_mm, charges_mm, &
1116 particles_qm, mcharge, forces_qm)
1118 CALL spme_forces(ewald_env, ewald_pw, mm_cell, particles_qm, mcharge, &
1119 atoms_mm, charges_mm, forces_mm)
1122 DEALLOCATE (charges_mm)
1124 CALL para_env%sum(forces_mm)
1126 imm = pot%mm_atom_index(imp)
1127 forces(:, imm) = forces(:, imm) - forces_mm(:, imp)
1129 DEALLOCATE (forces_mm)
1132 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
1133 DO ipot = 1,
SIZE(qmmm_env%added_charges%Potentials)
1134 pot => qmmm_env%added_charges%Potentials(ipot)%Pot
1135 nmm =
SIZE(pot%mm_atom_index)
1139 ALLOCATE (charges_mm(nmm))
1141 imm = pot%mm_atom_index(imp)
1142 indmm = qmmm_env%added_charges%mm_atom_index(imm)
1143 atoms_mm(imp)%r = qmmm_env%added_charges%added_particles(indmm)%r
1144 atoms_mm(imp)%atomic_kind => qmmm_env%added_charges%added_particles(indmm)%atomic_kind
1145 charges_mm(imp) = qmmm_env%added_charges%mm_atom_chrg(imm)
1148 ALLOCATE (forces_mm(3, nmm))
1151 cpabort(
"Ewald not implemented for DFTB/QMMM")
1155 charges_mm, particles_qm, qpot)
1157 CALL spme_forces(ewald_env, ewald_pw, mm_cell, atoms_mm, charges_mm, &
1158 particles_qm, mcharge, forces_qm)
1160 CALL spme_forces(ewald_env, ewald_pw, mm_cell, particles_qm, mcharge, &
1161 atoms_mm, charges_mm, forces_mm)
1165 CALL para_env%sum(forces_mm)
1167 imm = pot%mm_atom_index(imp)
1168 forces_added_charges(:, imm) = forces_added_charges(:, imm) - forces_mm(:, imp)
1170 DEALLOCATE (forces_mm)
1173 CALL para_env%sum(qpot)
1174 CALL para_env%sum(forces_qm)
1179 rcutoff(2) = 0.025_dp*rcutoff(1)
1180 rcutoff(1) = 2.0_dp*rcutoff(1)
1181 nkind =
SIZE(atomic_kind_set)
1187 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
1189 defined=defined, eta=eta_a, natorb=natorb)
1191 IF (.NOT. dftb_control%self_consistent) eta_a(0) =
eta_mm
1192 IF (.NOT. defined .OR. natorb < 1) cycle
1193 ELSE IF (do_xtb)
THEN
1196 DO i = 1,
SIZE(
list)
1199 CALL build_mm_pot(qpot(iatom), short_range_pot_type, eta_a(0), &
1200 qmmm_env%Potentials, particles_mm, &
1201 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
1202 mm_cell, iatom, rcutoff, particles_qm)
1203 CALL build_mm_dpot(mcharge(iatom), short_range_pot_type, eta_a(0), &
1204 qmmm_env%Potentials, particles_mm, &
1205 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
1206 mm_cell, iatom, forces, forces_qm(:, iqm), &
1207 rcutoff, particles_qm)
1209 qmmm_env%Potentials, particles_mm, &
1210 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
1211 mm_cell, iatom, rcutoff, particles_qm)
1213 qmmm_env%Potentials, particles_mm, &
1214 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
1215 mm_cell, iatom, forces, forces_qm(:, iqm), &
1216 rcutoff, particles_qm)
1218 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
1219 CALL build_mm_pot(qpot(iatom), short_range_pot_type, eta_a(0), &
1220 qmmm_env%added_charges%potentials, &
1221 qmmm_env%added_charges%added_particles, &
1222 qmmm_env%added_charges%mm_atom_chrg, &
1223 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, rcutoff, &
1225 CALL build_mm_dpot( &
1226 mcharge(iatom), short_range_pot_type, eta_a(0), &
1227 qmmm_env%added_charges%potentials, &
1228 qmmm_env%added_charges%added_particles, qmmm_env%added_charges%mm_atom_chrg, &
1229 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
1230 forces_added_charges, forces_qm(:, iqm), &
1231 rcutoff, particles_qm)
1233 qmmm_env%added_charges%potentials, &
1234 qmmm_env%added_charges%added_particles, &
1235 qmmm_env%added_charges%mm_atom_chrg, &
1236 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, rcutoff, &
1238 CALL build_mm_dpot( &
1240 qmmm_env%added_charges%potentials, &
1241 qmmm_env%added_charges%added_particles, qmmm_env%added_charges%mm_atom_chrg, &
1242 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
1243 forces_added_charges, forces_qm(:, iqm), &
1244 rcutoff, particles_qm)
1257 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
1259 defined=defined, eta=eta_a, natorb=natorb)
1261 IF (.NOT. dftb_control%self_consistent) eta_a(0) =
eta_mm
1262 IF (.NOT. defined .OR. natorb < 1) cycle
1263 ELSE IF (do_xtb)
THEN
1266 DO i = 1,
SIZE(
list)
1269 CALL build_mm_pot(qpot(iatom), nonperiodic_pot_type, eta_a(0), &
1270 qmmm_env%Potentials, particles_mm, &
1271 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, mm_cell, iatom, &
1272 qmmm_env%spherical_cutoff, particles_qm)
1273 CALL build_mm_dpot(mcharge(iatom), nonperiodic_pot_type, eta_a(0), &
1274 qmmm_env%Potentials, particles_mm, &
1275 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
1276 mm_cell, iatom, forces, forces_qm(:, iqm), &
1277 qmmm_env%spherical_cutoff, particles_qm)
1279 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
1280 CALL build_mm_pot(qpot(iatom), nonperiodic_pot_type, eta_a(0), &
1281 qmmm_env%added_charges%potentials, &
1282 qmmm_env%added_charges%added_particles, &
1283 qmmm_env%added_charges%mm_atom_chrg, &
1284 qmmm_env%added_charges%mm_atom_index, &
1285 mm_cell, iatom, qmmm_env%spherical_cutoff, &
1287 CALL build_mm_dpot(mcharge(iatom), nonperiodic_pot_type, eta_a(0), &
1288 qmmm_env%added_charges%potentials, &
1289 qmmm_env%added_charges%added_particles, &
1290 qmmm_env%added_charges%mm_atom_chrg, &
1291 qmmm_env%added_charges%mm_atom_index, mm_cell, iatom, &
1292 forces_added_charges, &
1293 forces_qm(:, iqm), qmmm_env%spherical_cutoff, particles_qm)
1298 cpabort(
"Unknown Ewald type!")
1307 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
1309 IF (.NOT. defined .OR. natorb < 1) cycle
1310 ELSE IF (do_xtb)
THEN
1313 DO i = 1,
SIZE(
list)
1315 iatom = qmmm_env%qm_atom_index(
list(i))
1316 particles_mm(iatom)%f(:) = particles_mm(iatom)%f(:) + forces_qm(:, iqm)
1322 IF (
SIZE(matrix_p) == 2)
THEN
1323 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
1324 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
1331 IF (iatom == jatom) cycle
1333 gmij = -0.5_dp*(qpot(iatom) + qpot(jatom))
1336 row=iatom, col=jatom, block=pblock, found=found)
1341 row=iatom, col=jatom, block=dsblock, found=found)
1343 fi = -2.0_dp*gmij*sum(pblock*dsblock)
1344 forces_qm(i, iatom) = forces_qm(i, iatom) + fi
1345 forces_qm(i, jatom) = forces_qm(i, jatom) - fi
1350 IF (
SIZE(matrix_p) == 2)
THEN
1351 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
1352 alpha_scalar=1.0_dp, beta_scalar=-1.0_dp)
1356 CALL para_env%sum(forces_qm)
1359 DO i = 1,
SIZE(
list)
1361 iatom = qmmm_env%qm_atom_index(iqm)
1362 particles_mm(iatom)%f(:) = particles_mm(iatom)%f(:) + forces_qm(:, iqm)
1366 DEALLOCATE (mcharge)
1370 DEALLOCATE (forces_qm)
1375 DEALLOCATE (ewald_env)
1377 DEALLOCATE (ewald_pw)
1383 CALL timestop(handle)
1385 END SUBROUTINE deriv_tb_qmmm_matrix_smeared
1401 SUBROUTINE build_mm_pot(qpot, pot_type, qm_alpha, potentials, &
1402 particles_mm, mm_charges, mm_atom_index, mm_cell, IndQM, &
1403 qmmm_spherical_cutoff, particles_qm)
1405 REAL(kind=
dp),
INTENT(INOUT) :: qpot
1406 INTEGER,
INTENT(IN) :: pot_type
1407 REAL(kind=
dp),
INTENT(IN) :: qm_alpha
1410 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mm_charges
1411 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index
1413 INTEGER,
INTENT(IN) :: indqm
1414 REAL(kind=
dp),
INTENT(IN) :: qmmm_spherical_cutoff(2)
1417 CHARACTER(len=*),
PARAMETER :: routinen =
'build_mm_pot'
1418 REAL(kind=
dp),
PARAMETER :: qsmall = 1.0e-15_dp
1420 INTEGER :: handle, imm, imp, indmm, ipot
1421 REAL(kind=
dp) :: dr, qeff, rt1, rt2, rt3, &
1423 REAL(kind=
dp),
DIMENSION(3) :: r_pbc, rij
1426 CALL timeset(routinen, handle)
1429 mainlooppot:
DO ipot = 1,
SIZE(potentials)
1430 pot => potentials(ipot)%Pot
1432 loopmm:
DO imp = 1,
SIZE(pot%mm_atom_index)
1433 imm = pot%mm_atom_index(imp)
1434 indmm = mm_atom_index(imm)
1435 r_pbc =
pbc(particles_mm(indmm)%r - particles_qm(indqm)%r, mm_cell)
1439 rij = [rt1, rt2, rt3]
1440 dr = sqrt(sum(rij**2))
1441 qeff = mm_charges(imm)
1443 IF (qmmm_spherical_cutoff(1) > 0.0_dp)
THEN
1445 qeff = qeff*sph_chrg_factor
1447 IF (abs(qeff) <= qsmall) cycle loopmm
1448 IF (dr >
rtiny)
THEN
1451 qpot = qpot + qeff*(1.0_dp/dr - sr)
1454 qpot = qpot - qeff*sr
1456 sr = erfc(qm_alpha*dr)/dr
1457 qpot = qpot + qeff*sr
1459 sr = erf(dr/pot%Rc)/dr
1460 qpot = qpot + qeff*sr
1462 sr = erfc(dr/pot%Rc)/dr
1463 qpot = qpot - qeff*sr
1465 cpabort(
"Unknown pot_type for dr > rtiny")
1468 qpot = qpot + qeff*2.0_dp/(
rootpi*pot%Rc)
1472 CALL timestop(handle)
1473 END SUBROUTINE build_mm_pot
1491 SUBROUTINE build_mm_dpot(qcharge, pot_type, qm_alpha, potentials, &
1492 particles_mm, mm_charges, mm_atom_index, mm_cell, IndQM, &
1493 forces, forces_qm, qmmm_spherical_cutoff, particles_qm)
1495 REAL(kind=
dp),
INTENT(IN) :: qcharge
1496 INTEGER,
INTENT(IN) :: pot_type
1497 REAL(kind=
dp),
INTENT(IN) :: qm_alpha
1500 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mm_charges
1501 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index
1503 INTEGER,
INTENT(IN) :: indqm
1504 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: forces
1505 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: forces_qm
1506 REAL(kind=
dp),
INTENT(IN) :: qmmm_spherical_cutoff(2)
1509 CHARACTER(len=*),
PARAMETER :: routinen =
'build_mm_dpot'
1510 REAL(kind=
dp),
PARAMETER :: qsmall = 1.0e-15_dp
1512 INTEGER :: handle, imm, imp, indmm, ipot
1513 REAL(kind=
dp) :: dr, drm, drp, dsr, fsr, qeff, rt1, rt2, &
1514 rt3, sph_chrg_factor
1515 REAL(kind=
dp),
DIMENSION(3) :: force_ab, r_pbc, rij
1518 CALL timeset(routinen, handle)
1521 mainlooppot:
DO ipot = 1,
SIZE(potentials)
1522 pot => potentials(ipot)%Pot
1524 loopmm:
DO imp = 1,
SIZE(pot%mm_atom_index)
1525 imm = pot%mm_atom_index(imp)
1526 indmm = mm_atom_index(imm)
1527 r_pbc =
pbc(particles_mm(indmm)%r - particles_qm(indqm)%r, mm_cell)
1531 rij = [rt1, rt2, rt3]
1532 dr = sqrt(sum(rij**2))
1533 qeff = mm_charges(imm)
1536 IF (qmmm_spherical_cutoff(1) > 0.0_dp)
THEN
1538 qeff = qeff*sph_chrg_factor
1540 IF (abs(qeff) <= qsmall) cycle loopmm
1541 IF (dr >
rtiny)
THEN
1547 fsr = qeff*qcharge*(-1.0_dp/(dr*dr) - dsr)
1551 fsr = -qeff*qcharge*dsr
1553 dsr = 0.5_dp*(erfc(qm_alpha*drp)/drp - erfc(qm_alpha*drm)/drm)/
ddrmm
1554 fsr = qeff*qcharge*dsr
1556 fsr = qeff*qcharge*(2.0_dp*exp(-(dr/pot%Rc)**2)/(
rootpi*pot%Rc*dr) - &
1557 erf(dr/pot%Rc)/dr**2)
1559 fsr = qeff*qcharge*(2.0_dp*exp(-(dr/pot%Rc)**2)/(
rootpi*pot%Rc*dr) + &
1560 erfc(dr/pot%Rc)/dr**2)
1562 cpabort(
"Unknown pot_type for dr > rtiny")
1564 force_ab = -fsr*rij/dr
1569 forces_qm(:) = forces_qm(:) - force_ab
1571 forces(:, imm) = forces(:, imm) - force_ab
1575 CALL timestop(handle)
1577 END SUBROUTINE build_mm_dpot
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
DBCSR operations in CP2K.
subroutine, public ewald_env_set(ewald_env, ewald_type, alpha, epsilon, eps_pol, gmax, ns_max, precs, o_spline, para_env, poisson_section, interaction_cutoffs, cell_hmat)
Purpose: Set the EWALD environment.
subroutine, public ewald_env_create(ewald_env, para_env)
allocates and intitializes a ewald_env
subroutine, public read_ewald_section(ewald_env, ewald_section)
Purpose: read the EWALD section.
subroutine, public ewald_env_release(ewald_env)
releases the given ewald_env (see doc/ReferenceCounting.html)
subroutine, public ewald_env_get(ewald_env, ewald_type, alpha, eps_pol, epsilon, gmax, ns_max, o_spline, group, para_env, poisson_section, precs, rcut, do_multipoles, max_multipole, do_ipol, max_ipol_iter, interaction_cutoffs, cell_hmat)
Purpose: Get the EWALD environment.
subroutine, public ewald_pw_release(ewald_pw)
releases the memory used by the ewald_pw
subroutine, public ewald_pw_create(ewald_pw, ewald_env, cell, cell_ref, print_section)
creates the structure ewald_pw_type
Defines the basic variable types.
integer, parameter, public dp
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition of mathematical constants and functions.
real(kind=dp), parameter, public rootpi
Interface to the message passing library MPI.
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii} ]
Define the data structure for the particle information.
subroutine, public deallocate_particle_set(particle_set)
Deallocate a particle set.
subroutine, public allocate_particle_set(particle_set, nparticle)
Allocate a particle set.
functions related to the poisson solver on regular grids
integer, parameter, public do_ewald_pme
integer, parameter, public do_ewald_ewald
integer, parameter, public do_ewald_none
integer, parameter, public do_ewald_spme
TB methods used with QMMM.
integer, parameter pot_ewald_short_range
integer, parameter pot_tb_nonperiodic
subroutine, public deriv_tb_qmmm_matrix_gauss(qs_env, qmmm_env, particles_mm, mm_cell, para_env, calc_force, forces, forces_added_charges)
Constructs tight-binding QM/MM derivatives for Gaussian MM charges.
subroutine, public build_tb_qmmm_matrix_gauss(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the tight-binding QM/MM Hamiltonian for Gaussian MM charges.
integer, parameter pot_tb_short_range
integer, parameter pot_gauss_nonperiodic
subroutine, public build_tb_qmmm_matrix_zero(qs_env, para_env)
Constructs an empty 1-el DFTB hamiltonian.
subroutine, public build_tb_qmmm_matrix_pc(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the 1-el DFTB hamiltonian.
subroutine, public build_tb_qmmm_matrix(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the 1-el DFTB hamiltonian.
integer, parameter pot_gauss_short_range
real(dp), parameter rtiny
subroutine, public deriv_tb_qmmm_matrix(qs_env, qmmm_env, particles_mm, mm_cell, para_env, calc_force, forces, forces_added_charges)
Constructs the derivative w.r.t. 1-el DFTB hamiltonian QMMM terms.
real(dp), parameter eta_mm
subroutine, public deriv_tb_qmmm_matrix_pc(qs_env, qmmm_env, particles_mm, mm_cell, para_env, calc_force, forces, forces_added_charges)
Constructs the derivative w.r.t. 1-el DFTB hamiltonian QMMM terms.
real(dp), parameter ddrmm
subroutine, public spherical_cutoff_factor(spherical_cutoff, rij, factor)
Computes a spherical cutoff factor for the QMMM interactions.
Calculation of Coulomb contributions in DFTB.
real(dp) function, public gamma_rab_sr(r, ga, gb, hb_para)
Computes the short-range gamma parameter from exact Coulomb interaction of normalized exp(-a*r) charg...
Calculation of Overlap and Hamiltonian matrices in DFTB.
subroutine, public build_dftb_overlap(qs_env, nderivative, matrix_s)
...
Definition of the DFTB parameter types.
Working with the DFTB parameter types.
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
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, matrix_vhxc, 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.
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.
Define the neighbor list data types and the corresponding functionality.
Generate the atomic neighbor lists.
subroutine, public build_qs_neighbor_lists(qs_env, para_env, molecular, force_env_section)
Build all the required neighbor lists for Quickstep.
Calculation of overlap matrix, its derivatives and forces.
subroutine, public build_overlap_matrix(ks_env, matrix_s, matrixkp_s, matrix_name, nderivative, basis_type_a, basis_type_b, sab_nl, calculate_forces, matrix_p, matrixkp_p, ext_kpoints)
Calculation of the overlap matrix over Cartesian Gaussian functions.
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
Calculate the electrostatic energy by the Smooth Particle Ewald method.
subroutine, public spme_forces(ewald_env, ewald_pw, box, particle_set_a, charges_a, particle_set_b, charges_b, forces_b)
Calculate the forces on particles B for the electrostatic interaction betrween particles A and B.
subroutine, public spme_potential(ewald_env, ewald_pw, box, particle_set_a, charges_a, particle_set_b, potential)
Calculate the electrostatic potential from particles A (charge A) at positions of particles B.
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, wall, hen, zeta, xi, kappa0, alpg, occupation, ngauss, electronegativity, chmax, en, kqat2, kcn, kq)
...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
to build arrays of pointers
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
calculation environment to calculate the ks_qmmm matrix, holds the QM/MM potential and all the needed...
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.