LCOV - code coverage report
Current view: top level - forcetheorem - mae.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 54 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_mae
       8             :   USE m_types
       9             :   USE m_types_forcetheo
      10             :   USE m_judft
      11             :   TYPE,EXTENDS(t_forcetheo) :: t_forcetheo_mae
      12             :      INTEGER :: directions_done
      13             :      REAL,ALLOCATABLE:: theta(:)
      14             :      REAL,ALLOCATABLE:: phi(:)
      15             :      REAL,ALLOCATABLE:: evsum(:)
      16             :    CONTAINS
      17             :      PROCEDURE :: start   =>mae_start
      18             :      PROCEDURE :: next_job=>mae_next_job 
      19             :      PROCEDURE :: eval    =>mae_eval
      20             :      PROCEDURE :: postprocess => mae_postprocess
      21             :      PROCEDURE :: init   => mae_init !not overloaded
      22             :      PROCEDURE :: dist   => mae_dist !not overloaded
      23             :   END TYPE t_forcetheo_mae
      24             : 
      25             : CONTAINS
      26           0 :   SUBROUTINE mae_init(this,cell,sym,theta_s,phi_s)
      27             :     USE m_calculator
      28             :     USE m_socsym
      29             :     USE m_types
      30             :     IMPLICIT NONE
      31             :     CLASS(t_forcetheo_mae),INTENT(INOUT):: this
      32             :     TYPE(t_cell),INTENT(IN)             :: cell
      33             :     TYPE(t_sym),INTENT(IN)              :: sym
      34             :     CHARACTER(len=*),INTENT(INOUT)      :: theta_s,phi_s
      35             : 
      36             :     INTEGER::n
      37           0 :     LOGICAL::error(sym%nop)
      38             :     
      39           0 :     CALL evaluateList(this%theta,theta_s)
      40           0 :     CALL evaluateList(this%phi,phi_s)
      41             : 
      42           0 :     IF (SIZE(this%phi).NE.SIZE(this%theta)) CALL &
      43           0 :          judft_error("Lists for theta/phi must have the same length in MAE force theorem calculations")
      44           0 :     DO n=1,SIZE(this%phi)
      45           0 :        CALL soc_sym(sym%nop,sym%mrot,this%theta(n),this%phi(n),cell%amat,error)
      46           0 :        IF (ANY(error)) CALL judft_error("Force theory choice of SOC-SQA breaks symmetry")
      47             :     END DO
      48           0 :     ALLOCATE(this%evsum(SIZE(this%phi)))
      49           0 :     this%evsum=0
      50           0 :   END SUBROUTINE mae_init
      51             :     
      52             : 
      53           0 :   SUBROUTINE mae_start(this,potden,l_io)
      54             :     USE m_types_potden
      55             :     IMPLICIT NONE
      56             :     CLASS(t_forcetheo_mae),INTENT(INOUT):: this
      57             :     TYPE(t_potden) ,INTENT(INOUT)       :: potden
      58             :     LOGICAL,INTENT(IN)                  :: l_io
      59           0 :     this%directions_done=0
      60           0 :     CALL this%t_forcetheo%start(potden,l_io) !call routine of basis type
      61           0 :   END SUBROUTINE  mae_start
      62             : 
      63             : 
      64           0 :   LOGICAL FUNCTION mae_next_job(this,lastiter,atoms,noco)
      65             :     USE m_types_setup
      66             :     USE m_xmlOutput
      67             :     USE m_constants
      68             :     IMPLICIT NONE
      69             :     CLASS(t_forcetheo_mae),INTENT(INOUT):: this
      70             :     LOGICAL,INTENT(IN)                  :: lastiter
      71             :     TYPE(t_atoms),INTENT(IN)            :: atoms
      72             :     !Stuff that might be modified...
      73             :     TYPE(t_noco),INTENT(INOUT) :: noco
      74           0 :        IF (.NOT.lastiter) THEN
      75           0 :           mae_next_job=this%t_forcetheo%next_job(lastiter,atoms,noco)
      76           0 :           RETURN
      77             :        ENDIF
      78             :        !OK, now we start the MAE-loop
      79           0 :        this%directions_done=this%directions_done+1
      80           0 :        mae_next_job=(this%directions_done<=SIZE(this%phi)) !still angles to do
      81           0 :        IF (.NOT.mae_next_job) RETURN
      82             : 
      83           0 :        noco%theta=this%theta(this%directions_done)
      84           0 :        noco%phi=this%phi(this%directions_done)
      85           0 :        noco%l_soc=.true.
      86           0 :        IF (this%directions_done.NE.1.AND.this%l_io) CALL closeXMLElement('Forcetheorem_Loop_MAE')
      87           0 :        IF (this%l_io) CALL openXMLElementPoly('Forcetheorem_Loop_MAE',(/'No'/),(/this%directions_done/))
      88             :   END FUNCTION mae_next_job
      89             : 
      90           0 :   FUNCTION mae_eval(this,eig_id,DIMENSION,atoms,kpts,sym,&
      91             :        cell,noco, input,mpi, oneD,enpara,v,results)RESULT(skip)
      92             :     USE m_types
      93             :     IMPLICIT NONE
      94             :     CLASS(t_forcetheo_mae),INTENT(INOUT):: this
      95             :     LOGICAL :: skip
      96             :     !Stuff that might be used...
      97             :     TYPE(t_mpi),INTENT(IN)         :: mpi
      98             :     TYPE(t_dimension),INTENT(IN)   :: dimension
      99             :     TYPE(t_oneD),INTENT(IN)        :: oneD
     100             :     TYPE(t_input),INTENT(IN)       :: input
     101             :     TYPE(t_noco),INTENT(IN)        :: noco
     102             :     TYPE(t_sym),INTENT(IN)         :: sym
     103             :     TYPE(t_cell),INTENT(IN)        :: cell
     104             :     TYPE(t_kpts),INTENT(IN)        :: kpts
     105             :     TYPE(t_atoms),INTENT(IN)       :: atoms
     106             :     TYPE(t_enpara),INTENT(IN)      :: enpara
     107             :     TYPE(t_potden),INTENT(IN)      :: v
     108             :     TYPE(t_results),INTENT(IN)     :: results
     109             :     INTEGER,INTENT(IN)             :: eig_id
     110           0 :     IF (this%directions_done==0) THEN
     111             :        skip=.FALSE.
     112             :        RETURN
     113             :     ENDIF
     114           0 :     this%evsum(this%directions_done)=results%seigv/2.0 
     115           0 :     skip=.TRUE.
     116           0 :   END FUNCTION  mae_eval
     117             : 
     118           0 :   SUBROUTINE mae_postprocess(this)
     119             :     USE m_xmlOutput
     120             :     IMPLICIT NONE
     121             :     CLASS(t_forcetheo_mae),INTENT(INOUT):: this
     122             : 
     123             :     !Locals
     124             :     INTEGER:: n
     125             :     CHARACTER(LEN=12):: attributes(3)
     126           0 :     IF (this%directions_done==0) THEN
     127           0 :        RETURN
     128             :     ENDIF
     129             :     
     130           0 :     IF (this%l_io) THEN
     131             :        !Now output the results
     132           0 :        CALL closeXMLElement('Forcetheorem_Loop_MAE')
     133           0 :        CALL openXMLElementPoly('Forcetheorem_MAE',(/'Angles'/),(/SIZE(this%evsum)/))
     134           0 :        DO n=1,SIZE(this%evsum)
     135           0 :           WRITE(attributes(1),'(f12.7)') this%theta(n)
     136           0 :           WRITE(attributes(2),'(f12.7)') this%phi(n)
     137           0 :           WRITE(attributes(3),'(f12.7)') this%evsum(n)     
     138             :           CALL writeXMLElementForm('Angle',(/'theta ','phi   ','ev-sum'/),attributes,&
     139           0 :                RESHAPE((/5,3,6,12,12,12/),(/3,2/)))
     140             :        END DO
     141           0 :        CALL closeXMLElement('Forcetheorem_MAE')
     142             :     ENDIF
     143           0 :     CALL judft_end("Forcetheorem MAE")
     144             :   END SUBROUTINE mae_postprocess
     145             : 
     146           0 :   SUBROUTINE mae_dist(this,mpi)
     147             :     USE m_types_mpi
     148             :     IMPLICIT NONE
     149             :     CLASS(t_forcetheo_mae),INTENT(INOUT):: this
     150             :     TYPE(t_mpi),INTENT(in):: mpi
     151             : 
     152             :     INTEGER:: i,ierr
     153             : #ifdef CPP_MPI    
     154             :     INCLUDE 'mpif.h'
     155           0 :     IF (mpi%irank==0) i=SIZE(this%theta)
     156           0 :     call MPI_BCAST(i,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
     157           0 :     IF (mpi%irank.NE.0) ALLOCATE(this%phi(i),this%theta(i),this%evsum(i));this%evsum=0.0
     158           0 :     CALL MPI_BCAST(this%phi,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
     159           0 :     CALL MPI_BCAST(this%theta,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
     160             : #endif    
     161           0 :   END SUBROUTINE mae_dist
     162           0 : END MODULE m_types_mae

Generated by: LCOV version 1.13