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 355 by mmeineke, Mon Mar 17 20:14:33 2003 UTC vs.
Revision 356 by gezelter, Mon Mar 17 20:42:57 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.20 2003-03-17 20:14:33 mmeineke Exp $, $Date: 2003-03-17 20:14:33 $, $Name: not supported by cvs2svn $, $Revision: 1.20 $
7 > !! @version $Id: do_Forces.F90,v 1.21 2003-03-17 20:42:57 gezelter Exp $, $Date: 2003-03-17 20:42:57 $, $Name: not supported by cvs2svn $, $Revision: 1.21 $
8  
9
10
9   module do_Forces
10    use simulation
11    use definitions
# Line 17 | Line 15 | module do_Forces
15    use sticky_pair
16    use dipole_dipole
17    use reaction_field
20
18   #ifdef IS_MPI
19    use mpiSimulation
20   #endif
21 +
22    implicit none
23    PRIVATE
24  
25 + #define __FORTRAN90
26 + #include "fForceField.h"
27 +
28 +  type (ffstruct), public :: thisFF
29 +
30    logical, save :: do_forces_initialized = .false.
31    logical, save :: FF_uses_LJ
32    logical, save :: FF_uses_sticky
# Line 37 | Line 40 | contains
40  
41   contains
42  
43 <  subroutine init_FF(LJ_mix_policy, use_RF_c, thisStat)
44 <    logical(kind=2), intent(in) :: use_RF_c
45 <    logical :: use_RF_f
43 >  subroutine init_FF(setThisFF, thisStat)
44 >
45 >    type (ffstruct) :: setThisFF
46 >
47      integer, intent(out) :: thisStat  
48      integer :: my_status, nMatches
45    character(len = 100) :: LJ_mix_Policy
49      integer, pointer :: MatchList(:)
47    
48    !! Fortran's version of a cast:
49    use_RF_f = use_RF_c
50  
51      !! assume things are copacetic, unless they aren't
52      thisStat = 0
53 +
54 +    thisFF = setThisFF
55 +
56 +    !! Fortran's version of a cast:
57 +    FF_uses_RF = thisFF%use_RF
58      
59      !! init_FF is called *after* all of the atom types have been
60      !! defined in atype_module using the new_atype subroutine.
# Line 84 | Line 89 | contains
89      deallocate(MatchList)
90      if (nMatches .gt. 0) FF_uses_EAM = .true.
91  
92 <    !! check to make sure the use_RF setting makes sense
93 <    if (use_RF_f) then
92 >    !! check to make sure the FF_uses_RF setting makes sense
93 >
94 >    if (FF_uses_RF) then
95         if (FF_uses_dipoles) then
90          FF_uses_RF = .true.
96            call initialize_rf()
97         else
98            write(default_error,*) 'Using Reaction Field with no dipoles?  Huh?'
# Line 95 | Line 100 | contains
100            return
101         endif
102      endif
103 <    
104 <    call init_lj_FF(LJ_mix_Policy, my_status)
105 <    if (my_status /= 0) then
106 <       thisStat = -1
107 <       return
108 <    end if
109 <    
110 <    call check_sticky_FF(my_status)
111 <    if (my_status /= 0) then
112 <       thisStat = -1
113 <       return
114 <    end if
103 >
104 >    if (FF_uses_LJ) then
105 >
106 >       select case (thisFF%LJ_Mixing_Policy)
107 >       case (thisFF%LB_MIXING_RULE)
108 >          call init_lj_FF('LB', my_status)            
109 >       case (thiFF%EXPLICIT_MIXING_RULE)
110 >          call init_lj_FF('Explicity, my_status)
111 >       case default
112 >          write(default_error,*) 'unknown LJ Mixing Policy!'
113 >          thisStat = -1
114 >          return            
115 >       end select      
116 >       if (my_status /= 0) then
117 >          thisStat = -1
118 >          return
119 >       end if
120 >    endif
121 >
122 >    if (FF_uses_sticky) then
123 >       call check_sticky_FF(my_status)
124 >       if (my_status /= 0) then
125 >          thisStat = -1
126 >          return
127 >       end if
128 >    endif
129 >
130      
131      do_forces_initialized = .true.    
132      
# Line 115 | Line 135 | contains
135  
136  
137    !! Does force loop over i,j pairs. Calls do_pair to calculates forces.
138 <  !------------------------------------------------------------->
138 >  a!------------------------------------------------------------->
139    subroutine do_force_loop(q, A, u_l, f, t, tau, pot, do_pot_c, do_stress_c, &
140         error)
141      !! Position array provided by C, dimensioned by getNlocal
# Line 242 | Line 262 | contains
262                  list(nlist) = j
263                                  
264                  if (rijsq <  rcutsq) then
265 <                   call do_pair(i, j, rijsq, d, do_pot, do_stress)
265 >                   call do_pair(i, j, rijsq, d, do_pot, do_stress, &
266 >                        u_l, A, f, t)
267                  endif
268               endif
269            enddo inner
# Line 263 | Line 284 | contains
284                  j = list(jnab)
285  
286                  call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq)
287 <                call do_pair(i, j, rijsq, d, do_pot, do_stress)
287 >                call do_pair(i, j, rijsq, d, do_pot, do_stress, &
288 >                     u_l, A, f, t)
289  
290               enddo
291            endif
# Line 306 | Line 328 | contains
328                  list(nlist) = j
329                  
330                  if (rijsq <  rcutsq) then
331 <                   call do_pair(i, j, rijsq, d, do_pot, do_stress)
331 >                   call do_pair(i, j, rijsq, d, do_pot, do_stress, &
332 >                        u_l, A, f, t)
333                  endif
334               endif
335            enddo inner
# Line 327 | Line 350 | contains
350                  j = list(jnab)
351  
352                  call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
353 <                call do_pair(i, j, rijsq, d, do_pot, do_stress)
353 >                call do_pair(i, j, rijsq, d, do_pot, do_stress, &
354 >                     u_l, A, f, t)
355  
356               enddo
357            endif
# Line 442 | Line 466 | contains
466      
467    end subroutine do_force_loop
468  
469 <  subroutine do_pair(i, j, rijsq, d, do_pot, do_stress)
469 >  subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t)
470  
471      real( kind = dp ) :: pot
472      real( kind = dp ), dimension(3,getNlocal()) :: u_l
# Line 474 | Line 498 | contains
498  
499   #endif
500  
477
501      if (FF_uses_LJ .and. SimUsesLJ()) then
502         call getElementProperty(atypes, me_i, "is_LJ", is_LJ_i)
503         call getElementProperty(atypes, me_j, "is_LJ", is_LJ_j)
# Line 483 | Line 506 | contains
506              call do_lj_pair(i, j, d, r, rijsq, pot, f, do_pot, do_stress)
507      endif
508        
486
509      if (FF_uses_dipoles .and. SimUsesDipoles()) then
510         call getElementProperty(atypes, me_i, "is_DP", is_DP_i)
511         call getElementProperty(atypes, me_j, "is_DP", is_DP_j)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines