45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.26 2005-07-29 19:38:27 gezelter Exp $, $Date: 2005-07-29 19:38:27 $, $Name: not supported by cvs2svn $, $Revision: 1.26 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.68 2005-11-15 16:01:06 chuckv Exp $, $Date: 2005-11-15 16:01:06 $, $Name: not supported by cvs2svn $, $Revision: 1.68 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
58 |
|
use lj |
59 |
|
use sticky |
60 |
|
use electrostatic_module |
61 |
< |
use reaction_field |
62 |
< |
use gb_pair |
61 |
> |
use gayberne |
62 |
|
use shapes |
63 |
|
use vector_class |
64 |
|
use eam |
65 |
+ |
use suttonchen |
66 |
|
use status |
67 |
|
#ifdef IS_MPI |
68 |
|
use mpiSimulation |
73 |
|
|
74 |
|
#define __FORTRAN90 |
75 |
|
#include "UseTheForce/fSwitchingFunction.h" |
76 |
+ |
#include "UseTheForce/fCutoffPolicy.h" |
77 |
|
#include "UseTheForce/DarkSide/fInteractionMap.h" |
78 |
+ |
#include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" |
79 |
|
|
80 |
+ |
|
81 |
|
INTEGER, PARAMETER:: PREPAIR_LOOP = 1 |
82 |
|
INTEGER, PARAMETER:: PAIR_LOOP = 2 |
83 |
|
|
81 |
– |
logical, save :: haveRlist = .false. |
84 |
|
logical, save :: haveNeighborList = .false. |
85 |
|
logical, save :: haveSIMvariables = .false. |
86 |
|
logical, save :: haveSaneForceField = .false. |
87 |
< |
logical, save :: haveInteractionMap = .false. |
87 |
> |
logical, save :: haveInteractionHash = .false. |
88 |
> |
logical, save :: haveGtypeCutoffMap = .false. |
89 |
> |
logical, save :: haveDefaultCutoffs = .false. |
90 |
> |
logical, save :: haveRlist = .false. |
91 |
|
|
92 |
|
logical, save :: FF_uses_DirectionalAtoms |
88 |
– |
logical, save :: FF_uses_LennardJones |
89 |
– |
logical, save :: FF_uses_Electrostatics |
90 |
– |
logical, save :: FF_uses_Charges |
93 |
|
logical, save :: FF_uses_Dipoles |
92 |
– |
logical, save :: FF_uses_Quadrupoles |
93 |
– |
logical, save :: FF_uses_Sticky |
94 |
– |
logical, save :: FF_uses_StickyPower |
94 |
|
logical, save :: FF_uses_GayBerne |
95 |
|
logical, save :: FF_uses_EAM |
96 |
< |
logical, save :: FF_uses_Shapes |
97 |
< |
logical, save :: FF_uses_FLARB |
98 |
< |
logical, save :: FF_uses_RF |
96 |
> |
logical, save :: FF_uses_SC |
97 |
> |
logical, save :: FF_uses_MEAM |
98 |
> |
|
99 |
|
|
100 |
|
logical, save :: SIM_uses_DirectionalAtoms |
102 |
– |
logical, save :: SIM_uses_LennardJones |
103 |
– |
logical, save :: SIM_uses_Electrostatics |
104 |
– |
logical, save :: SIM_uses_Charges |
105 |
– |
logical, save :: SIM_uses_Dipoles |
106 |
– |
logical, save :: SIM_uses_Quadrupoles |
107 |
– |
logical, save :: SIM_uses_Sticky |
108 |
– |
logical, save :: SIM_uses_StickyPower |
109 |
– |
logical, save :: SIM_uses_GayBerne |
101 |
|
logical, save :: SIM_uses_EAM |
102 |
< |
logical, save :: SIM_uses_Shapes |
103 |
< |
logical, save :: SIM_uses_FLARB |
113 |
< |
logical, save :: SIM_uses_RF |
102 |
> |
logical, save :: SIM_uses_SC |
103 |
> |
logical, save :: SIM_uses_MEAM |
104 |
|
logical, save :: SIM_requires_postpair_calc |
105 |
|
logical, save :: SIM_requires_prepair_calc |
106 |
|
logical, save :: SIM_uses_PBC |
117 |
– |
logical, save :: SIM_uses_molecular_cutoffs |
107 |
|
|
108 |
< |
!!!GO AWAY--------- |
120 |
< |
!!!!!real(kind=dp), save :: rlist, rlistsq |
108 |
> |
integer, save :: electrostaticSummationMethod |
109 |
|
|
110 |
|
public :: init_FF |
111 |
+ |
public :: setDefaultCutoffs |
112 |
|
public :: do_force_loop |
113 |
< |
! public :: setRlistDF |
114 |
< |
!public :: addInteraction |
115 |
< |
!public :: setInteractionHash |
116 |
< |
!public :: getInteractionHash |
117 |
< |
public :: createInteractionMap |
118 |
< |
public :: createRcuts |
113 |
> |
public :: createInteractionHash |
114 |
> |
public :: createGtypeCutoffMap |
115 |
> |
public :: getStickyCut |
116 |
> |
public :: getStickyPowerCut |
117 |
> |
public :: getGayBerneCut |
118 |
> |
public :: getEAMCut |
119 |
> |
public :: getShapeCut |
120 |
|
|
121 |
|
#ifdef PROFILE |
122 |
|
public :: getforcetime |
124 |
|
real :: forceTimeInitial, forceTimeFinal |
125 |
|
integer :: nLoops |
126 |
|
#endif |
137 |
– |
|
138 |
– |
type, public :: Interaction |
139 |
– |
integer :: InteractionHash |
140 |
– |
real(kind=dp) :: rCut = 0.0_dp |
141 |
– |
real(kind=dp) :: rCutSq = 0.0_dp |
142 |
– |
real(kind=dp) :: rListSq = 0.0_dp |
143 |
– |
end type Interaction |
127 |
|
|
128 |
< |
type(Interaction), dimension(:,:),allocatable :: InteractionMap |
129 |
< |
|
128 |
> |
!! Variables for cutoff mapping and interaction mapping |
129 |
> |
! Bit hash to determine pair-pair interactions. |
130 |
> |
integer, dimension(:,:), allocatable :: InteractionHash |
131 |
> |
real(kind=dp), dimension(:), allocatable :: atypeMaxCutoff |
132 |
> |
real(kind=dp), dimension(:), allocatable, target :: groupMaxCutoffRow |
133 |
> |
real(kind=dp), dimension(:), pointer :: groupMaxCutoffCol |
134 |
|
|
135 |
+ |
integer, dimension(:), allocatable, target :: groupToGtypeRow |
136 |
+ |
integer, dimension(:), pointer :: groupToGtypeCol => null() |
137 |
+ |
|
138 |
+ |
real(kind=dp), dimension(:), allocatable,target :: gtypeMaxCutoffRow |
139 |
+ |
real(kind=dp), dimension(:), pointer :: gtypeMaxCutoffCol |
140 |
+ |
type ::gtypeCutoffs |
141 |
+ |
real(kind=dp) :: rcut |
142 |
+ |
real(kind=dp) :: rcutsq |
143 |
+ |
real(kind=dp) :: rlistsq |
144 |
+ |
end type gtypeCutoffs |
145 |
+ |
type(gtypeCutoffs), dimension(:,:), allocatable :: gtypeCutoffMap |
146 |
+ |
|
147 |
+ |
integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY |
148 |
+ |
real(kind=dp),save :: defaultRcut, defaultRsw, defaultRlist |
149 |
+ |
real(kind=dp),save :: listSkin |
150 |
|
|
151 |
|
contains |
152 |
|
|
153 |
< |
|
152 |
< |
subroutine createInteractionMap(status) |
153 |
> |
subroutine createInteractionHash(status) |
154 |
|
integer :: nAtypes |
155 |
|
integer, intent(out) :: status |
156 |
|
integer :: i |
157 |
|
integer :: j |
158 |
< |
integer :: ihash |
158 |
< |
real(kind=dp) :: myRcut |
158 |
> |
integer :: iHash |
159 |
|
!! Test Types |
160 |
|
logical :: i_is_LJ |
161 |
|
logical :: i_is_Elect |
164 |
|
logical :: i_is_GB |
165 |
|
logical :: i_is_EAM |
166 |
|
logical :: i_is_Shape |
167 |
+ |
logical :: i_is_SC |
168 |
+ |
logical :: i_is_MEAM |
169 |
|
logical :: j_is_LJ |
170 |
|
logical :: j_is_Elect |
171 |
|
logical :: j_is_Sticky |
173 |
|
logical :: j_is_GB |
174 |
|
logical :: j_is_EAM |
175 |
|
logical :: j_is_Shape |
176 |
< |
|
176 |
> |
logical :: j_is_SC |
177 |
> |
logical :: j_is_MEAM |
178 |
> |
real(kind=dp) :: myRcut |
179 |
> |
|
180 |
> |
|
181 |
|
status = 0 |
182 |
|
|
183 |
|
if (.not. associated(atypes)) then |
184 |
< |
call handleError("atype", "atypes was not present before call of createDefaultInteractionMap!") |
184 |
> |
call handleError("atype", "atypes was not present before call of createInteractionHash!") |
185 |
|
status = -1 |
186 |
|
return |
187 |
|
endif |
193 |
|
return |
194 |
|
end if |
195 |
|
|
196 |
< |
if (.not. allocated(InteractionMap)) then |
197 |
< |
allocate(InteractionMap(nAtypes,nAtypes)) |
196 |
> |
if (.not. allocated(InteractionHash)) then |
197 |
> |
allocate(InteractionHash(nAtypes,nAtypes)) |
198 |
> |
else |
199 |
> |
deallocate(InteractionHash) |
200 |
> |
allocate(InteractionHash(nAtypes,nAtypes)) |
201 |
|
endif |
202 |
+ |
|
203 |
+ |
if (.not. allocated(atypeMaxCutoff)) then |
204 |
+ |
allocate(atypeMaxCutoff(nAtypes)) |
205 |
+ |
else |
206 |
+ |
deallocate(atypeMaxCutoff) |
207 |
+ |
allocate(atypeMaxCutoff(nAtypes)) |
208 |
+ |
endif |
209 |
|
|
210 |
|
do i = 1, nAtypes |
211 |
|
call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ) |
215 |
|
call getElementProperty(atypes, i, "is_GayBerne", i_is_GB) |
216 |
|
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
217 |
|
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
218 |
+ |
call getElementProperty(atypes, i, "is_SC", i_is_SC) |
219 |
+ |
call getElementProperty(atypes, i, "is_MEAM", i_is_MEAM) |
220 |
|
|
221 |
|
do j = i, nAtypes |
222 |
|
|
230 |
|
call getElementProperty(atypes, j, "is_GayBerne", j_is_GB) |
231 |
|
call getElementProperty(atypes, j, "is_EAM", j_is_EAM) |
232 |
|
call getElementProperty(atypes, j, "is_Shape", j_is_Shape) |
233 |
+ |
call getElementProperty(atypes, j, "is_SC", j_is_SC) |
234 |
+ |
call getElementProperty(atypes, j, "is_MEAM", j_is_MEAM) |
235 |
|
|
236 |
|
if (i_is_LJ .and. j_is_LJ) then |
237 |
|
iHash = ior(iHash, LJ_PAIR) |
253 |
|
iHash = ior(iHash, EAM_PAIR) |
254 |
|
endif |
255 |
|
|
256 |
+ |
if (i_is_SC .and. j_is_SC) then |
257 |
+ |
iHash = ior(iHash, SC_PAIR) |
258 |
+ |
endif |
259 |
+ |
|
260 |
|
if (i_is_GB .and. j_is_GB) iHash = ior(iHash, GAYBERNE_PAIR) |
261 |
|
if (i_is_GB .and. j_is_LJ) iHash = ior(iHash, GAYBERNE_LJ) |
262 |
|
if (i_is_LJ .and. j_is_GB) iHash = ior(iHash, GAYBERNE_LJ) |
266 |
|
if (i_is_LJ .and. j_is_Shape) iHash = ior(iHash, SHAPE_LJ) |
267 |
|
|
268 |
|
|
269 |
< |
InteractionMap(i,j)%InteractionHash = iHash |
270 |
< |
InteractionMap(j,i)%InteractionHash = iHash |
269 |
> |
InteractionHash(i,j) = iHash |
270 |
> |
InteractionHash(j,i) = iHash |
271 |
|
|
272 |
|
end do |
273 |
|
|
274 |
|
end do |
275 |
|
|
276 |
< |
haveInteractionMap = .true. |
277 |
< |
end subroutine createInteractionMap |
276 |
> |
haveInteractionHash = .true. |
277 |
> |
end subroutine createInteractionHash |
278 |
|
|
279 |
< |
! Query each potential and return the cutoff for that potential. We |
256 |
< |
! build the neighbor list based on the largest cutoff value for that |
257 |
< |
! atype. Each potential can decide whether to calculate the force for |
258 |
< |
! that atype based upon it's own cutoff. |
259 |
< |
|
260 |
< |
subroutine createRcuts(defaultRcut, defaultSkinThickness, stat) |
279 |
> |
subroutine createGtypeCutoffMap(stat) |
280 |
|
|
281 |
< |
real(kind=dp), intent(in), optional :: defaultRCut, defaultSkinThickness |
282 |
< |
integer :: iMap |
283 |
< |
integer :: map_i,map_j |
284 |
< |
real(kind=dp) :: thisRCut = 0.0_dp |
285 |
< |
real(kind=dp) :: actualCutoff = 0.0_dp |
286 |
< |
integer, intent(out) :: stat |
287 |
< |
integer :: nAtypes |
288 |
< |
integer :: myStatus |
289 |
< |
|
271 |
< |
stat = 0 |
272 |
< |
if (.not. haveInteractionMap) then |
281 |
> |
integer, intent(out), optional :: stat |
282 |
> |
logical :: i_is_LJ |
283 |
> |
logical :: i_is_Elect |
284 |
> |
logical :: i_is_Sticky |
285 |
> |
logical :: i_is_StickyP |
286 |
> |
logical :: i_is_GB |
287 |
> |
logical :: i_is_EAM |
288 |
> |
logical :: i_is_Shape |
289 |
> |
logical :: GtypeFound |
290 |
|
|
291 |
< |
call createInteractionMap(myStatus) |
291 |
> |
integer :: myStatus, nAtypes, i, j, istart, iend, jstart, jend |
292 |
> |
integer :: n_in_i, me_i, ia, g, atom1, ja, n_in_j,me_j |
293 |
> |
integer :: nGroupsInRow |
294 |
> |
integer :: nGroupsInCol |
295 |
> |
integer :: nGroupTypesRow,nGroupTypesCol |
296 |
> |
real(kind=dp):: thisSigma, bigSigma, thisRcut, tradRcut, tol, skin |
297 |
> |
real(kind=dp) :: biggestAtypeCutoff |
298 |
|
|
299 |
+ |
stat = 0 |
300 |
+ |
if (.not. haveInteractionHash) then |
301 |
+ |
call createInteractionHash(myStatus) |
302 |
|
if (myStatus .ne. 0) then |
303 |
< |
write(default_error, *) 'createInteractionMap failed in doForces!' |
303 |
> |
write(default_error, *) 'createInteractionHash failed in doForces!' |
304 |
|
stat = -1 |
305 |
|
return |
306 |
|
endif |
307 |
|
endif |
308 |
< |
|
308 |
> |
#ifdef IS_MPI |
309 |
> |
nGroupsInRow = getNgroupsInRow(plan_group_row) |
310 |
> |
nGroupsInCol = getNgroupsInCol(plan_group_col) |
311 |
> |
#endif |
312 |
|
nAtypes = getSize(atypes) |
313 |
< |
!! If we pass a default rcut, set all atypes to that cutoff distance |
314 |
< |
if(present(defaultRList)) then |
315 |
< |
InteractionMap(:,:)%rCut = defaultRCut |
316 |
< |
InteractionMap(:,:)%rCutSq = defaultRCut*defaultRCut |
317 |
< |
InteractionMap(:,:)%rListSq = (defaultRCut+defaultSkinThickness)**2 |
318 |
< |
haveRlist = .true. |
319 |
< |
return |
320 |
< |
end if |
321 |
< |
|
322 |
< |
do map_i = 1,nAtypes |
323 |
< |
do map_j = map_i,nAtypes |
295 |
< |
iMap = InteractionMap(map_i, map_j)%InteractionHash |
313 |
> |
! Set all of the initial cutoffs to zero. |
314 |
> |
atypeMaxCutoff = 0.0_dp |
315 |
> |
do i = 1, nAtypes |
316 |
> |
if (SimHasAtype(i)) then |
317 |
> |
call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ) |
318 |
> |
call getElementProperty(atypes, i, "is_Electrostatic", i_is_Elect) |
319 |
> |
call getElementProperty(atypes, i, "is_Sticky", i_is_Sticky) |
320 |
> |
call getElementProperty(atypes, i, "is_StickyPower", i_is_StickyP) |
321 |
> |
call getElementProperty(atypes, i, "is_GayBerne", i_is_GB) |
322 |
> |
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
323 |
> |
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
324 |
|
|
325 |
< |
if ( iand(iMap, LJ_PAIR).ne.0 ) then |
326 |
< |
! thisRCut = getLJCutOff(map_i,map_j) |
327 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
325 |
> |
|
326 |
> |
if (haveDefaultCutoffs) then |
327 |
> |
atypeMaxCutoff(i) = defaultRcut |
328 |
> |
else |
329 |
> |
if (i_is_LJ) then |
330 |
> |
thisRcut = getSigma(i) * 2.5_dp |
331 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
332 |
> |
endif |
333 |
> |
if (i_is_Elect) then |
334 |
> |
thisRcut = defaultRcut |
335 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
336 |
> |
endif |
337 |
> |
if (i_is_Sticky) then |
338 |
> |
thisRcut = getStickyCut(i) |
339 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
340 |
> |
endif |
341 |
> |
if (i_is_StickyP) then |
342 |
> |
thisRcut = getStickyPowerCut(i) |
343 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
344 |
> |
endif |
345 |
> |
if (i_is_GB) then |
346 |
> |
thisRcut = getGayBerneCut(i) |
347 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
348 |
> |
endif |
349 |
> |
if (i_is_EAM) then |
350 |
> |
thisRcut = getEAMCut(i) |
351 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
352 |
> |
endif |
353 |
> |
if (i_is_Shape) then |
354 |
> |
thisRcut = getShapeCut(i) |
355 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
356 |
> |
endif |
357 |
|
endif |
358 |
|
|
302 |
– |
if ( iand(iMap, ELECTROSTATIC_PAIR).ne.0 ) then |
303 |
– |
! thisRCut = getElectrostaticCutOff(map_i,map_j) |
304 |
– |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
305 |
– |
endif |
359 |
|
|
360 |
< |
if ( iand(iMap, STICKY_PAIR).ne.0 ) then |
361 |
< |
! thisRCut = getStickyCutOff(map_i,map_j) |
362 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
310 |
< |
endif |
311 |
< |
|
312 |
< |
if ( iand(iMap, STICKYPOWER_PAIR).ne.0 ) then |
313 |
< |
! thisRCut = getStickyPowerCutOff(map_i,map_j) |
314 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
315 |
< |
endif |
316 |
< |
|
317 |
< |
if ( iand(iMap, GAYBERNE_PAIR).ne.0 ) then |
318 |
< |
! thisRCut = getGayberneCutOff(map_i,map_j) |
319 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
320 |
< |
endif |
321 |
< |
|
322 |
< |
if ( iand(iMap, GAYBERNE_LJ).ne.0 ) then |
323 |
< |
! thisRCut = getGaybrneLJCutOff(map_i,map_j) |
324 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
325 |
< |
endif |
326 |
< |
|
327 |
< |
if ( iand(iMap, EAM_PAIR).ne.0 ) then |
328 |
< |
! thisRCut = getEAMCutOff(map_i,map_j) |
329 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
330 |
< |
endif |
331 |
< |
|
332 |
< |
if ( iand(iMap, SHAPE_PAIR).ne.0 ) then |
333 |
< |
! thisRCut = getShapeCutOff(map_i,map_j) |
334 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
335 |
< |
endif |
336 |
< |
|
337 |
< |
if ( iand(iMap, SHAPE_LJ).ne.0 ) then |
338 |
< |
! thisRCut = getShapeLJCutOff(map_i,map_j) |
339 |
< |
if (thisRcut > actualCutoff) actualCutoff = thisRcut |
340 |
< |
endif |
341 |
< |
InteractionMap(map_i, map_j)%rCut = actualCutoff |
342 |
< |
InteractionMap(map_i, map_j)%rCutSq = actualCutoff * actualCutoff |
343 |
< |
InteractionMap(map_i, map_j)%rListSq = (actualCutoff + skinThickness)**2 |
360 |
> |
if (atypeMaxCutoff(i).gt.biggestAtypeCutoff) then |
361 |
> |
biggestAtypeCutoff = atypeMaxCutoff(i) |
362 |
> |
endif |
363 |
|
|
364 |
< |
InteractionMap(map_j, map_i)%rCut = InteractionMap(map_i, map_j)%rCut |
365 |
< |
InteractionMap(map_j, map_i)%rCutSq = InteractionMap(map_i, map_j)%rCutSq |
366 |
< |
InteractionMap(map_j, map_i)%rListSq = InteractionMap(map_i, map_j)%rListSq |
348 |
< |
end do |
349 |
< |
end do |
350 |
< |
! now the groups |
364 |
> |
endif |
365 |
> |
enddo |
366 |
> |
|
367 |
|
|
368 |
< |
|
369 |
< |
|
370 |
< |
haveRlist = .true. |
371 |
< |
end subroutine createRcuts |
368 |
> |
|
369 |
> |
istart = 1 |
370 |
> |
jstart = 1 |
371 |
> |
#ifdef IS_MPI |
372 |
> |
iend = nGroupsInRow |
373 |
> |
jend = nGroupsInCol |
374 |
> |
#else |
375 |
> |
iend = nGroups |
376 |
> |
jend = nGroups |
377 |
> |
#endif |
378 |
> |
|
379 |
> |
!! allocate the groupToGtype and gtypeMaxCutoff here. |
380 |
> |
if(.not.allocated(groupToGtypeRow)) then |
381 |
> |
! allocate(groupToGtype(iend)) |
382 |
> |
allocate(groupToGtypeRow(iend)) |
383 |
> |
else |
384 |
> |
deallocate(groupToGtypeRow) |
385 |
> |
allocate(groupToGtypeRow(iend)) |
386 |
> |
endif |
387 |
> |
if(.not.allocated(groupMaxCutoffRow)) then |
388 |
> |
allocate(groupMaxCutoffRow(iend)) |
389 |
> |
else |
390 |
> |
deallocate(groupMaxCutoffRow) |
391 |
> |
allocate(groupMaxCutoffRow(iend)) |
392 |
> |
end if |
393 |
|
|
394 |
+ |
if(.not.allocated(gtypeMaxCutoffRow)) then |
395 |
+ |
allocate(gtypeMaxCutoffRow(iend)) |
396 |
+ |
else |
397 |
+ |
deallocate(gtypeMaxCutoffRow) |
398 |
+ |
allocate(gtypeMaxCutoffRow(iend)) |
399 |
+ |
endif |
400 |
|
|
358 |
– |
!!! THIS GOES AWAY FOR SIZE DEPENDENT CUTOFF |
359 |
– |
!!$ subroutine setRlistDF( this_rlist ) |
360 |
– |
!!$ |
361 |
– |
!!$ real(kind=dp) :: this_rlist |
362 |
– |
!!$ |
363 |
– |
!!$ rlist = this_rlist |
364 |
– |
!!$ rlistsq = rlist * rlist |
365 |
– |
!!$ |
366 |
– |
!!$ haveRlist = .true. |
367 |
– |
!!$ |
368 |
– |
!!$ end subroutine setRlistDF |
401 |
|
|
402 |
+ |
#ifdef IS_MPI |
403 |
+ |
! We only allocate new storage if we are in MPI because Ncol /= Nrow |
404 |
+ |
if(.not.associated(groupToGtypeCol)) then |
405 |
+ |
allocate(groupToGtypeCol(jend)) |
406 |
+ |
else |
407 |
+ |
deallocate(groupToGtypeCol) |
408 |
+ |
allocate(groupToGtypeCol(jend)) |
409 |
+ |
end if |
410 |
|
|
411 |
+ |
if(.not.associated(groupToGtypeCol)) then |
412 |
+ |
allocate(groupToGtypeCol(jend)) |
413 |
+ |
else |
414 |
+ |
deallocate(groupToGtypeCol) |
415 |
+ |
allocate(groupToGtypeCol(jend)) |
416 |
+ |
end if |
417 |
+ |
if(.not.associated(gtypeMaxCutoffCol)) then |
418 |
+ |
allocate(gtypeMaxCutoffCol(jend)) |
419 |
+ |
else |
420 |
+ |
deallocate(gtypeMaxCutoffCol) |
421 |
+ |
allocate(gtypeMaxCutoffCol(jend)) |
422 |
+ |
end if |
423 |
+ |
|
424 |
+ |
groupMaxCutoffCol = 0.0_dp |
425 |
+ |
gtypeMaxCutoffCol = 0.0_dp |
426 |
+ |
|
427 |
+ |
#endif |
428 |
+ |
groupMaxCutoffRow = 0.0_dp |
429 |
+ |
gtypeMaxCutoffRow = 0.0_dp |
430 |
+ |
|
431 |
+ |
|
432 |
+ |
!! first we do a single loop over the cutoff groups to find the |
433 |
+ |
!! largest cutoff for any atypes present in this group. We also |
434 |
+ |
!! create gtypes at this point. |
435 |
+ |
|
436 |
+ |
tol = 1.0d-6 |
437 |
+ |
nGroupTypesRow = 0 |
438 |
+ |
|
439 |
+ |
do i = istart, iend |
440 |
+ |
n_in_i = groupStartRow(i+1) - groupStartRow(i) |
441 |
+ |
groupMaxCutoffRow(i) = 0.0_dp |
442 |
+ |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
443 |
+ |
atom1 = groupListRow(ia) |
444 |
+ |
#ifdef IS_MPI |
445 |
+ |
me_i = atid_row(atom1) |
446 |
+ |
#else |
447 |
+ |
me_i = atid(atom1) |
448 |
+ |
#endif |
449 |
+ |
if (atypeMaxCutoff(me_i).gt.groupMaxCutoffRow(i)) then |
450 |
+ |
groupMaxCutoffRow(i)=atypeMaxCutoff(me_i) |
451 |
+ |
endif |
452 |
+ |
enddo |
453 |
+ |
|
454 |
+ |
if (nGroupTypesRow.eq.0) then |
455 |
+ |
nGroupTypesRow = nGroupTypesRow + 1 |
456 |
+ |
gtypeMaxCutoffRow(nGroupTypesRow) = groupMaxCutoffRow(i) |
457 |
+ |
groupToGtypeRow(i) = nGroupTypesRow |
458 |
+ |
else |
459 |
+ |
GtypeFound = .false. |
460 |
+ |
do g = 1, nGroupTypesRow |
461 |
+ |
if ( abs(groupMaxCutoffRow(i) - gtypeMaxCutoffRow(g)).lt.tol) then |
462 |
+ |
groupToGtypeRow(i) = g |
463 |
+ |
GtypeFound = .true. |
464 |
+ |
endif |
465 |
+ |
enddo |
466 |
+ |
if (.not.GtypeFound) then |
467 |
+ |
nGroupTypesRow = nGroupTypesRow + 1 |
468 |
+ |
gtypeMaxCutoffRow(nGroupTypesRow) = groupMaxCutoffRow(i) |
469 |
+ |
groupToGtypeRow(i) = nGroupTypesRow |
470 |
+ |
endif |
471 |
+ |
endif |
472 |
+ |
enddo |
473 |
+ |
|
474 |
+ |
#ifdef IS_MPI |
475 |
+ |
do j = jstart, jend |
476 |
+ |
n_in_j = groupStartCol(j+1) - groupStartCol(j) |
477 |
+ |
groupMaxCutoffCol(j) = 0.0_dp |
478 |
+ |
do ja = groupStartCol(j), groupStartCol(j+1)-1 |
479 |
+ |
atom1 = groupListCol(ja) |
480 |
+ |
|
481 |
+ |
me_j = atid_col(atom1) |
482 |
+ |
|
483 |
+ |
if (atypeMaxCutoff(me_j).gt.groupMaxCutoffCol(j)) then |
484 |
+ |
groupMaxCutoffCol(j)=atypeMaxCutoff(me_j) |
485 |
+ |
endif |
486 |
+ |
enddo |
487 |
+ |
|
488 |
+ |
if (nGroupTypesCol.eq.0) then |
489 |
+ |
nGroupTypesCol = nGroupTypesCol + 1 |
490 |
+ |
gtypeMaxCutoffCol(nGroupTypesCol) = groupMaxCutoffCol(j) |
491 |
+ |
groupToGtypeCol(j) = nGroupTypesCol |
492 |
+ |
else |
493 |
+ |
GtypeFound = .false. |
494 |
+ |
do g = 1, nGroupTypesCol |
495 |
+ |
if ( abs(groupMaxCutoffCol(j) - gtypeMaxCutoffCol(g)).lt.tol) then |
496 |
+ |
groupToGtypeCol(j) = g |
497 |
+ |
GtypeFound = .true. |
498 |
+ |
endif |
499 |
+ |
enddo |
500 |
+ |
if (.not.GtypeFound) then |
501 |
+ |
nGroupTypesCol = nGroupTypesCol + 1 |
502 |
+ |
gtypeMaxCutoffCol(nGroupTypesCol) = groupMaxCutoffCol(j) |
503 |
+ |
groupToGtypeCol(j) = nGroupTypesCol |
504 |
+ |
endif |
505 |
+ |
endif |
506 |
+ |
enddo |
507 |
+ |
|
508 |
+ |
#else |
509 |
+ |
! Set pointers to information we just found |
510 |
+ |
nGroupTypesCol = nGroupTypesRow |
511 |
+ |
groupToGtypeCol => groupToGtypeRow |
512 |
+ |
gtypeMaxCutoffCol => gtypeMaxCutoffRow |
513 |
+ |
groupMaxCutoffCol => groupMaxCutoffRow |
514 |
+ |
#endif |
515 |
+ |
|
516 |
+ |
|
517 |
+ |
|
518 |
+ |
|
519 |
+ |
|
520 |
+ |
!! allocate the gtypeCutoffMap here. |
521 |
+ |
allocate(gtypeCutoffMap(nGroupTypesRow,nGroupTypesCol)) |
522 |
+ |
!! then we do a double loop over all the group TYPES to find the cutoff |
523 |
+ |
!! map between groups of two types |
524 |
+ |
tradRcut = max(maxval(gtypeMaxCutoffRow),maxval(gtypeMaxCutoffCol)) |
525 |
+ |
|
526 |
+ |
do i = 1, nGroupTypesRow |
527 |
+ |
do j = 1, nGroupTypesCol |
528 |
+ |
|
529 |
+ |
select case(cutoffPolicy) |
530 |
+ |
case(TRADITIONAL_CUTOFF_POLICY) |
531 |
+ |
thisRcut = tradRcut |
532 |
+ |
case(MIX_CUTOFF_POLICY) |
533 |
+ |
thisRcut = 0.5_dp * (gtypeMaxCutoffRow(i) + gtypeMaxCutoffCol(j)) |
534 |
+ |
case(MAX_CUTOFF_POLICY) |
535 |
+ |
thisRcut = max(gtypeMaxCutoffRow(i), gtypeMaxCutoffCol(j)) |
536 |
+ |
case default |
537 |
+ |
call handleError("createGtypeCutoffMap", "Unknown Cutoff Policy") |
538 |
+ |
return |
539 |
+ |
end select |
540 |
+ |
gtypeCutoffMap(i,j)%rcut = thisRcut |
541 |
+ |
gtypeCutoffMap(i,j)%rcutsq = thisRcut*thisRcut |
542 |
+ |
skin = defaultRlist - defaultRcut |
543 |
+ |
listSkin = skin ! set neighbor list skin thickness |
544 |
+ |
gtypeCutoffMap(i,j)%rlistsq = (thisRcut + skin)**2 |
545 |
+ |
|
546 |
+ |
! sanity check |
547 |
+ |
|
548 |
+ |
if (haveDefaultCutoffs) then |
549 |
+ |
if (abs(gtypeCutoffMap(i,j)%rcut - defaultRcut).gt.0.0001) then |
550 |
+ |
call handleError("createGtypeCutoffMap", "user-specified rCut does not match computed group Cutoff") |
551 |
+ |
endif |
552 |
+ |
endif |
553 |
+ |
enddo |
554 |
+ |
enddo |
555 |
+ |
if(allocated(gtypeMaxCutoffRow)) deallocate(gtypeMaxCutoffRow) |
556 |
+ |
if(allocated(groupMaxCutoffRow)) deallocate(groupMaxCutoffRow) |
557 |
+ |
if(allocated(atypeMaxCutoff)) deallocate(atypeMaxCutoff) |
558 |
+ |
#ifdef IS_MPI |
559 |
+ |
if(associated(groupMaxCutoffCol)) deallocate(groupMaxCutoffCol) |
560 |
+ |
if(associated(gtypeMaxCutoffCol)) deallocate(gtypeMaxCutoffCol) |
561 |
+ |
#endif |
562 |
+ |
groupMaxCutoffCol => null() |
563 |
+ |
gtypeMaxCutoffCol => null() |
564 |
+ |
|
565 |
+ |
haveGtypeCutoffMap = .true. |
566 |
+ |
end subroutine createGtypeCutoffMap |
567 |
+ |
|
568 |
+ |
subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy) |
569 |
+ |
real(kind=dp),intent(in) :: defRcut, defRsw, defRlist |
570 |
+ |
integer, intent(in) :: cutPolicy |
571 |
+ |
|
572 |
+ |
defaultRcut = defRcut |
573 |
+ |
defaultRsw = defRsw |
574 |
+ |
defaultRlist = defRlist |
575 |
+ |
cutoffPolicy = cutPolicy |
576 |
+ |
|
577 |
+ |
haveDefaultCutoffs = .true. |
578 |
+ |
end subroutine setDefaultCutoffs |
579 |
+ |
|
580 |
+ |
subroutine setCutoffPolicy(cutPolicy) |
581 |
+ |
|
582 |
+ |
integer, intent(in) :: cutPolicy |
583 |
+ |
cutoffPolicy = cutPolicy |
584 |
+ |
call createGtypeCutoffMap() |
585 |
+ |
end subroutine setCutoffPolicy |
586 |
+ |
|
587 |
+ |
|
588 |
|
subroutine setSimVariables() |
589 |
|
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
373 |
– |
SIM_uses_LennardJones = SimUsesLennardJones() |
374 |
– |
SIM_uses_Electrostatics = SimUsesElectrostatics() |
375 |
– |
SIM_uses_Charges = SimUsesCharges() |
376 |
– |
SIM_uses_Dipoles = SimUsesDipoles() |
377 |
– |
SIM_uses_Sticky = SimUsesSticky() |
378 |
– |
SIM_uses_StickyPower = SimUsesStickyPower() |
379 |
– |
SIM_uses_GayBerne = SimUsesGayBerne() |
590 |
|
SIM_uses_EAM = SimUsesEAM() |
591 |
< |
SIM_uses_Shapes = SimUsesShapes() |
382 |
< |
SIM_uses_FLARB = SimUsesFLARB() |
383 |
< |
SIM_uses_RF = SimUsesRF() |
591 |
> |
SIM_uses_SC = SimUsesSC() |
592 |
|
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
593 |
|
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
594 |
|
SIM_uses_PBC = SimUsesPBC() |
605 |
|
|
606 |
|
error = 0 |
607 |
|
|
608 |
< |
if (.not. haveInteractionMap) then |
401 |
< |
|
608 |
> |
if (.not. haveInteractionHash) then |
609 |
|
myStatus = 0 |
610 |
< |
call createInteractionMap(myStatus) |
404 |
< |
|
610 |
> |
call createInteractionHash(myStatus) |
611 |
|
if (myStatus .ne. 0) then |
612 |
< |
write(default_error, *) 'createInteractionMap failed in doForces!' |
612 |
> |
write(default_error, *) 'createInteractionHash failed in doForces!' |
613 |
|
error = -1 |
614 |
|
return |
615 |
|
endif |
616 |
|
endif |
617 |
|
|
618 |
+ |
if (.not. haveGtypeCutoffMap) then |
619 |
+ |
myStatus = 0 |
620 |
+ |
call createGtypeCutoffMap(myStatus) |
621 |
+ |
if (myStatus .ne. 0) then |
622 |
+ |
write(default_error, *) 'createGtypeCutoffMap failed in doForces!' |
623 |
+ |
error = -1 |
624 |
+ |
return |
625 |
+ |
endif |
626 |
+ |
endif |
627 |
+ |
|
628 |
|
if (.not. haveSIMvariables) then |
629 |
|
call setSimVariables() |
630 |
|
endif |
631 |
|
|
632 |
< |
if (.not. haveRlist) then |
633 |
< |
write(default_error, *) 'rList has not been set in doForces!' |
634 |
< |
error = -1 |
635 |
< |
return |
636 |
< |
endif |
632 |
> |
! if (.not. haveRlist) then |
633 |
> |
! write(default_error, *) 'rList has not been set in doForces!' |
634 |
> |
! error = -1 |
635 |
> |
! return |
636 |
> |
! endif |
637 |
|
|
638 |
|
if (.not. haveNeighborList) then |
639 |
|
write(default_error, *) 'neighbor list has not been initialized in doForces!' |
658 |
|
end subroutine doReadyCheck |
659 |
|
|
660 |
|
|
661 |
< |
subroutine init_FF(use_RF_c, thisStat) |
661 |
> |
subroutine init_FF(thisESM, thisStat) |
662 |
|
|
663 |
< |
logical, intent(in) :: use_RF_c |
448 |
< |
|
663 |
> |
integer, intent(in) :: thisESM |
664 |
|
integer, intent(out) :: thisStat |
665 |
|
integer :: my_status, nMatches |
666 |
|
integer, pointer :: MatchList(:) => null() |
452 |
– |
real(kind=dp) :: rcut, rrf, rt, dielect |
667 |
|
|
668 |
|
!! assume things are copacetic, unless they aren't |
669 |
|
thisStat = 0 |
670 |
|
|
671 |
< |
!! Fortran's version of a cast: |
458 |
< |
FF_uses_RF = use_RF_c |
671 |
> |
electrostaticSummationMethod = thisESM |
672 |
|
|
673 |
|
!! init_FF is called *after* all of the atom types have been |
674 |
|
!! defined in atype_module using the new_atype subroutine. |
677 |
|
!! interactions are used by the force field. |
678 |
|
|
679 |
|
FF_uses_DirectionalAtoms = .false. |
467 |
– |
FF_uses_LennardJones = .false. |
468 |
– |
FF_uses_Electrostatics = .false. |
469 |
– |
FF_uses_Charges = .false. |
680 |
|
FF_uses_Dipoles = .false. |
471 |
– |
FF_uses_Sticky = .false. |
472 |
– |
FF_uses_StickyPower = .false. |
681 |
|
FF_uses_GayBerne = .false. |
682 |
|
FF_uses_EAM = .false. |
475 |
– |
FF_uses_Shapes = .false. |
476 |
– |
FF_uses_FLARB = .false. |
683 |
|
|
684 |
|
call getMatchingElementList(atypes, "is_Directional", .true., & |
685 |
|
nMatches, MatchList) |
686 |
|
if (nMatches .gt. 0) FF_uses_DirectionalAtoms = .true. |
687 |
|
|
482 |
– |
call getMatchingElementList(atypes, "is_LennardJones", .true., & |
483 |
– |
nMatches, MatchList) |
484 |
– |
if (nMatches .gt. 0) FF_uses_LennardJones = .true. |
485 |
– |
|
486 |
– |
call getMatchingElementList(atypes, "is_Electrostatic", .true., & |
487 |
– |
nMatches, MatchList) |
488 |
– |
if (nMatches .gt. 0) then |
489 |
– |
FF_uses_Electrostatics = .true. |
490 |
– |
endif |
491 |
– |
|
492 |
– |
call getMatchingElementList(atypes, "is_Charge", .true., & |
493 |
– |
nMatches, MatchList) |
494 |
– |
if (nMatches .gt. 0) then |
495 |
– |
FF_uses_Charges = .true. |
496 |
– |
FF_uses_Electrostatics = .true. |
497 |
– |
endif |
498 |
– |
|
688 |
|
call getMatchingElementList(atypes, "is_Dipole", .true., & |
689 |
|
nMatches, MatchList) |
690 |
< |
if (nMatches .gt. 0) then |
502 |
< |
FF_uses_Dipoles = .true. |
503 |
< |
FF_uses_Electrostatics = .true. |
504 |
< |
FF_uses_DirectionalAtoms = .true. |
505 |
< |
endif |
506 |
< |
|
507 |
< |
call getMatchingElementList(atypes, "is_Quadrupole", .true., & |
508 |
< |
nMatches, MatchList) |
509 |
< |
if (nMatches .gt. 0) then |
510 |
< |
FF_uses_Quadrupoles = .true. |
511 |
< |
FF_uses_Electrostatics = .true. |
512 |
< |
FF_uses_DirectionalAtoms = .true. |
513 |
< |
endif |
514 |
< |
|
515 |
< |
call getMatchingElementList(atypes, "is_Sticky", .true., nMatches, & |
516 |
< |
MatchList) |
517 |
< |
if (nMatches .gt. 0) then |
518 |
< |
FF_uses_Sticky = .true. |
519 |
< |
FF_uses_DirectionalAtoms = .true. |
520 |
< |
endif |
521 |
< |
|
522 |
< |
call getMatchingElementList(atypes, "is_StickyPower", .true., nMatches, & |
523 |
< |
MatchList) |
524 |
< |
if (nMatches .gt. 0) then |
525 |
< |
FF_uses_StickyPower = .true. |
526 |
< |
FF_uses_DirectionalAtoms = .true. |
527 |
< |
endif |
690 |
> |
if (nMatches .gt. 0) FF_uses_Dipoles = .true. |
691 |
|
|
692 |
|
call getMatchingElementList(atypes, "is_GayBerne", .true., & |
693 |
|
nMatches, MatchList) |
694 |
< |
if (nMatches .gt. 0) then |
532 |
< |
FF_uses_GayBerne = .true. |
533 |
< |
FF_uses_DirectionalAtoms = .true. |
534 |
< |
endif |
694 |
> |
if (nMatches .gt. 0) FF_uses_GayBerne = .true. |
695 |
|
|
696 |
|
call getMatchingElementList(atypes, "is_EAM", .true., nMatches, MatchList) |
697 |
|
if (nMatches .gt. 0) FF_uses_EAM = .true. |
698 |
|
|
539 |
– |
call getMatchingElementList(atypes, "is_Shape", .true., & |
540 |
– |
nMatches, MatchList) |
541 |
– |
if (nMatches .gt. 0) then |
542 |
– |
FF_uses_Shapes = .true. |
543 |
– |
FF_uses_DirectionalAtoms = .true. |
544 |
– |
endif |
699 |
|
|
546 |
– |
call getMatchingElementList(atypes, "is_FLARB", .true., & |
547 |
– |
nMatches, MatchList) |
548 |
– |
if (nMatches .gt. 0) FF_uses_FLARB = .true. |
549 |
– |
|
550 |
– |
!! Assume sanity (for the sake of argument) |
700 |
|
haveSaneForceField = .true. |
701 |
|
|
553 |
– |
!! check to make sure the FF_uses_RF setting makes sense |
554 |
– |
|
555 |
– |
if (FF_uses_dipoles) then |
556 |
– |
if (FF_uses_RF) then |
557 |
– |
dielect = getDielect() |
558 |
– |
call initialize_rf(dielect) |
559 |
– |
endif |
560 |
– |
else |
561 |
– |
if (FF_uses_RF) then |
562 |
– |
write(default_error,*) 'Using Reaction Field with no dipoles? Huh?' |
563 |
– |
thisStat = -1 |
564 |
– |
haveSaneForceField = .false. |
565 |
– |
return |
566 |
– |
endif |
567 |
– |
endif |
568 |
– |
|
569 |
– |
!sticky module does not contain check_sticky_FF anymore |
570 |
– |
!if (FF_uses_sticky) then |
571 |
– |
! call check_sticky_FF(my_status) |
572 |
– |
! if (my_status /= 0) then |
573 |
– |
! thisStat = -1 |
574 |
– |
! haveSaneForceField = .false. |
575 |
– |
! return |
576 |
– |
! end if |
577 |
– |
!endif |
578 |
– |
|
702 |
|
if (FF_uses_EAM) then |
703 |
|
call init_EAM_FF(my_status) |
704 |
|
if (my_status /= 0) then |
709 |
|
end if |
710 |
|
endif |
711 |
|
|
589 |
– |
if (FF_uses_GayBerne) then |
590 |
– |
call check_gb_pair_FF(my_status) |
591 |
– |
if (my_status .ne. 0) then |
592 |
– |
thisStat = -1 |
593 |
– |
haveSaneForceField = .false. |
594 |
– |
return |
595 |
– |
endif |
596 |
– |
endif |
597 |
– |
|
598 |
– |
if (FF_uses_GayBerne .and. FF_uses_LennardJones) then |
599 |
– |
endif |
600 |
– |
|
712 |
|
if (.not. haveNeighborList) then |
713 |
|
!! Create neighbor lists |
714 |
|
call expandNeighborList(nLocal, my_status) |
742 |
|
|
743 |
|
!! Stress Tensor |
744 |
|
real( kind = dp), dimension(9) :: tau |
745 |
< |
real ( kind = dp ) :: pot |
745 |
> |
real ( kind = dp ),dimension(LR_POT_TYPES) :: pot |
746 |
|
logical ( kind = 2) :: do_pot_c, do_stress_c |
747 |
|
logical :: do_pot |
748 |
|
logical :: do_stress |
749 |
|
logical :: in_switching_region |
750 |
|
#ifdef IS_MPI |
751 |
< |
real( kind = DP ) :: pot_local |
751 |
> |
real( kind = DP ), dimension(LR_POT_TYPES) :: pot_local |
752 |
|
integer :: nAtomsInRow |
753 |
|
integer :: nAtomsInCol |
754 |
|
integer :: nprocs |
763 |
|
integer :: nlist |
764 |
|
real( kind = DP ) :: ratmsq, rgrpsq, rgrp, vpair, vij |
765 |
|
real( kind = DP ) :: sw, dswdr, swderiv, mf |
766 |
+ |
real( kind = DP ) :: rVal |
767 |
|
real(kind=dp),dimension(3) :: d_atm, d_grp, fpair, fij |
768 |
|
real(kind=dp) :: rfpot, mu_i, virial |
769 |
|
integer :: me_i, me_j, n_in_i, n_in_j |
773 |
|
integer :: localError |
774 |
|
integer :: propPack_i, propPack_j |
775 |
|
integer :: loopStart, loopEnd, loop |
776 |
< |
integer :: iMap |
777 |
< |
real(kind=dp) :: listSkin = 1.0 |
776 |
> |
integer :: iHash |
777 |
> |
integer :: i1 |
778 |
> |
|
779 |
|
|
780 |
|
!! initialize local variables |
781 |
|
|
866 |
|
#endif |
867 |
|
outer: do i = istart, iend |
868 |
|
|
756 |
– |
#ifdef IS_MPI |
757 |
– |
me_i = atid_row(i) |
758 |
– |
#else |
759 |
– |
me_i = atid(i) |
760 |
– |
#endif |
761 |
– |
|
869 |
|
if (update_nlist) point(i) = nlist + 1 |
870 |
|
|
871 |
|
n_in_i = groupStartRow(i+1) - groupStartRow(i) |
900 |
|
me_j = atid(j) |
901 |
|
call get_interatomic_vector(q_group(:,i), & |
902 |
|
q_group(:,j), d_grp, rgrpsq) |
903 |
< |
#endif |
903 |
> |
#endif |
904 |
|
|
905 |
< |
if (rgrpsq < InteractionMap(me_i,me_j)%rListsq) then |
905 |
> |
if (rgrpsq < gtypeCutoffMap(groupToGtypeRow(i),groupToGtypeCol(j))%rListsq) then |
906 |
|
if (update_nlist) then |
907 |
|
nlist = nlist + 1 |
908 |
|
|
922 |
|
|
923 |
|
list(nlist) = j |
924 |
|
endif |
925 |
+ |
|
926 |
+ |
if (rgrpsq < gtypeCutoffMap(groupToGtypeRow(i),groupToGtypeCol(j))%rCutsq) then |
927 |
|
|
928 |
< |
if (loop .eq. PAIR_LOOP) then |
929 |
< |
vij = 0.0d0 |
930 |
< |
fij(1:3) = 0.0d0 |
931 |
< |
endif |
932 |
< |
|
933 |
< |
call get_switch(rgrpsq, sw, dswdr, rgrp, group_switch, & |
934 |
< |
in_switching_region) |
935 |
< |
|
936 |
< |
n_in_j = groupStartCol(j+1) - groupStartCol(j) |
937 |
< |
|
938 |
< |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
939 |
< |
|
940 |
< |
atom1 = groupListRow(ia) |
941 |
< |
|
942 |
< |
inner: do jb = groupStartCol(j), groupStartCol(j+1)-1 |
943 |
< |
|
944 |
< |
atom2 = groupListCol(jb) |
945 |
< |
|
946 |
< |
if (skipThisPair(atom1, atom2)) cycle inner |
947 |
< |
|
948 |
< |
if ((n_in_i .eq. 1).and.(n_in_j .eq. 1)) then |
949 |
< |
d_atm(1:3) = d_grp(1:3) |
950 |
< |
ratmsq = rgrpsq |
951 |
< |
else |
928 |
> |
if (loop .eq. PAIR_LOOP) then |
929 |
> |
vij = 0.0d0 |
930 |
> |
fij(1:3) = 0.0d0 |
931 |
> |
endif |
932 |
> |
|
933 |
> |
call get_switch(rgrpsq, sw, dswdr, rgrp, group_switch, & |
934 |
> |
in_switching_region) |
935 |
> |
|
936 |
> |
n_in_j = groupStartCol(j+1) - groupStartCol(j) |
937 |
> |
|
938 |
> |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
939 |
> |
|
940 |
> |
atom1 = groupListRow(ia) |
941 |
> |
|
942 |
> |
inner: do jb = groupStartCol(j), groupStartCol(j+1)-1 |
943 |
> |
|
944 |
> |
atom2 = groupListCol(jb) |
945 |
> |
|
946 |
> |
if (skipThisPair(atom1, atom2)) cycle inner |
947 |
> |
|
948 |
> |
if ((n_in_i .eq. 1).and.(n_in_j .eq. 1)) then |
949 |
> |
d_atm(1:3) = d_grp(1:3) |
950 |
> |
ratmsq = rgrpsq |
951 |
> |
else |
952 |
|
#ifdef IS_MPI |
953 |
< |
call get_interatomic_vector(q_Row(:,atom1), & |
954 |
< |
q_Col(:,atom2), d_atm, ratmsq) |
955 |
< |
#else |
956 |
< |
call get_interatomic_vector(q(:,atom1), & |
957 |
< |
q(:,atom2), d_atm, ratmsq) |
953 |
> |
call get_interatomic_vector(q_Row(:,atom1), & |
954 |
> |
q_Col(:,atom2), d_atm, ratmsq) |
955 |
> |
#else |
956 |
> |
call get_interatomic_vector(q(:,atom1), & |
957 |
> |
q(:,atom2), d_atm, ratmsq) |
958 |
|
#endif |
959 |
< |
endif |
960 |
< |
|
961 |
< |
if (loop .eq. PREPAIR_LOOP) then |
959 |
> |
endif |
960 |
> |
|
961 |
> |
if (loop .eq. PREPAIR_LOOP) then |
962 |
|
#ifdef IS_MPI |
963 |
< |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
964 |
< |
rgrpsq, d_grp, do_pot, do_stress, & |
965 |
< |
eFrame, A, f, t, pot_local) |
963 |
> |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
964 |
> |
rgrpsq, d_grp, do_pot, do_stress, & |
965 |
> |
eFrame, A, f, t, pot_local) |
966 |
|
#else |
967 |
< |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
968 |
< |
rgrpsq, d_grp, do_pot, do_stress, & |
969 |
< |
eFrame, A, f, t, pot) |
967 |
> |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
968 |
> |
rgrpsq, d_grp, do_pot, do_stress, & |
969 |
> |
eFrame, A, f, t, pot) |
970 |
|
#endif |
971 |
< |
else |
971 |
> |
else |
972 |
|
#ifdef IS_MPI |
973 |
< |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
974 |
< |
do_pot, & |
975 |
< |
eFrame, A, f, t, pot_local, vpair, fpair) |
973 |
> |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
974 |
> |
do_pot, eFrame, A, f, t, pot_local, vpair, & |
975 |
> |
fpair, d_grp, rgrp) |
976 |
|
#else |
977 |
< |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
978 |
< |
do_pot, & |
979 |
< |
eFrame, A, f, t, pot, vpair, fpair) |
977 |
> |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
978 |
> |
do_pot, eFrame, A, f, t, pot, vpair, fpair, & |
979 |
> |
d_grp, rgrp) |
980 |
|
#endif |
981 |
+ |
vij = vij + vpair |
982 |
+ |
fij(1:3) = fij(1:3) + fpair(1:3) |
983 |
+ |
endif |
984 |
+ |
enddo inner |
985 |
+ |
enddo |
986 |
|
|
987 |
< |
vij = vij + vpair |
988 |
< |
fij(1:3) = fij(1:3) + fpair(1:3) |
989 |
< |
endif |
990 |
< |
enddo inner |
991 |
< |
enddo |
992 |
< |
|
993 |
< |
if (loop .eq. PAIR_LOOP) then |
994 |
< |
if (in_switching_region) then |
995 |
< |
swderiv = vij*dswdr/rgrp |
996 |
< |
fij(1) = fij(1) + swderiv*d_grp(1) |
883 |
< |
fij(2) = fij(2) + swderiv*d_grp(2) |
884 |
< |
fij(3) = fij(3) + swderiv*d_grp(3) |
885 |
< |
|
886 |
< |
do ia=groupStartRow(i), groupStartRow(i+1)-1 |
887 |
< |
atom1=groupListRow(ia) |
888 |
< |
mf = mfactRow(atom1) |
987 |
> |
if (loop .eq. PAIR_LOOP) then |
988 |
> |
if (in_switching_region) then |
989 |
> |
swderiv = vij*dswdr/rgrp |
990 |
> |
fij(1) = fij(1) + swderiv*d_grp(1) |
991 |
> |
fij(2) = fij(2) + swderiv*d_grp(2) |
992 |
> |
fij(3) = fij(3) + swderiv*d_grp(3) |
993 |
> |
|
994 |
> |
do ia=groupStartRow(i), groupStartRow(i+1)-1 |
995 |
> |
atom1=groupListRow(ia) |
996 |
> |
mf = mfactRow(atom1) |
997 |
|
#ifdef IS_MPI |
998 |
< |
f_Row(1,atom1) = f_Row(1,atom1) + swderiv*d_grp(1)*mf |
999 |
< |
f_Row(2,atom1) = f_Row(2,atom1) + swderiv*d_grp(2)*mf |
1000 |
< |
f_Row(3,atom1) = f_Row(3,atom1) + swderiv*d_grp(3)*mf |
998 |
> |
f_Row(1,atom1) = f_Row(1,atom1) + swderiv*d_grp(1)*mf |
999 |
> |
f_Row(2,atom1) = f_Row(2,atom1) + swderiv*d_grp(2)*mf |
1000 |
> |
f_Row(3,atom1) = f_Row(3,atom1) + swderiv*d_grp(3)*mf |
1001 |
|
#else |
1002 |
< |
f(1,atom1) = f(1,atom1) + swderiv*d_grp(1)*mf |
1003 |
< |
f(2,atom1) = f(2,atom1) + swderiv*d_grp(2)*mf |
1004 |
< |
f(3,atom1) = f(3,atom1) + swderiv*d_grp(3)*mf |
1002 |
> |
f(1,atom1) = f(1,atom1) + swderiv*d_grp(1)*mf |
1003 |
> |
f(2,atom1) = f(2,atom1) + swderiv*d_grp(2)*mf |
1004 |
> |
f(3,atom1) = f(3,atom1) + swderiv*d_grp(3)*mf |
1005 |
|
#endif |
1006 |
< |
enddo |
1007 |
< |
|
1008 |
< |
do jb=groupStartCol(j), groupStartCol(j+1)-1 |
1009 |
< |
atom2=groupListCol(jb) |
1010 |
< |
mf = mfactCol(atom2) |
1006 |
> |
enddo |
1007 |
> |
|
1008 |
> |
do jb=groupStartCol(j), groupStartCol(j+1)-1 |
1009 |
> |
atom2=groupListCol(jb) |
1010 |
> |
mf = mfactCol(atom2) |
1011 |
|
#ifdef IS_MPI |
1012 |
< |
f_Col(1,atom2) = f_Col(1,atom2) - swderiv*d_grp(1)*mf |
1013 |
< |
f_Col(2,atom2) = f_Col(2,atom2) - swderiv*d_grp(2)*mf |
1014 |
< |
f_Col(3,atom2) = f_Col(3,atom2) - swderiv*d_grp(3)*mf |
1012 |
> |
f_Col(1,atom2) = f_Col(1,atom2) - swderiv*d_grp(1)*mf |
1013 |
> |
f_Col(2,atom2) = f_Col(2,atom2) - swderiv*d_grp(2)*mf |
1014 |
> |
f_Col(3,atom2) = f_Col(3,atom2) - swderiv*d_grp(3)*mf |
1015 |
|
#else |
1016 |
< |
f(1,atom2) = f(1,atom2) - swderiv*d_grp(1)*mf |
1017 |
< |
f(2,atom2) = f(2,atom2) - swderiv*d_grp(2)*mf |
1018 |
< |
f(3,atom2) = f(3,atom2) - swderiv*d_grp(3)*mf |
1016 |
> |
f(1,atom2) = f(1,atom2) - swderiv*d_grp(1)*mf |
1017 |
> |
f(2,atom2) = f(2,atom2) - swderiv*d_grp(2)*mf |
1018 |
> |
f(3,atom2) = f(3,atom2) - swderiv*d_grp(3)*mf |
1019 |
|
#endif |
1020 |
< |
enddo |
1021 |
< |
endif |
1020 |
> |
enddo |
1021 |
> |
endif |
1022 |
|
|
1023 |
< |
if (do_stress) call add_stress_tensor(d_grp, fij) |
1023 |
> |
if (do_stress) call add_stress_tensor(d_grp, fij) |
1024 |
> |
endif |
1025 |
|
endif |
1026 |
< |
end if |
1026 |
> |
endif |
1027 |
|
enddo |
1028 |
+ |
|
1029 |
|
enddo outer |
1030 |
|
|
1031 |
|
if (update_nlist) then |
1085 |
|
|
1086 |
|
if (do_pot) then |
1087 |
|
! scatter/gather pot_row into the members of my column |
1088 |
< |
call scatter(pot_Row, pot_Temp, plan_atom_row) |
1089 |
< |
|
1088 |
> |
do i = 1,LR_POT_TYPES |
1089 |
> |
call scatter(pot_Row(i,:), pot_Temp(i,:), plan_atom_row) |
1090 |
> |
end do |
1091 |
|
! scatter/gather pot_local into all other procs |
1092 |
|
! add resultant to get total pot |
1093 |
|
do i = 1, nlocal |
1094 |
< |
pot_local = pot_local + pot_Temp(i) |
1094 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES) & |
1095 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1096 |
|
enddo |
1097 |
|
|
1098 |
|
pot_Temp = 0.0_DP |
1099 |
< |
|
1100 |
< |
call scatter(pot_Col, pot_Temp, plan_atom_col) |
1099 |
> |
do i = 1,LR_POT_TYPES |
1100 |
> |
call scatter(pot_Col(i,:), pot_Temp(i,:), plan_atom_col) |
1101 |
> |
end do |
1102 |
|
do i = 1, nlocal |
1103 |
< |
pot_local = pot_local + pot_Temp(i) |
1103 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES)& |
1104 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1105 |
|
enddo |
1106 |
|
|
1107 |
|
endif |
1108 |
|
#endif |
1109 |
|
|
1110 |
< |
if (FF_RequiresPostpairCalc() .and. SIM_requires_postpair_calc) then |
1110 |
> |
if (SIM_requires_postpair_calc) then |
1111 |
> |
do i = 1, nlocal |
1112 |
> |
|
1113 |
> |
! we loop only over the local atoms, so we don't need row and column |
1114 |
> |
! lookups for the types |
1115 |
> |
|
1116 |
> |
me_i = atid(i) |
1117 |
> |
|
1118 |
> |
! is the atom electrostatic? See if it would have an |
1119 |
> |
! electrostatic interaction with itself |
1120 |
> |
iHash = InteractionHash(me_i,me_i) |
1121 |
|
|
1122 |
< |
if (FF_uses_RF .and. SIM_uses_RF) then |
999 |
< |
|
1122 |
> |
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1123 |
|
#ifdef IS_MPI |
1124 |
< |
call scatter(rf_Row,rf,plan_atom_row_3d) |
1125 |
< |
call scatter(rf_Col,rf_Temp,plan_atom_col_3d) |
1003 |
< |
do i = 1,nlocal |
1004 |
< |
rf(1:3,i) = rf(1:3,i) + rf_Temp(1:3,i) |
1005 |
< |
end do |
1006 |
< |
#endif |
1007 |
< |
|
1008 |
< |
do i = 1, nLocal |
1009 |
< |
|
1010 |
< |
rfpot = 0.0_DP |
1011 |
< |
#ifdef IS_MPI |
1012 |
< |
me_i = atid_row(i) |
1124 |
> |
call self_self(i, eFrame, pot_local(ELECTROSTATIC_POT), & |
1125 |
> |
t, do_pot) |
1126 |
|
#else |
1127 |
< |
me_i = atid(i) |
1127 |
> |
call self_self(i, eFrame, pot(ELECTROSTATIC_POT), & |
1128 |
> |
t, do_pot) |
1129 |
|
#endif |
1130 |
< |
iMap = InteractionMap(me_i, me_j)%InteractionHash |
1130 |
> |
endif |
1131 |
> |
|
1132 |
> |
|
1133 |
> |
if (electrostaticSummationMethod.eq.REACTION_FIELD) then |
1134 |
|
|
1135 |
< |
if ( iand(iMap, ELECTROSTATIC_PAIR).ne.0 ) then |
1136 |
< |
|
1137 |
< |
mu_i = getDipoleMoment(me_i) |
1138 |
< |
|
1139 |
< |
!! The reaction field needs to include a self contribution |
1140 |
< |
!! to the field: |
1141 |
< |
call accumulate_self_rf(i, mu_i, eFrame) |
1142 |
< |
!! Get the reaction field contribution to the |
1143 |
< |
!! potential and torques: |
1144 |
< |
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
1135 |
> |
! loop over the excludes to accumulate RF stuff we've |
1136 |
> |
! left out of the normal pair loop |
1137 |
> |
|
1138 |
> |
do i1 = 1, nSkipsForAtom(i) |
1139 |
> |
j = skipsForAtom(i, i1) |
1140 |
> |
|
1141 |
> |
! prevent overcounting of the skips |
1142 |
> |
if (i.lt.j) then |
1143 |
> |
call get_interatomic_vector(q(:,i), & |
1144 |
> |
q(:,j), d_atm, ratmsq) |
1145 |
> |
rVal = dsqrt(ratmsq) |
1146 |
> |
call get_switch(ratmsq, sw, dswdr, rVal, group_switch, & |
1147 |
> |
in_switching_region) |
1148 |
|
#ifdef IS_MPI |
1149 |
< |
pot_local = pot_local + rfpot |
1149 |
> |
call rf_self_excludes(i, j, sw, eFrame, d_atm, rVal, & |
1150 |
> |
vpair, pot_local(ELECTROSTATIC_POT), f, t, do_pot) |
1151 |
|
#else |
1152 |
< |
pot = pot + rfpot |
1153 |
< |
|
1152 |
> |
call rf_self_excludes(i, j, sw, eFrame, d_atm, rVal, & |
1153 |
> |
vpair, pot(ELECTROSTATIC_POT), f, t, do_pot) |
1154 |
|
#endif |
1155 |
< |
endif |
1156 |
< |
enddo |
1157 |
< |
endif |
1155 |
> |
endif |
1156 |
> |
enddo |
1157 |
> |
endif |
1158 |
> |
enddo |
1159 |
|
endif |
1160 |
< |
|
1039 |
< |
|
1160 |
> |
|
1161 |
|
#ifdef IS_MPI |
1162 |
< |
|
1162 |
> |
|
1163 |
|
if (do_pot) then |
1164 |
< |
pot = pot + pot_local |
1165 |
< |
!! we assume the c code will do the allreduce to get the total potential |
1045 |
< |
!! we could do it right here if we needed to... |
1164 |
> |
call mpi_allreduce(pot_local, pot, LR_POT_TYPES,mpi_double_precision,mpi_sum, & |
1165 |
> |
mpi_comm_world,mpi_err) |
1166 |
|
endif |
1167 |
< |
|
1167 |
> |
|
1168 |
|
if (do_stress) then |
1169 |
|
call mpi_allreduce(tau_Temp, tau, 9,mpi_double_precision,mpi_sum, & |
1170 |
|
mpi_comm_world,mpi_err) |
1171 |
|
call mpi_allreduce(virial_Temp, virial,1,mpi_double_precision,mpi_sum, & |
1172 |
|
mpi_comm_world,mpi_err) |
1173 |
|
endif |
1174 |
< |
|
1174 |
> |
|
1175 |
|
#else |
1176 |
< |
|
1176 |
> |
|
1177 |
|
if (do_stress) then |
1178 |
|
tau = tau_Temp |
1179 |
|
virial = virial_Temp |
1180 |
|
endif |
1181 |
< |
|
1181 |
> |
|
1182 |
|
#endif |
1183 |
< |
|
1183 |
> |
|
1184 |
|
end subroutine do_force_loop |
1185 |
|
|
1186 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
1187 |
< |
eFrame, A, f, t, pot, vpair, fpair) |
1187 |
> |
eFrame, A, f, t, pot, vpair, fpair, d_grp, r_grp) |
1188 |
|
|
1189 |
< |
real( kind = dp ) :: pot, vpair, sw |
1189 |
> |
real( kind = dp ) :: vpair, sw |
1190 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1191 |
|
real( kind = dp ), dimension(3) :: fpair |
1192 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
1193 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1198 |
|
logical, intent(inout) :: do_pot |
1199 |
|
integer, intent(in) :: i, j |
1200 |
|
real ( kind = dp ), intent(inout) :: rijsq |
1201 |
< |
real ( kind = dp ) :: r |
1201 |
> |
real ( kind = dp ), intent(inout) :: r_grp |
1202 |
|
real ( kind = dp ), intent(inout) :: d(3) |
1203 |
< |
real ( kind = dp ) :: ebalance |
1203 |
> |
real ( kind = dp ), intent(inout) :: d_grp(3) |
1204 |
> |
real ( kind = dp ) :: r |
1205 |
|
integer :: me_i, me_j |
1206 |
|
|
1207 |
< |
integer :: iMap |
1207 |
> |
integer :: iHash |
1208 |
|
|
1209 |
|
r = sqrt(rijsq) |
1210 |
|
vpair = 0.0d0 |
1218 |
|
me_j = atid(j) |
1219 |
|
#endif |
1220 |
|
|
1221 |
< |
iMap = InteractionMap(me_i, me_j)%InteractionHash |
1222 |
< |
|
1223 |
< |
if ( iand(iMap, LJ_PAIR).ne.0 ) then |
1224 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
1221 |
> |
iHash = InteractionHash(me_i, me_j) |
1222 |
> |
|
1223 |
> |
if ( iand(iHash, LJ_PAIR).ne.0 ) then |
1224 |
> |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1225 |
> |
pot(VDW_POT), f, do_pot) |
1226 |
|
endif |
1227 |
< |
|
1228 |
< |
if ( iand(iMap, ELECTROSTATIC_PAIR).ne.0 ) then |
1227 |
> |
|
1228 |
> |
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1229 |
|
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1230 |
< |
pot, eFrame, f, t, do_pot) |
1108 |
< |
|
1109 |
< |
if (FF_uses_RF .and. SIM_uses_RF) then |
1110 |
< |
|
1111 |
< |
! CHECK ME (RF needs to know about all electrostatic types) |
1112 |
< |
call accumulate_rf(i, j, r, eFrame, sw) |
1113 |
< |
call rf_correct_forces(i, j, d, r, eFrame, sw, f, fpair) |
1114 |
< |
endif |
1115 |
< |
|
1230 |
> |
pot(ELECTROSTATIC_POT), eFrame, f, t, do_pot) |
1231 |
|
endif |
1232 |
< |
|
1233 |
< |
if ( iand(iMap, STICKY_PAIR).ne.0 ) then |
1232 |
> |
|
1233 |
> |
if ( iand(iHash, STICKY_PAIR).ne.0 ) then |
1234 |
|
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1235 |
< |
pot, A, f, t, do_pot) |
1235 |
> |
pot(HB_POT), A, f, t, do_pot) |
1236 |
|
endif |
1237 |
< |
|
1238 |
< |
if ( iand(iMap, STICKYPOWER_PAIR).ne.0 ) then |
1237 |
> |
|
1238 |
> |
if ( iand(iHash, STICKYPOWER_PAIR).ne.0 ) then |
1239 |
|
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1240 |
< |
pot, A, f, t, do_pot) |
1240 |
> |
pot(HB_POT), A, f, t, do_pot) |
1241 |
|
endif |
1242 |
< |
|
1243 |
< |
if ( iand(iMap, GAYBERNE_PAIR).ne.0 ) then |
1242 |
> |
|
1243 |
> |
if ( iand(iHash, GAYBERNE_PAIR).ne.0 ) then |
1244 |
|
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1245 |
< |
pot, A, f, t, do_pot) |
1245 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1246 |
|
endif |
1247 |
|
|
1248 |
< |
if ( iand(iMap, GAYBERNE_LJ).ne.0 ) then |
1249 |
< |
! call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1250 |
< |
! pot, A, f, t, do_pot) |
1248 |
> |
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1249 |
> |
call do_gb_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1250 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1251 |
|
endif |
1252 |
< |
|
1253 |
< |
if ( iand(iMap, EAM_PAIR).ne.0 ) then |
1254 |
< |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1255 |
< |
do_pot) |
1252 |
> |
|
1253 |
> |
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1254 |
> |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1255 |
> |
pot(METALLIC_POT), f, do_pot) |
1256 |
|
endif |
1257 |
< |
|
1258 |
< |
if ( iand(iMap, SHAPE_PAIR).ne.0 ) then |
1257 |
> |
|
1258 |
> |
if ( iand(iHash, SHAPE_PAIR).ne.0 ) then |
1259 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1260 |
< |
pot, A, f, t, do_pot) |
1260 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1261 |
|
endif |
1262 |
< |
|
1263 |
< |
if ( iand(iMap, SHAPE_LJ).ne.0 ) then |
1262 |
> |
|
1263 |
> |
if ( iand(iHash, SHAPE_LJ).ne.0 ) then |
1264 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1265 |
< |
pot, A, f, t, do_pot) |
1265 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1266 |
|
endif |
1267 |
+ |
|
1268 |
+ |
if ( iand(iHash, SC_PAIR).ne.0 ) then |
1269 |
+ |
call do_SC_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1270 |
+ |
pot(METALLIC_POT), f, do_pot) |
1271 |
+ |
endif |
1272 |
+ |
|
1273 |
|
|
1274 |
+ |
|
1275 |
|
end subroutine do_pair |
1276 |
|
|
1277 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1278 |
|
do_pot, do_stress, eFrame, A, f, t, pot) |
1279 |
|
|
1280 |
< |
real( kind = dp ) :: pot, sw |
1280 |
> |
real( kind = dp ) :: sw |
1281 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1282 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1283 |
|
real (kind=dp), dimension(9,nLocal) :: A |
1284 |
|
real (kind=dp), dimension(3,nLocal) :: f |
1290 |
|
real ( kind = dp ) :: r, rc |
1291 |
|
real ( kind = dp ), intent(inout) :: d(3), dc(3) |
1292 |
|
|
1293 |
< |
integer :: me_i, me_j, iMap |
1293 |
> |
integer :: me_i, me_j, iHash |
1294 |
|
|
1295 |
+ |
r = sqrt(rijsq) |
1296 |
+ |
|
1297 |
|
#ifdef IS_MPI |
1298 |
|
me_i = atid_row(i) |
1299 |
|
me_j = atid_col(j) |
1302 |
|
me_j = atid(j) |
1303 |
|
#endif |
1304 |
|
|
1305 |
< |
iMap = InteractionMap(me_i, me_j)%InteractionHash |
1305 |
> |
iHash = InteractionHash(me_i, me_j) |
1306 |
|
|
1307 |
< |
if ( iand(iMap, EAM_PAIR).ne.0 ) then |
1307 |
> |
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1308 |
|
call calc_EAM_prepair_rho(i, j, d, r, rijsq ) |
1309 |
+ |
endif |
1310 |
+ |
|
1311 |
+ |
if ( iand(iHash, SC_PAIR).ne.0 ) then |
1312 |
+ |
call calc_SC_prepair_rho(i, j, d, r, rijsq ) |
1313 |
|
endif |
1314 |
|
|
1315 |
|
end subroutine do_prepair |
1317 |
|
|
1318 |
|
subroutine do_preforce(nlocal,pot) |
1319 |
|
integer :: nlocal |
1320 |
< |
real( kind = dp ) :: pot |
1320 |
> |
real( kind = dp ),dimension(LR_POT_TYPES) :: pot |
1321 |
|
|
1322 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1323 |
< |
call calc_EAM_preforce_Frho(nlocal,pot) |
1323 |
> |
call calc_EAM_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1324 |
|
endif |
1325 |
+ |
if (FF_uses_SC .and. SIM_uses_SC) then |
1326 |
+ |
call calc_SC_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1327 |
+ |
endif |
1328 |
|
|
1329 |
|
|
1330 |
|
end subroutine do_preforce |
1409 |
|
pot_Col = 0.0_dp |
1410 |
|
pot_Temp = 0.0_dp |
1411 |
|
|
1280 |
– |
rf_Row = 0.0_dp |
1281 |
– |
rf_Col = 0.0_dp |
1282 |
– |
rf_Temp = 0.0_dp |
1283 |
– |
|
1412 |
|
#endif |
1413 |
|
|
1414 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1415 |
|
call clean_EAM() |
1416 |
|
endif |
1417 |
|
|
1290 |
– |
rf = 0.0_dp |
1418 |
|
tau_Temp = 0.0_dp |
1419 |
|
virial_Temp = 0.0_dp |
1420 |
|
end subroutine zero_work_arrays |
1503 |
|
|
1504 |
|
function FF_UsesDirectionalAtoms() result(doesit) |
1505 |
|
logical :: doesit |
1506 |
< |
doesit = FF_uses_DirectionalAtoms .or. FF_uses_Dipoles .or. & |
1380 |
< |
FF_uses_Quadrupoles .or. FF_uses_Sticky .or. & |
1381 |
< |
FF_uses_StickyPower .or. FF_uses_GayBerne .or. FF_uses_Shapes |
1506 |
> |
doesit = FF_uses_DirectionalAtoms |
1507 |
|
end function FF_UsesDirectionalAtoms |
1508 |
|
|
1509 |
|
function FF_RequiresPrepairCalc() result(doesit) |
1510 |
|
logical :: doesit |
1511 |
< |
doesit = FF_uses_EAM |
1511 |
> |
doesit = FF_uses_EAM .or. FF_uses_SC & |
1512 |
> |
.or. FF_uses_MEAM |
1513 |
|
end function FF_RequiresPrepairCalc |
1514 |
|
|
1389 |
– |
function FF_RequiresPostpairCalc() result(doesit) |
1390 |
– |
logical :: doesit |
1391 |
– |
doesit = FF_uses_RF |
1392 |
– |
end function FF_RequiresPostpairCalc |
1393 |
– |
|
1515 |
|
#ifdef PROFILE |
1516 |
|
function getforcetime() result(totalforcetime) |
1517 |
|
real(kind=dp) :: totalforcetime |