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

Comparing trunk/OOPSE/libmdtools/do_Forces.F90 (file contents):
Revision 439 by chuckv, Mon Mar 31 22:09:39 2003 UTC vs.
Revision 441 by chuckv, Tue Apr 1 16:50:14 2003 UTC

# Line 4 | Line 4
4  
5   !! @author Charles F. Vardeman II
6   !! @author Matthew Meineke
7 < !! @version $Id: do_Forces.F90,v 1.6 2003-03-31 22:09:39 chuckv Exp $, $Date: 2003-03-31 22:09:39 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $
7 > !! @version $Id: do_Forces.F90,v 1.7 2003-04-01 16:50:14 chuckv Exp $, $Date: 2003-04-01 16:50:14 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $
8  
9   module do_Forces
10    use force_globals
# Line 168 | Line 168 | contains
168      logical :: do_pot
169      logical :: do_stress
170   #ifdef IS_MPI
171 <    real( kind = DP ) :: pot_local = 0.0_dp
171 >    real( kind = DP ) :: pot_local
172      integer :: nrow
173      integer :: ncol
174   #endif
# Line 189 | Line 189 | contains
189      !! initialize local variables  
190  
191   #ifdef IS_MPI
192 +    pot_local = 0.0_dp
193      nlocal = getNlocal()
194      nrow   = getNrow(plan_row)
195      ncol   = getNcol(plan_col)
# Line 196 | Line 197 | contains
197      nlocal = getNlocal()
198      natoms = nlocal
199   #endif
200 <
200 >  
201      call getRcut(rcut,rc2=rcutsq)
202      call getRlist(rlist,rlistsq)
203      
# Line 277 | Line 278 | contains
278                                  
279                  if (rijsq <  rcutsq) then
280                     call do_pair(i, j, rijsq, d, do_pot, do_stress, &
281 <                        u_l, A, f, t,pot)
281 >                        u_l, A, f, t, pot_local)
282                  endif
283               endif
284            enddo inner
# Line 299 | Line 300 | contains
300  
301                  call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq)
302                  call do_pair(i, j, rijsq, d, do_pot, do_stress, &
303 <                     u_l, A, f, t,pot)
303 >                     u_l, A, f, t, pot_local)
304  
305               enddo
306            endif
# Line 346 | Line 347 | contains
347                  
348                  if (rijsq <  rcutsq) then
349                     call do_pair(i, j, rijsq, d, do_pot, do_stress, &
350 <                        u_l, A, f, t,pot)
350 >                        u_l, A, f, t, pot)
351                  endif
352               endif
353            enddo inner
# Line 368 | Line 369 | contains
369  
370                  call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
371                  call do_pair(i, j, rijsq, d, do_pot, do_stress, &
372 <                     u_l, A, f, t,pot)
372 >                     u_l, A, f, t, pot)
373  
374               enddo
375            endif
# Line 472 | Line 473 | contains
473   #ifdef IS_MPI
474  
475      if (do_pot) then
476 <       pot = pot_local
476 >       pot = pot + pot_local
477         !! we assume the c code will do the allreduce to get the total potential
478         !! we could do it right here if we needed to...
479      endif
# Line 495 | Line 496 | contains
496      
497    end subroutine do_force_loop
498  
499 <  subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t,pot)
499 >  subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot)
500  
501      real( kind = dp ) :: pot
502      real( kind = dp ), dimension(:,:) :: u_l
# Line 698 | Line 699 | contains
699   #else
700      unique_id_2 = atom2
701   #endif
702 <    
702 >
703   #ifdef IS_MPI
704      !! this situation should only arise in MPI simulations
705      if (unique_id_1 == unique_id_2) then
# Line 708 | Line 709 | contains
709      
710      !! this prevents us from doing the pair on multiple processors
711      if (unique_id_1 < unique_id_2) then
712 <       if (mod(unique_id_1 + unique_id_2,2) == 0) skip_it = .true.
713 <       return
712 >       if (mod(unique_id_1 + unique_id_2,2) == 0) then
713 >          skip_it = .true.
714 >          return
715 >       endif
716      else                
717 <       if (mod(unique_id_1 + unique_id_2,2) == 1) skip_it = .true.
718 <       return
717 >       if (mod(unique_id_1 + unique_id_2,2) == 1) then
718 >          skip_it = .true.
719 >          return
720 >       endif
721      endif
722   #endif
723 <
723 >
724      !! the rest of these situations can happen in all simulations:
725      do i = 1, nExcludes_global      
726         if ((excludesGlobal(i) == unique_id_1) .or. &
# Line 724 | Line 729 | contains
729            return
730         endif
731      enddo
732 <
732 >
733      do i = 1, nExcludes_local
734         if (excludesLocal(1,i) == unique_id_1) then
735            if (excludesLocal(2,i) == unique_id_2) then

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines