c8472fb39a4a9de8a9c5ec38eecbc0ceb494957c
[unres.git] / source / unres / src_MD / md-diff / md / 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       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),stochforcvecV(MAXRES6)
18       common /stochcalc/ stochforcvec
19 c
20 c Compute the stochastic forces which contribute to velocity change
21 c
22       call stochastic_force(stochforcvecV)
23
24       do i=1,dimen
25         ddt1=0.0d0
26         ddt2=0.0d0
27         do j=1,dimen
28           ddt1=ddt1+vfric_mat(i,j)*d_a_work(j)
29           ddt2=ddt2+vrand_mat1(i,j)*stochforcvec(j)+
30      &     vrand_mat2(i,j)*stochforcvecV(j)
31         enddo
32         d_t_work(i)=d_t_work_new(i)+0.5d0*ddt1+ddt2
33       enddo
34       do j=1,3
35         d_t(j,0)=d_t_work(j)
36       enddo
37       ind=3
38       do i=nnt,nct-1
39         do j=1,3
40           d_t(j,i)=d_t_work(ind+j)
41         enddo
42         ind=ind+3
43       enddo
44       do i=nnt,nct
45         if (itype(i).ne.10) then
46           inres=i+nres
47           do j=1,3
48             d_t(j,inres)=d_t_work(ind+j)
49           enddo
50           ind=ind+3
51         endif
52       enddo 
53       return
54       end