Commit 9bd46a7d authored by Robin Hilgers's avatar Robin Hilgers

StarLast commit before removing artifacts from the plotdop.f90 out of the plot.f90

parent 107935d7
......@@ -435,11 +435,11 @@ CONTAINS
nfile = 120
numInFiles = 1
numOutFiles = 1
numOutFiles = 1 !TODO: We can remove the variable completly if we want.
ALLOCATE(den(numInFiles))
! Read in charge/potential !DONE: I/O shut off
! Read in charge/potential !DONE: I/O shut off TODO: Is PotDen input implemented well?
!DO i = 1, numInFiles
! CALL den(i)%init(stars,atoms,sphhar,vacuum,noco,input%jspins,POTDEN_TYPE_DEN)
! IF(TRIM(ADJUSTL(cdnFilenames(i))).EQ.'cdn1') THEN
......@@ -508,12 +508,12 @@ CONTAINS
xsf=.TRUE.
!From now on an XSF file will ALWAYS be created.
IF (xsf) THEN
DO i = 1, numOutFiles
OPEN(nfile+i,file=TRIM(ADJUSTL(outFilenames(i)))//'.xsf',form='formatted')
!IF (xsf) THEN
!DO i = 1, numOutFiles
OPEN(nfile+1,file=TRIM(ADJUSTL(outFilenames(i)))//'.xsf',form='formatted')
CALL xsf_WRITE_atoms(nfile+i,atoms,input%film,oneD%odi%d1,cell%amat)
END DO
END IF
!END DO
!END IF
! Loop over all plots
DO nplo = 1, nplot
......@@ -545,18 +545,19 @@ CONTAINS
!END IF
!Open the file
IF (filename =="default") WRITE(filename,'(a,i2)') "plot",nplo
DO i = 1, numOutFiles
IF (xsf) THEN
CALL xsf_WRITE_header(nfile+i,twodim,filename,vec1,vec2,vec3,zero,grid)
ELSE
IF (numOutFiles.NE.1) THEN
OPEN (nfile+i,file = filename//outFilenames(i),form='formatted')
ELSE
OPEN (nfile+i,file = filename,form='formatted')
END IF
IF (filename =="default") WRITE(filename,'(a,i2)') "plot",nplo !Which role does "default" exactly play?
!DO i = 1, numOutFiles!numOutFiles=1 => Pointless loop
!IF (xsf) THEN!Pointless
CALL xsf_WRITE_header(nfile+1,twodim,filename,vec1,vec2,vec3,zero,grid)
!Will never be called again due to xsf=.TRUE.
! ELSE
! IF (numOutFiles.NE.1) THEN
! OPEN (nfile+i,file = filename//outFilenames(i),form='formatted')
! ELSE
! OPEN (nfile+i,file = filename,form='formatted')
! END IF
END IF
END DO
!END DO
!loop over spins
DO jsp = 1, input%jspins
......@@ -594,106 +595,106 @@ CONTAINS
pt(:) = point(:)
END IF
DO i = 1, numInFiles
CALL outcdn(pt,nt,na,iv,iflag,jsp,sliceplot,stars,&
!DO i = 1, numInFiles !pointless do Loop
CALL outcdn(pt,nt,na,iv,iflag,jsp,sliceplot,stars,&!TODO; We have to get rid of that but I need to understand EXACTLY whats happening here.
vacuum,sphhar,atoms,sym,cell,oneD,&
den(i)%pw,den(i)%vacxy,den(i)%mt,&
den(i)%vacz,xdnout(i))
END DO
IF (na.NE.0) THEN
IF (noco%l_ss) THEN
! rotate magnetization "backward"
angss = DOT_PRODUCT(qssc,pt-atoms%pos(:,na))
help(1) = xdnout(2)
help(2) = xdnout(3)
xdnout(2) = +help(1)*COS(angss)+help(2)*SIN(angss)
xdnout(3) = -help(1)*SIN(angss)+help(2)*COS(angss)
! xdnout(2)=0. ; xdnout(3)=0. ; xdnout(4)=0.
END IF
END IF
IF (noco%l_ss .AND. (.NOT. unwind)) THEN
! rotate magnetization
angss = DOT_PRODUCT(qssc,point)
help(1) = xdnout(2)
help(2) = xdnout(3)
xdnout(2) = +help(1)*COS(angss) -help(2)*SIN(angss)
xdnout(3) = +help(1)*SIN(angss) +help(2)*COS(angss)
END IF
IF (polar) THEN
xdnout(5) = SQRT(ABS(xdnout(2)**2+xdnout(3)**2+xdnout(4)**2))
IF (xdnout(5)<eps) THEN
xdnout(5)= 0.0
xdnout(6)= -tpi_const
xdnout(7)= -tpi_const
ELSE
DO j = 1, 3
help(j) = xdnout(1+j)/xdnout(5)
END DO
IF (help(3)<0.5) THEN
xdnout(6)= ACOS(help(3))
ELSE
xdnout(6)= pi_const/2.0-ASIN(help(3))
END IF
IF (SQRT(ABS(help(1)**2+help(2)**2)) < eps) THEN
xdnout(7)= -tpi_const
ELSE
IF ( ABS(help(1)) > ABS(help(2)) ) THEN
xdnout(7)= ABS(ATAN(help(2)/help(1)))
ELSE
xdnout(7)= pi_const/2.0-ABS(ATAN(help(1)/help(2)))
END IF
IF (help(2)<0.0) THEN
xdnout(7)= -xdnout(7)
END IF
IF (help(1)<0.0) THEN
xdnout(7)= pi_const-xdnout(7)
END IF
DO WHILE (xdnout(7)-pi_const*phi0 > +pi_const)
xdnout(7)= xdnout(7)-tpi_const
END DO
DO WHILE (xdnout(7)-pi_const*phi0 < -pi_const)
xdnout(7)= xdnout(7)+tpi_const
END DO
END IF
END IF
xdnout(6)= xdnout(6)/pi_const
xdnout(7)= xdnout(7)/pi_const
END IF ! (polar)
DO i = 1, numOutFiles
IF (xsf) THEN
WRITE(nfile+i,*) xdnout(i)
ELSE
WRITE(nfile+i,'(4e15.7)') point ,xdnout(i)
END IF
END DO
!END DO
!IF (na.NE.0) THEN!TODO: do it somewhere else.
! IF (noco%l_ss) THEN
! ! rotate magnetization "backward"
! angss = DOT_PRODUCT(qssc,pt-atoms%pos(:,na))
! help(1) = xdnout(2)
! help(2) = xdnout(3)
! xdnout(2) = +help(1)*COS(angss)+help(2)*SIN(angss)
! xdnout(3) = -help(1)*SIN(angss)+help(2)*COS(angss)
! ! xdnout(2)=0. ; xdnout(3)=0. ; xdnout(4)=0.
! END IF
!END IF
!IF (noco%l_ss .AND. (.NOT. unwind)) THEN !TODO: do it somewhere else.
! ! rotate magnetization
! angss = DOT_PRODUCT(qssc,point)
! help(1) = xdnout(2)
! help(2) = xdnout(3)
! xdnout(2) = +help(1)*COS(angss) -help(2)*SIN(angss)
! xdnout(3) = +help(1)*SIN(angss) +help(2)*COS(angss)
!END IF
!IF (polar) THEN!TODO: do it somewhere else.
! xdnout(5) = SQRT(ABS(xdnout(2)**2+xdnout(3)**2+xdnout(4)**2))
! IF (xdnout(5)<eps) THEN
! xdnout(5)= 0.0
! xdnout(6)= -tpi_const
! xdnout(7)= -tpi_const
! ELSE
! DO j = 1, 3
! help(j) = xdnout(1+j)/xdnout(5)
! END DO
! IF (help(3)<0.5) THEN
! xdnout(6)= ACOS(help(3))
! ELSE
! xdnout(6)= pi_const/2.0-ASIN(help(3))
! END IF
! IF (SQRT(ABS(help(1)**2+help(2)**2)) < eps) THEN
! xdnout(7)= -tpi_const
! ELSE
! IF ( ABS(help(1)) > ABS(help(2)) ) THEN
! xdnout(7)= ABS(ATAN(help(2)/help(1)))
! ELSE
! xdnout(7)= pi_const/2.0-ABS(ATAN(help(1)/help(2)))
! END IF
! IF (help(2)<0.0) THEN
! xdnout(7)= -xdnout(7)
! END IF
! IF (help(1)<0.0) THEN
! xdnout(7)= pi_const-xdnout(7)
! END IF
! DO WHILE (xdnout(7)-pi_const*phi0 > +pi_const)
! xdnout(7)= xdnout(7)-tpi_const
! END DO
! DO WHILE (xdnout(7)-pi_const*phi0 < -pi_const)
! xdnout(7)= xdnout(7)+tpi_const
! END DO
! END IF
! END IF
! xdnout(6)= xdnout(6)/pi_const
! xdnout(7)= xdnout(7)/pi_const
!END IF ! (polar)
!DO i = 1, numOutFiles!Pointless loop
!IF (xsf) THEN
WRITE(nfile+1,*) xdnout(i)
!ELSE !Will never be "Else" again
! WRITE(nfile+i,'(4e15.7)') point ,xdnout(i)
!END IF
!END DO
END DO
END DO
END DO !z-loop
DO i = 1, numOutFiles
!DO i = 1, numOutFiles !numOutFiles=1
IF (xsf.AND.jsp /= input%jspins) &
CALL xsf_WRITE_newblock(nfile+i,twodim,vec1,vec2,vec3,zero,grid)
END DO
END DO !Spin-loop
CALL xsf_WRITE_newblock(nfile+1,twodim,vec1,vec2,vec3,zero,grid)
!END DO
END DO !Spin-loop!Pointless
DO i = 1, numOutFiles
IF (xsf) THEN
!DO i = 1, numOutFiles
!IF (xsf) THEN
CALL xsf_WRITE_endblock(nfile+i,twodim)
ELSE
CLOSE(nfile+i)
END IF
END DO
!ELSE!Also Pointless
! CLOSE(nfile+i)
!END IF
!END DO
END DO !nplot
CLOSE(18)
IF (xsf) THEN
DO i = 1, numOutFiles
CLOSE(nfile+i)
END DO
CLOSE(18)!TODO: Keep 18?????
!IF (xsf) THEN!Pointless
!DO i = 1, numOutFiles!Pointless
CLOSE(nfile=1)
!END DO
END IF
DEALLOCATE(xdnout, cdnFilenames, outFilenames)
......
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