6.5 Program 6.1, Fortran Code
101
Deff = acdiff / real ( nstep )/6/DT
acrot = acrot / real ( nstep )
c ** calculate fluctuations **
if ( acvsq .gt. 0.0 ) flv = sqrt( acvsq )
if ( acrsq .gt. 0.0 ) flr = sqrt( avrsq - avr * avr)
write(4,’(/” averages ”/ )’)
write(4,’(” = ”,f10.6)’) avv
write(4,’(” = ”,f10.6)’) avr
write(4,’(” = ”,f10.6)’) avrsq
write(4,’(” translational diffusion = ”, f10.6)’) Deff
write(4,’(” rotation rate = ”, f10.6)’) acrot
write(4,’(/” fluctuations ”/)’)
write(4,’(” fluctuation in = ”,f10.6)’) flv
write(4,’(” fluctuation in = ”,f10.6)’) flr
write(4,’(/” end of simulation ”)’)
c ***************************************************************
c ** main loop ends **
c ***************************************************************
c ** write out the final configuration from the run **
call writcn(fn(10),10)
stop
end
subroutine readcn(cnfile,itape)
common / block1 / rx, ry, rz
c ***************************************************************
c ** subroutine to read in the configuration from unit 10 **
c ***************************************************************
integer n
parameter ( n = 2 )
character cnfile*(*)
real rx(n), ry(n), rz(n)
integer itape
c ***************************************************************
open(unit=itape,file=cnfile,form=’formatted’,status=’unknown’)
rewind(itape)
do i = 1,n
read(itape,*)rx(i),ry(i),rz(i)
end do
return
end
subroutine writcn(cnfile,itape)
common / block1 / rx, ry, rz
c ***************************************************************
c ** subroutine to write out the configuration to unit 10 **
c ***************************************************************
Précédent

- 110/198

Suivant