9 |
|
#endif |
10 |
|
implicit none |
11 |
|
|
12 |
< |
real(kind=dp), save :: rrf |
12 |
> |
PRIVATE |
13 |
> |
|
14 |
> |
real(kind=dp), save :: rrf = 1.0_dp |
15 |
|
real(kind=dp), save :: rt |
16 |
< |
real(kind=dp), save :: dielect |
17 |
< |
real(kind=dp), save :: rrfsq |
16 |
> |
real(kind=dp), save :: dielect = 1.0_dp |
17 |
> |
real(kind=dp), save :: rrfsq = 1.0_dp |
18 |
|
real(kind=dp), save :: pre |
19 |
< |
logical, save :: rf_initialized = .false. |
19 |
> |
logical, save :: rf_initialized = .false., haveCuts = .false. |
20 |
> |
logical, save :: haveDie = .false. |
21 |
|
|
22 |
+ |
PUBLIC::initialize_rf |
23 |
+ |
PUBLIC::setCutoffsRF |
24 |
+ |
PUBLIC::accumulate_rf |
25 |
+ |
PUBLIC::accumulate_self_rf |
26 |
+ |
PUBLIC::reaction_field_final |
27 |
+ |
PUBLIC::rf_correct_forces |
28 |
+ |
|
29 |
|
contains |
30 |
|
|
31 |
< |
subroutine initialize_rf(this_rrf, this_rt, this_dielect) |
32 |
< |
real(kind=dp), intent(in) :: this_rrf, this_rt, this_dielect |
33 |
< |
|
24 |
< |
rrf = this_rrf |
25 |
< |
rt = this_rt |
31 |
> |
subroutine initialize_rf(this_dielect) |
32 |
> |
real(kind=dp), intent(in) :: this_dielect |
33 |
> |
|
34 |
|
dielect = this_dielect |
35 |
+ |
|
36 |
+ |
pre = 14.38362d0*2.0d0*(dielect-1.0d0)/((2.0d0*dielect+1.0d0)*rrfsq*rrf) |
37 |
|
|
38 |
+ |
haveDie = .true. |
39 |
+ |
if (haveCuts) rf_initialized = .true. |
40 |
+ |
|
41 |
+ |
return |
42 |
+ |
end subroutine initialize_rf |
43 |
+ |
|
44 |
+ |
subroutine setCutoffsRF( this_rrf, this_rt ) |
45 |
+ |
|
46 |
+ |
real(kind=dp), intent(in) :: this_rrf, this_rt |
47 |
+ |
|
48 |
+ |
rrf = this_rrf |
49 |
+ |
rt = this_rt |
50 |
+ |
|
51 |
|
rrfsq = rrf * rrf |
52 |
|
pre = 14.38362d0*2.0d0*(dielect-1.0d0)/((2.0d0*dielect+1.0d0)*rrfsq*rrf) |
53 |
|
|
54 |
+ |
haveCuts = .true. |
55 |
+ |
if (haveDie) rf_initialized = .true. |
56 |
|
|
57 |
< |
write(*,*) 'rrf = ', rrf |
58 |
< |
write(*,*) 'rt = ', rt |
34 |
< |
write(*,*) 'dielect = ', dielect |
35 |
< |
write(*,*) 'pre = ', pre |
36 |
< |
rf_initialized = .true. |
37 |
< |
|
38 |
< |
return |
39 |
< |
end subroutine initialize_rf |
57 |
> |
end subroutine setCutoffsRF |
58 |
> |
|
59 |
|
|
60 |
|
subroutine accumulate_rf(atom1, atom2, rij, u_l) |
61 |
|
|
78 |
|
if (rij.lt.rt) then |
79 |
|
taper = 1.0d0 |
80 |
|
else |
81 |
+ |
write(*,*) 'rf in taper region' |
82 |
|
taper = (rrf + 2.0d0*rij - 3.0d0*rt)*(rrf-rij)**2/ ((rrf-rt)**3) |
83 |
|
endif |
84 |
|
|
190 |
|
real (kind = dp), dimension(3) :: ul2 |
191 |
|
real (kind = dp) :: dtdr |
192 |
|
real (kind = dp) :: dudx, dudy, dudz, u1dotu2 |
193 |
< |
integer :: me1, me2 |
193 |
> |
integer :: me1, me2, id1, id2 |
194 |
|
real (kind = dp) :: mu1, mu2 |
195 |
|
|
196 |
|
if (.not.rf_initialized) then |
203 |
|
if (rij.lt.rt) then |
204 |
|
dtdr = 0.0d0 |
205 |
|
else |
206 |
+ |
write(*,*) 'rf correct in taper region' |
207 |
|
dtdr = 6.0d0*(rij*rij - rij*rt - rij*rrf +rrf*rt)/((rrf-rt)**3) |
208 |
|
endif |
209 |
|
|
257 |
|
#endif |
258 |
|
|
259 |
|
if (do_stress) then |
239 |
– |
if (molMembershipList(atom1) .ne. molMembershipList(atom2)) then |
260 |
|
|
261 |
+ |
#ifdef IS_MPI |
262 |
+ |
id1 = tagRow(atom1) |
263 |
+ |
id2 = tagColumn(atom2) |
264 |
+ |
#else |
265 |
+ |
id1 = atom1 |
266 |
+ |
id2 = atom2 |
267 |
+ |
#endif |
268 |
+ |
|
269 |
+ |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
270 |
+ |
|
271 |
|
! because the d vector is the rj - ri vector, and |
272 |
|
! because dudx, dudy, and dudz are the |
273 |
|
! (positive) force on atom i (negative on atom j) we need |