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 323 by gezelter, Wed Mar 12 15:39:01 2003 UTC vs.
Revision 325 by gezelter, Wed Mar 12 19:10:54 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.12 2003-03-12 15:39:01 gezelter Exp $, $Date: 2003-03-12 15:39:01 $, $Name: not supported by cvs2svn $, $Revision: 1.12 $
7 > !! @version $Id: do_Forces.F90,v 1.13 2003-03-12 19:10:54 gezelter Exp $, $Date: 2003-03-12 19:10:54 $, $Name: not supported by cvs2svn $, $Revision: 1.13 $
8  
9  
10  
# Line 13 | Line 13 | module do_Forces
13    use definitions
14    use forceGlobals
15    use atype_typedefs
16 <  use neighborLists
17 <
18 <  
19 <  use lj
16 >  use neighborLists  
17 >  use lj_FF
18    use sticky_FF
19    use dipole_dipole
20    use gb_FF
# Line 27 | Line 25 | public :: do_force_loop
25    implicit none
26    PRIVATE
27  
28 < public :: do_force_loop
28 >  public :: do_force_loop
29  
30 +  logical :: do_pot
31 +  logical :: do_stress
32 +
33   contains
34  
35    !! Does force loop over i,j pairs. Calls do_pair to calculates forces.
36    !------------------------------------------------------------->
37 <  subroutine do_force_loop(q,A,mu,u_l,f,t,tau,potE,do_pot,FFerror)
37 >  subroutine do_force_loop(q, A, u_l, f, t, tau, pot, do_pot_c, do_stress_c, &
38 >       FFerror)
39      !! Position array provided by C, dimensioned by getNlocal
40      real ( kind = dp ), dimension(3,getNlocal()) :: q
41      !! Rotation Matrix for each long range particle in simulation.
42 <    real( kind = dp), dimension(9,getNlocal()) :: A
41 <    
42 <    !! Magnitude dipole moment
43 <    real( kind = dp ), dimension(3,getNlocal()) :: mu
42 >    real( kind = dp), dimension(9,getNlocal()) :: A    
43      !! Unit vectors for dipoles (lab frame)
44      real( kind = dp ), dimension(3,getNlocal()) :: u_l
45      !! Force array provided by C, dimensioned by getNlocal
46      real ( kind = dp ), dimension(3,getNlocal()) :: f
47      !! Torsion array provided by C, dimensioned by getNlocal
48 <    real( kind = dp ), dimension(3,getNlocal()) :: t
50 <    
48 >    real( kind = dp ), dimension(3,getNlocal()) :: t    
49      !! Stress Tensor
50 <    real( kind = dp), dimension(9) :: tau
51 <    
52 <    real ( kind = dp ) :: potE
55 <    logical ( kind = 2) :: do_pot
50 >    real( kind = dp), dimension(9) :: tau  
51 >    real ( kind = dp ) :: pot
52 >    logical ( kind = 2) :: do_pot_c, do_stress_c
53      integer :: FFerror
54  
55   #ifdef IS_MPI
56      real( kind = DP ) :: pot_local
57   #endif
58      
59 <    real( kind = DP )   :: pe
60 <    logical             :: update_nlist
64 <    
65 <
66 <    integer ::  i, j, jbeg, jend, jnab, idim, jdim, idim2, jdim2, dim, dim2
59 >    logical :: update_nlist  
60 >    integer :: i, j, jbeg, jend, jnab
61      integer :: nlist
62 <    integer :: j_start
69 <    
70 <    real( kind = DP ) ::  r_ij, pot, ftmp, dudr, d2, drdx1, kt1, kt2, kt3, ktmp
71 <    
72 <    real( kind = DP ) ::  rx_ij, ry_ij, rz_ij, rijsq
73 <    real( kind = DP ) ::  rlistsq, rcutsq, rlist, rcut
62 >    real( kind = DP ) ::  rijsq, rlistsq, rcutsq, rlist, rcut
63  
75    ! a rig that need to be fixed.
64   #ifdef IS_MPI
77    real( kind = dp ) :: pe_local
65      integer :: nlocal
66   #endif
67      integer :: nrow
# Line 82 | Line 69 | contains
69      integer :: natoms
70      integer :: neighborListSize
71      integer :: listerror
85    !! should we calculate the stress tensor
86    logical  :: do_stress = .false.
72      FFerror = 0
73 +
74 +    do_pot = do_pot_c
75 +    do_stress = do_stress_c
76  
77      ! Make sure we are properly initialized.
78      if (.not. isFFInit) then
# Line 106 | Line 94 | contains
94      call getRlist(rlist,rlistsq)
95      
96      !! See if we need to update neighbor lists
97 <    call check(q, update_nlist)
97 >    call checkNeighborList(natoms, q, rcut, rlist, update_nlist)
98      
99      !--------------WARNING...........................
100      ! Zero variables, NOTE:::: Forces are zeroed in C
# Line 157 | Line 145 | contains
145                  nlist = nlist + 1
146                  
147                  if (nlist > neighborListSize) then
148 <                   call expandList(listerror)
148 >                   call expandNeighborList(nlocal, listerror)
149                     if (listerror /= 0) then
150                        FFerror = -1
151                        write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded."
# Line 221 | Line 209 | contains
209                  nlist = nlist + 1
210                  
211                  if (nlist > neighborListSize) then
212 <                   call expandList(listerror)
212 >                   call expandList(natoms, listerror)
213                     if (listerror /= 0) then
214                        FFerror = -1
215                        write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded."
# Line 393 | Line 381 | contains
381      call getElementProperty(atypes, me_i, "is_LJ", is_LJ_i)
382      call getElementProperty(atypes, me_j, "is_LJ", is_LJ_j)
383  
384 <    if ( is_LJ_i .and. is_LJ_j ) call do_lj_pair(i, j, d, r, rijsq, pot, f)
384 >    if ( is_LJ_i .and. is_LJ_j ) &
385 >         call do_lj_pair(i, j, d, r, rijsq, pot, f, do_pot, do_stress)
386  
387      call getElementProperty(atypes, me_i, "is_DP", is_DP_i)
388      call getElementProperty(atypes, me_j, "is_DP", is_DP_j)
389  
390      if ( is_DP_i .and. is_DP_j ) then
391  
392 <       call do_dipole_pair(i, j, d, r, pot, u_l, f, t)
392 >       call do_dipole_pair(i, j, d, r, pot, u_l, f, t, do_pot, do_stress)
393  
394         if (do_reaction_field) then
395            call accumulate_rf(i, j, r)
# Line 412 | Line 401 | contains
401      call getElementProperty(atypes, me_j, "is_Sticky", is_Sticky_j)
402  
403      if ( is_Sticky_i .and. is_Sticky_j ) then
404 <       call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t)
404 >       call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t, do_pot, do_stress)
405      endif
406  
407        
# Line 438 | Line 427 | contains
427          
428    end subroutine get_interatomic_vector
429    
430 <  subroutine zero_module_variables()
430 >  subroutine zero_work_arrays()
431 >    
432 > #ifdef IS_MPI
433  
434 < #ifndef IS_MPI
435 <
445 <    pe = 0.0E0_DP
446 <    tauTemp = 0.0_dp
447 <    fTemp = 0.0_dp
448 <    tTemp = 0.0_dp
449 < #else
450 <    qRow = 0.0_dp
451 <    qCol = 0.0_dp
434 >    q_Row = 0.0_dp
435 >    q_Col = 0.0_dp  
436      
437 <    muRow = 0.0_dp
438 <    muCol = 0.0_dp
437 >    u_l_Row = 0.0_dp
438 >    u_l_Col = 0.0_dp
439      
440 <    u_lRow = 0.0_dp
441 <    u_lCol = 0.0_dp
440 >    A_Row = 0.0_dp
441 >    A_Col = 0.0_dp
442      
443 <    ARow = 0.0_dp
444 <    ACol = 0.0_dp
445 <    
446 <    fRow = 0.0_dp
447 <    fCol = 0.0_dp
448 <    
449 <  
466 <    tRow = 0.0_dp
467 <    tCol = 0.0_dp
443 >    f_Row = 0.0_dp
444 >    f_Col = 0.0_dp
445 >    f_Temp = 0.0_dp
446 >      
447 >    t_Row = 0.0_dp
448 >    t_Col = 0.0_dp
449 >    t_Temp = 0.0_dp
450  
451 <  
451 >    pot_Row = 0.0_dp
452 >    pot_Col = 0.0_dp
453 >    pot_Temp = 0.0_dp
454  
471    eRow = 0.0_dp
472    eCol = 0.0_dp
473    eTemp = 0.0_dp
455   #endif
456  
457 <  end subroutine zero_module_variables
457 >    tau_Temp = 0.0_dp
458 >    virial_Temp = 0.0_dp
459 >    
460 >  end subroutine zero_work_arrays
461 >  
462  
478
463   !! Function to properly build neighbor lists in MPI using newtons 3rd law.
464   !! We don't want 2 processors doing the same i j pair twice.
465   !! Also checks to see if i and j are the same particle.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines