ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/UseTheForce/doForces.F90
(Generate patch)

Comparing trunk/OOPSE-2.0/src/UseTheForce/doForces.F90 (file contents):
Revision 2259 by gezelter, Mon Jun 27 21:01:36 2005 UTC vs.
Revision 2261 by gezelter, Tue Jun 28 13:58:45 2005 UTC

# Line 45 | Line 45
45  
46   !! @author Charles F. Vardeman II
47   !! @author Matthew Meineke
48 < !! @version $Id: doForces.F90,v 1.20 2005-06-27 21:01:30 gezelter Exp $, $Date: 2005-06-27 21:01:30 $, $Name: not supported by cvs2svn $, $Revision: 1.20 $
48 > !! @version $Id: doForces.F90,v 1.22 2005-06-28 13:58:45 gezelter Exp $, $Date: 2005-06-28 13:58:45 $, $Name: not supported by cvs2svn $, $Revision: 1.22 $
49  
50  
51   module doForces
# Line 81 | Line 81 | module doForces
81    logical, save :: haveRlist = .false.
82    logical, save :: haveNeighborList = .false.
83    logical, save :: haveSIMvariables = .false.
84  logical, save :: havePropertyMap = .false.
84    logical, save :: haveSaneForceField = .false.
85  
86    logical, save :: FF_uses_DirectionalAtoms
# Line 116 | Line 115 | module doForces
115    logical, save :: SIM_uses_PBC
116    logical, save :: SIM_uses_molecular_cutoffs
117  
118 <  real(kind=dp), save :: rlist, rlistsq
118 >  !!!GO AWAY---------
119 >  !!!!!real(kind=dp), save :: rlist, rlistsq
120  
121    public :: init_FF
122    public :: do_force_loop
123 <  public :: setRlistDF
123 > !  public :: setRlistDF
124  
125   #ifdef PROFILE
126    public :: getforcetime
# Line 129 | Line 129 | module doForces
129    integer :: nLoops
130   #endif
131  
132 <  type :: Properties
133 <     logical :: is_Directional   = .false.
134 <     logical :: is_LennardJones  = .false.
135 <     logical :: is_Electrostatic = .false.
136 <     logical :: is_Charge        = .false.
137 <     logical :: is_Dipole        = .false.
138 <     logical :: is_Quadrupole    = .false.
139 <     logical :: is_Sticky        = .false.
140 <     logical :: is_StickyPower   = .false.
141 <     logical :: is_GayBerne      = .false.
142 <     logical :: is_EAM           = .false.
143 <     logical :: is_Shape         = .false.
144 <     logical :: is_FLARB         = .false.
145 <  end type Properties
146 <
147 <  type(Properties), dimension(:),allocatable :: PropertyMap
148 <
132 >  type, public :: Interaction
133 >     integer :: InteractionHash
134 >     real(kind=dp) :: rCut
135 >  end type Interaction
136 >  
137 >  type(Interaction), dimension(:,:),allocatable :: InteractionMap
138 >  
139 >  !public :: addInteraction
140 >  !public :: setInteractionHash
141 >  !public :: getInteractionHash
142 >  public :: createInteractionMap
143 >  
144   contains
145  
146 <  subroutine setRlistDF( this_rlist )
147 <
153 <    real(kind=dp) :: this_rlist
154 <
155 <    rlist = this_rlist
156 <    rlistsq = rlist * rlist
157 <
158 <    haveRlist = .true.
159 <
160 <  end subroutine setRlistDF
161 <
162 <  subroutine createPropertyMap(status)
146 >
147 >  subroutine createInteractionMap(status)
148      integer :: nAtypes
149      integer :: status
150      integer :: i
151 <    logical :: thisProperty
152 <    real (kind=DP) :: thisDPproperty
153 <
154 <    status = 0
155 <
151 >    integer :: j
152 >    integer :: ihash
153 >    real(kind=dp) :: myRcut
154 > ! Test Types
155 >    logical :: i_is_LJ
156 >    logical :: i_is_Elect
157 >    logical :: i_is_Sticky
158 >    logical :: i_is_StickyP
159 >    logical :: i_is_GB
160 >    logical :: i_is_EAM
161 >    logical :: i_is_Shape
162 >    logical :: j_is_LJ
163 >    logical :: j_is_Elect
164 >    logical :: j_is_Sticky
165 >    logical :: j_is_StickyP
166 >    logical :: j_is_GB
167 >    logical :: j_is_EAM
168 >    logical :: j_is_Shape
169 >    
170 >    
171 >    if (.not. associated(atypes)) then
172 >       call handleError("atype", "atypes was not present before call of createDefaultInteractionMap!")
173 >       status = -1
174 >       return
175 >    endif
176 >    
177      nAtypes = getSize(atypes)
178 <
178 >    
179      if (nAtypes == 0) then
180         status = -1
181         return
182      end if
183  
184 <    if (.not. allocated(PropertyMap)) then
185 <       allocate(PropertyMap(nAtypes))
184 >    if (.not. allocated(InteractionMap)) then
185 >       allocate(InteractionMap(nAtypes,nAtypes))
186      endif
187 <
187 >        
188      do i = 1, nAtypes
189 <       call getElementProperty(atypes, i, "is_Directional", thisProperty)
190 <       PropertyMap(i)%is_Directional = thisProperty
189 >       call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ)
190 >       call getElementProperty(atypes, i, "is_Electrostatic", i_is_Elect)
191 >       call getElementProperty(atypes, i, "is_Sticky", i_is_Sticky)
192 >       call getElementProperty(atypes, i, "is_StickyPower", i_is_StickyP)
193 >       call getElementProperty(atypes, i, "is_GayBerne", i_is_GB)
194 >       call getElementProperty(atypes, i, "is_EAM", i_is_EAM)
195 >       call getElementProperty(atypes, i, "is_Shape", i_is_Shape)
196  
197 <       call getElementProperty(atypes, i, "is_LennardJones", thisProperty)
187 <       PropertyMap(i)%is_LennardJones = thisProperty
197 >       do j = i, nAtypes
198  
199 <       call getElementProperty(atypes, i, "is_Electrostatic", thisProperty)
200 <       PropertyMap(i)%is_Electrostatic = thisProperty
191 <
192 <       call getElementProperty(atypes, i, "is_Charge", thisProperty)
193 <       PropertyMap(i)%is_Charge = thisProperty
199 >          iHash = 0
200 >          myRcut = 0.0_dp
201  
202 <       call getElementProperty(atypes, i, "is_Dipole", thisProperty)
203 <       PropertyMap(i)%is_Dipole = thisProperty
202 >          call getElementProperty(atypes, j, "is_LennardJones", j_is_LJ)
203 >          call getElementProperty(atypes, j, "is_Electrostatic", j_is_Elect)
204 >          call getElementProperty(atypes, j, "is_Sticky", j_is_Sticky)
205 >          call getElementProperty(atypes, j, "is_StickyPower", j_is_StickyP)
206 >          call getElementProperty(atypes, j, "is_GayBerne", j_is_GB)
207 >          call getElementProperty(atypes, j, "is_EAM", j_is_EAM)
208 >          call getElementProperty(atypes, j, "is_Shape", j_is_Shape)
209  
210 <       call getElementProperty(atypes, i, "is_Quadrupole", thisProperty)
211 <       PropertyMap(i)%is_Quadrupole = thisProperty
210 >          if (i_is_LJ .and. j_is_LJ) then
211 >             iHash = ior(iHash, LJ_PAIR)            
212 >          endif
213 >          
214 >          if (i_is_Elect .and. j_is_Elect) then
215 >             iHash = ior(iHash, ELECTROSTATIC_PAIR)
216 >          endif
217 >          
218 >          if (i_is_Sticky .and. j_is_Sticky) then
219 >             iHash = ior(iHash, STICKY_PAIR)
220 >          endif
221  
222 <       call getElementProperty(atypes, i, "is_Sticky", thisProperty)
223 <       PropertyMap(i)%is_Sticky = thisProperty
224 <      
204 <       call getElementProperty(atypes, i, "is_StickyPower", thisProperty)
205 <       PropertyMap(i)%is_StickyPower = thisProperty
222 >          if (i_is_StickyP .and. j_is_StickyP) then
223 >             iHash = ior(iHash, STICKYPOWER_PAIR)
224 >          endif
225  
226 <       call getElementProperty(atypes, i, "is_GayBerne", thisProperty)
227 <       PropertyMap(i)%is_GayBerne = thisProperty
226 >          if (i_is_EAM .and. j_is_EAM) then
227 >             iHash = ior(iHash, EAM_PAIR)
228 >          endif
229  
230 <       call getElementProperty(atypes, i, "is_EAM", thisProperty)
231 <       PropertyMap(i)%is_EAM = thisProperty
230 >          if (i_is_GB .and. j_is_GB) iHash = ior(iHash, GAYBERNE_PAIR)
231 >          if (i_is_GB .and. j_is_LJ) iHash = ior(iHash, GAYBERNE_LJ)
232 >          if (i_is_LJ .and. j_is_GB) iHash = ior(iHash, GAYBERNE_LJ)
233  
234 <       call getElementProperty(atypes, i, "is_Shape", thisProperty)
235 <       PropertyMap(i)%is_Shape = thisProperty
234 >          if (i_is_Shape .and. j_is_Shape) iHash = ior(iHash, SHAPE_PAIR)
235 >          if (i_is_Shape .and. j_is_LJ) iHash = ior(iHash, SHAPE_LJ)
236 >          if (i_is_LJ .and. j_is_Shape) iHash = ior(iHash, SHAPE_LJ)
237  
238 <       call getElementProperty(atypes, i, "is_FLARB", thisProperty)
239 <       PropertyMap(i)%is_FLARB = thisProperty
238 >
239 >          InteractionMap(i,j)%InteractionHash = iHash
240 >          InteractionMap(j,i)%InteractionHash = iHash
241 >
242 >       end do
243 >
244      end do
245 +  end subroutine createInteractionMap
246  
220    havePropertyMap = .true.
247  
222  end subroutine createPropertyMap
248  
249 + !!! THIS GOES AWAY FOR SIZE DEPENDENT CUTOFF
250 + !!$  subroutine setRlistDF( this_rlist )
251 + !!$
252 + !!$   real(kind=dp) :: this_rlist
253 + !!$
254 + !!$    rlist = this_rlist
255 + !!$    rlistsq = rlist * rlist
256 + !!$
257 + !!$    haveRlist = .true.
258 + !!$
259 + !!$  end subroutine setRlistDF
260 +
261 +
262    subroutine setSimVariables()
263      SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms()
264      SIM_uses_LennardJones = SimUsesLennardJones()
# Line 250 | Line 288 | contains
288  
289      error = 0
290  
291 <    if (.not. havePropertyMap) then
291 >    if (.not. haveInteractionMap) then
292  
293         myStatus = 0
294  
295 <       call createPropertyMap(myStatus)
295 >       call createInteractionMap(myStatus)
296  
297         if (myStatus .ne. 0) then
298 <          write(default_error, *) 'createPropertyMap failed in doForces!'
298 >          write(default_error, *) 'createInteractionMap failed in doForces!'
299            error = -1
300            return
301         endif
# Line 859 | Line 897 | contains
897   #else
898               me_i = atid(i)
899   #endif
900 <
901 <             if (PropertyMap(me_i)%is_Dipole) then
900 >             iMap = InteractionMap(me_i, me_j)%InteractionHash
901 >            
902 >             if ( iand(iMap, ELECTROSTATIC_PAIR).ne.0 ) then
903  
904                  mu_i = getDipoleMoment(me_i)
905  
# Line 951 | Line 990 | contains
990         call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, &
991              pot, eFrame, f, t, do_pot)
992  
993 <       if (FF_uses_dipoles .and. SIM_uses_dipoles) then                
994 <          if ( PropertyMap(me_i)%is_Dipole .and. &
995 <               PropertyMap(me_j)%is_Dipole) then
996 <             if (FF_uses_RF .and. SIM_uses_RF) then
997 <                call accumulate_rf(i, j, r, eFrame, sw)
959 <                call rf_correct_forces(i, j, d, r, eFrame, sw, f, fpair)
960 <             endif
961 <          endif
993 >       if (FF_uses_RF .and. SIM_uses_RF) then
994 >
995 >          ! CHECK ME (RF needs to know about all electrostatic types)
996 >          call accumulate_rf(i, j, r, eFrame, sw)
997 >          call rf_correct_forces(i, j, d, r, eFrame, sw, f, fpair)
998         endif
999 +
1000      endif
1001  
1002      if ( iand(iMap, STICKY_PAIR).ne.0 ) then

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines