LCOV - code coverage report
Current view: top level - init/old_inp - first_glance.f (source / functions) Hit Total Coverage
Test: combined.info Lines: 96 121 79.3 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.0 %

          Line data    Source code
       1             :       MODULE m_firstglance
       2             :       use m_juDFT
       3             : c
       4             : c reads the part of the input file that is necessary to call rw_inp
       5             : c
       6             :       CONTAINS
       7          28 :       SUBROUTINE first_glance(
       8             :      <                        ntype,nop,nat,nlod,layerd,itmax,
       9             :      <                        l_kpts,l_qpts,l_gamma,nkpt,nmop,
      10             :      <                        nmopq)
      11             : 
      12             :       USE m_symdata , ONLY : nammap,ord2,l_c2
      13             :       IMPLICIT NONE
      14             : 
      15             :       INTEGER,INTENT (OUT) :: ntype,nop,nat,nlod,layerd,itmax
      16             :       INTEGER,INTENT (OUT) :: nkpt,nmop(3),nmopq(3)
      17             :       LOGICAL,INTENT (OUT) :: l_kpts,l_qpts,l_gamma
      18             : 
      19             : !mod: INTEGER ord2(25)               ! Number of 2D symmetry operations
      20             : !mod: LOGICAL l_c2(25)               ! whether plane group contains the c_2
      21             : !mod: CHARACTER(len=4) :: nammap(20) ! names as in the inp-file
      22             : 
      23             :       INTEGER neq,n,na,nlo,line,i,n2spg,nqpt
      24             :       CHARACTER*4 namgrp,namex
      25             :       CHARACTER*3 latnam
      26             :       LOGICAL invs,zrfs
      27             : 
      28          28 :       l_kpts = .false.
      29          28 :       l_qpts=.true.
      30             : 
      31          28 :       OPEN (5,file='inp',form='formatted',status='old')
      32             :       
      33             :       !<-- skip first lines with definitions
      34             :       DO
      35          28 :          READ(5,*) latnam
      36          28 :          if (latnam/="def") exit
      37             :       ENDDO
      38          28 :       backspace(5)
      39             :       !>
      40             : 
      41             :       line = 0
      42          28 :       READ (5,*)
      43             :       line = line + 1
      44          28 :       READ (5,*)
      45             :       line = line + 1
      46          28 :       READ (5,8010) latnam,namgrp,invs,zrfs
      47             :       line = line + 1
      48             :  8010 FORMAT (a3,1x,a4,6x,l1,6x,l1)
      49             : 
      50          28 :       READ (5,*)
      51             :       line = line + 1
      52          28 :       READ (5,*)
      53          28 :       line = line + 1
      54          28 :       IF ((latnam.EQ.'any').OR.(latnam.EQ.'obl')) THEN
      55           0 :         READ (5,*)
      56           0 :         line = line + 1
      57             :       ENDIF
      58          28 :       READ (5,'(a4)') namex
      59          28 :       line = line + 1
      60             : 
      61          56 :       READ (5,*,END=77,ERR=77) ntype
      62           0 :       GOTO 79
      63          28 :    77 READ (5,*,END=78,ERR=78) ntype
      64          28 :       GOTO 79
      65           0 :    78 READ (5,*,END=99,ERR=99) ntype
      66          28 :    79 line = line + 1
      67          28 :       nlod = 0
      68          28 :       nat = 0
      69          92 :       DO n = 1,ntype
      70          64 :          READ (5,*)
      71          64 :          line = line + 1
      72          64 :          READ (5,*)
      73          64 :          line = line + 1
      74          64 :          READ (5,*)
      75          64 :          line = line + 1
      76             :          IF ( namex=='hf  ' .OR. namex=='pbe0' .OR. namex=='exx '
      77          64 :      +        .OR. namex=='hse ' .OR. namex=='vhse' ) THEN
      78           0 :           READ (5,'(i2,42x,i2)',END=99,ERR=99) neq,nlo
      79             :          ELSE
      80          64 :           READ (5,'(i2,14x,i2)',END=99,ERR=99) neq,nlo
      81             :          ENDIF
      82          64 :          line = line + 1
      83          64 :          nlod = max(nlo,nlod)
      84         134 :          DO na = 1,neq
      85          70 :             READ (5,*)
      86         134 :             line = line + 1
      87             :          ENDDO
      88          92 :          nat = nat + neq
      89             :       ENDDO
      90          28 :       READ (5,*)
      91          28 :       line = line + 1
      92          28 :       READ (5,*)
      93          28 :       line = line + 1
      94          28 :       READ (5,*)
      95          28 :       line = line + 1
      96          28 :       READ (5,*)
      97          28 :       line = line + 1
      98          28 :       READ (5,*)
      99          28 :       line = line + 1
     100          28 :       READ (5,*)
     101          28 :       line = line + 1
     102          56 :       DO n = 1,1!nwdd
     103          28 :          READ (5,*)
     104          28 :          line = line + 1
     105          28 :          READ (5,*)
     106          28 :          line = line + 1
     107          28 :          READ (5,*)
     108          56 :          line = line + 1
     109             :       ENDDO
     110          28 :       READ (5,*)
     111          28 :       line = line + 1
     112          28 :       READ (5,*)
     113          28 :       line = line + 1
     114          28 :       READ (5,*)
     115          28 :       line = line + 1
     116          28 :       READ (5,'(6x,i2)',END=99,ERR=99) itmax
     117          28 :       line = line + 1
     118          28 :       READ (5,*)
     119          28 :       line = line + 1
     120          28 :       READ (5,*)
     121          28 :       line = line + 1
     122          28 :       READ (5,'(16x,i2)',END=99,ERR=99) layerd
     123          28 :       line = line + 1
     124             : 
     125             : c if (.not.l_kpts) then the kpts-file is missing and we have
     126             : c to find out how many k-points to generate...
     127             : 
     128          28 :       INQUIRE (file='QGpsi',exist=l_kpts)
     129          56 :       IF (.not.l_kpts) INQUIRE (file='kpts',exist=l_kpts)
     130          28 :       IF (.not.l_kpts) THEN
     131           4 :         WRITE (6,*) 'No kpts-file exists, trying to generate it'
     132          28 :         DO line = 1,6
     133          24 :           READ (5,*,END=95,ERR=95)
     134             :         ENDDO
     135             :         READ (5,'(5x,i5,3(4x,i2),7x,l1)',END=97,ERR=97) 
     136           8 :      +                   nkpt,nmop(1),nmop(2),nmop(3),l_gamma
     137           0 :         GOTO 96
     138           4 :  97     BACKSPACE (5)
     139             :         READ (5,'(5x,i5,3(4x,i2))',END=98,ERR=98)
     140           4 :      +                       nkpt,nmop(1),nmop(2),nmop(3)
     141           4 :         l_gamma=.false.
     142           4 :         GOTO 96
     143           0 :  98     BACKSPACE (5)
     144           0 :         READ (5,'(5x,i5)',END=95,ERR=95) nkpt
     145           0 :         nmop(1) = 0 ; nmop(2) = 0 ; nmop(3) = 0 ; l_gamma=.false.
     146           0 :         GOTO 96
     147             : 
     148           0 :  95     WRITE (6,*) 'Since you did not provide a kpts-file, you'
     149           0 :         WRITE (6,*) 'should give k-mesh information at the end of'
     150           0 :         WRITE (6,*) 'the inp-file, at least how many k-points, e.g.'
     151           0 :         WRITE (6,*) 'nkpt=  100  -- or give the divisions n in xyz:'
     152           0 :         WRITE (6,*) 'nkpt=   36,nx= 6,ny= 6,nz= 8,gamma=F'
     153           0 :         CLOSE (6)
     154           0 :         STOP
     155             :       ENDIF
     156             :  96   CONTINUE
     157             : 
     158             : 
     159             : ! determine the number of symmetry operations
     160          28 :       IF (namgrp.EQ.'any ') THEN
     161          14 :          nop = 48
     162          14 :          CLOSE (5)
     163          42 :          RETURN
     164             :       ENDIF
     165             :       n2spg = 0
     166         574 :       DO i = 1, 20
     167         294 :         IF (namgrp.EQ.nammap(i)) n2spg = i
     168             :       ENDDO
     169          14 :       IF (n2spg == 0 ) THEN
     170           0 :         WRITE (*,*) 'Spacegroup ',namgrp,' not known! Choose one of:'
     171           0 :         WRITE (*,'(20(a4,1x))') (nammap(i),i=1,20)
     172             :         CALL juDFT_error("Could not determine spacegroup!",calledby
     173           0 :      +       ="first_glance")
     174             :       ENDIF
     175          14 :       IF ( (n2spg.GE.13).AND.(n2spg.LE.17) ) THEN
     176           0 :         IF ( .not.((latnam.EQ.'hx3').OR.(latnam.EQ.'hex')) ) THEN
     177             :            CALL juDFT_error
     178             :      +          ("Use only hex or hx3 with p3, p3m1, p31m, p6 or p6m!"
     179           0 :      +          ,calledby ="first_glance")
     180             :         ENDIF
     181             :       ENDIF
     182             : 
     183          14 :       nop = ord2(n2spg)
     184          14 :       IF (invs) THEN
     185          12 :          nop = 2*nop
     186          12 :          IF ( zrfs.and.(.not.l_c2(n2spg)) ) nop = 2*nop
     187             :       ELSE
     188           2 :          IF (zrfs) nop = 2*nop
     189             :       ENDIF
     190             : 
     191          14 :       CLOSE (5)
     192          14 :       RETURN 
     193             : !
     194             : ! Error
     195             : !
     196           0 :   99  WRITE (6,*) 'Error glancing at inp file at line',line
     197           0 :       CLOSE (6)
     198             :       CALL juDFT_error("Error glancing at inp file",calledby
     199           0 :      +       ="first_glance")
     200             : 
     201             :       END SUBROUTINE first_glance
     202             :       END MODULE m_firstglance

Generated by: LCOV version 1.13