Fortran Coder

查看: 14869|回复: 13
打印 上一主题 下一主题

[求助] 紧急求助,固定格式与自由格式的问题

[复制链接]

10

帖子

2

主题

0

精华

入门

F 币
56 元
贡献
28 点
跳转到指定楼层
楼主
发表于 2014-10-9 15:14:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
分别采用NVT和NPT模拟出当T*=1.65时,LJ流体的状态方程并进行比较
用FORTRAN编写的时候总是有错误,恳请高手指教,非常感谢。

NPT.zip

10.74 KB, 下载次数: 4

分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

725

帖子

4

主题

0

精华

大师

农村外出务工人员

F 币
657 元
贡献
337 点

新人勋章爱心勋章水王勋章元老勋章热心勋章

沙发
发表于 2014-10-9 15:30:57 | 只看该作者
请给出源码,错误提示

10

帖子

2

主题

0

精华

入门

F 币
56 元
贡献
28 点
板凳
 楼主| 发表于 2014-10-9 16:21:32 | 只看该作者
楚香饭 发表于 2014-10-9 15:30
请给出源码,错误提示

谢谢您,代码说是超过1000字,回复不了。错误是:
--------------------Configuration: rty - Win32 Debug--------------------
Compiling Fortran...
F:\fortran programs\rty\agsdf.for
f90: Error: Illegal character in statement label field  [P]
f90: Error: Illegal character in statement label field  [R]
f90: Error: Illegal character in statement label field  [O]
f90: Error: Illegal character in statement label field  [G]
f90: Error: Illegal character in statement label field  [R]
f90: Error: First statement in file must not be continued
F:\fortran programs\rty\agsdf.for(1) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( : % . = =>
PROGRAM MCNVT
-------------^
F:\fortran programs\rty\agsdf.for(357) : Error: Illegal character in statement label field  [=]
   = '',F10.6)') FLP
---^
F:\fortran programs\rty\agsdf.for(357) : Error: Syntax error, found REAL_CONSTANT '.6' when expecting one of: ( * , ) + . - % . ** / // =
   = '',F10.6)') FLP
-----------^
F:\fortran programs\rty\agsdf.for(84) : Error: Executable statements are invalid within the BLOCK DATA unit.
        WRITE(*,'(1H1,'' **** PROGRAM MCLJ ****                  ''/)')
--------^
F:\fortran programs\rty\agsdf.for(76) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [TITLE]
        CHARACTER   TITLE*80, CNFILE*30
--------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DRMAX]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
--------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DENS]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
---------------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [TEMP]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
---------------------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DENSLJ]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
---------------------------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [SIGMA]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
-----------------------------------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RMIN]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RCUT]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
------------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(67) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [BETA]
        REAL        DRMAX, DENS, TEMP, DENSLJ, SIGMA, RMIN, RCUT, BETA
------------------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(68) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DUMMY]
        REAL        RANF, DUMMY, ACM, ACATMA, PI, RATIO, SR9, SR3
--------------------------^
F:\fortran programs\rty\agsdf.for(68) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ACM]
        REAL        RANF, DUMMY, ACM, ACATMA, PI, RATIO, SR9, SR3
---------------------------------^
F:\fortran programs\rty\agsdf.for(68) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ACATMA]
        REAL        RANF, DUMMY, ACM, ACATMA, PI, RATIO, SR9, SR3
--------------------------------------^
F:\fortran programs\rty\agsdf.for(68) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RATIO]
        REAL        RANF, DUMMY, ACM, ACATMA, PI, RATIO, SR9, SR3
--------------------------------------------------^
F:\fortran programs\rty\agsdf.for(68) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [SR9]
        REAL        RANF, DUMMY, ACM, ACATMA, PI, RATIO, SR9, SR3
---------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(68) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [SR3]
        REAL        RANF, DUMMY, ACM, ACATMA, PI, RATIO, SR9, SR3
--------------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [V]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
--------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VNEW]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
-----------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VOLD]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
-----------------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VEND]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
-----------------------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VN]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
-----------------------------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DELTV]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
---------------------------------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DELTVB]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
----------------------------------------------------^
F:\fortran programs\rty\agsdf.for(69) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VS]
        REAL        V, VNEW, VOLD, VEND, VN, DELTV, DELTVB, VS
------------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [W]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
--------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WEND]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
-----------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WNEW]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
-----------------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WOLD]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
-----------------------------------^

10

帖子

2

主题

0

精华

入门

F 币
56 元
贡献
28 点
地板
 楼主| 发表于 2014-10-9 16:21:49 | 只看该作者
楚香饭 发表于 2014-10-9 15:30
请给出源码,错误提示

F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [PRES]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
-----------------------------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [DELTW]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
-----------------------------------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WS]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(70) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [PS]
        REAL        W, WEND, WNEW, WOLD, PRES, DELTW, WS, PS
----------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(71) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VLRC]
        REAL        VLRC, VLRC6, VLRC12, WLRC, WLRC6, WLRC12
--------------------^
F:\fortran programs\rty\agsdf.for(71) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VLRC6]
        REAL        VLRC, VLRC6, VLRC12, WLRC, WLRC6, WLRC12
--------------------------^
F:\fortran programs\rty\agsdf.for(71) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [VLRC12]
        REAL        VLRC, VLRC6, VLRC12, WLRC, WLRC6, WLRC12
---------------------------------^
F:\fortran programs\rty\agsdf.for(71) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WLRC]
        REAL        VLRC, VLRC6, VLRC12, WLRC, WLRC6, WLRC12
-----------------------------------------^
F:\fortran programs\rty\agsdf.for(71) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WLRC6]
        REAL        VLRC, VLRC6, VLRC12, WLRC, WLRC6, WLRC12
-----------------------------------------------^
F:\fortran programs\rty\agsdf.for(71) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [WLRC12]
        REAL        VLRC, VLRC6, VLRC12, WLRC, WLRC6, WLRC12
------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(72) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RXIOLD]
        REAL        RXIOLD, RYIOLD, RZIOLD, RXINEW, RYINEW, RZINEW
--------------------^
F:\fortran programs\rty\agsdf.for(72) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RYIOLD]
        REAL        RXIOLD, RYIOLD, RZIOLD, RXINEW, RYINEW, RZINEW
----------------------------^
F:\fortran programs\rty\agsdf.for(72) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RZIOLD]
        REAL        RXIOLD, RYIOLD, RZIOLD, RXINEW, RYINEW, RZINEW
------------------------------------^
F:\fortran programs\rty\agsdf.for(72) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RXINEW]
        REAL        RXIOLD, RYIOLD, RZIOLD, RXINEW, RYINEW, RZINEW
--------------------------------------------^
F:\fortran programs\rty\agsdf.for(72) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RYINEW]
        REAL        RXIOLD, RYIOLD, RZIOLD, RXINEW, RYINEW, RZINEW
----------------------------------------------------^
F:\fortran programs\rty\agsdf.for(72) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [RZINEW]
        REAL        RXIOLD, RYIOLD, RZIOLD, RXINEW, RYINEW, RZINEW
------------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [AVV]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
--------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [AVP]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
-------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [AVW]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ACV]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
-----------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ACP]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
----------------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ACVSQ]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
---------------------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ACPSQ]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
----------------------------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [FLV]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
-----------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(73) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [FLP]
        REAL        AVV, AVP, AVW, ACV, ACP, ACVSQ, ACPSQ, FLV, FLP
----------------------------------------------------------------^
F:\fortran programs\rty\agsdf.for(74) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [STEP]
        INTEGER     STEP, I, NSTEP, IPRINT, ISAVE, IRATIO
--------------------^
F:\fortran programs\rty\agsdf.for(74) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [I]
        INTEGER     STEP, I, NSTEP, IPRINT, ISAVE, IRATIO
--------------------------^
F:\fortran programs\rty\agsdf.for(74) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [NSTEP]
        INTEGER     STEP, I, NSTEP, IPRINT, ISAVE, IRATIO
-----------------------------^
F:\fortran programs\rty\agsdf.for(74) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [IPRINT]
        INTEGER     STEP, I, NSTEP, IPRINT, ISAVE, IRATIO
------------------------------------^
F:\fortran programs\rty\agsdf.for(74) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [ISAVE]
        INTEGER     STEP, I, NSTEP, IPRINT, ISAVE, IRATIO
--------------------------------------------^
F:\fortran programs\rty\agsdf.for(74) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [IRATIO]
        INTEGER     STEP, I, NSTEP, IPRINT, ISAVE, IRATIO
---------------------------------------------------^
F:\fortran programs\rty\agsdf.for(75) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [OVRLAP]
        LOGICAL     OVRLAP
--------------------^
F:\fortran programs\rty\agsdf.for(76) : Info: Symbol in BLOCK DATA program unit is not in a COMMON block.   [CNFILE]
        CHARACTER   TITLE*80, CNFILE*30
------------------------------^
Error executing df.exe.

rty.exe - 10 error(s), 0 warning(s)

2022

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1598 元
贡献
689 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

5#
发表于 2014-10-9 16:27:26 | 只看该作者
看起来你的源代码是自由格式的。而你使用了固定格式的扩展名 (for)试试改成 f90 扩展名。

如果还有问题,你可以上传源代码作为附件。

10

帖子

2

主题

0

精华

入门

F 币
56 元
贡献
28 点
6#
 楼主| 发表于 2014-10-9 16:36:14 | 只看该作者
fcode 发表于 2014-10-9 16:27
看起来你的源代码是自由格式的。而你使用了固定格式的扩展名 (for)试试改成 f90 扩展名。

如果还有问题 ...

请问f90的拓展名是什么?我们研一新开分子模拟课,不太明白。

2022

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1598 元
贡献
689 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

7#
发表于 2014-10-9 16:39:20 | 只看该作者
你现在的文件名是 agsdf.for,改成 agsdf.f90 然后重新编译

10

帖子

2

主题

0

精华

入门

F 币
56 元
贡献
28 点
8#
 楼主| 发表于 2014-10-9 17:48:32 | 只看该作者
fcode 发表于 2014-10-9 16:39
你现在的文件名是 agsdf.for,改成 agsdf.f90 然后重新编译

非常感谢。我输入了一个特别简单的程序,都有错误。代码:
      PROGRAM mc


      do icyc1=1,ncycl
        call mcmove
          if (mod(icyc1,nsamp).eq.0)
        +  call sample
        enddo
        end

错误信息:--------------------Configuration: hai - Win32 Debug--------------------
Compiling Fortran...
F:\fortran programs\hai\ad.f90
F:\fortran programs\hai\ad.f90(6) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: BLOCK BLOCKDATA PROGRAM TYPE COMPLEX BYTE CHARACTER DOUBLE DOUBLECOMPLEX ...
   if (mod(icyc1,nsamp).eq.0)
------------------------------------^
F:\fortran programs\hai\ad.f90(7) : Error: Syntax error, found '+' when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK BLOCKDATA PROGRAM TYPE COMPLEX BYTE CHARACTER ...
+  call sample
--------^
Error executing df.exe.

hai.exe - 2 error(s), 0 warning(s)

725

帖子

4

主题

0

精华

大师

农村外出务工人员

F 币
657 元
贡献
337 点

新人勋章爱心勋章水王勋章元老勋章热心勋章

9#
发表于 2014-10-9 17:58:23 | 只看该作者
[Fortran] 纯文本查看 复制代码
PROGRAM mc
       do icyc1=1,ncycl
         call mcmove
           if (mod(icyc1,nsamp).eq.0) call sample  !// 写成一行既可
         enddo
         end

10

帖子

2

主题

0

精华

入门

F 币
56 元
贡献
28 点
10#
 楼主| 发表于 2014-10-9 18:13:49 | 只看该作者
楚香饭 发表于 2014-10-9 17:58
[mw_shl_code=fortran,true]PROGRAM mc
       do icyc1=1,ncycl
         call mcmove

请问这个是什么意思呢:--------------------Configuration: hahaha - Win32 Debug--------------------
Compiling Fortran...
F:\fortran programs\hahaha\haah.f90
F:\fortran programs\hahaha\haah.f90(2) : Warning: Variable NCYCL is used before its value has been defined
       do icyc1=1,ncycl
------------------^
F:\fortran programs\hahaha\haah.f90(4) : Warning: Variable NSAMP is used before its value has been defined
           if (mod(icyc1,nsamp).eq.0) call sample  
-------------------------^
Linking...
haah.obj : error LNK2001: unresolved external symbol _MCMOVE@0
haah.obj : error LNK2001: unresolved external symbol _SAMPLE@0
Debug/hahaha.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

hahaha.exe - 3 error(s), 2 warning(s)
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-11-24 01:07

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表