6.5 Program 6.1, Fortran Code
105
d( jc, ic ) = d( ic, jc )
60 continue
70 continue
return
end
subroutine covar ( dt )
common / block2 / d, xic
c ***************************************************************
c ** routine to compute 3n correlated random normal deviates. **
c ** **
c ** principal variables: **
c ** **
c ** integer n number of atoms **
c ** integer n3 number of degrees of freedom **
c ** real d(n3,n3) the diffusion tensor **
c ** real xic(n3) correlated random normal deviates **
c ** real xi(n3) uncorrelated random normal deviates **
c ** real l(n3,n3) a lower triangular matrix **
c ** real dt reduced timestep **
c ** **
c ** usage: **
c ** **
c ** covar is called in a brownian dynamics simulation after the **
c ** the diffusion tensor has been constructed in force. on exit **
c ** the array xic contains the correlated gaussian displacements. **
c ** **
c ** ********************************************************** **
c ** ** warning ** **
c ** ** l * l(transpose), where l is a lower triangular ** **
c ** ** matrix. this is expensive for a large matrix ** **
c ** ** and you may find a more efficient or accurate ** **
c ** ** machine code routine in the common scientific ** **
c ** ** libraries such as nag or imsl. if the matrix ** **
c ** ** is not positive definite the method will fail. ** **
c ** ********************************************************** **
c ** **
c ***************************************************************
integer n, n3
parameter ( n = 2, n3 = n * 3 )
real d(n3,n3), xic(n3)
real dt
integer i, j, k
real gauss, dummy, l(n3,n3), sum, xi(n3)
c ***************************************************************
c ** calculate the lower triangular matrix l **
Précédent

- 114/198

Suivant