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

Comparing trunk/OOPSE-4/src/UseTheForce/DarkSide/LJ.F90 (file contents):
Revision 2355 by chuckv, Wed Oct 12 18:59:16 2005 UTC vs.
Revision 2497 by chuckv, Wed Dec 7 19:58:18 2005 UTC

# Line 43 | Line 43
43   !! Calculates Long Range forces Lennard-Jones interactions.
44   !! @author Charles F. Vardeman II
45   !! @author Matthew Meineke
46 < !! @version $Id: LJ.F90,v 1.17 2005-10-12 18:59:16 chuckv Exp $, $Date: 2005-10-12 18:59:16 $, $Name: not supported by cvs2svn $, $Revision: 1.17 $
46 > !! @version $Id: LJ.F90,v 1.20 2005-12-07 19:58:18 chuckv Exp $, $Date: 2005-12-07 19:58:18 $, $Name: not supported by cvs2svn $, $Revision: 1.20 $
47  
48  
49   module lj
# Line 51 | Line 51 | module lj
51    use vector_class
52    use simulation
53    use status
54 +  use fForceOptions
55   #ifdef IS_MPI
56    use mpiSimulation
57   #endif
# Line 102 | Line 103 | module lj
103  
104    public :: newLJtype
105    public :: setLJDefaultCutoff
105  public :: setLJUniformCutoff
106  public :: setLJCutoffByTypes
106    public :: getSigma
107    public :: getEpsilon
109  public :: useGeometricMixing
108    public :: do_lj_pair
109    public :: destroyLJtypes
110  
# Line 165 | Line 163 | contains
163      end if
164    end subroutine setLJDefaultCutoff
165  
168  subroutine setLJUniformCutoff(thisRcut, shiftedPot)
169    real(kind=dp), intent(in) :: thisRcut
170    logical, intent(in) :: shiftedPot
171    integer :: nLJtypes, i, j
172
173    if (LJMap%currentLJtype == 0) then
174       call handleError("LJ", "No members in LJMap")
175       return
176    end if
177
178    nLJtypes = LJMap%nLJtypes
179    if (.not. allocated(MixingMap)) then
180       allocate(MixingMap(nLJtypes, nLJtypes))
181    endif
182
183    do i = 1, nLJtypes
184       do j = 1, nLJtypes
185          MixingMap(i,j)%rCut = thisRcut
186          MixingMap(i,j)%shiftedPot = shiftedPot
187          MixingMap(i,j)%rCutWasSet = .true.
188       enddo
189    enddo
190    call createMixingMap()
191  end subroutine setLJUniformCutoff
192
193  subroutine setLJCutoffByTypes(atid1, atid2, thisRcut, shiftedPot)
194    integer, intent(in) :: atid1, atid2
195    real(kind=dp), intent(in) :: thisRcut
196    logical, intent(in) :: shiftedPot
197    integer :: nLJtypes, ljt1, ljt2
198
199    if (LJMap%currentLJtype == 0) then
200       call handleError("LJ", "No members in LJMap")
201       return
202    end if
203
204    nLJtypes = LJMap%nLJtypes
205    if (.not. allocated(MixingMap)) then
206       allocate(MixingMap(nLJtypes, nLJtypes))
207    endif
208
209    ljt1 = LJMap%atidToLJtype(atid1)
210    ljt2 = LJMap%atidToLJtype(atid2)
211
212    MixingMap(ljt1,ljt2)%rCut = thisRcut
213    MixingMap(ljt1,ljt2)%shiftedPot = shiftedPot
214    MixingMap(ljt1,ljt2)%rCutWasSet = .true.
215    MixingMap(ljt2,ljt1)%rCut = thisRcut
216    MixingMap(ljt2,ljt1)%shiftedPot = shiftedPot
217    MixingMap(ljt2,ljt1)%rCutWasSet = .true.
218
219    call createMixingMap()
220  end subroutine setLJCutoffByTypes
221
166    function getSigma(atid) result (s)
167      integer, intent(in) :: atid
168      integer :: ljt1
# Line 249 | Line 193 | contains
193  
194    end function getEpsilon
195  
252  subroutine useGeometricMixing()
253    useGeometricDistanceMixing = .true.
254    haveMixingMap = .false.
255    return
256  end subroutine useGeometricMixing
257
196    subroutine createMixingMap()
197      integer :: nLJtypes, i, j
198      real ( kind = dp ) :: s1, s2, e1, e2
# Line 272 | Line 210 | contains
210         allocate(MixingMap(nLJtypes, nLJtypes))
211      endif
212  
213 +    useGeometricDistanceMixing = usesGeometricDistanceMixing()
214      do i = 1, nLJtypes
215  
216         s1 = LJMap%LJtypes(i)%sigma
# Line 297 | Line 236 | contains
236  
237            MixingMap(i,j)%sigma6 = (MixingMap(i,j)%sigma)**6
238  
239 <          if (MixingMap(i,j)%rCutWasSet) then
240 <             rcut6 = (MixingMap(i,j)%rcut)**6
239 >          if (haveDefaultCutoff) then
240 >             rcut6 = defaultCutoff**6
241 >             tp6    = MixingMap(i,j)%sigma6/rcut6
242 >             tp12    = tp6**2          
243 >             MixingMap(i,j)%delta =-4.0_DP*MixingMap(i,j)%epsilon*(tp12 - tp6)
244 >             MixingMap(i,j)%shiftedPot = defaultShift
245            else
246 <             if (haveDefaultCutoff) then
247 <                rcut6 = defaultCutoff**6
248 <                doShift = defaultShift
306 <             else
307 <                call handleError("LJ", "No specified or default cutoff value!")
308 <             endif
309 <          endif
310 <          
311 <          tp6    = MixingMap(i,j)%sigma6/rcut6
312 <          tp12    = tp6**2          
313 <          MixingMap(i,j)%delta =-4.0_DP*MixingMap(i,j)%epsilon*(tp12 - tp6)
314 <          MixingMap(i,j)%shiftedPot = doShift
246 >             MixingMap(i,j)%delta = 0.0_DP
247 >             MixingMap(i,j)%shiftedPot = defaultShift
248 >          endif          
249  
250            if (i.ne.j) then
251               MixingMap(j,i)%sigma      = MixingMap(i,j)%sigma
# Line 331 | Line 265 | contains
265      
266    end subroutine createMixingMap
267    
268 <  subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, &
268 >  subroutine do_lj_pair(atom1, atom2, d, rij, r2, rcut, sw, vpair, fpair, &
269         pot, f, do_pot)
270 <
270 >    
271      integer, intent(in) ::  atom1, atom2
272      integer :: atid1, atid2, ljt1, ljt2
273 <    real( kind = dp ), intent(in) :: rij, r2
273 >    real( kind = dp ), intent(in) :: rij, r2, rcut
274      real( kind = dp ) :: pot, sw, vpair
275      real( kind = dp ), dimension(3,nLocal) :: f    
276      real( kind = dp ), intent(in), dimension(3) :: d
# Line 349 | Line 283 | contains
283      real( kind = dp ) :: pot_temp, dudr
284      real( kind = dp ) :: sigma6
285      real( kind = dp ) :: epsilon
286 <    real( kind = dp ) :: r6
287 <    real( kind = dp ) :: t6
288 <    real( kind = dp ) :: t12
286 >    real( kind = dp ) :: r6, rc6
287 >    real( kind = dp ) :: t6, tp6
288 >    real( kind = dp ) :: t12, tp12
289      real( kind = dp ) :: delta
290      logical :: isSoftCore, shiftedPot
291      integer :: id1, id2, localError
# Line 387 | Line 321 | contains
321        
322         pot_temp = 4.0E0_DP * epsilon * t6
323         if (shiftedPot) then
324 +          rc6 = rcut**6
325 +          tp6 = sigma6 / rc6
326 +          delta =-4.0_DP*epsilon*(tp6)
327            pot_temp = pot_temp + delta
328         endif
329        
# Line 397 | Line 334 | contains
334      else
335         pot_temp = 4.0E0_DP * epsilon * (t12 - t6)
336         if (shiftedPot) then
337 +          rc6 = rcut**6
338 +          tp6 = sigma6 / rc6
339 +          tp12 = tp6*tp6
340 +          delta =-4.0_DP*epsilon*(tp12 - tp6)
341            pot_temp = pot_temp + delta
342         endif
343        
# Line 415 | Line 356 | contains
356  
357   #ifdef IS_MPI
358      if (do_pot) then
359 <       pot_Row(LJ_POT,atom1) = pot_Row(LJ_POT,atom1) + sw*pot_temp*0.5
360 <       pot_Col(LJ_POT,atom2) = pot_Col(LJ_POT,atom2) + sw*pot_temp*0.5
359 >       pot_Row(VDW_POT,atom1) = pot_Row(VDW_POT,atom1) + sw*pot_temp*0.5
360 >       pot_Col(VDW_POT,atom2) = pot_Col(VDW_POT,atom2) + sw*pot_temp*0.5
361      endif
362  
363      f_Row(1,atom1) = f_Row(1,atom1) + fx

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines