24小时热门版块排行榜    

查看: 2058  |  回复: 18

snoopyzhao

至尊木虫 (职业作家)

★ ★ ★
余泽成(金币+3): 辛苦了! 2012-03-11 23:27:47
引用回帖:
9楼: Originally posted by zhaohuxian at 2012-03-08 10:54:37:
谢谢您的热心帮助,根据帖子里的错误信息,我改了程序:
        program angle
        !Define the parameters

      parameter (x=1000)
      parameter (y=1000)
      parameter (radtodeg=57.29577951d0)

        in ...

把下面的错误更正了再说……
CODE:
C:\Documents and Settings\Administrator\Desktop>gfortran -Wall zf.f90
zf.f90:13.19:

      dimension dx(x,y), dy(x,y), dz(x,y)
                   1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:13.21:

      dimension dx(x,y), dy(x,y), dz(x,y)
                     1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:13.18:

      dimension dx(x,y), dy(x,y), dz(x,y)
                  1
Error: The module or main program array 'dx' at (1) must have constant shape
zf.f90:13.28:

      dimension dx(x,y), dy(x,y), dz(x,y)
                            1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:13.30:

      dimension dx(x,y), dy(x,y), dz(x,y)
                              1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:13.27:

      dimension dx(x,y), dy(x,y), dz(x,y)
                           1
Error: The module or main program array 'dy' at (1) must have constant shape
zf.f90:13.37:

      dimension dx(x,y), dy(x,y), dz(x,y)
                                     1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:13.39:

      dimension dx(x,y), dy(x,y), dz(x,y)
                                       1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:13.36:

      dimension dx(x,y), dy(x,y), dz(x,y)
                                    1
Error: The module or main program array 'dz' at (1) must have constant shape
zf.f90:9.22:

        integer iatom(x)
                      1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:9.24:

        integer iatom(x)
                        1
Error: The module or main program array 'iatom' at (1) must have constant shape
zf.f90:16.24:

      character*4 lable(x), latom(x,y)
                        1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:16.26:

      character*4 lable(x), latom(x,y)
                          1
Error: The module or main program array 'lable' at (1) must have constant shape
zf.f90:16.34:

      character*4 lable(x), latom(x,y)
                                  1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:16.36:

      character*4 lable(x), latom(x,y)
                                    1
Error: Expression at (1) must be of INTEGER type, found REAL
zf.f90:16.38:

      character*4 lable(x), latom(x,y)
                                      1
Error: The module or main program array 'latom' at (1) must have constant shape
zf.f90:106.22:

        open (11,file=opsition)
                      1
Error: FILE tag at (1) must be of type CHARACTER
zf.f90:117.14:

        close(con)
              1
Error: UNIT tag at (1) must be of type INTEGER

» 本帖已获得的红花(最新10朵)

11楼2012-03-08 12:47:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

sxf2012

木虫 (正式写手)

声明x,y为整数类型
integer,parameter :: x = 1000
integer,parameter :: y = 1000
12楼2012-03-09 08:58:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

sxf2012

木虫 (正式写手)

你的这句声明
"implicit real*8(a-h,o-z)
      parameter (x=10000)
      parameter (y=10000)
"
使得x和y为双精度了
13楼2012-03-09 09:03:48
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhaohuxian

木虫 (正式写手)

送鲜花一朵
引用回帖:
: Originally posted by snoopyzhao at 2012-03-08 12:47:36:
把下面的错误更正了再说……


C:\Documents and Settings\Administrator\Desktop>gfortran -Wall zf.f90
zf.f90:13.19:

      dimension dx(x,y), dy(x,y), dz(x,y)
                   1
Error: E ...

program angle
        !Define the parameters

      integer,parameter :: x = 1000
      integer,parameter :: y = 1000

      parameter (radtodeg=57.29577951d0)

        integer i, j, atomkind, lower, upper
        integer iatom(x)


      dimension rv(3,3),temp(6)
      dimension dx(x,y), dy(x,y), dz(x,y)

      character(len=132) line, system
      character*4 lable(x), latom(x,y)

      double precision lattice

      logical eof, con_ex, out_ex

        eof=.false.
        con_ex=.false.
        out_ex=.false.

        ! Check the required files
       
        inquire(file='OUTCAR',exist=out_ex)
        inquire(file='CONTCAR',exist=con_ex)

        if (.not. out_ex) then
        print *, "OUTCAR: file not exist."
        stop
        end if

        if (.not. con_ex) then
        print *, "CONTCAR: file not exist."
        stop
        end if

        ! Read the species in OUTCAR

        open(unit=11,file='OUTCAR',status='OLD')
        atomkind=0
        do while(.not.eof)
          read(11,*,end=10) line
          if(index(line,'VRHFIN').ne.0) then
            atomkind=atomkind+1
            upper=index(line,':')-1
            lower=index(line,'=')+1
            lable(atomkind)=line(lower:upper)
          end if
        end do
        close(11)
10        continue

      ! Read POSCAR to process lattice information and amount of each kind

        open(unit=12,file='CONTCAR',status='OLD')
        read(12,*,end=20) system
        read(12,*,end=20) lattice
        read(12,*,end=20) rv(1,1), rv(2,1), rv(3,1)
        read(12,*,end=20) rv(1,2), rv(2,2), rv(3,2)
        read(12,*,end=20) rv(1,3), rv(2,3), rv(3,3)
        read(12,*,end=20), (iatom(i), i=1,atomkind)
        close(12)

        ! Process the label list
        do i=1,atomkind
          do j=1,iatom(i)
             latom(j,i)=lable(i)
          end do
        end do

        do i=1,3
          temp(i)=0.0
          do j=1,3
            temp(i)=temp(i)+rv(j,i)**2
          end do
          temp(i)=sqrt(temp(i))
        end do
        a=temp(1)
        b=temp(2)
        c=temp(3)

        do i=1,3
          temp(3+i)=0.0
        end do

        do j=1,3
          temp(4)=temp(4)+rv(j,2)*rv(j,3)
          temp(5)=temp(5)+rv(j,1)*rv(j,3)
          temp(6)=temp(6)+rv(j,1)*rv(j,2)
        end do
        temp(4)=temp(4)/(temp(2)*temp(3))
        temp(5)=temp(5)/(temp(1)*temp(3))
        temp(6)=temp(6)/(temp(1)*temp(2))

        alpha=radtodeg*acos(temp(4))
        beta=radtodeg*acos(temp(5))
        gamma=radtodeg*acos(temp(6))

20    continue
      
      ! Open file for record, and write

        open (21,file=opsition)
        write(21,300) system
        write(21,300) "lattice lengths: "
        write(21,300) "a=", a
        write(21,300) "b=", b
        write(21,300) "c=", c
        write(21,300) "lattice angles: "
        write(21,300) "alpha=", alpha
        write(21,300) "beta=", beta
        write(21,300) "gamma=", gamma

        close(21)


        ! Read OUTCAR to process the coordinates

        open(unit=11,file='OUTCAR',status='OLD')
      open (21,file=opsition)
        do while(.not.eof)
          read(11,*,end=30) line
          if (index(line,'POSITION').ne.0) then
          read(11,*,end=30) line
          
            do i=1,atomkind
              do j=1,iatom(i)
                read(11,*,end=30) dx(j,i), dy(j,i), dz(j,i)
                write(21,300) latom(j,i), dx(j,i), dy(j,i), dz(j,i)
              end do
            end do

          end if
        end do
        close(11)
        close(21)
30    continue
      
300        format(a4,1x,3f15.9,1x,a4,1x,i4,2(1x,a2),1x,f8.4,1x,i4)

      stop
        end



谢谢,修改好了,x、y的声明错了
14楼2012-03-09 09:16:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)

引用回帖:
14楼: Originally posted by zhaohuxian at 2012-03-09 09:16:09:
program angle
        !Define the parameters

      integer,parameter :: x = 1000
      integer,parameter :: y = 1000

      parameter (radtodeg=57.29577951d0)

        integer i, j, atomkind, lower, u ...

还有错误……
CODE:
zf.f90:108.22:

        open (21,file=opsition)
                      1
Error: FILE tag at (1) must be of type CHARACTER
zf.f90:125.20:

      open (21,file=opsition)
                    1
Error: FILE tag at (1) must be of type CHARACTER

» 本帖已获得的红花(最新10朵)

15楼2012-03-09 10:04:21
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhaohuxian

木虫 (正式写手)

送鲜花一朵
引用回帖:
: Originally posted by snoopyzhao at 2012-03-09 10:04:21:
还有错误……


zf.f90:108.22:

        open (21,file=opsition)
                      1
Error: FILE tag at (1) must be of type CHARACTER
zf.f90:125.20:

      open (21,file=opsition)
    ...

program angle
      !Define the parameters

      integer,parameter :: x = 1000
      integer,parameter :: y = 1000

      parameter (radtodeg=57.29577951d0)

        integer i, j, atomkind, lower, upper
        integer iatom(x)


      dimension rv(3,3),temp(6)
      dimension dx(x,y), dy(x,y), dz(x,y)

      character(len=132) line, system, opsition
      character*4 lable(x), latom(x,y)

      double precision lattice

      logical eof, con_ex, out_ex

        eof=.false.
        con_ex=.false.
        out_ex=.false.

        ! Check the required files
        
        inquire(file='OUTCAR',exist=out_ex)
        inquire(file='CONTCAR',exist=con_ex)

        if (.not. out_ex) then
        print *, "OUTCAR: file not exist."
        stop
        end if

        if (.not. con_ex) then
        print *, "CONTCAR: file not exist."
        stop
        end if

        ! Read the species in OUTCAR

        open(unit=11,file='OUTCAR',status='OLD')
        atomkind=0
        do while(.not.eof)
          read(11,*,end=10) line
          if(index(line,'VRHFIN').ne.0) then
            atomkind=atomkind+1
            upper=index(line,':')-1
            lower=index(line,'=')+1
            lable(atomkind)=line(lower:upper)
          end if
        end do
        close(11)
10        continue

      ! Read POSCAR to process lattice information and amount of each kind

        open(unit=12,file='CONTCAR',status='OLD')
        read(12,*,end=20) system
        read(12,*,end=20) lattice
        read(12,*,end=20) rv(1,1), rv(2,1), rv(3,1)
        read(12,*,end=20) rv(1,2), rv(2,2), rv(3,2)
        read(12,*,end=20) rv(1,3), rv(2,3), rv(3,3)
        read(12,*,end=20), (iatom(i), i=1,atomkind)
        close(12)

        ! Process the label list
        do i=1,atomkind
          do j=1,iatom(i)
             latom(j,i)=lable(i)
          end do
        end do

        do i=1,3
          temp(i)=0.0
          do j=1,3
            temp(i)=temp(i)+rv(j,i)**2
          end do
          temp(i)=sqrt(temp(i))
        end do
        a=temp(1)
        b=temp(2)
        c=temp(3)

        do i=1,3
          temp(3+i)=0.0
        end do

        do j=1,3
          temp(4)=temp(4)+rv(j,2)*rv(j,3)
          temp(5)=temp(5)+rv(j,1)*rv(j,3)
          temp(6)=temp(6)+rv(j,1)*rv(j,2)
        end do
        temp(4)=temp(4)/(temp(2)*temp(3))
        temp(5)=temp(5)/(temp(1)*temp(3))
        temp(6)=temp(6)/(temp(1)*temp(2))

        alpha=radtodeg*acos(temp(4))
        beta=radtodeg*acos(temp(5))
        gamma=radtodeg*acos(temp(6))

20    continue
      
      ! Open file for record, and write

        open (21,file=opsition)
        write(21,300) system
        write(21,300) "lattice lengths: "
        write(21,300) "a=", a
        write(21,300) "b=", b
        write(21,300) "c=", c
        write(21,300) "lattice angles: "
        write(21,300) "alpha=", alpha
        write(21,300) "beta=", beta
        write(21,300) "gamma=", gamma

        close(21)


        ! Read OUTCAR to process the coordinates

        open(unit=11,file='OUTCAR',status='OLD')
      open (21,file=opsition)
        do while(.not.eof)
          read(11,*,end=30) line
          if (index(line,'POSITION').ne.0) then
          read(11,*,end=30) line
         
            do i=1,atomkind
              do j=1,iatom(i)
                read(11,*,end=30) dx(j,i), dy(j,i), dz(j,i)
                write(21,300) latom(j,i), dx(j,i), dy(j,i), dz(j,i)
              end do
            end do

          end if
        end do
        close(11)
        close(21)
30    continue
      
300        format(a4,1x,3f15.9,1x,a4,1x,i4,2(1x,a2),1x,f8.4,1x,i4)

      stop
      end

增加文件名的字符定义
谢谢
16楼2012-03-09 10:24:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)

现在还有问题吗?至少我这里编译没有什么问题了……

» 本帖已获得的红花(最新10朵)

17楼2012-03-09 10:38:04
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhaohuxian

木虫 (正式写手)

送鲜花一朵
引用回帖:
: Originally posted by snoopyzhao at 2012-03-09 10:38:04:
现在还有问题吗?至少我这里编译没有什么问题了……

Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.


编译是通过了,但是运行的时候出现了这个debug信息,想问一下为啥,谢谢
18楼2012-03-09 10:48:48
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)


余泽成(金币+1): 谢谢参与应助! 2012-03-11 23:28:34
引用回帖:
18楼: Originally posted by zhaohuxian at 2012-03-09 10:48:48:
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.


编译是通过了,但是运行的时候出现了这个debug信息 ...

这是你编译器的问题吧,至少在我这里没有任何问题,当然,我没有办法运用它,毕意缺少必要的输入文件……
19楼2012-03-09 12:14:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 zhaohuxian 的主题更新
信息提示
请填处理意见