d88d5dcf2e647cdfb57cf55764234bd382a1de1f
[unres.git] / source / unres / src_MD / md-diff / mts / predict_edrift.f
1 c---------------------------------------------------------------------
2       subroutine predict_edrift(epdrift)
3 c
4 c Predict the drift of the potential energy
5 c
6       implicit real*8 (a-h,o-z)
7       include 'DIMENSIONS'
8       include 'COMMON.CONTROL'
9       include 'COMMON.VAR'
10       include 'COMMON.MD'
11       include 'COMMON.CHAIN'
12       include 'COMMON.DERIV'
13       include 'COMMON.GEO'
14       include 'COMMON.LOCAL'
15       include 'COMMON.INTERACT'
16       include 'COMMON.IOUNITS'
17       include 'COMMON.MUCA'
18       double precision epdrift,epdriftij
19 c Drift of the potential energy
20       epdrift=0.0d0
21       do i=nnt,nct
22 c Backbone
23         if (i.lt.nct) then
24           do j=1,3
25             epdriftij=dabs((d_a(j,i)-d_a_old(j,i))*gcart(j,i))
26             if (lmuca) epdriftij=epdriftij*factor
27 c            write (iout,*) "back",i,j,epdriftij
28             if (epdriftij.gt.epdrift) epdrift=epdriftij 
29           enddo
30         endif
31 c Side chains
32         if (itype(i).ne.10) then
33           do j=1,3 
34             epdriftij=
35      &       dabs((d_a(j,i+nres)-d_a_old(j,i+nres))*gxcart(j,i))
36             if (lmuca) epdriftij=epdriftij*factor
37 c            write (iout,*) "side",i,j,epdriftij
38             if (epdriftij.gt.epdrift) epdrift=epdriftij
39           enddo
40         endif
41       enddo
42       epdrift=0.5d0*epdrift*d_time*d_time
43 c      write (iout,*) "epdrift",epdrift
44       return
45       end