1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
|
module reaction_field |
43 |
|
use force_globals |
44 |
|
use definitions |
138 |
|
|
139 |
|
end subroutine createMomentMap |
140 |
|
|
141 |
< |
subroutine accumulate_rf(atom1, atom2, rij, u_l, taper) |
141 |
> |
subroutine accumulate_rf(atom1, atom2, rij, eFrame, taper) |
142 |
|
|
143 |
|
integer, intent(in) :: atom1, atom2 |
144 |
|
real (kind = dp), intent(in) :: rij |
145 |
< |
real (kind = dp), dimension(3,nLocal) :: u_l |
145 |
> |
real (kind = dp), dimension(9,nLocal) :: eFrame |
146 |
|
|
147 |
|
integer :: me1, me2 |
148 |
|
real (kind = dp), intent(in) :: taper |
169 |
|
|
170 |
|
#ifdef IS_MPI |
171 |
|
me1 = atid_Row(atom1) |
172 |
< |
ul1(1) = u_l_Row(1,atom1) |
173 |
< |
ul1(2) = u_l_Row(2,atom1) |
174 |
< |
ul1(3) = u_l_Row(3,atom1) |
172 |
> |
ul1(1) = eFrame_Row(3,atom1) |
173 |
> |
ul1(2) = eFrame_Row(6,atom1) |
174 |
> |
ul1(3) = eFrame_Row(9,atom1) |
175 |
|
|
176 |
|
me2 = atid_Col(atom2) |
177 |
< |
ul2(1) = u_l_Col(1,atom2) |
178 |
< |
ul2(2) = u_l_Col(2,atom2) |
179 |
< |
ul2(3) = u_l_Col(3,atom2) |
177 |
> |
ul2(1) = eFrame_Col(3,atom2) |
178 |
> |
ul2(2) = eFrame_Col(6,atom2) |
179 |
> |
ul2(3) = eFrame_Col(9,atom2) |
180 |
|
#else |
181 |
|
me1 = atid(atom1) |
182 |
< |
ul1(1) = u_l(1,atom1) |
183 |
< |
ul1(2) = u_l(2,atom1) |
184 |
< |
ul1(3) = u_l(3,atom1) |
182 |
> |
ul1(1) = eFrame(3,atom1) |
183 |
> |
ul1(2) = eFrame(6,atom1) |
184 |
> |
ul1(3) = eFrame(9,atom1) |
185 |
|
|
186 |
|
me2 = atid(atom2) |
187 |
< |
ul2(1) = u_l(1,atom2) |
188 |
< |
ul2(2) = u_l(2,atom2) |
189 |
< |
ul2(3) = u_l(3,atom2) |
187 |
> |
ul2(1) = eFrame(3,atom2) |
188 |
> |
ul2(2) = eFrame(6,atom2) |
189 |
> |
ul2(3) = eFrame(9,atom2) |
190 |
|
#endif |
191 |
|
|
192 |
|
mu1 = MomentMap(me1)%dipole_moment |
214 |
|
return |
215 |
|
end subroutine accumulate_rf |
216 |
|
|
217 |
< |
subroutine accumulate_self_rf(atom1, mu1, u_l) |
217 |
> |
subroutine accumulate_self_rf(atom1, mu1, eFrame) |
218 |
|
|
219 |
|
integer, intent(in) :: atom1 |
220 |
|
real(kind=dp), intent(in) :: mu1 |
221 |
< |
real(kind=dp), dimension(3,nLocal) :: u_l |
221 |
> |
real(kind=dp), dimension(9,nLocal) :: eFrame |
222 |
|
|
223 |
|
!! should work for both MPI and non-MPI version since this is not pairwise. |
224 |
< |
rf(1,atom1) = rf(1,atom1) + u_l(1,atom1)*mu1 |
225 |
< |
rf(2,atom1) = rf(2,atom1) + u_l(2,atom1)*mu1 |
226 |
< |
rf(3,atom1) = rf(3,atom1) + u_l(3,atom1)*mu1 |
224 |
> |
rf(1,atom1) = rf(1,atom1) + eFrame(3,atom1)*mu1 |
225 |
> |
rf(2,atom1) = rf(2,atom1) + eFrame(6,atom1)*mu1 |
226 |
> |
rf(3,atom1) = rf(3,atom1) + eFrame(9,atom1)*mu1 |
227 |
|
|
228 |
|
return |
229 |
|
end subroutine accumulate_self_rf |
230 |
|
|
231 |
< |
subroutine reaction_field_final(a1, mu1, u_l, rfpot, t, do_pot) |
231 |
> |
subroutine reaction_field_final(a1, mu1, eFrame, rfpot, t, do_pot) |
232 |
|
|
233 |
|
integer, intent(in) :: a1 |
234 |
|
real (kind=dp), intent(in) :: mu1 |
235 |
|
real (kind=dp), intent(inout) :: rfpot |
236 |
|
logical, intent(in) :: do_pot |
237 |
< |
real (kind = dp), dimension(3,nLocal) :: u_l |
237 |
> |
real (kind = dp), dimension(9,nLocal) :: eFrame |
238 |
|
real (kind = dp), dimension(3,nLocal) :: t |
239 |
|
|
240 |
|
integer :: localError |
258 |
|
|
259 |
|
! The torque contribution is dipole cross reaction_field |
260 |
|
|
261 |
< |
t(1,a1) = t(1,a1) + pre*mu1*(u_l(2,a1)*rf(3,a1) - u_l(3,a1)*rf(2,a1)) |
262 |
< |
t(2,a1) = t(2,a1) + pre*mu1*(u_l(3,a1)*rf(1,a1) - u_l(1,a1)*rf(3,a1)) |
263 |
< |
t(3,a1) = t(3,a1) + pre*mu1*(u_l(1,a1)*rf(2,a1) - u_l(2,a1)*rf(1,a1)) |
261 |
> |
t(1,a1) = t(1,a1) + pre*mu1*(eFrame(6,a1)*rf(3,a1) - eFrame(9,a1)*rf(2,a1)) |
262 |
> |
t(2,a1) = t(2,a1) + pre*mu1*(eFrame(9,a1)*rf(1,a1) - eFrame(3,a1)*rf(3,a1)) |
263 |
> |
t(3,a1) = t(3,a1) + pre*mu1*(eFrame(3,a1)*rf(2,a1) - eFrame(6,a1)*rf(1,a1)) |
264 |
|
|
265 |
|
! the potential contribution is -1/2 dipole dot reaction_field |
266 |
|
|
267 |
|
if (do_pot) then |
268 |
|
rfpot = rfpot - 0.5d0 * pre * mu1 * & |
269 |
< |
(rf(1,a1)*u_l(1,a1) + rf(2,a1)*u_l(2,a1) + rf(3,a1)*u_l(3,a1)) |
269 |
> |
(rf(1,a1)*eFrame(3,a1) + rf(2,a1)*eFrame(6,a1) + rf(3,a1)*eFrame(9,a1)) |
270 |
|
endif |
271 |
|
|
272 |
|
return |
273 |
|
end subroutine reaction_field_final |
274 |
|
|
275 |
< |
subroutine rf_correct_forces(atom1, atom2, d, rij, u_l, taper, f, fpair) |
275 |
> |
subroutine rf_correct_forces(atom1, atom2, d, rij, eFrame, taper, f, fpair) |
276 |
|
|
277 |
|
integer, intent(in) :: atom1, atom2 |
278 |
|
real(kind=dp), dimension(3), intent(in) :: d |
279 |
|
real(kind=dp), intent(in) :: rij, taper |
280 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
280 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
281 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
282 |
|
real( kind = dp ), dimension(3), intent(inout) :: fpair |
283 |
|
|
315 |
|
|
316 |
|
#ifdef IS_MPI |
317 |
|
me1 = atid_Row(atom1) |
318 |
< |
ul1(1) = u_l_Row(1,atom1) |
319 |
< |
ul1(2) = u_l_Row(2,atom1) |
320 |
< |
ul1(3) = u_l_Row(3,atom1) |
318 |
> |
ul1(1) = eFrame_Row(3,atom1) |
319 |
> |
ul1(2) = eFrame_Row(6,atom1) |
320 |
> |
ul1(3) = eFrame_Row(9,atom1) |
321 |
|
|
322 |
|
me2 = atid_Col(atom2) |
323 |
< |
ul2(1) = u_l_Col(1,atom2) |
324 |
< |
ul2(2) = u_l_Col(2,atom2) |
325 |
< |
ul2(3) = u_l_Col(3,atom2) |
323 |
> |
ul2(1) = eFrame_Col(3,atom2) |
324 |
> |
ul2(2) = eFrame_Col(6,atom2) |
325 |
> |
ul2(3) = eFrame_Col(9,atom2) |
326 |
|
#else |
327 |
|
me1 = atid(atom1) |
328 |
< |
ul1(1) = u_l(1,atom1) |
329 |
< |
ul1(2) = u_l(2,atom1) |
330 |
< |
ul1(3) = u_l(3,atom1) |
328 |
> |
ul1(1) = eFrame(3,atom1) |
329 |
> |
ul1(2) = eFrame(6,atom1) |
330 |
> |
ul1(3) = eFrame(9,atom1) |
331 |
|
|
332 |
|
me2 = atid(atom2) |
333 |
< |
ul2(1) = u_l(1,atom2) |
334 |
< |
ul2(2) = u_l(2,atom2) |
335 |
< |
ul2(3) = u_l(3,atom2) |
333 |
> |
ul2(1) = eFrame(3,atom2) |
334 |
> |
ul2(2) = eFrame(6,atom2) |
335 |
> |
ul2(3) = eFrame(9,atom2) |
336 |
|
#endif |
337 |
|
|
338 |
|
mu1 = MomentMap(me1)%dipole_moment |