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 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2756 by gezelter, Wed May 17 15:37:15 2006 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.11 2005-04-15 22:03:47 gezelter Exp $, $Date: 2005-04-15 22:03:47 $, $Name: not supported by cvs2svn $, $Revision: 1.11 $
46 > !! @version $Id: LJ.F90,v 1.25 2006-05-17 15:37:14 gezelter Exp $, $Date: 2006-05-17 15:37:14 $, $Name: not supported by cvs2svn $, $Revision: 1.25 $
47  
48  
49   module lj
50 +  use definitions
51    use atype_module
51  use switcheroo
52    use vector_class
53    use simulation
54    use status
55 +  use fForceOptions
56   #ifdef IS_MPI
57    use mpiSimulation
58   #endif
# Line 59 | Line 60 | module lj
60  
61    implicit none
62    PRIVATE
63 + #define __FORTRAN90
64 + #include "UseTheForce/DarkSide/fInteractionMap.h"
65  
66 <  integer, parameter :: DP = selected_real_kind(15)
66 >  logical, save :: useGeometricDistanceMixing = .false.
67 >  logical, save :: haveMixingMap = .false.
68  
69 <  type, private :: LjType
70 <     integer :: c_ident
71 <     integer :: atid
69 >  real(kind=DP), save :: defaultCutoff = 0.0_DP
70 >  logical, save :: defaultShift = .false.
71 >  logical, save :: haveDefaultCutoff = .false.
72 >
73 >  type, private :: LJtype
74 >     integer       :: atid
75       real(kind=dp) :: sigma
76       real(kind=dp) :: epsilon
77 <     logical :: soft_pot
78 <  end type LjType
77 >     logical       :: isSoftCore = .false.
78 >  end type LJtype
79  
80 <  type(LjType), dimension(:), allocatable :: ParameterMap
80 >  type, private :: LJList
81 >     integer               :: Nljtypes = 0
82 >     integer               :: currentLJtype = 0
83 >     type(LJtype), pointer :: LJtypes(:)      => null()
84 >     integer, pointer      :: atidToLJtype(:) => null()
85 >  end type LJList
86  
87 <  logical, save :: haveMixingMap = .false.
87 >  type(LJList), save :: LJMap
88  
89    type :: MixParameters
90       real(kind=DP) :: sigma
91       real(kind=DP) :: epsilon
92 <     real(kind=dp)  :: sigma6
93 <     real(kind=dp)  :: tp6
94 <     real(kind=dp)  :: tp12
95 <     real(kind=dp)  :: delta
96 <     logical :: soft_pot    
92 >     real(kind=dp) :: sigmai
93 >     real(kind=dp) :: rCut
94 >     logical       :: rCutWasSet = .false.
95 >     logical       :: shiftedPot
96 >     logical       :: isSoftCore = .false.
97    end type MixParameters
98  
99    type(MixParameters), dimension(:,:), allocatable :: MixingMap
100  
101 <  real(kind=DP), save :: LJ_rcut
102 <  logical, save :: have_rcut = .false.
91 <  logical, save :: LJ_do_shift = .false.
92 <  logical, save :: useGeometricDistanceMixing = .false.
93 <
94 <  !! Public methods and data
95 <
96 <  public :: setCutoffLJ
97 <  public :: useGeometricMixing
98 <  public :: do_lj_pair
99 <  public :: newLJtype  
101 >  public :: newLJtype
102 >  public :: setLJDefaultCutoff
103    public :: getSigma
104    public :: getEpsilon
105 <  public :: destroyLJTypes
105 >  public :: do_lj_pair
106 >  public :: destroyLJtypes
107  
108   contains
109  
110 <  subroutine newLJtype(c_ident, sigma, epsilon, soft_pot, status)
110 >  subroutine newLJtype(c_ident, sigma, epsilon, isSoftCore, status)
111      integer,intent(in) :: c_ident
112      real(kind=dp),intent(in) :: sigma
113      real(kind=dp),intent(in) :: epsilon
114 <    integer, intent(in) :: soft_pot
114 >    integer, intent(in) :: isSoftCore
115      integer,intent(out) :: status
116 <    integer :: nATypes, myATID
116 >    integer :: nLJTypes, ntypes, myATID
117      integer, pointer :: MatchList(:) => null()
118 +    integer :: current
119  
120      status = 0
121 +    ! check to see if this is the first time into this routine...
122 +    if (.not.associated(LJMap%LJtypes)) then
123  
124 <    myATID = getFirstMatchingElement(atypes, "c_ident", c_ident)
124 >       call getMatchingElementList(atypes, "is_LennardJones", .true., &
125 >            nLJTypes, MatchList)
126 >      
127 >       LJMap%nLJtypes =  nLJTypes
128  
129 <    if (.not.allocated(ParameterMap)) then
129 >       allocate(LJMap%LJtypes(nLJTypes))
130  
131 <       !call getMatchingElementList(atypes, "is_LennardJones", .true., &
122 <       !     nLJTypes, MatchList)
123 <       nAtypes = getSize(atypes)
124 <       if (nAtypes == 0) then
125 <          status = -1
126 <          return
127 <       end if
131 >       ntypes = getSize(atypes)
132  
133 <       if (.not. allocated(ParameterMap)) then
130 <          allocate(ParameterMap(nAtypes))
131 <       endif
132 <
133 >       allocate(LJMap%atidToLJtype(ntypes))
134      end if
135  
136 <    if (myATID .gt. size(ParameterMap)) then
137 <       status = -1
137 <       return
138 <    endif
136 >    LJMap%currentLJtype = LJMap%currentLJtype + 1
137 >    current = LJMap%currentLJtype
138  
139 <    ! set the values for ParameterMap for this atom type:
140 <
141 <    ParameterMap(myATID)%c_ident = c_ident
142 <    ParameterMap(myATID)%atid = myATID
143 <    ParameterMap(myATID)%epsilon = epsilon
144 <    ParameterMap(myATID)%sigma = sigma
145 <    if (soft_pot == 1) then
147 <       ParameterMap(myATID)%soft_pot = .true.
139 >    myATID = getFirstMatchingElement(atypes, "c_ident", c_ident)
140 >    LJMap%atidToLJtype(myATID)        = current
141 >    LJMap%LJtypes(current)%atid       = myATID
142 >    LJMap%LJtypes(current)%sigma      = sigma
143 >    LJMap%LJtypes(current)%epsilon    = epsilon
144 >    if (isSoftCore .eq. 1) then
145 >       LJMap%LJtypes(current)%isSoftCore = .true.
146      else
147 <       ParameterMap(myATID)%soft_pot = .false.
147 >       LJMap%LJtypes(current)%isSoftCore = .false.
148      endif
149    end subroutine newLJtype
150  
151 +  subroutine setLJDefaultCutoff(thisRcut, shiftedPot)
152 +    real(kind=dp), intent(in) :: thisRcut
153 +    logical, intent(in) :: shiftedPot
154 +    defaultCutoff = thisRcut
155 +    defaultShift = shiftedPot
156 +    haveDefaultCutoff = .true.
157 +    !we only want to build LJ Mixing map if LJ is being used.
158 +    if(LJMap%nLJTypes /= 0) then
159 +       call createMixingMap()
160 +    end if
161 +
162 +  end subroutine setLJDefaultCutoff
163 +
164    function getSigma(atid) result (s)
165      integer, intent(in) :: atid
166 <    integer :: localError
166 >    integer :: ljt1
167      real(kind=dp) :: s
168  
169 <    if (.not.allocated(ParameterMap)) then
170 <       call handleError("LJ", "no ParameterMap was present before first call of getSigma!")
169 >    if (LJMap%currentLJtype == 0) then
170 >       call handleError("LJ", "No members in LJMap")
171         return
172      end if
173  
174 <    s = ParameterMap(atid)%sigma
174 >    ljt1 = LJMap%atidToLJtype(atid)
175 >    s = LJMap%LJtypes(ljt1)%sigma
176 >
177    end function getSigma
178  
179    function getEpsilon(atid) result (e)
180      integer, intent(in) :: atid
181 <    integer :: localError
181 >    integer :: ljt1
182      real(kind=dp) :: e
183  
184 <    if (.not.allocated(ParameterMap)) then
185 <       call handleError("LJ", "no ParameterMap was present before first call of getEpsilon!")
184 >    if (LJMap%currentLJtype == 0) then
185 >       call handleError("LJ", "No members in LJMap")
186         return
187      end if
188  
189 <    e = ParameterMap(atid)%epsilon
189 >    ljt1 = LJMap%atidToLJtype(atid)
190 >    e = LJMap%LJtypes(ljt1)%epsilon
191 >
192    end function getEpsilon
193  
194 +  subroutine createMixingMap()
195 +    integer :: nLJtypes, i, j
196 +    real ( kind = dp ) :: s1, s2, e1, e2
197 +    real ( kind = dp ) :: rcut6, tp6, tp12
198 +    logical :: isSoftCore1, isSoftCore2, doShift
199  
200 <  subroutine setCutoffLJ(rcut, do_shift, status)
201 <    logical, intent(in):: do_shift
182 <    integer :: status, myStatus
183 <    real(kind=dp) :: rcut
184 <
185 < #define __FORTRAN90
186 < #include "UseTheForce/fSwitchingFunction.h"
187 <
188 <    status = 0
189 <
190 <    LJ_rcut = rcut
191 <    LJ_do_shift = do_shift
192 <    call set_switch(LJ_SWITCH, rcut, rcut)
193 <    have_rcut = .true.
194 <
195 <    return
196 <  end subroutine setCutoffLJ
197 <
198 <  subroutine useGeometricMixing()
199 <    useGeometricDistanceMixing = .true.
200 <    haveMixingMap = .false.
201 <    return
202 <  end subroutine useGeometricMixing
203 <
204 <  subroutine createMixingMap(status)
205 <    integer :: nATIDs
206 <    integer :: status
207 <    integer :: i
208 <    integer :: j
209 <    real ( kind = dp ) :: Sigma_i, Sigma_j
210 <    real ( kind = dp ) :: Epsilon_i, Epsilon_j
211 <    real ( kind = dp ) :: rcut6
212 <    logical :: i_is_LJ, j_is_LJ
213 <
214 <    status = 0
215 <
216 <    if (.not. allocated(ParameterMap)) then
217 <       call handleError("LJ", "no ParameterMap was present before call of createMixingMap!")
218 <       status = -1
200 >    if (LJMap%currentLJtype == 0) then
201 >       call handleError("LJ", "No members in LJMap")
202         return
220    endif
221
222    nATIDs = size(ParameterMap)
223
224    if (nATIDs == 0) then
225       status = -1
226       return
203      end if
204  
205 +    nLJtypes = LJMap%nLJtypes
206 +
207      if (.not. allocated(MixingMap)) then
208 <       allocate(MixingMap(nATIDs, nATIDs))
208 >       allocate(MixingMap(nLJtypes, nLJtypes))
209      endif
210  
211 <    if (.not.have_rcut) then
212 <       status = -1
235 <       return
236 <    endif
211 >    useGeometricDistanceMixing = usesGeometricDistanceMixing()
212 >    do i = 1, nLJtypes
213  
214 <    rcut6 = LJ_rcut**6
214 >       s1 = LJMap%LJtypes(i)%sigma
215 >       e1 = LJMap%LJtypes(i)%epsilon
216 >       isSoftCore1 = LJMap%LJtypes(i)%isSoftCore
217  
218 <    ! This loops through all atypes, even those that don't support LJ forces.
219 <    do i = 1, nATIDs
220 <       call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ)
221 <       if (i_is_LJ) then
222 <          Epsilon_i = ParameterMap(i)%epsilon
223 <          Sigma_i = ParameterMap(i)%sigma
218 >       do j = i, nLJtypes
219 >          
220 >          s2 = LJMap%LJtypes(j)%sigma
221 >          e2 = LJMap%LJtypes(j)%epsilon
222 >          isSoftCore2 = LJMap%LJtypes(j)%isSoftCore
223 >          
224 >          MixingMap(i,j)%isSoftCore = isSoftCore1 .or. isSoftCore2
225  
226 <          ! do self mixing rule
227 <          MixingMap(i,i)%sigma   = Sigma_i          
228 <          MixingMap(i,i)%sigma6  = Sigma_i ** 6          
229 <          MixingMap(i,i)%tp6     = (MixingMap(i,i)%sigma6)/rcut6          
230 <          MixingMap(i,i)%tp12    = (MixingMap(i,i)%tp6) ** 2
231 <          MixingMap(i,i)%epsilon = Epsilon_i          
232 <          MixingMap(i,i)%delta   = -4.0_DP * MixingMap(i,i)%epsilon * &
233 <               (MixingMap(i,i)%tp12 - MixingMap(i,i)%tp6)
255 <          MixingMap(i,i)%soft_pot = ParameterMap(i)%soft_pot
256 <
257 <          do j = i + 1, nATIDs
258 <             call getElementProperty(atypes, j, "is_LennardJones", j_is_LJ)
226 >          ! only the distance parameter uses different mixing policies
227 >          if (useGeometricDistanceMixing) then
228 >             MixingMap(i,j)%sigma = sqrt(s1 * s2)
229 >          else
230 >             MixingMap(i,j)%sigma = 0.5_dp * (s1 + s2)
231 >          endif
232 >          
233 >          MixingMap(i,j)%epsilon = sqrt(e1 * e2)
234  
235 <             if (j_is_LJ) then
261 <                Epsilon_j = ParameterMap(j)%epsilon
262 <                Sigma_j = ParameterMap(j)%sigma
235 >          MixingMap(i,j)%sigmai = 1.0_DP  / (MixingMap(i,j)%sigma)
236  
237 <                ! only the distance parameter uses different mixing policies
238 <                if (useGeometricDistanceMixing) then
239 <                   ! only for OPLS as far as we can tell
240 <                   MixingMap(i,j)%sigma = dsqrt(Sigma_i * Sigma_j)
241 <                else
269 <                   ! everyone else
270 <                   MixingMap(i,j)%sigma = 0.5_dp * (Sigma_i + Sigma_j)
271 <                endif
237 >          if (haveDefaultCutoff) then
238 >             MixingMap(i,j)%shiftedPot = defaultShift
239 >          else
240 >             MixingMap(i,j)%shiftedPot = defaultShift
241 >          endif          
242  
243 <                ! energy parameter is always geometric mean:
244 <                MixingMap(i,j)%epsilon = dsqrt(Epsilon_i * Epsilon_j)
243 >          if (i.ne.j) then
244 >             MixingMap(j,i)%sigma      = MixingMap(i,j)%sigma
245 >             MixingMap(j,i)%epsilon    = MixingMap(i,j)%epsilon
246 >             MixingMap(j,i)%sigmai     = MixingMap(i,j)%sigmai
247 >             MixingMap(j,i)%rCut       = MixingMap(i,j)%rCut
248 >             MixingMap(j,i)%rCutWasSet = MixingMap(i,j)%rCutWasSet
249 >             MixingMap(j,i)%shiftedPot = MixingMap(i,j)%shiftedPot
250 >             MixingMap(j,i)%isSoftCore = MixingMap(i,j)%isSoftCore
251 >          endif
252  
253 <                MixingMap(i,j)%sigma6 = (MixingMap(i,j)%sigma)**6
254 <                MixingMap(i,j)%tp6    = MixingMap(i,j)%sigma6/rcut6
255 <                MixingMap(i,j)%tp12    = (MixingMap(i,j)%tp6) ** 2
279 <
280 <                MixingMap(i,j)%delta = -4.0_DP * MixingMap(i,j)%epsilon * &
281 <                     (MixingMap(i,j)%tp12 - MixingMap(i,j)%tp6)
282 <
283 <                MixingMap(i,j)%soft_pot = ParameterMap(i)%soft_pot .or. ParameterMap(j)%soft_pot
284 <
285 <
286 <                MixingMap(j,i)%sigma   = MixingMap(i,j)%sigma
287 <                MixingMap(j,i)%sigma6  = MixingMap(i,j)%sigma6
288 <                MixingMap(j,i)%tp6     = MixingMap(i,j)%tp6
289 <                MixingMap(j,i)%tp12    = MixingMap(i,j)%tp12
290 <                MixingMap(j,i)%epsilon = MixingMap(i,j)%epsilon
291 <                MixingMap(j,i)%delta   = MixingMap(i,j)%delta
292 <                MixingMap(j,i)%soft_pot   = MixingMap(i,j)%soft_pot
293 <             endif
294 <          end do
295 <       endif
296 <    end do
297 <
253 >       enddo
254 >    enddo
255 >    
256      haveMixingMap = .true.
257 <
257 >    
258    end subroutine createMixingMap
259 <
260 <  subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, &
259 >          
260 >  subroutine do_lj_pair(atom1, atom2, d, rij, r2, rcut, sw, vpair, fpair, &
261         pot, f, do_pot)
262 <
262 >    
263      integer, intent(in) ::  atom1, atom2
264 <    real( kind = dp ), intent(in) :: rij, r2
264 >    integer :: atid1, atid2, ljt1, ljt2
265 >    real( kind = dp ), intent(in) :: rij, r2, rcut
266      real( kind = dp ) :: pot, sw, vpair
267      real( kind = dp ), dimension(3,nLocal) :: f    
268      real( kind = dp ), intent(in), dimension(3) :: d
# Line 313 | Line 272 | contains
272      ! local Variables
273      real( kind = dp ) :: drdx, drdy, drdz
274      real( kind = dp ) :: fx, fy, fz
275 +    real( kind = dp ) :: myPot, myPotC, myDeriv, myDerivC, ros, rcos
276      real( kind = dp ) :: pot_temp, dudr
277 <    real( kind = dp ) :: sigma6
277 >    real( kind = dp ) :: sigmai
278      real( kind = dp ) :: epsilon
279 <    real( kind = dp ) :: r6
320 <    real( kind = dp ) :: t6
321 <    real( kind = dp ) :: t12
322 <    real( kind = dp ) :: delta
323 <    logical :: soft_pot
279 >    logical :: isSoftCore, shiftedPot
280      integer :: id1, id2, localError
281  
282      if (.not.haveMixingMap) then
283 <       localError = 0
328 <       call createMixingMap(localError)
329 <       if ( localError .ne. 0 ) then
330 <          call handleError("LJ", "MixingMap creation failed!")
331 <          return
332 <       end if
283 >       call createMixingMap()
284      endif
285  
286      ! Look up the correct parameters in the mixing matrix
287   #ifdef IS_MPI
288 <    sigma6   = MixingMap(atid_Row(atom1),atid_Col(atom2))%sigma6
289 <    epsilon  = MixingMap(atid_Row(atom1),atid_Col(atom2))%epsilon
339 <    delta    = MixingMap(atid_Row(atom1),atid_Col(atom2))%delta
340 <    soft_pot =  MixingMap(atid_Row(atom1),atid_Col(atom2))%soft_pot
288 >    atid1 = atid_Row(atom1)
289 >    atid2 = atid_Col(atom2)
290   #else
291 <    sigma6   = MixingMap(atid(atom1),atid(atom2))%sigma6
292 <    epsilon  = MixingMap(atid(atom1),atid(atom2))%epsilon
344 <    delta    = MixingMap(atid(atom1),atid(atom2))%delta
345 <    soft_pot    = MixingMap(atid(atom1),atid(atom2))%soft_pot
291 >    atid1 = atid(atom1)
292 >    atid2 = atid(atom2)
293   #endif
294  
295 <    r6 = r2 * r2 * r2
295 >    ljt1 = LJMap%atidToLJtype(atid1)
296 >    ljt2 = LJMap%atidToLJtype(atid2)
297  
298 <    t6  = sigma6/ r6
299 <    t12 = t6 * t6    
298 >    sigmai     = MixingMap(ljt1,ljt2)%sigmai
299 >    epsilon    = MixingMap(ljt1,ljt2)%epsilon
300 >    isSoftCore = MixingMap(ljt1,ljt2)%isSoftCore
301 >    shiftedPot = MixingMap(ljt1,ljt2)%shiftedPot
302  
303 <    if (soft_pot) then
304 <       pot_temp = 4.0E0_DP * epsilon * t12
355 <       if (LJ_do_shift) then
356 <          pot_temp = pot_temp + delta
357 <       endif
303 >    ros = rij * sigmai
304 >    myPotC = 0.0_DP
305  
306 <       vpair = vpair + pot_temp
306 >    if (isSoftCore) then
307  
308 <       dudr = sw * 24.0E0_DP * epsilon * (-2.0E0_DP)*t12 / rij
308 >       call getSoftFunc(ros, myPot, myDeriv)
309  
310 <    else
311 <       pot_temp = 4.0E0_DP * epsilon * (t12 - t6)
312 <       if (LJ_do_shift) then
366 <          pot_temp = pot_temp + delta
310 >       if (shiftedPot) then
311 >          rcos = rcut * sigmai
312 >          call getSoftFunc(rcos, myPotC, myDerivC)
313         endif
314 +              
315 +    else
316  
317 <       vpair = vpair + pot_temp
317 >       call getLJfunc(ros, myPot, myDeriv)
318  
319 <       dudr = sw * 24.0E0_DP * epsilon * (t6 - 2.0E0_DP*t12) / rij
319 >       if (shiftedPot) then
320 >          rcos = rcut * sigmai
321 >          call getLJfunc(rcos, myPotC, myDerivC)
322 >       endif
323 >      
324      endif
325  
326 +    pot_temp = epsilon * (myPot - myPotC)
327 +    vpair = vpair + pot_temp
328 +    dudr = sw * epsilon * myDeriv * sigmai
329 +
330      drdx = d(1) / rij
331      drdy = d(2) / rij
332      drdz = d(3) / rij
# Line 379 | Line 335 | contains
335      fy = dudr * drdy
336      fz = dudr * drdz
337  
382
338   #ifdef IS_MPI
339      if (do_pot) then
340 <       pot_Row(atom1) = pot_Row(atom1) + sw*pot_temp*0.5
341 <       pot_Col(atom2) = pot_Col(atom2) + sw*pot_temp*0.5
340 >       pot_Row(VDW_POT,atom1) = pot_Row(VDW_POT,atom1) + sw*pot_temp*0.5
341 >       pot_Col(VDW_POT,atom2) = pot_Col(VDW_POT,atom2) + sw*pot_temp*0.5
342      endif
343  
344      f_Row(1,atom1) = f_Row(1,atom1) + fx
# Line 427 | Line 382 | contains
382    end subroutine do_lj_pair
383  
384    subroutine destroyLJTypes()
385 <    if(allocated(ParameterMap)) deallocate(ParameterMap)
386 <    if(allocated(MixingMap)) deallocate(MixingMap)
385 >
386 >    LJMap%nLJtypes = 0
387 >    LJMap%currentLJtype = 0
388 >    
389 >    if (associated(LJMap%LJtypes)) then
390 >       deallocate(LJMap%LJtypes)
391 >       LJMap%LJtypes => null()
392 >    end if
393 >    
394 >    if (associated(LJMap%atidToLJtype)) then
395 >       deallocate(LJMap%atidToLJtype)
396 >       LJMap%atidToLJtype => null()
397 >    end if
398 >    
399      haveMixingMap = .false.
400 +
401    end subroutine destroyLJTypes
402  
403 +  subroutine getLJfunc(r, myPot, myDeriv)
404  
405 +    real(kind=dp), intent(in) :: r
406 +    real(kind=dp), intent(inout) :: myPot, myDeriv
407 +    real(kind=dp) :: ri, ri2, ri6, ri7, ri12, ri13
408 +    real(kind=dp) :: a, b, c, d, dx
409 +    integer :: j
410 +
411 +    ri = 1.0_DP / r
412 +    ri2 = ri*ri
413 +    ri6 = ri2*ri2*ri2
414 +    ri7 = ri6*ri
415 +    ri12 = ri6*ri6
416 +    ri13 = ri12*ri
417 +    
418 +    myPot = 4.0_DP * (ri12 - ri6)
419 +    myDeriv = 24.0_DP * (ri7 - 2.0_DP * ri13)
420 +    
421 +    return
422 +  end subroutine getLJfunc
423 +
424 +  subroutine getSoftFunc(r, myPot, myDeriv)
425 +    
426 +    real(kind=dp), intent(in) :: r
427 +    real(kind=dp), intent(inout) :: myPot, myDeriv
428 +    real(kind=dp) :: ri, ri2, ri6, ri7
429 +    real(kind=dp) :: a, b, c, d, dx
430 +    integer :: j
431 +    
432 +    ri = 1.0_DP / r    
433 +    ri2 = ri*ri
434 +    ri6 = ri2*ri2*ri2
435 +    ri7 = ri6*ri
436 +    myPot = 4.0_DP * (ri6)
437 +    myDeriv = - 24.0_DP * ri7
438 +    
439 +    return
440 +  end subroutine getSoftFunc
441 +
442   end module lj

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines