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

Comparing trunk/OOPSE/libmdtools/calc_dipole_dipole.F90 (file contents):
Revision 483 by gezelter, Wed Apr 9 04:06:43 2003 UTC vs.
Revision 626 by mmeineke, Wed Jul 16 21:30:56 2003 UTC

# Line 10 | Line 10 | module dipole_dipole
10   #endif
11    implicit none
12  
13 +  PRIVATE
14    real(kind=dp), save :: rrf = 0.0
15    real(kind=dp), save :: rt  = 0.0
16 <  real(kind=dp), save :: rrfsq = 0.0
16 <  real(kind=dp), save :: pre = 0.0
16 >   real(kind=dp), save :: pre = 0.0
17    logical, save :: dipole_initialized = .false.
18  
19 +
20 +  public::setCutoffsDipole
21 +  public::do_dipole_pair
22 +
23   contains
24      
25 <  subroutine initialize_dipole(this_rrf, this_rt)
25 >  subroutine setCutoffsDipole(this_rrf, this_rt)
26      real(kind=dp), intent(in) :: this_rrf, this_rt
27      rrf = this_rrf
28      rt = this_rt    
29 <    rrfsq = rrf * rrf
26 <    ! pre converts from mu in units of debye to kcal/mol
29 >     ! pre converts from mu in units of debye to kcal/mol
30      pre = 14.38362_dp
31  
32      dipole_initialized = .true.
33      
34      return
35 <  end subroutine initialize_dipole
35 >  end subroutine setCutoffsDipole
36  
34
37    subroutine do_dipole_pair(atom1, atom2, d, rij, r2, pot, u_l, f, t, &
38         do_pot, do_stress)
39      
# Line 80 | Line 82 | contains
82      ul2(3) = u_l(3,atom2)
83   #endif
84  
83    if( atom1 .eq. 2 )then
84       write (0,*) 'ul =', ul1(1), ul1(2), ul1(3)
85    endif
85  
87    if( atom2 .eq. 2 )then
88       write (0,*) 'ul =', ul2(1), ul2(2), ul2(3)
89    endif
90
91
86      call getElementProperty(atypes, me1, "dipole_moment", mu1)
87      call getElementProperty(atypes, me2, "dipole_moment", mu2)
88  
# Line 186 | Line 180 | contains
180  
181            if (molMembershipList(atom1) .ne. molMembershipList(atom2)) then
182  
183 <             tau_Temp(1) = tau_Temp(1) + dudx * d(1)
184 <             tau_Temp(2) = tau_Temp(2) + dudx * d(2)
185 <             tau_Temp(3) = tau_Temp(3) + dudx * d(3)
186 <             tau_Temp(4) = tau_Temp(4) + dudy * d(1)
187 <             tau_Temp(5) = tau_Temp(5) + dudy * d(2)
188 <             tau_Temp(6) = tau_Temp(6) + dudy * d(3)
189 <             tau_Temp(7) = tau_Temp(7) + dudz * d(1)
190 <             tau_Temp(8) = tau_Temp(8) + dudz * d(2)
191 <             tau_Temp(9) = tau_Temp(9) + dudz * d(3)
183 >             ! because the d vector is the rj - ri vector, and
184 >             ! because dudx, dudy, dudz are the (positive) force on
185 >             ! atom i (negative on atom j) we need a negative sign here:
186 >
187 >             tau_Temp(1) = tau_Temp(1) - d(1) * dudx
188 >             tau_Temp(2) = tau_Temp(2) - d(1) * dudy
189 >             tau_Temp(3) = tau_Temp(3) - d(1) * dudz
190 >             tau_Temp(4) = tau_Temp(4) - d(2) * dudx
191 >             tau_Temp(5) = tau_Temp(5) - d(2) * dudy
192 >             tau_Temp(6) = tau_Temp(6) - d(2) * dudz
193 >             tau_Temp(7) = tau_Temp(7) - d(3) * dudx
194 >             tau_Temp(8) = tau_Temp(8) - d(3) * dudy
195 >             tau_Temp(9) = tau_Temp(9) - d(3) * dudz
196 >
197               virial_Temp = virial_Temp + &
198                    (tau_Temp(1) + tau_Temp(5) + tau_Temp(9))
199  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines