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 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 439 by chuckv, Mon Mar 31 22:09:39 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.1.1.1 2003-03-21 17:42:12 mmeineke Exp $, $Date: 2003-03-21 17:42:12 $, $Name: not supported by cvs2svn $, $Revision: 1.1.1.1 $
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 $
8  
9   module do_Forces
10    use force_globals
# Line 167 | Line 167 | contains
167      logical ( kind = 2) :: do_pot_c, do_stress_c
168      logical :: do_pot
169      logical :: do_stress
170 < #ifdef IS_MPI
171 <    real( kind = DP ) :: pot_local
170 > #ifdef IS_MPI
171 >    real( kind = DP ) :: pot_local = 0.0_dp
172      integer :: nrow
173      integer :: ncol
174   #endif
# Line 323 | Line 323 | contains
323            
324            inner: do j = i+1, natoms
325              
326 <             if (skipThisPair(i,j)) cycle inner
327 <            
326 >             if (skipThisPair(i,j))  cycle inner
327 >                          
328               call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
329            
330 +
331               if (rijsq <  rlistsq) then
332                  
333                  nlist = nlist + 1
# Line 380 | Line 381 | contains
381      
382   #ifdef IS_MPI
383      !!distribute forces
384 <    
385 <    call scatter(f_Row,f,plan_row3d)
384 >  
385 >    f_temp = 0.0_dp
386 >    call scatter(f_Row,f_temp,plan_row3d)
387 >    do i = 1,nlocal
388 >       f(1:3,i) = f(1:3,i) + f_temp(1:3,i)
389 >    end do
390 >
391 >    f_temp = 0.0_dp
392      call scatter(f_Col,f_temp,plan_col3d)
393      do i = 1,nlocal
394         f(1:3,i) = f(1:3,i) + f_temp(1:3,i)
395      end do
396      
397      if (FF_UsesDirectionalAtoms() .and. SimUsesDirectionalAtoms()) then
398 <       call scatter(t_Row,t,plan_row3d)
398 >       t_temp = 0.0_dp
399 >       call scatter(t_Row,t_temp,plan_row3d)
400 >       do i = 1,nlocal
401 >          t(1:3,i) = t(1:3,i) + t_temp(1:3,i)
402 >       end do
403 >       t_temp = 0.0_dp
404         call scatter(t_Col,t_temp,plan_col3d)
405        
406         do i = 1,nlocal
# Line 399 | Line 411 | contains
411      if (do_pot) then
412         ! scatter/gather pot_row into the members of my column
413         call scatter(pot_Row, pot_Temp, plan_row)
414 <      
414 >
415         ! scatter/gather pot_local into all other procs
416         ! add resultant to get total pot
417         do i = 1, nlocal
418            pot_local = pot_local + pot_Temp(i)
419         enddo
420 +      
421 +       pot_Temp = 0.0_DP
422  
409       pot_Temp = 0.0_DP
410
423         call scatter(pot_Col, pot_Temp, plan_col)
424         do i = 1, nlocal
425            pot_local = pot_local + pot_Temp(i)
426         enddo
427 <      
427 >
428      endif    
429   #endif
430  
# Line 532 | Line 544 | contains
544            
545            call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, &
546                 do_pot, do_stress)
535          
547            if (FF_uses_RF .and. SimUsesRF()) then
537            
548               call accumulate_rf(i, j, r, u_l)
549               call rf_correct_forces(i, j, d, r, u_l, f, do_stress)
540            
550            endif
551            
552         endif
# Line 547 | Line 556 | contains
556  
557         call getElementProperty(atypes, me_i, "is_Sticky", is_Sticky_i)
558         call getElementProperty(atypes, me_j, "is_Sticky", is_Sticky_j)
559 <      
559 >
560         if ( is_Sticky_i .and. is_Sticky_j ) then
561            call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t, &
562                 do_pot, do_stress)
# Line 580 | Line 589 | contains
589      d_old = d
590      ! Wrap back into periodic box if necessary
591      if ( SimUsesPBC() ) then
592 <
592 >      
593         d(1:3) = d(1:3) - box(1:3) * sign(1.0_dp,d(1:3)) * &
594              int(abs(d(1:3)/box(1:3)) + 0.5_dp)
595 <
595 >      
596      endif
597      r_sq = dot_product(d,d)
598          
# Line 649 | Line 658 | contains
658    end subroutine zero_work_arrays
659    
660    function skipThisPair(atom1, atom2) result(skip_it)
652    
661      integer, intent(in) :: atom1
662      integer, intent(in), optional :: atom2
663      logical :: skip_it
664      integer :: unique_id_1, unique_id_2
665 +    integer :: me_i,me_j
666      integer :: i
667  
668      skip_it = .false.
# Line 671 | Line 680 | contains
680      !! in the normal loop, the atom numbers are unique
681      unique_id_1 = atom1
682   #endif
683 <    
683 >
684      !! We were called with only one atom, so just check the global exclude
685      !! list for this atom
686      if (.not. present(atom2)) then
# Line 715 | Line 724 | contains
724            return
725         endif
726      enddo
727 <  
727 >
728      do i = 1, nExcludes_local
729         if (excludesLocal(1,i) == unique_id_1) then
730            if (excludesLocal(2,i) == unique_id_2) then

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines