1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
+ |
|
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.4 2004-10-22 20:22:47 gezelter Exp $, $Date: 2004-10-22 20:22:47 $, $Name: not supported by cvs2svn $, $Revision: 1.4 $ |
46 |
> |
!! @version $Id: LJ.F90,v 1.6 2005-01-12 22:40:44 gezelter Exp $, $Date: 2005-01-12 22:40:44 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $ |
47 |
|
|
48 |
+ |
|
49 |
|
module lj |
50 |
|
use atype_module |
51 |
|
use switcheroo |
63 |
|
integer, parameter :: DP = selected_real_kind(15) |
64 |
|
|
65 |
|
type, private :: LjType |
66 |
< |
integer :: ident |
66 |
> |
integer :: c_ident |
67 |
> |
integer :: atid |
68 |
|
real(kind=dp) :: sigma |
69 |
|
real(kind=dp) :: epsilon |
70 |
|
end type LjType |
100 |
|
|
101 |
|
contains |
102 |
|
|
103 |
< |
subroutine newLJtype(ident, sigma, epsilon, status) |
104 |
< |
integer,intent(in) :: ident |
103 |
> |
subroutine newLJtype(c_ident, sigma, epsilon, status) |
104 |
> |
integer,intent(in) :: c_ident |
105 |
|
real(kind=dp),intent(in) :: sigma |
106 |
|
real(kind=dp),intent(in) :: epsilon |
107 |
|
integer,intent(out) :: status |
108 |
< |
integer :: nAtypes |
108 |
> |
integer :: nATypes, myATID |
109 |
> |
integer, pointer :: MatchList(:) => null() |
110 |
|
|
111 |
|
status = 0 |
112 |
|
|
113 |
< |
!! Be simple-minded and assume that we need a ParameterMap that |
69 |
< |
!! is the same size as the total number of atom types |
113 |
> |
myATID = getFirstMatchingElement(atypes, "c_ident", c_ident) |
114 |
|
|
115 |
|
if (.not.allocated(ParameterMap)) then |
116 |
|
|
117 |
+ |
!call getMatchingElementList(atypes, "is_LennardJones", .true., & |
118 |
+ |
! nLJTypes, MatchList) |
119 |
|
nAtypes = getSize(atypes) |
74 |
– |
|
120 |
|
if (nAtypes == 0) then |
121 |
|
status = -1 |
122 |
|
return |
128 |
|
|
129 |
|
end if |
130 |
|
|
131 |
< |
if (ident .gt. size(ParameterMap)) then |
131 |
> |
if (myATID .gt. size(ParameterMap)) then |
132 |
|
status = -1 |
133 |
|
return |
134 |
|
endif |
135 |
|
|
136 |
|
! set the values for ParameterMap for this atom type: |
137 |
|
|
138 |
< |
ParameterMap(ident)%ident = ident |
139 |
< |
ParameterMap(ident)%epsilon = epsilon |
140 |
< |
ParameterMap(ident)%sigma = sigma |
138 |
> |
ParameterMap(myATID)%c_ident = c_ident |
139 |
> |
ParameterMap(myATID)%atid = myATID |
140 |
> |
ParameterMap(myATID)%epsilon = epsilon |
141 |
> |
ParameterMap(myATID)%sigma = sigma |
142 |
|
|
143 |
|
end subroutine newLJtype |
144 |
|
|
161 |
|
real(kind=dp) :: e |
162 |
|
|
163 |
|
if (.not.allocated(ParameterMap)) then |
164 |
< |
call handleError("dipole-dipole", "no ParameterMap was present before first call of getEpsilon!") |
164 |
> |
call handleError("LJ", "no ParameterMap was present before first call of getEpsilon!") |
165 |
|
return |
166 |
|
end if |
167 |
|
|
194 |
|
end subroutine useGeometricMixing |
195 |
|
|
196 |
|
subroutine createMixingMap(status) |
197 |
< |
integer :: nAtypes |
197 |
> |
integer :: nATIDs |
198 |
|
integer :: status |
199 |
|
integer :: i |
200 |
|
integer :: j |
204 |
|
|
205 |
|
status = 0 |
206 |
|
|
207 |
< |
nAtypes = size(ParameterMap) |
207 |
> |
nATIDs = size(ParameterMap) |
208 |
|
|
209 |
< |
if (nAtypes == 0) then |
209 |
> |
if (nATIDs == 0) then |
210 |
|
status = -1 |
211 |
|
return |
212 |
|
end if |
217 |
|
endif |
218 |
|
|
219 |
|
if (.not. allocated(MixingMap)) then |
220 |
< |
allocate(MixingMap(nAtypes, nAtypes)) |
220 |
> |
allocate(MixingMap(nATIDs, nATIDs)) |
221 |
|
endif |
222 |
|
|
223 |
|
rcut6 = LJ_rcut**6 |
224 |
|
|
225 |
|
! This loops through all atypes, even those that don't support LJ forces. |
226 |
< |
do i = 1, nAtypes |
226 |
> |
do i = 1, nATIDs |
227 |
|
|
228 |
|
Epsilon_i = ParameterMap(i)%epsilon |
229 |
|
Sigma_i = ParameterMap(i)%sigma |
237 |
|
MixingMap(i,i)%delta = -4.0_DP * MixingMap(i,i)%epsilon * & |
238 |
|
(MixingMap(i,i)%tp12 - MixingMap(i,i)%tp6) |
239 |
|
|
240 |
< |
do j = i + 1, nAtypes |
240 |
> |
do j = i + 1, nATIDs |
241 |
|
|
242 |
|
Epsilon_j = ParameterMap(j)%epsilon |
243 |
|
Sigma_j = ParameterMap(j)%sigma |
271 |
|
end do |
272 |
|
end do |
273 |
|
|
274 |
+ |
haveMixingMap = .true. |
275 |
+ |
|
276 |
|
end subroutine createMixingMap |
277 |
|
|
278 |
|
subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
392 |
|
|
393 |
|
end module lj |
394 |
|
|
395 |
< |
subroutine newLJtype(ident, sigma, epsilon, status) |
395 |
> |
subroutine newLJtype(c_ident, sigma, epsilon, status) |
396 |
|
use lj, ONLY : module_newLJtype => newLJtype |
397 |
|
integer, parameter :: DP = selected_real_kind(15) |
398 |
< |
integer,intent(inout) :: ident |
398 |
> |
integer,intent(inout) :: c_ident |
399 |
|
real(kind=dp),intent(inout) :: sigma |
400 |
|
real(kind=dp),intent(inout) :: epsilon |
401 |
|
integer,intent(inout) :: status |
402 |
|
|
403 |
< |
call module_newLJtype(ident, sigma, epsilon, status) |
403 |
> |
call module_newLJtype(c_ident, sigma, epsilon, status) |
404 |
|
|
405 |
|
end subroutine newLJtype |
406 |
|
|