added source code
[unres.git] / source / unres / src_MD / md-diff / np / sd_verlet1.f
1 c-------------------------------------------------------------      
2       subroutine sd_verlet1
3 c Applying stochastic velocity Verlet algorithm - step 1 to velocities        
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)
18       common /stochcalc/ stochforcvec
19       logical lprn /.false./
20
21 c      write (iout,*) "dc_old"
22 c      do i=0,nres
23 c        write (iout,'(i5,3f10.5,5x,3f10.5)') 
24 c     &   i,(dc_old(j,i),j=1,3),(dc_old(j,i+nres),j=1,3)
25 c      enddo
26       do j=1,3
27         dc_work(j)=dc_old(j,0)
28         d_t_work(j)=d_t_old(j,0)
29         d_a_work(j)=d_a_old(j,0)
30       enddo
31       ind=3
32       do i=nnt,nct-1
33         do j=1,3
34           dc_work(ind+j)=dc_old(j,i)
35           d_t_work(ind+j)=d_t_old(j,i)
36           d_a_work(ind+j)=d_a_old(j,i)
37         enddo
38         ind=ind+3
39       enddo
40       do i=nnt,nct
41         if (itype(i).ne.10) then
42           do j=1,3
43             dc_work(ind+j)=dc_old(j,i+nres)
44             d_t_work(ind+j)=d_t_old(j,i+nres)
45             d_a_work(ind+j)=d_a_old(j,i+nres)
46           enddo
47           ind=ind+3
48         endif
49       enddo
50
51       if (lprn) then
52       write (iout,*) 
53      &  "pfric_mat, vfric_mat, afric_mat, prand_mat, vrand_mat1,",
54      &  " vrand_mat2"
55       do i=1,dimen
56         do j=1,dimen
57           write (iout,'(2i5,6e15.5)') i,j,pfric_mat(i,j),
58      &      vfric_mat(i,j),afric_mat(i,j),
59      &      prand_mat(i,j),vrand_mat1(i,j),vrand_mat2(i,j)
60         enddo
61       enddo
62       endif
63       do i=1,dimen
64         ddt1=0.0d0
65         ddt2=0.0d0
66         do j=1,dimen
67           dc_work(i)=dc_work(i)+vfric_mat(i,j)*d_t_work(j)
68      &      +afric_mat(i,j)*d_a_work(j)+prand_mat(i,j)*stochforcvec(j)
69           ddt1=ddt1+pfric_mat(i,j)*d_t_work(j)
70           ddt2=ddt2+vfric_mat(i,j)*d_a_work(j)
71         enddo
72         d_t_work_new(i)=ddt1+0.5d0*ddt2
73         d_t_work(i)=ddt1+ddt2
74       enddo
75       do j=1,3
76         dc(j,0)=dc_work(j)
77         d_t(j,0)=d_t_work(j)
78       enddo
79       ind=3     
80       do i=nnt,nct-1    
81         do j=1,3
82           dc(j,i)=dc_work(ind+j)
83           d_t(j,i)=d_t_work(ind+j)
84         enddo
85         ind=ind+3
86       enddo
87       do i=nnt,nct
88         if (itype(i).ne.10) then
89           inres=i+nres
90           do j=1,3
91             dc(j,inres)=dc_work(ind+j)
92             d_t(j,inres)=d_t_work(ind+j)
93           enddo
94           ind=ind+3
95         endif      
96       enddo 
97       return
98       end