2 |
|
!! Corresponds to the force field defined in lj_FF.cpp |
3 |
|
!! @author Charles F. Vardeman II |
4 |
|
!! @author Matthew Meineke |
5 |
< |
!! @version $Id: calc_LJ_FF.F90,v 1.6 2003-03-12 15:39:01 gezelter Exp $, $Date: 2003-03-12 15:39:01 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $ |
5 |
> |
!! @version $Id: calc_LJ_FF.F90,v 1.7 2003-03-12 19:31:55 gezelter Exp $, $Date: 2003-03-12 19:31:55 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $ |
6 |
|
|
7 |
|
module lj |
8 |
|
use simulation |
15 |
|
#endif |
16 |
|
implicit none |
17 |
|
PRIVATE |
18 |
+ |
|
19 |
+ |
integer, save :: LJ_Mixing_Policy |
20 |
+ |
integer, parameter :: LB_Mixing_Rule = 1 |
21 |
+ |
integer, parameter :: Explicit_Mixing_Rule = 2 |
22 |
|
|
23 |
|
!! Logical has lj force field module been initialized? |
20 |
– |
logical, save :: isljFFinit = .false. |
24 |
|
|
25 |
+ |
logical, save :: LJ_FF_initialized = .false. |
26 |
+ |
|
27 |
|
!! Public methods and data |
28 |
< |
public :: init_ljFF |
28 |
> |
public :: init_LJ_FF |
29 |
|
public :: do_lj_pair |
30 |
|
|
31 |
|
type :: lj_mixed_params |
47 |
|
|
48 |
|
contains |
49 |
|
|
50 |
< |
subroutine init_ljFF(status) |
50 |
> |
subroutine init_LJ_FF(mix_Policy, status) |
51 |
> |
character(len=100), intent(in) :: mix_Policy |
52 |
|
integer, intent(out) :: status |
53 |
|
integer :: myStatus |
54 |
|
|
55 |
+ |
if ((mix_Policy == "standard") .or. (mix_Policy == "LB")) then |
56 |
+ |
LJ_Mixing_Policy = LB_Mixing_Rule |
57 |
+ |
else |
58 |
+ |
if (mix_Policy == "explicit") then |
59 |
+ |
LJ_Mixing_Policy = Explicit_Mixing_Rule |
60 |
+ |
else |
61 |
+ |
write(*,*) 'Unknown Mixing Policy!' |
62 |
+ |
status = -1 |
63 |
+ |
return |
64 |
+ |
endif |
65 |
+ |
endif |
66 |
+ |
|
67 |
|
status = 0 |
68 |
|
call createMixingList(myStatus) |
69 |
|
if (myStatus /= 0) then |
71 |
|
return |
72 |
|
end if |
73 |
|
|
74 |
< |
end subroutine init_ljFF |
74 |
> |
LJ_FF_initialized = .true. |
75 |
> |
|
76 |
> |
end subroutine init_LJ_FF |
77 |
|
|
78 |
|
subroutine createMixingList(status) |
79 |
|
integer :: nAtypes |
97 |
|
status = -1 |
98 |
|
return |
99 |
|
end if |
100 |
< |
call getRcut(rcut, rcut6=rcut6) |
100 |
> |
call getRcut(rcut, rc6=rcut6) |
101 |
|
do i = 1, nAtypes |
102 |
|
|
103 |
|
call getElementProperty(atypes,i,"lj_epsilon",myEpsilon_i) |
153 |
|
end subroutine createMixingList |
154 |
|
|
155 |
|
|
156 |
< |
subroutine do_lj_pair(atom1, atom2, d, rij, r2, pot, f) |
156 |
> |
subroutine do_lj_pair(atom1, atom2, d, rij, r2, pot, f, do_pot, do_stress) |
157 |
|
|
158 |
|
integer, intent(in) :: atom1, atom2 |
159 |
|
real( kind = dp ), intent(in) :: rij, r2 |
160 |
|
real( kind = dp ) :: pot |
161 |
|
real( kind = dp ), dimension(3, getNlocal()) :: f |
162 |
|
real( kind = dp ), intent(in), dimension(3) :: d |
163 |
+ |
logical, intent(in) :: do_pot, do_stress |
164 |
|
|
165 |
|
! local Variables |
166 |
|
real( kind = dp ) :: drdx, drdy, drdz |
207 |
|
fz = dudr * drdz |
208 |
|
|
209 |
|
#ifdef IS_MPI |
210 |
< |
pot_Row(atom1) = pot_Row(atom1) + pot_temp*0.5 |
211 |
< |
pot_Col(atom2) = pot_Col(atom2) + pot_temp*0.5 |
210 |
> |
if (do_pot) then |
211 |
> |
pot_Row(atom1) = pot_Row(atom1) + pot_temp*0.5 |
212 |
> |
pot_Col(atom2) = pot_Col(atom2) + pot_temp*0.5 |
213 |
> |
endif |
214 |
|
|
215 |
|
f_Row(1,atom1) = f_Row(1,atom1) + fx |
216 |
|
f_Row(2,atom1) = f_Row(2,atom1) + fy |
221 |
|
f_Col(3,atom2) = f_Col(3,atom2) - fz |
222 |
|
|
223 |
|
#else |
224 |
< |
pot = pot + pot_temp |
224 |
> |
if (do_pot) pot = pot + pot_temp |
225 |
|
|
226 |
|
f(1,atom1) = f(1,atom1) + fx |
227 |
|
f(2,atom1) = f(2,atom1) + fy |
232 |
|
f(3,atom2) = f(3,atom2) - fz |
233 |
|
#endif |
234 |
|
|
235 |
< |
if (doStress()) then |
235 |
> |
if (do_stress) then |
236 |
|
tau_Temp(1) = tau_Temp(1) + fx * d(1) |
237 |
|
tau_Temp(2) = tau_Temp(2) + fx * d(2) |
238 |
|
tau_Temp(3) = tau_Temp(3) + fx * d(3) |
250 |
|
end subroutine do_lj_pair |
251 |
|
|
252 |
|
|
253 |
< |
!! Calculates the mixing for sigma or epslon based on character |
254 |
< |
!! string for initialzition of mixing array. |
253 |
> |
!! Calculates the mixing for sigma or epslon |
254 |
> |
|
255 |
|
function calcLJMix(thisParam,param1,param2,status) result(myMixParam) |
256 |
|
character(len=*) :: thisParam |
257 |
|
real(kind = dp) :: param1 |
258 |
|
real(kind = dp) :: param2 |
259 |
|
real(kind = dp ) :: myMixParam |
260 |
< |
character(len = getStringLen()) :: thisMixingRule |
261 |
< |
integer, optional :: status |
262 |
< |
|
240 |
< |
!! get the mixing rules from the simulation |
241 |
< |
thisMixingRule = returnMixingRules() |
260 |
> |
|
261 |
> |
integer, optional :: status |
262 |
> |
|
263 |
|
myMixParam = 0.0_dp |
264 |
|
|
265 |
|
if (present(status)) status = 0 |
266 |
< |
select case (thisMixingRule) |
267 |
< |
case ("standard") |
266 |
> |
select case (LJ_Mixing_Policy) |
267 |
> |
case (LB_Mixing_Rule) |
268 |
|
select case (thisParam) |
269 |
|
case ("sigma") |
270 |
|
myMixParam = 0.5_dp * (param1 + param2) |
273 |
|
case default |
274 |
|
status = -1 |
275 |
|
end select |
255 |
– |
case("LJglass") |
276 |
|
case default |
277 |
|
status = -1 |
278 |
|
end select |