9 |
|
!! @author Matthew Meineke |
10 |
|
!! @author Christopher Fennel |
11 |
|
!! @author J. Daniel Gezelter |
12 |
< |
!! @version $Id: calc_sticky_pair.F90,v 1.1.1.1 2003-03-21 17:42:12 mmeineke Exp $, $Date: 2003-03-21 17:42:12 $, $Name: not supported by cvs2svn $, $Revision: 1.1.1.1 $ |
12 |
> |
!! @version $Id: calc_sticky_pair.F90,v 1.11 2003-07-17 20:32:24 gezelter Exp $, $Date: 2003-07-17 20:32:24 $, $Name: not supported by cvs2svn $, $Revision: 1.11 $ |
13 |
|
|
14 |
|
module sticky_pair |
15 |
|
|
16 |
|
use force_globals |
17 |
|
use definitions |
18 |
+ |
use simulation |
19 |
|
#ifdef IS_MPI |
20 |
|
use mpiSimulation |
21 |
|
#endif |
25 |
|
PRIVATE |
26 |
|
|
27 |
|
logical, save :: sticky_initialized = .false. |
28 |
< |
real( kind = dp ), save :: SSD_w0 |
29 |
< |
real( kind = dp ), save :: SSD_v0 |
30 |
< |
real( kind = dp ), save :: SSD_rl |
31 |
< |
real( kind = dp ), save :: SSD_ru |
32 |
< |
real( kind = dp ), save :: SSD_rup |
28 |
> |
real( kind = dp ), save :: SSD_w0 = 0.0_dp |
29 |
> |
real( kind = dp ), save :: SSD_v0 = 0.0_dp |
30 |
> |
real( kind = dp ), save :: SSD_v0p = 0.0_dp |
31 |
> |
real( kind = dp ), save :: SSD_rl = 0.0_dp |
32 |
> |
real( kind = dp ), save :: SSD_ru = 0.0_dp |
33 |
> |
real( kind = dp ), save :: SSD_rlp = 0.0_dp |
34 |
> |
real( kind = dp ), save :: SSD_rup = 0.0_dp |
35 |
|
|
36 |
|
public :: check_sticky_FF |
37 |
|
public :: set_sticky_params |
46 |
|
return |
47 |
|
end subroutine check_sticky_FF |
48 |
|
|
49 |
< |
subroutine set_sticky_params(sticky_w0, sticky_v0) |
50 |
< |
real( kind = dp ), intent(in) :: sticky_w0, sticky_v0 |
49 |
> |
subroutine set_sticky_params(sticky_w0, sticky_v0, sticky_v0p, & |
50 |
> |
sticky_rl, sticky_ru, sticky_rlp, sticky_rup) |
51 |
> |
|
52 |
> |
real( kind = dp ), intent(in) :: sticky_w0, sticky_v0, sticky_v0p |
53 |
> |
real( kind = dp ), intent(in) :: sticky_rl, sticky_ru |
54 |
> |
real( kind = dp ), intent(in) :: sticky_rlp, sticky_rup |
55 |
|
|
56 |
|
! we could pass all 5 parameters if we felt like it... |
57 |
|
|
58 |
|
SSD_w0 = sticky_w0 |
59 |
|
SSD_v0 = sticky_v0 |
60 |
< |
SSD_rl = 2.75_DP |
61 |
< |
SSD_ru = 3.35_DP |
62 |
< |
SSD_rup = 4.0_DP |
60 |
> |
SSD_v0p = sticky_v0p |
61 |
> |
SSD_rl = sticky_rl |
62 |
> |
SSD_ru = sticky_ru |
63 |
> |
SSD_rlp = sticky_rlp |
64 |
> |
SSD_rup = sticky_rup |
65 |
|
|
66 |
|
sticky_initialized = .true. |
67 |
|
return |
69 |
|
|
70 |
|
subroutine do_sticky_pair(atom1, atom2, d, rij, r2, A, pot, f, t, & |
71 |
|
do_pot, do_stress) |
72 |
< |
|
72 |
> |
|
73 |
|
!! This routine does only the sticky portion of the SSD potential |
74 |
|
!! [Chandra and Ichiye, J. Chem. Phys. 111, 2701 (1999)]. |
75 |
|
!! The Lennard-Jones and dipolar interaction must be handled separately. |
76 |
< |
|
76 |
> |
|
77 |
|
!! We assume that the rotation matrices have already been calculated |
78 |
|
!! and placed in the A array. |
79 |
< |
|
79 |
> |
|
80 |
|
!! i and j are pointers to the two SSD atoms |
81 |
|
|
82 |
|
integer, intent(in) :: atom1, atom2 |
83 |
|
real (kind=dp), intent(inout) :: rij, r2 |
84 |
|
real (kind=dp), dimension(3), intent(in) :: d |
85 |
|
real (kind=dp) :: pot |
86 |
< |
real (kind=dp), dimension(:,:) :: A |
87 |
< |
real (kind=dp), dimension(:,:) :: f |
88 |
< |
real (kind=dp), dimension(:,:) :: t |
86 |
> |
real (kind=dp), dimension(9,getNlocal()) :: A |
87 |
> |
real (kind=dp), dimension(3,getNlocal()) :: f |
88 |
> |
real (kind=dp), dimension(3,getNlocal()) :: t |
89 |
|
logical, intent(in) :: do_pot, do_stress |
90 |
|
|
91 |
|
real (kind=dp) :: xi, yi, zi, xj, yj, zj, xi2, yi2, zi2, xj2, yj2, zj2 |
101 |
|
real (kind=dp) :: fxii, fyii, fzii, fxjj, fyjj, fzjj |
102 |
|
real (kind=dp) :: fxij, fyij, fzij, fxji, fyji, fzji |
103 |
|
real (kind=dp) :: fxradial, fyradial, fzradial |
104 |
< |
|
104 |
> |
real (kind=dp) :: rijtest, rjitest |
105 |
> |
real (kind=dp) :: radcomxi, radcomyi, radcomzi |
106 |
> |
real (kind=dp) :: radcomxj, radcomyj, radcomzj |
107 |
> |
|
108 |
> |
|
109 |
|
if (.not.sticky_initialized) then |
110 |
|
write(*,*) 'Sticky forces not initialized!' |
111 |
|
return |
112 |
|
endif |
113 |
|
|
114 |
< |
r3 = r2*rij |
115 |
< |
r5 = r3*r2 |
116 |
< |
|
117 |
< |
drdx = d(1) / rij |
118 |
< |
drdy = d(2) / rij |
119 |
< |
drdz = d(3) / rij |
120 |
< |
|
114 |
> |
if ( rij .LE. SSD_rup ) then |
115 |
> |
|
116 |
> |
r3 = r2*rij |
117 |
> |
r5 = r3*r2 |
118 |
> |
|
119 |
> |
drdx = d(1) / rij |
120 |
> |
drdy = d(2) / rij |
121 |
> |
drdz = d(3) / rij |
122 |
> |
|
123 |
|
#ifdef IS_MPI |
124 |
< |
! rotate the inter-particle separation into the two different |
125 |
< |
! body-fixed coordinate systems: |
126 |
< |
|
127 |
< |
xi = A_row(1,atom1)*d(1) + A_row(2,atom1)*d(2) + A_row(3,atom1)*d(3) |
128 |
< |
yi = A_row(4,atom1)*d(1) + A_row(5,atom1)*d(2) + A_row(6,atom1)*d(3) |
129 |
< |
zi = A_row(7,atom1)*d(1) + A_row(8,atom1)*d(2) + A_row(9,atom1)*d(3) |
130 |
< |
|
131 |
< |
! negative sign because this is the vector from j to i: |
132 |
< |
|
133 |
< |
xj = -(A_Col(1,atom2)*d(1) + A_Col(2,atom2)*d(2) + A_Col(3,atom2)*d(3)) |
134 |
< |
yj = -(A_Col(4,atom2)*d(1) + A_Col(5,atom2)*d(2) + A_Col(6,atom2)*d(3)) |
135 |
< |
zj = -(A_Col(7,atom2)*d(1) + A_Col(8,atom2)*d(2) + A_Col(9,atom2)*d(3)) |
124 |
> |
! rotate the inter-particle separation into the two different |
125 |
> |
! body-fixed coordinate systems: |
126 |
> |
|
127 |
> |
xi = A_row(1,atom1)*d(1) + A_row(2,atom1)*d(2) + A_row(3,atom1)*d(3) |
128 |
> |
yi = A_row(4,atom1)*d(1) + A_row(5,atom1)*d(2) + A_row(6,atom1)*d(3) |
129 |
> |
zi = A_row(7,atom1)*d(1) + A_row(8,atom1)*d(2) + A_row(9,atom1)*d(3) |
130 |
> |
|
131 |
> |
! negative sign because this is the vector from j to i: |
132 |
> |
|
133 |
> |
xj = -(A_Col(1,atom2)*d(1) + A_Col(2,atom2)*d(2) + A_Col(3,atom2)*d(3)) |
134 |
> |
yj = -(A_Col(4,atom2)*d(1) + A_Col(5,atom2)*d(2) + A_Col(6,atom2)*d(3)) |
135 |
> |
zj = -(A_Col(7,atom2)*d(1) + A_Col(8,atom2)*d(2) + A_Col(9,atom2)*d(3)) |
136 |
|
#else |
137 |
< |
! rotate the inter-particle separation into the two different |
138 |
< |
! body-fixed coordinate systems: |
139 |
< |
|
140 |
< |
xi = a(1,atom1)*d(1) + a(2,atom1)*d(2) + a(3,atom1)*d(3) |
141 |
< |
yi = a(4,atom1)*d(1) + a(5,atom1)*d(2) + a(6,atom1)*d(3) |
142 |
< |
zi = a(7,atom1)*d(1) + a(8,atom1)*d(2) + a(9,atom1)*d(3) |
143 |
< |
|
144 |
< |
! negative sign because this is the vector from j to i: |
145 |
< |
|
146 |
< |
xj = -(a(1,atom2)*d(1) + a(2,atom2)*d(2) + a(3,atom2)*d(3)) |
147 |
< |
yj = -(a(4,atom2)*d(1) + a(5,atom2)*d(2) + a(6,atom2)*d(3)) |
148 |
< |
zj = -(a(7,atom2)*d(1) + a(8,atom2)*d(2) + a(9,atom2)*d(3)) |
137 |
> |
! rotate the inter-particle separation into the two different |
138 |
> |
! body-fixed coordinate systems: |
139 |
> |
|
140 |
> |
xi = a(1,atom1)*d(1) + a(2,atom1)*d(2) + a(3,atom1)*d(3) |
141 |
> |
yi = a(4,atom1)*d(1) + a(5,atom1)*d(2) + a(6,atom1)*d(3) |
142 |
> |
zi = a(7,atom1)*d(1) + a(8,atom1)*d(2) + a(9,atom1)*d(3) |
143 |
> |
|
144 |
> |
! negative sign because this is the vector from j to i: |
145 |
> |
|
146 |
> |
xj = -(a(1,atom2)*d(1) + a(2,atom2)*d(2) + a(3,atom2)*d(3)) |
147 |
> |
yj = -(a(4,atom2)*d(1) + a(5,atom2)*d(2) + a(6,atom2)*d(3)) |
148 |
> |
zj = -(a(7,atom2)*d(1) + a(8,atom2)*d(2) + a(9,atom2)*d(3)) |
149 |
|
#endif |
135 |
– |
|
136 |
– |
xi2 = xi*xi |
137 |
– |
yi2 = yi*yi |
138 |
– |
zi2 = zi*zi |
139 |
– |
|
140 |
– |
xj2 = xj*xj |
141 |
– |
yj2 = yj*yj |
142 |
– |
zj2 = zj*zj |
143 |
– |
|
144 |
– |
call calc_sw_fnc(rij, s, sp, dsdr, dspdr) |
145 |
– |
|
146 |
– |
wi = 2.0d0*(xi2-yi2)*zi / r3 |
147 |
– |
wj = 2.0d0*(xj2-yj2)*zj / r3 |
148 |
– |
w = wi+wj |
149 |
– |
|
150 |
– |
zif = zi/rij - 0.6d0 |
151 |
– |
zis = zi/rij + 0.8d0 |
152 |
– |
|
153 |
– |
zjf = zj/rij - 0.6d0 |
154 |
– |
zjs = zj/rij + 0.8d0 |
155 |
– |
|
156 |
– |
wip = zif*zif*zis*zis - SSD_w0 |
157 |
– |
wjp = zjf*zjf*zjs*zjs - SSD_w0 |
158 |
– |
wp = wip + wjp |
150 |
|
|
151 |
+ |
xi2 = xi*xi |
152 |
+ |
yi2 = yi*yi |
153 |
+ |
zi2 = zi*zi |
154 |
|
|
155 |
< |
if (do_pot) then |
155 |
> |
xj2 = xj*xj |
156 |
> |
yj2 = yj*yj |
157 |
> |
zj2 = zj*zj |
158 |
> |
|
159 |
> |
call calc_sw_fnc(rij, s, sp, dsdr, dspdr) |
160 |
> |
|
161 |
> |
wi = 2.0d0*(xi2-yi2)*zi / r3 |
162 |
> |
wj = 2.0d0*(xj2-yj2)*zj / r3 |
163 |
> |
w = wi+wj |
164 |
> |
|
165 |
> |
zif = zi/rij - 0.6d0 |
166 |
> |
zis = zi/rij + 0.8d0 |
167 |
> |
|
168 |
> |
zjf = zj/rij - 0.6d0 |
169 |
> |
zjs = zj/rij + 0.8d0 |
170 |
> |
|
171 |
> |
wip = zif*zif*zis*zis - SSD_w0 |
172 |
> |
wjp = zjf*zjf*zjs*zjs - SSD_w0 |
173 |
> |
wp = wip + wjp |
174 |
> |
|
175 |
> |
if (do_pot) then |
176 |
|
#ifdef IS_MPI |
177 |
< |
pot_row(atom1) = pot_row(atom1) + 0.25d0*SSD_v0*(s*w + sp*wp) |
178 |
< |
pot_col(atom2) = pot_col(atom2) + 0.25d0*SSD_v0*(s*w + sp*wp) |
177 |
> |
pot_row(atom1) = pot_row(atom1) + 0.25d0*(SSD_v0*s*w + SSD_v0p*sp*wp) |
178 |
> |
pot_col(atom2) = pot_col(atom2) + 0.25d0*(SSD_v0*s*w + SSD_v0p*sp*wp) |
179 |
|
#else |
180 |
< |
pot = pot + 0.5d0*SSD_v0*(s*w + sp*wp) |
180 |
> |
pot = pot + 0.5d0*(SSD_v0*s*w + SSD_v0p*sp*wp) |
181 |
|
#endif |
182 |
< |
endif |
169 |
< |
|
170 |
< |
dwidx = 4.0d0*xi*zi/r3 - 6.0d0*xi*zi*(xi2-yi2)/r5 |
171 |
< |
dwidy = - 4.0d0*yi*zi/r3 - 6.0d0*yi*zi*(xi2-yi2)/r5 |
172 |
< |
dwidz = 2.0d0*(xi2-yi2)/r3 - 6.0d0*zi2*(xi2-yi2)/r5 |
173 |
< |
|
174 |
< |
dwjdx = 4.0d0*xj*zj/r3 - 6.0d0*xj*zj*(xj2-yj2)/r5 |
175 |
< |
dwjdy = - 4.0d0*yj*zj/r3 - 6.0d0*yj*zj*(xj2-yj2)/r5 |
176 |
< |
dwjdz = 2.0d0*(xj2-yj2)/r3 - 6.0d0*zj2*(xj2-yj2)/r5 |
177 |
< |
|
178 |
< |
uglyi = zif*zif*zis + zif*zis*zis |
179 |
< |
uglyj = zjf*zjf*zjs + zjf*zjs*zjs |
180 |
< |
|
181 |
< |
dwipdx = -2.0d0*xi*zi*uglyi/r3 |
182 |
< |
dwipdy = -2.0d0*yi*zi*uglyi/r3 |
183 |
< |
dwipdz = 2.0d0*(1.0d0/rij - zi2/r3)*uglyi |
184 |
< |
|
185 |
< |
dwjpdx = -2.0d0*xj*zj*uglyj/r3 |
186 |
< |
dwjpdy = -2.0d0*yj*zj*uglyj/r3 |
187 |
< |
dwjpdz = 2.0d0*(1.0d0/rij - zj2/r3)*uglyj |
188 |
< |
|
189 |
< |
dwidux = 4.0d0*(yi*zi2 + 0.5d0*yi*(xi2-yi2))/r3 |
190 |
< |
dwiduy = 4.0d0*(xi*zi2 - 0.5d0*xi*(xi2-yi2))/r3 |
191 |
< |
dwiduz = - 8.0d0*xi*yi*zi/r3 |
192 |
< |
|
193 |
< |
dwjdux = 4.0d0*(yj*zj2 + 0.5d0*yj*(xj2-yj2))/r3 |
194 |
< |
dwjduy = 4.0d0*(xj*zj2 - 0.5d0*xj*(xj2-yj2))/r3 |
195 |
< |
dwjduz = - 8.0d0*xj*yj*zj/r3 |
196 |
< |
|
197 |
< |
dwipdux = 2.0d0*yi*uglyi/rij |
198 |
< |
dwipduy = -2.0d0*xi*uglyi/rij |
199 |
< |
dwipduz = 0.0d0 |
200 |
< |
|
201 |
< |
dwjpdux = 2.0d0*yj*uglyj/rij |
202 |
< |
dwjpduy = -2.0d0*xj*uglyj/rij |
203 |
< |
dwjpduz = 0.0d0 |
204 |
< |
|
205 |
< |
! do the torques first since they are easy: |
206 |
< |
! remember that these are still in the body fixed axes |
207 |
< |
|
208 |
< |
txi = 0.5d0*SSD_v0*(s*dwidux + sp*dwipdux) |
209 |
< |
tyi = 0.5d0*SSD_v0*(s*dwiduy + sp*dwipduy) |
210 |
< |
tzi = 0.5d0*SSD_v0*(s*dwiduz + sp*dwipduz) |
211 |
< |
|
212 |
< |
txj = 0.5d0*SSD_v0*(s*dwjdux + sp*dwjpdux) |
213 |
< |
tyj = 0.5d0*SSD_v0*(s*dwjduy + sp*dwjpduy) |
214 |
< |
tzj = 0.5d0*SSD_v0*(s*dwjduz + sp*dwjpduz) |
215 |
< |
|
216 |
< |
! go back to lab frame using transpose of rotation matrix: |
217 |
< |
|
218 |
< |
#ifdef IS_MPI |
219 |
< |
t_Row(1,atom1) = t_Row(1,atom1) + a_Row(1,atom1)*txi + & |
220 |
< |
a_Row(4,atom1)*tyi + a_Row(7,atom1)*tzi |
221 |
< |
t_Row(2,atom1) = t_Row(2,atom1) + a_Row(2,atom1)*txi + & |
222 |
< |
a_Row(5,atom1)*tyi + a_Row(8,atom1)*tzi |
223 |
< |
t_Row(3,atom1) = t_Row(3,atom1) + a_Row(3,atom1)*txi + & |
224 |
< |
a_Row(6,atom1)*tyi + a_Row(9,atom1)*tzi |
225 |
< |
|
226 |
< |
t_Col(1,atom2) = t_Col(1,atom2) + a_Col(1,atom2)*txj + & |
227 |
< |
a_Col(4,atom2)*tyj + a_Col(7,atom2)*tzj |
228 |
< |
t_Col(2,atom2) = t_Col(2,atom2) + a_Col(2,atom2)*txj + & |
229 |
< |
a_Col(5,atom2)*tyj + a_Col(8,atom2)*tzj |
230 |
< |
t_Col(3,atom2) = t_Col(3,atom2) + a_Col(3,atom2)*txj + & |
231 |
< |
a_Col(6,atom2)*tyj + a_Col(9,atom2)*tzj |
232 |
< |
#else |
233 |
< |
t(1,atom1) = t(1,atom1) + a(1,atom1)*txi + a(4,atom1)*tyi + a(7,atom1)*tzi |
234 |
< |
t(2,atom1) = t(2,atom1) + a(2,atom1)*txi + a(5,atom1)*tyi + a(8,atom1)*tzi |
235 |
< |
t(3,atom1) = t(3,atom1) + a(3,atom1)*txi + a(6,atom1)*tyi + a(9,atom1)*tzi |
236 |
< |
|
237 |
< |
t(1,atom2) = t(1,atom2) + a(1,atom2)*txj + a(4,atom2)*tyj + a(7,atom2)*tzj |
238 |
< |
t(2,atom2) = t(2,atom2) + a(2,atom2)*txj + a(5,atom2)*tyj + a(8,atom2)*tzj |
239 |
< |
t(3,atom2) = t(3,atom2) + a(3,atom2)*txj + a(6,atom2)*tyj + a(9,atom2)*tzj |
240 |
< |
#endif |
241 |
< |
! Now, on to the forces: |
242 |
< |
|
243 |
< |
! first rotate the i terms back into the lab frame: |
182 |
> |
endif |
183 |
|
|
184 |
< |
#ifdef IS_MPI |
185 |
< |
fxii = a_Row(1,atom1)*(s*dwidx+sp*dwipdx) + & |
186 |
< |
a_Row(4,atom1)*(s*dwidy+sp*dwipdy) + & |
248 |
< |
a_Row(7,atom1)*(s*dwidz+sp*dwipdz) |
249 |
< |
fyii = a_Row(2,atom1)*(s*dwidx+sp*dwipdx) + & |
250 |
< |
a_Row(5,atom1)*(s*dwidy+sp*dwipdy) + & |
251 |
< |
a_Row(8,atom1)*(s*dwidz+sp*dwipdz) |
252 |
< |
fzii = a_Row(3,atom1)*(s*dwidx+sp*dwipdx) + & |
253 |
< |
a_Row(6,atom1)*(s*dwidy+sp*dwipdy) + & |
254 |
< |
a_Row(9,atom1)*(s*dwidz+sp*dwipdz) |
184 |
> |
dwidx = 4.0d0*xi*zi/r3 - 6.0d0*xi*zi*(xi2-yi2)/r5 |
185 |
> |
dwidy = - 4.0d0*yi*zi/r3 - 6.0d0*yi*zi*(xi2-yi2)/r5 |
186 |
> |
dwidz = 2.0d0*(xi2-yi2)/r3 - 6.0d0*zi2*(xi2-yi2)/r5 |
187 |
|
|
188 |
< |
fxjj = a_Col(1,atom2)*(s*dwjdx+sp*dwjpdx) + & |
189 |
< |
a_Col(4,atom2)*(s*dwjdy+sp*dwjpdy) + & |
190 |
< |
a_Col(7,atom2)*(s*dwjdz+sp*dwjpdz) |
191 |
< |
fyjj = a_Col(2,atom2)*(s*dwjdx+sp*dwjpdx) + & |
192 |
< |
a_Col(5,atom2)*(s*dwjdy+sp*dwjpdy) + & |
193 |
< |
a_Col(8,atom2)*(s*dwjdz+sp*dwjpdz) |
194 |
< |
fzjj = a_Col(3,atom2)*(s*dwjdx+sp*dwjpdx)+ & |
195 |
< |
a_Col(6,atom2)*(s*dwjdy+sp*dwjpdy) + & |
196 |
< |
a_Col(9,atom2)*(s*dwjdz+sp*dwjpdz) |
188 |
> |
dwjdx = 4.0d0*xj*zj/r3 - 6.0d0*xj*zj*(xj2-yj2)/r5 |
189 |
> |
dwjdy = - 4.0d0*yj*zj/r3 - 6.0d0*yj*zj*(xj2-yj2)/r5 |
190 |
> |
dwjdz = 2.0d0*(xj2-yj2)/r3 - 6.0d0*zj2*(xj2-yj2)/r5 |
191 |
> |
|
192 |
> |
uglyi = zif*zif*zis + zif*zis*zis |
193 |
> |
uglyj = zjf*zjf*zjs + zjf*zjs*zjs |
194 |
> |
|
195 |
> |
dwipdx = -2.0d0*xi*zi*uglyi/r3 |
196 |
> |
dwipdy = -2.0d0*yi*zi*uglyi/r3 |
197 |
> |
dwipdz = 2.0d0*(1.0d0/rij - zi2/r3)*uglyi |
198 |
> |
|
199 |
> |
dwjpdx = -2.0d0*xj*zj*uglyj/r3 |
200 |
> |
dwjpdy = -2.0d0*yj*zj*uglyj/r3 |
201 |
> |
dwjpdz = 2.0d0*(1.0d0/rij - zj2/r3)*uglyj |
202 |
> |
|
203 |
> |
dwidux = 4.0d0*(yi*zi2 + 0.5d0*yi*(xi2-yi2))/r3 |
204 |
> |
dwiduy = 4.0d0*(xi*zi2 - 0.5d0*xi*(xi2-yi2))/r3 |
205 |
> |
dwiduz = - 8.0d0*xi*yi*zi/r3 |
206 |
> |
|
207 |
> |
dwjdux = 4.0d0*(yj*zj2 + 0.5d0*yj*(xj2-yj2))/r3 |
208 |
> |
dwjduy = 4.0d0*(xj*zj2 - 0.5d0*xj*(xj2-yj2))/r3 |
209 |
> |
dwjduz = - 8.0d0*xj*yj*zj/r3 |
210 |
> |
|
211 |
> |
dwipdux = 2.0d0*yi*uglyi/rij |
212 |
> |
dwipduy = -2.0d0*xi*uglyi/rij |
213 |
> |
dwipduz = 0.0d0 |
214 |
> |
|
215 |
> |
dwjpdux = 2.0d0*yj*uglyj/rij |
216 |
> |
dwjpduy = -2.0d0*xj*uglyj/rij |
217 |
> |
dwjpduz = 0.0d0 |
218 |
> |
|
219 |
> |
! do the torques first since they are easy: |
220 |
> |
! remember that these are still in the body fixed axes |
221 |
> |
|
222 |
> |
txi = 0.5d0*(SSD_v0*s*dwidux + SSD_v0p*sp*dwipdux) |
223 |
> |
tyi = 0.5d0*(SSD_v0*s*dwiduy + SSD_v0p*sp*dwipduy) |
224 |
> |
tzi = 0.5d0*(SSD_v0*s*dwiduz + SSD_v0p*sp*dwipduz) |
225 |
> |
|
226 |
> |
txj = 0.5d0*(SSD_v0*s*dwjdux + SSD_v0p*sp*dwjpdux) |
227 |
> |
tyj = 0.5d0*(SSD_v0*s*dwjduy + SSD_v0p*sp*dwjpduy) |
228 |
> |
tzj = 0.5d0*(SSD_v0*s*dwjduz + SSD_v0p*sp*dwjpduz) |
229 |
> |
|
230 |
> |
! go back to lab frame using transpose of rotation matrix: |
231 |
> |
|
232 |
> |
#ifdef IS_MPI |
233 |
> |
t_Row(1,atom1) = t_Row(1,atom1) + a_Row(1,atom1)*txi + & |
234 |
> |
a_Row(4,atom1)*tyi + a_Row(7,atom1)*tzi |
235 |
> |
t_Row(2,atom1) = t_Row(2,atom1) + a_Row(2,atom1)*txi + & |
236 |
> |
a_Row(5,atom1)*tyi + a_Row(8,atom1)*tzi |
237 |
> |
t_Row(3,atom1) = t_Row(3,atom1) + a_Row(3,atom1)*txi + & |
238 |
> |
a_Row(6,atom1)*tyi + a_Row(9,atom1)*tzi |
239 |
> |
|
240 |
> |
t_Col(1,atom2) = t_Col(1,atom2) + a_Col(1,atom2)*txj + & |
241 |
> |
a_Col(4,atom2)*tyj + a_Col(7,atom2)*tzj |
242 |
> |
t_Col(2,atom2) = t_Col(2,atom2) + a_Col(2,atom2)*txj + & |
243 |
> |
a_Col(5,atom2)*tyj + a_Col(8,atom2)*tzj |
244 |
> |
t_Col(3,atom2) = t_Col(3,atom2) + a_Col(3,atom2)*txj + & |
245 |
> |
a_Col(6,atom2)*tyj + a_Col(9,atom2)*tzj |
246 |
|
#else |
247 |
< |
fxii = a(1,atom1)*(s*dwidx+sp*dwipdx) + & |
248 |
< |
a(4,atom1)*(s*dwidy+sp*dwipdy) + & |
249 |
< |
a(7,atom1)*(s*dwidz+sp*dwipdz) |
269 |
< |
fyii = a(2,atom1)*(s*dwidx+sp*dwipdx) + & |
270 |
< |
a(5,atom1)*(s*dwidy+sp*dwipdy) + & |
271 |
< |
a(8,atom1)*(s*dwidz+sp*dwipdz) |
272 |
< |
fzii = a(3,atom1)*(s*dwidx+sp*dwipdx) + & |
273 |
< |
a(6,atom1)*(s*dwidy+sp*dwipdy) + & |
274 |
< |
a(9,atom1)*(s*dwidz+sp*dwipdz) |
247 |
> |
t(1,atom1) = t(1,atom1) + a(1,atom1)*txi + a(4,atom1)*tyi + a(7,atom1)*tzi |
248 |
> |
t(2,atom1) = t(2,atom1) + a(2,atom1)*txi + a(5,atom1)*tyi + a(8,atom1)*tzi |
249 |
> |
t(3,atom1) = t(3,atom1) + a(3,atom1)*txi + a(6,atom1)*tyi + a(9,atom1)*tzi |
250 |
|
|
251 |
< |
fxjj = a(1,atom2)*(s*dwjdx+sp*dwjpdx) + & |
252 |
< |
a(4,atom2)*(s*dwjdy+sp*dwjpdy) + & |
253 |
< |
a(7,atom2)*(s*dwjdz+sp*dwjpdz) |
254 |
< |
fyjj = a(2,atom2)*(s*dwjdx+sp*dwjpdx) + & |
255 |
< |
a(5,atom2)*(s*dwjdy+sp*dwjpdy) + & |
256 |
< |
a(8,atom2)*(s*dwjdz+sp*dwjpdz) |
257 |
< |
fzjj = a(3,atom2)*(s*dwjdx+sp*dwjpdx)+ & |
258 |
< |
a(6,atom2)*(s*dwjdy+sp*dwjpdy) + & |
259 |
< |
a(9,atom2)*(s*dwjdz+sp*dwjpdz) |
251 |
> |
t(1,atom2) = t(1,atom2) + a(1,atom2)*txj + a(4,atom2)*tyj + a(7,atom2)*tzj |
252 |
> |
t(2,atom2) = t(2,atom2) + a(2,atom2)*txj + a(5,atom2)*tyj + a(8,atom2)*tzj |
253 |
> |
t(3,atom2) = t(3,atom2) + a(3,atom2)*txj + a(6,atom2)*tyj + a(9,atom2)*tzj |
254 |
> |
#endif |
255 |
> |
! Now, on to the forces: |
256 |
> |
|
257 |
> |
! first rotate the i terms back into the lab frame: |
258 |
> |
|
259 |
> |
radcomxi = SSD_v0*s*dwidx+SSD_v0p*sp*dwipdx |
260 |
> |
radcomyi = SSD_v0*s*dwidy+SSD_v0p*sp*dwipdy |
261 |
> |
radcomzi = SSD_v0*s*dwidz+SSD_v0p*sp*dwipdz |
262 |
> |
|
263 |
> |
radcomxj = SSD_v0*s*dwjdx+SSD_v0p*sp*dwjpdx |
264 |
> |
radcomyj = SSD_v0*s*dwjdy+SSD_v0p*sp*dwjpdy |
265 |
> |
radcomzj = SSD_v0*s*dwjdz+SSD_v0p*sp*dwjpdz |
266 |
> |
|
267 |
> |
#ifdef IS_MPI |
268 |
> |
fxii = a_Row(1,atom1)*(radcomxi) + & |
269 |
> |
a_Row(4,atom1)*(radcomyi) + & |
270 |
> |
a_Row(7,atom1)*(radcomzi) |
271 |
> |
fyii = a_Row(2,atom1)*(radcomxi) + & |
272 |
> |
a_Row(5,atom1)*(radcomyi) + & |
273 |
> |
a_Row(8,atom1)*(radcomzi) |
274 |
> |
fzii = a_Row(3,atom1)*(radcomxi) + & |
275 |
> |
a_Row(6,atom1)*(radcomyi) + & |
276 |
> |
a_Row(9,atom1)*(radcomzi) |
277 |
> |
|
278 |
> |
fxjj = a_Col(1,atom2)*(radcomxj) + & |
279 |
> |
a_Col(4,atom2)*(radcomyj) + & |
280 |
> |
a_Col(7,atom2)*(radcomzj) |
281 |
> |
fyjj = a_Col(2,atom2)*(radcomxj) + & |
282 |
> |
a_Col(5,atom2)*(radcomyj) + & |
283 |
> |
a_Col(8,atom2)*(radcomzj) |
284 |
> |
fzjj = a_Col(3,atom2)*(radcomxj)+ & |
285 |
> |
a_Col(6,atom2)*(radcomyj) + & |
286 |
> |
a_Col(9,atom2)*(radcomzj) |
287 |
> |
#else |
288 |
> |
fxii = a(1,atom1)*(radcomxi) + & |
289 |
> |
a(4,atom1)*(radcomyi) + & |
290 |
> |
a(7,atom1)*(radcomzi) |
291 |
> |
fyii = a(2,atom1)*(radcomxi) + & |
292 |
> |
a(5,atom1)*(radcomyi) + & |
293 |
> |
a(8,atom1)*(radcomzi) |
294 |
> |
fzii = a(3,atom1)*(radcomxi) + & |
295 |
> |
a(6,atom1)*(radcomyi) + & |
296 |
> |
a(9,atom1)*(radcomzi) |
297 |
> |
|
298 |
> |
fxjj = a(1,atom2)*(radcomxj) + & |
299 |
> |
a(4,atom2)*(radcomyj) + & |
300 |
> |
a(7,atom2)*(radcomzj) |
301 |
> |
fyjj = a(2,atom2)*(radcomxj) + & |
302 |
> |
a(5,atom2)*(radcomyj) + & |
303 |
> |
a(8,atom2)*(radcomzj) |
304 |
> |
fzjj = a(3,atom2)*(radcomxj)+ & |
305 |
> |
a(6,atom2)*(radcomyj) + & |
306 |
> |
a(9,atom2)*(radcomzj) |
307 |
|
#endif |
286 |
– |
|
287 |
– |
fxij = -fxii |
288 |
– |
fyij = -fyii |
289 |
– |
fzij = -fzii |
290 |
– |
|
291 |
– |
fxji = -fxjj |
292 |
– |
fyji = -fyjj |
293 |
– |
fzji = -fzjj |
294 |
– |
|
295 |
– |
! now assemble these with the radial-only terms: |
308 |
|
|
309 |
< |
fxradial = 0.5d0*SSD_v0*(dsdr*drdx*w + dspdr*drdx*wp + fxii + fxji) |
310 |
< |
fyradial = 0.5d0*SSD_v0*(dsdr*drdy*w + dspdr*drdy*wp + fyii + fyji) |
311 |
< |
fzradial = 0.5d0*SSD_v0*(dsdr*drdz*w + dspdr*drdz*wp + fzii + fzji) |
312 |
< |
|
309 |
> |
fxij = -fxii |
310 |
> |
fyij = -fyii |
311 |
> |
fzij = -fzii |
312 |
> |
|
313 |
> |
fxji = -fxjj |
314 |
> |
fyji = -fyjj |
315 |
> |
fzji = -fzjj |
316 |
> |
|
317 |
> |
! now assemble these with the radial-only terms: |
318 |
> |
|
319 |
> |
fxradial = 0.5d0*(SSD_v0*dsdr*drdx*w + SSD_v0p*dspdr*drdx*wp + fxii + fxji) |
320 |
> |
fyradial = 0.5d0*(SSD_v0*dsdr*drdy*w + SSD_v0p*dspdr*drdy*wp + fyii + fyji) |
321 |
> |
fzradial = 0.5d0*(SSD_v0*dsdr*drdz*w + SSD_v0p*dspdr*drdz*wp + fzii + fzji) |
322 |
> |
|
323 |
|
#ifdef IS_MPI |
324 |
< |
f_Row(1,atom1) = f_Row(1,atom1) + fxradial |
325 |
< |
f_Row(2,atom1) = f_Row(2,atom1) + fyradial |
326 |
< |
f_Row(3,atom1) = f_Row(3,atom1) + fzradial |
327 |
< |
|
328 |
< |
f_Col(1,atom2) = f_Col(1,atom2) + 0.5d0*SSD_v0*(-dsdr*drdx*w - & |
329 |
< |
dspdr*drdx*wp + fxjj + fxij) |
330 |
< |
f_Col(2,atom2) = f_Col(2,atom2) + 0.5d0*SSD_v0*(-dsdr*drdy*w - & |
309 |
< |
dspdr*drdy*wp + fyjj + fyij) |
310 |
< |
f_Col(3,atom2) = f_Col(3,atom2) + 0.5d0*SSD_v0*(-dsdr*drdz*w - & |
311 |
< |
dspdr*drdz*wp + fzjj + fzij) |
324 |
> |
f_Row(1,atom1) = f_Row(1,atom1) + fxradial |
325 |
> |
f_Row(2,atom1) = f_Row(2,atom1) + fyradial |
326 |
> |
f_Row(3,atom1) = f_Row(3,atom1) + fzradial |
327 |
> |
|
328 |
> |
f_Col(1,atom2) = f_Col(1,atom2) - fxradial |
329 |
> |
f_Col(2,atom2) = f_Col(2,atom2) - fyradial |
330 |
> |
f_Col(3,atom2) = f_Col(3,atom2) - fzradial |
331 |
|
#else |
332 |
< |
f(1,atom1) = f(1,atom1) + fxradial |
333 |
< |
f(2,atom1) = f(2,atom1) + fyradial |
334 |
< |
f(3,atom1) = f(3,atom1) + fzradial |
335 |
< |
|
336 |
< |
f(1,atom2) = f(1,atom2) + 0.5d0*SSD_v0*(-dsdr*drdx*w - dspdr*drdx*wp + & |
337 |
< |
fxjj + fxij) |
338 |
< |
f(2,atom2) = f(2,atom2) + 0.5d0*SSD_v0*(-dsdr*drdy*w - dspdr*drdy*wp + & |
320 |
< |
fyjj + fyij) |
321 |
< |
f(3,atom2) = f(3,atom2) + 0.5d0*SSD_v0*(-dsdr*drdz*w - dspdr*drdz*wp + & |
322 |
< |
fzjj + fzij) |
332 |
> |
f(1,atom1) = f(1,atom1) + fxradial |
333 |
> |
f(2,atom1) = f(2,atom1) + fyradial |
334 |
> |
f(3,atom1) = f(3,atom1) + fzradial |
335 |
> |
|
336 |
> |
f(1,atom2) = f(1,atom2) - fxradial |
337 |
> |
f(2,atom2) = f(2,atom2) - fyradial |
338 |
> |
f(3,atom2) = f(3,atom2) - fzradial |
339 |
|
#endif |
340 |
< |
|
341 |
< |
if (do_stress) then |
342 |
< |
tau_Temp(1) = tau_Temp(1) + fxradial * d(1) |
343 |
< |
tau_Temp(2) = tau_Temp(2) + fxradial * d(2) |
344 |
< |
tau_Temp(3) = tau_Temp(3) + fxradial * d(3) |
345 |
< |
tau_Temp(4) = tau_Temp(4) + fyradial * d(1) |
346 |
< |
tau_Temp(5) = tau_Temp(5) + fyradial * d(2) |
347 |
< |
tau_Temp(6) = tau_Temp(6) + fyradial * d(3) |
348 |
< |
tau_Temp(7) = tau_Temp(7) + fzradial * d(1) |
349 |
< |
tau_Temp(8) = tau_Temp(8) + fzradial * d(2) |
350 |
< |
tau_Temp(9) = tau_Temp(9) + fzradial * d(3) |
351 |
< |
virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
340 |
> |
|
341 |
> |
if (do_stress) then |
342 |
> |
if (molMembershipList(atom1) .ne. molMembershipList(atom2)) then |
343 |
> |
|
344 |
> |
! because the d vector is the rj - ri vector, and |
345 |
> |
! because fxradial, fyradial, and fzradial are the |
346 |
> |
! (positive) force on atom i (negative on atom j) we need |
347 |
> |
! a negative sign here: |
348 |
> |
|
349 |
> |
tau_Temp(1) = tau_Temp(1) - d(1) * fxradial |
350 |
> |
tau_Temp(2) = tau_Temp(2) - d(1) * fyradial |
351 |
> |
tau_Temp(3) = tau_Temp(3) - d(1) * fzradial |
352 |
> |
tau_Temp(4) = tau_Temp(4) - d(2) * fxradial |
353 |
> |
tau_Temp(5) = tau_Temp(5) - d(2) * fyradial |
354 |
> |
tau_Temp(6) = tau_Temp(6) - d(2) * fzradial |
355 |
> |
tau_Temp(7) = tau_Temp(7) - d(3) * fxradial |
356 |
> |
tau_Temp(8) = tau_Temp(8) - d(3) * fyradial |
357 |
> |
tau_Temp(9) = tau_Temp(9) - d(3) * fzradial |
358 |
> |
|
359 |
> |
virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
360 |
> |
endif |
361 |
> |
endif |
362 |
|
endif |
363 |
< |
|
363 |
> |
|
364 |
|
end subroutine do_sticky_pair |
365 |
|
|
366 |
|
!! calculates the switching functions and their derivatives for a given |
367 |
|
subroutine calc_sw_fnc(r, s, sp, dsdr, dspdr) |
368 |
< |
|
368 |
> |
|
369 |
|
real (kind=dp), intent(in) :: r |
370 |
|
real (kind=dp), intent(inout) :: s, sp, dsdr, dspdr |
371 |
< |
|
371 |
> |
|
372 |
|
! distances must be in angstroms |
373 |
|
|
374 |
|
if (r.lt.SSD_rl) then |
375 |
|
s = 1.0d0 |
350 |
– |
sp = 1.0d0 |
376 |
|
dsdr = 0.0d0 |
377 |
+ |
elseif (r.gt.SSD_ru) then |
378 |
+ |
s = 0.0d0 |
379 |
+ |
dsdr = 0.0d0 |
380 |
+ |
else |
381 |
+ |
s = ((SSD_ru + 2.0d0*r - 3.0d0*SSD_rl) * (SSD_ru-r)**2) / & |
382 |
+ |
((SSD_ru - SSD_rl)**3) |
383 |
+ |
dsdr = 6.0d0*(r-SSD_ru)*(r-SSD_rl)/((SSD_ru - SSD_rl)**3) |
384 |
+ |
endif |
385 |
+ |
|
386 |
+ |
if (r.lt.SSD_rlp) then |
387 |
+ |
sp = 1.0d0 |
388 |
|
dspdr = 0.0d0 |
389 |
|
elseif (r.gt.SSD_rup) then |
354 |
– |
s = 0.0d0 |
390 |
|
sp = 0.0d0 |
356 |
– |
dsdr = 0.0d0 |
391 |
|
dspdr = 0.0d0 |
392 |
|
else |
393 |
< |
sp = ((SSD_rup + 2.0d0*r - 3.0d0*SSD_rl) * (SSD_rup-r)**2) / & |
394 |
< |
((SSD_rup - SSD_rl)**3) |
395 |
< |
dspdr = 6.0d0*(r-SSD_rup)*(r-SSD_rl)/((SSD_rup - SSD_rl)**3) |
362 |
< |
|
363 |
< |
if (r.gt.SSD_ru) then |
364 |
< |
s = 0.0d0 |
365 |
< |
dsdr = 0.0d0 |
366 |
< |
else |
367 |
< |
s = ((SSD_ru + 2.0d0*r - 3.0d0*SSD_rl) * (SSD_ru-r)**2) / & |
368 |
< |
((SSD_ru - SSD_rl)**3) |
369 |
< |
dsdr = 6.0d0*(r-SSD_ru)*(r-SSD_rl)/((SSD_ru - SSD_rl)**3) |
370 |
< |
endif |
393 |
> |
sp = ((SSD_rup + 2.0d0*r - 3.0d0*SSD_rlp) * (SSD_rup-r)**2) / & |
394 |
> |
((SSD_rup - SSD_rlp)**3) |
395 |
> |
dspdr = 6.0d0*(r-SSD_rup)*(r-SSD_rlp)/((SSD_rup - SSD_rlp)**3) |
396 |
|
endif |
397 |
|
|
398 |
|
return |