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

Comparing branches/new_design/OOPSE-4/src/UseTheForce/DarkSide/LJ.F90 (file contents):
Revision 1847 by tim, Sat Dec 4 00:01:32 2004 UTC vs.
Revision 1848 by gezelter, Sat Dec 4 19:24:05 2004 UTC

# Line 1 | Line 1
1   !! Calculates Long Range forces Lennard-Jones interactions.
2   !! @author Charles F. Vardeman II
3   !! @author Matthew Meineke
4 < !! @version $Id: LJ.F90,v 1.4.2.1 2004-12-04 00:01:32 tim Exp $, $Date: 2004-12-04 00:01:32 $, $Name: not supported by cvs2svn $, $Revision: 1.4.2.1 $
4 > !! @version $Id: LJ.F90,v 1.4.2.2 2004-12-04 19:24:05 gezelter Exp $, $Date: 2004-12-04 19:24:05 $, $Name: not supported by cvs2svn $, $Revision: 1.4.2.2 $
5  
6   module lj
7    use atype_module
# Line 20 | Line 20 | module lj
20    integer, parameter :: DP = selected_real_kind(15)
21    
22    type, private :: LjType
23 <     integer :: ident
23 >     integer :: c_ident
24 >     integer :: atid
25       real(kind=dp) :: sigma
26       real(kind=dp) :: epsilon
27    end type LjType
# Line 56 | Line 57 | contains
57    
58   contains
59  
60 <  subroutine newLJtype(ident, sigma, epsilon, status)
61 <    integer,intent(in) :: ident
60 >  subroutine newLJtype(c_ident, sigma, epsilon, status)
61 >    integer,intent(in) :: c_ident
62      real(kind=dp),intent(in) :: sigma
63      real(kind=dp),intent(in) :: epsilon
64      integer,intent(out) :: status
65 <    integer :: nAtypes
65 >    integer :: nLJTypes, myATID
66 >    integer, pointer :: MatchList(:) => null()
67  
68      status = 0
69      
70 <    !! Be simple-minded and assume that we need a ParameterMap that
69 <    !! is the same size as the total number of atom types
70 >    myATID = getFirstMatchingElement(atypes, "c_ident", c_ident)
71  
72      if (.not.allocated(ParameterMap)) then
73        
74 <       nAtypes = getSize(atypes)
74 >       call getMatchingElementList(atypes, "is_LennardJones", .true., &
75 >            nLJTypes, MatchList)
76      
77 <       if (nAtypes == 0) then
77 >       if (nLJtypes == 0) then
78            status = -1
79            return
80         end if
81        
82         if (.not. allocated(ParameterMap)) then
83 <          allocate(ParameterMap(nAtypes))
83 >          allocate(ParameterMap(nLJtypes))
84         endif
85        
86      end if
87  
88 <    if (ident .gt. size(ParameterMap)) then
88 >    if (myATID .gt. size(ParameterMap)) then
89         status = -1
90         return
91      endif
92      
93      ! set the values for ParameterMap for this atom type:
94  
95 <    ParameterMap(ident)%ident = ident
96 <    ParameterMap(ident)%epsilon = epsilon
97 <    ParameterMap(ident)%sigma = sigma
95 >    ParameterMap(myATID)%c_ident = c_ident
96 >    ParameterMap(myATID)%atid = myATID
97 >    ParameterMap(myATID)%epsilon = epsilon
98 >    ParameterMap(myATID)%sigma = sigma
99      
100    end subroutine newLJtype
101  
# Line 115 | Line 118 | contains
118      real(kind=dp) :: e
119      
120      if (.not.allocated(ParameterMap)) then
121 <       call handleError("dipole-dipole", "no ParameterMap was present before first call of getEpsilon!")
121 >       call handleError("LJ", "no ParameterMap was present before first call of getEpsilon!")
122         return
123      end if
124      
# Line 148 | Line 151 | contains
151    end subroutine useGeometricMixing
152    
153    subroutine createMixingMap(status)
154 <    integer :: nAtypes
154 >    integer :: nATIDs
155      integer :: status
156      integer :: i
157      integer :: j
# Line 158 | Line 161 | contains
161  
162      status = 0
163      
164 <    nAtypes = size(ParameterMap)
164 >    nATIDs = size(ParameterMap)
165      
166 <    if (nAtypes == 0) then
166 >    if (nATIDs == 0) then
167         status = -1
168         return
169      end if
# Line 171 | Line 174 | contains
174      endif
175      
176      if (.not. allocated(MixingMap)) then
177 <       allocate(MixingMap(nAtypes, nAtypes))
177 >       allocate(MixingMap(nATIDs, nATIDs))
178      endif
179      
180      rcut6 = LJ_rcut**6
181      
182      ! This loops through all atypes, even those that don't support LJ forces.
183 <    do i = 1, nAtypes
183 >    do i = 1, nATIDs
184        
185         Epsilon_i = ParameterMap(i)%epsilon
186         Sigma_i = ParameterMap(i)%sigma
# Line 191 | Line 194 | contains
194         MixingMap(i,i)%delta   = -4.0_DP * MixingMap(i,i)%epsilon * &
195              (MixingMap(i,i)%tp12 - MixingMap(i,i)%tp6)
196        
197 <       do j = i + 1, nAtypes
197 >       do j = i + 1, nATIDs
198            
199            Epsilon_j = ParameterMap(j)%epsilon
200            Sigma_j = ParameterMap(j)%sigma
# Line 346 | Line 349 | subroutine newLJtype(ident, sigma, epsilon, status)
349      
350   end module lj
351  
352 < subroutine newLJtype(ident, sigma, epsilon, status)
352 > subroutine newLJtype(c_ident, sigma, epsilon, status)
353    use lj, ONLY : module_newLJtype => newLJtype
354    integer, parameter :: DP = selected_real_kind(15)
355 <  integer,intent(inout) :: ident
355 >  integer,intent(inout) :: c_ident
356    real(kind=dp),intent(inout) :: sigma
357    real(kind=dp),intent(inout) :: epsilon
358    integer,intent(inout) :: status
359    
360 <  call module_newLJtype(ident, sigma, epsilon, status)
360 >  call module_newLJtype(c_ident, sigma, epsilon, status)
361    
362   end subroutine newLJtype
363  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines