xdrf2pdb-M.F: corrected order of reading
[unres.git] / source / unres / src_MD / src / md-diff / np / sddir_verlet2.f
1 c---------------------------------------------------------------------
2       subroutine sddir_verlet2
3 c  Calculating the adjusted velocities for accelerations
4       implicit real*8 (a-h,o-z)
5       include 'DIMENSIONS'
6       include 'COMMON.CONTROL'
7       include 'COMMON.VAR'
8       include 'COMMON.MD'
9       include 'COMMON.LANGEVIN'
10       include 'COMMON.CHAIN'
11       include 'COMMON.DERIV'
12       include 'COMMON.GEO'
13       include 'COMMON.LOCAL'
14       include 'COMMON.INTERACT'
15       include 'COMMON.IOUNITS'
16       include 'COMMON.NAMES'
17       double precision stochforcvec(MAXRES6),d_as_work1(MAXRES6)
18       double precision cos60 /0.5d0/, sin60 /0.86602540378443864676d0/
19 c Revised 3/31/05 AL: correlation between random contributions to 
20 c position and velocity increments included.
21 c The correlation coefficients are calculated at low-friction limit.
22 c Also, friction forces are now not calculated with new velocities.
23
24 c      call friction_force
25       call stochastic_force(stochforcvec) 
26 c
27 c Compute the acceleration due to friction forces (d_af_work) and stochastic
28 c forces (d_as_work)
29 c
30       do i=1,dimen
31 c        d_af_work(i)=0.0d0
32         d_as_work1(i)=0.0d0
33         do j=1,dimen
34 c          d_af_work(i)=d_af_work(i)+Ginv(i,j)*fric_work(j)
35           d_as_work1(i)=d_as_work1(i)+Ginv(i,j)*stochforcvec(j)
36         enddo
37       enddo
38 c
39 c Update velocities
40 c
41       do j=1,3
42         d_t(j,0)=d_t_new(j,0)+(0.5d0*(d_a(j,0)+d_af_work(j))
43      &    +sin60*d_as_work(j)+cos60*d_as_work1(j))*d_time
44       enddo
45       ind=3
46       do i=nnt,nct-1
47         do j=1,3
48           d_t(j,i)=d_t_new(j,i)+(0.5d0*(d_a(j,i)+d_af_work(ind+j))
49      &     +sin60*d_as_work(ind+j)+cos60*d_as_work1(ind+j))*d_time
50         enddo
51         ind=ind+3
52       enddo
53       do i=nnt,nct
54         if (itype(i).ne.10) then
55           inres=i+nres
56           do j=1,3
57             d_t(j,inres)=d_t_new(j,inres)+(0.5d0*(d_a(j,inres)
58      &       +d_af_work(ind+j))+sin60*d_as_work(ind+j)
59      &       +cos60*d_as_work1(ind+j))*d_time
60           enddo
61           ind=ind+3
62         endif
63       enddo 
64       return
65       end