Skip to content

Commit

Permalink
Remove get NATOM from build_overlap_matrix_low (#1264)
Browse files Browse the repository at this point in the history
* xTB pairpotential (A. Hehn)

* Adjust regtest

* Adjust regtests

* qs_overlap: remove get NATOM
atom code: output

* atom code: output pretty

* Correct lower bound of wfn array
  • Loading branch information
juerghutter committed Dec 30, 2020
1 parent c6a7f7c commit f4744a6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/atom_fit.F
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ SUBROUTINE atom_fit_basis(atom_info, basis, pptype, iunit, powell_section)
END DO
END SELECT
CALL atom_print_basis(basis, iunit, " Optimized Basis")
CALL atom_print_basis_file(basis)
CALL atom_print_basis_file(basis, atom_info(1, 1)%atom%orbitals%wfn)
END IF

DEALLOCATE (x)
Expand Down
1 change: 1 addition & 0 deletions src/atom_grb.F
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ SUBROUTINE atom_grb_construction(atom_info, atom_section, iw)
CALL atom_density(rho(:), atom%orbitals%pmat, atom%basis, maxl, typ="RHO")
n = SUM(MAXLOC(rho(:)))
rmax = basis%grid%rad(n)
IF (rmax < 0.1_dp) rmax = 1.0_dp
DEALLOCATE (rho)

! generate polarization sets
Expand Down
34 changes: 31 additions & 3 deletions src/atom_output.F
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ MODULE atom_output
section_vals_val_get
USE kinds, ONLY: default_string_length,&
dp
USE mathconstants, ONLY: pi
USE mathconstants, ONLY: dfac,&
pi
USE periodic_table, ONLY: ptable
USE physcon, ONLY: evolt
USE xc_derivatives, ONLY: xc_functional_get_info
Expand Down Expand Up @@ -374,17 +375,20 @@ END SUBROUTINE atom_print_basis
! **************************************************************************************************
!> \brief Print the optimized atomic basis set into a file.
!> \param atom_basis atomic basis set
!> \param wfn ...
!> \par History
!> * 11.2016 revised output format [Matthias Krack]
!> * 11.2011 Slater basis functions [Juerg Hutter]
!> * 03.2011 created [Juerg Hutter]
!> \note The basis set is stored as the file 'OPT_BASIS' inside the current working directory.
!> It may be a good idea, however, to specify the name of this file via some input section.
! **************************************************************************************************
SUBROUTINE atom_print_basis_file(atom_basis)
SUBROUTINE atom_print_basis_file(atom_basis, wfn)
TYPE(atom_basis_type) :: atom_basis
REAL(KIND=dp), DIMENSION(:, :, 0:), OPTIONAL :: wfn

INTEGER :: i, iw, l
INTEGER :: i, im, iw, l
REAL(KIND=dp) :: expzet, prefac, zeta

CALL open_file(file_name="OPT_BASIS", file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
SELECT CASE (atom_basis%basis_type)
Expand Down Expand Up @@ -457,6 +461,30 @@ SUBROUTINE atom_print_basis_file(atom_basis)
CASE DEFAULT
CPABORT("")
END SELECT

IF (PRESENT(wfn)) THEN
SELECT CASE (atom_basis%basis_type)
CASE DEFAULT
CASE (GTO_BASIS)
IF (.NOT. atom_basis%geometrical) THEN
WRITE (iw, '(/,T3,A)') "ORBITAL COEFFICENTS (Quickstep normalization)"
im = MIN(6, SIZE(wfn, 2))
DO l = 0, lmat
IF (atom_basis%nbas(l) > 0) THEN
WRITE (iw, '(T3,A,I3)') "L Quantum Number:", l
! Quickstep normalization
expzet = 0.25_dp*REAL(2*l + 3, dp)
prefac = SQRT(SQRT(pi)/2._dp**(l + 2)*dfac(2*l + 1))
DO i = 1, atom_basis%nbas(l)
zeta = (2._dp*atom_basis%am(i, l))**expzet
WRITE (iw, '(T5,F14.8,2x,6F12.8)') atom_basis%am(i, l), wfn(i, 1:im, l)*prefac/zeta
END DO
END IF
END DO
END IF
END SELECT
END IF

CALL close_file(unit_number=iw)

END SUBROUTINE atom_print_basis_file
Expand Down
2 changes: 1 addition & 1 deletion src/atom_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -2586,7 +2586,7 @@ SUBROUTINE atom_basis_condnum(basis, rad, cnum)
END IF

info = 0
lwork = nbas*nbas
lwork = MAX(nbas*nbas, nbas + 100)
ALLOCATE (weig(nbas), work(lwork))

CALL lapack_ssyev("N", "U", nbas, smat, nbas, weig, work, lwork, info)
Expand Down
1 change: 0 additions & 1 deletion src/qs_overlap.F
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ SUBROUTINE build_overlap_matrix_low(ks_env, matrix_s, matrixkp_s, matrix_name, n
NULLIFY (atomic_kind_set)
CALL get_ks_env(ks_env, &
atomic_kind_set=atomic_kind_set, &
natom=natom, &
qs_kind_set=qs_kind_set, &
dft_control=dft_control)

Expand Down

0 comments on commit f4744a6

Please sign in to comment.