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