TABLE OF CONTENTS
ABINIT/rdnpw [ Functions ]
NAME
rdnpw
FUNCTION
Read the line that contains npw from a kg file (option=0) or wf file (option=1 or option==2). Then, skip the next line. Also performs some checks, related to npw_k and nband_k. The arguments ikpt and isppol are only needed for the error message
COPYRIGHT
Copyright (C) 1998-2018 ABINIT group (XG) This file is distributed under the terms of the GNU General Public License, see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt .
INPUTS
ikpt=index of current k point (needed for error message) isppol=spin polarization currently treated (needed for error message) nband_k=number of bands at this k-point (input if option==0 or option==1) npw_k=number of plane waves at this k-point (input if option==0 or option==1) option=if 0, read a kg file; if 1 or 2, read a wf file this is important for the content of the line and error messages if option=2, no checking unitfile=unit of the file to be read
OUTPUT
if option==2, npw_k, nspinor and nband_k are output
SIDE EFFECTS
nspinor=number of spinorial components of the wavefunctions (input if option==0 or option==1)
NOTES
PARENTS
newkpt
CHILDREN
SOURCE
44 #if defined HAVE_CONFIG_H 45 #include "config.h" 46 #endif 47 48 #include "abi_common.h" 49 50 51 subroutine rdnpw(ikpt,isppol,nband_k,npw_k,nspinor,option,unitfile) 52 53 use defs_basis 54 use m_errors 55 use m_profiling_abi 56 57 !This section has been created automatically by the script Abilint (TD). 58 !Do not modify the following lines by hand. 59 #undef ABI_FUNC 60 #define ABI_FUNC 'rdnpw' 61 !End of the abilint section 62 63 implicit none 64 65 !Arguments ------------------------------------ 66 !scalars 67 integer,intent(in) :: ikpt,isppol,option,unitfile 68 integer,intent(inout) :: nband_k,npw_k,nspinor 69 70 !Local variables------------------------------- 71 !scalars 72 integer :: ierr,nband_disk,npw_disk,nspinor_disk 73 character(len=500) :: message 74 75 ! ************************************************************************* 76 77 !DEBUG 78 !write(std_out,*) ' rdnpw : enter, debug, unitfile= ',unitfile 79 !ENDDEBUG 80 81 nband_disk=0 82 if(option==0) read(unitfile,IOSTAT=ierr)npw_disk 83 if(option==1 .or. option==2) read(unitfile,IOSTAT=ierr)npw_disk,nspinor_disk,nband_disk 84 85 if(ierr/=0)then 86 write(message, '(a,i0,a,i0)' )' Reading npw record of disk file unit',unitfile,', gives iostat=',ierr 87 MSG_BUG(message) 88 end if 89 90 !DEBUG 91 !write(std_out,*) ' rdnpw : option,npw_disk,nspinor_disk,nband_disk=',option,npw_disk,nspinor_disk,nband_disk 92 !ENDDEBUG 93 94 if(option==0)then 95 96 ! Check agreement with npw_k 97 if (npw_k/=npw_disk) then 98 write(message, '(a,i5,a,i2,3a,i6,a,i6,2a,i6,a)' )& 99 & ' At k point number',ikpt,', with spin polarization',isppol,',',ch10,& 100 & ' for kg disk file unit',unitfile,', the value of npw_disk=',npw_disk,ch10,& 101 & ' disagrees with argument npw_k=',npw_k,'. IO problem.' 102 MSG_BUG(message) 103 end if 104 105 else if(option==1)then 106 107 ! Check agreement with npw_k 108 if (npw_k/=npw_disk) then 109 write(message, '(a,i5,a,i2,a,a,a,i6,a,i6,a,a,i6,a)' )& 110 & ' At k point number',ikpt,', with spin polarization',isppol,',',ch10,& 111 & ' for wf file unit',unitfile,', the value of npw_disk=',npw_disk,ch10,& 112 & ' disagrees with argument npw_k=',npw_k,'. IO problem.' 113 MSG_BUG(message) 114 end if 115 116 ! Check agreement with nspinor 117 if (nspinor/=nspinor_disk) then 118 write(message, '(a,i5,a,i2,a,a,a,i6,a,i6,a,a,i6,a)' )& 119 & ' At k point number',ikpt,', with spin polarization',isppol,',',ch10,& 120 & ' for wf file unit',unitfile,', the value of nspinor_disk=',nspinor_disk,ch10,& 121 & ' disagrees with argument nspinor=',nspinor,'. IO problem.' 122 MSG_BUG(message) 123 end if 124 125 ! Check agreement with nband_k 126 if (nband_k/=nband_disk) then 127 write(message, '(a,i5,a,i2,3a,i6,a,i6,2a,i6,a)' )& 128 & ' At k point number',ikpt,', with spin polarization',isppol,',',ch10,& 129 & ' for wf file unit',unitfile,', the value of nband_disk=',nband_disk,ch10,& 130 & ' disagrees with argument nband_k=',nband_k,'. IO problem.' 131 MSG_BUG(message) 132 end if 133 134 else if(option==2)then 135 136 npw_k=npw_disk 137 nspinor=nspinor_disk 138 nband_k=nband_disk 139 140 else 141 write(message, '(a,i0)' )' Only option=0, 1 or 2 are allowed, while option=',option 142 MSG_BUG(message) 143 end if 144 145 !Skip the next line (k+G) 146 read(unitfile,IOSTAT=ierr) 147 148 if(ierr/=0)then 149 write(message, '(a,i0,a,i0)' )' Reading next record of disk file unit',unitfile,', gives iostat=',ierr 150 MSG_BUG(message) 151 end if 152 153 end subroutine rdnpw