[Wien] Syntax error in array constructor (gfortran)

Gavin Abo gsabo at crimson.ua.edu
Thu Feb 21 07:43:16 CET 2013


I think you have to modify the code like you indicated.  I made the 
attached patch.  It removed the compile time errors, but I never tested 
it make sure it didn't have any runtime errors.

Placed gfortran.patch (for Wien2k 12.1) into $WIENROOT, and entered:

$ patch -b -p0 -i gfortran.patch

On 2/20/2013 11:26 PM, tasaka at affinity-science.com wrote:
> Hello,
>
> I encountered the follwoing errors when compiling in SRC_hf
> with GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3.
> if there are any options of gfortran to avoid these errors, please advise.
>
> //
> gfortran -ffree-form -O2 -ffree-line-length-none  -c calc_exhfvv_tmp_.F
> calc_exhfvv_tmp_.F:269.22:
>
>              igv = (/ 1:ng /)
>                        1
> Error: Syntax error in array constructor at (1)
> calc_exhfvv_tmp_.F:272.22:
>
>              igv = (/ 1:(igs-1),(igs+1):ng /)
>                        1
> Error: Syntax error in array constructor at (1)
> make[1]: *** [calc_exhfvv.o] Error 1
> //
>
> Or, should I modify the codes as like below?
>
>              igv = (/ (i, i=1,ng,1) /)
>
>
> Any information would be appreciated.
>
> With best regards,
> Tomo
>
>
>
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>

-------------- next part --------------
diff -cr SRC_hf/calc_exhfvv.F SRC_hf/calc_exhfvv.F
*** SRC_hf/calc_exhfvv.F	2012-06-13 02:53:03.000000000 -0600
--- SRC_hf/calc_exhfvv.F	2013-01-21 12:33:50.000000000 -0700
***************
*** 266,275 ****
            enddo
            if (igs .eq. 0) then
              allocate(igv(ng))
!             igv = (/ 1:ng /)
            else
              allocate(igv(ng-1))
!             igv = (/ 1:(igs-1),(igs+1):ng /)
            endif
  
            ftmp3a = (0d0,0d0)
--- 266,275 ----
            enddo
            if (igs .eq. 0) then
              allocate(igv(ng))
!             igv = (/ (i,i=1,ng) /)
            else
              allocate(igv(ng-1))
!             igv = (/ (i,i=1,(igs-1)),(i,i=(igs+1),ng) /)
            endif
  
            ftmp3a = (0d0,0d0)
diff -cr SRC_hf/calc_h.F SRC_hf/calc_h.F
*** SRC_hf/calc_h.F	2012-07-15 06:45:02.000000000 -0600
--- SRC_hf/calc_h.F	2013-01-21 12:37:57.000000000 -0700
***************
*** 287,293 ****
          elseif (diaghf .eqv. .true.) then
  
            nindexb2(1:nbf) = 1
!           indexb(1:nbf,1) = (/1:nbf/)
  
          endif
  
--- 287,293 ----
          elseif (diaghf .eqv. .true.) then
  
            nindexb2(1:nbf) = 1
!           indexb(1:nbf,1) = (/(i,i=1,nbf)/)
  
          endif
  
***************
*** 418,427 ****
            enddo
            if (igs .eq. 0) then
              allocate(igv(ng))
!             igv = (/ 1:ng /)
            else
              allocate(igv(ng-1))
!             igv = (/ 1:(igs-1),(igs+1):ng /)
            endif
  
            nkvhf = nkvt(ik3) - nlototold
--- 418,427 ----
            enddo
            if (igs .eq. 0) then
              allocate(igv(ng))
!             igv = (/ (i,i=1,ng) /)
            else
              allocate(igv(ng-1))
!             igv = (/ (i,i=1,(igs-1)),(i,i=(igs+1),ng) /)
            endif
  
            nkvhf = nkvt(ik3) - nlototold
diff -cr SRC_hf/calc_rhovalvxsl.F SRC_hf/calc_rhovalvxsl.F
*** SRC_hf/calc_rhovalvxsl.F	2012-06-11 07:28:52.000000000 -0600
--- SRC_hf/calc_rhovalvxsl.F	2013-01-21 12:40:07.000000000 -0700
***************
*** 9,15 ****
        use struct, only : dx, iatnr, jri, mult, nat, nrad, r0, vcell
        implicit none
  
!       integer :: iat, ilm, nr
  
        real*8 :: fac, result, rhovalvxsl, rhovalvxslint
  
--- 9,15 ----
        use struct, only : dx, iatnr, jri, mult, nat, nrad, r0, vcell
        implicit none
  
!       integer :: i, iat, ilm, nr
  
        real*8 :: fac, result, rhovalvxsl, rhovalvxslint
  
***************
*** 22,28 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          do ilm=1, nlmvsl(iat)
  
--- 22,28 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          do ilm=1, nlmvsl(iat)
  
diff -cr SRC_hf/calc_ucuchucuc.f SRC_hf/calc_ucuchucuc.f
*** SRC_hf/calc_ucuchucuc.f	2012-06-05 09:21:25.000000000 -0600
--- SRC_hf/calc_ucuchucuc.f	2013-01-21 12:41:20.000000000 -0700
***************
*** 30,36 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 30,36 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uuchucu.f SRC_hf/calc_uuchucu.f
*** SRC_hf/calc_uuchucu.f	2012-06-05 09:23:37.000000000 -0600
--- SRC_hf/calc_uuchucu.f	2013-01-21 12:43:16.000000000 -0700
***************
*** 30,36 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 30,36 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uuchucuh.f SRC_hf/calc_uuchucuh.f
*** SRC_hf/calc_uuchucuh.f	2012-06-05 09:26:15.000000000 -0600
--- SRC_hf/calc_uuchucuh.f	2013-01-21 12:44:12.000000000 -0700
***************
*** 32,38 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 32,38 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uu.f SRC_hf/calc_uu.f
*** SRC_hf/calc_uu.f	2012-06-05 10:03:01.000000000 -0600
--- SRC_hf/calc_uu.f	2013-01-21 12:42:29.000000000 -0700
***************
*** 8,14 ****
        implicit none
        include 'param.inc'
  
!       integer :: iat, if1, if2, l, nr
  
        real*8, allocatable :: fun(:), r(:)
  
--- 8,14 ----
        implicit none
        include 'param.inc'
  
!       integer :: i, iat, if1, if2, l, nr
  
        real*8, allocatable :: fun(:), r(:)
  
***************
*** 20,26 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          do l=0, lmax2
  
--- 20,26 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          do l=0, lmax2
  
diff -cr SRC_hf/calc_uuguu.f SRC_hf/calc_uuguu.f
*** SRC_hf/calc_uuguu.f	2012-07-15 06:45:58.000000000 -0600
--- SRC_hf/calc_uuguu.f	2013-01-21 12:45:27.000000000 -0700
***************
*** 30,36 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 30,36 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uuguuh.f SRC_hf/calc_uuguuh.f
*** SRC_hf/calc_uuguuh.f	2012-07-15 06:46:13.000000000 -0600
--- SRC_hf/calc_uuguuh.f	2013-01-21 12:46:10.000000000 -0700
***************
*** 32,38 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 32,38 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uui.f SRC_hf/calc_uui.f
*** SRC_hf/calc_uui.f	2012-07-15 06:45:32.000000000 -0600
--- SRC_hf/calc_uui.f	2013-01-21 12:46:58.000000000 -0700
***************
*** 30,36 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 30,36 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uuih.f SRC_hf/calc_uuih.f
*** SRC_hf/calc_uuih.f	2012-07-15 06:45:42.000000000 -0600
--- SRC_hf/calc_uuih.f	2013-01-21 12:47:41.000000000 -0700
***************
*** 32,38 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
--- 32,38 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          if (screened .eqv. .true.) then
            sbi = 0d0
diff -cr SRC_hf/calc_uvxslug.f SRC_hf/calc_uvxslug.f
*** SRC_hf/calc_uvxslug.f	2012-06-05 10:07:38.000000000 -0600
--- SRC_hf/calc_uvxslug.f	2013-01-21 12:48:29.000000000 -0700
***************
*** 9,15 ****
        use struct, only : cin, dx, jri, mult, nat, nrad, r0
        implicit none
  
!       integer :: iat, if1, if2, ilm, ivsl, l1, l2, nr
  
        real*8 :: result
  
--- 9,15 ----
        use struct, only : cin, dx, jri, mult, nat, nrad, r0
        implicit none
  
!       integer :: i, iat, if1, if2, ilm, ivsl, l1, l2, nr
  
        real*8 :: result
  
***************
*** 23,29 ****
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/1:nr/))-1d0))
  
          do ivsl=1, nindvsl(iat)
  
--- 23,29 ----
        do iat=1, nat
  
          nr = jri(iat)
!         r(1:nr) = r0(iat)*exp(dx(iat)*(dble((/(i,i=1,nr)/))-1d0))
  
          do ivsl=1, nindvsl(iat)
  
diff -cr SRC_kgen/arbmsh.f SRC_kgen/arbmsh.f
*** SRC_kgen/arbmsh.f	2012-04-10 07:11:13.000000000 -0600
--- SRC_kgen/arbmsh.f	2013-01-21 10:43:28.000000000 -0700
***************
*** 90,96 ****
  !     ------------------------------------------------------------------
  !     -- CREATE FILE FOR HF                                           --
  !     ------------------------------------------------------------------
!       IF (CREATEHF .EQ. .TRUE.) &
          CALL CREATE_FILEHF(N,W(OISHIF),NSYM,IIO,GBAS,AAA,ORTHO)
  !     ------------------------------------------------------------------
  !     -- PRINTOUT OF SYMMETRY OPERATIONS                              --
--- 90,96 ----
  !     ------------------------------------------------------------------
  !     -- CREATE FILE FOR HF                                           --
  !     ------------------------------------------------------------------
!       IF (CREATEHF .EQV. .TRUE.) &
          CALL CREATE_FILEHF(N,W(OISHIF),NSYM,IIO,GBAS,AAA,ORTHO)
  !     ------------------------------------------------------------------
  !     -- PRINTOUT OF SYMMETRY OPERATIONS                              --
diff -cr SRC_lapw0/lapw0.F SRC_lapw0/lapw0.F
*** SRC_lapw0/lapw0.F	2012-07-20 00:43:04.000000000 -0600
--- SRC_lapw0/lapw0.F	2013-01-21 09:44:20.000000000 -0700
***************
*** 256,267 ****
          if ((alphax .lt. 0d0) .or. (alphax .gt. 1d0)) stop 'error in case.inhf: &
            the fraction of HF exchange should be between 0 and 1'
          read(60,*) screening
!         if ((screening .ne. .true.) .and. (screening .ne. .false.)) &
            stop 'error in case.inhf: screening should be true or false'
!         if (screening .eq. .true.) then
            read(60,*) slamb
            if (slamb .lt. 0d0) stop 'error in case.inhf: lambda should be positive'
!         elseif (screening .eq. .false.) then
            slamb = 0d0
          endif
        endif
--- 256,267 ----
          if ((alphax .lt. 0d0) .or. (alphax .gt. 1d0)) stop 'error in case.inhf: &
            the fraction of HF exchange should be between 0 and 1'
          read(60,*) screening
!         if ((screening .neqv. .true.) .and. (screening .neqv. .false.)) &
            stop 'error in case.inhf: screening should be true or false'
!         if (screening .eqv. .true.) then
            read(60,*) slamb
            if (slamb .lt. 0d0) stop 'error in case.inhf: lambda should be positive'
!         elseif (screening .eqv. .false.) then
            slamb = 0d0
          endif
        endif
diff -cr SRC_lapw0/vx_screened.f SRC_lapw0/vx_screened.f
*** SRC_lapw0/vx_screened.f	2011-12-09 07:05:55.000000000 -0700
--- SRC_lapw0/vx_screened.f	2013-01-21 10:40:45.000000000 -0700
***************
*** 44,50 ****
        s3 = s**3
        s4 = s**4
  
!       if ((screening .eq. .true.) .and. (slamb .gt. 1d-10)) then
  
          j = 1d0 - 2d0/3d0*a2 - 8d0/3d0*a*datan(1d0/a) + &
            2d0/3d0*a2*(a2 + 3d0)*dlog(1d0 + 1d0/a2)
--- 44,50 ----
        s3 = s**3
        s4 = s**4
  
!       if ((screening .eqv. .true.) .and. (slamb .gt. 1d-10)) then
  
          j = 1d0 - 2d0/3d0*a2 - 8d0/3d0*a*datan(1d0/a) + &
            2d0/3d0*a2*(a2 + 3d0)*dlog(1d0 + 1d0/a2)


More information about the Wien mailing list