From f5aa0bead663b2ec196ab1a18148f85b9fa562ac Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Tue, 6 Apr 2021 11:06:22 +0200
Subject: [PATCH] Cleanup: sph_dbes1 renamed sph_dbes; some comments added or
corrected
---
CPV/src/pseudopot_sub.f90 | 11 +++++------
upflib/TODO_upflib.md | 11 +++++++++--
upflib/init_us_1.f90 | 14 ++++++++------
upflib/sph_bes.f90 | 4 ++--
4 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/CPV/src/pseudopot_sub.f90 b/CPV/src/pseudopot_sub.f90
index 9054bb7ac..508d91679 100644
--- a/CPV/src/pseudopot_sub.f90
+++ b/CPV/src/pseudopot_sub.f90
@@ -413,7 +413,7 @@
!
if( tpre )then
!
- call sph_dbes1 ( nr, rgrid(is)%r, xg, l, jl, djl)
+ call sph_dbes ( nr, rgrid(is)%r, xg, l, jl, djl)
!
endif
!
@@ -536,7 +536,7 @@
!
if( tpre ) then
!
- call sph_dbes1 ( nr, rgrid(is)%r, xg, l-1, jl, djl)
+ call sph_dbes ( nr, rgrid(is)%r, xg, l-1, jl, djl)
!
endif
!
@@ -604,7 +604,6 @@
use io_global, only: stdout
USE ions_base, ONLY: nsp
USE uspp_param, ONLY: upf, nh, nhm, nbetam, lmaxq
- use uspp_param, only: lmaxkb
USE atom, ONLY: rgrid
USE uspp, ONLY: indv
use uspp, only: qq_nt, qq_nt_d, beta
@@ -691,7 +690,7 @@
!
if( tpre ) then
!
- call sph_dbes1 ( nr, rgrid(is)%r, xg, l-1, jl, djl)
+ call sph_dbes ( nr, rgrid(is)%r, xg, l-1, jl, djl)
!
endif
!
@@ -1051,7 +1050,7 @@
use uspp, only: qq_nt, qq_nt_d, nhtolm, beta
use constants, only: pi, fpi
use ions_base, only: nsp
- use uspp_param, only: upf, lmaxq, lmaxkb, nbetam, nh
+ use uspp_param, only: upf, lmaxq, nbetam, nh
use qgb_mod, only: qgb, dqgb
use smallbox_gvec, only: gb, gxb, ngb
use small_box, only: omegab, tpibab
@@ -1304,7 +1303,7 @@
!
if( tpre )then
!
- call sph_dbes1 ( nr, rgrid(is)%r, xg, l, jl, djl)
+ call sph_dbes ( nr, rgrid(is)%r, xg, l, jl, djl)
!
endif
!
diff --git a/upflib/TODO_upflib.md b/upflib/TODO_upflib.md
index 95c8906c8..f21886211 100644
--- a/upflib/TODO_upflib.md
+++ b/upflib/TODO_upflib.md
@@ -21,9 +21,16 @@
together with upf(:), when upf is read? Or maybe nh should be part of upf?
It is used in many many places, though!
- Merge pseudopotential_indexes from CPV/src/pseudopot_sub.f90 with the
- uspp initialization in upflib (init_us_1 etc)
+ uspp initialization in upflib (init_us_1 etc); merge qvan2b and qvan2
+ (requires merge of interpolation tables qrad and qradb)
- upf_ions now contains just a function n_atom_wfc: move somewhere else?
- - upf_spinorb contains just two variables: merge into uspp?
+ - upf_spinorb contains just two variables: merge into uspp? add to it
+ the two functions spinor and sph_ind used only for spin-orbit?
+ - more functions to be moved from Modules/: dylmr2, dqvan2
+ - lmaxq should be "the maximum value of L in Q functions", not "... + 1"
+ and should be used to dimension arrays where l=0,...,L. The dimension
+ of spherical harmonics (2*lmaxkb+1)^2 is something different and should
+ be stored in a different variable (something like ylmdim, or maxlm)
* upflib restructuring:
- shall we keep just one src folder ? or structure it a bit more, such as
diff --git a/upflib/init_us_1.f90 b/upflib/init_us_1.f90
index 7d0993663..be87d15a0 100644
--- a/upflib/init_us_1.f90
+++ b/upflib/init_us_1.f90
@@ -403,13 +403,13 @@ SUBROUTINE compute_qrad (omega, intra_bgrp_comm)
!
! Compute interpolation table qrad(i,nm,l+1,nt) = Q^{(L)}_{nm,nt}(q_i)
! of angular momentum L, for atom of type nt, on grid q_i, where
- ! nm = combined index for n,m=1,nh(nt)
+ ! nm = combined (n,m) index; n,m = 1,...,nbeta (number of beta functions)
!
USE upf_kinds, ONLY : dp
USE upf_const, ONLY : fpi
USE atom, ONLY : rgrid
- USE uspp_param, ONLY : upf, lmaxq, nbetam, nh, nhm, lmaxkb, nsp
- USE uspp_data, ONLY : nqxq, dq, qrad, qrad_d
+ USE uspp_param, ONLY : upf, lmaxq, nbetam, nsp
+ USE uspp_data, ONLY : nqxq, dq, qrad
USE mp, ONLY : mp_sum
!
IMPLICIT NONE
@@ -437,8 +437,10 @@ SUBROUTINE compute_qrad (omega, intra_bgrp_comm)
if ( upf(nt)%tvanp ) then
DO l = 0, upf(nt)%nqlc -1
!
- ! note that l is the true (combined) angular momentum
- ! and that the arrays have dimensions 0..l (no more 1..l+1)
+ ! l is the true (combined) angular momentum
+ ! Note that the index of array qfuncl runs from 0 to l,
+ ! while the same index for qrad runs from 1 to l+1
+ ! FIXME: qrad has "holes" if USPP/PAW do not precede NCPP
!
DO iq = startq, lastq
!
@@ -450,7 +452,7 @@ SUBROUTINE compute_qrad (omega, intra_bgrp_comm)
!
DO nb = 1, upf(nt)%nbeta
!
- ! the Q are symmetric with respect to indices
+ ! the Q are symmetric with respect to nb,nm indices
!
DO mb = nb, upf(nt)%nbeta
ijv = mb * (mb - 1) / 2 + nb
diff --git a/upflib/sph_bes.f90 b/upflib/sph_bes.f90
index 615049104..24b1d8018 100644
--- a/upflib/sph_bes.f90
+++ b/upflib/sph_bes.f90
@@ -259,7 +259,7 @@ integer function semifact(n)
return
end function semifact
!
-SUBROUTINE sph_dbes1 ( nr, r, xg, l, jl, djl )
+SUBROUTINE sph_dbes ( nr, r, xg, l, jl, djl )
!
!! Calculates \(x*dj_l(x)/dx\) using the recursion formula:
!! $$ dj_l(x)/dx = l/x j_l(x) - j_{l+1}(x) $$
@@ -295,4 +295,4 @@ SUBROUTINE sph_dbes1 ( nr, r, xg, l, jl, djl )
end if
end if
!
-end SUBROUTINE sph_dbes1
+end SUBROUTINE sph_dbes