1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2! This module contains the following active subroutines: 3! InitPAW, DestroyPAW 4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5 6#if defined HAVE_CONFIG_H 7#include "config.h" 8#endif 9 10MODULE pseudodata 11 12 Use io_tools 13 Use gridmod 14 Use atomdata 15 16 IMPLICIT NONE 17 18 TYPE Pseudoinfo 19 CHARACTER(132) :: exctype 20 INTEGER :: lmax,irc,irc_shap,irc_vloc,irc_core,coretailpoints,mesh_size 21 INTEGER :: ivale,itau,ivion 22 CHARACTER(15) :: orthogonalization_scheme 23 CHARACTER(132) :: Vloc_description 24 CHARACTER(132) :: Proj_description 25 CHARACTER(132) :: Comp_description 26 LOGICAL :: multi_rc,poscorenhat 27 REAL(8) :: rc,rc_shap,rc_vloc,rc_core,energyoflmax,gausslength 28 REAL(8), POINTER :: rcio(:) 29 REAL(8), POINTER :: vloc(:),abinitvloc(:),abinitnohat(:) 30 REAL(8), POINTER :: rveff(:),AErefrv(:),rvx(:),trvx(:) 31 REAL(8), POINTER :: projshape(:),hatshape(:),hatden(:),hatpot(:) 32 REAL(8), POINTER :: den(:),tden(:),core(:),tcore(:),nhatv(:) 33 REAL(8), POINTER :: coretau(:),tcoretau(:) 34 REAL(8), POINTER :: valetau(:),tvaletau(:) 35 INTEGER :: nbase,ncoreshell 36 INTEGER, POINTER :: np(:),l(:),nodes(:),kappa(:) 37 INTEGER, POINTER :: rng(:) ! rng particularly of continuum states 38 CHARACTER(8), POINTER :: label(:) 39 REAL(8), POINTER :: phi(:,:),tphi(:,:),tp(:,:) ! before orthog 40 REAL(8), POINTER :: ophi(:,:),otphi(:,:),otp(:,:) ! after orthog 41 REAL(8), POINTER :: Kop(:,:) ! for storing K|phi> 42 REAL(8), POINTER :: eig(:),occ(:),ck(:),vrc(:) 43 REAL(8), POINTER :: oij(:,:),dij(:,:),wij(:,:) 44 !********** modified parameters for use with KS and HF 45 REAL(8), POINTER :: rVf(:),rtVf(:),g(:,:) 46 REAL(8), POINTER :: Kij(:,:),Vfij(:,:),mLij(:,:,:),DR(:,:,:,:,:) 47 REAL(8), POINTER :: DRVC(:,:,:),TXVC(:,:) ! now output for DFT also 48 REAL(8) :: XCORECORE ! output for DFT 49 INTEGER, POINTER :: valencemap(:) ! valencemap({occ. states})={basis} 50 Type(OrbitInfo), POINTER :: OCCwfn 51 Type(OrbitInfo), POINTER :: TOCCwfn 52 REAL(8) :: tkin,tion,tvale,txc,Ea,Etotal,Eaion,Eaionhat,Eaxc 53 REAL(8) :: VlocCoef,VlocRad 54 !***********for HF only 55 REAL(8), POINTER :: lmbd(:,:) !(Eq. 72) lmbd({occ. states},{basis states}) 56 REAL(8), POINTER :: DRC(:,:,:,:),mLic(:,:,:) 57 REAL(8), POINTER :: DRCC(:,:,:,:),DRCjkl(:,:,:,:,:),mLcc(:,:,:),Dcj(:,:) 58 REAL(8) :: coretol 59 END TYPE Pseudoinfo 60 61 CONTAINS 62 63 SUBROUTINE InitPAW(PAW,Grid,Orbit) 64 TYPE(GridInfo), INTENT(IN) :: Grid 65 TYPE(OrbitInfo), INTENT(IN) :: Orbit 66 Type(PseudoInfo), INTENT(INOUT) :: PAW 67 INTEGER :: io,l,n,mxbase,nbase,ok 68! Initialize logical variables 69 PAW%multi_rc=.false. 70 PAW%poscorenhat=.true. 71 CALL DestroyPAW(PAW) 72! Compute initial size of basis 73 n=Grid%n 74 nbase=0 75 DO l=0,PAW%lmax 76 DO io=1,Orbit%norbit ! cycle through all configurations 77 IF (Orbit%l(io).EQ.l.AND.(.NOT.Orbit%iscore(io))) THEN 78 nbase=nbase+1 79 ENDIF 80 ENDDO 81 ENDDO 82 mxbase=nbase+5*max(1,PAW%lmax) !Estimate excess 83 PAW%nbase=nbase 84 WRITE(STD_OUT,*) 'Found ', nbase,' valence basis functions ' 85 WRITE(STD_OUT,*) 'Allocating for ', mxbase, ' total basis functions' 86 ALLOCATE(PAW%projshape(n),PAW%hatden(n),PAW%hatpot(n),& 87& PAW%hatshape(n),PAW%vloc(n),PAW%rveff(n),PAW%abinitvloc(n),& 88& PAW%abinitnohat(n),PAW%AErefrv(n),PAW%rvx(n),PAW%trvx(n),& 89& PAW%den(n),PAW%tden(n),PAW%core(n),PAW%tcore(n),& 90& PAW%coretau(n),PAW%tcoretau(n),& 91& PAW%valetau(n),PAW%tvaletau(n),& 92& PAW%nhatv(n),stat=ok) 93 IF (ok/=0) STOP 'Allocation error 1 in InitPAW' 94 PAW%projshape=0.d0;PAW%hatden=0.d0;PAW%hatpot=0.d0 95 PAW%hatshape=0.d0;PAW%vloc=0.d0;PAW%rveff=0.d0 96 PAW%abinitvloc=0.d0;PAW%abinitnohat=0.d0 97 PAW%AErefrv=0.d0;PAW%rvx=0.d0;PAW%trvx=0.d0 98 PAW%den=0.d0;PAW%tden=0.d0;PAW%core=0.d0;PAW%tcore=0.d0 99 PAW%XCORECORE=0.d0;PAW%nhatv=0.d0 100 PAW%coretau=0.d0;PAW%tcoretau=0.d0 101 PAW%valetau=0.d0;PAW%tvaletau=0.d0 102 ALLOCATE(PAW%phi(n,mxbase),PAW%tphi(n,mxbase),PAW%tp(n,mxbase),& 103& PAW%ophi(n,mxbase),PAW%otphi(n,mxbase),PAW%otp(n,mxbase),& 104& PAW%np(mxbase),PAW%l(mxbase),PAW%eig(mxbase),PAW%occ(mxbase),& 105& PAW%ck(mxbase),PAW%vrc(mxbase),PAW%Kop(n,mxbase),PAW%rng(mxbase),& 106& PAW%rcio(mxbase),PAW%nodes(mxbase),stat=ok) 107 IF (ok/=0) STOP 'Allocation error 2 in InitPAW' 108 PAW%phi=0.d0;PAW%tphi=0.d0;PAW%tp=0.d0 109 PAW%ophi=0.d0;PAW%otphi=0.d0;PAW%otp=0.d0 110 PAW%eig=0.d0;PAW%occ=0.d0;PAW%vrc=0.d0;PAW%ck=0.d0;PAW%Kop=0.d0 111 PAW%rcio=0.d0;PAW%np=0;PAW%l=0 112 if(diracrelativistic) then 113 ALLOCATE(PAW%kappa(mxbase)) 114 PAW%kappa=0 115 endif 116 PAW%rng=Grid%n 117 ALLOCATE(PAW%oij(mxbase,mxbase),PAW%dij(mxbase,mxbase),& 118& PAW%wij(mxbase,mxbase), stat=ok) 119 IF (ok/=0) STOP 'Allocation error 3 in InitPAW' 120 PAW%oij=0.d0;PAW%dij=0.d0;PAW%wij=0.d0 121 ALLOCATE(PAW%rVf(n),PAW%rtVf(n),PAW%Kij(mxbase,mxbase),& 122& PAW%Vfij(mxbase,mxbase),stat=ok) 123 IF (ok/=0) STOP 'Allocation error 4 in InitPAW' 124 PAW%rVf=0.d0;PAW%rtVf=0.d0;PAW%Kij=0.d0;PAW%Vfij=0.d0 125 IF (Orbit%exctype=='HF') THEN 126 ALLOCATE(PAW%lmbd(Orbit%norbit,mxbase),stat=ok) 127 IF (ok/=0) STOP 'Allocation error 5 in InitPAW' 128 PAW%lmbd=0.d0 129 ELSE 130 nullify(PAW%lmbd) 131 ENDIF 132 ALLOCATE(PAW%valencemap(Orbit%norbit),stat=ok) 133 IF (ok/=0) STOP 'Allocation error 6 in InitPAW' 134 ALLOCATE(PAW%OCCwfn,PAW%TOCCwfn,stat=ok) 135 IF (ok/=0) STOP 'Allocation error 7 in InitPAW' 136 END SUBROUTINE InitPAW 137 138 Subroutine DestroyPAW(PAW) 139 Type(PseudoInfo), INTENT(INOUT) :: PAW 140 IF (ASSOCIATED(PAW%rcio)) DEALLOCATE(PAW%rcio) 141 If (ASSOCIATED(PAW%vloc)) DEALLOCATE(PAW%vloc) 142 If (ASSOCIATED(PAW%abinitvloc)) DEALLOCATE(PAW%abinitvloc) 143 If (ASSOCIATED(PAW%abinitnohat)) DEALLOCATE(PAW%abinitnohat) 144 If (ASSOCIATED(PAW%rveff)) DEALLOCATE(PAW%rveff) 145 If (ASSOCIATED(PAW%AErefrv)) DEALLOCATE(PAW%AErefrv) 146 If (ASSOCIATED(PAW%rvx)) DEALLOCATE(PAW%rvx) 147 If (ASSOCIATED(PAW%trvx)) DEALLOCATE(PAW%trvx) 148 If (ASSOCIATED(PAW%projshape)) DEALLOCATE(PAW%projshape) 149 If (ASSOCIATED(PAW%hatshape)) DEALLOCATE(PAW%hatshape) 150 If (ASSOCIATED(PAW%hatden)) DEALLOCATE(PAW%hatden) 151 If (ASSOCIATED(PAW%hatpot)) DEALLOCATE(PAW%hatpot) 152 If (ASSOCIATED(PAW%den)) DEALLOCATE(PAW%den) 153 If (ASSOCIATED(PAW%tden)) DEALLOCATE(PAW%tden) 154 If (ASSOCIATED(PAW%core)) DEALLOCATE(PAW%core) 155 If (ASSOCIATED(PAW%tcore)) DEALLOCATE(PAW%tcore) 156 If (ASSOCIATED(PAW%coretau)) DEALLOCATE(PAW%coretau) 157 If (ASSOCIATED(PAW%tcoretau)) DEALLOCATE(PAW%tcoretau) 158 If (ASSOCIATED(PAW%valetau)) DEALLOCATE(PAW%valetau) 159 If (ASSOCIATED(PAW%tvaletau)) DEALLOCATE(PAW%tvaletau) 160 If (ASSOCIATED(PAW%nhatv)) DEALLOCATE(PAW%nhatv) 161 If (ASSOCIATED(PAW%np)) DEALLOCATE(PAW%np) 162 If (ASSOCIATED(PAW%l)) DEALLOCATE(PAW%l) 163 If (ASSOCIATED(PAW%nodes)) DEALLOCATE(PAW%nodes) 164 If (ASSOCIATED(PAW%kappa)) DEALLOCATE(PAW%kappa) 165 If (ASSOCIATED(PAW%rng)) DEALLOCATE(PAW%rng) 166 If (ASSOCIATED(PAW%label)) DEALLOCATE(PAW%label) 167 If (ASSOCIATED(PAW%phi)) DEALLOCATE(PAW%phi) 168 If (ASSOCIATED(PAW%tphi)) DEALLOCATE(PAW%tphi) 169 If (ASSOCIATED(PAW%tp)) DEALLOCATE(PAW%tp) 170 If (ASSOCIATED(PAW%ophi)) DEALLOCATE(PAW%ophi) 171 If (ASSOCIATED(PAW%otphi)) DEALLOCATE(PAW%otphi) 172 If (ASSOCIATED(PAW%otp)) DEALLOCATE(PAW%otp) 173 If (ASSOCIATED(PAW%Kop)) DEALLOCATE(PAW%Kop) 174 If (ASSOCIATED(PAW%eig)) DEALLOCATE(PAW%eig) 175 If (ASSOCIATED(PAW%occ)) DEALLOCATE(PAW%occ) 176 If (ASSOCIATED(PAW%ck)) DEALLOCATE(PAW%ck) 177 If (ASSOCIATED(PAW%vrc)) DEALLOCATE(PAW%vrc) 178 If (ASSOCIATED(PAW%oij)) DEALLOCATE(PAW%oij) 179 If (ASSOCIATED(PAW%dij)) DEALLOCATE(PAW%dij) 180 If (ASSOCIATED(PAW%wij)) DEALLOCATE(PAW%wij) 181 If (ASSOCIATED(PAW%rVf)) DEALLOCATE(PAW%rVf) 182 If (ASSOCIATED(PAW%rtVf)) DEALLOCATE(PAW%rtVf) 183 If (ASSOCIATED(PAW%g)) DEALLOCATE(PAW%g) 184 If (ASSOCIATED(PAW%Kij)) DEALLOCATE(PAW%Kij) 185 If (ASSOCIATED(PAW%Vfij)) DEALLOCATE(PAW%Vfij) 186 If (ASSOCIATED(PAW%mLij)) DEALLOCATE(PAW%mLij) 187 If (ASSOCIATED(PAW%DR)) DEALLOCATE(PAW%DR) 188 If (ASSOCIATED(PAW%DRVC)) DEALLOCATE(PAW%DRVC) 189 If (ASSOCIATED(PAW%TXVC)) DEALLOCATE(PAW%TXVC) 190 If (ASSOCIATED(PAW%valencemap)) DEALLOCATE(PAW%valencemap) 191 If (ASSOCIATED(PAW%lmbd)) DEALLOCATE(PAW%lmbd) 192 If (ASSOCIATED(PAW%DRC)) DEALLOCATE(PAW%DRC) 193 If (ASSOCIATED(PAW%DRCC)) DEALLOCATE(PAW%DRCC) 194 If (ASSOCIATED(PAW%DRCjkl)) DEALLOCATE(PAW%DRCjkl) 195 If (ASSOCIATED(PAW%mLic)) DEALLOCATE(PAW%mLic) 196 If (ASSOCIATED(PAW%mLcc)) DEALLOCATE(PAW%mLcc) 197 If (ASSOCIATED(PAW%Dcj)) DEALLOCATE(PAW%Dcj) 198 If (ASSOCIATED(PAW%OCCwfn)) then 199 call DestroyOrbit(PAW%OCCwfn) 200 DEALLOCATE(PAW%OCCwfn) 201 end if 202 If (ASSOCIATED(PAW%TOCCwfn)) then 203 call DestroyOrbit(PAW%TOCCwfn) 204 DEALLOCATE(PAW%TOCCwfn) 205 end if 206 End Subroutine DestroyPAW 207 208End module pseudodata 209