ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE_old/src/mdtools/libmdCode/do_Forces.F90
(Generate patch)

Comparing trunk/OOPSE_old/src/mdtools/libmdCode/do_Forces.F90 (file contents):
Revision 298 by chuckv, Fri Mar 7 18:26:30 2003 UTC vs.
Revision 306 by chuckv, Mon Mar 10 19:26:45 2003 UTC

# Line 1 | Line 1
1 + !! do_Forces.F90
2 + !! module do_Forces
3   !! Calculates Long Range forces.
4 +
5   !! @author Charles F. Vardeman II
6   !! @author Matthew Meineke
7 < !! @version $Id: do_Forces.F90,v 1.5 2003-03-07 18:26:30 chuckv Exp $, $Date: 2003-03-07 18:26:30 $, $Name: not supported by cvs2svn $, $Revision: 1.5 $
7 > !! @version $Id: do_Forces.F90,v 1.8 2003-03-10 19:26:45 chuckv Exp $, $Date: 2003-03-10 19:26:45 $, $Name: not supported by cvs2svn $, $Revision: 1.8 $
8  
9  
10  
# Line 28 | Line 31 | contains
31  
32   contains
33  
34 < !! FORCE routine Calculates Lennard Jones forces.
34 > !! Does force loop over i,j pairs. Calls do_pair to calculates forces.
35   !------------------------------------------------------------->
36    subroutine do_force_loop(q,A,mu,u_l,f,t,tau,potE,do_pot,FFerror)
37   !! Position array provided by C, dimensioned by getNlocal
# Line 83 | Line 86 | contains
86    real( kind = DP ) ::  rx_ij, ry_ij, rz_ij, rijsq
87    real( kind = DP ) ::  rlistsq, rcutsq,rlist,rcut
88  
89 <  real( kind = DP ) :: dielectric = 0.0_dp
89 >  
90  
91   ! a rig that need to be fixed.
92   #ifdef IS_MPI
# Line 462 | Line 465 | contains
465      real( kind = dp ) ::  drdz = 0.0_dp
466      
467  
468 + #ifdef IS_MPI
469 +
470      if (Atype_i%is_LJ .and. Atype_j%is_LJ) then
471         call getLJForce(r,pot,dudr,ljAtype_i,ljAtype_j,fx,fy,fz)
472      endif
473  
474      if (Atype_i%is_dp .and. Atype_j%is_dp) then
475  
471 #ifdef IS_MPI
476         call dipole_dipole(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
477              ulRow(:,i), ulCol(:,j), rt, rrf, pot)
474 #else
475       call dipole_dipole(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
476            ul(:,i), ul(:,j), rt, rrf, pot)
477 #endif
478  
479         if (do_reaction_field) then
480 #ifdef IS_MPI
480            call accumulate_rf(i, j, r_ij, rflRow(:,i), rflCol(:j), &
481                 ulRow(:i), ulCol(:,j), rt, rrf)
482 +       endif
483 +
484 +    endif
485 +
486 +    if (Atype_i%is_sticky .and. Atype_j%is_sticky) then
487 +       call getstickyforce(r, pot, dudr, Atype_i, Atype_j)
488 +    endif
489 +
490   #else
491 +
492 +    if (Atype_i%is_LJ .and. Atype_j%is_LJ) then
493 +       call getLJForce(r,pot,dudr,ljAtype_i,ljAtype_j,fx,fy,fz)
494 +    endif
495 +
496 +    if (Atype_i%is_dp .and. Atype_j%is_dp) then
497 +       call dipole_dipole(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
498 +            ul(:,i), ul(:,j), rt, rrf, pot)
499 +
500 +       if (do_reaction_field) then
501            call accumulate_rf(i, j, r_ij, rfl(:,i), rfl(:j), &
502                 ul(:,i), ul(:,j), rt, rrf)
486 #endif
503         endif
504  
489
505      endif
506  
507      if (Atype_i%is_sticky .and. Atype_j%is_sticky) then
508 <       call getstickyforce(r,pot,dudr,ljAtype_i,ljAtype_j)
508 >       call getstickyforce(r,pot,dudr, Atype_i, Atype_j)
509      endif
510  
511 + #endif
512 +
513        
514   #ifdef IS_MPI
515                  eRow(i) = eRow(i) + pot*0.5
# Line 508 | Line 525 | contains
525                  fx = dudr * drdx
526                  fy = dudr * drdy
527                  fz = dudr * drdz
511
512
513
514
515
516
528                  
529   #ifdef IS_MPI
530                  fCol(1,j) = fCol(1,j) - fx
# Line 647 | Line 658 | contains
658  
659    end subroutine zero_module_variables
660  
661 < #ifdef IS_MPI
661 >
662   !! Function to properly build neighbor lists in MPI using newtons 3rd law.
663   !! We don't want 2 processors doing the same i j pair twice.
664   !! Also checks to see if i and j are the same particle.
665 <  function mpi_cycle_jLoop(i,j) result(do_cycle)
665 >  function checkExcludes(atom1,atom2) result(do_cycle)
666   !--------------- Arguments--------------------------
667   ! Index i
668 <    integer,intent(in) :: i
668 >    integer,intent(in) :: atom1
669   ! Index j
670 <    integer,intent(in) :: j
670 >    integer,intent(in), optional :: atom2
671   ! Result do_cycle
672      logical :: do_cycle
673   !--------------- Local variables--------------------
674      integer :: tag_i
675      integer :: tag_j
676 < !--------------- END DECLARATIONS------------------    
677 <    tag_i = tagRow(i)
676 >    integer :: i
677 > !--------------- END DECLARATIONS------------------  
678 >    do_cycle = .false.
679 >
680 > #ifdef IS_MPI
681 >    tag_i = tagRow(atom1)
682 > #else
683 >    tag_i = tag(atom1)
684 > #endif
685 >
686 > !! Check global excludes first
687 >    if (.not. present(atom2)) then
688 >       do i = 1,nGlobalExcludes
689 >          if (excludeGlobal(i) == tag_i) then
690 >             do_cycle = .true.
691 >             return
692 >          end if
693 >       end do
694 >       return !! return after checking globals
695 >    end if
696 >
697 > !! we return if j not present here.
698      tag_j = tagColumn(j)
699  
700 <    do_cycle = .false.
700 >
701  
702      if (tag_i == tag_j) then
703         do_cycle = .true.
# Line 679 | Line 710 | contains
710      else                
711         if (mod(tag_i + tag_j,2) == 1) do_cycle = .true.
712      endif
682  end function mpi_cycle_jLoop
683 #endif
713  
714 +
715 +
716 +    do i = 1, nLocalExcludes
717 +       if (tag_i = excludes(1,i) .and. excludes(2,i) < 0) then
718 +          do_cycle = .true.
719 +          return
720 +       end if
721 +    end do
722 +      
723 +
724 +  end function checkExcludes
725 +
726 +
727   end module do_Forces

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines