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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines