-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNhc_Integrate.F90
77 lines (58 loc) · 2.44 KB
/
Nhc_Integrate.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Subroutine Nhc_Integrate
Use Parameters
use utility, only: norm_seq
Implicit None
Integer :: iys, i
real(8) :: dkinr(3), pvrfact(3), vrfact(3)!, scaler(3)
Double Precision :: dt_ys
integer :: iatom, imode, inhc
do iys = 1, nys
dt_ys = dt_ref*ysweight(iys)
!YK Excluded imode=1, which should do nothing
do imode = 2, nbead
do iatom = 1, natom
! /* calculate kinetic energy of normal mode coordinate *
! * for each atom */
dkinr(:) = fictmass(iatom,imode)*vur(:,iatom,imode)*vur(:,iatom,imode)
! /* update the force */
frbath(:,iatom,1,imode) = (dkinr(:) - gkt)/qmass(imode)
do inhc = 2, nnhc
frbath(:,iatom,inhc,imode) &
= (qmass(imode)*vrbath(:,iatom,inhc-1,imode)*vrbath(:,iatom,inhc-1,imode) - gkt)/qmass(imode)
enddo
! /* update the thermostat velocities */
vrbath(:,iatom,nnhc,imode) = vrbath(:,iatom,nnhc,imode) + 0.25d0*frbath(:,iatom,nnhc,imode)*dt_ys
do inhc = 1, nnhc-1
vrfact(:)=dexp(-0.125d0*vrbath(:,iatom,nnhc-inhc+1,imode)*dt_ys)
vrbath(:,iatom,nnhc-inhc,imode) &
= vrbath(:,iatom,nnhc-inhc,imode)*vrfact(:)*vrfact(:) &
+ 0.25d0*frbath(:,iatom,nnhc-inhc,imode)*vrfact(:)*dt_ys
enddo
! /* update the particle velocities */
pvrfact(:) = dexp(-0.5d0*vrbath(:,iatom,1,imode)*dt_ys)
! /* update the force */
frbath(:,iatom,1,imode)=(pvrfact(:)*pvrfact(:)*dkinr(:) - gkt)/qmass(imode)
! /* update the thermostat position */
do inhc = 1, nnhc
rbath(:,iatom,inhc,imode) &
= rbath(:,iatom,inhc,imode) + 0.5d0*vrbath(:,iatom,inhc,imode)*dt_ys
enddo
! /* update the tehrmostat velocities */
do inhc = 1, nnhc-1
vrfact(:) = dexp(-0.125d0*vrbath(:,iatom,inhc+1,imode)*dt_ys)
vrbath(:,iatom,inhc,imode) &
= vrbath(:,iatom,inhc,imode)*vrfact(:)*vrfact(:) &
+ 0.25d0*frbath(:,iatom,inhc,imode)*vrfact*dt_ys
frbath(:,iatom,inhc+1,imode) &
= (qmass(imode)*vrbath(:,iatom,inhc,imode)*vrbath(:,iatom,inhc,imode) - gkt) &
/ qmass(imode)
enddo
vrbath(:,iatom,nnhc,imode) &
= vrbath(:,iatom,nnhc,imode) + 0.25d0*frbath(:,iatom,nnhc,imode)*dt_ys
! /* update the paricle velocities */
vur(:,iatom,imode) = vur(:,iatom,imode)*pvrfact(:)
enddo
enddo
enddo
Return
End Subroutine