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 2317 by chrisfen, Wed Sep 21 17:20:14 2005 UTC vs.
Revision 2461 by gezelter, Mon Nov 21 22:59:02 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.15 2005-09-21 17:20:14 chrisfen Exp $, $Date: 2005-09-21 17:20:14 $, $Name: not supported by cvs2svn $, $Revision: 1.15 $
46 > !! @version $Id: LJ.F90,v 1.19 2005-11-21 22:59:01 gezelter Exp $, $Date: 2005-11-21 22:59:01 $, $Name: not supported by cvs2svn $, $Revision: 1.19 $
47  
48  
49   module lj
# Line 58 | Line 58 | module lj
58  
59    implicit none
60    PRIVATE
61 + #define __FORTRAN90
62 + #include "UseTheForce/DarkSide/fInteractionMap.h"
63  
64    integer, parameter :: DP = selected_real_kind(15)
65  
# Line 77 | Line 79 | module lj
79    end type LJtype
80  
81    type, private :: LJList
82 <     integer               :: nLJtypes = 0
82 >     integer               :: Nljtypes = 0
83       integer               :: currentLJtype = 0
84       type(LJtype), pointer :: LJtypes(:)      => null()
85       integer, pointer      :: atidToLJtype(:) => null()
# Line 100 | Line 102 | module lj
102  
103    public :: newLJtype
104    public :: setLJDefaultCutoff
103  public :: setLJUniformCutoff
104  public :: setLJCutoffByTypes
105    public :: getSigma
106    public :: getEpsilon
107    public :: useGeometricMixing
# Line 157 | Line 157 | contains
157      defaultCutoff = thisRcut
158      defaultShift = shiftedPot
159      haveDefaultCutoff = .true.
160 <    call createMixingMap()
161 <  end subroutine setLJDefaultCutoff
162 <
163 <  subroutine setLJUniformCutoff(thisRcut, shiftedPot)
164 <    real(kind=dp), intent(in) :: thisRcut
165 <    logical, intent(in) :: shiftedPot
166 <    integer :: nLJtypes, i, j
167 <
168 <    if (LJMap%currentLJtype == 0) then
169 <       call handleError("LJ", "No members in LJMap")
170 <       return
160 >    !we only want to build LJ Mixing map if LJ is being used.
161 >    if(LJMap%nLJTypes /= 0) then
162 >       call createMixingMap()
163      end if
164 <
173 <    nLJtypes = LJMap%nLJtypes
174 <    if (.not. allocated(MixingMap)) then
175 <       allocate(MixingMap(nLJtypes, nLJtypes))
176 <    endif
177 <
178 <    do i = 1, nLJtypes
179 <       do j = 1, nLJtypes
180 <          MixingMap(i,j)%rCut = thisRcut
181 <          MixingMap(i,j)%shiftedPot = shiftedPot
182 <          MixingMap(i,j)%rCutWasSet = .true.
183 <       enddo
184 <    enddo
185 <    call createMixingMap()
186 <  end subroutine setLJUniformCutoff
187 <
188 <  subroutine setLJCutoffByTypes(atid1, atid2, thisRcut, shiftedPot)
189 <    integer, intent(in) :: atid1, atid2
190 <    real(kind=dp), intent(in) :: thisRcut
191 <    logical, intent(in) :: shiftedPot
192 <    integer :: nLJtypes, ljt1, ljt2
193 <
194 <    if (LJMap%currentLJtype == 0) then
195 <       call handleError("LJ", "No members in LJMap")
196 <       return
197 <    end if
198 <
199 <    nLJtypes = LJMap%nLJtypes
200 <    if (.not. allocated(MixingMap)) then
201 <       allocate(MixingMap(nLJtypes, nLJtypes))
202 <    endif
203 <
204 <    ljt1 = LJMap%atidToLJtype(atid1)
205 <    ljt2 = LJMap%atidToLJtype(atid2)
206 <
207 <    MixingMap(ljt1,ljt2)%rCut = thisRcut
208 <    MixingMap(ljt1,ljt2)%shiftedPot = shiftedPot
209 <    MixingMap(ljt1,ljt2)%rCutWasSet = .true.
210 <    MixingMap(ljt2,ljt1)%rCut = thisRcut
211 <    MixingMap(ljt2,ljt1)%shiftedPot = shiftedPot
212 <    MixingMap(ljt2,ljt1)%rCutWasSet = .true.
164 >  end subroutine setLJDefaultCutoff
165  
214    call createMixingMap()
215  end subroutine setLJCutoffByTypes
216
166    function getSigma(atid) result (s)
167      integer, intent(in) :: atid
168      integer :: ljt1
# Line 292 | Line 241 | contains
241  
242            MixingMap(i,j)%sigma6 = (MixingMap(i,j)%sigma)**6
243  
244 <          if (MixingMap(i,j)%rCutWasSet) then
245 <             rcut6 = (MixingMap(i,j)%rcut)**6
244 >          if (haveDefaultCutoff) then
245 >             rcut6 = defaultCutoff**6
246 >             tp6    = MixingMap(i,j)%sigma6/rcut6
247 >             tp12    = tp6**2          
248 >             MixingMap(i,j)%delta =-4.0_DP*MixingMap(i,j)%epsilon*(tp12 - tp6)
249 >             MixingMap(i,j)%shiftedPot = defaultShift
250            else
251 <             if (haveDefaultCutoff) then
252 <                rcut6 = defaultCutoff**6
253 <                doShift = defaultShift
301 <             else
302 <                call handleError("LJ", "No specified or default cutoff value!")
303 <             endif
304 <          endif
305 <          
306 <          tp6    = MixingMap(i,j)%sigma6/rcut6
307 <          tp12    = tp6**2          
308 <          MixingMap(i,j)%delta =-4.0_DP*MixingMap(i,j)%epsilon*(tp12 - tp6)
309 <          MixingMap(i,j)%shiftedPot = doShift
251 >             MixingMap(i,j)%delta = 0.0_DP
252 >             MixingMap(i,j)%shiftedPot = defaultShift
253 >          endif          
254  
255            if (i.ne.j) then
256               MixingMap(j,i)%sigma      = MixingMap(i,j)%sigma
# Line 326 | Line 270 | contains
270      
271    end subroutine createMixingMap
272    
273 <  subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, &
273 >  subroutine do_lj_pair(atom1, atom2, d, rij, r2, rcut, sw, vpair, fpair, &
274         pot, f, do_pot)
275 <
275 >    
276      integer, intent(in) ::  atom1, atom2
277      integer :: atid1, atid2, ljt1, ljt2
278 <    real( kind = dp ), intent(in) :: rij, r2
278 >    real( kind = dp ), intent(in) :: rij, r2, rcut
279      real( kind = dp ) :: pot, sw, vpair
280      real( kind = dp ), dimension(3,nLocal) :: f    
281      real( kind = dp ), intent(in), dimension(3) :: d
# Line 344 | Line 288 | contains
288      real( kind = dp ) :: pot_temp, dudr
289      real( kind = dp ) :: sigma6
290      real( kind = dp ) :: epsilon
291 <    real( kind = dp ) :: r6
292 <    real( kind = dp ) :: t6
293 <    real( kind = dp ) :: t12
291 >    real( kind = dp ) :: r6, rc6
292 >    real( kind = dp ) :: t6, tp6
293 >    real( kind = dp ) :: t12, tp12
294      real( kind = dp ) :: delta
295      logical :: isSoftCore, shiftedPot
296      integer :: id1, id2, localError
# Line 382 | Line 326 | contains
326        
327         pot_temp = 4.0E0_DP * epsilon * t6
328         if (shiftedPot) then
329 +          rc6 = rcut**6
330 +          tp6 = sigma6 / rc6
331 +          delta =-4.0_DP*epsilon*(tp6)
332            pot_temp = pot_temp + delta
333         endif
334        
# Line 392 | Line 339 | contains
339      else
340         pot_temp = 4.0E0_DP * epsilon * (t12 - t6)
341         if (shiftedPot) then
342 +          rc6 = rcut**6
343 +          tp6 = sigma6 / rc6
344 +          tp12 = tp6*tp6
345 +          delta =-4.0_DP*epsilon*(tp12 - tp6)
346            pot_temp = pot_temp + delta
347         endif
348        
# Line 410 | Line 361 | contains
361  
362   #ifdef IS_MPI
363      if (do_pot) then
364 <       pot_Row(atom1) = pot_Row(atom1) + sw*pot_temp*0.5
365 <       pot_Col(atom2) = pot_Col(atom2) + sw*pot_temp*0.5
364 >       pot_Row(VDW_POT,atom1) = pot_Row(VDW_POT,atom1) + sw*pot_temp*0.5
365 >       pot_Col(VDW_POT,atom2) = pot_Col(VDW_POT,atom2) + sw*pot_temp*0.5
366      endif
367  
368      f_Row(1,atom1) = f_Row(1,atom1) + fx

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines