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

Comparing trunk/OOPSE/libmdtools/calc_sticky_pair.F90 (file contents):
Revision 843 by mmeineke, Wed Oct 29 20:41:39 2003 UTC vs.
Revision 1198 by tim, Thu May 27 00:48:12 2004 UTC

# Line 9 | Line 9
9   !! @author Matthew Meineke
10   !! @author Christopher Fennel
11   !! @author J. Daniel Gezelter
12 < !! @version $Id: calc_sticky_pair.F90,v 1.15 2003-10-29 20:41:38 mmeineke Exp $, $Date: 2003-10-29 20:41:38 $, $Name: not supported by cvs2svn $, $Revision: 1.15 $
12 > !! @version $Id: calc_sticky_pair.F90,v 1.20 2004-05-27 00:48:12 tim Exp $, $Date: 2004-05-27 00:48:12 $, $Name: not supported by cvs2svn $, $Revision: 1.20 $
13  
14   module sticky_pair
15  
# Line 74 | Line 74 | contains
74      return
75    end subroutine set_sticky_params
76  
77 <  subroutine do_sticky_pair(atom1, atom2, d, rij, r2, A, pot, f, t, &
78 <       do_pot, do_stress)
79 <
77 >  subroutine do_sticky_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, &
78 >       pot, A, f, t, do_pot)
79 >    
80      !! This routine does only the sticky portion of the SSD potential
81      !! [Chandra and Ichiye, J. Chem. Phys. 111, 2701 (1999)].
82      !! The Lennard-Jones and dipolar interaction must be handled separately.
83 <
83 >    
84      !! We assume that the rotation matrices have already been calculated
85      !! and placed in the A array.
86  
# Line 89 | Line 89 | contains
89      integer, intent(in) :: atom1, atom2
90      real (kind=dp), intent(inout) :: rij, r2
91      real (kind=dp), dimension(3), intent(in) :: d
92 <    real (kind=dp) :: pot
93 <    real (kind=dp), dimension(9,getNlocal()) :: A
94 <    real (kind=dp), dimension(3,getNlocal()) :: f
95 <    real (kind=dp), dimension(3,getNlocal()) :: t
96 <    logical, intent(in) :: do_pot, do_stress
92 >    real (kind=dp), dimension(3), intent(inout) :: fpair
93 >    real (kind=dp) :: pot, vpair, sw
94 >    real (kind=dp), dimension(9,nLocal) :: A
95 >    real (kind=dp), dimension(3,nLocal) :: f
96 >    real (kind=dp), dimension(3,nLocal) :: t
97 >    logical, intent(in) :: do_pot
98  
99      real (kind=dp) :: xi, yi, zi, xj, yj, zj, xi2, yi2, zi2, xj2, yj2, zj2
100      real (kind=dp) :: r3, r5, r6, s, sp, dsdr, dspdr
# Line 180 | Line 181 | contains
181         wjp = zjf*zjf*zjs*zjs - SSD_w0
182         wp = wip + wjp
183  
184 +       vpair = vpair + 0.5d0*(SSD_v0*s*w + SSD_v0p*sp*wp)
185         if (do_pot) then
186   #ifdef IS_MPI
187 <          pot_row(atom1) = pot_row(atom1) + 0.25d0*(SSD_v0*s*w + SSD_v0p*sp*wp)
188 <          pot_col(atom2) = pot_col(atom2) + 0.25d0*(SSD_v0*s*w + SSD_v0p*sp*wp)
187 >          pot_row(atom1) = pot_row(atom1) + 0.25d0*(SSD_v0*s*w + SSD_v0p*sp*wp)*sw
188 >          pot_col(atom2) = pot_col(atom2) + 0.25d0*(SSD_v0*s*w + SSD_v0p*sp*wp)*sw
189   #else
190 <          pot = pot + 0.5d0*(SSD_v0*s*w + SSD_v0p*sp*wp)
190 >          pot = pot + 0.5d0*(SSD_v0*s*w + SSD_v0p*sp*wp)*sw
191   #endif  
192         endif
193  
# Line 227 | Line 229 | contains
229         ! do the torques first since they are easy:
230         ! remember that these are still in the body fixed axes
231  
232 <       txi = 0.5d0*(SSD_v0*s*dwidux + SSD_v0p*sp*dwipdux)
233 <       tyi = 0.5d0*(SSD_v0*s*dwiduy + SSD_v0p*sp*dwipduy)
234 <       tzi = 0.5d0*(SSD_v0*s*dwiduz + SSD_v0p*sp*dwipduz)
232 >       txi = 0.5d0*(SSD_v0*s*dwidux + SSD_v0p*sp*dwipdux)*sw
233 >       tyi = 0.5d0*(SSD_v0*s*dwiduy + SSD_v0p*sp*dwipduy)*sw
234 >       tzi = 0.5d0*(SSD_v0*s*dwiduz + SSD_v0p*sp*dwipduz)*sw
235  
236 <       txj = 0.5d0*(SSD_v0*s*dwjdux + SSD_v0p*sp*dwjpdux)
237 <       tyj = 0.5d0*(SSD_v0*s*dwjduy + SSD_v0p*sp*dwjpduy)
238 <       tzj = 0.5d0*(SSD_v0*s*dwjduz + SSD_v0p*sp*dwjpduz)
236 >       txj = 0.5d0*(SSD_v0*s*dwjdux + SSD_v0p*sp*dwjpdux)*sw
237 >       tyj = 0.5d0*(SSD_v0*s*dwjduy + SSD_v0p*sp*dwjpduy)*sw
238 >       tzj = 0.5d0*(SSD_v0*s*dwjduz + SSD_v0p*sp*dwjpduz)*sw
239  
240         ! go back to lab frame using transpose of rotation matrix:
241  
# Line 264 | Line 266 | contains
266  
267         ! first rotate the i terms back into the lab frame:
268  
269 <       radcomxi = SSD_v0*s*dwidx+SSD_v0p*sp*dwipdx
270 <       radcomyi = SSD_v0*s*dwidy+SSD_v0p*sp*dwipdy
271 <       radcomzi = SSD_v0*s*dwidz+SSD_v0p*sp*dwipdz
269 >       radcomxi = (SSD_v0*s*dwidx+SSD_v0p*sp*dwipdx)*sw
270 >       radcomyi = (SSD_v0*s*dwidy+SSD_v0p*sp*dwipdy)*sw
271 >       radcomzi = (SSD_v0*s*dwidz+SSD_v0p*sp*dwipdz)*sw
272  
273 <       radcomxj = SSD_v0*s*dwjdx+SSD_v0p*sp*dwjpdx
274 <       radcomyj = SSD_v0*s*dwjdy+SSD_v0p*sp*dwjpdy
275 <       radcomzj = SSD_v0*s*dwjdz+SSD_v0p*sp*dwjpdz
273 >       radcomxj = (SSD_v0*s*dwjdx+SSD_v0p*sp*dwjpdx)*sw
274 >       radcomyj = (SSD_v0*s*dwjdy+SSD_v0p*sp*dwjpdy)*sw
275 >       radcomzj = (SSD_v0*s*dwjdz+SSD_v0p*sp*dwjpdz)*sw
276  
277   #ifdef IS_MPI    
278         fxii = a_Row(1,atom1)*(radcomxi) + &
# Line 346 | Line 348 | contains
348         f(3,atom2) = f(3,atom2) - fzradial
349   #endif
350  
349       if (do_stress) then          
350
351   #ifdef IS_MPI
352 <          id1 = tagRow(atom1)
353 <          id2 = tagColumn(atom2)
352 >       id1 = AtomRowToGlobal(atom1)
353 >       id2 = AtomColToGlobal(atom2)
354   #else
355 <          id1 = atom1
356 <          id2 = atom2
355 >       id1 = atom1
356 >       id2 = atom2
357   #endif
358 <
359 <          if (molMembershipList(id1) .ne. molMembershipList(id2)) then
360 <
361 <             ! because the d vector is the rj - ri vector, and
362 <             ! because fxradial, fyradial, and fzradial are the
363 <             ! (positive) force on atom i (negative on atom j) we need
364 <             ! a negative sign here:
365 <
366 <             tau_Temp(1) = tau_Temp(1) - d(1) * fxradial
367 <             tau_Temp(2) = tau_Temp(2) - d(1) * fyradial
368 <             tau_Temp(3) = tau_Temp(3) - d(1) * fzradial
369 <             tau_Temp(4) = tau_Temp(4) - d(2) * fxradial
370 <             tau_Temp(5) = tau_Temp(5) - d(2) * fyradial
371 <             tau_Temp(6) = tau_Temp(6) - d(2) * fzradial
372 <             tau_Temp(7) = tau_Temp(7) - d(3) * fxradial
373 <             tau_Temp(8) = tau_Temp(8) - d(3) * fyradial
374 <             tau_Temp(9) = tau_Temp(9) - d(3) * fzradial
375 <
376 <             virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9))
377 <          endif
358 >      
359 >       if (molMembershipList(id1) .ne. molMembershipList(id2)) then
360 >          
361 >          fpair(1) = fpair(1) + fxradial
362 >          fpair(2) = fpair(2) + fyradial
363 >          fpair(3) = fpair(3) + fzradial
364 >          
365         endif
366      endif
380
367    end subroutine do_sticky_pair
368  
369    !! calculates the switching functions and their derivatives for a given

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines