added source code
[unres.git] / source / unres / src_MD / src / md-diff / md / max_accel.f
1 c---------------------------------------------------------------------
2       subroutine max_accel
3 c
4 c Find the maximum difference in the accelerations of the the sites
5 c at the beginning and the end of the time step.
6 c
7       implicit real*8 (a-h,o-z)
8       include 'DIMENSIONS'
9       include 'COMMON.CONTROL'
10       include 'COMMON.VAR'
11       include 'COMMON.MD'
12       include 'COMMON.CHAIN'
13       include 'COMMON.DERIV'
14       include 'COMMON.GEO'
15       include 'COMMON.LOCAL'
16       include 'COMMON.INTERACT'
17       include 'COMMON.IOUNITS'
18       double precision aux(3),accel(3)
19       do j=1,3
20         aux(j)=d_a(j,0)-d_a_old(j,0)
21       enddo 
22       amax=0.0d0
23       do i=nnt,nct
24 c Backbone
25         if (i.lt.nct) then
26           do j=1,3
27             accel(j)=aux(j)+0.5d0*(d_a(j,i)-d_a_old(j,i))
28             if (dabs(accel(j)).gt.amax) amax=dabs(accel(j))
29           enddo
30         endif
31 c Side chains
32         do j=1,3
33           accel(j)=aux(j)
34         enddo
35         if (itype(i).ne.10) then
36           do j=1,3 
37             accel(j)=accel(j)+d_a(j,i+nres)-d_a_old(j,i+nres)
38           enddo
39         endif
40         do j=1,3
41           if (dabs(accel(j)).gt.amax) amax=dabs(accel(j))
42         enddo
43         do j=1,3
44           aux(j)=aux(j)+d_a(j,i)-d_a_old(j,i)
45         enddo
46       enddo
47       return
48       end