80 subsys_section, para_env)
85 POINTER :: dftb_potential
89 CHARACTER(LEN=2) :: iel, jel
90 CHARACTER(LEN=6) :: cspline
91 CHARACTER(LEN=default_path_length) :: file_name
92 CHARACTER(LEN=default_path_length),
ALLOCATABLE, &
93 DIMENSION(:, :) :: sk_files
94 CHARACTER(LEN=default_string_length) :: iname, jname, name_a, name_b, skfn
95 INTEGER :: ikind, isp, jkind, k, l, l1, l2, llm, &
96 lmax, lmax_a, lmax_b, lp, m, n_urpoly, &
97 ngrd, nkind, output_unit, runit, &
99 LOGICAL :: at_end, found, ldum, search, sklist
100 REAL(dp) :: da, db, dgrd, dij, energy, eps_disp, ra, &
101 radmax, rb, rcdisp, rmax6, s_cut, xij, &
103 REAL(dp),
ALLOCATABLE,
DIMENSION(:, :) :: fmat, scoeff, smat, spxr
104 REAL(dp),
DIMENSION(0:3) :: eta, occupation, skself
105 REAL(dp),
DIMENSION(10) :: fwork, swork, uwork
106 REAL(dp),
DIMENSION(1:2) :: surr
107 REAL(dp),
DIMENSION(1:3) :: srep
115 "PRINT%KINDS/BASIS_SET"),
cp_p_file))
THEN
117 "PRINT%KINDS", extension=
".Log")
118 IF (output_unit > 0)
THEN
119 WRITE (output_unit,
"(/,A)")
" DFTB| A set of relativistic DFTB "// &
120 "parameters for material sciences."
121 WRITE (output_unit,
"(A)")
" DFTB| J. Frenzel, N. Jardillier, A.F. Oliveira,"// &
122 " T. Heine, G. Seifert"
123 WRITE (output_unit,
"(A)")
" DFTB| TU Dresden, 2002-2007"
124 WRITE (output_unit,
"(/,A)")
" DFTB| Non-SCC parameters "
125 WRITE (output_unit,
"(A,T25,A)")
" DFTB| C,H :", &
126 " D. Porezag et al, PRB 51 12947 (1995)"
127 WRITE (output_unit,
"(A,T25,A)")
" DFTB| B,N :", &
128 " J. Widany et al, PRB 53 4443 (1996)"
129 WRITE (output_unit,
"(A,T25,A)")
" DFTB| Li,Na,K,Cl :", &
130 " S. Hazebroucq et al, JCP 123 134510 (2005)"
131 WRITE (output_unit,
"(A,T25,A)")
" DFTB| F :", &
132 " T. Heine et al, JCSoc-Perkins Trans 2 707 (1999)"
133 WRITE (output_unit,
"(A,T25,A)")
" DFTB| Mo,S :", &
134 " G. Seifert et al, PRL 85 146 (2000)"
135 WRITE (output_unit,
"(A,T25,A)")
" DFTB| P :", &
136 " G. Seifert et al, EPS 16 341 (2001)"
137 WRITE (output_unit,
"(A,T25,A)")
" DFTB| Sc,N,C :", &
138 " M. Krause et al, JCP 115 6596 (2001)"
144 sklist = (dftb_control%sk_file_list /=
"")
146 nkind =
SIZE(atomic_kind_set)
147 ALLOCATE (sk_files(nkind, nkind))
149 ALLOCATE (dftb_potential(nkind, nkind))
153 CALL get_atomic_kind(atomic_kind_set(ikind), name=iname, element_symbol=iel)
158 CALL get_atomic_kind(atomic_kind_set(jkind), name=jname, element_symbol=jel)
163 DO k = 1,
SIZE(dftb_control%sk_pair_list, 2)
164 name_a = trim(dftb_control%sk_pair_list(1, k))
165 name_b = trim(dftb_control%sk_pair_list(2, k))
168 IF ((iname == name_a .AND. jname == name_b))
THEN
169 sk_files(ikind, jkind) = trim(dftb_control%sk_file_path)//
"/"// &
170 trim(dftb_control%sk_pair_list(3, k))
175 IF (.NOT. found .AND. sklist)
THEN
176 file_name = trim(dftb_control%sk_file_path)//
"/"// &
177 trim(dftb_control%sk_file_list)
188 IF ((iname == name_a .AND. jname == name_b))
THEN
190 sk_files(ikind, jkind) = trim(dftb_control%sk_file_path)//
"/"// &
196 IF ((iel == name_a .AND. jel == name_b))
THEN
198 sk_files(ikind, jkind) = trim(dftb_control%sk_file_path)//
"/"// &
208 CALL cp_abort(__location__, &
209 "Failure in assigning KINDS <"//trim(iname)//
"> and <"//trim(jname)// &
210 "> to a DFTB interaction pair!")
218 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
219 IF (.NOT.
ASSOCIATED(dftb_atom_a))
THEN
221 CALL set_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
228 CALL get_qs_kind(qs_kind_set(jkind), dftb_parameter=dftb_atom_b)
230 IF (output_unit > 0)
THEN
231 WRITE (output_unit,
"(A,T30,A50)")
" DFTB| Reading parameter file ", &
232 adjustr(trim(sk_files(jkind, ikind)))
237 IF (para_env%is_source())
THEN
239 CALL open_file(file_name=sk_files(jkind, ikind), unit_number=runit)
241 READ (runit, fmt=*,
END=1, err=1) dgrd, ngrd
249 READ (runit, fmt=*,
END=1, err=1) skself(2:0:-1), energy, &
250 eta(2:0:-1), occupation(2:0:-1)
252 READ (runit, fmt=*,
END=1, err=1) uwork(1:10)
254 IF (dot_product(uwork(2:10), uwork(2:10)) >= 1.e-12_dp)
THEN
257 IF (abs(uwork(k)) >= 1.e-12_dp) n_urpoly = k
262 IF (n_urpoly < 2) n_urpoly = 0
265 CALL para_env%bcast(n_urpoly)
266 CALL para_env%bcast(uwork)
267 CALL para_env%bcast(ngrd)
268 CALL para_env%bcast(dgrd)
270 CALL para_env%bcast(skself)
271 CALL para_env%bcast(energy)
272 CALL para_env%bcast(eta)
273 CALL para_env%bcast(occupation)
275 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, &
276 z=z, zeff=sum(occupation), defined=.true., &
277 skself=skself, energy=energy, eta=eta, occupation=occupation)
280 ALLOCATE (fmat(ngrd, 10))
281 ALLOCATE (smat(ngrd, 10))
282 IF (para_env%is_source())
THEN
284 READ (runit, fmt=*,
END=1, err=1) fwork(1:10), swork(1:10)
285 fmat(k, 1:10) = fwork(1:10)
286 smat(k, 1:10) = swork(1:10)
289 CALL para_env%bcast(fmat)
290 CALL para_env%bcast(smat)
303 CALL get_qs_kind(qs_kind_set(ikind), lmax_dftb=lmax)
321 IF ((abs(skself(l)) > 0._dp) .OR. &
322 (sum(abs(fmat(ngrd/10:ngrd, lp))) > 0._dp)) lmax = l
328 CALL cp_abort(__location__,
"Maximum L allowed is d. "// &
329 "Use KIND/LMAX_DFTB to set smaller values if needed.")
332 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, &
333 lmax=lmax, natorb=(lmax + 1)**2)
336 IF (n_urpoly == 0)
THEN
337 IF (para_env%is_source())
THEN
341 READ (runit, fmt=
'(A6)',
END=1, err=1) cspline
342 IF (cspline ==
'Spline')
THEN
345 READ (runit, fmt=*,
END=1, err=1) spdim, s_cut
346 ALLOCATE (spxr(spdim, 2))
347 ALLOCATE (scoeff(spdim, 4))
349 READ (runit, fmt=*,
END=1, err=1) srep(1:3)
350 DO isp = 1, spdim - 1
352 READ (runit, fmt=*,
END=1, err=1) spxr(isp, 1:2), scoeff(isp, 1:4)
355 READ (runit, fmt=*,
END=1, err=1) spxr(spdim, 1:2), scoeff(spdim, 1:4), surr(1:2)
361 IF (para_env%is_source())
THEN
362 CALL close_file(unit_number=runit)
365 CALL para_env%bcast(spdim)
366 IF (spdim > 0 .AND. (.NOT. para_env%is_source()))
THEN
367 ALLOCATE (spxr(spdim, 2))
368 ALLOCATE (scoeff(spdim, 4))
371 CALL para_env%bcast(spxr)
372 CALL para_env%bcast(scoeff)
373 CALL para_env%bcast(surr)
374 CALL para_env%bcast(srep)
375 CALL para_env%bcast(s_cut)
380 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_a, lmax=lmax_a)
381 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_b, lmax=lmax_b)
383 DO l1 = 0, max(lmax_a, lmax_b)
384 DO l2 = 0, min(l1, lmax_a, lmax_b)
390 CALL qs_dftb_pairpot_create(dftb_potential(ikind, jkind), &
394 dftb_potential(ikind, jkind)%n_urpoly = n_urpoly
395 dftb_potential(ikind, jkind)%urep_cut = uwork(10)
396 dftb_potential(ikind, jkind)%urep(:) = 0._dp
397 dftb_potential(ikind, jkind)%urep(1) = uwork(10)
398 dftb_potential(ikind, jkind)%urep(2:n_urpoly) = uwork(2:n_urpoly)
401 dftb_potential(ikind, jkind)%dgrd = dgrd
402 CALL skreorder(fmat, lmax_a, lmax_b)
403 dftb_potential(ikind, jkind)%fmat(:, 1:llm) = fmat(:, 1:llm)
404 CALL skreorder(smat, lmax_a, lmax_b)
405 dftb_potential(ikind, jkind)%smat(:, 1:llm) = smat(:, 1:llm)
406 dftb_potential(ikind, jkind)%ngrdcut = ngrd + int(slako_d0/dgrd)
409 dftb_potential(ikind, jkind)%s_cut = s_cut
410 dftb_potential(ikind, jkind)%srep = srep
411 dftb_potential(ikind, jkind)%spxr = spxr
412 dftb_potential(ikind, jkind)%scoeff = scoeff
413 dftb_potential(ikind, jkind)%surr = surr
427 CALL get_atomic_kind(atomic_kind_set(ikind), z=z, name=iname)
428 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
430 IF (.NOT.
ASSOCIATED(dftb_atom_a))
THEN
431 CALL allocate_dftb_atom_param(dftb_atom_a)
432 CALL set_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
437 IF (ikind == jkind) cycle
438 CALL get_atomic_kind(atomic_kind_set(jkind), name=jname)
439 CALL get_qs_kind(qs_kind_set(jkind), dftb_parameter=dftb_atom_b)
441 IF (output_unit > 0)
THEN
442 WRITE (output_unit,
"(A,T30,A50)")
" DFTB| Reading parameter file ", &
443 adjustr(trim(sk_files(ikind, jkind)))
448 IF (para_env%is_source())
THEN
449 runit = get_unit_number()
450 CALL open_file(file_name=sk_files(ikind, jkind), unit_number=runit)
452 READ (runit, fmt=*,
END=1, err=1) dgrd, ngrd
459 IF (ikind == jkind)
THEN
461 READ (runit, fmt=*,
END=1, err=1) skself(2:0:-1), energy, &
462 eta(2:0:-1), occupation(2:0:-1)
465 READ (runit, fmt=*,
END=1, err=1) uwork(1:10)
467 IF (dot_product(uwork(2:10), uwork(2:10)) >= 1.e-12_dp)
THEN
470 IF (abs(uwork(k)) >= 1.e-12_dp) n_urpoly = k
475 IF (n_urpoly < 2) n_urpoly = 0
478 CALL para_env%bcast(n_urpoly)
479 CALL para_env%bcast(uwork)
480 CALL para_env%bcast(ngrd)
481 CALL para_env%bcast(dgrd)
484 ALLOCATE (fmat(ngrd, 10))
485 ALLOCATE (smat(ngrd, 10))
486 IF (para_env%is_source())
THEN
488 READ (runit, fmt=*,
END=1, err=1) fwork(1:10), swork(1:10)
489 fmat(k, 1:10) = fwork(1:10)
490 smat(k, 1:10) = swork(1:10)
493 CALL para_env%bcast(fmat)
494 CALL para_env%bcast(smat)
497 IF (n_urpoly == 0)
THEN
498 IF (para_env%is_source())
THEN
502 READ (runit, fmt=
'(A6)',
END=1, err=1) cspline
503 IF (cspline ==
'Spline')
THEN
506 READ (runit, fmt=*,
END=1, err=1) spdim, s_cut
507 ALLOCATE (spxr(spdim, 2))
508 ALLOCATE (scoeff(spdim, 4))
510 READ (runit, fmt=*,
END=1, err=1) srep(1:3)
511 DO isp = 1, spdim - 1
513 READ (runit, fmt=*,
END=1, err=1) spxr(isp, 1:2), scoeff(isp, 1:4)
516 READ (runit, fmt=*,
END=1, err=1) spxr(spdim, 1:2), scoeff(spdim, 1:4), surr(1:2)
522 IF (para_env%is_source())
THEN
523 CALL close_file(unit_number=runit)
526 CALL para_env%bcast(spdim)
527 IF (spdim > 0 .AND. (.NOT. para_env%is_source()))
THEN
528 ALLOCATE (spxr(spdim, 2))
529 ALLOCATE (scoeff(spdim, 4))
532 CALL para_env%bcast(spxr)
533 CALL para_env%bcast(scoeff)
534 CALL para_env%bcast(surr)
535 CALL para_env%bcast(srep)
536 CALL para_env%bcast(s_cut)
541 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_a, lmax=lmax_a)
542 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_b, lmax=lmax_b)
544 DO l1 = 0, max(lmax_a, lmax_b)
545 DO l2 = 0, min(l1, lmax_a, lmax_b)
551 CALL qs_dftb_pairpot_create(dftb_potential(ikind, jkind), &
555 dftb_potential(ikind, jkind)%n_urpoly = n_urpoly
556 dftb_potential(ikind, jkind)%urep_cut = uwork(10)
557 dftb_potential(ikind, jkind)%urep(:) = 0._dp
558 dftb_potential(ikind, jkind)%urep(1) = uwork(10)
559 dftb_potential(ikind, jkind)%urep(2:n_urpoly) = uwork(2:n_urpoly)
562 dftb_potential(ikind, jkind)%dgrd = dgrd
563 CALL skreorder(fmat, lmax_a, lmax_b)
564 dftb_potential(ikind, jkind)%fmat(:, 1:llm) = fmat(:, 1:llm)
565 CALL skreorder(smat, lmax_a, lmax_b)
566 dftb_potential(ikind, jkind)%smat(:, 1:llm) = smat(:, 1:llm)
567 dftb_potential(ikind, jkind)%ngrdcut = ngrd + int(slako_d0/dgrd)
570 dftb_potential(ikind, jkind)%s_cut = s_cut
571 dftb_potential(ikind, jkind)%srep = srep
572 dftb_potential(ikind, jkind)%spxr = spxr
573 dftb_potential(ikind, jkind)%scoeff = scoeff
574 dftb_potential(ikind, jkind)%surr = surr
587 DEALLOCATE (sk_files)
590 IF (dftb_control%dispersion)
THEN
592 IF (dftb_control%dispersion_type == dispersion_uff)
THEN
593 file_name = trim(dftb_control%sk_file_path)//
"/"// &
594 trim(dftb_control%uff_force_field)
596 TYPE(cp_parser_type) :: parser
598 CALL get_atomic_kind(atomic_kind_set(ikind), name=iname)
599 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
602 CALL parser_create(parser, file_name, para_env=para_env)
606 CALL parser_get_next_line(parser, 1, at_end)
608 CALL parser_get_object(parser, name_a)
610 IF (name_a(1:1) ==
'"') name_a(1:m) = name_a(2:m + 1)
611 IF (name_a(1:m) == trim(iname))
THEN
612 CALL parser_get_object(parser, rb)
613 CALL parser_get_object(parser, rb)
614 CALL parser_get_object(parser, ra)
615 CALL parser_get_object(parser, da)
619 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, name=iname, xi=ra, di=da)
623 CALL parser_release(parser)
632 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
633 radmax = (dftb_potential(ikind, ikind)%ngrdcut + 1)* &
634 dftb_potential(ikind, ikind)%dgrd*0.5_dp
635 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, cutoff=radmax)
638 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
639 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_a, cutoff=ra)
641 CALL get_qs_kind(qs_kind_set(jkind), dftb_parameter=dftb_atom_b)
642 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_b, cutoff=rb)
643 radmax = (dftb_potential(ikind, jkind)%ngrdcut + 1)* &
644 dftb_potential(ikind, jkind)%dgrd
645 IF (ra + rb < radmax)
THEN
646 ra = ra + (radmax - ra - rb)*0.5_dp
647 rb = rb + (radmax - ra - rb)*0.5_dp
648 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, cutoff=ra)
649 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_b, cutoff=rb)
656 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
657 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_a, zeff=zeff)
658 CALL set_potential(potential=qs_kind_set(ikind)%all_potential, &
659 zeff=zeff, zeff_correction=0.0_dp)
663 IF (dftb_control%dftb3_diagonal)
THEN
665 CALL get_qs_kind(qs_kind_set(ikind), dftb3_param=db)
666 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
667 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, dudq=db)
672 IF (dftb_control%dispersion)
THEN
673 IF (dftb_control%dispersion_type == dispersion_uff)
THEN
674 eps_disp = dftb_control%eps_disp
676 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_atom_a)
677 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_a, xi=ra, di=da)
680 CALL get_qs_kind(qs_kind_set(jkind), dftb_parameter=dftb_atom_b)
681 CALL get_dftb_atom_param(dftb_parameter=dftb_atom_b, xi=rb, di=db)
684 dftb_potential(ikind, jkind)%xij = xij
685 dftb_potential(ikind, jkind)%dij = dij
686 dftb_potential(ikind, jkind)%x0ij = xij*(0.5_dp**(1.0_dp/6.0_dp))
687 dftb_potential(ikind, jkind)%a = dij*396.0_dp/25.0_dp
688 dftb_potential(ikind, jkind)%b = &
689 dij/(xij**5)*672.0_dp*2.0_dp**(5.0_dp/6.0_dp)/25.0_dp
690 dftb_potential(ikind, jkind)%c = &
691 -dij/(xij**10)*2.0_dp**(2.0_dp/3.0_dp)*552.0_dp/25.0_dp
692 rmax6 = ((8._dp*pi*dij/eps_disp)*xij**6)**0.25_dp
693 rcdisp = max(rcdisp, rmax6*0.5_dp)
695 CALL set_dftb_atom_param(dftb_parameter=dftb_atom_a, rcdisp=rcdisp)
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.