65#include "./base/base_uses.f90"
70 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: coord => null()
71 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rab => null()
72 INTEGER,
DIMENSION(:),
POINTER :: katom => null()
77 CHARACTER(len=*),
PARAMETER,
PRIVATE :: modulen =
'xtb_potentials'
95 REAL(
dp),
INTENT(INOUT) :: erep
96 REAL(
dp),
INTENT(IN) :: kf, enscale
97 LOGICAL,
INTENT(IN) :: calculate_forces
99 CHARACTER(len=*),
PARAMETER :: routinen =
'repulsive_potential'
101 INTEGER :: atom_a, atom_b, handle, iatom, ikind, &
103 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind
104 INTEGER,
DIMENSION(3) :: cell
105 LOGICAL :: defined, use_virial
106 REAL(kind=
dp) :: alphaa, alphab, den2, den4, derepij, dr, &
107 ena, enb, ens, erepij, f1, sal, &
109 REAL(kind=
dp),
DIMENSION(3) :: force_rr, rij
113 DIMENSION(:),
POINTER :: nl_iterator
115 POINTER :: sab_xtb_pp
117 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
121 CALL timeset(routinen, handle)
126 atomic_kind_set=atomic_kind_set, &
127 qs_kind_set=qs_kind_set, &
129 sab_xtb_pp=sab_xtb_pp)
132 IF (calculate_forces)
THEN
133 CALL get_qs_env(qs_env=qs_env, virial=virial, force=force)
134 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
140 iatom=iatom, jatom=jatom, r=rij, cell=cell)
141 CALL get_qs_kind(qs_kind_set(ikind), zatom=za, xtb_parameter=xtb_atom_a)
143 IF (.NOT. defined) cycle
144 CALL get_qs_kind(qs_kind_set(jkind), zatom=zb, xtb_parameter=xtb_atom_b)
146 IF (.NOT. defined) cycle
148 dr = sqrt(sum(rij(:)**2))
150 IF (dr > 0.001_dp)
THEN
157 den2 = (ena - enb)**2
159 sal = sqrt(alphaa*alphab)
160 ens = 1.0_dp + (0.01_dp*den2 + 0.01_dp*den4)*enscale
162 erepij = zneffa*zneffb/dr*exp(-ens*sal*dr**kf)
164 IF (atprop%energy)
THEN
165 atprop%atecc(iatom) = atprop%atecc(iatom) + 0.5_dp*erepij
166 atprop%atecc(jatom) = atprop%atecc(jatom) + 0.5_dp*erepij
168 IF (calculate_forces .AND. (iatom /= jatom .OR. dr > 0.001_dp))
THEN
169 derepij = -(1.0_dp/dr + ens*sal*kf*dr**(kf - 1.0_dp))*erepij
170 force_rr(1) = derepij*rij(1)/dr
171 force_rr(2) = derepij*rij(2)/dr
172 force_rr(3) = derepij*rij(3)/dr
173 atom_a = atom_of_kind(iatom)
174 atom_b = atom_of_kind(jatom)
175 force(ikind)%repulsive(:, atom_a) = force(ikind)%repulsive(:, atom_a) - force_rr(:)
176 force(jkind)%repulsive(:, atom_b) = force(jkind)%repulsive(:, atom_b) + force_rr(:)
179 IF (iatom == jatom) f1 = 0.5_dp
188 CALL timestop(handle)
201 SUBROUTINE srb_potential(qs_env, esrb, calculate_forces, xtb_control, cnumbers, dcnum)
203 REAL(
dp),
INTENT(INOUT) :: esrb
204 LOGICAL,
INTENT(IN) :: calculate_forces
206 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: cnumbers
207 TYPE(
dcnum_type),
DIMENSION(:),
INTENT(IN) :: dcnum
209 CHARACTER(len=*),
PARAMETER :: routinen =
'srb_potential'
210 REAL(kind=
dp),
DIMENSION(5:9),
PARAMETER :: &
211 cnfac = (/0.05646607_dp, 0.10514203_dp, 0.09753494_dp, 0.30470380_dp, 0.23261783_dp/), &
212 ensrb = (/2.20568300_dp, 2.49640820_dp, 2.81007174_dp, 4.51078438_dp, 4.67476223_dp/), &
213 r0srb = (/1.35974851_dp, 0.98310699_dp, 0.98423007_dp, 0.76716063_dp, 1.06139799_dp/)
215 INTEGER :: atom_a, atom_b, atom_c, handle, i, &
216 iatom, ikind, jatom, jkind, katom, &
218 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
219 INTEGER,
DIMENSION(3) :: cell
220 LOGICAL :: defined, use_virial
221 REAL(kind=
dp) :: c1srb, c2srb, den1, den2, desrbij, dr, &
222 dr0, drk, enta, entb, esrbij, etasrb, &
223 f1, fhua, fhub, gscal, ksrb, rra0, &
225 REAL(kind=
dp),
DIMENSION(3) :: fdik, force_rr, rij, rik
229 DIMENSION(:),
POINTER :: nl_iterator
231 POINTER :: sab_xtb_pp
233 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
237 CALL timeset(routinen, handle)
242 atomic_kind_set=atomic_kind_set, &
243 qs_kind_set=qs_kind_set, &
245 sab_xtb_pp=sab_xtb_pp)
249 IF (calculate_forces)
THEN
250 CALL get_qs_env(qs_env=qs_env, virial=virial, force=force)
251 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
255 ksrb = xtb_control%ksrb
256 etasrb = xtb_control%esrb
257 c1srb = xtb_control%c1srb*0.01_dp
258 c2srb = xtb_control%c2srb*0.01_dp
259 gscal = xtb_control%gscal
260 shift = xtb_control%shift
265 iatom=iatom, jatom=jatom, r=rij, cell=cell)
266 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
268 IF (.NOT. defined) cycle
269 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
271 IF (.NOT. defined) cycle
273 dr = sqrt(sum(rij(:)**2))
275 IF (dr > 0.001_dp)
THEN
276 IF (za >= 5 .AND. za <= 9 .AND. zb >= 5 .AND. zb <= 9 .AND. za /= zb)
THEN
277 rra0 = r0srb(za) + cnfac(za)*cnumbers(iatom) + shift
278 rrb0 = r0srb(zb) + cnfac(zb)*cnumbers(jatom) + shift
279 den1 = abs(ensrb(za) - ensrb(zb))
280 dr0 = (rra0 + rrb0)*(1._dp - c1srb*den1 - c2srb*den1*den1)
281 den2 = (enta - entb)**2
282 esrbij = ksrb*exp(-etasrb*(1._dp + gscal*den2)*(dr - dr0)**2)
284 IF (atprop%energy)
THEN
285 atprop%atecc(iatom) = atprop%atecc(iatom) + 0.5_dp*esrbij
286 atprop%atecc(jatom) = atprop%atecc(jatom) + 0.5_dp*esrbij
288 IF (calculate_forces)
THEN
289 desrbij = 2.0_dp*esrbij*(-etasrb*(1._dp + gscal*den2)*(dr - dr0))
290 force_rr(1) = desrbij*rij(1)/dr
291 force_rr(2) = desrbij*rij(2)/dr
292 force_rr(3) = desrbij*rij(3)/dr
293 atom_a = atom_of_kind(iatom)
294 atom_b = atom_of_kind(jatom)
295 force(ikind)%repulsive(:, atom_a) = force(ikind)%repulsive(:, atom_a) - force_rr(:)
296 force(jkind)%repulsive(:, atom_b) = force(jkind)%repulsive(:, atom_b) + force_rr(:)
299 IF (iatom == jatom) f1 = 0.5_dp
304 fhua = -desrbij*cnfac(za)*(1._dp - c1srb*den1 - c2srb*den1*den1)
305 DO i = 1, dcnum(iatom)%neighbors
306 katom = dcnum(iatom)%nlist(i)
307 kkind = kind_of(katom)
308 atom_c = atom_of_kind(katom)
309 rik = dcnum(iatom)%rik(:, i)
310 drk = sqrt(sum(rik(:)**2))
311 IF (drk > 1.e-3_dp)
THEN
312 fdik(:) = fhua*dcnum(iatom)%dvals(i)*rik(:)/drk
313 force(ikind)%repulsive(:, atom_a) = force(ikind)%repulsive(:, atom_a) - fdik(:)
314 force(kkind)%repulsive(:, atom_c) = force(kkind)%repulsive(:, atom_c) + fdik(:)
321 fhub = -desrbij*cnfac(zb)*(1._dp - c1srb*den1 - c2srb*den1*den1)
322 DO i = 1, dcnum(jatom)%neighbors
323 katom = dcnum(jatom)%nlist(i)
324 kkind = kind_of(katom)
325 atom_c = atom_of_kind(katom)
326 rik = dcnum(jatom)%rik(:, i)
327 drk = sqrt(sum(rik(:)**2))
328 IF (drk > 1.e-3_dp)
THEN
329 fdik(:) = fhub*dcnum(jatom)%dvals(i)*rik(:)/drk
330 force(jkind)%repulsive(:, atom_b) = force(jkind)%repulsive(:, atom_b) - fdik(:)
331 force(kkind)%repulsive(:, atom_c) = force(kkind)%repulsive(:, atom_c) + fdik(:)
344 CALL timestop(handle)
356 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
357 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: ppradius
358 REAL(kind=
dp),
INTENT(IN) :: eps_pair, kfparam
360 INTEGER :: ikind, ir, jkind, nkind
361 LOGICAL :: defa, defb
362 REAL(kind=
dp) :: alphaa, alphab, erep, rab, rab0, rcova, &
363 rcovb, saa, zneffa, zneffb
367 nkind =
SIZE(ppradius, 1)
369 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
370 CALL get_xtb_atom_param(xtb_atom_a, rcov=rcova, alpha=alphaa, zneff=zneffa, defined=defa)
371 IF (.NOT. defa) cycle
372 DO jkind = ikind, nkind
373 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
374 CALL get_xtb_atom_param(xtb_atom_b, rcov=rcovb, alpha=alphab, zneff=zneffb, defined=defb)
375 IF (.NOT. defb) cycle
379 saa = sqrt(alphaa*alphab)
380 erep = zneffa*zneffb/rab*exp(-saa*rab**kfparam)
381 IF (erep < eps_pair)
EXIT
384 rab = max(rab, rab0 + 2.0_dp)
385 ppradius(ikind, jkind) = rab
386 ppradius(jkind, ikind) = ppradius(ikind, jkind)
401 REAL(kind=
dp),
INTENT(INOUT) :: exb
402 LOGICAL,
INTENT(IN) :: calculate_forces
404 CHARACTER(LEN=*),
PARAMETER :: routinen =
'xb_interaction'
406 INTEGER :: atom_a, atom_b, handle, iatom, ikind, &
407 jatom, jkind, na, natom, nkind, zat
408 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
409 INTEGER,
DIMENSION(3) :: cell
410 LOGICAL :: defined, use_virial
411 REAL(kind=
dp) :: dr, kx2, kxr, rcova, rcovb
412 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: kx
413 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: rcab
414 REAL(kind=
dp),
DIMENSION(3) :: rij
420 DIMENSION(:) :: neighbor_atoms
422 DIMENSION(:),
POINTER :: nl_iterator
424 POINTER :: sab_xb, sab_xtb_pp
427 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
432 CALL timeset(routinen, handle)
435 atomic_kind_set=atomic_kind_set, &
436 qs_kind_set=qs_kind_set, &
439 dft_control=dft_control, &
441 sab_xtb_pp=sab_xtb_pp)
443 nkind =
SIZE(atomic_kind_set)
444 xtb_control => dft_control%qs_control%xtb_control
447 kxr = xtb_control%kxr
448 kx2 = xtb_control%kx2
450 NULLIFY (particle_set)
451 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
452 natom =
SIZE(particle_set)
456 IF (calculate_forces)
THEN
457 CALL get_qs_env(qs_env=qs_env, virial=virial, force=force)
458 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
462 ALLOCATE (neighbor_atoms(nkind))
464 NULLIFY (neighbor_atoms(ikind)%coord)
465 NULLIFY (neighbor_atoms(ikind)%rab)
466 NULLIFY (neighbor_atoms(ikind)%katom)
468 IF (zat == 17 .OR. zat == 35 .OR. zat == 53 .OR. zat == 85)
THEN
469 ALLOCATE (neighbor_atoms(ikind)%coord(3, na))
470 neighbor_atoms(ikind)%coord(1:3, 1:na) = 0.0_dp
471 ALLOCATE (neighbor_atoms(ikind)%rab(na))
472 neighbor_atoms(ikind)%rab(1:na) = huge(0.0_dp)
473 ALLOCATE (neighbor_atoms(ikind)%katom(na))
474 neighbor_atoms(ikind)%katom(1:na) = 0
480 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
484 ALLOCATE (rcab(nkind, nkind))
486 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
489 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
491 rcab(ikind, jkind) = kxr*(rcova + rcovb)
498 iatom=iatom, jatom=jatom, r=rij, cell=cell)
499 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
501 IF (.NOT. defined) cycle
502 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
504 IF (.NOT. defined) cycle
506 dr = sqrt(sum(rij(:)**2))
509 IF (dr > 1.e-3_dp)
THEN
510 IF (
ASSOCIATED(neighbor_atoms(ikind)%rab))
THEN
511 atom_a = atom_of_kind(iatom)
512 IF (dr < neighbor_atoms(ikind)%rab(atom_a))
THEN
513 neighbor_atoms(ikind)%rab(atom_a) = dr
514 neighbor_atoms(ikind)%coord(1:3, atom_a) = rij(1:3)
515 neighbor_atoms(ikind)%katom(atom_a) = jatom
518 IF (
ASSOCIATED(neighbor_atoms(jkind)%rab))
THEN
519 atom_b = atom_of_kind(jatom)
520 IF (dr < neighbor_atoms(jkind)%rab(atom_b))
THEN
521 neighbor_atoms(jkind)%rab(atom_b) = dr
522 neighbor_atoms(jkind)%coord(1:3, atom_b) = -rij(1:3)
523 neighbor_atoms(jkind)%katom(atom_b) = iatom
532 CALL xb_neighbors(neighbor_atoms, para_env)
533 CALL xb_energy(exb, neighbor_atoms, atom_of_kind, kind_of, sab_xb, kx, kx2, rcab, &
534 calculate_forces, use_virial, force, virial, atprop)
537 IF (
ASSOCIATED(neighbor_atoms(ikind)%coord))
THEN
538 DEALLOCATE (neighbor_atoms(ikind)%coord)
540 IF (
ASSOCIATED(neighbor_atoms(ikind)%rab))
THEN
541 DEALLOCATE (neighbor_atoms(ikind)%rab)
543 IF (
ASSOCIATED(neighbor_atoms(ikind)%katom))
THEN
544 DEALLOCATE (neighbor_atoms(ikind)%katom)
547 DEALLOCATE (neighbor_atoms)
548 DEALLOCATE (kx, rcab)
550 CALL timestop(handle)
563 SUBROUTINE xb_neighbors(neighbor_atoms, para_env)
565 INTENT(INOUT) :: neighbor_atoms
568 INTEGER :: iatom, ikind, natom, nkind
569 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: matom
570 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: dmloc
571 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: coord
573 nkind =
SIZE(neighbor_atoms)
575 IF (
ASSOCIATED(neighbor_atoms(ikind)%rab))
THEN
576 natom =
SIZE(neighbor_atoms(ikind)%rab)
577 ALLOCATE (dmloc(2*natom), matom(natom), coord(3, natom))
580 dmloc(2*iatom - 1) = neighbor_atoms(ikind)%rab(iatom)
581 dmloc(2*iatom) = real(para_env%mepos, kind=
dp)
583 CALL para_env%minloc(dmloc)
587 neighbor_atoms(ikind)%rab(iatom) = dmloc(2*iatom - 1)
588 IF (nint(dmloc(2*iatom)) == para_env%mepos)
THEN
589 coord(1:3, iatom) = neighbor_atoms(ikind)%coord(1:3, iatom)
590 matom(iatom) = neighbor_atoms(ikind)%katom(iatom)
593 CALL para_env%sum(coord)
594 neighbor_atoms(ikind)%coord(1:3, :) = coord(1:3, :)
595 CALL para_env%sum(matom)
596 neighbor_atoms(ikind)%katom(:) = matom(:)
597 DEALLOCATE (dmloc, matom, coord)
601 END SUBROUTINE xb_neighbors
622 atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
623 REAL(
dp),
INTENT(INOUT) :: enonbonded
629 INTENT(IN),
POINTER :: sab_xtb_nonbond
631 POINTER :: atomic_kind_set
632 LOGICAL,
INTENT(IN) :: calculate_forces, use_virial
635 INTEGER,
DIMENSION(:),
INTENT(IN) :: atom_of_kind
637 CHARACTER(len=*),
PARAMETER :: routinen =
'nonbonded_correction'
639 CHARACTER(LEN=default_string_length) :: def_error, this_error
640 INTEGER :: atom_i, atom_j, handle, iatom, ikind, &
641 jatom, jkind, kk, ntype
642 INTEGER,
DIMENSION(3) :: cell
644 REAL(kind=
dp) :: dedf, dr, dx, energy_cutoff, err, fval, &
646 REAL(kind=
dp),
DIMENSION(3) :: fij, rij
649 DIMENSION(:),
POINTER :: nl_iterator
655 CALL timeset(routinen, handle)
660 nonbonded => xtb_control%nonbonded
661 do_ewald = xtb_control%do_ewald
662 CALL get_qs_env(qs_env=qs_env, ewald_env=ewald_env)
664 ntype =
SIZE(atomic_kind_set)
667 CALL force_field_pack_nonbond_pot_correction(atomic_kind_set, nonbonded, potparm, ewald_env, do_ewald)
673 energy_cutoff = 0._dp
678 iatom=iatom, jatom=jatom, r=rij, cell=cell)
679 pot => potparm%pot(ikind, jkind)%pot
680 dr = sqrt(rij(1)**2 + rij(2)**2 + rij(3)**2)
681 rcut = sqrt(pot%rcutsq)
682 IF (dr <= rcut .AND. dr > 1.e-3_dp)
THEN
684 IF (ikind == jkind) fval = 0.5_dp
686 enonbonded = enonbonded + fval*
ener_pot(pot, dr, energy_cutoff)
687 IF (atprop%energy)
THEN
688 atprop%atecc(iatom) = atprop%atecc(iatom) + 0.5_dp*fval*
ener_pot(pot, dr, energy_cutoff)
689 atprop%atecc(jatom) = atprop%atecc(jatom) + 0.5_dp*fval*
ener_pot(pot, dr, energy_cutoff)
693 IF (calculate_forces)
THEN
697 CALL cp_warn(__location__,
"Generic potential with type > 1 not implemented.")
701 IF ((pot%set(kk)%rmin /=
not_initialized) .AND. (dr < pot%set(kk)%rmin)) cycle
703 IF ((pot%set(kk)%rmax /=
not_initialized) .AND. (dr >= pot%set(kk)%rmax)) cycle
705 IF (dr <= rcut .AND. dr > 1.e-3_dp)
THEN
707 NULLIFY (nonbonded_section)
712 dedf = fval*
evalfd(pot%set(kk)%gp%myid, 1, pot%set(kk)%gp%values, dx, err)
713 IF (abs(err) > lerr)
THEN
714 WRITE (this_error,
"(A,G12.6,A)")
"(", err,
")"
715 WRITE (def_error,
"(A,G12.6,A)")
"(", lerr,
")"
718 CALL cp_warn(__location__, &
719 'ASSERTION (cond) failed at line '//
cp_to_string(__line__)// &
720 ' Error '//trim(this_error)//
' in computing numerical derivatives larger then'// &
721 trim(def_error)//
' .')
724 atom_i = atom_of_kind(iatom)
725 atom_j = atom_of_kind(jatom)
727 fij(1:3) = dedf*rij(1:3)/pot%set(kk)%gp%values(1)
729 force(ikind)%repulsive(:, atom_i) = force(ikind)%repulsive(:, atom_i) - fij(:)
730 force(jkind)%repulsive(:, atom_j) = force(jkind)%repulsive(:, atom_j) + fij(:)
743 IF (
ASSOCIATED(potparm))
THEN
747 CALL timestop(handle)
759 SUBROUTINE force_field_pack_nonbond_pot_correction(atomic_kind_set, nonbonded, potparm, ewald_env, do_ewald)
763 POINTER :: atomic_kind_set
768 LOGICAL,
INTENT(IN) :: do_ewald
770 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a_local, &
771 name_atm_b, name_atm_b_local
772 INTEGER :: ikind, ingp, iw, jkind
774 REAL(kind=
dp) :: ewald_rcut
779 NULLIFY (pot, logger)
784 DO ikind = 1,
SIZE(atomic_kind_set)
785 atomic_kind => atomic_kind_set(ikind)
787 DO jkind = ikind,
SIZE(atomic_kind_set)
788 atomic_kind => atomic_kind_set(jkind)
791 name_atm_a = name_atm_a_local
792 name_atm_b = name_atm_b_local
795 pot => potparm%pot(ikind, jkind)%pot
796 IF (
ASSOCIATED(nonbonded))
THEN
797 DO ingp = 1,
SIZE(nonbonded%pot)
798 IF ((trim(nonbonded%pot(ingp)%pot%at1) ==
"*") .OR. &
799 (trim(nonbonded%pot(ingp)%pot%at2) ==
"*")) cycle
804 IF ((((name_atm_a) == (nonbonded%pot(ingp)%pot%at1)) .AND. &
805 ((name_atm_b) == (nonbonded%pot(ingp)%pot%at2))) .OR. &
806 (((name_atm_b) == (nonbonded%pot(ingp)%pot%at1)) .AND. &
807 ((name_atm_a) == (nonbonded%pot(ingp)%pot%at2))))
THEN
811 CALL cp_warn(__location__, &
812 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
813 " and "//trim(name_atm_b)//
" OVERWRITING! ")
819 IF (.NOT. found)
THEN
829 pot%rcutsq = max(pot%rcutsq, ewald_rcut*ewald_rcut)
833 END SUBROUTINE force_field_pack_nonbond_pot_correction
855 SUBROUTINE xb_energy(exb, neighbor_atoms, atom_of_kind, kind_of, sab_xb, kx, kx2, rcab, &
856 calculate_forces, use_virial, force, virial, atprop)
857 REAL(
dp),
INTENT(INOUT) :: exb
859 INTENT(IN) :: neighbor_atoms
860 INTEGER,
DIMENSION(:),
INTENT(IN) :: atom_of_kind, kind_of
863 REAL(
dp),
DIMENSION(:),
INTENT(IN) :: kx
864 REAL(
dp),
INTENT(IN) :: kx2
865 REAL(
dp),
DIMENSION(:, :),
INTENT(IN) :: rcab
866 LOGICAL,
INTENT(IN) :: calculate_forces, use_virial
871 INTEGER :: atom_a, atom_b, atom_c, iatom, ikind, &
872 jatom, jkind, katom, kkind
873 INTEGER,
DIMENSION(3) :: cell
874 REAL(kind=
dp) :: alp, aterm, cosa, daterm, ddab, ddax, &
875 ddbx, ddr, ddr12, ddr6, deval, dr, &
876 drab, drax, drbx, eval, xy
877 REAL(kind=
dp),
DIMENSION(3) :: fia, fij, fja, ria, rij, rja
879 DIMENSION(:),
POINTER :: nl_iterator
887 iatom=iatom, jatom=jatom, r=rij, cell=cell)
890 atom_a = atom_of_kind(iatom)
891 katom = neighbor_atoms(ikind)%katom(atom_a)
892 IF (katom == 0) cycle
893 dr = sqrt(rij(1)**2 + rij(2)**2 + rij(3)**2)
894 ddr = rcab(ikind, jkind)/dr
897 eval = kx(ikind)*(ddr12 - kx2*ddr6)/(1.0_dp + ddr12)
899 ria(1:3) = neighbor_atoms(ikind)%coord(1:3, atom_a)
900 rja(1:3) = rij(1:3) - ria(1:3)
901 drax = ria(1)**2 + ria(2)**2 + ria(3)**2
903 drab = rja(1)**2 + rja(2)**2 + rja(3)**2
906 cosa = (drbx + drax - drab)/xy
907 aterm = (0.5_dp - 0.25_dp*cosa)**alp
909 exb = exb + aterm*eval
910 IF (atprop%energy)
THEN
911 atprop%atecc(iatom) = atprop%atecc(iatom) + 0.5_dp*aterm*eval
912 atprop%atecc(jatom) = atprop%atecc(jatom) + 0.5_dp*aterm*eval
915 IF (calculate_forces)
THEN
916 kkind = kind_of(katom)
917 atom_b = atom_of_kind(jatom)
918 atom_c = atom_of_kind(katom)
920 deval = 6.0_dp*kx(ikind)*ddr6*(kx2*ddr12 + 2.0_dp*ddr6 - kx2)/(1.0_dp + ddr12)**2
921 deval = -rcab(ikind, jkind)*deval/(dr*dr)/ddr
922 fij(1:3) = aterm*deval*rij(1:3)/dr
923 force(ikind)%repulsive(:, atom_a) = force(ikind)%repulsive(:, atom_a) - fij(:)
924 force(jkind)%repulsive(:, atom_b) = force(jkind)%repulsive(:, atom_b) + fij(:)
932 daterm = -0.25_dp*alp*(0.5_dp - 0.25_dp*cosa)**(alp - 1.0_dp)
933 ddbx = 0.5_dp*(drab - drax + drbx)/xy/drbx
934 ddax = 0.5_dp*(drab + drax - drbx)/xy/drax
936 fij(1:3) = 2.0_dp*daterm*ddbx*rij(1:3)*eval
937 fia(1:3) = 2.0_dp*daterm*ddax*ria(1:3)*eval
938 fja(1:3) = 2.0_dp*daterm*ddab*rja(1:3)*eval
939 force(ikind)%repulsive(:, atom_a) = force(ikind)%repulsive(:, atom_a) - fij(:) - fia(:)
940 force(jkind)%repulsive(:, atom_b) = force(jkind)%repulsive(:, atom_b) + fij(:) + fja(:)
941 force(kkind)%repulsive(:, atom_c) = force(kkind)%repulsive(:, atom_c) + fia(:) - fja(:)
951 END SUBROUTINE xb_energy
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
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.
Holds information on atomic properties.
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 ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
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.
This public domain function parser module is intended for applications where a set of mathematical ex...
real(kind=rn) function, public evalfd(id_fun, ipar, vals, h, err)
Evaluates derivatives.
subroutine, public finalizef()
...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Interface to the message passing library MPI.
subroutine, public pair_potential_pp_release(potparm)
Release Data-structure that constains potential parameters.
subroutine, public pair_potential_single_copy(potparm_source, potparm_dest)
Copy two potential parameter type.
subroutine, public pair_potential_single_clean(potparm)
Cleans the potential parameter type.
real(kind=dp), parameter, public not_initialized
subroutine, public pair_potential_pp_create(potparm, nkinds)
Data-structure that constains potential parameters.
real(kind=dp) function, public ener_pot(pot, r, energy_cutoff)
Evaluates the nonbond potential energy for the implemented FF kinds.
subroutine, public init_genpot(potparm, ntype)
Initialize genpot.
Define the data structure for the particle information.
Coordination number routines for dispersion pairpotentials.
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.
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, 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, 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, init_u_ramping_each_scf, reltmat, ghost, 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.
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
pure subroutine, public virial_pair_force(pv_virial, f0, force, rab)
Computes the contribution to the stress tensor from two-body pair-wise forces.
xTB (repulsive) pair potentials Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov JCTC 1...
subroutine, public nonbonded_correction(enonbonded, force, qs_env, xtb_control, sab_xtb_nonbond, atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
Computes a correction for nonbonded interactions based on a generic potential.
subroutine, public srb_potential(qs_env, esrb, calculate_forces, xtb_control, cnumbers, dcnum)
...
subroutine, public xb_interaction(qs_env, exb, calculate_forces)
...
subroutine, public xtb_pp_radius(qs_kind_set, ppradius, eps_pair, kfparam)
...
subroutine, public repulsive_potential(qs_env, erep, kf, enscale, calculate_forces)
...
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, hen, zeta, xi, kappa0, alpg, occupation, electronegativity, chmax, en, kqat2, kcn, kq)
...
Provides all information about an atomic kind.
type for the atomic properties
type of a logger, at the moment it contains just a print level starting at which level it should be l...
to build arrays of pointers
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.