线性晶格态密度的Fortran编码
编写的代码包含一些错误。我正在使用Visual Studio 2012和Intel.Visual.Fortran.Composer.XE.2013.0.089编译器 这是我写的代码线性晶格态密度的Fortran编码,fortran,Fortran,编写的代码包含一些错误。我正在使用Visual Studio 2012和Intel.Visual.Fortran.Composer.XE.2013.0.089编译器 这是我写的代码 PROGRAM DensityOfState IMPLICIT NONE INTEGER :: omega , t0 , a0 ,kx omega=1 ; t0 =1 ; a0=1 REAL :: kx , eta , w , ek eta=0.0015 REAL,PARAMETER :: pi=
PROGRAM DensityOfState
IMPLICIT NONE
INTEGER :: omega , t0 , a0 ,kx
omega=1 ; t0 =1 ; a0=1
REAL :: kx , eta , w , ek
eta=0.0015
REAL,PARAMETER :: pi=3.14
COMPLEX , PARAMETER ::i=(0,1)
COMPLEX :: Energy
COMPLEX :: Density
COMPLEX :: GreenFunc
LoopEnergy : DO w=-2,+2,0.001
WRITE(*,*) Energy= w +( i * eta)
LoopWaveVector : DO kx=-1000,1000
WRITE(*,*) ek= 2*t0*COS(kx*a0)
WRITE(*,*) GreenFunc= Energy - ek
END DO LoopEnergy
END DO LoopWaveVector
WRITE(*,*) IMAG(GreenFunc)
Density= (1.0/pi*omega)*IMAG(GreenFunc)
WRITE(*,*) Density
END PROGRAM DensityOfState
这是一个错误列表
Error 1 error #5082: Syntax error, found IDENTIFIER 'ENERGY' when expecting one of: ( % [ . =
1>------ Build started: Project: Console3, Configuration: Debug Win32 ------
1>Compiling with Intel(R) Visual Fortran Compiler XE 13.0.0.089 [IA-32]...
1>Source1.f90
error #5082: Syntax error, found IDENTIFIER 'ENERGY' when expecting one of: ( % [ . = =>
error #5082: Syntax error, found IDENTIFIER 'EK' when expecting one of: ( % [ . = =>
error #5082: Syntax error, found IDENTIFIER 'GREENFUNC' when expecting one of: ( % [ . = =>
error #6236: A specification statement cannot appear in the executable section.
error #6236: A specification statement cannot appear in the executable section.
error #6236: A specification statement cannot appear in the executable section.
error #6236: A specification statement cannot appear in the executable section.
error #6236: A specification statement cannot appear in the executable section.
error #6236: A specification statement cannot appear in the executable section.
error #6404: This name does not have a type, and must have an explicit type. [ETA]
error #6404: This name does not have a type, and must have an explicit type. [W]
error #6063: An INTEGER or REAL data type is required in this context. [W]
warning #6041: The increment in a DO is zero or evaluates to zero. [0.001]
error #6458: This name must be the name of a variable with a derived type (structure type) [WRITE]
error #6404: This name does not have a type, and must have an explicit type. [I]
error #6458: This name must be the name of a variable with a derived type (structure type) [WRITE]
warning #7319: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [COS]
1 error #6404: This name does not have a type, and must have an explicit type. [COS]
error #6458: This name must be the name of a variable with a derived type (structure type) [WRITE]
error #6404: This name does not have a type, and must have an explicit type. [ENERGY]
error #6404: This name does not have a type, and must have an explicit type. [EK]
error #6606: The block construct names must match, and they do not. [LOOPENERGY]
error #6606: The block construct names must match, and they do not. [LOOPWAVEVECTOR]
error #6404: This name does not have a type, and must have an explicit type. [GREENFUNC]
warning #7319: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [IMAG]
error #6404: This name does not have a type, and must have an explicit type. [IMAG]
error #6404: This name does not have a type, and must have an explicit type. [DENSITY]
error #6404: This name does not have a type, and must have an explicit type. [PI]
1>compilation aborted for c:\users\mahdi\documents\visual studio 2012\Projects\Console3\Console3\Source1.f90 (code 1)
不是正确的Fortran语句。要将w+(i*eta)
分配给能量
,只需使用
Energy= w +( i * eta)
要打印能量值,只需
WRITE(*,*) Energy
欢迎光临,请拿着这本书阅读。请对问题中的代码使用正确的格式,并对所有Fortran问题使用tag。非常感谢。错误已修复。
WRITE(*,*) Energy