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.19 2004-05-11 21:31:14 gezelter Exp $, $Date: 2004-05-11 21:31:14 $, $Name: not supported by cvs2svn $, $Revision: 1.19 $ |
5 |
> |
!! @version $Id: calc_LJ_FF.F90,v 1.22 2004-06-01 21:45:22 gezelter Exp $, $Date: 2004-06-01 21:45:22 $, $Name: not supported by cvs2svn $, $Revision: 1.22 $ |
6 |
|
|
7 |
|
module lj |
8 |
|
use definitions |
122 |
|
real ( kind = dp ) :: mySigma_i,mySigma_j |
123 |
|
real ( kind = dp ) :: myEpsilon_i,myEpsilon_j |
124 |
|
real ( kind = dp ) :: rcut6 |
125 |
+ |
logical :: I_isLJ, J_isLJ |
126 |
|
status = 0 |
127 |
|
|
128 |
|
nAtypes = getSize(atypes) |
140 |
|
! This loops through all atypes, even those that don't support LJ forces. |
141 |
|
do i = 1, nAtypes |
142 |
|
|
143 |
< |
call getElementProperty(atypes, i, "lj_epsilon", myEpsilon_i) |
143 |
< |
call getElementProperty(atypes, i, "lj_sigma", mySigma_i) |
144 |
< |
! do self mixing rule |
145 |
< |
ljMixed(i,i)%sigma = mySigma_i |
146 |
< |
|
147 |
< |
ljMixed(i,i)%sigma6 = (ljMixed(i,i)%sigma) ** 6 |
143 |
> |
call getElementProperty(atypes, i, "is_LJ", I_isLJ) |
144 |
|
|
145 |
< |
ljMixed(i,i)%tp6 = (ljMixed(i,i)%sigma6)/rcut6 |
145 |
> |
if (I_isLJ) then |
146 |
|
|
147 |
< |
ljMixed(i,i)%tp12 = (ljMixed(i,i)%tp6) ** 2 |
148 |
< |
|
149 |
< |
|
150 |
< |
ljMixed(i,i)%epsilon = myEpsilon_i |
155 |
< |
|
156 |
< |
ljMixed(i,i)%delta = -4.0_DP * ljMixed(i,i)%epsilon * & |
157 |
< |
(ljMixed(i,i)%tp12 - ljMixed(i,i)%tp6) |
158 |
< |
|
159 |
< |
do j = i + 1, nAtypes |
160 |
< |
call getElementProperty(atypes,j,"lj_epsilon",myEpsilon_j) |
161 |
< |
call getElementProperty(atypes,j,"lj_sigma", mySigma_j) |
147 |
> |
call getElementProperty(atypes, i, "lj_epsilon", myEpsilon_i) |
148 |
> |
call getElementProperty(atypes, i, "lj_sigma", mySigma_i) |
149 |
> |
! do self mixing rule |
150 |
> |
ljMixed(i,i)%sigma = mySigma_i |
151 |
|
|
152 |
< |
ljMixed(i,j)%sigma = & |
164 |
< |
calcLJMix("sigma",mySigma_i, & |
165 |
< |
mySigma_j) |
152 |
> |
ljMixed(i,i)%sigma6 = (ljMixed(i,i)%sigma) ** 6 |
153 |
|
|
154 |
< |
ljMixed(i,j)%sigma6 = & |
168 |
< |
(ljMixed(i,j)%sigma)**6 |
154 |
> |
ljMixed(i,i)%tp6 = (ljMixed(i,i)%sigma6)/rcut6 |
155 |
|
|
156 |
+ |
ljMixed(i,i)%tp12 = (ljMixed(i,i)%tp6) ** 2 |
157 |
|
|
171 |
– |
ljMixed(i,j)%tp6 = ljMixed(i,j)%sigma6/rcut6 |
158 |
|
|
159 |
< |
ljMixed(i,j)%tp12 = (ljMixed(i,j)%tp6) ** 2 |
159 |
> |
ljMixed(i,i)%epsilon = myEpsilon_i |
160 |
|
|
161 |
+ |
ljMixed(i,i)%delta = -4.0_DP * ljMixed(i,i)%epsilon * & |
162 |
+ |
(ljMixed(i,i)%tp12 - ljMixed(i,i)%tp6) |
163 |
|
|
164 |
< |
ljMixed(i,j)%epsilon = & |
165 |
< |
calcLJMix("epsilon",myEpsilon_i, & |
166 |
< |
myEpsilon_j) |
167 |
< |
|
168 |
< |
ljMixed(i,j)%delta = -4.0_DP * ljMixed(i,j)%epsilon * & |
169 |
< |
(ljMixed(i,j)%tp12 - ljMixed(i,j)%tp6) |
170 |
< |
|
171 |
< |
|
172 |
< |
ljMixed(j,i)%sigma = ljMixed(i,j)%sigma |
173 |
< |
ljMixed(j,i)%sigma6 = ljMixed(i,j)%sigma6 |
174 |
< |
ljMixed(j,i)%tp6 = ljMixed(i,j)%tp6 |
175 |
< |
ljMixed(j,i)%tp12 = ljMixed(i,j)%tp12 |
176 |
< |
ljMixed(j,i)%epsilon = ljMixed(i,j)%epsilon |
177 |
< |
ljMixed(j,i)%delta = ljMixed(i,j)%delta |
178 |
< |
|
179 |
< |
end do |
164 |
> |
do j = i + 1, nAtypes |
165 |
> |
|
166 |
> |
call getElementProperty(atypes, j, "is_LJ", J_isLJ) |
167 |
> |
|
168 |
> |
if (J_isLJ) then |
169 |
> |
|
170 |
> |
call getElementProperty(atypes,j,"lj_epsilon",myEpsilon_j) |
171 |
> |
call getElementProperty(atypes,j,"lj_sigma", mySigma_j) |
172 |
> |
|
173 |
> |
ljMixed(i,j)%sigma = & |
174 |
> |
calcLJMix("sigma",mySigma_i, & |
175 |
> |
mySigma_j) |
176 |
> |
|
177 |
> |
ljMixed(i,j)%sigma6 = & |
178 |
> |
(ljMixed(i,j)%sigma)**6 |
179 |
> |
|
180 |
> |
|
181 |
> |
ljMixed(i,j)%tp6 = ljMixed(i,j)%sigma6/rcut6 |
182 |
> |
|
183 |
> |
ljMixed(i,j)%tp12 = (ljMixed(i,j)%tp6) ** 2 |
184 |
> |
|
185 |
> |
|
186 |
> |
ljMixed(i,j)%epsilon = & |
187 |
> |
calcLJMix("epsilon",myEpsilon_i, & |
188 |
> |
myEpsilon_j) |
189 |
> |
|
190 |
> |
ljMixed(i,j)%delta = -4.0_DP * ljMixed(i,j)%epsilon * & |
191 |
> |
(ljMixed(i,j)%tp12 - ljMixed(i,j)%tp6) |
192 |
> |
|
193 |
> |
|
194 |
> |
ljMixed(j,i)%sigma = ljMixed(i,j)%sigma |
195 |
> |
ljMixed(j,i)%sigma6 = ljMixed(i,j)%sigma6 |
196 |
> |
ljMixed(j,i)%tp6 = ljMixed(i,j)%tp6 |
197 |
> |
ljMixed(j,i)%tp12 = ljMixed(i,j)%tp12 |
198 |
> |
ljMixed(j,i)%epsilon = ljMixed(i,j)%epsilon |
199 |
> |
ljMixed(j,i)%delta = ljMixed(i,j)%delta |
200 |
> |
endif |
201 |
> |
end do |
202 |
> |
endif |
203 |
|
end do |
204 |
|
|
205 |
|
end subroutine createMixingList |
206 |
|
|
207 |
< |
subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, pot, f, & |
208 |
< |
do_pot, do_stress) |
207 |
> |
subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
208 |
> |
pot, f, do_pot) |
209 |
|
|
210 |
|
integer, intent(in) :: atom1, atom2 |
211 |
|
real( kind = dp ), intent(in) :: rij, r2 |
212 |
|
real( kind = dp ) :: pot, sw, vpair |
213 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
214 |
|
real( kind = dp ), intent(in), dimension(3) :: d |
215 |
< |
logical, intent(in) :: do_pot, do_stress |
215 |
> |
real( kind = dp ), intent(inout), dimension(3) :: fpair |
216 |
> |
logical, intent(in) :: do_pot |
217 |
|
|
218 |
|
! local Variables |
219 |
|
real( kind = dp ) :: drdx, drdy, drdz |
286 |
|
f(2,atom2) = f(2,atom2) - fy |
287 |
|
f(3,atom2) = f(3,atom2) - fz |
288 |
|
#endif |
289 |
< |
|
278 |
< |
if (do_stress) then |
279 |
< |
|
289 |
> |
|
290 |
|
#ifdef IS_MPI |
291 |
< |
id1 = tagRow(atom1) |
292 |
< |
id2 = tagColumn(atom2) |
291 |
> |
id1 = AtomRowToGlobal(atom1) |
292 |
> |
id2 = AtomColToGlobal(atom2) |
293 |
|
#else |
294 |
< |
id1 = atom1 |
295 |
< |
id2 = atom2 |
294 |
> |
id1 = atom1 |
295 |
> |
id2 = atom2 |
296 |
|
#endif |
297 |
+ |
|
298 |
+ |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
299 |
|
|
300 |
< |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
301 |
< |
|
302 |
< |
! because the d vector is the rj - ri vector, and |
303 |
< |
! because fx, fy, fz are the force on atom i, we need a |
292 |
< |
! negative sign here: |
293 |
< |
|
294 |
< |
tau_Temp(1) = tau_Temp(1) - d(1) * fx |
295 |
< |
tau_Temp(2) = tau_Temp(2) - d(1) * fy |
296 |
< |
tau_Temp(3) = tau_Temp(3) - d(1) * fz |
297 |
< |
tau_Temp(4) = tau_Temp(4) - d(2) * fx |
298 |
< |
tau_Temp(5) = tau_Temp(5) - d(2) * fy |
299 |
< |
tau_Temp(6) = tau_Temp(6) - d(2) * fz |
300 |
< |
tau_Temp(7) = tau_Temp(7) - d(3) * fx |
301 |
< |
tau_Temp(8) = tau_Temp(8) - d(3) * fy |
302 |
< |
tau_Temp(9) = tau_Temp(9) - d(3) * fz |
303 |
< |
|
304 |
< |
virial_Temp = virial_Temp + & |
305 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
306 |
< |
|
307 |
< |
endif |
300 |
> |
fpair(1) = fpair(1) + fx |
301 |
> |
fpair(2) = fpair(2) + fy |
302 |
> |
fpair(3) = fpair(3) + fz |
303 |
> |
|
304 |
|
endif |
305 |
< |
|
305 |
> |
|
306 |
|
return |
307 |
|
|
308 |
|
end subroutine do_lj_pair |