ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/calc_reaction_field.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/calc_reaction_field.F90 (file contents):
Revision 621 by gezelter, Wed Jul 16 02:11:02 2003 UTC vs.
Revision 730 by gezelter, Wed Aug 27 16:25:11 2003 UTC

# Line 9 | Line 9 | module reaction_field
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  
# Line 171 | Line 190 | contains
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
# Line 238 | Line 257 | contains
257   #endif
258        
259         if (do_stress) then          
241          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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines