Bonjour,
je suis en train de faire un programme sur Fortran 77 de tirage au sort des énergies d'un spectre.
Donc voici les codes du programme; j'en ai deux : un avec une fonction rando et un avec la fonction rando_number mais j'ai un probleme à l'éxécution, il me dit que la routine, ligne et source sont inconnues si vous pouvez m'aider. Merci d'avance
Ps: debutante en fortran
Code1:
code2
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 IMPLICIT REAL*8(A-H,O-Z) OPEN(1,FILE='ENERGIE',STATUS='UNKNOWN') OPEN(2,FILE='COORDONNEES',STATUS='UNKNOWN') a0=0.016599426877692d0 a1=0.312787459557518d0 a2=-0.16081183620725d0 a3=0.0284109792835631d0 a4=-0.00171760856320689d0 NE=(a4/5.)*(E**5)+(a3/4.)*(E**4)+(a2/3.)*(E**3)+(a1/2.)*(E**2) &+a0*EErreurs: Image NE1=0.684 do 1 i=1,10000 E=i*10. fE=NE/NE1 1 continue i=1 do 2 j=1,100000 R=rando(ii) do while(fE.lt.R) i=i+1 write(1,*) 'E' enddo 2 continue a=0.5d01 b=a x=0. y=0. R1=rando(ii) if(R1 .gt. 0. .and. R1 .lt. 1.) then x=x-a+(R1*2.*a) y=y-b+(R1*2.*b) endif write(2,*) 'x,y' STOP END ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c fonction de générationErreurs: Image doubleprecision function rando(ii) IMPLICIT REAL*8(A-H,O-Z) common/zufall/iy data ib,m,iq,ir/16807,2147483647,127773,2836/ ii=0 100 continue k=iy/iq l=mod(iy,iq) n=ib*l-ir*k if(n.gt.0) then iy=n else iy=n+m end if rando=iy/float(m) if(rando.eq.1.d0.or.rando.eq.0.d0) goto 100 end ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 IMPLICIT REAL*8(A-H,O-Z) OPEN(1,FILE='ENERGIE',STATUS='UNKNOWN') OPEN(2,FILE='COORDONNEES',STATUS='UNKNOWN') a0=0.016599426877692d0 a1=0.312787459557518d0 a2=-0.16081183620725d0 a3=0.0284109792835631d0 a4=-0.00171760856320689d0 NE=(a4/5.)*(E**5)+(a3/4.)*(E**4)+(a2/3.)*(E**3)+(a1/2.)*(E**2) &+a0*E NE1=0.684 do 1 i=1,10000 E=i*10. fE=NE/NE1 1 continue i=1 do 2 j=1,100000 call random_number(plop) R=plop do while(fE.lt.R) i=i+1 write(1,10) E 10 format('E = ',D12.6) enddo 2 continue a=0.5d01 b=a x=0. y=0. R1=plop if(R1 .gt. 0. .and. R1 .lt. 1.) then x=x-a+(R1*2.*a) y=y-b+(R1*2.*b) endif write(2,11) x,y 11 format('x,y = ',2D12.6) STOP END
Partager