- #1
lehloks
- 3
- 0
Hi Forum users
I have a velocity autocorrelation code which was made to read a three component velocity vectors and I have modified to read a 9 component stress tensor data. I can compile it successfully but when I try to run it and compute a stress correlation function I get an error: i.e. segmentation fault. I have also included the type of data formate the code was initially meant to correlate.
Thanks in advance for the help
*************************************************************************************************************************************
OUTPUT ERROR
[]
**** PROGRAM TCORR ****
CALCULATION OF TIME CORRELATION FUNCTIONS
ENTER DATA FILE NAME
DFILE.txt
ENTER RESULTS FILE NAME
TI1
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
8336
Segmentation fault
[/]
DATA
I have a velocity autocorrelation code which was made to read a three component velocity vectors and I have modified to read a 9 component stress tensor data. I can compile it successfully but when I try to run it and compute a stress correlation function I get an error: i.e. segmentation fault. I have also included the type of data formate the code was initially meant to correlate.
Thanks in advance for the help
*************************************************************************************************************************************
OUTPUT ERROR
[]
**** PROGRAM TCORR ****
CALCULATION OF TIME CORRELATION FUNCTIONS
ENTER DATA FILE NAME
DFILE.txt
ENTER RESULTS FILE NAME
TI1
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
8336
Segmentation fault
[/]
Code:
[C PROGRAM TCORR
COMMON / BLOCK1 / STORA, STORB, STORC, STORD,STORE,STORF,STORG,
& STORH, STORI
C COMMON / BLOCK2/STORB
COMMON / BLOCK2 / PA, PB, PC, PD, PE, PF, PG, PH , PI
c COMMON / BLOCK4/ VB
COMMON / BLOCK3 / PACF, ANORM
C *******************************************************************
C ** CALCULATION OF TIME CORRELATION FUNCTIONS. **
C ** **
C ** THIS PROGRAM ANALYZES DATA TO CALCULATE A TIME CORRELATION **
C ** FUNCTION IN ONE SWEEP (LOW MEMORY REQUIREMENT). IN THIS **
C ** EXAMPLE THE VELOCITY AUTO-CORRELATION FUNCTION IS CALCULATED. **
C ** **
C ** PRINCIPAL VARIABLES: **
C ** **
C ** INTEGER N NUMBER OF ATOMS
C ** INTEGER NSTEP NUMBER OF STEPS ON THE TAPE
C ** INTEGER IOR INTERVAL FOR TIME ORIGINS
C ** INTEGER NT CORRELATION LENGTH, INCLUDING T=0
C ** INTEGER NTIMOR NUMBER OF TIME ORIGINS
C ** INTEGER NLABEL LABEL FOR STEP (1,2,3...NSTEP)
C ** REAL VX(N),VY(N),VZ(N) VELOCITIES
C ** REAL VACF(NT) THE CORRELATION FUNCTION
C ** NSTEP AND NT SHOULD BE MULTIPLES OF IOR.
C ** REAL PA,PB,PC = Pxx,Pxy,Pxz STRESSES
C ** REAL PD,PE,PF = Pyx,Pyy,Pyz STRESSES
C ** REAL PG,PH,PI = Pzx,Pzy,Pzz STRESSES
C ** ROUTINES REFERENCED:
C ** **
C ** SUBROUTINE STORE (J1)
C ROUTINE TO STORE THE DATA FOR CORRELATION **
C SUBROUTINE CORR ( J1, J2, IT )
C ROUTINE TO CORRELATE THE STORED TIME ORIGINS **
C USAGE: **
C ** **
C DATA IN FILE DFILE ON FORTRAN UNIT DUNIT. **
C RESULTS IN FILE RFILE ON FORTRAN UNIT RUNIT. **
C *******************************************************************
INTEGER N, NSTEP, IOR, NT, NDIM, DUNIT, RUNIT, NTIMOR
INTEGER FULLUP
PARAMETER ( N = 2377, NSTEP = 8, IOR = 2, NT = 8 )
PARAMETER ( DUNIT = 10, RUNIT = 11 )
PARAMETER ( NDIM = NT / IOR + 1, NTIMOR = NSTEP / IOR )
PARAMETER ( FULLUP = NDIM - 1 )
REAL PA(N), PB(N), PC(N), PD(N), PE(N), PF(N), PG(N), PH(N), PI(N)
REAL STORA(NDIM,N), STORB(NDIM,N), STORC(NDIM,N),STORD(NDIM,N),
& STORE(NDIM,N),STORF(NDIM,N),STORG(NDIM,N),STORH(NDIM,N),
& STORI(NDIM,N)
REAL PACF(NT), ANORM(NT)
INTEGER S(NTIMOR), TM(NTIMOR)
INTEGER TS, TSS, L, NINCOR, K, R, JA, IB, IN, IA, JO, I
INTEGER NLABEL
CHARACTER DUMMY * 5
CHARACTER DFILE * 30
CHARACTER RFILE * 30
C *******************************************************************
WRITE(*,'('' **** PROGRAM TCORR **** '')')
WRITE(*,'('' CALCULATION OF TIME CORRELATION FUNCTIONS '')')
C ** READ IN FILE NAMES **
WRITE(*,'('' ENTER DATA FILE NAME '')')
READ (*,'(A)') DFILE
WRITE (*,'('' ENTER RESULTS FILE NAME '')')
READ (*,'(A)') RFILE
C ** INITIALIZE COUNTERS **
NINCOR = FULLUP
JA = 1
IA = 1
IB = 1
C ** ZERO ARRAYS **
DO 5 I = 1, NT
PACF(I) = 0.0
ANORM(I) = 0.0
write(*,*) PACF(I)
5 CONTINUE
C ** OPEN DATA FILE AND RESULTS FILE **
OPEN ( UNIT = DUNIT, FILE = DFILE, STATUS = 'OLD',
: FORM = 'FORMATTED')
OPEN ( UNIT = RUNIT, FILE = RFILE, STATUS = 'NEW' )
C ** CALCULATION BEGINS **
DO 40 L = 1, NTIMOR
JA = JA + 1
S(L) = JA - 1
READ (DUNIT, '(A5,I4)') DUMMY, NLABEL
DO 7 R = 1, N
c READ (DUNIT,'(1X,F17.14,8(13X,F17.14))')PA(R),PB(R),PC(R),PD(R),
c & PE(R),PF(R),PG(R),PH(R),PI(R)
READ(DUNIT,'(E13.6,8(2X,E13.6))')PA(R),PB(R),PC(R),PD(R),
& PE(R),PF(R),PG(R),PH(R),PI(R)
7 CONTINUE
TM(L) = NLABEL
write(*,*) TM(L)
C ** STORE STEP AS A TIME ORIGIN **
CALL STOREE ( JA )
C ** CORRELATE THE ORIGINS IN STORE **
DO 10 IN = IA, L
TSS = TM(L) - TM(IN)
TS = TSS + 1
JO = S(IN) + 1
CALL CORR ( JO, JA, TS )
10 CONTINUE
C ** READ IN DATA BETWEEN TIME ORIGINS. THIS CAN **
C ** BE CONVENIENTLY STORED IN ELEMENT 1 OF THE **
C ** ARRAYS STORX ETC. AND CAN THEN BEN CORRELATED **
C ** WITH THE TIME ORIGINS. **
DO 30 K = 1, IOR - 1
READ (DUNIT, '(A5,I4)') DUMMY, NLABEL
DO 15 R = 1, N
c READ (DUNIT,'(1X,F17.14,8(13X,F17.14))')PA(R),PB(R),PC(R),PD(R),
c & PE(R),PF(R),PG(R),PH(R),PI(R)
READ(DUNIT,'(E13.6,8(2X,E13.6))')PA(R),PB(R),PC(R),PD(R),
& PE(R),PF(R),PG(R),PH(R),PI(R)
15 CONTINUE
CALL STOREE ( 1 )
DO 20 IN = IA, L
TSS = NLABEL - TM(IN)
TS = TSS + 1
JO = S(IN) + 1
CALL CORR ( JO, 1, TS )
20 CONTINUE
30 CONTINUE
IF ( L .GE. FULLUP ) THEN
IF ( L .EQ. NINCOR ) THEN
NINCOR = NINCOR + FULLUP
JA = 1
ENDIF
IA = IA + 1
ENDIF
40 CONTINUE
CLOSE ( DUNIT )
C ** NORMALISE CORRELATION FUNCTIONS **
PACF(1) = PACF(1) / ANORM(1) / REAL ( N )
DO 50 I = 2, NT
PACF(I) = PACF(I) / ANORM(I) / REAL ( N ) / PACF(1)
50 CONTINUE
WRITE ( RUNIT, '('' VELOCITY ACF '')')
WRITE ( RUNIT, '(I6,E15.6)') ( I, PACF(I), I = 1, NT )
CLOSE ( RUNIT )
STOP
END
SUBROUTINE STOREE ( J1 )
c COMMON/ BLOCK1 / STORX, STORY, STORZ, STORA, STORB
COMMON / BLOCK1 / STORA, STORB, STORC, STORD,STORE,STORF,STORG,
& STORH,STORI
c COMMON/BLOCK2/STORB
COMMON/ BLOCK2 / PA, PB, PC, PD, PE, PF, PG, PH, PI
C ** SUBROUTINE TO STORE TIME ORIGINS **
INTEGER J1
INTEGER N, NT, IOR, NDIM
PARAMETER ( N = 2377, NT = 8, IOR =2 )
PARAMETER ( NDIM = NT / IOR + 1 )
REAL STORA(NDIM,N), STORB(NDIM,N), STORC(NDIM,N),STORD(NDIM,N),
& STORE(NDIM,N),STORF(NDIM,N),STORG(NDIM,N),STORH(NDIM,N),
& STORI(NDIM,N)
REAL PA(N), PB(N), PC(N), PD(N), PE(N), PF(N),PG(N), PH(N), PI(N)
INTEGER I
DO 10 I = 1, N
STORA(J1,I) = PA(I)
STORB(J1,I) = PB(I)
STORC(J1,I) = PC(I)
STORD(J1,I) = PD(I)
STORE(J1,I) = PE(I)
STORF(J1,I) = PF(I)
STORG(J1,I) = PG(I)
STORH(J1,I) = PH(I)
STORI(J1,I) = PI(I)
10 CONTINUE
RETURN
END
SUBROUTINE CORR ( J1, J2, IT )
COMMON / BLOCK1 / STORA, STORB, STORC, STORD,STORE,STORF,STORG,
& STORH,STORI
c COMMON/ BLOCK1 / STORX, STORY, STORZ,STORA
COMMON/ BLOCK3 / PACF, ANORM
C *******************************************************************
C ** SUBROUTINE TO CORRELATE TIME ORIGINS **
C *******************************************************************
INTEGER J1, J2, IT
INTEGER N, NT, IOR, NDIM
PARAMETER ( N = 2377, NT = 8, IOR = 2 )
PARAMETER ( NDIM = NT / IOR + 1 )
REAL STORA(NDIM,N), STORB(NDIM,N), STORC(NDIM,N),STORD(NDIM,N),
& STORE(NDIM,N),STORF(NDIM,N),STORG(NDIM,N),STORH(NDIM,N),
& STORI(NDIM,N)
c REAL STORX(NDIM,N), STORY(NDIM,N), STORZ(NDIM,N),STORA(NDIM,N),
c & STORB(NDIM,N)
REAL PACF(NT), ANORM(NT)
INTEGER I
C ********************************************************************
DO 10 I = 1, N
PACF(IT) = PACF(IT) + STORA(J1,I) * STORA(J2,I)
: + STORB(J1,I) * STORB(J2,I)
: + STORC(J1,I) * STORC(J2,I)
: + STORD(J1,I) * STORD(J2,I)
: + STORE(J1,I) * STORE(J2,I)
: + STORF(J1,I) * STORF(J2,I)
: + STORG(J1,I) * STORG(J2,I)
: + STORH(J1,I) * STORH(J2,I)
: + STORI(J1,I) * STORI(J2,I)
10 CONTINUE
ANORM(IT) = ANORM(IT) + 1.0
RETURN
END
DATA
Code:
[/1.000010E+04 6.223473E-01 -3.664185E+00 2.488328E+00 -3.664185E+00 1.899320E+00 2.983450E-01 2.488328E+00 2.983450E-01 3.010223E+00
1.000020E+04 -1.791006E+00 1.525541E-01 1.653747E+00 1.525541E-01 -3.636319E+00 2.703241E+00 1.653747E+00 2.703241E+00 4.975571E+00
1.000030E+04 -3.129378E-01 -3.663724E+00 1.656161E+00 -3.663724E+00 -4.128011E+00 -2.043832E+00 1.656161E+00 -2.043832E+00 3.279852E+00
1.000040E+04 -6.450919E+00 -3.708082E+00 -2.611070E+00 -3.708082E+00 -5.693249E+00 4.460507E-01 -2.611070E+00 4.460507E-01 1.607329E+00
1.000050E+04 3.146279E+00 -5.644253E-01 5.284613E-01 -5.644253E-01 -4.642398E+00 1.216114E+00 5.284613E-01 1.216114E+00 4.043103E+00
1.000060E+04 4.873293E+00 2.183875E+00 6.155124E-03 2.183875E+00 5.325019E+00 -4.930211E-02 6.155124E-03 -4.930211E-02 1.012324E+00
1.000070E+04 -1.353394E+00 2.333362E+00 4.408005E+00 2.333362E+00 -4.269528E+00 -7.599770E-01 4.408005E+00 -7.599770E-01 -4.354086E+00
1.000080E+04 -4.813567E+00 -2.603514E+00 -2.146995E-01 -2.603514E+00 3.169052E+00 -3.620447E+00 -2.146995E-01 -3.620447E+00 -7.228028E+00
1.000090E+04 -3.882664E+00 1.025861E+00 6.714240E+00 1.025861E+00 -4.198472E+00 1.217365E+00 6.714240E+00 1.217365E+00 -1.349967E+00
1.000100E+04 8.225114E+00 -1.288076E+00 -4.120618E+00 -1.288076E+00 8.242155E+00 1.484652E+00 -4.120618E+00 1.484652E+00 -1.395376E+00
1.000110E+04 -4.278094E-01 1.302281E-01 -1.920785E-02 1.302281E-01 4.527090E+00 -1.287830E+00 -1.920785E-02 -1.287830E+00 8.564435E-01
1.000120E+04 -2.129472E+00 -8.630678E-01 -2.741652E+00 -8.630678E-01 5.669820E-01 -3.469758E+00 -2.741652E+00 -3.469758E+00 2.849660E+00
1.000130E+04 -1.388297E+00 -4.542468E-01 -3.584711E+00 -4.542468E-01 5.000307E+00 1.873149E-01 -3.584711E+00 1.873149E-01 -5.513841E+00
1.000140E+04 -2.208094E+00 -1.588296E+00 2.894718E+00 -1.588296E+00 -1.531510E+00 -3.102739E+00 2.894718E+00 -3.102739E+00 1.971957E+00
1.000150E+04 -2.362187E+00 4.148493E+00 -1.156406E+00 4.148493E+00 8.843932E+00 -2.263363E+00 -1.156406E+00 -2.263363E+00 3.948367E+00
1.000160E+04 4.293848E+00 -8.717760E-01 -4.857359E+00 -8.717760E-01 -1.039215E+00 -4.006499E+00 -4.857359E+00 -4.006499E+00 5.529035E+00
1.000170E+04 6.008994E+00 4.474473E+00 -7.412315E-01 4.474473E+00 1.533358E+00 -2.114606E+00 -7.412315E-01 -2.114606E+00 4.151184E+00
1.000180E+04 2.549805E+00 -1.988171E-01 -8.086132E-01 -1.988171E-01 4.636833E+00 2.004581E+00 -8.086132E-01 2.004581E+00 1.121635E+00
1.000190E+04 1.884038E+00 2.886740E-01 -1.110394E-02 2.886740E-01 9.626488E-01 3.640551E-01 -1.110394E-02 3.640551E-01 -3.440572E+00
1.000200E+04 3.120294E+00 1.187718E+00 4.085338E+00 1.187718E+00 6.202198E+00 -3.173531E-01 4.085338E+00 -3.173531E-01 3.308024E+00
1.000210E+04 4.883089E+00 -4.223909E-01 -8.868787E-01 -4.223909E-01 -4.729599E+00 5.564123E+00 -8.868787E-01 5.564123E+00 -4.126135E+00
1.000220E+04 -6.236270E+00 -9.843776E-01 -2.407780E+00 -9.843776E-01 -2.957732E+00 4.747150E+00 -2.407780E+00 4.747150E+00 1.559040E+00
1.000230E+04 -1.780105E+00 -2.137214E+00 -5.485467E-01 -2.137214E+00 2.781043E+00 -2.217609E+00 -5.485467E-01 -2.217609E+00 1.718062E+00
1.000240E+04 -5.111529E+00 -1.521354E+00 -6.175900E+00 -1.521354E+00 -1.973681E+00 8.255795E-01 -6.175900E+00 8.255795E-01 -1.655795E+00
1.000250E+04 -5.330991E+00 -4.261089E+00 7.381286E-01 -4.261089E+00 -7.567198E+00 1.392663E+00 7.381286E-01 1.392663E+00 -6.545155E+00
1.000260E+04 -6.243782E-01 3.789372E+00 -3.943346E+00 3.789372E+00 1.153042E+00 5.273850E-01 -3.943346E+00 5.273850E-01 6.059340E+00
1.000270E+04 -3.980964E+00 8.120442E+00 -1.562085E+00 8.120442E+00 3.230575E+00 -1.117039E+00 -1.562085E+00 -1.117039E+00 -3.087427E+00
1.000280E+04 -9.319135E-02 -6.109320E-01 -5.879235E-01 -6.109320E-01 -1.577245E+00 -2.184000E+00 -5.879235E-01 -2.184000E+00 -2.892314E+00
1.000290E+04 3.304992E-01 1.486312E+00 1.969823E+00 1.486312E+00 -1.392437E+00 1.316654E+00 1.969823E+00 1.316654E+00 3.901087E+00
1.000300E+04 -2.294725E-01 -2.442103E-01 -2.194509E+00 -2.442103E-01 1.277485E+00 -5.398374E-01 -2.194509E+00 -5.398374E-01 7.853932E-01
1.000310E+04 9.462532E+00 -6.513826E+00 5.213425E-01 -6.513826E+00 9.879859E+00 4.694737E+00 5.213425E-01 4.694737E+00 1.090147E+00
1.000320E+04 -5.361188E+00 -5.342272E+00 8.158420E-01 -5.342272E+00 3.276005E-01 8.863708E-01 8.158420E-01 8.863708E-01 5.660149E+00
1.000330E+04 -1.467439E+00 6.519859E-01 3.014452E-01 6.519859E-01 1.162301E+01 -3.233772E+00 3.014452E-01 -3.233772E+00 3.717345E+00
1.000340E+04 -4.811940E+00 -4.800248E-01 1.216208E+00 -4.800248E-01 -5.772343E-01 -3.451997E-01 1.216208E+00 -3.451997E-01 -4.984954E+00
1.000350E+04 -5.078319E+00 -6.066364E-01 9.366926E-01 -6.066364E-01 3.000697E+00 2.218479E+00 9.366926E-01 2.218479E+00 -3.292760E+00
1.000360E+04 6.385810E+00 7.841234E-01 4.822792E+00 7.841234E-01 2.436286E+00 -2.018650E+00 4.822792E+00 -2.018650E+00 -2.194116E+00
1.000370E+04 2.244729E+00 -4.070176E+00 -9.467727E-01 -4.070176E+00 5.664441E+00 -5.750406E-01 -9.467727E-01 -5.750406E-01 1.374589E+00
1.000380E+04 -1.608836E+00 4.057103E+00 -9.719371E-01 4.057103E+00 -3.387367E-01 1.915489E+00 -9.719371E-01 1.915489E+00 1.625737E+00
1.000390E+04 -4.542367E+00 -5.237635E+00 9.438007E-01 -5.237635E+00 -5.430743E+00 4.518610E+00 9.438007E-01 4.518610E+00 -1.827717E+00
1.000400E+04 2.002808E+00 1.630871E+00 -1.877269E-01 1.630871E+00 -2.281501E+00 8.627181E-01 -1.877269E-01 8.627181E-01 3.100278E+00
1.000410E+04 3.543448E+00 1.824904E+00 -2.156255E+00 1.824904E+00 2.578403E+00 -1.105649E+00 -2.156255E+00 -1.105649E+00 -5.751973E+00
1.000420E+04 6.168638E+00 1.881836E+00 -8.843819E-01 1.881836E+00 -2.260070E+00 -3.110424E+00 -8.843819E-01 -3.110424E+00 -7.044914E+00
1.000430E+04 -4.072518E+00 -2.834909E+00 3.382775E+00 -2.834909E+00 3.871989E+00 -5.028691E+00 3.382775E+00 -5.028691E+00 -4.210028E+00
1.000440E+04 7.008325E+00 -1.559439E+00 -1.436902E+00 -1.559439E+00 8.371497E+00 -2.518365E+00 -1.436902E+00 -2.518365E+00 1.495700E+00
1.000450E+04 -8.829623E+00 -4.140527E-01 3.347391E+00 -4.140527E-01 -9.291294E-01 -7.492739E-01 3.347391E+00 -7.492739E-01 -1.281331E+01
1.000460E+04 2.247049E+00 -2.657417E+00 3.154380E-01 -2.657417E+00 -6.116580E+00 -5.229492E+00 3.154380E-01 -5.229492E+00 -4.626847E+00
1.000470E+04 1.367584E+01 -5.088453E+00 -5.997885E+00 -5.088453E+00 1.032811E+01 -1.740847E+00 -5.997885E+00 -1.740847E+00 -1.834946E-01
1.000480E+04 4.518350E+00 -1.516833E+00 9.302873E-01 -1.516833E+00 4.125968E+00 -3.015525E+00 9.302873E-01 -3.015525E+00 -2.995732E+00
1.000490E+04 2.337245E+00 -5.072033E+00 2.885876E+00 -5.072033E+00 4.065533E+00 1.618054E+00 2.885876E+00 1.618054E+00 -1.911990E+00
1.000500E+04 -1.809472E+00 -6.461211E+00 2.704525E+00 -6.461211E+00 -2.229136E-02 2.824328E+00 2.704525E+00 2.824328E+00 -5.401895E+00
1.000510E+04 -4.019570E+00 2.768689E+00 -4.150727E+00 2.768689E+00 3.803728E+00 1.117661E+00 -4.150727E+00 1.117661E+00 -2.088222E+01
1.000520E+04 -4.703619E+00 -1.793318E+00 -2.342140E+00 -1.793318E+00 -1.722167E+00 -1.783093E+00 -2.342140E+00 -1.783093E+00 -9.129213E+00
[/]
Original Data format to be correlated:
[/STEP 1
0.00000000000000 0.00000000000000 0.00000000000000
0.00000000000000 0.00000000000000 0.00000000000000
0.00000000000000 0.00000000000000 0.00000000000000
0.00010703812381 -0.00017907303145 0.00012845544357
0.00007086879372 -0.00020989410868 -0.00012629189678
-0.00000514347034 -0.00032707162009 -0.00004409049289
0.00010881028378 -0.00013028912781 -0.00026799460440
0.00010384640076 -0.00022617983701 0.00011577020987
-0.00015678637226 0.00005965340793 0.00005029434091
0.00015091005383 -0.00035119896993 0.00014458338425
-0.00004205347437 0.00029641535287 -0.00006770444703
0.00011338315538 0.00013223598310 0.00014689456032
0.00011067923208 -0.00009236400923 -0.00018006605952
STEP 2
0.00000000000000 0.00000000000000 0.00000000000000
0.00000000000000 0.00000000000000 0.00000000000000
0.00000000000000 0.00000000000000 0.00000000000000
0.00010947611239 -0.00015730214483 0.00011035102784
-0.00094308570313 -0.00028271152464 -0.00030895485437
-0.00007548695858 0.00094436386887 0.00052657379138
-0.00016726996547 0.00003910375158 0.00057890424342
-0.00009081549950 -0.00026510370240 -0.00018462750363
STEP 3
0.00000000000000 0.00000000000000 0.00000000000000
0.00000000000000 0.00000000000000 0.00000000000000
0.00000000000000 0.00000000000000 0.00000000000000
]
linuxubuntu lehloks is online now Report This Post