ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/md_code/f_VDW.f90
Revision: 11
Committed: Tue Jul 9 18:40:59 2002 UTC (21 years, 11 months ago) by mmeineke
File size: 2075 byte(s)
Log Message:
This commit was generated by cvs2svn to compensate for changes in r10, which
included commits to RCS files with non-trunk default branches.

File Contents

# Content
1 subroutine force_VDW ( i, j, rcutsq, rijsq, sigma, epslon, v, &
2 fx, fy, fz, rxij, ryij, rzij, natoms )
3 implicit none
4
5
6 ! Passed parameters
7
8 integer :: natoms ! the number of atoms
9 integer :: i, j ! the index of the two atoms
10
11 real(kind=8) :: rcutsq ! the square of rcut (needed for the shift potential)
12 real(kind=8) :: rijsq ! the square of the distance twixt i and j
13 real(kind=8) :: v ! the potential energy
14 real(kind=8) :: rxij, ryij, rzij ! vector components of the distance
15
16 ! Passed arrays
17
18 real(kind=8), dimension(natoms) :: sigma ! the distance parameters
19 real(kind=8), dimension(natoms) :: epslon ! the wel depth parameters
20 real(kind=8), dimension(natoms) :: fx, fy, fz ! the force arrays
21
22 ! local variables
23
24 real(kind=8), parameter :: beta = 2.25_8, alpha = 1.84e5_8
25
26 real(kind=8) :: sr2, sr6, vij, vsij, fij
27 real(kind=8) :: srexp, sr, sr_i
28 real(kind=8) :: sigm, sigsq, epsl
29 real(kind=8) :: fxij, fyij, fzij
30 real(kind=8) :: preterm, r_exp_6
31
32 ! *********************************************************************
33
34 epsl = sqrt( epslon(i) * epslon(j) )
35 sigm = ( sigma(i) + sigma(j) ) / 2.0_8
36 sigsq = sigm * sigm
37
38 sr2 = sigsq / rijsq
39 sr = sqrt(sr2)
40 sr_i = 1.0_8 / sr
41 sr6 = beta * sr2 * sr2 * sr2
42 srexp = alpha * dexp( -12.0_8 * sr_i )
43
44 vij = epsl * ( srexp - sr6 )
45
46 r_exp_6= ( 2.0_8 * srexp ) - ( sr * sr6 )
47 preterm= ( 6.0_8 * epsl ) / ( sigsq * sr_i )
48 fij = preterm * r_exp_6
49
50 fxij = rxij * fij
51 fyij = ryij * fij
52 fzij = rzij * fij
53
54 fx(i) = fx(i) - fxij
55 fy(i) = fy(i) - fyij
56 fz(i) = fz(i) - fzij
57
58 fx(j) = fx(j) + fxij
59 fy(j) = fy(j) + fyij
60 fz(j) = fz(j) + fzij
61
62 ! calculate the shifted potential
63
64 sr2 = sigsq / rcutsq
65 sr = sqrt( sr2 )
66 sr_i = 1.0_8 / sr
67 sr6 = beta * sr2 * sr2 * sr2
68 srexp = alpha * exp(-12.0_8 * sr_i)
69
70 vsij = epsl * ( srexp - sr6 )
71
72 ! calculate the continous potential
73
74 v = v + vij - vsij
75
76 end subroutine force_vdw
77