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