Commit 67a8953b authored by Gregor Michalicek's avatar Gregor Michalicek

Output of eigenvalues into out.xml

parent 8b95dae3
......@@ -37,6 +37,7 @@ CONTAINS
USE m_ferhis
USE m_fergwt
USE m_types
USE m_xmlOutput
IMPLICIT NONE
TYPE(t_results),INTENT(INOUT) :: results
TYPE(t_mpi),INTENT(IN) :: mpi
......@@ -64,6 +65,7 @@ CONTAINS
INTEGER, ALLOCATABLE :: idxeig(:),idxjsp(:),idxkpt(:),INDEX(:)
REAL, ALLOCATABLE :: e(:),eig(:,:,:),we(:)
INTEGER ne(kpts%nkptd,SIZE(results%w_iks,3))
CHARACTER(LEN=20) :: attributes(5)
!--- J constants
!--- J constants
......@@ -133,15 +135,23 @@ CONTAINS
ENDIF
!---> pk non-collinear
!
DO jsp = 1,nspins
IF (mpi%irank == 0) CALL openXMLElementNoAttributes('eigenvalues')
DO jsp = 1,nspins
DO k = 1,kpts%nkpt
CALL read_eig(eig_id,k,jsp,neig=ne(k,jsp),eig=eig(:,k,jsp))
IF ( mpi%irank == 0 ) THEN
WRITE (6,'(a2,3f10.5,f12.6)') 'at',kpts%bk(:,k),kpts%wtkpt(k)
WRITE (6,'(i5,a14)') ne(k,jsp),' eigenvalues :'
WRITE (6,'(8f12.6)') (eig(i,k,jsp),i=1,ne(k,jsp))
attributes = ''
WRITE(attributes(1),'(i0)'), jsp
WRITE(attributes(2),'(i0)'), k
WRITE(attributes(3),'(f15.8)'), kpts%bk(1,k)
WRITE(attributes(4),'(f15.8)'), kpts%bk(2,k)
WRITE(attributes(5),'(f15.8)'), kpts%bk(3,k)
CALL writeXMLElementPoly('eigenvaluesAt',(/'spin','ikpt','k_x','k_y','k_z'/),attributes,eig(1:ne(k,jsp),k,jsp))
END IF
nv= -1
nv= -1
!
!---> STORE EIGENVALUES AND WEIGHTS IN A LINEAR LIST. AND MEMORIZE
!---> CONECTION TO THE ORIGINAL ARRAYS
......@@ -152,11 +162,13 @@ CONTAINS
idxeig(n+j) = j+n_help
idxkpt(n+j) = k
idxjsp(n+j) = jsp
ENDDO
END DO
!---> COUNT THE NUMBER OF EIGENVALUES
n = n + ne(k,jsp)
ENDDO
ENDDO
END DO
END DO
IF (mpi%irank == 0) CALL closeXMLElement('eigenvalues')
CALL sort(n,e,index)
! Check if no deep eigenvalue is found
......
......@@ -84,9 +84,11 @@ MODULE m_xmlOutput
TYPE IS(INTEGER)
WRITE(charAttributeValues(i),'(i0)'), attributeValues(i)
TYPE IS(REAL)
WRITE(charAttributeValues(i),'(f20.10)'), attributeValues(i)
WRITE(charAttributeValues(i),'(f19.10)'), attributeValues(i)
TYPE IS(LOGICAL)
WRITE(charAttributeValues(i),'(l1)'), attributeValues(i)
TYPE IS(CHARACTER(LEN=*))
WRITE(charAttributeValues(i),'(a)'), TRIM(ADJUSTL(attributeValues(i)))
CLASS DEFAULT
STOP 'Type of attributeValues not allowed'
END SELECT
......@@ -98,9 +100,11 @@ MODULE m_xmlOutput
TYPE IS(INTEGER)
WRITE(charContentList(i),'(i0)'), contentList(i)
TYPE IS(REAL)
WRITE(charContentList(i),'(f20.10)'), contentList(i)
WRITE(charContentList(i),'(f19.10)'), contentList(i)
TYPE IS(LOGICAL)
WRITE(charContentList(i),'(l1)'), contentList(i)
TYPE IS(CHARACTER(LEN=*))
WRITE(charContentList(i),'(a)'), TRIM(ADJUSTL(contentList(i)))
CLASS DEFAULT
STOP 'Type of contentList not allowed'
END SELECT
......@@ -152,7 +156,7 @@ MODULE m_xmlOutput
INTEGER :: i, j, contentLineLength, contentLineListSize
CHARACTER(LEN=70) :: format
CHARACTER(LEN=200) :: outputString
INTEGER :: contentListSize, overallListSize
INTEGER :: contentListSize, overallListSize, numContentLineChars
INTEGER :: lengthsShape(2)
IF(SIZE(attributeNames).NE.SIZE(attributeValues)) THEN
......@@ -201,8 +205,14 @@ MODULE m_xmlOutput
END IF
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(outputString))
IF(SIZE(contentLineList).GT.1) THEN
WRITE(format,'(a,i0,a)') "(a",3*(currentElementIndex+2),",a)"
DO i = 1, SIZE(contentLineList)
IF (i.EQ.SIZE(contentLineList)) THEN
numContentLineChars = 20*MOD(SIZE(contentList),contentLineLength)
IF(numContentLineChars.EQ.0) numContentLineChars = 20 * contentLineLength
WRITE(format,'(a,i0,a,i0,a)') "(a",3*(currentElementIndex+2),",a",numContentLineChars,")"
ELSE
WRITE(format,'(a,i0,a)') "(a",3*(currentElementIndex+2),",a100)"
END IF
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(contentLineList(i)))
END DO
WRITE(format,'(a,i0,a)') "(a",3*(currentElementIndex+1),",a)"
......@@ -256,7 +266,7 @@ MODULE m_xmlOutput
IF((i-1)*contentLineLength+j.GT.SIZE(contentList)) THEN
RETURN
END IF
contentLineList(i) = TRIM(ADJUSTL(contentLineList(i)))//' '//TRIM(ADJUSTL(contentList((i-1)*contentLineLength+j)))
WRITE(contentLineList(i),'(a,a20)') TRIM(ADJUSTL(contentLineList(i))), TRIM(ADJUSTL(contentList((i-1)*contentLineLength+j)))
END DO
END DO
END SUBROUTINE fillContentLineList
......@@ -299,9 +309,11 @@ MODULE m_xmlOutput
TYPE IS(INTEGER)
WRITE(charAttributeValues(i),'(i0)'), attributeValues(i)
TYPE IS(REAL)
WRITE(charAttributeValues(i),'(f20.10)'), attributeValues(i)
WRITE(charAttributeValues(i),'(f19.10)'), attributeValues(i)
TYPE IS(LOGICAL)
WRITE(charAttributeValues(i),'(l1)'), attributeValues(i)
TYPE IS(CHARACTER(LEN=*))
WRITE(charAttributeValues(i),'(a)'), TRIM(ADJUSTL(attributeValues(i)))
CLASS DEFAULT
STOP 'Type of attributeValues not allowed'
END SELECT
......
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