- #1
MahdiI84
- 22
- 1
- TL;DR Summary
- hi ,I wrote the code in Fortran for the density of state of a linear lattice. Because I am new to Fortran coding, my program has many errors. Please help me. Thank you.
Fortran:
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
((AND ERRORS))
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.
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)
Last edited by a moderator: