4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @version $Id: do_Forces.F90,v 1.12 2003-03-12 15:39:01 gezelter Exp $, $Date: 2003-03-12 15:39:01 $, $Name: not supported by cvs2svn $, $Revision: 1.12 $ |
7 |
> |
!! @version $Id: do_Forces.F90,v 1.15 2003-03-12 22:27:59 gezelter Exp $, $Date: 2003-03-12 22:27:59 $, $Name: not supported by cvs2svn $, $Revision: 1.15 $ |
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
module do_Forces |
12 |
|
use simulation |
13 |
|
use definitions |
14 |
< |
use forceGlobals |
15 |
< |
use atype_typedefs |
16 |
< |
use neighborLists |
17 |
< |
|
18 |
< |
|
19 |
< |
use lj |
14 |
> |
use atype_module |
15 |
> |
use neighborLists |
16 |
> |
use lj_FF |
17 |
|
use sticky_FF |
18 |
|
use dipole_dipole |
19 |
|
use gb_FF |
24 |
|
implicit none |
25 |
|
PRIVATE |
26 |
|
|
27 |
< |
public :: do_force_loop |
27 |
> |
logical, save :: do_forces_initialized = .false. |
28 |
> |
logical, save :: FF_uses_LJ |
29 |
> |
logical, save :: FF_uses_sticky |
30 |
> |
logical, save :: FF_uses_dipoles |
31 |
> |
logical, save :: FF_uses_RF |
32 |
> |
logical, save :: FF_uses_GB |
33 |
> |
logical, save :: FF_uses_EAM |
34 |
|
|
35 |
+ |
|
36 |
+ |
public :: init_FF |
37 |
+ |
public :: do_forces |
38 |
+ |
|
39 |
|
contains |
40 |
|
|
41 |
+ |
subroutine init_FF(thisStat) |
42 |
+ |
|
43 |
+ |
integer, intent(out) :: my_status |
44 |
+ |
integer :: thisStat = 0 |
45 |
+ |
|
46 |
+ |
! be a smarter subroutine. |
47 |
+ |
|
48 |
+ |
|
49 |
+ |
call init_lj_FF(my_status) |
50 |
+ |
if (my_status /= 0) then |
51 |
+ |
thisStat = -1 |
52 |
+ |
return |
53 |
+ |
end if |
54 |
+ |
|
55 |
+ |
call check_sticky_FF(my_status) |
56 |
+ |
if (my_status /= 0) then |
57 |
+ |
thisStat = -1 |
58 |
+ |
return |
59 |
+ |
end if |
60 |
+ |
|
61 |
+ |
do_forces_initialized = .true. |
62 |
+ |
|
63 |
+ |
end subroutine init_FF |
64 |
+ |
|
65 |
+ |
|
66 |
+ |
|
67 |
|
!! Does force loop over i,j pairs. Calls do_pair to calculates forces. |
68 |
|
!-------------------------------------------------------------> |
69 |
< |
subroutine do_force_loop(q,A,mu,u_l,f,t,tau,potE,do_pot,FFerror) |
69 |
> |
subroutine do_force_loop(q, A, u_l, f, t, tau, pot, do_pot_c, do_stress_c, & |
70 |
> |
error) |
71 |
|
!! Position array provided by C, dimensioned by getNlocal |
72 |
|
real ( kind = dp ), dimension(3,getNlocal()) :: q |
73 |
|
!! Rotation Matrix for each long range particle in simulation. |
74 |
< |
real( kind = dp), dimension(9,getNlocal()) :: A |
41 |
< |
|
42 |
< |
!! Magnitude dipole moment |
43 |
< |
real( kind = dp ), dimension(3,getNlocal()) :: mu |
74 |
> |
real( kind = dp), dimension(9,getNlocal()) :: A |
75 |
|
!! Unit vectors for dipoles (lab frame) |
76 |
|
real( kind = dp ), dimension(3,getNlocal()) :: u_l |
77 |
|
!! Force array provided by C, dimensioned by getNlocal |
78 |
|
real ( kind = dp ), dimension(3,getNlocal()) :: f |
79 |
|
!! Torsion array provided by C, dimensioned by getNlocal |
80 |
< |
real( kind = dp ), dimension(3,getNlocal()) :: t |
50 |
< |
|
80 |
> |
real( kind = dp ), dimension(3,getNlocal()) :: t |
81 |
|
!! Stress Tensor |
82 |
< |
real( kind = dp), dimension(9) :: tau |
83 |
< |
|
84 |
< |
real ( kind = dp ) :: potE |
85 |
< |
logical ( kind = 2) :: do_pot |
86 |
< |
integer :: FFerror |
57 |
< |
|
82 |
> |
real( kind = dp), dimension(9) :: tau |
83 |
> |
real ( kind = dp ) :: pot |
84 |
> |
logical ( kind = 2) :: do_pot_c, do_stress_c |
85 |
> |
logical :: do_pot |
86 |
> |
logical :: do_stress |
87 |
|
#ifdef IS_MPI |
88 |
|
real( kind = DP ) :: pot_local |
60 |
– |
#endif |
61 |
– |
|
62 |
– |
real( kind = DP ) :: pe |
63 |
– |
logical :: update_nlist |
64 |
– |
|
65 |
– |
|
66 |
– |
integer :: i, j, jbeg, jend, jnab, idim, jdim, idim2, jdim2, dim, dim2 |
67 |
– |
integer :: nlist |
68 |
– |
integer :: j_start |
69 |
– |
|
70 |
– |
real( kind = DP ) :: r_ij, pot, ftmp, dudr, d2, drdx1, kt1, kt2, kt3, ktmp |
71 |
– |
|
72 |
– |
real( kind = DP ) :: rx_ij, ry_ij, rz_ij, rijsq |
73 |
– |
real( kind = DP ) :: rlistsq, rcutsq, rlist, rcut |
74 |
– |
|
75 |
– |
! a rig that need to be fixed. |
76 |
– |
#ifdef IS_MPI |
77 |
– |
real( kind = dp ) :: pe_local |
89 |
|
integer :: nlocal |
79 |
– |
#endif |
90 |
|
integer :: nrow |
91 |
|
integer :: ncol |
92 |
< |
integer :: natoms |
92 |
> |
#endif |
93 |
> |
integer :: natoms |
94 |
> |
logical :: update_nlist |
95 |
> |
integer :: i, j, jbeg, jend, jnab |
96 |
> |
integer :: nlist |
97 |
> |
real( kind = DP ) :: rijsq, rlistsq, rcutsq, rlist, rcut |
98 |
|
integer :: neighborListSize |
99 |
|
integer :: listerror |
85 |
– |
!! should we calculate the stress tensor |
86 |
– |
logical :: do_stress = .false. |
87 |
– |
FFerror = 0 |
100 |
|
|
101 |
< |
! Make sure we are properly initialized. |
102 |
< |
if (.not. isFFInit) then |
91 |
< |
write(default_error,*) "ERROR: lj_FF has not been properly initialized" |
92 |
< |
FFerror = -1 |
93 |
< |
return |
94 |
< |
endif |
101 |
> |
!! initialize local variables |
102 |
> |
|
103 |
|
#ifdef IS_MPI |
104 |
< |
if (.not. isMPISimSet()) then |
105 |
< |
write(default_error,*) "ERROR: mpiSimulation has not been properly initialized" |
106 |
< |
FFerror = -1 |
107 |
< |
return |
108 |
< |
endif |
104 |
> |
nlocal = getNlocal() |
105 |
> |
nrow = getNrow(plan_row) |
106 |
> |
ncol = getNcol(plan_col) |
107 |
> |
#else |
108 |
> |
nlocal = getNlocal() |
109 |
> |
natoms = nlocal |
110 |
|
#endif |
111 |
< |
|
103 |
< |
!! initialize local variables |
104 |
< |
natoms = getNlocal() |
111 |
> |
|
112 |
|
call getRcut(rcut,rcut2=rcutsq) |
113 |
|
call getRlist(rlist,rlistsq) |
114 |
|
|
115 |
< |
!! See if we need to update neighbor lists |
116 |
< |
call check(q, update_nlist) |
110 |
< |
|
111 |
< |
!--------------WARNING........................... |
112 |
< |
! Zero variables, NOTE:::: Forces are zeroed in C |
113 |
< |
! Zeroing them here could delete previously computed |
114 |
< |
! Forces. |
115 |
< |
!------------------------------------------------ |
116 |
< |
call zero_module_variables() |
115 |
> |
call check_initialization() |
116 |
> |
call zero_work_arrays() |
117 |
|
|
118 |
< |
! communicate MPI positions |
118 |
> |
do_pot = do_pot_c |
119 |
> |
do_stress = do_stress_c |
120 |
> |
|
121 |
> |
! Gather all information needed by all force loops: |
122 |
> |
|
123 |
|
#ifdef IS_MPI |
124 |
+ |
|
125 |
|
call gather(q,q_Row,plan_row3d) |
126 |
|
call gather(q,q_Col,plan_col3d) |
127 |
+ |
|
128 |
+ |
if (FF_UsesDirectionalAtoms() .and. SimUsesDirectionalAtoms()) then |
129 |
+ |
call gather(u_l,u_l_Row,plan_row3d) |
130 |
+ |
call gather(u_l,u_l_Col,plan_col3d) |
131 |
+ |
|
132 |
+ |
call gather(A,A_Row,plan_row_rotation) |
133 |
+ |
call gather(A,A_Col,plan_col_rotation) |
134 |
+ |
endif |
135 |
|
|
123 |
– |
call gather(u_l,u_l_Row,plan_row3d) |
124 |
– |
call gather(u_l,u_l_Col,plan_col3d) |
125 |
– |
|
126 |
– |
call gather(A,A_Row,plan_row_rotation) |
127 |
– |
call gather(A,A_Col,plan_col_rotation) |
136 |
|
#endif |
137 |
< |
|
138 |
< |
|
137 |
> |
|
138 |
> |
if (FF_RequiresPrepairCalc() .and. SimRequiresPrepairCalc()) then |
139 |
> |
!! See if we need to update neighbor lists |
140 |
> |
call checkNeighborList(nlocal, q, rcut, rlist, update_nlist) |
141 |
> |
!! if_mpi_gather_stuff_for_prepair |
142 |
> |
!! do_prepair_loop_if_needed |
143 |
> |
!! if_mpi_scatter_stuff_from_prepair |
144 |
> |
!! if_mpi_gather_stuff_from_prepair_to_main_loop |
145 |
> |
else |
146 |
> |
!! See if we need to update neighbor lists |
147 |
> |
call checkNeighborList(nlocal, q, rcut, rlist, update_nlist) |
148 |
> |
endif |
149 |
> |
|
150 |
|
#ifdef IS_MPI |
151 |
|
|
152 |
|
if (update_nlist) then |
153 |
|
|
154 |
< |
! save current configuration, contruct neighbor list, |
155 |
< |
! and calculate forces |
154 |
> |
!! save current configuration, construct neighbor list, |
155 |
> |
!! and calculate forces |
156 |
|
call save_neighborList(q) |
157 |
|
|
158 |
|
neighborListSize = getNeighborListSize() |
159 |
< |
nlist = 0 |
159 |
> |
nlist = 0 |
160 |
|
|
142 |
– |
nrow = getNrow(plan_row) |
143 |
– |
ncol = getNcol(plan_col) |
144 |
– |
nlocal = getNlocal() |
145 |
– |
|
161 |
|
do i = 1, nrow |
162 |
|
point(i) = nlist + 1 |
163 |
|
|
164 |
|
inner: do j = 1, ncol |
165 |
|
|
166 |
|
if (check_exclude(i,j)) cycle inner: |
167 |
< |
|
167 |
> |
|
168 |
|
call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq) |
169 |
|
|
170 |
|
if (rijsq < rlistsq) then |
172 |
|
nlist = nlist + 1 |
173 |
|
|
174 |
|
if (nlist > neighborListSize) then |
175 |
< |
call expandList(listerror) |
175 |
> |
call expandNeighborList(nlocal, listerror) |
176 |
|
if (listerror /= 0) then |
177 |
< |
FFerror = -1 |
177 |
> |
error = -1 |
178 |
|
write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded." |
179 |
|
return |
180 |
|
end if |
183 |
|
list(nlist) = j |
184 |
|
|
185 |
|
if (rijsq < rcutsq) then |
186 |
< |
call do_pair(i, j, rijsq, d) |
186 |
> |
call do_pair(i, j, rijsq, d, do_pot, do_stress) |
187 |
|
endif |
188 |
|
endif |
189 |
|
enddo inner |
191 |
|
|
192 |
|
point(nrow + 1) = nlist + 1 |
193 |
|
|
194 |
< |
else !! (update) |
194 |
> |
else !! (of update_check) |
195 |
|
|
196 |
|
! use the list to find the neighbors |
197 |
|
do i = 1, nrow |
204 |
|
j = list(jnab) |
205 |
|
|
206 |
|
call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq) |
207 |
< |
call do_pair(i, j, rijsq, d) |
207 |
> |
call do_pair(i, j, rijsq, d, do_pot, do_stress) |
208 |
|
|
209 |
|
enddo |
210 |
|
endif |
211 |
|
enddo |
212 |
|
endif |
213 |
< |
|
213 |
> |
|
214 |
|
#else |
215 |
|
|
216 |
|
if (update_nlist) then |
221 |
|
|
222 |
|
neighborListSize = getNeighborListSize() |
223 |
|
nlist = 0 |
224 |
< |
|
224 |
> |
|
225 |
|
do i = 1, natoms-1 |
226 |
|
point(i) = nlist + 1 |
227 |
< |
|
227 |
> |
|
228 |
|
inner: do j = i+1, natoms |
229 |
< |
|
229 |
> |
|
230 |
|
if (check_exclude(i,j)) cycle inner: |
231 |
< |
|
231 |
> |
|
232 |
|
call get_interatomic_vector(q(:,i), q(:,j), d, rijsq) |
233 |
|
|
234 |
|
if (rijsq < rlistsq) then |
236 |
|
nlist = nlist + 1 |
237 |
|
|
238 |
|
if (nlist > neighborListSize) then |
239 |
< |
call expandList(listerror) |
239 |
> |
call expandList(natoms, listerror) |
240 |
|
if (listerror /= 0) then |
241 |
< |
FFerror = -1 |
241 |
> |
error = -1 |
242 |
|
write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded." |
243 |
|
return |
244 |
|
end if |
245 |
|
endif |
246 |
|
|
247 |
|
list(nlist) = j |
248 |
< |
|
248 |
> |
|
249 |
|
if (rijsq < rcutsq) then |
250 |
< |
call do_pair(i, j, rijsq, d) |
250 |
> |
call do_pair(i, j, rijsq, d, do_pot, do_stress) |
251 |
|
endif |
252 |
|
endif |
253 |
|
enddo inner |
268 |
|
j = list(jnab) |
269 |
|
|
270 |
|
call get_interatomic_vector(q(:,i), q(:,j), d, rijsq) |
271 |
< |
call do_pair(i, j, rijsq, d) |
271 |
> |
call do_pair(i, j, rijsq, d, do_pot, do_stress) |
272 |
|
|
273 |
|
enddo |
274 |
|
endif |
277 |
|
|
278 |
|
#endif |
279 |
|
|
280 |
< |
|
266 |
< |
#ifdef IS_MPI |
267 |
< |
!! distribute all reaction field stuff (or anything for post-pair): |
268 |
< |
call scatter(rflRow,rflTemp1,plan_row3d) |
269 |
< |
call scatter(rflCol,rflTemp2,plan_col3d) |
270 |
< |
do i = 1,nlocal |
271 |
< |
rflTemp(1:3,i) = rflTemp1(1:3,i) + rflTemp2(1:3,i) |
272 |
< |
end do |
273 |
< |
#endif |
274 |
< |
|
275 |
< |
! This is the post-pair loop: |
276 |
< |
#ifdef IS_MPI |
277 |
< |
|
278 |
< |
if (system_has_postpair_atoms) then |
279 |
< |
do i = 1, nlocal |
280 |
< |
Atype_i => identPtrListRow(i)%this |
281 |
< |
call do_postpair(i, Atype_i) |
282 |
< |
enddo |
283 |
< |
endif |
284 |
< |
|
285 |
< |
#else |
286 |
< |
|
287 |
< |
if (system_has_postpair_atoms) then |
288 |
< |
do i = 1, natoms |
289 |
< |
Atype_i => identPtr(i)%this |
290 |
< |
call do_postpair(i, Atype_i) |
291 |
< |
enddo |
292 |
< |
endif |
280 |
> |
! phew, done with main loop. |
281 |
|
|
294 |
– |
#endif |
295 |
– |
|
296 |
– |
|
282 |
|
#ifdef IS_MPI |
283 |
|
!!distribute forces |
284 |
< |
|
284 |
> |
|
285 |
|
call scatter(f_Row,f,plan_row3d) |
286 |
|
call scatter(f_Col,f_temp,plan_col3d) |
287 |
|
do i = 1,nlocal |
288 |
|
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
289 |
|
end do |
290 |
< |
|
291 |
< |
if (doTorque()) then |
290 |
> |
|
291 |
> |
if (FF_UsesDirectionalAtoms() .and. SimUsesDirectionalAtoms()) then |
292 |
|
call scatter(t_Row,t,plan_row3d) |
293 |
|
call scatter(t_Col,t_temp,plan_col3d) |
294 |
< |
|
294 |
> |
|
295 |
|
do i = 1,nlocal |
296 |
|
t(1:3,i) = t(1:3,i) + t_temp(1:3,i) |
297 |
|
end do |
314 |
|
pot_local = pot_local + pot_Temp(i) |
315 |
|
enddo |
316 |
|
|
317 |
+ |
endif |
318 |
+ |
|
319 |
+ |
if (FF_RequiresPostpairCalc() .and. SimRequiresPostpairCalc()) then |
320 |
+ |
|
321 |
+ |
if (FF_uses_RF .and. SimUsesRF()) then |
322 |
+ |
|
323 |
+ |
#ifdef IS_MPI |
324 |
+ |
call scatter(rf_Row,rf,plan_row3d) |
325 |
+ |
call scatter(rf_Col,rf_Temp,plan_col3d) |
326 |
+ |
do i = 1,nlocal |
327 |
+ |
rf(1:3,i) = rf(1:3,i) + rf_Temp(1:3,i) |
328 |
+ |
end do |
329 |
+ |
#endif |
330 |
+ |
|
331 |
+ |
do i = 1, getNlocal() |
332 |
+ |
|
333 |
+ |
#ifdef IS_MPI |
334 |
+ |
me_i = atid_row(i) |
335 |
+ |
#else |
336 |
+ |
me_i = atid(i) |
337 |
+ |
#endif |
338 |
+ |
call getElementProperty(atypes, me_i, "is_DP", is_DP_i) |
339 |
+ |
if ( is_DP_i ) then |
340 |
+ |
call getElementProperty(atypes, me_i, "dipole_moment", mu_i) |
341 |
+ |
!! The reaction field needs to include a self contribution |
342 |
+ |
!! to the field: |
343 |
+ |
call accumulate_self_rf(i, mu_i, u_l) |
344 |
+ |
!! Get the reaction field contribution to the |
345 |
+ |
!! potential and torques: |
346 |
+ |
call reaction_field(i, mu_i, u_l, rfpot, t, do_pot) |
347 |
+ |
#ifdef IS_MPI |
348 |
+ |
pot_local = pot_local + rfpot |
349 |
+ |
#else |
350 |
+ |
pot = pot + rfpot |
351 |
+ |
#endif |
352 |
+ |
endif |
353 |
+ |
enddo |
354 |
+ |
endif |
355 |
+ |
endif |
356 |
+ |
|
357 |
+ |
|
358 |
+ |
#ifdef IS_MPI |
359 |
+ |
|
360 |
+ |
if (do_pot) then |
361 |
|
pot = pot_local |
362 |
+ |
!! we assume the c code will do the allreduce to get the total potential |
363 |
+ |
!! we could do it right here if we needed to... |
364 |
|
endif |
365 |
|
|
366 |
< |
if (doStress()) then |
366 |
> |
if (do_stress) then |
367 |
|
mpi_allreduce(tau, tau_Temp,9,mpi_double_precision,mpi_sum, & |
368 |
|
mpi_comm_world,mpi_err) |
369 |
|
mpi_allreduce(virial, virial_Temp,1,mpi_double_precision,mpi_sum, & |
370 |
|
mpi_comm_world,mpi_err) |
371 |
|
endif |
372 |
|
|
373 |
< |
#endif |
373 |
> |
#else |
374 |
|
|
375 |
< |
if (doStress()) then |
375 |
> |
if (do_stress) then |
376 |
|
tau = tau_Temp |
377 |
|
virial = virial_Temp |
378 |
|
endif |
379 |
|
|
380 |
+ |
#endif |
381 |
+ |
|
382 |
|
end subroutine do_force_loop |
383 |
|
|
384 |
|
|
397 |
|
|
398 |
|
end subroutine do_postForce |
399 |
|
|
400 |
< |
subroutine do_pair(i, j, rijsq, d) |
400 |
> |
subroutine do_pair(i, j, rijsq, d, do_pot, do_stress) |
401 |
|
|
402 |
+ |
logical, intent(inout) :: do_pot, do_stress |
403 |
|
integer, intent(in) :: i, j |
404 |
|
real ( kind = dp ), intent(in) :: rijsq |
405 |
|
real ( kind = dp ) :: r |
424 |
|
|
425 |
|
#endif |
426 |
|
|
393 |
– |
call getElementProperty(atypes, me_i, "is_LJ", is_LJ_i) |
394 |
– |
call getElementProperty(atypes, me_j, "is_LJ", is_LJ_j) |
427 |
|
|
428 |
< |
if ( is_LJ_i .and. is_LJ_j ) call do_lj_pair(i, j, d, r, rijsq, pot, f) |
428 |
> |
if (FF_uses_LJ .and. SimUsesLJ()) then |
429 |
> |
call getElementProperty(atypes, me_i, "is_LJ", is_LJ_i) |
430 |
> |
call getElementProperty(atypes, me_j, "is_LJ", is_LJ_j) |
431 |
> |
|
432 |
> |
if ( is_LJ_i .and. is_LJ_j ) & |
433 |
> |
call do_lj_pair(i, j, d, r, rijsq, pot, f, do_pot, do_stress) |
434 |
> |
endif |
435 |
> |
|
436 |
|
|
437 |
< |
call getElementProperty(atypes, me_i, "is_DP", is_DP_i) |
438 |
< |
call getElementProperty(atypes, me_j, "is_DP", is_DP_j) |
439 |
< |
|
440 |
< |
if ( is_DP_i .and. is_DP_j ) then |
441 |
< |
|
442 |
< |
call do_dipole_pair(i, j, d, r, pot, u_l, f, t) |
443 |
< |
|
444 |
< |
if (do_reaction_field) then |
445 |
< |
call accumulate_rf(i, j, r) |
437 |
> |
if (FF_uses_DP .and. SimUsesDP()) then |
438 |
> |
call getElementProperty(atypes, me_i, "is_DP", is_DP_i) |
439 |
> |
call getElementProperty(atypes, me_j, "is_DP", is_DP_j) |
440 |
> |
|
441 |
> |
if ( is_DP_i .and. is_DP_j ) then |
442 |
> |
|
443 |
> |
call do_dipole_pair(i, j, d, r, pot, u_l, f, t, do_pot, do_stress) |
444 |
> |
|
445 |
> |
if (FF_uses_RF .and. SimUsesRF()) then |
446 |
> |
|
447 |
> |
call accumulate_rf(i, j, r, u_l) |
448 |
> |
call rf_correct_forces(i, j, d, r, u_l, f, do_stress) |
449 |
> |
|
450 |
> |
endif |
451 |
> |
|
452 |
|
endif |
408 |
– |
|
453 |
|
endif |
454 |
|
|
455 |
< |
call getElementProperty(atypes, me_i, "is_Sticky", is_Sticky_i) |
412 |
< |
call getElementProperty(atypes, me_j, "is_Sticky", is_Sticky_j) |
455 |
> |
if (FF_uses_Sticky .and. SimUsesSticky()) then |
456 |
|
|
457 |
< |
if ( is_Sticky_i .and. is_Sticky_j ) then |
458 |
< |
call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t) |
457 |
> |
call getElementProperty(atypes, me_i, "is_Sticky", is_Sticky_i) |
458 |
> |
call getElementProperty(atypes, me_j, "is_Sticky", is_Sticky_j) |
459 |
> |
|
460 |
> |
if ( is_Sticky_i .and. is_Sticky_j ) then |
461 |
> |
call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t, & |
462 |
> |
do_pot, do_stress) |
463 |
> |
endif |
464 |
|
endif |
417 |
– |
|
465 |
|
|
466 |
|
end subroutine do_pair |
467 |
|
|
484 |
|
r_sq = dot_product(d,d) |
485 |
|
|
486 |
|
end subroutine get_interatomic_vector |
440 |
– |
|
441 |
– |
subroutine zero_module_variables() |
487 |
|
|
488 |
< |
#ifndef IS_MPI |
488 |
> |
subroutine check_initialization(error) |
489 |
> |
integer, intent(out) :: error |
490 |
|
|
491 |
< |
pe = 0.0E0_DP |
492 |
< |
tauTemp = 0.0_dp |
493 |
< |
fTemp = 0.0_dp |
494 |
< |
tTemp = 0.0_dp |
495 |
< |
#else |
496 |
< |
qRow = 0.0_dp |
497 |
< |
qCol = 0.0_dp |
491 |
> |
error = 0 |
492 |
> |
! Make sure we are properly initialized. |
493 |
> |
if (.not. do_Forces_initialized) then |
494 |
> |
write(default_error,*) "ERROR: do_Forces has not been initialized!" |
495 |
> |
error = -1 |
496 |
> |
return |
497 |
> |
endif |
498 |
> |
#ifdef IS_MPI |
499 |
> |
if (.not. isMPISimSet()) then |
500 |
> |
write(default_error,*) "ERROR: mpiSimulation has not been initialized!" |
501 |
> |
error = -1 |
502 |
> |
return |
503 |
> |
endif |
504 |
> |
#endif |
505 |
> |
|
506 |
> |
return |
507 |
> |
end subroutine check_initialization |
508 |
> |
|
509 |
> |
|
510 |
> |
subroutine zero_work_arrays() |
511 |
|
|
512 |
< |
muRow = 0.0_dp |
513 |
< |
muCol = 0.0_dp |
512 |
> |
#ifdef IS_MPI |
513 |
> |
|
514 |
> |
q_Row = 0.0_dp |
515 |
> |
q_Col = 0.0_dp |
516 |
|
|
517 |
< |
u_lRow = 0.0_dp |
518 |
< |
u_lCol = 0.0_dp |
517 |
> |
u_l_Row = 0.0_dp |
518 |
> |
u_l_Col = 0.0_dp |
519 |
|
|
520 |
< |
ARow = 0.0_dp |
521 |
< |
ACol = 0.0_dp |
520 |
> |
A_Row = 0.0_dp |
521 |
> |
A_Col = 0.0_dp |
522 |
|
|
523 |
< |
fRow = 0.0_dp |
524 |
< |
fCol = 0.0_dp |
525 |
< |
|
526 |
< |
|
527 |
< |
tRow = 0.0_dp |
528 |
< |
tCol = 0.0_dp |
523 |
> |
f_Row = 0.0_dp |
524 |
> |
f_Col = 0.0_dp |
525 |
> |
f_Temp = 0.0_dp |
526 |
> |
|
527 |
> |
t_Row = 0.0_dp |
528 |
> |
t_Col = 0.0_dp |
529 |
> |
t_Temp = 0.0_dp |
530 |
|
|
531 |
< |
|
531 |
> |
pot_Row = 0.0_dp |
532 |
> |
pot_Col = 0.0_dp |
533 |
> |
pot_Temp = 0.0_dp |
534 |
|
|
471 |
– |
eRow = 0.0_dp |
472 |
– |
eCol = 0.0_dp |
473 |
– |
eTemp = 0.0_dp |
535 |
|
#endif |
536 |
|
|
537 |
< |
end subroutine zero_module_variables |
537 |
> |
tau_Temp = 0.0_dp |
538 |
> |
virial_Temp = 0.0_dp |
539 |
> |
|
540 |
> |
end subroutine zero_work_arrays |
541 |
> |
|
542 |
|
|
478 |
– |
|
543 |
|
!! Function to properly build neighbor lists in MPI using newtons 3rd law. |
544 |
|
!! We don't want 2 processors doing the same i j pair twice. |
545 |
|
!! Also checks to see if i and j are the same particle. |
604 |
|
|
605 |
|
end function checkExcludes |
606 |
|
|
607 |
< |
|
607 |
> |
function FF_UsesDirectionalAtoms() result(doesit) |
608 |
> |
logical :: doesit |
609 |
> |
doesit = FF_uses_dipoles .or. FF_uses_sticky .or. & |
610 |
> |
FF_uses_GB .or. FF_uses_RF |
611 |
> |
end function FF_UsesDirectionalAtoms |
612 |
> |
|
613 |
> |
function FF_RequiresPrepairCalc() result(doesit) |
614 |
> |
logical :: doesit |
615 |
> |
doesit = FF_uses_EAM |
616 |
> |
end function FF_RequiresPrepairCalc |
617 |
> |
|
618 |
> |
function FF_RequiresPostpairCalc() result(doesit) |
619 |
> |
logical :: doesit |
620 |
> |
doesit = FF_uses_RF |
621 |
> |
end function FF_RequiresPostpairCalc |
622 |
> |
|
623 |
|
end module do_Forces |