xdrf2pdb-M.F: corrected order of reading
[unres.git] / source / unres / src_MD / md-diff / mts / sd_verlet2.f
1 c--------------------------------------------------------------------------
2       subroutine sd_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 #ifndef LANG0
10       include 'COMMON.LANGEVIN'
11 #else
12       include 'COMMON.LANGEVIN.lang0'
13 #endif
14       include 'COMMON.CHAIN'
15       include 'COMMON.DERIV'
16       include 'COMMON.GEO'
17       include 'COMMON.LOCAL'
18       include 'COMMON.INTERACT'
19       include 'COMMON.IOUNITS'
20       include 'COMMON.NAMES'
21       double precision stochforcvec(MAXRES6),stochforcvecV(MAXRES6)
22       common /stochcalc/ stochforcvec
23 c
24 c Compute the stochastic forces which contribute to velocity change
25 c
26       call stochastic_force(stochforcvecV)
27
28 #ifndef LANG0
29       do i=1,dimen
30         ddt1=0.0d0
31         ddt2=0.0d0
32         do j=1,dimen
33           ddt1=ddt1+vfric_mat(i,j)*d_a_work(j)
34           ddt2=ddt2+vrand_mat1(i,j)*stochforcvec(j)+
35      &     vrand_mat2(i,j)*stochforcvecV(j)
36         enddo
37         d_t_work(i)=d_t_work_new(i)+0.5d0*ddt1+ddt2
38       enddo
39 #endif
40       do j=1,3
41         d_t(j,0)=d_t_work(j)
42       enddo
43       ind=3
44       do i=nnt,nct-1
45         do j=1,3
46           d_t(j,i)=d_t_work(ind+j)
47         enddo
48         ind=ind+3
49       enddo
50       do i=nnt,nct
51         if (itype(i).ne.10) then
52           inres=i+nres
53           do j=1,3
54             d_t(j,inres)=d_t_work(ind+j)
55           enddo
56           ind=ind+3
57         endif
58       enddo 
59       return
60       end