Fortran Programs 1-6

advertisement
--------------------------------------------------------------------PROGRAM BRNMTN
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
BROWNIAN MOTION BY INTEGRATION OF GAUSSIAN WHITE NOISE.
THIS PROGRAM REQUIRES A GAUSSIAN RANDOM NUMBER GENERATOR SUCH AS
GASDEV DESCRIBED IN PRESS.
YOU WILL BE PROMPTED FOR THE INPUT DATA, WHICH CONSISTS OF THE
NUMBER OF GAUSSIAN WHITE NOISE POINTS (NOT TO EXCEED 2500) AND
THE NUMBER OF BROWNIAN MOTION POINTS TO BE CALCULATED (NOT TO
EXCEED 500). THE NUMBER OF GAUSSIAN WHITE NOISE POINTS SHOULD
EXCEED THE NUMBER OF BROWNIAN MOTION POINTS BY AT LEAST A FACTOR
OF FIVE.
THE PROGRAM THEN CALCULATES THE BROWNIAN MOTION TRAJECTORY AND
PUTS THESE INTO A FILE LABELED 'OUTPUT.' THESE POINTS MAY BE
EXPORTED TO YOUR FAVORITE GRAPHICS PROGRAM.
IMPLICIT REAL*8(A-H,O-Z)
DIMENSION Y(2500),Z(500)
WRITE(*,20)
20 FORMAT(1X,'SELECT THE NUMBER OF GAUSSIAN WHITE NOISE POINTS AND'/,
X' BROWNIAN MOTION POINTS. ',\)
READ(*,*) N,NBM
OPEN(3,FILE='OUTPUT', STATUS='NEW')
GENERATE GAUSSIAN WHITE NOISE POINTS
IDUM = -1
DO 30 I=1,N
30 Y(I) = 0.0
DO 35 I=1,NBM
35 Z(I) = 0.0
DO 40 I=1,N
40 Y(I) = GASDEV(IDUM)
GENERATE BROWNIAN MOTION POINTS
M = N/NBM
MIN = 2
MAX = M
DO 70 J=1,NBM
DO 50 I=MIN,MAX
Y(I) = Y(I-1)+Y(I)
50 Z(J) = Y(I)
START NEW SUMMATION WITH ORIGINAL Y(I-1)
MIN = MIN+M
MAX = MAX+M
70 CONTINUE
BROWNIAN MOTION TRAJECTORY BY SUMMATION OF THE Z POINTS
ZSUM = 0.0
DO 90 I=1,NBM
ZSUM = ZSUM+Z(I)
WRITE(3,80) ZSUM
80 FORMAT(E14.5)
90 CONTINUE
CLOSE(3)
WRITE (*,100)
100 FORMAT(1X,'PRESS RETURN TO TERMINATE.')
PAUSE
END
-------------------PROGRAM BRSLTR
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
SOLUTION OF THE BRUSSELATOR BY THE RUNGE-KUTTA METHOD
THE EQUATIONS ARE
DX/DT = A-(B+1)*X+X^2*Y
DY/DT = B*X-X^2*Y
WHERE A,B,C ARE PARAMETERS. THE SOLUTIONS ARE ADVANCED BY A
TIME INCREMENT DT. THE PRINTOUTS OF X AND Y ARE CONTROLLED BY
THE NUMBER OF TIME INCREMENTS (NUM) BETWEEN WRITES TO THE OUTPUT
FILE. THIS IS SET BY THE VALUE OF M, WHERE M = 1/NUM*DT.
TOO LARGE A TIME INCREMENT WILL CAUSE ERRATIC BEHAVIOR OF THE
PROGRAM. AN INITIAL VALUE OF 0.01 IS RECOMMENDED.
WHEN ENTERING VALUES OF PARAMETERS, UPON SEEING THE SCREEN PROMPT,
YOU MUST LEAVE A SPACE BETWEEN NUMBERS.
THE OUTPUT FILES ARE LABELED 'XRESULT' AND 'YRESULT.' THESE
RESULTS MAY BE EXPORTED TO YOUR FAVORITE GRAPHICS PROGRAM.
IMPLICIT REAL*8(A-H,O-Z)
F1(X,Y,A,B) = A-(B+1.0)*X+X*X*Y
F2(X,Y,B) = B*X-X*X*Y
OPEN(2,FILE='XRESULT', STATUS='NEW')
OPEN(3,FILE='YRESULT', STATUS='NEW')
WRITE(*,10)
10 FORMAT(1X,'SELECT THE NUMBER OF POINTS TO BE CALCULATED, THE VALUE
XS OF A,B, AND THE',/1X,'INITIAL VALUES OF X AND Y. ',\)
READ(*,*) N,A,B,X,Y
WRITE(*,25)
25 FORMAT(1X,'SELECT THE TIME INCREMENT AND THE VALUE OF M.
',\)
READ(*,*) DT, M
WRITE(2,40) X
WRITE(3,40) Y
NUM IS A COUNTER FOR TIME INTERVALS BETWEEN OUTPUT WRITES
NUM = 0
DO 50 I=1,N
AK1 = F1(X,Y,A,B)*DT
AM1 = F2(X,Y,B)*DT
X1 = X+AK1/2.0
Y1 = Y+AM1/2.0
AK2 = F1(X1,Y1,A,B)*DT
AM2 = F2(X1,Y1,B)*DT
X2 = X+AK2/2.0
Y2 = Y+AM2/2.0
AK3 = F1(X2,Y2,A,B)*DT
AM3 = F2(X2,Y2,B)*DT
X3 = X+AK3
Y3 = Y+AM3
AK4 = F1(X3,Y3,A,B)*DT
AM4 = F2(X3,Y3,B)*DT
X1 = X+(AK1+2.0*AK2+2.0*AK3+AK4)/6.0
Y1 = Y+(AM1+2.0*AM2+2.0*AM3+AM4)/6.0
X = X1
Y = Y1
IF(NUM.EQ.0) GO TO 35
IF(NUM*M*DT.EQ.1) GO TO 30
GO TO 45
30 NUM = 0
35 WRITE(2,40) X
WRITE(3,40) Y
40 FORMAT(E14.5)
45 NUM = NUM + 1
50 CONTINUE
CLOSE(2)
CLOSE(3)
WRITE(*,60)
60 FORMAT(1X,'PRESS RETURN TO TERMINATE')
PAUSE
END
--------------------PROGRAM CELLAUT
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
CELLULAR AUTOMATA
THIS PROGRAM CALCULATES ONE-DIMENSIONAL CELLULAR AUTOMATA USING THE NEIGHBOR-THREE RULES OF [WOLFRAM, 1983].
THE INPUT CONSISTS OF THE NUMBER OF SITES
(CELLS) N IN THE CA PLUS 2 TO TAKE INTO ACCOUNT THE ENDS FOR
CYCLIC BOUNDARY CONDITIONS, THE NUMBER OF TIME VALUES (INCLUDING
TIME ZERO) NT, AND THE ORIGINAL CONFIGURATION IX(NT,N) COMPRISED
OF 1'S AND 0'S. THE VALUES OF N, NT, AND THE INITIAL
CONFIGURATION MUST BE ENTERED IN A FILE LABELED 'INPUT.'
SEE THE PROGRAM FOR THE FORMAT OF THE INPUT DATA.
THE CA RULES IN THE PROGRAM MUST BE CHANGED FOR EACH NEW CA AND
THE PROGRAM MUST BE RECOMPILED FOR EACH NEW CA.
EACH TIME N AND OR NT ARE CHANGED, THE PROGRAM MUST BE MODIFIED
AND RECOMPILED. THESE CHANGES ARE INDICATED IN THE PROGRAM
BY *****.
THE VALUE OF N MUST NOT EXCEED 100 AND THE VALUE OF NT MUST NOT
EXCEED 500.
THE CA APPEAR DIRECTLY ON THE SCREEN.
IMPLICIT REAL*8(A-H,O-V), INTEGER(I-N)
DIMENSION IX(500,100)
OPEN(2, FILE='INPUT',STATUS='OLD')
C
READ IN THE NUMBER OF CELLS (+2) AND THE NUMBER OF TIME STEPS
READ(2,*) N,NT
C
READ IN THE INITIAL CONFIGURATION.
READ(2,*) (IX(1,J), J=1,N)
DO 120 I=1,NT-1
DO 118 J=2,N-1
C*****THE CA RULES MUST BE SPECIFIED BELOW. THE NEIGHBORHOODS ARE
C*****LABELED. IF DESIRED, THE CA NUMBER CAN BE RECORDED IN THE
C*****NEXT STATEMENT.
C
CELLULAR AUTOMATA RULES FOR CA 126
IF(IX(I,J).EQ.1) GO TO 108
C
NEIGHBORHOOD 101
IF(IX(I,J-1).EQ.1.AND.IX(I,J+1).EQ.1) IX(I+1,J) = 1
C
NEIGHBORHOOD 100
IF(IX(I,J-1).EQ.1.AND.IX(I,J+1).EQ.0) IX(I+1,J) = 1
C
NEIGHBORHOOD 001
IF(IX(I,J-1).EQ.0.AND.IX(I,J+1).EQ.1) IX(I+1,J) = 1
C
NEIGHBORHOOD 000
IF(IX(I,J-1).EQ.0.AND.IX(I,J+1).EQ.0) IX(I+1,J) = 0
GO TO 118
C
NEIGHBORHOOD 111
108 IF(IX(I,J-1).EQ.1.AND.IX(I,J+1).EQ.1) IX(I+1,J)
NEIGHBORHOOD 110
IF(IX(I,J-1).EQ.1.AND.IX(I,J+1).EQ.0) IX(I+1,J)
C
NEIGHBORHOOD 011
IF(IX(I,J-1).EQ.0.AND.IX(I,J+1).EQ.1) IX(I+1,J)
C
NEIGHBORHOOD 010
IF(IX(I,J-1).EQ.0.AND.IX(I,J+1).EQ.0) IX(I+1,J)
118 CONTINUE
IX(I+1,1) = IX(I+1,N-1)
IX(I+1,N) = IX(I+1,2)
120 CONTINUE
DO 125 I=1,NT
DO 127 J=1,N
IF(IX(I,J).EQ.0) GO TO 128
WRITE(*,130)
130 FORMAT(''\)
GOTO 127
128 WRITE(*,129)
129 FORMAT(' '\)
127 CONTINUE
WRITE(*,126)
126 FORMAT(' ')
125 CONTINUE
CLOSE(2)
C
SCREEN REMARK
WRITE(*,160)
160 FORMAT(1X,'PRESS RETURN TO TERMINATE')
PAUSE
END
-------------------PROGRAM GSSWTN
= 0
C
C
C
C
C
C
C
C
C
C
= 1
= 1
= 1
GAUSSIAN WHITE NOISE
THIS PROGRAM CALCULATES GAUSSIAN WHITE NOISE.
THIS PROGRAM REQUIRES A GAUSSIAN RANDOM NUMBER GENERATOR SUCH AS
GASDEV DESCRIBED IN PRESS.
INPUT CONSISTS OF THE NUMBER OF WHITE NOISE POINTS (N).
THERE IS NO RESTRICTION ON THE NUMBER OF POINTS.
THE OUTPUT IS IN A FILE NAMED 'RESULT.'
20
50
60
70
IMPLICIT REAL*8(A-H,O-Z)
WRITE(*,20)
FORMAT(1X,'SELECT THE NUMBER OF GAUSSIAN WHITE NOISE POINTS.
READ(*,*) N
OPEN(3,FILE='RESULT',STATUS='NEW')
IDUM = -1
DO 60 I=1,N
X = GASDEV(IDUM)
WRITE(3,50) X
FORMAT(E14.5)
CONTINUE
CLOSE(3)
WRITE(*,70)
FORMAT(1X,'PRESS RETURN TO TERMINATE.')
PAUSE
END
',\)
------------------PROGRAM ISING
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
TWO-DIMENSIONAL ISING LATTICE BY MONTE CARLO METHOD
THIS FORTRAN PROGRAM CALCULATES THE SHORT-RANGE ORDER
PARAMETER F1 (FRACTION OF NEAREST-NEIGHBOR SITES OCCUPIED
BY AN ANTIPARALLEL PAIR OF SPINS) AND E/NJ. INPUT CONSISTS OF THE
LATTICE DIMENSION N (WHERE TOTAL NUMBER OF SITES IS N * N),
THE REDUCED COUPLING CONSTANT R, AND THE NUMBER OF ITERATIONS
NIT. THE COUNTER NCOUNT RECORDS THE NUMBER OF ITERATIONS.
EACH ITERATION CONSISTS OF THE METROPOLIS MC METHOD APPLIED
SUCCESSIVELY TO EACH OF THE NXN SITES. THE TOTAL NUMBER OF
CONFIGURATIONS USED IN THE CALCULATION OF F1 IS N * N * NIT.
A RANDOM NUMBER GENERATOR, SUCH AS RAN2 FROM PRESS,
MUST BE SUPPLIED.
THE OUTPUT ON THE SCREEN IS THE ORDER PARAMETER. IN A FILE
LABELED 'RESULT' CAN BE FOUND VALUES FOR E/NJ AFTER EACH
ITERATION.
AT THE END OF THE CALCULATION, YOU WILL BE PROMPTED AS TO WHETHER
YOU WISH TO DO ANOTHER CALCULATION. IF YOU DO, THE RESULTS FOR
EACH CALCULATION WILL BE SAVED IN THE 'RESULT' FILE.
IMPLICIT REAL*8(A-H,O-Z)
CHARACTER*3 ANS
DIMENSION IA(50,50),SUMF1(1000)
OPEN(3,FILE='RESULT',STATUS='NEW')
DIMENSION OF LATTICES IS N; REDUCED COUPLING CONSTANT R=J/KT
1 WRITE(*,5)
5 FORMAT(1X,'PLEASE TYPE IN THE LATTICE DIMENSION, J/KT, AND NUMBER
X OF ITERATIONS; LEAVE A'/' SPACE BETWEEN NUMBERS.
',\)
READ(*,*) N,R,NIT
WRITE(*,6)
6 FORMAT(1X,'CALCULATION IS IN PROGRESS.')
NCOUNT = 0
DO 200 IJ=1,NIT
NCOUNT = NCOUNT+1
IF(NCOUNT.EQ.1) GO TO 7
F1 = F1*N*N*(NCOUNT-1)
GO TO 12
7 F1 = 0.0
IDUM = -1
SET ALL SPINS EQUAL TO 1 TO BEGIN
9 DO 10 I=1,N
DO 10 J=1,N
10 IA(I,J) = 1
12 K = 0
COUNT NUMBER OF +1,+1 NEIGHBOR PAIRS
15 NPP = 0
DO 20 J=1,N
IF(IA(1,J).NE.IA(N,J).OR.IA(1,J).EQ.0) GO TO 20
NPP = NPP+1
20 CONTINUE
DO 30 I=1,N
IF(IA(I,1).NE.IA(I,N).OR.IA(I,1).EQ.0) GO TO 30
NPP = NPP+1
30 CONTINUE
DO 40 I=1,N
40
50
C
60
65
C
66
67
68
70
80
82
85
90
C
100
C
110
120
130
140
DO 40 J=1,N-1
IF(IA(I,J).NE.IA(I,J+1).OR.IA(I,J).EQ.0) GO TO 40
NPP = NPP+1
CONTINUE
DO 50 I=1,N-1
DO 50 J=1,N
IF(IA(I,J).NE.IA(I+1,J).OR.IA(I,J).EQ.0) GO TO 50
NPP = NPP+1
CONTINUE
COUNT NUMBER OF +1 SPINS
NP = 0
DO 60 I=1,N
DO 60 J=1,N
IF(IA(I,J).EQ.0) GO TO 60
NP = NP+1
CONTINUE
SS = 4.0*NPP-8.0*NP+2.0*N*N
IF(K.GT.0) GO TO 65
E1 = -R*SS
GO TO 66
E2 = -R*SS
DELE = E2-E1
GO TO 85
REVERSE SPIN AT SITE I,J
L = 0
L = L+1
M = 0
M = M+1
IF(IA(L,M)) 70,70,80
IA(L,M) = 1
GO TO 82
IA(L,M) = 0
K = K+1
NP1 = NP
NPP1 = NPP
GO TO 15
IF(DELE) 90,90,100
E1 = E2
GO TO 140
DELTA E IS GT ZERO; CHECK BOLTZMANN DISTRIBUTION
IDUM = IDUM-1
RN = RAN2(IDUM)
BOL = DEXP(-DELE)
IF(RN.LT.BOL) GO TO 130
NON-BOLTZMANN DISTRIBUTION---RESET TO OLD VALUES
IF(IA(L,M)) 110,110,120
IA(L,M) = 1
NP = NP1
NPP = NPP1
GO TO 140
IA(L,M) = 0
NP = NP1
NPP = NPP1
GO TO 140
E1 = E2
F1 = (4.0*NP-2.0*NPP)/(2.0*N*N)+F1
NP1 = NP
NPP1 = NPP
IF(M.NE.N) GO TO 68
IF(L.NE.N) GO TO 67
F1 = F1/(N*N*NCOUNT)
SUMF1(IJ) = -2.0*(1.0 - 2.0*F1)
200 CONTINUE
WRITE(3,210) (SUMF1(IJ), IJ=1,NIT)
210 FORMAT(E12.5)
WRITE(*,150) F1
150 FORMAT(1X,'THE ORDER PARAMETER IS',E12.5)
WRITE(*,155)
155 FORMAT(1X,'DO YOU WISH TO CONTINUE WITH A NEW CONFIGURATION? (yes
XOR no) ',\)
READ(*,157) ANS
157 FORMAT(A3)
IF(ANS.EQ.'yes') GO TO 1
CLOSE(3)
WRITE(*,160)
160 FORMAT(1X,'PRESS RETURN TO TERMINATE')
PAUSE
END
----------------------PROGRAM LJMDFOR1D
C
C
C
C
C
C
C
C
C
THIS PROGRAM PERFORMS AN MD SIMULATION ON A ONE-DIMENSIONAL
LENNARD-JONES FLUID MODEL. THE PROGRAM USES THE RANDOM NUMBER
GENERATOR RAN2 FROM PRESS. CARE SHOULD BE TAKEN TO CHANGE THE
FUNCTION AND ALL THE REAL VARIABLES IN IT INTO DOUBLE PRECISION.
THE VARIABLES HAVE EASY TO UNDERSTAND
NAMES. REDUCED UNITS HAVE BEEN USED. THE NTH POSITION DERIVATIVE
HAS BEEN MULTIPLIED BY (DELTA)**N/N!. NO CUTOFF CORRECTIONS HAVE
BEEN APPLIED.
IMPLICIT REAL*8(A-H, O-Z)
COMMON /X0F/ X0(300), F(300)
COMMON /X123/ X1(300), X2(300), X3(300)
COMMON /NSIDEL/ N, SIDEL, SIDEL2
COMMON /SUMS/ V2SUM, ENSUM, VISUM
COMMON /ENERVIR/ ENERGY, VIRIAL
OPEN( UNIT=6, FILE='MDOUT.OUT')
GIVE THE VALUES OF THE INPUT PARAMETERS.
NEQUI=5000
NCALC=20
NPROD=15000
N=300
AN=N
DELTA=0.005D0
DELTA2=DELTA*DELTA
DELTA3=0.5D0*DELTA2
TEMP=2.10D0
DENSITY=0.4D0
SIDEL=AN/DENSITY
SIDEL2=0.5D0*SIDEL
DELTAX=SIDEL/(AN + 1.0D0)
DO 10 I=1, N
X2(I)=0.0D0
X3(I)=0.0D0
10
C
20
25
C
30
40
C
50
C
60
80
70
C
90
C
C
F(I)=0.0D0
V2SUM=0.0D0
ENSUM=0.0D0
VISUM=0.0D0
X0(1)=DELTAX
ASSIGN INITIAL POSITIONS
DO 20 I=2, N
X0(I)=X0(I-1) + DELTAX
SUMV=0.0D0
WRITE(*,25)
FORMAT(1X,'PLEASE TYPE IN RANDOM NUMBER SEED INTEGER. '\)
ASSIGN RANDOM VELOCITIES
READ(*,*)IDUM
DO 30 I=1,N
XX = RAN2(IDUM)
X1(I) = 2.0D0*XX-1.0D0
SUMV=SUMV + X1(I)
SUMV2=0.0D0
DO 40 I=1, N
X1(I) = X1(I) - SUMV/AN
SUMV2 = SUMV2 + X1(I)*X1(I)
SCALE=DSQRT(AN*DELTA2*TEMP/SUMV2)
SCALE THE VELOCITIES TO GET THE GIVEN REDUCED TEMPERATURE
DO 50 I=1, N
X1(I) = X1(I)*SCALE
START THE EQUILIBRATION PHASE
CALL FORCEETC
DO 60 I=1, N
X2(I) =F(I)*DELTA3
DO 70 NST=1, NEQUI
CALL PREDCOR(DELTA3)
IF(MOD(NST,NCALC).EQ.0)THEN
CALL CALC(DENSITY, SQV, DELTA2, NCALC, NST)
SCALE=DSQRT(AN*DELTA2*TEMP/SQV)
DO 80 I=1, N
X1(I) = X1(I)*SCALE
END IF
CONTINUE
START THE PRODUCTION RUN
V2SUM=0.0D0
ENSUM=0.0D0
VISUM=0.0D0
DO 90 NST=1, NPROD
CALL PREDCOR(DELTA3)
IF(MOD(NST,NCALC).EQ.0)CALL CALC(DENSITY, SQV,
1 DELTA2, NCALC, NST)
CONTINUE
STOP
END
SUBROUTINE FORCEETC
THIS SUBROUTINE CALCULATES THE FORCES, POTENTIAL ENERGIES AND THE
VIRIAL FOR A GIVEN CONFIGURATION.
IMPLICIT REAL*8(A-H, O-Z)
COMMON /X0F/ X0(300), F(300)
COMMON /NSIDEL/ N, SIDEL,SIDEL2
COMMON /ENERVIR/ ENERGY, VIRIAL
10
ENERGY=0.0D0
VIRIAL=0.0D0
DO 10 I=1, N-1
R=X0(I)-X0(I+1)
IF(R.GT.SIDEL2)R=R-SIDEL
IF(R.LT.-SIDEL2)R=R+SIDEL
R2=R*R
R6=R2*R2*R2
R61=1.0D0/R6
EN=4.0D0*R61*(R61-1.0D0)
FORCE=24.0D0*R61*(2.0D0*R61-1.0D0)/R
F(I)=F(I)+FORCE
F(I+1)=F(I+1)-FORCE
ENERGY=ENERGY+EN
VIRIAL=VIRIAL+FORCE*R
R=X0(N)-X0(1)
IF(R.GT.SIDEL2)R=R-SIDEL
IF(R.LT.-SIDEL2)R=R+SIDEL
R2=R*R
R6=R2*R2*R2
R61=1.0D0/R6
EN=4.0D0*R61*(R61-1.0D0)
FORCE=24.0D0*R61*(2.0D0*R61-1.0D0)/R
F(N)=F(N)+FORCE
F(1)=F(1)-FORCE
ENERGY=ENERGY+EN
VIRIAL=VIRIAL+FORCE*R
RETURN
END
10
SUBROUTINE PREDCOR(DELTA3)
THIS SUBROUTINE APPLIES THE GEAR'S THIRD ORDER PREDICTOR CORRECTOR
ALGORITHM.
IMPLICIT REAL*8(A-H, O-Z)
COMMON /X0F/ X0(300), F(300)
COMMON /X123/ X1(300), X2(300), X3(300)
COMMON /NSIDEL/ N, SIDEL, SIDEL2
DO 10 I=1, N
X0(I)=X0(I)+X1(I)+X2(I)+X3(I)
X1(I)=X1(I)+2.0D0*X2(I)+3.0D0*X3(I)
X2(I)=X2(I)+3.0D0*X3(I)
F(I)=0.0D0
CALL FORCEETC
DO 20 I=1, N
DIFF=DELTA3*F(I)-X2(I)
X0(I)=X0(I)+DIFF/6.0D0
X1(I)=X1(I)+5.0D0*DIFF/6.0D0
X2(I)=X2(I)+DIFF
X3(I)=X3(I)+DIFF/3.0D0
IF(X0(I).GT.SIDEL)X0(I)=X0(I)-SIDEL
IF(X0(I).LT.0.0D0)X0(I)=X0(I)+SIDEL
RETURN
END
C
C
20
C
C
SUBROUTINE CALC(DENSITY, SQV, DELTA2, NCALC, NST)
THIS SUBROUTINE CALCULATES THE PHYSICAL PROPERTIES USING THEIR
DEFINITIONS, AS NEEDED.
10
IMPLICIT REAL*8(A-H, O-Z)
COMMON /X123/ X1(300), X2(300), X3(300)
COMMON /NSIDEL/ N, SIDEL, SIDEL2
COMMON /SUMS/ V2SUM, ENSUM, VISUM
COMMON /ENERVIR/ ENERGY, VIRIAL
SQV=0.0D0
AN=N
DO 10 I=1, N
SQV=SQV+X1(I)*X1(I)
V2SUM=V2SUM+SQV
ENSUM=ENSUM+ENERGY
VISUM=VISUM+VIRIAL
TEMPCALC=SQV/(AN*DELTA2)
PRES=DENSITY*(TEMPCALC+VIRIAL/AN)
EPOT=ENERGY/AN
ETOT=0.5D0*TEMPCALC +EPOT
POINTS=DFLOAT(NST/NCALC)
TAVE=V2SUM/(AN*POINTS*DELTA2)
EAVE=ENSUM/(AN*POINTS)
PAVE=DENSITY*(TAVE+VISUM/(AN*POINTS))
WRITE(6,*)'NST,TEMPCALC,TAVE,EPOT,EAVE,PRES,PAVE,ETOT'
WRITE(6,*)NST,TEMPCALC,TAVE,EPOT,EAVE,PRES,PAVE,ETOT
RETURN
END
Download