Skip to content

Commit

Permalink
ZZ element, consistent correlation flag (author), allocations in ao i…
Browse files Browse the repository at this point in the history
…nterpolation
  • Loading branch information
jlm785 committed Jan 14, 2024
1 parent e390ce3 commit 5f15686
Show file tree
Hide file tree
Showing 19 changed files with 1,076 additions and 1,010 deletions.
4 changes: 2 additions & 2 deletions Src/ALFA/plot_psi_sub.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subroutine plot_psi_sub(ioreplay)
! and rho_v_plot_sub.
! Modernized, documentation, APIs, 2 February 2021. JLM
! Modified, efermi, 29 November 2021. JLM
! copyright Jose Luis Martins/INESC-MN
! Modified, size of author, 13 January 2024.


use cpw_variables
Expand Down Expand Up @@ -189,7 +189,7 @@ subroutine plot_psi_sub(ioreplay)

! information about the calculation

character(len=3) :: author ! type of xc wanted (CA=PZ , PW92 , PBE)
character(len=4) :: author ! type of xc wanted (CA=PZ , PW92 , PBE)

character(len=60) :: pwline ! identifier of the calculation. May contain miscellaneous information!
character(len=50) :: title ! title for plots
Expand Down
2 changes: 1 addition & 1 deletion Src/ALFA/plot_rho_v_sub.f90
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ subroutine plot_rho_v_sub(ioreplay)

! information about the calculation

character(len=3) :: author ! type of xc wanted (CA=PZ , PW92 , PBE)
character(len=4) :: author ! type of xc wanted (CA=PZ , PW92 , PBE)

character(len=60) :: pwline ! identifier of the calculation. May contain miscellaneous information!
character(len=50) :: title ! title for plots
Expand Down
3 changes: 2 additions & 1 deletion Src/ALFA/pw_rho_v_in.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ subroutine pw_rho_v_in(filename, io, ipr, &
! Modified October 15 2018 to pass generation information for pwSCF.
! Modified, documentation, February 4 2020. JLM
! Modified, efermi order of ntrans, mtrx, tnp, 29 November 2021. JLM
! Modified, size of author, 13 January 2024.


implicit none
Expand All @@ -67,7 +68,7 @@ subroutine pw_rho_v_in(filename, io, ipr, &
character(len=140), intent(out) :: subtitle !< subtitle for plots
character(len=250), intent(out) :: meta_cpw2000 !< metadata from cpw2000

character(len=3), intent(out) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
character(len=4), intent(out) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
character(len=6), intent(out) :: flgscf !< type of self consistent field and diagonalization
character(len=4), intent(out) :: flgdal !< whether the dual approximation is used
real(REAL64), intent(out) :: emax !< kinetic energy cutoff of plane wave expansion (Hartree).
Expand Down
15 changes: 13 additions & 2 deletions Src/ALFA/pw_rho_v_in_crystal_calc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ subroutine pw_rho_v_in_crystal_calc(io, &
! Modified, meta_cpw2000, author,nx,etc, January 10, 2017. JLM
! Modified, documentation, spacegroup, 31 December 2020. JLM
! Modified, meta_cpw2000 has information if file is old style, 15 February 2022. JLM
! Modified, size of author, 13 January 2024.

implicit none
integer, parameter :: REAL64 = selected_real_kind(12)
Expand Down Expand Up @@ -75,7 +76,7 @@ subroutine pw_rho_v_in_crystal_calc(io, &

! information about the calculation

character(len=3), intent(out) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
character(len=4), intent(out) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
character(len=6), intent(out) :: flgscf !< type of self consistent field and diagonalization
character(len=4), intent(out) :: flgdal !< whether the dual approximation is used
real(REAL64), intent(out) :: emax !< kinetic energy cutoff of plane wave expansion (Hartree).
Expand Down Expand Up @@ -175,12 +176,22 @@ subroutine pw_rho_v_in_crystal_calc(io, &
bdate,btime

read(io) author,flgscf,flgdal
if(author == 'ca ' .or. author == 'CA ' .or. author == 'pz ' &
if(author == 'ca ' .or. author == 'CA' .or. author == 'pz ' &
.or. author == 'PZ ') then
write(6,*)
write(6,'(" The potential was calculated in the local ", &
& "density aproximation using Ceperley and Alder correlation")')
write(6,'(" (as parametrized by Perdew and Zunger)")')
elseif(author == 'PW92' .or. author == 'pw92') then
write(6,*)
write(6,'(" The potential was calculated in the local ", &
& "density aproximation using Ceperley and Alder correlation")')
write(6,'(" (as parametrized by Perdew and Wang (1992) )")')
elseif(author == 'vwn' .or. author == 'VWN') then
write(6,*)
write(6,'(" The potential was calculated in the local ", &
& "density aproximation using Ceperley and Alder correlation")')
write(6,'(" (as parametrized by Vosko, Wilk and Nusair)")')
elseif(author == 'pbe' .or. author == 'PBE' ) then
write(6,*)
write(6,'(" The potential was calculated in the generalized", &
Expand Down
16 changes: 9 additions & 7 deletions Src/ALFA/pw_rho_v_in_pseudo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ subroutine pw_rho_v_in_pseudo(io, ipr, ealraw, author, &
! Modified, documentation, February 4 2020. JLM
! Modified, polarization orbitals of f not processed. 2 December 2021. JLM
! Copyright INESC-MN/Jose Luis Martins
! Modified, size of author, 13 January 2024.


implicit none
Expand All @@ -62,7 +63,7 @@ subroutine pw_rho_v_in_pseudo(io, ipr, ealraw, author, &
integer, intent(in) :: ntype !< number of types of atoms
integer, intent(in) :: natom(mxdtyp) !< number of atoms of type i
character(len=2), intent(in) :: nameat(mxdtyp) !< chemical symbol for the type i
character(len=3), intent(in) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
character(len=*), intent(in) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)

! output

Expand Down Expand Up @@ -148,15 +149,16 @@ subroutine pw_rho_v_in_pseudo(io, ipr, ealraw, author, &
& "pw_rho_v_in_pseudo chemical symbols do not match", &
& 3x,a2,3x,a2)') namel,nameat(nt)

if(icorrt == 'ca') icorrt='CA'
if(icorrt == 'xa') icorrt='XA'
if(icorrt == 'wi') icorrt='WI'
if(icorrt == 'hl') icorrt='HL'
if(icorrt == 'pb') icorrt='PB'
! if(icorrt == 'ca') icorrt='CA'
! if(icorrt == 'xa') icorrt='XA'
! if(icorrt == 'wi') icorrt='WI'
! if(icorrt == 'hl') icorrt='HL'
! if(icorrt == 'pb') icorrt='PB'
call chrcap(icorrt,2)

if(icorrt /= author(1:2)) write(6,'(" *** warning in ", &
& "pw_rho_v_in_pseudo: correlation potential does not ", &
& "match",3x,a2,3x,a3)') icorrt,author
& "match",3x,a2,3x,a2)') icorrt, author(1:2)
icorr(nt) = icorrt

! sum up vql0 for the alpha energy
Expand Down
2 changes: 1 addition & 1 deletion Src/ALFA/pw_rho_v_out.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ subroutine pw_rho_v_out(filename, io, author, tblaha, flgscf, flgdal, &
character(len=250), intent(in) :: meta_cpw2000 !< metadata from cpw2000

character(len=*), intent(in) :: filename !< input file
character(len=3), intent(in) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
character(len=4), intent(in) :: author !< type of xc wanted (CA=PZ , PW92 , PBE)
real(REAL64), intent(in) :: tblaha !< Tran-Blaha constant
character(len=6), intent(in) :: flgscf !< type of self consistent field and diagonalizatioN
character(len=4), intent(in) :: flgdal !< whether the dual approximation is used
Expand Down
5 changes: 5 additions & 0 deletions Src/ao_interpolation/ao_h_and_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ subroutine ao_h_and_s(emax, rkpt, nbaslcao, flgpsd, &
! Modified, hamilt_pw, 6 June 2020. JLM
! Modified, qmod-->ekpg in hk_psi. 13 February 2021. JLM
! Modified, nanlspin, 30 November 2023. JLM
! Modified, allocation of d2h0drk2, 14 January 2024. JLM

implicit none

Expand Down Expand Up @@ -187,13 +188,17 @@ subroutine ao_h_and_s(emax, rkpt, nbaslcao, flgpsd, &

nder = 1

allocate(d2h0drk2(1,1,3,3))

call kdotp_matrix(mtxd, mxdorb, psi, ev_fake, rkpt, isort, nder, &
h0, dh0drk, d2h0drk2, &
ng, kgv, &
ntype, natom, rat, adot, &
nqnl, delqnl, vkb, nkb, &
mxdtyp,mxdatm,mxdlqp,mxddim,mxdbnd,mxdgve)

deallocate(d2h0drk2)

call zgemm('c','n', nbaslcao, nbaslcao, mtxd, C_UM, hpsi, mxddim, &
psi, mxddim, C_ZERO, Hao, mxdorb)

Expand Down
32 changes: 18 additions & 14 deletions Src/ao_interpolation/ao_interpolation_out_dos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@
! https://github.com/jlm785/cpw2000 !
!------------------------------------------------------------!

!> This subroutine calculates the bands on an uniform grid
!> for later processing using the atomic orbital interpolation
!> Calculates the atomic orbital interpolation
!> for the density of states
!>
!> \author Carlos Loia Reis
!> \version 5.10
!> \date July 2014, 29 November 2021.
!> \copyright GNU Public License v2

subroutine ao_interpolation_out_dos(noiData, ztot, adot, ntrans, mtrx)
subroutine ao_interpolation_out_dos(noiData, ztot, adot, ntrans, mtrx)

! Adapted to use ao interpolatiion package July, 2014. clr
! modified 25 November 2015. JLM
! Modified documentation May 2020. JLM
! Modfied, new dos file format June 2021. CLR
! copyright Jose Luis Martins, Carlos Loia Reis/INESC-MN

! version 5.01
! Modified, e_of_k allocations, 14 Janury 2024. JLM

use NonOrthoInterp

Expand Down Expand Up @@ -139,10 +142,12 @@ subroutine ao_interpolation_out_dos(noiData, ztot, adot, ntrans, mtrx)

if(noiData%lso==1) then
allocate(e_of_k_so(2*neig,nrk2))
allocate(e_of_k(1,1))
allocate(basxpsi_of_k(noiData%nband,noiData%nband,nrk2))
lscl = .false.
lso = .true.
else
allocate(e_of_k_so(1,1))
allocate(e_of_k(neig,nrk2))
allocate(basxpsi_of_k(noiData%nband,noiData%nband,nrk2))
lscl = .true.
Expand Down Expand Up @@ -217,11 +222,8 @@ subroutine ao_interpolation_out_dos(noiData, ztot, adot, ntrans, mtrx)

deallocate(basxpsi_of_k)

if(noiData%lso==1) then
deallocate(e_of_k_so)
else
deallocate(e_of_k)
endif
deallocate(e_of_k_so)
deallocate(e_of_k)

deallocate(kmap2)
deallocate(nband2)
Expand All @@ -233,9 +235,11 @@ subroutine ao_interpolation_out_dos(noiData, ztot, adot, ntrans, mtrx)
deallocate(psi)

return
end subroutine ao_interpolation_out_dos

end subroutine ao_interpolation_out_dos

subroutine DiagByLowdin2(nband,Hao,S, ev, psi)

implicit none
integer, parameter :: REAL64 = selected_real_kind(12)

Expand Down Expand Up @@ -290,9 +294,9 @@ subroutine DiagByLowdin2(nband,Hao,S, ev, psi)

deallocate(S12,ev_ao, S12_inv,Uao,Hao_tr,wrk,ev_s)

return


end subroutine
end subroutine DiagByLowdin2



Expand Down
14 changes: 8 additions & 6 deletions Src/ao_interpolation/ao_interpolation_sub.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
! https://github.com/jlm785/cpw2000 !
!------------------------------------------------------------!

!> This subroutines reads a file with the atomic structure and
!> the effective potential and charge density and writes files
!> for the band structure, DOS, charge, potentaial plots.
!> This subroutines reads a file with the atomic structure and
!> the effective potential and charge density and writes file
!> with the information for the atomic orbital interpolation
!> MTB (Modified Tight Binding) method.
!>
!> \author Carlos Lóia Reis, Jose Luis Martins
!> \author Carlos Loia Reis, Jose Luis Martins
!> \version 5.03
!> \date December 18, 2013, 29 November 2021.
!> \copyright GNU Public License v2
Expand All @@ -30,7 +31,8 @@ subroutine ao_interpolation_sub(ioreplay)
! Modified, cpw_variables. 7 January 2020. JLM
! Modified, epspsi, icmax, 14 June 2020. JLM
! Modified, efermi, 29 November 2021. JLM
! copyright Jose Luis Martins/INESC-MN
! Modified, size of author, 13 January 2024.


use cpw_variables
use NonOrthoInterp
Expand Down Expand Up @@ -197,7 +199,7 @@ subroutine ao_interpolation_sub(ioreplay)

! information about the calculation

character(len=3) :: author ! type of xc wanted (CA=PZ , PW92 , PBE)
character(len=4) :: author ! type of xc wanted (CA=PZ , PW92 , PBE)

character(len=60) :: pwline ! identifier of the calculation. May contain miscellaneous information!
character(len=50) :: title ! title for plots
Expand Down
8 changes: 4 additions & 4 deletions Src/cpw.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
!------------------------------------------------------------!


!> Total Energy Plane Wave Calculation
!> Total Energy Plane Wave Calculation
!>
!> \author Jose Luis Martins and many others
!> \version 5.07
!> \date 20 April 2023
!> \version 5.10
!> \date 24 January 2024
!> \copyright GNU Public License v2

program cpw2000
Expand Down Expand Up @@ -151,7 +151,7 @@ program cpw2000

icorr = xc_%author(1:2)

call cpw_read_pseudo(iprglob, icorr, &
call cpw_read_pseudo(iprglob, xc_%author, &
crys_, pseudo_, atorb_, dims_)


Expand Down
Loading

0 comments on commit 5f15686

Please sign in to comment.