fortran - Not reading Input file to run stress autocorrelation function -
i trying run stress autocorrelation function code calculate stress autocorrelation function,then there calculate viscosity using green -kubo equation. fortran code have not read out stress data in order calculate stress auot-correlarion function. can please me this. have attached code , data want correlate. hope here soon.
here error
./a.out **** program stress_autocorrelation **** calculation of time correlation functions enter data file name dfile enter results file name rfile 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 @ line 106 of file main.f95 (unit = 10, file = 'dfile') fortran runtime error: bad value during floating point read
code , below input data:
! program claculate pressure autocorrelation function program stress_autocorrelation implicit none common / block1 / stora, storb, storc, stord,store,storf,storg, storh, stori common / block2 / pa, pb, pc, pd, pe, pf, pg, ph , pi common / block3 / pacf, anorm ! ******************************************************************* ! ............ principal variables............ ! ! ** integer n number of atoms ! ** integer nstep number of steps on tape ! ** integer ior interval time origins ! ** integer nt correlation length, including t=0 ! ** integer ntimor number of time origin ! ** integer nlabel label step (1,2,3.....nstep) ! ! ! ** real pacf(nt) pressure correlation function ! ** nstep , nt should multiples of ior. ! ** pa,pb,pc = pxx,pxy,pxz ! ** pd,pe,pf = pyx,pyy,pyz ! ** pg,ph,pi = pzx,pzy,pzz ! ! ! ...............routines referenced.......................... ! ! ....subroutine store (j1).......... !routine store data correlation ! .....subroutine corr (j1,j2,it)......... !routine correlate stored time origin ! ! ! .....................usage.............................. ! ! data in file dfile on fortrran unit dunit ! results in file rfile on fortran unit runit ! ******************************************************************* integer n, nstep, ior, nt, ndim, dunit, runit, ntimor integer fullup parameter ( n = 78, nstep = 10, ior = 4, 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) real 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, integer nlabel character dummy * 5 character dfile * 115 character rfile * 115 ! ******************************************************************* write(*,'('' **** program stress_autocorrelation **** '')') write(*,'('' calculation of time correlation functions '')') !.....read in file names......... write(*,'('' enter data file name'')') read (*,'(a)') dfile write (*,'('' enter results file name'')') read (*,'(a)') rfile !......initialize counters....... nincor = fullup ja = 1 ia = 1 ib = 1 !........zero arrays............. 5 = 1, nt pacf(i) = 0.0 anorm(i) = 0.0 write(*,*) pacf(i) 5 continue !..........open data file , results file........... open ( unit = dunit, file = dfile, status = 'old', form = 'formatted') open ( unit = runit, file = rfile, status = 'new' ) !.........calculation begins............ 40 l = 1, ntimor ja = ja + 1 s(l) = ja - 1 read ( dunit, '(a5,i4)') dummy, nlabel 7 r = 1, n read (dunit,'(f9.6,8(9x,f9.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) !.......store step time origin...... call storee ( ja ) !........correlate origins in store...... 10 in = ia, l tss = tm(l) - tm(in) ts = tss + 1 jo = s(in) + 1 call corr ( jo, ja, ts ) 10 continue !read in data between time origins. can !be conveniently stored in element 1 of !array storx etc. , can ben correlated !with time origins 30 k = 1, ior - 1 read ( dunit, '(a5,i4)') dummy, nlabel 15 r = 1, n read ( dunit,'(f17.14,8(13x,f17.14))')pa(r),pb(r),pc(r),pd(r),pe(r),pf(r),pg(r),ph(r),pi(r) 15 continue call storee ( 1 ) 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 ) if ( l .eq. nincor ) nincor = nincor + fullup ja = 1 endif ia = ia + 1 endif 40 continue close ( dunit ) !.....normalise correlation functions....... pacf(1) = pacf(1) / anorm(1) / real ( n ) 50 = 2, nt pacf(i) = pacf(i) / anorm(i) / real ( n ) / pacf(1) 50 continue write ( runit, '('' pressure acf '')') write ( runit, '(i6,e15.6)') ( i, pacf(i), = 1, nt ) close ( runit ) stop end subroutine storee ( j1 ) common / block1 / stora, storb, storc, stord,store,storf,storg,storh,stori common/ block2 / pa, pb, pc, pd, pe, pf, pg, ph, pi ! ******************************************************************* !.........subroutine store time origins.............. ! ******************************************************************* integer j1 integer n, nt, ior, ndim parameter ( n = 78, nt = 8, ior =4 ) parameter ( ndim = nt / ior + 1 ) real stora(ndim,n), storb(ndim,n), storc(ndim,n),stord(ndim,n) real 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 10 = 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, ) common / block1 / stora, storb, storc, stord,store,storf,storg,storh,stori common/ block3 / pacf, anorm ! ******************************************************************* !......subroutine correlate time origins.... ! ******************************************************************* integer j1, j2, integer n, nt, ior, ndim parameter ( n = 78, nt = 8, ior = 4 ) parameter ( ndim = nt / ior + 1 ) real stora(ndim,n), storb(ndim,n), storc(ndim,n),stord(ndim,n) real store(ndim,n),storf(ndim,n),storg(ndim,n),storh(ndim,n),stori(ndim,n) real pacf(nt), anorm(nt) integer !******************************************************************** 10 = 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: has 9 columns
-9.568336e+00 -1.615161e+00 1.042644e+00 -1.615161e+00 -1.131916e+01 -6.979813e-01 1.042644e+00 -6.979813e-01 -1.182917e+01 -4.765572e-01 9.005122e-01 -2.282920e+00 9.005122e-01 -3.827857e+00 -3.206736e+00 -2.282920e+00 -3.206736e+00 -6.252462e+00 -1.012710e+01 4.672368e-01 8.791873e-02 4.672368e-01 -4.680832e+00 -5.271814e-01 8.791873e-02 -5.271814e-01 -1.898345e-01 -7.699012e+00 -9.906154e-01 7.450304e-01 -9.906154e-01 -1.061230e+00 -3.546956e+00 7.450304e-01 -3.546956e+00 -6.843898e+00 -3.544260e+00 4.254020e+00 -1.963602e+00 4.254020e+00 3.740858e+00 -4.587760e+00 -1.963602e+00 -4.587760e+00 -6.776258e+00 1.755595e-01 -9.625855e-01 -2.395960e+00 -9.625855e-01 -1.701399e+00 -8.483695e-01 -2.395960e+00 -8.483695e-01 -4.165223e+00 -3.244186e+00 5.540608e+00 -4.951768e-01 5.540608e+00 3.068601e+00 -1.613010e-01 -4.951768e-01 -1.613010e-01 -5.641277e+00 -8.985849e+00 1.870244e+00 -2.295795e-01 1.870244e+00 -4.635924e+00 -4.787461e+00 -2.295795e-01 -4.787461e+00 -3.014272e+00 -1.651073e-01 -6.326584e-01 -3.028051e+00 -6.326584e-01 -2.621833e+00 -2.640439e+00 -3.028051e+00 -2.640439e+00 1.668877e+00 1.250349e+00 3.054784e+00 -2.898975e+00 3.054784e+00 8.419503e-01 9.620184e-01 -2.898975e+00 9.620184e-01 1.479256e+00 -7.796195e-01 1.942983e+00 -2.736569e+00 1.942983e+00 6.073043e+00 -2.520281e+00 -2.736569e+00 -2.520281e+00 -9.600832e-01 4.697066e-01 3.138124e+00 -1.092573e+00 3.138124e+00 -2.099285e+00 -1.581031e+00 -1.092573e+00 -1.581031e+00 -6.285002e-01 3.017532e-01 -9.701574e-02 1.611936e+00 -9.701574e-02 -1.762075e+00 -3.401961e+00 1.611936e+00 -3.401961e+00 -6.889746e-01 1.177410e-01 5.090611e-01 1.452691e-01 5.090611e-01 5.695570e+00 -3.573245e+00 1.452691e-01 -3.573245e+00 -1.099615e+00 -5.180126e+00 -1.876409e-01 -2.067182e+00 -1.876409e-01 1.611177e+00 5.458450e-01 -2.067182e+00 5.458450e-01 1.026071e+00 1.477567e+00 1.598949e+00 -1.577546e+00 1.598949e+00 3.933810e+00 -2.698132e+00 -1.577546e+00 -2.698132e+00 3.485029e+00 -2.533324e+00 1.753033e+00 1.425241e-01 1.753033e+00 2.406501e+00 -1.147217e+00 1.425241e-01 -1.147217e+00 3.065603e-01 -2.360274e+00 1.312721e+00 -3.711419e-01 1.312721e+00 2.556935e+00 3.152605e-01 -3.711419e-01 3.152605e-01 3.378170e+00 -1.698217e+00 1.105760e+00 3.780822e-01 1.105760e+00 2.736574e+00 7.920578e-01 3.780822e-01 7.920578e-01 -6.596856e-01 -5.099544e+00 1.647542e-01 -1.036544e+00 1.647542e-01 3.845429e+00 -1.034068e+00 -1.036544e+00 -1.034068e+00 -3.152053e+00 -2.686567e+00 1.335786e+00 -1.889911e-01 1.335786e+00 9.755267e-01 9.322043e-01 -1.889911e-01 9.322043e-01 3.229615e-01 1.542994e-01 3.104663e+00 -1.634353e-01 3.104663e+00 4.090105e+00 -1.128244e+00 -1.634353e-01 -1.128244e+00 -2.909383e-01 -4.235419e-01 1.554157e+00 3.475430e+00 1.554157e+00 4.701173e+00 -1.789414e+00 3.475430e+00 -1.789414e+00 1.517218e+00 -8.054924e-01 -1.167935e+00 -1.123460e+00 -1.167935e+00 1.169303e+00 -2.171076e+00 -1.123460e+00 -2.171076e+00 -5.636150e+00
Comments
Post a Comment