2 |
|
!! Corresponds to the force field defined in lj_FF.cpp |
3 |
|
!! @author Charles F. Vardeman II |
4 |
|
!! @author Matthew Meineke |
5 |
< |
!! @version $Id: LJ.F90,v 1.1 2004-10-20 04:02:48 gezelter Exp $, $Date: 2004-10-20 04:02:48 $, $Name: not supported by cvs2svn $, $Revision: 1.1 $ |
5 |
> |
!! @version $Id: LJ.F90,v 1.2 2004-10-21 15:25:30 chuckv Exp $, $Date: 2004-10-21 15:25:30 $, $Name: not supported by cvs2svn $, $Revision: 1.2 $ |
6 |
|
|
7 |
|
module lj |
8 |
– |
use definitions |
8 |
|
use atype_module |
9 |
|
use switcheroo |
10 |
|
use vector_class |
16 |
|
|
17 |
|
implicit none |
18 |
|
PRIVATE |
19 |
+ |
|
20 |
+ |
integer, parameter :: DP = selected_real_kind(15) |
21 |
|
|
22 |
|
#define __FORTRAN90 |
23 |
|
#include "UseTheForce/fForceField.h" |
36 |
|
public :: init_LJ_FF |
37 |
|
public :: setCutoffLJ |
38 |
|
public :: do_lj_pair |
39 |
+ |
public :: newLJtype |
40 |
|
|
41 |
+ |
!! structure for lj type parameters |
42 |
+ |
type, private :: ljType |
43 |
+ |
integer :: lj_ident |
44 |
+ |
real(kind=dp) :: lj_sigma |
45 |
+ |
real(kind=dp) :: lj_epsilon |
46 |
+ |
end type ljType |
47 |
+ |
|
48 |
+ |
!! List of lj type parameters |
49 |
+ |
type, private :: ljTypeList |
50 |
+ |
integer :: n_lj_types = 0 |
51 |
+ |
integer :: currentAddition = 0 |
52 |
+ |
type(ljType), pointer :: ljParams(:) => null() |
53 |
+ |
end type ljTypeList |
54 |
+ |
|
55 |
+ |
!! The list of lj Parameters |
56 |
+ |
type (ljTypeList), save :: ljParameterList |
57 |
+ |
|
58 |
+ |
|
59 |
|
type :: lj_mixed_params |
60 |
|
!! Lennard-Jones epsilon |
61 |
|
real ( kind = dp ) :: epsilon = 0.0_dp |
71 |
|
|
72 |
|
type (lj_mixed_params), dimension(:,:), pointer :: ljMixed |
73 |
|
|
74 |
+ |
|
75 |
+ |
|
76 |
|
contains |
77 |
|
|
78 |
+ |
subroutine newLJtype(ident,lj_sigma,lj_epsilon,status) |
79 |
+ |
integer,intent(in) :: ident |
80 |
+ |
real(kind=dp),intent(in) :: lj_sigma |
81 |
+ |
real(kind=dp),intent(in) :: lj_epsilon |
82 |
+ |
integer,intent(out) :: status |
83 |
+ |
|
84 |
+ |
integer,pointer :: Matchlist(:) => null() |
85 |
+ |
integer :: current |
86 |
+ |
integer :: nAtypes |
87 |
+ |
status = 0 |
88 |
+ |
|
89 |
+ |
!! Assume that atypes has already been set and get the total number of types in atypes |
90 |
+ |
|
91 |
+ |
|
92 |
+ |
|
93 |
+ |
! check to see if this is the first time into |
94 |
+ |
if (.not.associated(ljParameterList%ljParams)) then |
95 |
+ |
call getMatchingElementList(atypes, "is_lj", .true., nAtypes, MatchList) |
96 |
+ |
ljParameterList%n_lj_types = nAtypes |
97 |
+ |
if (nAtypes == 0) then |
98 |
+ |
status = -1 |
99 |
+ |
return |
100 |
+ |
end if |
101 |
+ |
allocate(ljParameterList%ljParams(nAtypes)) |
102 |
+ |
end if |
103 |
+ |
|
104 |
+ |
ljParameterList%currentAddition = ljParameterList%currentAddition + 1 |
105 |
+ |
current = ljParameterList%currentAddition |
106 |
+ |
|
107 |
+ |
! set the values for ljParameterList |
108 |
+ |
ljParameterList%ljParams(current)%lj_ident = ident |
109 |
+ |
ljParameterList%ljParams(current)%lj_epsilon = lj_epsilon |
110 |
+ |
ljParameterList%ljParams(current)%lj_sigma = lj_sigma |
111 |
+ |
|
112 |
+ |
end subroutine newLJtype |
113 |
+ |
|
114 |
|
subroutine init_LJ_FF(mix_Policy, status) |
115 |
|
integer, intent(in) :: mix_Policy |
116 |
|
integer, intent(out) :: status |
183 |
|
logical :: I_isLJ, J_isLJ |
184 |
|
status = 0 |
185 |
|
|
186 |
< |
nAtypes = getSize(atypes) |
186 |
> |
! we only allocate this array to the number of lj_atypes |
187 |
> |
nAtypes = size(ljParameterList%ljParams) |
188 |
|
if (nAtypes == 0) then |
189 |
|
status = -1 |
190 |
|
return |
199 |
|
! This loops through all atypes, even those that don't support LJ forces. |
200 |
|
do i = 1, nAtypes |
201 |
|
|
202 |
< |
call getElementProperty(atypes, i, "is_LJ", I_isLJ) |
203 |
< |
|
204 |
< |
if (I_isLJ) then |
146 |
< |
|
147 |
< |
call getElementProperty(atypes, i, "lj_epsilon", myEpsilon_i) |
148 |
< |
call getElementProperty(atypes, i, "lj_sigma", mySigma_i) |
202 |
> |
myEpsilon_i = ljParameterList%ljParams(i)%lj_epsilon |
203 |
> |
mySigma_i = ljParameterList%ljParams(i)%lj_sigma |
204 |
> |
|
205 |
|
! do self mixing rule |
206 |
|
ljMixed(i,i)%sigma = mySigma_i |
207 |
|
|
219 |
|
|
220 |
|
do j = i + 1, nAtypes |
221 |
|
|
222 |
< |
call getElementProperty(atypes, j, "is_LJ", J_isLJ) |
223 |
< |
|
224 |
< |
if (J_isLJ) then |
225 |
< |
|
170 |
< |
call getElementProperty(atypes,j,"lj_epsilon",myEpsilon_j) |
171 |
< |
call getElementProperty(atypes,j,"lj_sigma", mySigma_j) |
172 |
< |
|
222 |
> |
myEpsilon_j = ljParameterList%ljParams(j)%lj_epsilon |
223 |
> |
mySigma_j = ljParameterList%ljParams(j)%lj_sigma |
224 |
> |
|
225 |
> |
|
226 |
|
ljMixed(i,j)%sigma = & |
227 |
|
calcLJMix("sigma",mySigma_i, & |
228 |
|
mySigma_j) |
250 |
|
ljMixed(j,i)%tp12 = ljMixed(i,j)%tp12 |
251 |
|
ljMixed(j,i)%epsilon = ljMixed(i,j)%epsilon |
252 |
|
ljMixed(j,i)%delta = ljMixed(i,j)%delta |
253 |
< |
endif |
253 |
> |
|
254 |
|
end do |
202 |
– |
endif |
255 |
|
end do |
256 |
|
|
257 |
|
end subroutine createMixingList |
389 |
|
end function calcLJMix |
390 |
|
|
391 |
|
end module lj |
392 |
+ |
|
393 |
+ |
subroutine newLJtype(ident,lj_sigma,lj_epsilon,status) |
394 |
+ |
use lj, ONLY : module_newLJtype => newLJtype |
395 |
+ |
integer, parameter :: DP = selected_real_kind(15) |
396 |
+ |
integer,intent(inout) :: ident |
397 |
+ |
real(kind=dp),intent(inout) :: lj_sigma |
398 |
+ |
real(kind=dp),intent(inout) :: lj_epsilon |
399 |
+ |
integer,intent(inout) :: status |
400 |
+ |
|
401 |
+ |
call module_newLJtype(ident,lj_sigma,lj_epsilon,status) |
402 |
+ |
|
403 |
+ |
end subroutine newLJtype |
404 |
+ |
|