61 |
|
|
62 |
|
end subroutine createChargeMap |
63 |
|
|
64 |
< |
subroutine do_charge_pair(atom1, atom2, d, rij, r2, sw, vpair, & |
65 |
< |
pot, f, do_pot, do_stress) |
64 |
> |
subroutine do_charge_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
65 |
> |
pot, f, do_pot) |
66 |
|
|
67 |
< |
logical :: do_pot, do_stress |
67 |
> |
logical :: do_pot |
68 |
|
|
69 |
|
integer atom1, atom2, me1, me2, id1, id2 |
70 |
|
integer :: localError |
73 |
|
real(kind=dp) :: vterm |
74 |
|
|
75 |
|
real( kind = dp ) :: pot |
76 |
< |
real( kind = dp ), dimension(3) :: d |
76 |
> |
real( kind = dp ), dimension(3) :: d, fpair |
77 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
78 |
|
|
79 |
|
if (.not.haveChargeMap) then |
137 |
|
f(3,atom2) = f(3,atom2) - fz |
138 |
|
|
139 |
|
#endif |
140 |
< |
|
141 |
< |
if (do_stress) then |
142 |
< |
|
140 |
> |
|
141 |
|
#ifdef IS_MPI |
142 |
< |
id1 = tagRow(atom1) |
143 |
< |
id2 = tagColumn(atom2) |
142 |
> |
id1 = tagRow(atom1) |
143 |
> |
id2 = tagColumn(atom2) |
144 |
|
#else |
145 |
< |
id1 = atom1 |
146 |
< |
id2 = atom2 |
145 |
> |
id1 = atom1 |
146 |
> |
id2 = atom2 |
147 |
|
#endif |
148 |
+ |
|
149 |
+ |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
150 |
|
|
151 |
+ |
fpair(1) = fpair(1) + fx |
152 |
+ |
fpair(2) = fpair(2) + fy |
153 |
+ |
fpair(3) = fpair(3) + fz |
154 |
|
|
152 |
– |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
153 |
– |
|
154 |
– |
! because the d vector is the rj - ri vector, and |
155 |
– |
! because fx, fy, fz are the force on atom i, we need a |
156 |
– |
! negative sign here: |
157 |
– |
|
158 |
– |
tau_Temp(1) = tau_Temp(1) - d(1) * fx |
159 |
– |
tau_Temp(2) = tau_Temp(2) - d(1) * fy |
160 |
– |
tau_Temp(3) = tau_Temp(3) - d(1) * fz |
161 |
– |
tau_Temp(4) = tau_Temp(4) - d(2) * fx |
162 |
– |
tau_Temp(5) = tau_Temp(5) - d(2) * fy |
163 |
– |
tau_Temp(6) = tau_Temp(6) - d(2) * fz |
164 |
– |
tau_Temp(8) = tau_Temp(8) - d(3) * fy |
165 |
– |
tau_Temp(9) = tau_Temp(9) - d(3) * fz |
166 |
– |
|
167 |
– |
|
168 |
– |
virial_Temp = virial_Temp + & |
169 |
– |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
170 |
– |
|
171 |
– |
endif |
155 |
|
endif |
173 |
– |
|
174 |
– |
|
156 |
|
return |
157 |
|
end subroutine do_charge_pair |
158 |
|
|