Commit 8247151a authored by Robin Hilgers's avatar Robin Hilgers

Included user friendly errors

parent fb1d8c09
......@@ -49,7 +49,7 @@ SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
! Local Scalars
COMPLEX :: rhodummy, imPart12, realPart12
REAL :: rhodumms,fermiEnergyTemp, realPart1, realPart2, imPart1,imPart2
REAL :: rhodumms,fermiEnergyTemp, realPart1, realPart2, imPart1,imPart2, rhodummyR
INTEGER :: i,nt,j,lh,na,mp,ispin,urec,itype,m,i_u
INTEGER :: archiveType
LOGICAL :: n_exist,l_qfix,l_error, l_flip(atoms%ntype)
......@@ -79,14 +79,26 @@ SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
! spherical and non-spherical m.t. charge density
DO lh = 0,sphhar%nlh(atoms%ntypsy(na))
DO j = 1,atoms%jri(itype)
rhodummy=CMPLX(den%mt(j,lh,itype,3),0)
CALL rot_den_mat(atoms%flipSpinPhi(itype),atoms%flipSpinTheta(itype),den%mt(j,lh,itype,1),den%mt(j,lh,itype,2),rhodummy)
den%mt(j,lh,itype,3)=REAL(rhodummy)
IF (noco%l_mtNocoPot) THEN
rhodummy=CMPLX(den%mt(j,lh,itype,3),0)
CALL rot_den_mat(atoms%flipSpinPhi(itype),atoms%flipSpinTheta(itype),den%mt(j,lh,itype,1),den%mt(j,lh,itype,2),rhodummy)
den%mt(j,lh,itype,3)=REAL(rhodummy)
ELSE
IF (atoms%flipSpinTheta(itype).EQ.180.AND.atoms%flipSpinPhi(itype).EQ.0) THEN
rhodummyR = den%mt(j,lh,itype,1)
den%mt(j,lh,itype,1) = den%mt(j,lh,itype,input%jspins)
den%mt(j,lh,itype,input%jspins) = rhodummyR
ELSE
!Since in non-noco case the den-matrices are only initialized with two diagonal components we cannot perform flips where off-diagonal elements arise in non-noco case => Only rotations by 180 degrees are allowed.
CALL judft_error("l_mtNocoPot=F in combination with spin flips different from flipSpinTheta=180, flipSpinPhi=0 is meaningless",&
calledby="flipcdn")
DO lh = 0,sphhar%nlh(atoms%ntypsy(na))
END IF
END IF
END DO
END DO
ELSE IF (l_flip(itype).AND.atoms%flipSpinScale(itype)) THEN
IF((atoms%flipSpinTheta(itype).NE.0.0 .OR.atoms%flipSpinPhi(itype).NE.0.0)) CALL judft_error("Spinscaling in combination with flipSpin is currently only implemented using flipSpinTheta=flipSpinPhi=0.0", calledby="flipcdn")
IF((atoms%flipSpinTheta(itype).NE.180 .OR.atoms%flipSpinPhi(itype).NE.0.0)) CALL judft_error("Spinscaling in combination with flipSpin is currently only implemented using flipSpinTheta=180.0 and flipSpinPhi=0.0",calledby="flipcdn")
DO lh = 0,sphhar%nlh(atoms%ntypsy(na))
DO j = 1,atoms%jri(itype)
rhodummy = den%mt(j,lh,itype,1) + den%mt(j,lh,itype,input%jspins)
......@@ -106,27 +118,39 @@ SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
IF (l_flip(itype).AND.(.NOT.atoms%flipSpinScale(itype))) THEN
DO m = -3,3
DO mp = -3,3
IF (noco%l_mtNocoPot) THEN
! Since den%mmpMat is complex but rot_den_mat can only handle real values as diagonals of den_mat a splitting of den%mmpMat in real and imaginary part is performed. Rotations are performed seperatly and added up afterwards.
realPart1=REAL(den%mmpMat(m,mp,i_u,1))
realPart2=REAL(den%mmpMat(m,mp,i_u,2))
realPart12=CMPLX(REAL(den%mmpMat(m,mp,i_u,3)),0)
imPart1=AIMAG(den%mmpMat(m,mp,i_u,1))
imPart2=AIMAG(den%mmpMat(m,mp,i_u,2))
imPart12=CMPLX(0,AIMAG(den%mmpMat(m,mp,i_u,3)))
CALL rot_den_mat(atoms%flipSpinPhi(itype),atoms%flipSpinTheta(itype),realPart1,realPart2,&
realPart12)
CALL rot_den_mat(atoms%flipSpinPhi(itype),atoms%flipSpinTheta(itype),imPart1,imPart2,&
imPart12)
den%mmpMat(m,mp,i_u,1)=CMPLX(realPart1,imPart1)
den%mmpMat(m,mp,i_u,2)=CMPLX(realPart2,imPart2)
den%mmpMat(m,mp,i_u,3)=realPart12+imPart12
END DO
realPart1=REAL(den%mmpMat(m,mp,i_u,1))
realPart2=REAL(den%mmpMat(m,mp,i_u,2))
realPart12=CMPLX(REAL(den%mmpMat(m,mp,i_u,3)),0)
imPart1=AIMAG(den%mmpMat(m,mp,i_u,1))
imPart2=AIMAG(den%mmpMat(m,mp,i_u,2))
imPart12=CMPLX(0,AIMAG(den%mmpMat(m,mp,i_u,3)))
CALL rot_den_mat(atoms%flipSpinPhi(itype),atoms%flipSpinTheta(itype),realPart1,realPart2,&
realPart12)
CALL rot_den_mat(atoms%flipSpinPhi(itype),atoms%flipSpinTheta(itype),imPart1,imPart2,&
imPart12)
den%mmpMat(m,mp,i_u,1)=CMPLX(realPart1,imPart1)
den%mmpMat(m,mp,i_u,2)=CMPLX(realPart2,imPart2)
den%mmpMat(m,mp,i_u,3)=realPart12+imPart12
ELSE
IF (atoms%flipSpinTheta(itype).EQ.180.AND.atoms%flipSpinPhi(itype).EQ.0) THEN
rhodummyR = den%mmpMat(m,mp,i_u,1)
den%mmpMat(m,mp,i_u,1) = den%mmpMat(m,mp,i_u,input%jspins)
den%mmpMat(m,mp,i_u,input%jspins) = rhodummyR
ELSE
!Since in non-noco case the den-matrices are only initialized with two diagonal components we cannot perform flips where off-diagonal elements arise in non-noco case => Only rotations by 180 degrees are allowed.
CALL judft_error("l_mtNocoPot=F in combination with spin flips different from flipSpinTheta=180, flipSpinPhi=0 is meaningless",&
calledby="flipcdn")
END IF
END IF
END DO
END DO
ELSE IF (l_flip(itype).AND.(atoms%flipSpinScale(itype))) THEN
DO m = -3,3
DO mp = -3,3
IF((atoms%flipSpinTheta(itype).NE.0.0 .OR.atoms%flipSpinPhi(itype).NE.0.0)) CALL judft_error("Spinscaling in combination with flipSpin is currently only implemented using flipSpinTheta=flipSpinPhi=0.0",&
calledby="flipcdn")
IF((atoms%flipSpinTheta(itype).NE.180 .OR.atoms%flipSpinPhi(itype).NE.0.0)) CALL judft_error("Spinscaling in combination with flipSpin is currently only implemented using flipSpinTheta=180.0 and flipSpinPhi=0.0",calledby="flipcdn")
rhodummy = den%mmpMat(m,mp,i_u,1) + den%mmpMat(m,mp,i_u,input%jspins)
rhodumms = den%mmpMat(m,mp,i_u,1) - den%mmpMat(m,mp,i_u,input%jspins)
den%mmpMat(m,mp,i_u,1) = 0.5 * (rhodummy + atoms%bmu(itype) * rhodumms)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment