LCOV - code coverage report
Current view: top level - forcetheorem - dmi.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 65 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 8 0.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : MODULE m_types_dmi
       8             : 
       9             :   USE m_types
      10             :   USE m_types_forcetheo
      11             :   USE m_judft
      12             :   TYPE,EXTENDS(t_forcetheo) :: t_forcetheo_dmi
      13             :      INTEGER :: q_done
      14             :      REAL,ALLOCATABLE:: qvec(:,:)
      15             :      REAL,ALLOCATABLE:: theta(:)
      16             :      REAL,ALLOCATABLE:: phi(:)
      17             :      REAL,ALLOCATABLE:: evsum(:,:)
      18             :    CONTAINS
      19             :      PROCEDURE :: start   =>dmi_start
      20             :      PROCEDURE :: next_job=>dmi_next_job 
      21             :      PROCEDURE :: eval    =>dmi_eval
      22             :      PROCEDURE :: postprocess => dmi_postprocess
      23             :      PROCEDURE :: init   => dmi_init !not overloaded
      24             :      PROCEDURE :: dist   => dmi_dist !not overloaded
      25             :   END TYPE t_forcetheo_dmi
      26             : 
      27             : CONTAINS
      28             : 
      29           0 :   SUBROUTINE dmi_init(this,q,theta_s,phi_s)
      30             :     USE m_calculator
      31             :     USE m_constants
      32             :     IMPLICIT NONE
      33             :     CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
      34             :     REAL,INTENT(in)                     :: q(:,:)
      35             :     CHARACTER(len=*),INTENT(INOUT)      :: theta_s,phi_s
      36             : 
      37           0 :     CALL evaluateList(this%theta,theta_s)
      38           0 :     CALL evaluateList(this%phi,phi_s)
      39             : 
      40           0 :     IF (SIZE(this%phi).NE.SIZE(this%theta)) CALL &
      41           0 :          judft_error("Lists for theta/phi must have the same length in DMI force theorem calculations")
      42             : 
      43             :     ! use same definition of rotation angles as in noco-routines 
      44           0 :     this%theta=-this%theta
      45           0 :     this%phi=this%phi+pi_const
      46             :     
      47             :     
      48           0 :     ALLOCATE(this%qvec(3,SIZE(q,2)))
      49           0 :     this%qvec=q
      50             :     
      51           0 :     ALLOCATE(this%evsum(0:SIZE(this%phi),SIZE(q,2)))
      52           0 :     this%evsum=0
      53           0 :   END SUBROUTINE dmi_init
      54             : 
      55           0 :   SUBROUTINE dmi_start(this,potden,l_io)
      56             :     USE m_types_potden
      57             :     IMPLICIT NONE
      58             :     CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
      59             :     TYPE(t_potden) ,INTENT(INOUT)       :: potden
      60             :     LOGICAL,INTENT(IN)                  :: l_io
      61           0 :     this%q_done=0
      62           0 :     CALL this%t_forcetheo%start(potden,l_io) !call routine of basis type
      63           0 :   END SUBROUTINE  dmi_start
      64             : 
      65           0 :   LOGICAL FUNCTION dmi_next_job(this,lastiter,atoms,noco)
      66             :     USE m_types_setup
      67             :     USE m_xmlOutput
      68             :     USE m_constants
      69             :     IMPLICIT NONE
      70             :     CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
      71             :     LOGICAL,INTENT(IN)                  :: lastiter
      72             :     TYPE(t_atoms),INTENT(IN)            :: atoms
      73             :     !Stuff that might be modified...
      74             :     TYPE(t_noco),INTENT(INOUT) :: noco
      75             :     INTEGER                    :: itype
      76           0 :     IF (.NOT.lastiter) THEN
      77           0 :        dmi_next_job=this%t_forcetheo%next_job(lastiter,atoms,noco)
      78           0 :        RETURN
      79             :     ENDIF
      80             :     !OK, now we start the DMI-loop
      81           0 :     this%q_done=this%q_done+1
      82           0 :     dmi_next_job=(this%q_done<=SIZE(this%qvec,2)) !still q-vectors to do
      83           0 :     IF (.NOT.dmi_next_job) RETURN
      84             :     
      85             :     !Now modify the noco-file
      86           0 :     noco%qss=this%qvec(:,this%q_done)
      87           0 :     noco%l_spav=.true.
      88             :     !Modify the alpha-angles
      89           0 :     DO iType = 1,atoms%ntype
      90           0 :        noco%alph(iType) = noco%alphInit(iType) + tpi_const*dot_PRODUCT(noco%qss,atoms%taual(:,SUM(atoms%neq(:itype-1))+1))
      91             :     END DO
      92           0 :     IF (.NOT.this%l_io) RETURN
      93             :   
      94           0 :     IF (this%q_done.NE.1) CALL closeXMLElement('Forcetheorem_Loop_DMI')
      95           0 :     CALL openXMLElementPoly('Forcetheorem_Loop_DMI',(/'Q-vec'/),(/this%q_done/))
      96           0 :   END FUNCTION dmi_next_job
      97             : 
      98           0 :   SUBROUTINE dmi_postprocess(this)
      99             :     USE m_xmlOutput
     100             :     IMPLICIT NONE
     101             :     CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
     102             : 
     103             :     !Locals
     104             :     INTEGER:: n,q
     105             :     CHARACTER(LEN=12):: attributes(4)
     106           0 :     IF (this%q_done==0) RETURN
     107           0 :     IF (this%l_io) THEN
     108             :        !Now output the results
     109           0 :        CALL closeXMLElement('Forcetheorem_Loop_DMI')
     110           0 :        CALL openXMLElementPoly('Forcetheorem_DMI',(/'qPoints','Angles '/),(/SIZE(this%evsum,2),SIZE(this%evsum,1)/))
     111           0 :        DO q=1,SIZE(this%evsum,2)
     112           0 :           WRITE(attributes(1),'(i5)') q
     113           0 :           WRITE(attributes(2),'(f12.7)') this%evsum(0,q) 
     114             :           CALL writeXMLElementForm('Entry',(/'q     ','ev-sum'/),attributes(1:2),&
     115           0 :                RESHAPE((/1,6,5,12/),(/2,2/)))
     116           0 :           DO n=1,SIZE(this%evsum,1)-1
     117           0 :              WRITE(attributes(2),'(f12.7)') this%theta(n)
     118           0 :              WRITE(attributes(3),'(f12.7)') this%phi(n)
     119           0 :              WRITE(attributes(4),'(f12.7)') this%evsum(n,q)     
     120             :              CALL writeXMLElementForm('Entry',(/'q     ','theta ','phi   ','ev-sum'/),attributes,&
     121           0 :                   RESHAPE((/1,5,3,6,5,12,12,12/),(/4,2/)))
     122             :           END DO
     123             :        ENDDO
     124           0 :        CALL closeXMLElement('Forcetheorem_DMI')
     125             :     ENDIF
     126             : 
     127           0 :     CALL judft_end("Forcetheorem DMI")
     128             :   END SUBROUTINE dmi_postprocess
     129             : 
     130           0 :   SUBROUTINE dmi_dist(this,mpi)
     131             :     USE m_types_mpi
     132             :     IMPLICIT NONE
     133             :     CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
     134             :     TYPE(t_mpi),INTENT(in):: mpi
     135             :     
     136             :     INTEGER:: i,q,ierr
     137             : #ifdef CPP_MPI    
     138             :     INCLUDE 'mpif.h'
     139           0 :     IF (mpi%irank==0) i=SIZE(this%theta)
     140           0 :     call MPI_BCAST(i,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
     141           0 :     IF (mpi%irank==0) q=SIZE(this%qvec,2)
     142           0 :     CALL MPI_BCAST(q,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
     143           0 :     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
     144           0 :     CALL MPI_BCAST(this%phi,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
     145           0 :     CALL MPI_BCAST(this%theta,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
     146           0 :     CALL MPI_BCAST(this%qvec,3*q,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
     147             : #endif    
     148           0 :   END SUBROUTINE dmi_dist
     149             : 
     150           0 :   FUNCTION dmi_eval(this,eig_id,DIMENSION,atoms,kpts,sym,&
     151             :        cell,noco, input,mpi, oneD,enpara,v,results)RESULT(skip)
     152             :      USE m_types
     153             :      USE m_ssomat
     154             :     IMPLICIT NONE
     155             :     CLASS(t_forcetheo_dmi),INTENT(INOUT):: this
     156             :     LOGICAL :: skip
     157             :     !Stuff that might be used...
     158             :     TYPE(t_mpi),INTENT(IN)         :: mpi
     159             :     TYPE(t_dimension),INTENT(IN)   :: dimension
     160             :     TYPE(t_oneD),INTENT(IN)        :: oneD
     161             :     TYPE(t_input),INTENT(IN)       :: input
     162             :     TYPE(t_noco),INTENT(IN)        :: noco
     163             :     TYPE(t_sym),INTENT(IN)         :: sym
     164             :     TYPE(t_cell),INTENT(IN)        :: cell
     165             :     TYPE(t_kpts),INTENT(IN)        :: kpts
     166             :     TYPE(t_atoms),INTENT(IN)       :: atoms
     167             :     TYPE(t_enpara),INTENT(IN)      :: enpara
     168             :     TYPE(t_potden),INTENT(IN)      :: v
     169             :     TYPE(t_results),INTENT(IN)     :: results
     170             :     INTEGER,INTENT(IN)             :: eig_id
     171           0 :     skip=.FALSE.
     172           0 :     IF (this%q_done==0) RETURN
     173             :   
     174           0 :     this%evsum(0,this%q_done)=results%seigv
     175             :     CALL ssomat(this%evsum(1:,this%q_done),this%theta,this%phi,eig_id,DIMENSION,atoms,kpts,sym,&
     176           0 :        cell,noco, input,mpi, oneD,enpara,v,results) 
     177           0 :     skip=.TRUE.
     178           0 :   END FUNCTION  dmi_eval
     179             : 
     180             :   
     181           0 : END MODULE m_types_dmi

Generated by: LCOV version 1.13