Commit 9c1b50b8 authored by Daniel Wortmann's avatar Daniel Wortmann

Added Output to DMI mode

parent 0f9c1c4e
......@@ -2,7 +2,7 @@ MODULE m_ssomat
USE m_judft
IMPLICIT NONE
CONTAINS
SUBROUTINE ssomat(seigvso,theta,phi,eig_id,atoms,kpts,sym,&
SUBROUTINE ssomat(seigvso,h_so,theta,phi,eig_id,atoms,kpts,sym,&
cell,noco,nococonv, input,mpi, oneD,enpara,v,results )
USE m_types_nococonv
USE m_types_mat
......@@ -37,6 +37,7 @@ CONTAINS
INTEGER,INTENT(IN) :: eig_id
REAL,INTENT(in) :: theta(:),phi(:) ! more than a single angle at once...
REAL,INTENT(OUT) :: seigvso(:)
REAL,INTENT(OUT) :: h_so(:,:)
! ..
! .. Locals ..
#ifdef CPP_MPI
......@@ -50,7 +51,7 @@ CONTAINS
COMPLEX :: c1,c2
COMPLEX, ALLOCATABLE :: matel(:,:,:)
REAL, ALLOCATABLE :: eig_shift(:,:,:)
REAL, ALLOCATABLE :: eig_shift(:,:,:,:)
COMPLEX, ALLOCATABLE :: acof(:,:,:,:,:), bcof(:,:,:,:,:)
COMPLEX, ALLOCATABLE :: ccof(:,:,:,:,:,:)
......@@ -68,7 +69,7 @@ CONTAINS
! needed directly for calculating matrix elements
seigvso=0.0
ALLOCATE(eig_shift(input%neig,kpts%nkpt,SIZE(theta)));eig_shift=0.0
ALLOCATE(eig_shift(input%neig,kpts%nkpt,0:atoms%ntype,SIZE(theta)));eig_shift=0.0
ALLOCATE( acof(input%neig,0:atoms%lmaxd*(atoms%lmaxd+2),atoms%nat,2,2),&
bcof(input%neig,0:atoms%lmaxd*(atoms%lmaxd+2),atoms%nat,2,2) )
ALLOCATE( ccof(-atoms%llod:atoms%llod,input%neig,atoms%nlod,atoms%nat,2,2) )
......@@ -98,9 +99,9 @@ CONTAINS
zmat%l_real=.FALSE.
IF (ALLOCATED(zmat%data_c)) DEALLOCATE(zmat%data_c)
ALLOCATE(zmat%data_c(zMat%matsize1,zmat%matsize2))
CALL read_eig(eig_id,nk,1,neig=ne,eig=eig_shift(:,nk,1),zmat=zmat)
CALL read_eig(eig_id,nk,1,neig=ne,eig=eig_shift(:,0,nk,1),zmat=zmat)
DO jsloc= 1,2
eig_shift(:,nk,1)=0.0 !not needed
eig_shift(:,0,nk,1)=0.0 !not needed
CALL abcof(input,atoms,sym, cell,lapw,ne,usdus,noco,nococonv,jsloc,oneD, &
acof(:,:,:,jsloc,1),bcof(:,:,:,jsloc,1),ccof(:,:,:,:,jsloc,1),zMat)
ENDDO
......@@ -154,7 +155,7 @@ CONTAINS
acof,bcof, ccof,&
acof,bcof, ccof,&
matel )
eig_shift(:,nk,nr)=matel(1,:,0)
eig_shift(:,0:,nk,nr)=matel(1,:,0:)
ENDDO
ENDDO
......@@ -166,12 +167,15 @@ CONTAINS
CALL MPI_REDUCE(eig_shift,eig_shift,SIZE(eig_shift),MPI_DOUBLE_PRECISION,MPI_SUM,0,mpi%mpi_comm,ierr)
ENDIF
#endif
h_so=0.0
IF (mpi%irank==0) THEN
!Sum all shift using weights
DO nr=1,SIZE(theta)
DO nk=1,kpts%nkpt
seigvso(nr)=seigvso(nr)+dot_PRODUCT(results%w_iks(:,nk,1),eig_shift(:,nk,nr))
seigvso(nr)=seigvso(nr)+dot_PRODUCT(results%w_iks(:,nk,1),eig_shift(:,0,nk,nr))
DO n=0,atoms%ntype
H_so(n,nr)=H_so(n,nr)+dot_PRODUCT(results%w_iks(:,nk,1),eig_shift(:,n,nk,nr))
enddo
ENDDO
ENDDO
seigvso= results%seigv+seigvso
......
......@@ -16,6 +16,7 @@ MODULE m_types_dmi
REAL,ALLOCATABLE:: theta(:)
REAL,ALLOCATABLE:: phi(:)
REAL,ALLOCATABLE:: evsum(:,:)
REAL,ALLOCATABLE:: h_so(:,:,:)
CONTAINS
PROCEDURE :: start =>dmi_start
PROCEDURE :: next_job=>dmi_next_job
......@@ -28,13 +29,14 @@ MODULE m_types_dmi
CONTAINS
SUBROUTINE dmi_init(this,q,theta,phi)
SUBROUTINE dmi_init(this,q,theta,phi,ntype)
USE m_calculator
USE m_constants
IMPLICIT NONE
CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
REAL,INTENT(in) :: q(:,:)
REAL,INTENT(IN) :: theta(:),phi(:)
INTEGER,INTENT(IN) :: ntype
this%theta=theta
this%phi=phi
......@@ -51,7 +53,9 @@ CONTAINS
this%qvec=q
ALLOCATE(this%evsum(0:SIZE(this%phi),SIZE(q,2)))
this%evsum=0
ALLOCATE(this%h_so(0:ntype,0:SIZE(this%phi),SIZE(q,2)))
this%evsum=0;this%h_so=0.0
END SUBROUTINE dmi_init
SUBROUTINE dmi_start(this,potden,l_io)
......@@ -105,8 +109,9 @@ CONTAINS
CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
!Locals
INTEGER:: n,q
INTEGER:: n,q,i
CHARACTER(LEN=12):: attributes(4)
CHARACTER(LEN=16) :: atom_name
IF (this%q_done==0) RETURN
IF (this%l_io) THEN
!Now output the results
......@@ -121,8 +126,14 @@ CONTAINS
WRITE(attributes(2),'(f12.7)') this%theta(n)
WRITE(attributes(3),'(f12.7)') this%phi(n)
WRITE(attributes(4),'(f12.7)') this%evsum(n,q)
CALL writeXMLElementForm('Entry',(/'q ','theta ','phi ','ev-sum'/),attributes,&
RESHAPE((/1,5,3,6,5,12,12,12/),(/4,2/)))
CALL writeXMLElementForm('Entry',(/'q ','theta ','phi ','ev-sum'/),attributes,RESHAPE((/1,5,3,6,5,12,12,12/),(/4,2/)))
write(attributes(4),'(f12.7)') this%h_so(0,n,q)
CALL writeXMLElementForm('All atoms',(/'q ','theta ','phi ','<H_so>'/),attributes,RESHAPE((/1,5,3,6,5,12,12,12/),(/4,2/)))
DO i=1,size(this%h_so,1)-1
write(attributes(4),'(f12.7)') this%h_so(i,n,q)
write(atom_name,'(a,i0)') "Atom type:",i
CALL writeXMLElementForm(atom_name,(/'q ','theta ','phi ','<H_so>'/),attributes,RESHAPE((/1,5,3,6,5,12,12,12/),(/4,2/)))
ENDDO
END DO
ENDDO
CALL closeXMLElement('Forcetheorem_DMI')
......@@ -137,7 +148,7 @@ CONTAINS
CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
TYPE(t_mpi),INTENT(in):: mpi
INTEGER:: i,q,ierr
INTEGER:: i,q,ierr,n
#ifdef CPP_MPI
INCLUDE 'mpif.h'
IF (mpi%irank==0) i=SIZE(this%theta)
......@@ -145,6 +156,9 @@ CONTAINS
IF (mpi%irank==0) q=SIZE(this%qvec,2)
CALL MPI_BCAST(q,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
IF (mpi%irank.NE.0) ALLOCATE(this%qvec(3,q),this%phi(i),this%theta(i),this%evsum(0:i,q));this%evsum=0.0
if (mpi%irank==0) n=size(this%h_so,1)-1
call MPI_BCAST(n,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
IF (mpi%irank.NE.0) ALLOCATE(this%h_so(0:n,0:i,q));this%h_so=0.0
CALL MPI_BCAST(this%phi,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(this%theta,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(this%qvec,3*q,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
......@@ -177,7 +191,7 @@ CONTAINS
IF (this%q_done==0) RETURN
this%evsum(0,this%q_done)=results%seigv
CALL ssomat(this%evsum(1:,this%q_done),this%theta,this%phi,eig_id,atoms,kpts,sym,&
CALL ssomat(this%evsum(1:,this%q_done),this%h_so(:,:,this%q_done),this%theta,this%phi,eig_id,atoms,kpts,sym,&
cell,noco,nococonv, input,mpi, oneD,enpara,v,results)
skip=.TRUE.
END FUNCTION dmi_eval
......
......@@ -6,7 +6,7 @@
MODULE m_make_forcetheo
implicit none
contains
subroutine make_forcetheo(forcetheo_data,cell,sym,atoms,forcetheo)
use m_types
......@@ -16,7 +16,7 @@ contains
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_forcetheo_data),INTENT(IN):: forcetheo_data
CLASS(t_forcetheo),ALLOCATABLE,INTENT(OUT):: forcetheo
!Finish setup of forcetheorem
SELECT CASE (forcetheo_data%mode)
CASE(1)
......@@ -30,12 +30,12 @@ contains
CASE default
ALLOCATE(t_forcetheo::forcetheo)
END SELECT
SELECT TYPE(forcetheo)
TYPE IS(t_forcetheo_mae)
CALL forcetheo%init(forcetheo_data%theta,forcetheo_data%phi,cell,sym)
TYPE IS(t_forcetheo_dmi)
CALL forcetheo%init(forcetheo_data%qvec,forcetheo_data%theta,forcetheo_data%phi)
CALL forcetheo%init(forcetheo_data%qvec,forcetheo_data%theta,forcetheo_data%phi,atoms%ntype)
TYPE IS(t_forcetheo_jij)
CALL forcetheo%init(forcetheo_data%qvec,forcetheo_data%theta(1),atoms)
TYPE IS(t_forcetheo_ssdisp)
......
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