From 6ee47afe364eececc35a388c33787a579a982e23 Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Tue, 12 Dec 2023 13:33:54 +0100
Subject: [PATCH] [skip-CI] Yet another bug introduced yesterday
---
Modules/read_pseudo.f90 | 4 +---
upflib/read_fhi.f90 | 6 ++++--
upflib/read_ps.f90 | 3 ++-
upflib/read_psml.f90 | 3 ++-
upflib/read_upf_new.f90 | 3 ++-
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/Modules/read_pseudo.f90 b/Modules/read_pseudo.f90
index dbc0b22e0..fde5ae3b4 100644
--- a/Modules/read_pseudo.f90
+++ b/Modules/read_pseudo.f90
@@ -44,7 +44,7 @@ SUBROUTINE readpp ( input_dft, printout, ecutwfc_pp, ecutrho_pp )
USE mp, ONLY: mp_bcast
USE mp_images, ONLY: intra_image_comm
USE io_global, ONLY: stdout, ionode, ionode_id
- USE pseudo_types, ONLY: pseudo_upf, reset_upf, deallocate_pseudo_upf
+ USE pseudo_types, ONLY: pseudo_upf, deallocate_pseudo_upf
USE funct, ONLY: enforce_input_dft, set_dft_from_name, get_inlc
USE xc_lib, ONLY: xclib_get_id
USE radial_grids, ONLY: deallocate_radial_grid, nullify_radial_grid
@@ -88,8 +88,6 @@ SUBROUTINE readpp ( input_dft, printout, ecutwfc_pp, ecutrho_pp )
END IF
!
DO nt = 1, ntyp
- !
- CALL reset_upf( upf(nt) )
!
! try first pseudo_dir_cur if set: in case of restart from file,
! this is where PP files should be located
diff --git a/upflib/read_fhi.f90 b/upflib/read_fhi.f90
index 96129aa5e..da7733962 100644
--- a/upflib/read_fhi.f90
+++ b/upflib/read_fhi.f90
@@ -57,7 +57,8 @@ CONTAINS
!
IMPLICIT NONE
INTEGER, INTENT(in) :: iunps
- TYPE(pseudo_upf), INTENT(out) :: upf
+ TYPE(pseudo_upf), INTENT(inout) :: upf
+ ! INOUT because many variables are reset to default values in input
!
CALL read_fhi(iunps)
CALL convert_fhi(upf)
@@ -180,7 +181,8 @@ SUBROUTINE convert_fhi (upf)
!
IMPLICIT NONE
!
- TYPE(pseudo_upf), INTeNT(out) :: upf
+ TYPE(pseudo_upf), INTENT(inout) :: upf
+ ! INOUT because many variables are reset to default values in input
!
REAL(dp), ALLOCATABLE :: aux(:)
REAL(dp) :: vll
diff --git a/upflib/read_ps.f90 b/upflib/read_ps.f90
index 33655abad..8fc8d9ed5 100644
--- a/upflib/read_ps.f90
+++ b/upflib/read_ps.f90
@@ -24,7 +24,7 @@ SUBROUTINE read_ps_new ( psfile, upf, printout, ierr )
!! Should be executed on a single processor
!
USE upf_io, ONLY: stdout
- USE pseudo_types, ONLY: pseudo_upf
+ USE pseudo_types, ONLY: pseudo_upf, reset_upf
USE read_upf_v1_module, ONLY: read_upf_v1
USE read_upf_new_module,ONLY: read_upf_new
USE read_uspp_module, ONLY: readvan, readrrkj
@@ -40,6 +40,7 @@ SUBROUTINE read_ps_new ( psfile, upf, printout, ierr )
INTEGER :: iunps, l, lm3, lm4, lm5
!
!
+ CALL reset_upf( upf )
CALL read_upf_new( psfile, upf, ierr )
!
!! start reading - check first if file is readable as xml file
diff --git a/upflib/read_psml.f90 b/upflib/read_psml.f90
index 7c348d8c9..656d76ad3 100644
--- a/upflib/read_psml.f90
+++ b/upflib/read_psml.f90
@@ -41,8 +41,9 @@ CONTAINS
!
CHARACTER(len=*), INTENT(IN) :: filename
!! input : name of file in psml format
- TYPE(pseudo_upf), INTENT(OUT) :: upf
+ TYPE(pseudo_upf), INTENT(INOUT) :: upf
!! the derived type storing the pseudo data
+ !! INOUT because many variables are reset to default values in input
INTEGER, INTENT(OUT) :: ierr
!! error code (0 if correctly read)
CHARACTER(len=30) :: tag
diff --git a/upflib/read_upf_new.f90 b/upflib/read_upf_new.f90
index 993672d85..3ab761127 100644
--- a/upflib/read_upf_new.f90
+++ b/upflib/read_upf_new.f90
@@ -35,8 +35,9 @@ CONTAINS
IMPLICIT NONE
CHARACTER(len=*), INTENT(IN) :: filename
!! i/o filename
- TYPE(pseudo_upf),INTENT(OUT) :: upf
+ TYPE(pseudo_upf),INTENT(INOUT) :: upf
!! the derived type storing the pseudo data
+ !! INOUT because many variables are reset to default values in input
INTEGER, INTENT(OUT) :: ierr
!! ierr= -2 : UPF v.2
!! ierr= 0 : xml schema