LCOV - code coverage report
Current view: top level - io - rw_noco.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 25 58 43.1 %
Date: 2019-09-08 04:53:50 Functions: 1 2 50.0 %

          Line data    Source code
       1             :       MODULE m_rwnoco
       2             :       USE m_juDFT
       3             : !---------------------------------------------------------------------
       4             : !     read or write the nocoinp-file
       5             : !---------------------------------------------------------------------
       6             :       CONTAINS
       7           6 :         SUBROUTINE rw_noco_read(atoms,noco,input)
       8             :           USE m_types
       9             :           USE m_constants
      10             :           IMPLICIT NONE
      11             :           ! ..
      12             :           ! ..  Arguments ..
      13             :           TYPE(t_atoms),INTENT(IN)   :: atoms
      14             :           TYPE(t_noco),INTENT(INOUT) :: noco
      15             :           TYPE(t_input),INTENT(INOUT):: input     
      16             : 
      17             : 
      18             :           ! ..
      19             :           INTEGER :: itype, j, fileend
      20             :           REAL    :: qsc(3)
      21             :           CHARACTER(len=8) :: inpchar 
      22             : 
      23             : 
      24             : 
      25          18 :           DO itype = 1,atoms%ntype
      26          12 :              READ (24,'(22x,l1)') noco%l_relax(itype)
      27             :              
      28          12 :              inpchar(1:2)= 'XX'
      29          12 :              READ (24,fmt='(19x,a2)') inpchar(1:2)
      30          12 :              BACKSPACE (24)
      31          12 :              IF (inpchar(1:2)/='pi') THEN
      32             :                 READ (24,fmt='(7x,f14.10,11x,f14.10)') &
      33          12 :                      &      noco%alph(itype),noco%b_con(1,itype)
      34             :              ELSE
      35             :                 READ (24,fmt='(7x,f12.8,13x,f14.10)') &
      36           0 :                      &      noco%alph(itype),noco%b_con(1,itype)
      37           0 :                 noco%alph(itype)= noco%alph(itype)*pi_const
      38             :              ENDIF
      39          12 :              inpchar(1:2)= 'XX'
      40          12 :              READ (24,fmt='(19x,a2)') inpchar(1:2)
      41          12 :              BACKSPACE (24)
      42          12 :              IF (inpchar(1:2)/='pi') THEN
      43             :                 READ (24,fmt='(7x,f14.10,11x,f14.10)') &
      44          12 :                      &      noco%beta(itype),noco%b_con(2,itype)
      45             :              ELSE
      46             :                 READ (24,fmt='(7x,f12.8,13x,f14.10)') &
      47           0 :                      &      noco%beta(itype),noco%b_con(2,itype)
      48           0 :                 noco%beta(itype)= noco%beta(itype)*pi_const
      49             :              ENDIF
      50             : 
      51          12 :              READ (24,*)
      52          12 :                 WRITE (6,8010)        itype,noco%l_relax(itype)
      53          12 :                 WRITE (6,8020)        noco%alph(itype),noco%b_con(1,itype)
      54          12 :                 WRITE (6,8025)         noco%beta(itype),noco%b_con(2,itype)
      55          18 :                 WRITE (6,*)
      56             :           ENDDO
      57             : 8010      FORMAT ('atom-type',i4,',l_relax=',l1,',l_magn=',l1,&
      58             :                &',M=',f8.5,',magtype=',i4)
      59             : 8020      FORMAT ('alpha =',f14.10,',b_cons_x =',f14.10)
      60             : 8025      FORMAT ('beta  =',f14.10,',b_cons_y =',f14.10)
      61             : 8026      FORMAT ('Total number of magnetic atoms',i4,',magnetic types',i4)
      62             : 
      63           6 :           READ (24,*)
      64           6 :           READ (24,8036) noco%l_ss,noco%l_mperp,noco%l_constr
      65             : !!$          IF ( (inpchar(1:8)=='sso_opt=') .OR. (noco%l_ss .AND. noco%l_soc) ) THEN
      66             : !!$             BACKSPACE (24)
      67             : !!$             READ (24,fmt='(45x,2l1)') input%sso_opt(1),input%sso_opt(2)
      68             : !!$          ELSE
      69             : !!$             input%sso_opt(1)= .FALSE. 
      70             : !!$             input%sso_opt(2)= .FALSE.
      71             : !!$          ENDIF
      72           6 :           READ (24,8046) noco%mix_b
      73             : 
      74             :           WRITE (6,fmt='(5(A,l1),l1)') &
      75           6 :                & 'l_ss=',noco%l_ss,',l_mperp=',noco%l_mperp,',l_constr=',noco%l_constr
      76           6 :           WRITE (6,8040) noco%mix_b
      77             : 8030      FORMAT ('l_ss=',l1,',l_mperp=',l1,',l_constr=',l1,',l_disp=',l1)
      78             : 8035      FORMAT (5x,l1,9x,l1,10x,l1,8x,l1)
      79             : 8036      FORMAT (5x,l1,9x,l1,10x,l1)
      80             : 8040      FORMAT ('mix_b=',f6.3,',thetaJ=',f14.10,',nsh=',i4)
      81             : 8045      FORMAT (6x,f6.3,8x,f14.10,5x,i4)
      82             : 8046      FORMAT (6x,f6.3)
      83             : 
      84           6 :           IF (noco%l_ss) THEN
      85             :              READ (24,fmt='(5x,3(f14.10,1x))') &
      86           0 :                   &    noco%qss(1),noco%qss(2),noco%qss(3)
      87           0 :              inpchar(1:3)= 'XXX'
      88           0 :              READ (24,fmt='(a4)',iostat=fileend) inpchar(1:4)
      89           0 :              IF (fileend==0) THEN
      90           0 :                 IF (inpchar(1:4)=='qsc=') THEN
      91           0 :                    BACKSPACE (24)
      92             :                    READ (24,fmt='(5x,3(f14.10,1x))') &
      93           0 :                         &      qsc(1),qsc(2),qsc(3)
      94           0 :                    DO j= 1,3
      95           0 :                       IF ( ABS(qsc(j)) < 1.e-6 ) THEN
      96             :                          WRITE (6,fmt='(A,i1,A,1x,f14.10)')&
      97           0 :                               &          'Error reading nocoinp: qsc(',j,') =',qsc(j)
      98             :                          CALL juDFT_error("Error reading nocoinp",calledby&
      99           0 :                               &              ="rw_noco")
     100             :                       ENDIF
     101           0 :                       noco%qss(j)= noco%qss(j)/qsc(j)
     102             :                    ENDDO
     103             :                 ENDIF
     104             :              ENDIF
     105           0 :              WRITE (6,*) 'This is a Spin-Spiral (SS) calculation. The'
     106           0 :              WRITE (6,*) 'q-vector of the Spin-Spiral is:'
     107           0 :              WRITE (6,8060) noco%qss(1),noco%qss(2),noco%qss(3)
     108             : 8060         FORMAT ('qss=(',f14.10,',',f14.10,',',f14.10,')')
     109             :           ENDIF
     110           6 :         END SUBROUTINE rw_noco_read
     111             : 
     112           0 :       SUBROUTINE rw_noco_write(atoms,noco,input)
     113             :       USE m_types
     114             :       IMPLICIT NONE
     115             : ! ..
     116             : ! ..  Arguments ..
     117             :       TYPE(t_atoms),INTENT(IN)   :: atoms
     118             :       TYPE(t_noco),INTENT(INOUT) :: noco
     119             :       TYPE(t_input),INTENT(IN)   :: input     
     120             : 
     121             : ! ..
     122             :       INTEGER :: itype
     123             :       CHARACTER(len=8) :: inpchar 
     124             :  
     125           0 :       DO itype = 1,atoms%ntype
     126           0 :          IF ( noco%l_relax(itype) ) noco%b_con(:,itype) = 0.0
     127           0 :          WRITE (24,8010) itype,noco%l_relax(itype)
     128           0 :          WRITE (24,8020) noco%alph(itype),noco%b_con(1,itype)
     129           0 :          WRITE (24,8025)  noco%beta(itype),noco%b_con(2,itype)
     130           0 :          WRITE (24,*)
     131             :       ENDDO
     132             :  
     133           0 :       WRITE (24,*) '-- logical parameters --'
     134             :       WRITE (24,fmt='(5(A,l1),l1)') &
     135           0 :      & 'l_ss=',noco%l_ss,',l_mperp=',noco%l_mperp,',l_constr=',noco%l_constr
     136           0 :       WRITE (24,8040) noco%mix_b
     137             : 
     138           0 :       IF (noco%l_ss) THEN
     139           0 :        WRITE (24,8060) noco%qss(1),noco%qss(2),noco%qss(3)
     140           0 :        WRITE (6,8060) noco%qss(1),noco%qss(2),noco%qss(3)
     141             :       ENDIF
     142             : 8010      FORMAT ('atom-type',i4,',l_relax=',l1,',l_magn=',l1,&
     143             :                &',M=',f8.5,',magtype=',i4)
     144             : 8020      FORMAT ('alpha =',f14.10,',b_cons_x =',f14.10)
     145             : 8025      FORMAT ('beta  =',f14.10,',b_cons_y =',f14.10)
     146             : 8040      FORMAT ('mix_b=',f6.3,',thetaJ=',f14.10,',nsh=',i4)
     147             : 8060         FORMAT ('qss=(',f14.10,',',f14.10,',',f14.10,')')
     148           0 :       END SUBROUTINE rw_noco_write
     149             :       END MODULE m_rwnoco

Generated by: LCOV version 1.13