| New Reply |
Fortran Question |
Share Thread |
| Jun22-12, 08:44 PM | #1 |
|
|
Fortran Question
Hello everyone, i'm new here and i have a question:
I did this fortran code and isn't work, but i think the problem is my codeblocks Someone can execute the code and if they presents some errors help me also? |
| Jun22-12, 08:46 PM | #2 |
|
|
The code: http://codepaste.net/s23byg
|
| Jun22-12, 08:54 PM | #3 |
|
Mentor
|
How about you tell us the error messages that you get (copy and paste them), and which lines of code they refer to?
|
| Jun22-12, 09:08 PM | #4 |
|
|
Fortran Question
fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|74|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 74 .6:|
||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|78|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 78 .73:| ||Error: Letter A already has an IMPLICIT type | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|79|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 79 .29:| ||Error: Letter C already has an IMPLICIT type | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|80|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 80 .19:| ||Error: VARIABLE attribute of 'x' conflicts with PARAMETER attribute | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|81|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 81 .17:| ||Error: Duplicate DIMENSION attribute specified | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|82|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 82 .29:| ||Error: Symbol 'cw' already has basic type of COMPLEX| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|90|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 90 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|91|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 91 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|92|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 92 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|93|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 93 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|95|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 95 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|96|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 96 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|97|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 97 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|98|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 98 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|103|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 103 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|105|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 105 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|112|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 112 .9:| ||Error: Expecting END PROGRAM statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|116|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 116 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|120|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 120 .32:| ||Error: Letter A already has an IMPLICIT type | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|121|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 121 .23:| ||Error: PARAMETER attribute of 'nz' conflicts with PARAMETER attribute | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|122|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 122 .21:| ||Error: Unexpected attribute declaration statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|125|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 125 .29:| ||Error: Unexpected STATEMENT FUNCTION statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|129|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 129 .9:| ||Error: Expecting END PROGRAM statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|133|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 133 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|137|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 137 .32:| ||Error: Letter A already has an IMPLICIT type | ||Fatal Error: Error count reached limit of 25.| ||=== Build finished: 26 errors, 0 warnings (0 minutes, 1 seconds) ===| I think the program doesn't recognize the subrotines as subrotines.. ||Error: Letter C already has an IMPLICIT type|| suggest this |
| Jun22-12, 09:08 PM | #5 |
|
|
Btw, you must see the code to understand what i mean
|
| Jun22-12, 10:18 PM | #6 |
|
Mentor
|
Here's your code. Why didn't you just post it here?
I believe that the errors are due to your lack of a PROGRAM statement (and an END statement for it. Code:
!
IMPLICIT REAL (8) (A-B,D-H, O-Z) !Define numeros reais e imaginarios
IMPLICIT COMPLEX (8)(C)
PARAMETER(NZ=501,L=2) !Define parametros
!
DIMENSION D1(L,L) , P(L,L) , D(L,L) , X(NZ) , Y(NZ)
DIMENSION V(NZ), Q(L,L)
COMPLEX (8) CW(NZ), CKP(X,X), CTRANSM(L,L), CT(L,L)
!OPEN(UNIT=12,FILE='ENERGY.DAT',FORM='FORMATTED')
!OPEN(UNIT=13,FILE='PSI0.DAT',FORM='FORMATTED')
!OPEN(UNIT=14,FILE='PSI.DAT',FORM='FORMATTED')
!
!
!307 FORMAT(86(2X,E14.7))
!308 FORMAT(I5,86(2X,E14.7))
AM = 0.067D0 !Massa efetiva do e- (GaAs)
EPS = 12.5D0 !Constante dielétrica (GaAs)
RY = 13.6058D3 * AM / EPS / EPS
A0 = 0.5292D0 * EPS / AM
PI = 4.D0 * DATAN(1.D0)
CZ = (0.D0,1.D0)
WRITE(*,*)'INSIRA ENERGIA DA PARTICULA INCIDENTE (meV)=' !Insere variável
READ(*,*) E1
E = E1/RY
! WRITE(*,*)'INSIRA A MASSA DA PARTICULA INCIDENTE=' !Insere variável
! READ(*,*) MASSA
WRITE(*,*)'INSIRA O COMPRIMENTO=' !Insere variável
READ(*,*) ALF
AL = ALF/A0
DZ = AL/NZ-1
CALL MESH (DZ,Z)
CALL POTE(A0,RY,AL,Z,V)
K2 = DSQRT(E-V(NZ))
DO M=NZ,2
KB = DSQRT(E-V(M-1))
DM = K2/KB
C = CDEXP(CZ*K2*DZ)
CW(M) = C
X(M) = (1 + DM)/2
Y(M) = (1 - DM)/2
K2 = KB
ENDDO
D1 (1,1) = X(1)
D1 (2,1) = Y(1)
D1 (1,2) = Y(1)
D1 (2,2) = X(1)
CALL CALCM(X,Y,CW,KW)
CT = D1*KW
CT(2,1) = T1
CT(1,2) = T2
CTRANSM = 1 - (DABS(T1)**2)/DABS(T2)**2
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SUBROUTINE CALCM(X,Y,CW,KW)
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
IMPLICIT REAL (8) (A-B,D-H,O-Z) !Define numeros reais e imaginarios
IMPLICIT COMPLEX (8)(C)
PARAMETER(X=2, NZ=501)
DIMENSION D(X,X), P(X,X), C(X,X)
COMPLEX (8) CP(X,X), CW(NZ), CQ(X,X) , CKP(X,X), CK3(X,X), CDP(X,X)
DO M = NZ,2
D (1,1) = X(M)
D (2,1) = Y(M)
D (1,2) = Y(M)
D (2,2) = X(M)
CP (1,1) = CW(M)
CP (2,1) = (0.D0,0.D0)
CP (1,2) = (0.D0,0.D0)
CP (2,2) = DCONJG(CW(M))
KY(1,1) = D(1,1)*P(1,1)+D(1,2)*P(2,1)
KY(1,2) = D(1,1)*P(1,2)+D(1,2)*P(2,2)
KY(2,1) = D(2,1)*P(1,1)+D(2,2)*P(2,1)
KY(2,2) = D(2,1)*P(1,2)+D(2,2)*P(2,2)
ENDDO
KY(NZ-1)*KY(NZ)=KW
DO M=NZ,2
KY(NZ-2)*KW=KX
KW=KX
ENDDO
RETURN
END SUBROUTINE CALCM
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
SUBROUTINE MESH(DZ,Z)
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
IMPLICIT REAL(8) (A-H,O-Z)
PARAMETER (NZ=501)
DIMENSION Z(NZ)
!
DO I=1,NZ
Z(I) = DFLOAT(I-1) * DZ
ENDDO
!
RETURN
END SUBROUTINE MESH
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SUBROUTINE POTE(A0,RY,AL,Z,POTF) !**********
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IMPLICIT REAL(8) (A-H,O-Z)
PARAMETER (NZ=501)
DIMENSION Z(NZ), POTF(NZ)
ALH = 0.5D0 * AL !MEIO DO SISTEMA
DQW = 20.D0 / A0 ! DISTANCIA ENTRE POCOS
DQWH = 0.5D0 * DQW
QW = 100.D0 / A0 ! LARGURA DOS POCOS
QWH = 0.5D0 * QW
AT = DQWH + QW
DO IZ=1,NZ
ZW = Z(IZ) - ALH
POTF(IZ) = 0.D0
IF(DABS(ZW).GT.DQWH.AND.DABS(ZW).LT.AT) POTF(IZ) = 400.D0/RY
ENDDO
!
RETURN
END SUBROUTINE POTE
|
| Jun24-12, 11:45 AM | #7 |
|
|
But where? i searched for this erros so many times and found nothing
|
| Jun24-12, 12:13 PM | #8 |
|
Mentor
|
You need to separate the main program from its subroutines.
Code:
PROGRAM XYZ IMPLICIT REAL (8) (A-B,D-H, O-Z) !Define numeros reais e imaginarios IMPLICIT COMPLEX (8)(C) PARAMETER(NZ=501,L=2) !Define parametros ! DIMENSION D1(L,L) , P(L,L) , D(L,L) , X(NZ) , Y(NZ) DIMENSION V(NZ), Q(L,L) COMPLEX (8) CW(NZ), CKP(X,X), CTRANSM(L,L), CT(L,L) !OPEN(UNIT=12,FILE='ENERGY.DAT',FORM='FORMATTED') !OPEN(UNIT=13,FILE='PSI0.DAT',FORM='FORMATTED') !OPEN(UNIT=14,FILE='PSI.DAT',FORM='FORMATTED') ! ! !307 FORMAT(86(2X,E14.7)) !308 FORMAT(I5,86(2X,E14.7)) AM = 0.067D0 !Massa efetiva do e- (GaAs) EPS = 12.5D0 !Constante dielétrica (GaAs) RY = 13.6058D3 * AM / EPS / EPS A0 = 0.5292D0 * EPS / AM PI = 4.D0 * DATAN(1.D0) CZ = (0.D0,1.D0) WRITE(*,*)'INSIRA ENERGIA DA PARTICULA INCIDENTE (meV)=' !Insere variável READ(*,*) E1 E = E1/RY ! WRITE(*,*)'INSIRA A MASSA DA PARTICULA INCIDENTE=' !Insere variável ! READ(*,*) MASSA WRITE(*,*)'INSIRA O COMPRIMENTO=' !Insere variável READ(*,*) ALF AL = ALF/A0 DZ = AL/NZ-1 CALL MESH (DZ,Z) CALL POTE(A0,RY,AL,Z,V) K2 = DSQRT(E-V(NZ)) DO M=NZ,2 KB = DSQRT(E-V(M-1)) DM = K2/KB C = CDEXP(CZ*K2*DZ) CW(M) = C X(M) = (1 + DM)/2 Y(M) = (1 - DM)/2 K2 = KB ENDDO D1 (1,1) = X(1) D1 (2,1) = Y(1) D1 (1,2) = Y(1) D1 (2,2) = X(1) CALL CALCM(X,Y,CW,KW) CT = D1*KW CT(2,1) = T1 CT(1,2) = T2 CTRANSM = 1 - (DABS(T1)**2)/DABS(T2)**2 END PROGRAM XYZ |
| Jun25-12, 06:56 PM | #9 |
|
|
I did but don't work :(
Code: PROGRAM ABCDE IMPLICIT REAL (8) (A-B,D-H, O-Z) !Define numeros reais e imaginarios IMPLICIT COMPLEX (8)(C) PARAMETER(NZ=501,L=2) !Define parametros ! DIMENSION D1(L,L) , P(L,L) , D(L,L) , X(NZ) , Y(NZ) DIMENSION V(NZ), Q(L,L) COMPLEX (8) CW(NZ), CKP(X,X), CTRANSM(L,L), CT(L,L) !OPEN(UNIT=12,FILE='ENERGY.DAT',FORM='FORMATTED') !OPEN(UNIT=13,FILE='PSI0.DAT',FORM='FORMATTED') !OPEN(UNIT=14,FILE='PSI.DAT',FORM='FORMATTED') ! ! !307 FORMAT(86(2X,E14.7)) !308 FORMAT(I5,86(2X,E14.7)) AM = 0.067D0 !Massa efetiva do e- (GaAs) EPS = 12.5D0 !Constante dielétrica (GaAs) RY = 13.6058D3 * AM / EPS / EPS A0 = 0.5292D0 * EPS / AM PI = 4.D0 * DATAN(1.D0) CZ = (0.D0,1.D0) WRITE(*,*)'INSIRA ENERGIA DA PARTICULA INCIDENTE (meV)=' !Insere variável READ(*,*) E1 E = E1/RY ! WRITE(*,*)'INSIRA A MASSA DA PARTICULA INCIDENTE=' !Insere variável ! READ(*,*) MASSA WRITE(*,*)'INSIRA O COMPRIMENTO=' !Insere variável READ(*,*) ALF AL = ALF/A0 DZ = AL/NZ-1 CALL MESH (DZ,Z) CALL POTE(A0,RY,AL,Z,V) K2 = DSQRT(E-V(NZ)) DO M=NZ,2 KB = DSQRT(E-V(M-1)) DM = K2/KB C = CDEXP(CZ*K2*DZ) CW(M) = C X(M) = (1 + DM)/2 Y(M) = (1 - DM)/2 K2 = KB ENDDO D1 (1,1) = X(1) D1 (2,1) = Y(1) D1 (1,2) = Y(1) D1 (2,2) = X(1) CALL CALCM(X,Y,CW,KW) CT = D1*KW CT(2,1) = T1 CT(1,2) = T2 CTRANSM = 1 - (DABS(T1)**2)/DABS(T2)**2 END PROGRAM ABCDE !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ SUBROUTINE CALCM(X,Y,CW,KW) !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ! IMPLICIT REAL (8) (A-B,D-H,O-Z) !Define numeros reais e imaginarios IMPLICIT COMPLEX (8)(C) PARAMETER(X=2, NZ=501) DIMENSION D(X,X), P(X,X), C(X,X) COMPLEX (8) CP(X,X), CW(NZ), CQ(X,X) , CKP(X,X), CK3(X,X), CDP(X,X) DO M = NZ,2 D (1,1) = X(M) D (2,1) = Y(M) D (1,2) = Y(M) D (2,2) = X(M) CP (1,1) = CW(M) CP (2,1) = (0.D0,0.D0) CP (1,2) = (0.D0,0.D0) CP (2,2) = DCONJG(CW(M)) KY(1,1) = D(1,1)*P(1,1)+D(1,2)*P(2,1) KY(1,2) = D(1,1)*P(1,2)+D(1,2)*P(2,2) KY(2,1) = D(2,1)*P(1,1)+D(2,2)*P(2,1) KY(2,2) = D(2,1)*P(1,2)+D(2,2)*P(2,2) ENDDO KY(NZ-1)*KY(NZ)=KW DO M=NZ,2 KY(NZ-2)*KW=KX KW=KX ENDDO RETURN END SUBROUTINE CALCM !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ! SUBROUTINE MESH(DZ,Z) !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ! IMPLICIT REAL(8) (A-H,O-Z) PARAMETER (NZ=501) DIMENSION Z(NZ) ! DO I=1,NZ Z(I) = DFLOAT(I-1) * DZ ENDDO ! RETURN END SUBROUTINE MESH !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ SUBROUTINE POTE(A0,RY,AL,Z,POTF) !********** !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IMPLICIT REAL(8) (A-H,O-Z) PARAMETER (NZ=501) DIMENSION Z(NZ), POTF(NZ) ALH = 0.5D0 * AL !MEIO DO SISTEMA DQW = 20.D0 / A0 ! DISTANCIA ENTRE POCOS DQWH = 0.5D0 * DQW QW = 100.D0 / A0 ! LARGURA DOS POCOS QWH = 0.5D0 * QW AT = DQWH + QW DO IZ=1,NZ ZW = Z(IZ) - ALH POTF(IZ) = 0.D0 IF(DABS(ZW).GT.DQWH.AND.DABS(ZW).LT.AT) POTF(IZ) = 400.D0/RY ENDDO ! RETURN END SUBROUTINE POTE Errors: fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|76|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 76 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|80|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 80 .73:| ||Error: Letter A already has an IMPLICIT type | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|81|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 81 .29:| ||Error: Letter C already has an IMPLICIT type | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|82|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 82 .19:| ||Error: VARIABLE attribute of 'x' conflicts with PARAMETER attribute | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|83|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 83 .17:| ||Error: Duplicate DIMENSION attribute specified | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|84|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 84 .29:| ||Error: Symbol 'cw' already has basic type of COMPLEX| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|92|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 92 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|93|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 93 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|94|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 94 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|95|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 95 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|97|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 97 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|98|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 98 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|99|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 99 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|100|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 100 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|105|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 105 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|107|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 107 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|114|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 114 .9:| ||Error: Expecting END PROGRAM statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|118|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 118 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|122|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 122 .32:| ||Error: Letter A already has an IMPLICIT type | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|123|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 123 .23:| ||Error: PARAMETER attribute of 'nz' conflicts with PARAMETER attribute | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|124|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 124 .21:| ||Error: Unexpected attribute declaration statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|127|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 127 .29:| ||Error: Unexpected STATEMENT FUNCTION statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|131|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 131 .9:| ||Error: Expecting END PROGRAM statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|135|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 135 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|139|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 139 .32:| ||Error: Letter A already has an IMPLICIT type | ||Fatal Error: Error count reached limit of 25.| ||=== Build finished: 26 errors, 0 warnings (0 minutes, 1 seconds) ===| I'm sorry but i don't know how i put the code in a box like you, if you tell me i edit my post, thanks. |
| Jun25-12, 07:51 PM | #10 |
|
Mentor
|
Put "[code]" before your code and "[/code]" after it.
|
| Jun25-12, 08:12 PM | #11 |
|
Mentor
|
I'm not an expert in Fortran 90, but I believe one of your problems is that you aren't declaring your arrays and other variables correctly.
For example, here's how you should be declaring a two-dimension array of reals: REAL, DIMENSION(4,20) :: F Also, you are using statements such as IMPLICIT REAL (8) (A-B,D-H,O-Z) and I think this is causing problems with arrays that start with one of these letters (such as D, which you later use as an array). In the CALCM subroutine, you have this code: KY(NZ-1)*KY(NZ)=KW I don't know what you're trying to do in that line of code. There's a similar problem two lines down from that one. Also in CALCM, X is one of the formal parameters, but you declare it as a PARAMETER (that is, a constant) inside this subroutine. Later you use it as an array, as in this code D (1,1) = X(M). I'm sure it's confusing, but a subroutine or function parameter is not the same thing as a PARAMETER, which is a constant. A subroutine parameter is a placeholder for a value that is passed to the subroutine. Also, you have some statement BTW, put a [code] tag at the top of your code and a [/code] tag at the bottom. |
| Jun25-12, 09:30 PM | #12 |
|
|
2) I need remove this line? IMPLICIT REAL (8) (A-B,D-H,O-Z) 3) In this part i try calculate KY, and after to do: KY(500)*KY(501)=KW KY(NZ-2)*KW=KX KW=KX where renew KW I have a matrix[L,L] with D e P, where D depends on the X,Y and P depends on the CW. I believe that i can use a matrix in a "DO" using just one variable, like KW(NZ).. I don't know if i was clear.. But if i'm wrong, how i fix it? Code:
KY(1,1) = D(1,1)*P(1,1)+D(1,2)*P(2,1)
KY(1,2) = D(1,1)*P(1,2)+D(1,2)*P(2,2)
KY(2,1) = D(2,1)*P(1,1)+D(2,2)*P(2,1)
KY(2,2) = D(2,1)*P(1,2)+D(2,2)*P(2,2)
ENDDO
KY(NZ-1)*KY(NZ)=KW
DO M=NZ,2
KY(NZ-2)*KW=KX
KW=KX
Code: Code:
PROGRAM ABCDE
IMPLICIT REAL (8) (A-B,D-H, O-Z) !Define numeros reais e imaginarios
IMPLICIT COMPLEX (8)(C)
PARAMETER(NZ=501,L=2) !Define parametros
!
REAL, DIMENSION(L,L) :: D1
REAL, DIMENSION(L,L) :: P
REAL, DIMENSION(L,L) :: D
REAL, DIMENSION(L,L) :: Q
REAL, DIMENSION(NZ) :: X
REAL, DIMENSION(NZ) :: Y
REAL, DIMENSION(NZ) :: V
COMPLEX, DIMENSION(NZ) :: CW
COMPLEX, DIMENSION(L,L) :: CKP
COMPLEX, DIMENSION(L,L) :: CTRANSM
COMPLEX, DIMENSION(L,L) :: CT
!OPEN(UNIT=12,FILE='ENERGY.DAT',FORM='FORMATTED')
!OPEN(UNIT=13,FILE='PSI0.DAT',FORM='FORMATTED')
!OPEN(UNIT=14,FILE='PSI.DAT',FORM='FORMATTED')
!
!
!307 FORMAT(86(2X,E14.7))
!308 FORMAT(I5,86(2X,E14.7))
AM = 0.067D0 !Massa efetiva do e- (GaAs)
EPS = 12.5D0 !Constante dielétrica (GaAs)
RY = 13.6058D3 * AM / EPS / EPS
A0 = 0.5292D0 * EPS / AM
PI = 4.D0 * DATAN(1.D0)
CZ = (0.D0,1.D0)
WRITE(*,*)'INSIRA ENERGIA DA PARTICULA INCIDENTE (meV)=' !Insere variável
READ(*,*) E1
E = E1/RY
! WRITE(*,*)'INSIRA A MASSA DA PARTICULA INCIDENTE=' !Insere variável
! READ(*,*) MASSA
WRITE(*,*)'INSIRA O COMPRIMENTO=' !Insere variável
READ(*,*) ALF
AL = ALF/A0
DZ = AL/NZ-1
CALL MESH (DZ,Z)
CALL POTE(A0,RY,AL,Z,V)
K2 = DSQRT(E-V(NZ))
DO M=NZ,2
KB = DSQRT(E-V(M-1))
DM = K2/KB
C = CDEXP(CZ*K2*DZ)
CW(M) = C
X(M) = (1 + DM)/2
Y(M) = (1 - DM)/2
K2 = KB
ENDDO
D1 (1,1) = X(1)
D1 (2,1) = Y(1)
D1 (1,2) = Y(1)
D1 (2,2) = X(1)
CALL CALCM(X,Y,CW,KW)
CT = D1*KW
CT(2,1) = T1
CT(1,2) = T2
CTRANSM = 1 - (DABS(T1)**2)/DABS(T2)**2
END PROGRAM ABCDE
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SUBROUTINE CALCM(X,Y,CW,KW)
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
IMPLICIT REAL (8) (A-B,D-H,O-Z) !Define numeros reais e imaginarios
IMPLICIT COMPLEX (8)(C)
PARAMETER(L=2, NZ=501)
DIMENSION D(L,L), P(L,L), C(L,L)
COMPLEX (8) CP(L,L), CW(NZ), CQ(L,L) , CKP(L,L), CK3(L,L), CDP(L,L)
DO M = NZ,2
D (1,1) = X(M)
D (2,1) = Y(M)
D (1,2) = Y(M)
D (2,2) = X(M)
CP (1,1) = CW(M)
CP (2,1) = (0.D0,0.D0)
CP (1,2) = (0.D0,0.D0)
CP (2,2) = DCONJG(CW(M))
KY(1,1) = D(1,1)*P(1,1)+D(1,2)*P(2,1)
KY(1,2) = D(1,1)*P(1,2)+D(1,2)*P(2,2)
KY(2,1) = D(2,1)*P(1,1)+D(2,2)*P(2,1)
KY(2,2) = D(2,1)*P(1,2)+D(2,2)*P(2,2)
ENDDO
KY(NZ-1)*KY(NZ)=KW
DO M=NZ,2
KY(NZ-2)*KW=KX
KW=KX
ENDDO
RETURN
END SUBROUTINE CALCM
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
SUBROUTINE MESH(DZ,Z)
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
IMPLICIT REAL(8) (A-H,O-Z)
PARAMETER (NZ=501)
DIMENSION Z(NZ)
!
DO I=1,NZ
Z(I) = DFLOAT(I-1) * DZ
ENDDO
!
RETURN
END SUBROUTINE MESH
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SUBROUTINE POTE(A0,RY,AL,Z,POTF) !**********
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IMPLICIT REAL(8) (A-H,O-Z)
PARAMETER (NZ=501)
DIMENSION Z(NZ), POTF(NZ)
ALH = 0.5D0 * AL !MEIO DO SISTEMA
DQW = 20.D0 / A0 ! DISTANCIA ENTRE POCOS
DQWH = 0.5D0 * DQW
QW = 100.D0 / A0 ! LARGURA DOS POCOS
QWH = 0.5D0 * QW
AT = DQWH + QW
DO IZ=1,NZ
ZW = Z(IZ) - ALH
POTF(IZ) = 0.D0
IF(DABS(ZW).GT.DQWH.AND.DABS(ZW).LT.AT) POTF(IZ) = 400.D0/RY
ENDDO
!
RETURN
END SUBROUTINE POTE
Code:
fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|110|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 110 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|111|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 111 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|112|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 112 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|113|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 113 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|118|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 118 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|120|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 120 .6:| ||Error: Unclassifiable statement | fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|52|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 52 .20:| ||Warning: Rank mismatch in argument 'z' (rank-1 and scalar)| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|54|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 54 .25:| ||Warning: Rank mismatch in argument 'z' (rank-1 and scalar)| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|57|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 57 .15:| ||Warning: DO loop will be executed zero times| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|98|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 98 .17:| ||Warning: DO loop will be executed zero times| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|119|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 119 .15:| ||Warning: DO loop will be executed zero times| fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90|74|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira 2.f90 74 .16:| ||Warning: Type mismatch in argument 'x' ; passed REAL(4) to REAL(8)| ||=== Build finished: 6 errors, 6 warnings (0 minutes, 0 seconds) ===| |
| Jun25-12, 09:50 PM | #13 |
|
|
|
| Jun26-12, 10:19 AM | #14 |
|
Mentor
|
You can do this: KW = KY(500) * KY(501) Here I multiply the two array elements and store the result in KW. You have a two-dimension matrix. What does "D e P" mean? You can operate on a matrix in a DO loop. If the matrix has two indexes, both must be present, although there is a shortcut you can use to operate only on the rows or the columns, something like KW(I, :). When I wrote Fortran code, that wasn't part of the language. The comments below apply to your CALCM subroutine. For example, the second IMPLICIT line says that any variable whose name begins with 'C' is a complex number. I believe this conflicts with your declaration a few lines later of CP, CW, and so on, all of which are arrays. The subroutine formal parameters are X, Y, CW, and KW. You should have explicit declarations for each of these, as well as the explicit declarations of the other variables that you are using in this subroutine. Your array declarations are still wrong. They should look like this: Code:
REAL, DIMENSION(L,L) :: KW REAL, DIMENSION(NZ) :: X COMPLEX, DIMENSION(NZ) :: CW Code:
REAL*8, DIMENSION(L,L) :: KW REAL*8, DIMENSION(NZ) :: X COMPLEX*16, DIMENSION(NZ) :: CW The same comments apply to your MESH and POTE subroutines. Finally, you should clean up your main PROGRAM. As I said before, get rid of the two IMPLICIT statements at the top, and explicitly declare each variable that you use in the PROGRAM part of your code, but only those variables. Make sure that you declare array variables as arrays. It looks to me like you are declaring every variable in the PROGRAM section, including the ones used in the subroutines. Declare only the variables that are used in the main program. |
| Jun26-12, 06:14 PM | #15 |
|
Mentor
|
I forgot to mention that there is some information in the error messages that can be useful. In post #9 you gave a long list of errors such as this one:
fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90|76|fica\Programa Computacional\FORTRAN\Particula incidente em uma barreira\particula incidente em uma barreira.f90 76 .6:| The last two numbers at the end indicate (I believe) the line where the error occurred, and possibly the position in the line. One thing that makes me nervous is that your directory name and file name have lots of spaces in them. I don't know the requirements of your compiler and linker, but many will complain if there are spaces in the file name. |
| Jun27-12, 03:16 PM | #16 |
|
|
|
| Jul2-12, 08:47 PM | #17 |
|
|
In the subrotine, if i want do a loop with matrix, how i define the matrix?
I try this but didnt work, i believe that the logica is right (i did in a paper before) The lines with "!" i left just like a base for me Code:
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SUBROUTINE CALCM(X,Y,CW,KW)
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
IMPLICIT REAL (8) (A-B,D-H,O-Z) !Define numeros reais e imaginarios
IMPLICIT COMPLEX (8)(C)
PARAMETER(L=2, NZ=501)
DIMENSION KY(L,L)
COMPLEX (8) CKY(L,L), CKW(L,L,NZ), CKJ (L,L,NZ)
!faz o D*P para todos as barreiras D2*P2, D3*P3..
DO M = NZ,2
CKY(1,1) = X(M)*CW(M)
CKY(1,2) = Y(M)*DCONJG(CW(M)
CKY(2,1) = Y(M)*CW(M)
CKY(2,2) = X(M)*DCONJG(CW(M)
ENDDO
!faz a primeira multiplicação de trás pra frente (D500*P500)*(D501*P501)
CKW(1,1,NZ) = CKY(1,1,NZ-1)*CKY(1,1,NZ) + CKY(1,2,NZ-1)*CKY(2,1,NZ)
CKW(1,2,NZ) = CKY(1,1,NZ-1)*CKY(1,2,NZ) + CKY(1,2,NZ-1)*CKY(2,2,NZ)
CKW(2,1,NZ) = CKY(2,1,NZ-1)*CKY(1,1,NZ) + CKY(2,2,NZ-1)*CKY(2,1,NZ)
CKW(2,2,NZ) = CKY(2,1,NZ-1)*CKY(1,2,NZ) + CKY(2,2,NZ-1)*CKY(2,2,NZ)
DO M = NZ-2,2
!CKJ = CKY(M)*CKW
CKJ(1,1,M) = CKY(1,1,M)*CKY(1,1,NZ) + CKY(1,2,M)*CKY(2,1,NZ)
CKJ(1,2,M) = CKY(1,1,M)*CKY(1,2,NZ) + CKY(1,2,M)*CKY(2,2,NZ)
CKJ(2,1,M) = CKY(2,1,M)*CKY(1,1,NZ) + CKY(2,2,M)*CKY(2,1,NZ)
CKJ(2,2,M) = CKY(2,1,M)*CKY(1,2,NZ) + CKY(2,2,M)*CKY(2,2,NZ)
!CKW = CKJ
CKW(1,1,NZ) = CKJ(1,1,M)
CKW(1,2,NZ) = CKJ(1,1,M)
CKW(2,1,NZ) = CKY(2,1,M)
CKW(2,2,NZ) = CKY(2,1,M)
!D(1,1) = X(M)
!D(2,1) = Y(M)
!D(1,2) = Y(M)
!D(2,2) = X(M)
!CP(1,1) = CW(M)
!CP(2,1) = (0.D0,0.D0)
!CP(1,2) = (0.D0,0.D0)
!CP(2,2) = DCONJG(CW(M))
!CKY(1,1,M) = D(1,1)*CP(1,1)+D(1,2)*P(2,1)
!KY(1,2,M) = D(1,1)*P(1,2)+D(1,2)*P(2,2)
!KY(2,1,M) = D(2,1)*P(1,1)+D(2,2)*P(2,1)
!KY(2,2,M) = D(2,1)*P(1,2)+D(2,2)*P(2,2)
ENDDO
RETURN
END SUBROUTINE CALCM
|
| New Reply |
Similar discussions for: Fortran Question
|
||||
| Thread | Forum | Replies | ||
| Fortran 77 help making an empty array (or blank list if they exist in fortran) | Programming & Comp Sci | 5 | ||
| fortran 90 question | Programming & Comp Sci | 1 | ||
| Fortran 90 Question | Programming & Comp Sci | 6 | ||
| Accessing Fortran Modules within a Fortran library from Fortran | Programming & Comp Sci | 0 | ||