1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
|
!! doForces.F90 |
43 |
|
!! module doForces |
44 |
|
!! Calculates Long Range forces. |
45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.1 2004-10-20 04:19:55 gezelter Exp $, $Date: 2004-10-20 04:19:55 $, $Name: not supported by cvs2svn $, $Revision: 1.1 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.15 2005-05-05 14:47:35 chrisfen Exp $, $Date: 2005-05-05 14:47:35 $, $Name: not supported by cvs2svn $, $Revision: 1.15 $ |
49 |
|
|
50 |
+ |
|
51 |
|
module doForces |
52 |
|
use force_globals |
53 |
|
use simulation |
56 |
|
use switcheroo |
57 |
|
use neighborLists |
58 |
|
use lj |
59 |
< |
use sticky_pair |
60 |
< |
use dipole_dipole |
19 |
< |
use charge_charge |
59 |
> |
use sticky |
60 |
> |
use electrostatic_module |
61 |
|
use reaction_field |
62 |
|
use gb_pair |
63 |
+ |
use shapes |
64 |
|
use vector_class |
65 |
|
use eam |
66 |
|
use status |
72 |
|
PRIVATE |
73 |
|
|
74 |
|
#define __FORTRAN90 |
33 |
– |
#include "UseTheForce/fForceField.h" |
75 |
|
#include "UseTheForce/fSwitchingFunction.h" |
76 |
|
|
77 |
|
INTEGER, PARAMETER:: PREPAIR_LOOP = 1 |
79 |
|
|
80 |
|
logical, save :: haveRlist = .false. |
81 |
|
logical, save :: haveNeighborList = .false. |
41 |
– |
logical, save :: havePolicies = .false. |
82 |
|
logical, save :: haveSIMvariables = .false. |
83 |
|
logical, save :: havePropertyMap = .false. |
84 |
|
logical, save :: haveSaneForceField = .false. |
85 |
< |
logical, save :: FF_uses_LJ |
86 |
< |
logical, save :: FF_uses_sticky |
87 |
< |
logical, save :: FF_uses_charges |
88 |
< |
logical, save :: FF_uses_dipoles |
89 |
< |
logical, save :: FF_uses_RF |
90 |
< |
logical, save :: FF_uses_GB |
85 |
> |
|
86 |
> |
logical, save :: FF_uses_DirectionalAtoms |
87 |
> |
logical, save :: FF_uses_LennardJones |
88 |
> |
logical, save :: FF_uses_Electrostatics |
89 |
> |
logical, save :: FF_uses_Charges |
90 |
> |
logical, save :: FF_uses_Dipoles |
91 |
> |
logical, save :: FF_uses_Quadrupoles |
92 |
> |
logical, save :: FF_uses_Sticky |
93 |
> |
logical, save :: FF_uses_StickyPower |
94 |
> |
logical, save :: FF_uses_GayBerne |
95 |
|
logical, save :: FF_uses_EAM |
96 |
< |
logical, save :: SIM_uses_LJ |
97 |
< |
logical, save :: SIM_uses_sticky |
98 |
< |
logical, save :: SIM_uses_charges |
99 |
< |
logical, save :: SIM_uses_dipoles |
100 |
< |
logical, save :: SIM_uses_RF |
101 |
< |
logical, save :: SIM_uses_GB |
96 |
> |
logical, save :: FF_uses_Shapes |
97 |
> |
logical, save :: FF_uses_FLARB |
98 |
> |
logical, save :: FF_uses_RF |
99 |
> |
|
100 |
> |
logical, save :: SIM_uses_DirectionalAtoms |
101 |
> |
logical, save :: SIM_uses_LennardJones |
102 |
> |
logical, save :: SIM_uses_Electrostatics |
103 |
> |
logical, save :: SIM_uses_Charges |
104 |
> |
logical, save :: SIM_uses_Dipoles |
105 |
> |
logical, save :: SIM_uses_Quadrupoles |
106 |
> |
logical, save :: SIM_uses_Sticky |
107 |
> |
logical, save :: SIM_uses_StickyPower |
108 |
> |
logical, save :: SIM_uses_GayBerne |
109 |
|
logical, save :: SIM_uses_EAM |
110 |
+ |
logical, save :: SIM_uses_Shapes |
111 |
+ |
logical, save :: SIM_uses_FLARB |
112 |
+ |
logical, save :: SIM_uses_RF |
113 |
|
logical, save :: SIM_requires_postpair_calc |
114 |
|
logical, save :: SIM_requires_prepair_calc |
61 |
– |
logical, save :: SIM_uses_directional_atoms |
115 |
|
logical, save :: SIM_uses_PBC |
116 |
|
logical, save :: SIM_uses_molecular_cutoffs |
117 |
|
|
129 |
|
#endif |
130 |
|
|
131 |
|
type :: Properties |
132 |
< |
logical :: is_lj = .false. |
133 |
< |
logical :: is_sticky = .false. |
134 |
< |
logical :: is_dp = .false. |
135 |
< |
logical :: is_gb = .false. |
136 |
< |
logical :: is_eam = .false. |
137 |
< |
logical :: is_charge = .false. |
138 |
< |
real(kind=DP) :: charge = 0.0_DP |
139 |
< |
real(kind=DP) :: dipole_moment = 0.0_DP |
132 |
> |
logical :: is_Directional = .false. |
133 |
> |
logical :: is_LennardJones = .false. |
134 |
> |
logical :: is_Electrostatic = .false. |
135 |
> |
logical :: is_Charge = .false. |
136 |
> |
logical :: is_Dipole = .false. |
137 |
> |
logical :: is_Quadrupole = .false. |
138 |
> |
logical :: is_Sticky = .false. |
139 |
> |
logical :: is_StickyPower = .false. |
140 |
> |
logical :: is_GayBerne = .false. |
141 |
> |
logical :: is_EAM = .false. |
142 |
> |
logical :: is_Shape = .false. |
143 |
> |
logical :: is_FLARB = .false. |
144 |
|
end type Properties |
145 |
|
|
146 |
|
type(Properties), dimension(:),allocatable :: PropertyMap |
148 |
|
contains |
149 |
|
|
150 |
|
subroutine setRlistDF( this_rlist ) |
151 |
< |
|
151 |
> |
|
152 |
|
real(kind=dp) :: this_rlist |
153 |
|
|
154 |
|
rlist = this_rlist |
155 |
|
rlistsq = rlist * rlist |
156 |
< |
|
156 |
> |
|
157 |
|
haveRlist = .true. |
158 |
|
|
159 |
< |
end subroutine setRlistDF |
159 |
> |
end subroutine setRlistDF |
160 |
|
|
161 |
|
subroutine createPropertyMap(status) |
162 |
|
integer :: nAtypes |
173 |
|
status = -1 |
174 |
|
return |
175 |
|
end if |
176 |
< |
|
176 |
> |
|
177 |
|
if (.not. allocated(PropertyMap)) then |
178 |
|
allocate(PropertyMap(nAtypes)) |
179 |
|
endif |
180 |
|
|
181 |
|
do i = 1, nAtypes |
182 |
< |
call getElementProperty(atypes, i, "is_LJ", thisProperty) |
183 |
< |
PropertyMap(i)%is_LJ = thisProperty |
182 |
> |
call getElementProperty(atypes, i, "is_Directional", thisProperty) |
183 |
> |
PropertyMap(i)%is_Directional = thisProperty |
184 |
|
|
185 |
+ |
call getElementProperty(atypes, i, "is_LennardJones", thisProperty) |
186 |
+ |
PropertyMap(i)%is_LennardJones = thisProperty |
187 |
+ |
|
188 |
+ |
call getElementProperty(atypes, i, "is_Electrostatic", thisProperty) |
189 |
+ |
PropertyMap(i)%is_Electrostatic = thisProperty |
190 |
+ |
|
191 |
|
call getElementProperty(atypes, i, "is_Charge", thisProperty) |
192 |
|
PropertyMap(i)%is_Charge = thisProperty |
130 |
– |
|
131 |
– |
if (thisProperty) then |
132 |
– |
call getElementProperty(atypes, i, "charge", thisDPproperty) |
133 |
– |
PropertyMap(i)%charge = thisDPproperty |
134 |
– |
endif |
193 |
|
|
194 |
< |
call getElementProperty(atypes, i, "is_DP", thisProperty) |
195 |
< |
PropertyMap(i)%is_DP = thisProperty |
194 |
> |
call getElementProperty(atypes, i, "is_Dipole", thisProperty) |
195 |
> |
PropertyMap(i)%is_Dipole = thisProperty |
196 |
|
|
197 |
< |
if (thisProperty) then |
198 |
< |
call getElementProperty(atypes, i, "dipole_moment", thisDPproperty) |
141 |
< |
PropertyMap(i)%dipole_moment = thisDPproperty |
142 |
< |
endif |
197 |
> |
call getElementProperty(atypes, i, "is_Quadrupole", thisProperty) |
198 |
> |
PropertyMap(i)%is_Quadrupole = thisProperty |
199 |
|
|
200 |
|
call getElementProperty(atypes, i, "is_Sticky", thisProperty) |
201 |
|
PropertyMap(i)%is_Sticky = thisProperty |
202 |
< |
call getElementProperty(atypes, i, "is_GB", thisProperty) |
203 |
< |
PropertyMap(i)%is_GB = thisProperty |
202 |
> |
|
203 |
> |
call getElementProperty(atypes, i, "is_StickyPower", thisProperty) |
204 |
> |
PropertyMap(i)%is_StickyPower = thisProperty |
205 |
> |
|
206 |
> |
call getElementProperty(atypes, i, "is_GayBerne", thisProperty) |
207 |
> |
PropertyMap(i)%is_GayBerne = thisProperty |
208 |
> |
|
209 |
|
call getElementProperty(atypes, i, "is_EAM", thisProperty) |
210 |
|
PropertyMap(i)%is_EAM = thisProperty |
211 |
+ |
|
212 |
+ |
call getElementProperty(atypes, i, "is_Shape", thisProperty) |
213 |
+ |
PropertyMap(i)%is_Shape = thisProperty |
214 |
+ |
|
215 |
+ |
call getElementProperty(atypes, i, "is_FLARB", thisProperty) |
216 |
+ |
PropertyMap(i)%is_FLARB = thisProperty |
217 |
|
end do |
218 |
|
|
219 |
|
havePropertyMap = .true. |
221 |
|
end subroutine createPropertyMap |
222 |
|
|
223 |
|
subroutine setSimVariables() |
224 |
< |
SIM_uses_LJ = SimUsesLJ() |
225 |
< |
SIM_uses_sticky = SimUsesSticky() |
226 |
< |
SIM_uses_charges = SimUsesCharges() |
227 |
< |
SIM_uses_dipoles = SimUsesDipoles() |
228 |
< |
SIM_uses_RF = SimUsesRF() |
229 |
< |
SIM_uses_GB = SimUsesGB() |
224 |
> |
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
225 |
> |
SIM_uses_LennardJones = SimUsesLennardJones() |
226 |
> |
SIM_uses_Electrostatics = SimUsesElectrostatics() |
227 |
> |
SIM_uses_Charges = SimUsesCharges() |
228 |
> |
SIM_uses_Dipoles = SimUsesDipoles() |
229 |
> |
SIM_uses_Sticky = SimUsesSticky() |
230 |
> |
SIM_uses_StickyPower = SimUsesStickyPower() |
231 |
> |
SIM_uses_GayBerne = SimUsesGayBerne() |
232 |
|
SIM_uses_EAM = SimUsesEAM() |
233 |
+ |
SIM_uses_Shapes = SimUsesShapes() |
234 |
+ |
SIM_uses_FLARB = SimUsesFLARB() |
235 |
+ |
SIM_uses_RF = SimUsesRF() |
236 |
|
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
237 |
|
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
166 |
– |
SIM_uses_directional_atoms = SimUsesDirectionalAtoms() |
238 |
|
SIM_uses_PBC = SimUsesPBC() |
168 |
– |
!SIM_uses_molecular_cutoffs = SimUsesMolecularCutoffs() |
239 |
|
|
240 |
|
haveSIMvariables = .true. |
241 |
|
|
248 |
|
integer :: myStatus |
249 |
|
|
250 |
|
error = 0 |
251 |
< |
|
251 |
> |
|
252 |
|
if (.not. havePropertyMap) then |
253 |
|
|
254 |
|
myStatus = 0 |
272 |
|
return |
273 |
|
endif |
274 |
|
|
205 |
– |
if (SIM_uses_LJ .and. FF_uses_LJ) then |
206 |
– |
if (.not. havePolicies) then |
207 |
– |
write(default_error, *) 'LJ mixing Policies have not been set in doForces!' |
208 |
– |
error = -1 |
209 |
– |
return |
210 |
– |
endif |
211 |
– |
endif |
212 |
– |
|
275 |
|
if (.not. haveNeighborList) then |
276 |
|
write(default_error, *) 'neighbor list has not been initialized in doForces!' |
277 |
|
error = -1 |
293 |
|
#endif |
294 |
|
return |
295 |
|
end subroutine doReadyCheck |
234 |
– |
|
296 |
|
|
236 |
– |
subroutine init_FF(LJMIXPOLICY, use_RF_c, thisStat) |
297 |
|
|
298 |
< |
integer, intent(in) :: LJMIXPOLICY |
298 |
> |
subroutine init_FF(use_RF_c, thisStat) |
299 |
> |
|
300 |
|
logical, intent(in) :: use_RF_c |
301 |
|
|
302 |
|
integer, intent(out) :: thisStat |
309 |
|
|
310 |
|
!! Fortran's version of a cast: |
311 |
|
FF_uses_RF = use_RF_c |
312 |
< |
|
312 |
> |
|
313 |
|
!! init_FF is called *after* all of the atom types have been |
314 |
|
!! defined in atype_module using the new_atype subroutine. |
315 |
|
!! |
316 |
|
!! this will scan through the known atypes and figure out what |
317 |
|
!! interactions are used by the force field. |
318 |
< |
|
319 |
< |
FF_uses_LJ = .false. |
320 |
< |
FF_uses_sticky = .false. |
321 |
< |
FF_uses_charges = .false. |
322 |
< |
FF_uses_dipoles = .false. |
323 |
< |
FF_uses_GB = .false. |
318 |
> |
|
319 |
> |
FF_uses_DirectionalAtoms = .false. |
320 |
> |
FF_uses_LennardJones = .false. |
321 |
> |
FF_uses_Electrostatics = .false. |
322 |
> |
FF_uses_Charges = .false. |
323 |
> |
FF_uses_Dipoles = .false. |
324 |
> |
FF_uses_Sticky = .false. |
325 |
> |
FF_uses_StickyPower = .false. |
326 |
> |
FF_uses_GayBerne = .false. |
327 |
|
FF_uses_EAM = .false. |
328 |
< |
|
329 |
< |
call getMatchingElementList(atypes, "is_LJ", .true., nMatches, MatchList) |
266 |
< |
if (nMatches .gt. 0) FF_uses_LJ = .true. |
328 |
> |
FF_uses_Shapes = .false. |
329 |
> |
FF_uses_FLARB = .false. |
330 |
|
|
331 |
< |
call getMatchingElementList(atypes, "is_Charge", .true., nMatches, MatchList) |
332 |
< |
if (nMatches .gt. 0) FF_uses_charges = .true. |
331 |
> |
call getMatchingElementList(atypes, "is_Directional", .true., & |
332 |
> |
nMatches, MatchList) |
333 |
> |
if (nMatches .gt. 0) FF_uses_DirectionalAtoms = .true. |
334 |
|
|
335 |
< |
call getMatchingElementList(atypes, "is_DP", .true., nMatches, MatchList) |
336 |
< |
if (nMatches .gt. 0) FF_uses_dipoles = .true. |
337 |
< |
|
335 |
> |
call getMatchingElementList(atypes, "is_LennardJones", .true., & |
336 |
> |
nMatches, MatchList) |
337 |
> |
if (nMatches .gt. 0) FF_uses_LennardJones = .true. |
338 |
> |
|
339 |
> |
call getMatchingElementList(atypes, "is_Electrostatic", .true., & |
340 |
> |
nMatches, MatchList) |
341 |
> |
if (nMatches .gt. 0) then |
342 |
> |
FF_uses_Electrostatics = .true. |
343 |
> |
endif |
344 |
> |
|
345 |
> |
call getMatchingElementList(atypes, "is_Charge", .true., & |
346 |
> |
nMatches, MatchList) |
347 |
> |
if (nMatches .gt. 0) then |
348 |
> |
FF_uses_Charges = .true. |
349 |
> |
FF_uses_Electrostatics = .true. |
350 |
> |
endif |
351 |
> |
|
352 |
> |
call getMatchingElementList(atypes, "is_Dipole", .true., & |
353 |
> |
nMatches, MatchList) |
354 |
> |
if (nMatches .gt. 0) then |
355 |
> |
FF_uses_Dipoles = .true. |
356 |
> |
FF_uses_Electrostatics = .true. |
357 |
> |
FF_uses_DirectionalAtoms = .true. |
358 |
> |
endif |
359 |
> |
|
360 |
> |
call getMatchingElementList(atypes, "is_Quadrupole", .true., & |
361 |
> |
nMatches, MatchList) |
362 |
> |
if (nMatches .gt. 0) then |
363 |
> |
FF_uses_Quadrupoles = .true. |
364 |
> |
FF_uses_Electrostatics = .true. |
365 |
> |
FF_uses_DirectionalAtoms = .true. |
366 |
> |
endif |
367 |
> |
|
368 |
|
call getMatchingElementList(atypes, "is_Sticky", .true., nMatches, & |
369 |
|
MatchList) |
370 |
< |
if (nMatches .gt. 0) FF_uses_Sticky = .true. |
370 |
> |
if (nMatches .gt. 0) then |
371 |
> |
FF_uses_Sticky = .true. |
372 |
> |
FF_uses_DirectionalAtoms = .true. |
373 |
> |
endif |
374 |
> |
|
375 |
> |
call getMatchingElementList(atypes, "is_StickyPower", .true., nMatches, & |
376 |
> |
MatchList) |
377 |
> |
if (nMatches .gt. 0) then |
378 |
> |
FF_uses_StickyPower = .true. |
379 |
> |
FF_uses_DirectionalAtoms = .true. |
380 |
> |
endif |
381 |
|
|
382 |
< |
call getMatchingElementList(atypes, "is_GB", .true., nMatches, MatchList) |
383 |
< |
if (nMatches .gt. 0) FF_uses_GB = .true. |
384 |
< |
|
382 |
> |
call getMatchingElementList(atypes, "is_GayBerne", .true., & |
383 |
> |
nMatches, MatchList) |
384 |
> |
if (nMatches .gt. 0) then |
385 |
> |
FF_uses_GayBerne = .true. |
386 |
> |
FF_uses_DirectionalAtoms = .true. |
387 |
> |
endif |
388 |
> |
|
389 |
|
call getMatchingElementList(atypes, "is_EAM", .true., nMatches, MatchList) |
390 |
|
if (nMatches .gt. 0) FF_uses_EAM = .true. |
391 |
< |
|
391 |
> |
|
392 |
> |
call getMatchingElementList(atypes, "is_Shape", .true., & |
393 |
> |
nMatches, MatchList) |
394 |
> |
if (nMatches .gt. 0) then |
395 |
> |
FF_uses_Shapes = .true. |
396 |
> |
FF_uses_DirectionalAtoms = .true. |
397 |
> |
endif |
398 |
> |
|
399 |
> |
call getMatchingElementList(atypes, "is_FLARB", .true., & |
400 |
> |
nMatches, MatchList) |
401 |
> |
if (nMatches .gt. 0) FF_uses_FLARB = .true. |
402 |
> |
|
403 |
|
!! Assume sanity (for the sake of argument) |
404 |
|
haveSaneForceField = .true. |
405 |
|
|
406 |
|
!! check to make sure the FF_uses_RF setting makes sense |
407 |
< |
|
407 |
> |
|
408 |
|
if (FF_uses_dipoles) then |
409 |
|
if (FF_uses_RF) then |
410 |
|
dielect = getDielect() |
417 |
|
haveSaneForceField = .false. |
418 |
|
return |
419 |
|
endif |
301 |
– |
endif |
302 |
– |
|
303 |
– |
if (FF_uses_LJ) then |
304 |
– |
|
305 |
– |
select case (LJMIXPOLICY) |
306 |
– |
case (LB_MIXING_RULE) |
307 |
– |
call init_lj_FF(LB_MIXING_RULE, my_status) |
308 |
– |
case (EXPLICIT_MIXING_RULE) |
309 |
– |
call init_lj_FF(EXPLICIT_MIXING_RULE, my_status) |
310 |
– |
case default |
311 |
– |
write(default_error,*) 'unknown LJ Mixing Policy!' |
312 |
– |
thisStat = -1 |
313 |
– |
haveSaneForceField = .false. |
314 |
– |
return |
315 |
– |
end select |
316 |
– |
if (my_status /= 0) then |
317 |
– |
thisStat = -1 |
318 |
– |
haveSaneForceField = .false. |
319 |
– |
return |
320 |
– |
end if |
321 |
– |
havePolicies = .true. |
420 |
|
endif |
421 |
|
|
422 |
< |
if (FF_uses_sticky) then |
423 |
< |
call check_sticky_FF(my_status) |
424 |
< |
if (my_status /= 0) then |
425 |
< |
thisStat = -1 |
426 |
< |
haveSaneForceField = .false. |
427 |
< |
return |
428 |
< |
end if |
429 |
< |
endif |
430 |
< |
|
422 |
> |
!sticky module does not contain check_sticky_FF anymore |
423 |
> |
!if (FF_uses_sticky) then |
424 |
> |
! call check_sticky_FF(my_status) |
425 |
> |
! if (my_status /= 0) then |
426 |
> |
! thisStat = -1 |
427 |
> |
! haveSaneForceField = .false. |
428 |
> |
! return |
429 |
> |
! end if |
430 |
> |
!endif |
431 |
|
|
432 |
|
if (FF_uses_EAM) then |
433 |
< |
call init_EAM_FF(my_status) |
433 |
> |
call init_EAM_FF(my_status) |
434 |
|
if (my_status /= 0) then |
435 |
|
write(default_error, *) "init_EAM_FF returned a bad status" |
436 |
|
thisStat = -1 |
439 |
|
end if |
440 |
|
endif |
441 |
|
|
442 |
< |
if (FF_uses_GB) then |
442 |
> |
if (FF_uses_GayBerne) then |
443 |
|
call check_gb_pair_FF(my_status) |
444 |
|
if (my_status .ne. 0) then |
445 |
|
thisStat = -1 |
448 |
|
endif |
449 |
|
endif |
450 |
|
|
451 |
< |
if (FF_uses_GB .and. FF_uses_LJ) then |
451 |
> |
if (FF_uses_GayBerne .and. FF_uses_LennardJones) then |
452 |
|
endif |
453 |
+ |
|
454 |
|
if (.not. haveNeighborList) then |
455 |
|
!! Create neighbor lists |
456 |
|
call expandNeighborList(nLocal, my_status) |
462 |
|
haveNeighborList = .true. |
463 |
|
endif |
464 |
|
|
366 |
– |
|
367 |
– |
|
465 |
|
end subroutine init_FF |
369 |
– |
|
466 |
|
|
467 |
+ |
|
468 |
|
!! Does force loop over i,j pairs. Calls do_pair to calculates forces. |
469 |
|
!-------------------------------------------------------------> |
470 |
< |
subroutine do_force_loop(q, q_group, A, u_l, f, t, tau, pot, & |
470 |
> |
subroutine do_force_loop(q, q_group, A, eFrame, f, t, tau, pot, & |
471 |
|
do_pot_c, do_stress_c, error) |
472 |
|
!! Position array provided by C, dimensioned by getNlocal |
473 |
|
real ( kind = dp ), dimension(3, nLocal) :: q |
476 |
|
!! Rotation Matrix for each long range particle in simulation. |
477 |
|
real( kind = dp), dimension(9, nLocal) :: A |
478 |
|
!! Unit vectors for dipoles (lab frame) |
479 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
479 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
480 |
|
!! Force array provided by C, dimensioned by getNlocal |
481 |
|
real ( kind = dp ), dimension(3,nLocal) :: f |
482 |
|
!! Torsion array provided by C, dimensioned by getNlocal |
516 |
|
integer :: loopStart, loopEnd, loop |
517 |
|
|
518 |
|
real(kind=dp) :: listSkin = 1.0 |
519 |
< |
|
519 |
> |
|
520 |
|
!! initialize local variables |
521 |
< |
|
521 |
> |
|
522 |
|
#ifdef IS_MPI |
523 |
|
pot_local = 0.0_dp |
524 |
|
nAtomsInRow = getNatomsInRow(plan_atom_row) |
528 |
|
#else |
529 |
|
natoms = nlocal |
530 |
|
#endif |
531 |
< |
|
531 |
> |
|
532 |
|
call doReadyCheck(localError) |
533 |
|
if ( localError .ne. 0 ) then |
534 |
|
call handleError("do_force_loop", "Not Initialized") |
536 |
|
return |
537 |
|
end if |
538 |
|
call zero_work_arrays() |
539 |
< |
|
539 |
> |
|
540 |
|
do_pot = do_pot_c |
541 |
|
do_stress = do_stress_c |
542 |
< |
|
542 |
> |
|
543 |
|
! Gather all information needed by all force loops: |
544 |
< |
|
544 |
> |
|
545 |
|
#ifdef IS_MPI |
546 |
< |
|
546 |
> |
|
547 |
|
call gather(q, q_Row, plan_atom_row_3d) |
548 |
|
call gather(q, q_Col, plan_atom_col_3d) |
549 |
|
|
550 |
|
call gather(q_group, q_group_Row, plan_group_row_3d) |
551 |
|
call gather(q_group, q_group_Col, plan_group_col_3d) |
552 |
< |
|
553 |
< |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then |
554 |
< |
call gather(u_l, u_l_Row, plan_atom_row_3d) |
555 |
< |
call gather(u_l, u_l_Col, plan_atom_col_3d) |
556 |
< |
|
552 |
> |
|
553 |
> |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
554 |
> |
call gather(eFrame, eFrame_Row, plan_atom_row_rotation) |
555 |
> |
call gather(eFrame, eFrame_Col, plan_atom_col_rotation) |
556 |
> |
|
557 |
|
call gather(A, A_Row, plan_atom_row_rotation) |
558 |
|
call gather(A, A_Col, plan_atom_col_rotation) |
559 |
|
endif |
560 |
< |
|
560 |
> |
|
561 |
|
#endif |
562 |
< |
|
562 |
> |
|
563 |
|
!! Begin force loop timing: |
564 |
|
#ifdef PROFILE |
565 |
|
call cpu_time(forceTimeInitial) |
566 |
|
nloops = nloops + 1 |
567 |
|
#endif |
568 |
< |
|
568 |
> |
|
569 |
|
loopEnd = PAIR_LOOP |
570 |
|
if (FF_RequiresPrepairCalc() .and. SIM_requires_prepair_calc) then |
571 |
|
loopStart = PREPAIR_LOOP |
580 |
|
if (loop .eq. loopStart) then |
581 |
|
#ifdef IS_MPI |
582 |
|
call checkNeighborList(nGroupsInRow, q_group_row, listSkin, & |
583 |
< |
update_nlist) |
583 |
> |
update_nlist) |
584 |
|
#else |
585 |
|
call checkNeighborList(nGroups, q_group, listSkin, & |
586 |
< |
update_nlist) |
586 |
> |
update_nlist) |
587 |
|
#endif |
588 |
|
endif |
589 |
< |
|
589 |
> |
|
590 |
|
if (update_nlist) then |
591 |
|
!! save current configuration and construct neighbor list |
592 |
|
#ifdef IS_MPI |
597 |
|
neighborListSize = size(list) |
598 |
|
nlist = 0 |
599 |
|
endif |
600 |
< |
|
600 |
> |
|
601 |
|
istart = 1 |
602 |
|
#ifdef IS_MPI |
603 |
|
iend = nGroupsInRow |
607 |
|
outer: do i = istart, iend |
608 |
|
|
609 |
|
if (update_nlist) point(i) = nlist + 1 |
610 |
< |
|
610 |
> |
|
611 |
|
n_in_i = groupStartRow(i+1) - groupStartRow(i) |
612 |
< |
|
612 |
> |
|
613 |
|
if (update_nlist) then |
614 |
|
#ifdef IS_MPI |
615 |
|
jstart = 1 |
624 |
|
! make sure group i has neighbors |
625 |
|
if (jstart .gt. jend) cycle outer |
626 |
|
endif |
627 |
< |
|
627 |
> |
|
628 |
|
do jnab = jstart, jend |
629 |
|
if (update_nlist) then |
630 |
|
j = jnab |
643 |
|
if (rgrpsq < rlistsq) then |
644 |
|
if (update_nlist) then |
645 |
|
nlist = nlist + 1 |
646 |
< |
|
646 |
> |
|
647 |
|
if (nlist > neighborListSize) then |
648 |
|
#ifdef IS_MPI |
649 |
|
call expandNeighborList(nGroupsInRow, listerror) |
657 |
|
end if |
658 |
|
neighborListSize = size(list) |
659 |
|
endif |
660 |
< |
|
660 |
> |
|
661 |
|
list(nlist) = j |
662 |
|
endif |
663 |
< |
|
663 |
> |
|
664 |
|
if (loop .eq. PAIR_LOOP) then |
665 |
|
vij = 0.0d0 |
666 |
|
fij(1:3) = 0.0d0 |
667 |
|
endif |
668 |
< |
|
668 |
> |
|
669 |
|
call get_switch(rgrpsq, sw, dswdr, rgrp, group_switch, & |
670 |
|
in_switching_region) |
671 |
< |
|
671 |
> |
|
672 |
|
n_in_j = groupStartCol(j+1) - groupStartCol(j) |
673 |
< |
|
674 |
< |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
675 |
< |
|
673 |
> |
|
674 |
> |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
675 |
> |
|
676 |
|
atom1 = groupListRow(ia) |
677 |
< |
|
677 |
> |
|
678 |
|
inner: do jb = groupStartCol(j), groupStartCol(j+1)-1 |
679 |
< |
|
679 |
> |
|
680 |
|
atom2 = groupListCol(jb) |
681 |
< |
|
681 |
> |
|
682 |
|
if (skipThisPair(atom1, atom2)) cycle inner |
683 |
|
|
684 |
|
if ((n_in_i .eq. 1).and.(n_in_j .eq. 1)) then |
698 |
|
#ifdef IS_MPI |
699 |
|
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
700 |
|
rgrpsq, d_grp, do_pot, do_stress, & |
701 |
< |
u_l, A, f, t, pot_local) |
701 |
> |
eFrame, A, f, t, pot_local) |
702 |
|
#else |
703 |
|
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
704 |
|
rgrpsq, d_grp, do_pot, do_stress, & |
705 |
< |
u_l, A, f, t, pot) |
705 |
> |
eFrame, A, f, t, pot) |
706 |
|
#endif |
707 |
|
else |
708 |
|
#ifdef IS_MPI |
709 |
|
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
710 |
|
do_pot, & |
711 |
< |
u_l, A, f, t, pot_local, vpair, fpair) |
711 |
> |
eFrame, A, f, t, pot_local, vpair, fpair) |
712 |
|
#else |
713 |
|
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
714 |
|
do_pot, & |
715 |
< |
u_l, A, f, t, pot, vpair, fpair) |
715 |
> |
eFrame, A, f, t, pot, vpair, fpair) |
716 |
|
#endif |
717 |
|
|
718 |
|
vij = vij + vpair |
720 |
|
endif |
721 |
|
enddo inner |
722 |
|
enddo |
723 |
< |
|
723 |
> |
|
724 |
|
if (loop .eq. PAIR_LOOP) then |
725 |
|
if (in_switching_region) then |
726 |
|
swderiv = vij*dswdr/rgrp |
727 |
|
fij(1) = fij(1) + swderiv*d_grp(1) |
728 |
|
fij(2) = fij(2) + swderiv*d_grp(2) |
729 |
|
fij(3) = fij(3) + swderiv*d_grp(3) |
730 |
< |
|
730 |
> |
|
731 |
|
do ia=groupStartRow(i), groupStartRow(i+1)-1 |
732 |
|
atom1=groupListRow(ia) |
733 |
|
mf = mfactRow(atom1) |
741 |
|
f(3,atom1) = f(3,atom1) + swderiv*d_grp(3)*mf |
742 |
|
#endif |
743 |
|
enddo |
744 |
< |
|
744 |
> |
|
745 |
|
do jb=groupStartCol(j), groupStartCol(j+1)-1 |
746 |
|
atom2=groupListCol(jb) |
747 |
|
mf = mfactCol(atom2) |
756 |
|
#endif |
757 |
|
enddo |
758 |
|
endif |
759 |
< |
|
759 |
> |
|
760 |
|
if (do_stress) call add_stress_tensor(d_grp, fij) |
761 |
|
endif |
762 |
|
end if |
763 |
|
enddo |
764 |
|
enddo outer |
765 |
< |
|
765 |
> |
|
766 |
|
if (update_nlist) then |
767 |
|
#ifdef IS_MPI |
768 |
|
point(nGroupsInRow + 1) = nlist + 1 |
776 |
|
update_nlist = .false. |
777 |
|
endif |
778 |
|
endif |
779 |
< |
|
779 |
> |
|
780 |
|
if (loop .eq. PREPAIR_LOOP) then |
781 |
|
call do_preforce(nlocal, pot) |
782 |
|
endif |
783 |
< |
|
783 |
> |
|
784 |
|
enddo |
785 |
< |
|
785 |
> |
|
786 |
|
!! Do timing |
787 |
|
#ifdef PROFILE |
788 |
|
call cpu_time(forceTimeFinal) |
789 |
|
forceTime = forceTime + forceTimeFinal - forceTimeInitial |
790 |
|
#endif |
791 |
< |
|
791 |
> |
|
792 |
|
#ifdef IS_MPI |
793 |
|
!!distribute forces |
794 |
< |
|
794 |
> |
|
795 |
|
f_temp = 0.0_dp |
796 |
|
call scatter(f_Row,f_temp,plan_atom_row_3d) |
797 |
|
do i = 1,nlocal |
798 |
|
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
799 |
|
end do |
800 |
< |
|
800 |
> |
|
801 |
|
f_temp = 0.0_dp |
802 |
|
call scatter(f_Col,f_temp,plan_atom_col_3d) |
803 |
|
do i = 1,nlocal |
804 |
|
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
805 |
|
end do |
806 |
< |
|
807 |
< |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then |
806 |
> |
|
807 |
> |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
808 |
|
t_temp = 0.0_dp |
809 |
|
call scatter(t_Row,t_temp,plan_atom_row_3d) |
810 |
|
do i = 1,nlocal |
812 |
|
end do |
813 |
|
t_temp = 0.0_dp |
814 |
|
call scatter(t_Col,t_temp,plan_atom_col_3d) |
815 |
< |
|
815 |
> |
|
816 |
|
do i = 1,nlocal |
817 |
|
t(1:3,i) = t(1:3,i) + t_temp(1:3,i) |
818 |
|
end do |
819 |
|
endif |
820 |
< |
|
820 |
> |
|
821 |
|
if (do_pot) then |
822 |
|
! scatter/gather pot_row into the members of my column |
823 |
|
call scatter(pot_Row, pot_Temp, plan_atom_row) |
824 |
< |
|
824 |
> |
|
825 |
|
! scatter/gather pot_local into all other procs |
826 |
|
! add resultant to get total pot |
827 |
|
do i = 1, nlocal |
828 |
|
pot_local = pot_local + pot_Temp(i) |
829 |
|
enddo |
830 |
< |
|
830 |
> |
|
831 |
|
pot_Temp = 0.0_DP |
832 |
< |
|
832 |
> |
|
833 |
|
call scatter(pot_Col, pot_Temp, plan_atom_col) |
834 |
|
do i = 1, nlocal |
835 |
|
pot_local = pot_local + pot_Temp(i) |
836 |
|
enddo |
837 |
< |
|
837 |
> |
|
838 |
|
endif |
839 |
|
#endif |
840 |
< |
|
840 |
> |
|
841 |
|
if (FF_RequiresPostpairCalc() .and. SIM_requires_postpair_calc) then |
842 |
< |
|
842 |
> |
|
843 |
|
if (FF_uses_RF .and. SIM_uses_RF) then |
844 |
< |
|
844 |
> |
|
845 |
|
#ifdef IS_MPI |
846 |
|
call scatter(rf_Row,rf,plan_atom_row_3d) |
847 |
|
call scatter(rf_Col,rf_Temp,plan_atom_col_3d) |
849 |
|
rf(1:3,i) = rf(1:3,i) + rf_Temp(1:3,i) |
850 |
|
end do |
851 |
|
#endif |
852 |
< |
|
852 |
> |
|
853 |
|
do i = 1, nLocal |
854 |
< |
|
854 |
> |
|
855 |
|
rfpot = 0.0_DP |
856 |
|
#ifdef IS_MPI |
857 |
|
me_i = atid_row(i) |
858 |
|
#else |
859 |
|
me_i = atid(i) |
860 |
|
#endif |
861 |
< |
|
862 |
< |
if (PropertyMap(me_i)%is_DP) then |
863 |
< |
|
864 |
< |
mu_i = PropertyMap(me_i)%dipole_moment |
865 |
< |
|
861 |
> |
|
862 |
> |
if (PropertyMap(me_i)%is_Dipole) then |
863 |
> |
|
864 |
> |
mu_i = getDipoleMoment(me_i) |
865 |
> |
|
866 |
|
!! The reaction field needs to include a self contribution |
867 |
|
!! to the field: |
868 |
< |
call accumulate_self_rf(i, mu_i, u_l) |
868 |
> |
call accumulate_self_rf(i, mu_i, eFrame) |
869 |
|
!! Get the reaction field contribution to the |
870 |
|
!! potential and torques: |
871 |
< |
call reaction_field_final(i, mu_i, u_l, rfpot, t, do_pot) |
871 |
> |
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
872 |
|
#ifdef IS_MPI |
873 |
|
pot_local = pot_local + rfpot |
874 |
|
#else |
875 |
|
pot = pot + rfpot |
876 |
< |
|
876 |
> |
|
877 |
|
#endif |
878 |
< |
endif |
878 |
> |
endif |
879 |
|
enddo |
880 |
|
endif |
881 |
|
endif |
882 |
< |
|
883 |
< |
|
882 |
> |
|
883 |
> |
|
884 |
|
#ifdef IS_MPI |
885 |
< |
|
885 |
> |
|
886 |
|
if (do_pot) then |
887 |
|
pot = pot + pot_local |
888 |
|
!! we assume the c code will do the allreduce to get the total potential |
889 |
|
!! we could do it right here if we needed to... |
890 |
|
endif |
891 |
< |
|
891 |
> |
|
892 |
|
if (do_stress) then |
893 |
|
call mpi_allreduce(tau_Temp, tau, 9,mpi_double_precision,mpi_sum, & |
894 |
|
mpi_comm_world,mpi_err) |
895 |
|
call mpi_allreduce(virial_Temp, virial,1,mpi_double_precision,mpi_sum, & |
896 |
|
mpi_comm_world,mpi_err) |
897 |
|
endif |
898 |
< |
|
898 |
> |
|
899 |
|
#else |
900 |
< |
|
900 |
> |
|
901 |
|
if (do_stress) then |
902 |
|
tau = tau_Temp |
903 |
|
virial = virial_Temp |
904 |
|
endif |
905 |
< |
|
905 |
> |
|
906 |
|
#endif |
907 |
< |
|
907 |
> |
|
908 |
|
end subroutine do_force_loop |
909 |
< |
|
909 |
> |
|
910 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
911 |
< |
u_l, A, f, t, pot, vpair, fpair) |
911 |
> |
eFrame, A, f, t, pot, vpair, fpair) |
912 |
|
|
913 |
|
real( kind = dp ) :: pot, vpair, sw |
914 |
|
real( kind = dp ), dimension(3) :: fpair |
915 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
916 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
916 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
917 |
|
real( kind = dp ), dimension(9,nLocal) :: A |
918 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
919 |
|
real( kind = dp ), dimension(3,nLocal) :: t |
936 |
|
me_i = atid(i) |
937 |
|
me_j = atid(j) |
938 |
|
#endif |
939 |
< |
|
940 |
< |
if (FF_uses_LJ .and. SIM_uses_LJ) then |
941 |
< |
|
942 |
< |
if ( PropertyMap(me_i)%is_LJ .and. PropertyMap(me_j)%is_LJ ) then |
939 |
> |
|
940 |
> |
! write(*,*) i, j, me_i, me_j |
941 |
> |
|
942 |
> |
if (FF_uses_LennardJones .and. SIM_uses_LennardJones) then |
943 |
> |
|
944 |
> |
if ( PropertyMap(me_i)%is_LennardJones .and. & |
945 |
> |
PropertyMap(me_j)%is_LennardJones ) then |
946 |
|
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
947 |
|
endif |
948 |
< |
|
948 |
> |
|
949 |
|
endif |
950 |
< |
|
951 |
< |
if (FF_uses_charges .and. SIM_uses_charges) then |
952 |
< |
|
953 |
< |
if (PropertyMap(me_i)%is_Charge .and. PropertyMap(me_j)%is_Charge) then |
954 |
< |
call do_charge_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
950 |
> |
|
951 |
> |
if (FF_uses_Electrostatics .and. SIM_uses_Electrostatics) then |
952 |
> |
|
953 |
> |
if (PropertyMap(me_i)%is_Electrostatic .and. & |
954 |
> |
PropertyMap(me_j)%is_Electrostatic) then |
955 |
> |
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
956 |
> |
pot, eFrame, f, t, do_pot) |
957 |
|
endif |
856 |
– |
|
857 |
– |
endif |
858 |
– |
|
859 |
– |
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
860 |
– |
|
861 |
– |
if ( PropertyMap(me_i)%is_DP .and. PropertyMap(me_j)%is_DP) then |
862 |
– |
call do_dipole_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, u_l, f, t, & |
863 |
– |
do_pot) |
864 |
– |
if (FF_uses_RF .and. SIM_uses_RF) then |
865 |
– |
call accumulate_rf(i, j, r, u_l, sw) |
866 |
– |
call rf_correct_forces(i, j, d, r, u_l, sw, f, fpair) |
867 |
– |
endif |
868 |
– |
endif |
958 |
|
|
959 |
+ |
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
960 |
+ |
if ( PropertyMap(me_i)%is_Dipole .and. & |
961 |
+ |
PropertyMap(me_j)%is_Dipole) then |
962 |
+ |
if (FF_uses_RF .and. SIM_uses_RF) then |
963 |
+ |
call accumulate_rf(i, j, r, eFrame, sw) |
964 |
+ |
call rf_correct_forces(i, j, d, r, eFrame, sw, f, fpair) |
965 |
+ |
endif |
966 |
+ |
endif |
967 |
+ |
endif |
968 |
|
endif |
969 |
|
|
970 |
+ |
|
971 |
|
if (FF_uses_Sticky .and. SIM_uses_sticky) then |
972 |
|
|
973 |
|
if ( PropertyMap(me_i)%is_Sticky .and. PropertyMap(me_j)%is_Sticky) then |
974 |
< |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, A, f, t, & |
975 |
< |
do_pot) |
974 |
> |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
975 |
> |
pot, A, f, t, do_pot) |
976 |
|
endif |
977 |
|
|
978 |
|
endif |
979 |
|
|
980 |
+ |
if (FF_uses_StickyPower .and. SIM_uses_stickypower) then |
981 |
+ |
if ( PropertyMap(me_i)%is_StickyPower .and. & |
982 |
+ |
PropertyMap(me_j)%is_StickyPower) then |
983 |
+ |
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
984 |
+ |
pot, A, f, t, do_pot) |
985 |
+ |
endif |
986 |
+ |
endif |
987 |
+ |
|
988 |
+ |
if (FF_uses_GayBerne .and. SIM_uses_GayBerne) then |
989 |
|
|
990 |
< |
if (FF_uses_GB .and. SIM_uses_GB) then |
991 |
< |
|
992 |
< |
if ( PropertyMap(me_i)%is_GB .and. PropertyMap(me_j)%is_GB) then |
993 |
< |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, u_l, f, t, & |
886 |
< |
do_pot) |
990 |
> |
if ( PropertyMap(me_i)%is_GayBerne .and. & |
991 |
> |
PropertyMap(me_j)%is_GayBerne) then |
992 |
> |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
993 |
> |
pot, A, f, t, do_pot) |
994 |
|
endif |
995 |
|
|
996 |
|
endif |
997 |
< |
|
997 |
> |
|
998 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
999 |
< |
|
999 |
> |
|
1000 |
|
if ( PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) then |
1001 |
|
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1002 |
|
do_pot) |
1003 |
|
endif |
1004 |
< |
|
1004 |
> |
|
1005 |
|
endif |
1006 |
< |
|
1006 |
> |
|
1007 |
> |
|
1008 |
> |
! write(*,*) PropertyMap(me_i)%is_Shape,PropertyMap(me_j)%is_Shape |
1009 |
> |
|
1010 |
> |
if (FF_uses_Shapes .and. SIM_uses_Shapes) then |
1011 |
> |
if ( PropertyMap(me_i)%is_Shape .and. & |
1012 |
> |
PropertyMap(me_j)%is_Shape ) then |
1013 |
> |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1014 |
> |
pot, A, f, t, do_pot) |
1015 |
> |
endif |
1016 |
> |
if ( (PropertyMap(me_i)%is_Shape .and. & |
1017 |
> |
PropertyMap(me_j)%is_LennardJones) .or. & |
1018 |
> |
(PropertyMap(me_i)%is_LennardJones .and. & |
1019 |
> |
PropertyMap(me_j)%is_Shape) ) then |
1020 |
> |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1021 |
> |
pot, A, f, t, do_pot) |
1022 |
> |
endif |
1023 |
> |
endif |
1024 |
> |
|
1025 |
|
end subroutine do_pair |
1026 |
|
|
1027 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1028 |
< |
do_pot, do_stress, u_l, A, f, t, pot) |
1028 |
> |
do_pot, do_stress, eFrame, A, f, t, pot) |
1029 |
|
|
1030 |
< |
real( kind = dp ) :: pot, sw |
1031 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
1032 |
< |
real (kind=dp), dimension(9,nLocal) :: A |
1033 |
< |
real (kind=dp), dimension(3,nLocal) :: f |
1034 |
< |
real (kind=dp), dimension(3,nLocal) :: t |
910 |
< |
|
911 |
< |
logical, intent(inout) :: do_pot, do_stress |
912 |
< |
integer, intent(in) :: i, j |
913 |
< |
real ( kind = dp ), intent(inout) :: rijsq, rcijsq |
914 |
< |
real ( kind = dp ) :: r, rc |
915 |
< |
real ( kind = dp ), intent(inout) :: d(3), dc(3) |
916 |
< |
|
917 |
< |
logical :: is_EAM_i, is_EAM_j |
918 |
< |
|
919 |
< |
integer :: me_i, me_j |
920 |
< |
|
1030 |
> |
real( kind = dp ) :: pot, sw |
1031 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1032 |
> |
real (kind=dp), dimension(9,nLocal) :: A |
1033 |
> |
real (kind=dp), dimension(3,nLocal) :: f |
1034 |
> |
real (kind=dp), dimension(3,nLocal) :: t |
1035 |
|
|
1036 |
+ |
logical, intent(inout) :: do_pot, do_stress |
1037 |
+ |
integer, intent(in) :: i, j |
1038 |
+ |
real ( kind = dp ), intent(inout) :: rijsq, rcijsq |
1039 |
+ |
real ( kind = dp ) :: r, rc |
1040 |
+ |
real ( kind = dp ), intent(inout) :: d(3), dc(3) |
1041 |
+ |
|
1042 |
+ |
logical :: is_EAM_i, is_EAM_j |
1043 |
+ |
|
1044 |
+ |
integer :: me_i, me_j |
1045 |
+ |
|
1046 |
+ |
|
1047 |
|
r = sqrt(rijsq) |
1048 |
|
if (SIM_uses_molecular_cutoffs) then |
1049 |
|
rc = sqrt(rcijsq) |
1050 |
|
else |
1051 |
|
rc = r |
1052 |
|
endif |
928 |
– |
|
1053 |
|
|
1054 |
+ |
|
1055 |
|
#ifdef IS_MPI |
1056 |
< |
me_i = atid_row(i) |
1057 |
< |
me_j = atid_col(j) |
1056 |
> |
me_i = atid_row(i) |
1057 |
> |
me_j = atid_col(j) |
1058 |
|
#else |
1059 |
< |
me_i = atid(i) |
1060 |
< |
me_j = atid(j) |
1059 |
> |
me_i = atid(i) |
1060 |
> |
me_j = atid(j) |
1061 |
|
#endif |
1062 |
< |
|
1063 |
< |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1064 |
< |
|
1065 |
< |
if (PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) & |
1066 |
< |
call calc_EAM_prepair_rho(i, j, d, r, rijsq ) |
1067 |
< |
|
1068 |
< |
endif |
1069 |
< |
|
1070 |
< |
end subroutine do_prepair |
1071 |
< |
|
1072 |
< |
|
1073 |
< |
subroutine do_preforce(nlocal,pot) |
1074 |
< |
integer :: nlocal |
1075 |
< |
real( kind = dp ) :: pot |
1076 |
< |
|
1077 |
< |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1078 |
< |
call calc_EAM_preforce_Frho(nlocal,pot) |
1079 |
< |
endif |
1080 |
< |
|
1081 |
< |
|
1082 |
< |
end subroutine do_preforce |
1083 |
< |
|
1084 |
< |
|
1085 |
< |
subroutine get_interatomic_vector(q_i, q_j, d, r_sq) |
1086 |
< |
|
1087 |
< |
real (kind = dp), dimension(3) :: q_i |
1088 |
< |
real (kind = dp), dimension(3) :: q_j |
1089 |
< |
real ( kind = dp ), intent(out) :: r_sq |
1090 |
< |
real( kind = dp ) :: d(3), scaled(3) |
1091 |
< |
integer i |
1092 |
< |
|
1093 |
< |
d(1:3) = q_j(1:3) - q_i(1:3) |
1094 |
< |
|
1095 |
< |
! Wrap back into periodic box if necessary |
1096 |
< |
if ( SIM_uses_PBC ) then |
1097 |
< |
|
1098 |
< |
if( .not.boxIsOrthorhombic ) then |
1099 |
< |
! calc the scaled coordinates. |
1100 |
< |
|
1101 |
< |
scaled = matmul(HmatInv, d) |
1102 |
< |
|
1103 |
< |
! wrap the scaled coordinates |
1104 |
< |
|
1105 |
< |
scaled = scaled - anint(scaled) |
1106 |
< |
|
1107 |
< |
|
1108 |
< |
! calc the wrapped real coordinates from the wrapped scaled |
1109 |
< |
! coordinates |
1110 |
< |
|
1111 |
< |
d = matmul(Hmat,scaled) |
1112 |
< |
|
1113 |
< |
else |
1114 |
< |
! calc the scaled coordinates. |
1115 |
< |
|
1116 |
< |
do i = 1, 3 |
1117 |
< |
scaled(i) = d(i) * HmatInv(i,i) |
1118 |
< |
|
1119 |
< |
! wrap the scaled coordinates |
1120 |
< |
|
1121 |
< |
scaled(i) = scaled(i) - anint(scaled(i)) |
1122 |
< |
|
1123 |
< |
! calc the wrapped real coordinates from the wrapped scaled |
1124 |
< |
! coordinates |
1125 |
< |
|
1126 |
< |
d(i) = scaled(i)*Hmat(i,i) |
1127 |
< |
enddo |
1128 |
< |
endif |
1129 |
< |
|
1130 |
< |
endif |
1131 |
< |
|
1132 |
< |
r_sq = dot_product(d,d) |
1133 |
< |
|
1134 |
< |
end subroutine get_interatomic_vector |
1135 |
< |
|
1136 |
< |
subroutine zero_work_arrays() |
1137 |
< |
|
1062 |
> |
|
1063 |
> |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1064 |
> |
|
1065 |
> |
if (PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) & |
1066 |
> |
call calc_EAM_prepair_rho(i, j, d, r, rijsq ) |
1067 |
> |
|
1068 |
> |
endif |
1069 |
> |
|
1070 |
> |
end subroutine do_prepair |
1071 |
> |
|
1072 |
> |
|
1073 |
> |
subroutine do_preforce(nlocal,pot) |
1074 |
> |
integer :: nlocal |
1075 |
> |
real( kind = dp ) :: pot |
1076 |
> |
|
1077 |
> |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1078 |
> |
call calc_EAM_preforce_Frho(nlocal,pot) |
1079 |
> |
endif |
1080 |
> |
|
1081 |
> |
|
1082 |
> |
end subroutine do_preforce |
1083 |
> |
|
1084 |
> |
|
1085 |
> |
subroutine get_interatomic_vector(q_i, q_j, d, r_sq) |
1086 |
> |
|
1087 |
> |
real (kind = dp), dimension(3) :: q_i |
1088 |
> |
real (kind = dp), dimension(3) :: q_j |
1089 |
> |
real ( kind = dp ), intent(out) :: r_sq |
1090 |
> |
real( kind = dp ) :: d(3), scaled(3) |
1091 |
> |
integer i |
1092 |
> |
|
1093 |
> |
d(1:3) = q_j(1:3) - q_i(1:3) |
1094 |
> |
|
1095 |
> |
! Wrap back into periodic box if necessary |
1096 |
> |
if ( SIM_uses_PBC ) then |
1097 |
> |
|
1098 |
> |
if( .not.boxIsOrthorhombic ) then |
1099 |
> |
! calc the scaled coordinates. |
1100 |
> |
|
1101 |
> |
scaled = matmul(HmatInv, d) |
1102 |
> |
|
1103 |
> |
! wrap the scaled coordinates |
1104 |
> |
|
1105 |
> |
scaled = scaled - anint(scaled) |
1106 |
> |
|
1107 |
> |
|
1108 |
> |
! calc the wrapped real coordinates from the wrapped scaled |
1109 |
> |
! coordinates |
1110 |
> |
|
1111 |
> |
d = matmul(Hmat,scaled) |
1112 |
> |
|
1113 |
> |
else |
1114 |
> |
! calc the scaled coordinates. |
1115 |
> |
|
1116 |
> |
do i = 1, 3 |
1117 |
> |
scaled(i) = d(i) * HmatInv(i,i) |
1118 |
> |
|
1119 |
> |
! wrap the scaled coordinates |
1120 |
> |
|
1121 |
> |
scaled(i) = scaled(i) - anint(scaled(i)) |
1122 |
> |
|
1123 |
> |
! calc the wrapped real coordinates from the wrapped scaled |
1124 |
> |
! coordinates |
1125 |
> |
|
1126 |
> |
d(i) = scaled(i)*Hmat(i,i) |
1127 |
> |
enddo |
1128 |
> |
endif |
1129 |
> |
|
1130 |
> |
endif |
1131 |
> |
|
1132 |
> |
r_sq = dot_product(d,d) |
1133 |
> |
|
1134 |
> |
end subroutine get_interatomic_vector |
1135 |
> |
|
1136 |
> |
subroutine zero_work_arrays() |
1137 |
> |
|
1138 |
|
#ifdef IS_MPI |
1014 |
– |
|
1015 |
– |
q_Row = 0.0_dp |
1016 |
– |
q_Col = 0.0_dp |
1139 |
|
|
1140 |
< |
q_group_Row = 0.0_dp |
1141 |
< |
q_group_Col = 0.0_dp |
1142 |
< |
|
1143 |
< |
u_l_Row = 0.0_dp |
1144 |
< |
u_l_Col = 0.0_dp |
1145 |
< |
|
1146 |
< |
A_Row = 0.0_dp |
1147 |
< |
A_Col = 0.0_dp |
1148 |
< |
|
1149 |
< |
f_Row = 0.0_dp |
1150 |
< |
f_Col = 0.0_dp |
1151 |
< |
f_Temp = 0.0_dp |
1152 |
< |
|
1153 |
< |
t_Row = 0.0_dp |
1154 |
< |
t_Col = 0.0_dp |
1155 |
< |
t_Temp = 0.0_dp |
1156 |
< |
|
1157 |
< |
pot_Row = 0.0_dp |
1158 |
< |
pot_Col = 0.0_dp |
1159 |
< |
pot_Temp = 0.0_dp |
1160 |
< |
|
1161 |
< |
rf_Row = 0.0_dp |
1162 |
< |
rf_Col = 0.0_dp |
1163 |
< |
rf_Temp = 0.0_dp |
1164 |
< |
|
1140 |
> |
q_Row = 0.0_dp |
1141 |
> |
q_Col = 0.0_dp |
1142 |
> |
|
1143 |
> |
q_group_Row = 0.0_dp |
1144 |
> |
q_group_Col = 0.0_dp |
1145 |
> |
|
1146 |
> |
eFrame_Row = 0.0_dp |
1147 |
> |
eFrame_Col = 0.0_dp |
1148 |
> |
|
1149 |
> |
A_Row = 0.0_dp |
1150 |
> |
A_Col = 0.0_dp |
1151 |
> |
|
1152 |
> |
f_Row = 0.0_dp |
1153 |
> |
f_Col = 0.0_dp |
1154 |
> |
f_Temp = 0.0_dp |
1155 |
> |
|
1156 |
> |
t_Row = 0.0_dp |
1157 |
> |
t_Col = 0.0_dp |
1158 |
> |
t_Temp = 0.0_dp |
1159 |
> |
|
1160 |
> |
pot_Row = 0.0_dp |
1161 |
> |
pot_Col = 0.0_dp |
1162 |
> |
pot_Temp = 0.0_dp |
1163 |
> |
|
1164 |
> |
rf_Row = 0.0_dp |
1165 |
> |
rf_Col = 0.0_dp |
1166 |
> |
rf_Temp = 0.0_dp |
1167 |
> |
|
1168 |
|
#endif |
1169 |
< |
|
1170 |
< |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1171 |
< |
call clean_EAM() |
1172 |
< |
endif |
1173 |
< |
|
1174 |
< |
rf = 0.0_dp |
1175 |
< |
tau_Temp = 0.0_dp |
1176 |
< |
virial_Temp = 0.0_dp |
1177 |
< |
end subroutine zero_work_arrays |
1178 |
< |
|
1179 |
< |
function skipThisPair(atom1, atom2) result(skip_it) |
1180 |
< |
integer, intent(in) :: atom1 |
1181 |
< |
integer, intent(in), optional :: atom2 |
1182 |
< |
logical :: skip_it |
1183 |
< |
integer :: unique_id_1, unique_id_2 |
1184 |
< |
integer :: me_i,me_j |
1185 |
< |
integer :: i |
1186 |
< |
|
1187 |
< |
skip_it = .false. |
1188 |
< |
|
1189 |
< |
!! there are a number of reasons to skip a pair or a particle |
1190 |
< |
!! mostly we do this to exclude atoms who are involved in short |
1191 |
< |
!! range interactions (bonds, bends, torsions), but we also need |
1192 |
< |
!! to exclude some overcounted interactions that result from |
1193 |
< |
!! the parallel decomposition |
1194 |
< |
|
1195 |
< |
#ifdef IS_MPI |
1196 |
< |
!! in MPI, we have to look up the unique IDs for each atom |
1197 |
< |
unique_id_1 = AtomRowToGlobal(atom1) |
1169 |
> |
|
1170 |
> |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1171 |
> |
call clean_EAM() |
1172 |
> |
endif |
1173 |
> |
|
1174 |
> |
rf = 0.0_dp |
1175 |
> |
tau_Temp = 0.0_dp |
1176 |
> |
virial_Temp = 0.0_dp |
1177 |
> |
end subroutine zero_work_arrays |
1178 |
> |
|
1179 |
> |
function skipThisPair(atom1, atom2) result(skip_it) |
1180 |
> |
integer, intent(in) :: atom1 |
1181 |
> |
integer, intent(in), optional :: atom2 |
1182 |
> |
logical :: skip_it |
1183 |
> |
integer :: unique_id_1, unique_id_2 |
1184 |
> |
integer :: me_i,me_j |
1185 |
> |
integer :: i |
1186 |
> |
|
1187 |
> |
skip_it = .false. |
1188 |
> |
|
1189 |
> |
!! there are a number of reasons to skip a pair or a particle |
1190 |
> |
!! mostly we do this to exclude atoms who are involved in short |
1191 |
> |
!! range interactions (bonds, bends, torsions), but we also need |
1192 |
> |
!! to exclude some overcounted interactions that result from |
1193 |
> |
!! the parallel decomposition |
1194 |
> |
|
1195 |
> |
#ifdef IS_MPI |
1196 |
> |
!! in MPI, we have to look up the unique IDs for each atom |
1197 |
> |
unique_id_1 = AtomRowToGlobal(atom1) |
1198 |
|
#else |
1199 |
< |
!! in the normal loop, the atom numbers are unique |
1200 |
< |
unique_id_1 = atom1 |
1199 |
> |
!! in the normal loop, the atom numbers are unique |
1200 |
> |
unique_id_1 = atom1 |
1201 |
|
#endif |
1202 |
< |
|
1203 |
< |
!! We were called with only one atom, so just check the global exclude |
1204 |
< |
!! list for this atom |
1205 |
< |
if (.not. present(atom2)) then |
1206 |
< |
do i = 1, nExcludes_global |
1207 |
< |
if (excludesGlobal(i) == unique_id_1) then |
1208 |
< |
skip_it = .true. |
1209 |
< |
return |
1210 |
< |
end if |
1211 |
< |
end do |
1212 |
< |
return |
1213 |
< |
end if |
1214 |
< |
|
1202 |
> |
|
1203 |
> |
!! We were called with only one atom, so just check the global exclude |
1204 |
> |
!! list for this atom |
1205 |
> |
if (.not. present(atom2)) then |
1206 |
> |
do i = 1, nExcludes_global |
1207 |
> |
if (excludesGlobal(i) == unique_id_1) then |
1208 |
> |
skip_it = .true. |
1209 |
> |
return |
1210 |
> |
end if |
1211 |
> |
end do |
1212 |
> |
return |
1213 |
> |
end if |
1214 |
> |
|
1215 |
|
#ifdef IS_MPI |
1216 |
< |
unique_id_2 = AtomColToGlobal(atom2) |
1216 |
> |
unique_id_2 = AtomColToGlobal(atom2) |
1217 |
|
#else |
1218 |
< |
unique_id_2 = atom2 |
1218 |
> |
unique_id_2 = atom2 |
1219 |
|
#endif |
1220 |
< |
|
1220 |
> |
|
1221 |
|
#ifdef IS_MPI |
1222 |
< |
!! this situation should only arise in MPI simulations |
1223 |
< |
if (unique_id_1 == unique_id_2) then |
1224 |
< |
skip_it = .true. |
1225 |
< |
return |
1226 |
< |
end if |
1227 |
< |
|
1228 |
< |
!! this prevents us from doing the pair on multiple processors |
1229 |
< |
if (unique_id_1 < unique_id_2) then |
1230 |
< |
if (mod(unique_id_1 + unique_id_2,2) == 0) then |
1231 |
< |
skip_it = .true. |
1232 |
< |
return |
1233 |
< |
endif |
1234 |
< |
else |
1235 |
< |
if (mod(unique_id_1 + unique_id_2,2) == 1) then |
1236 |
< |
skip_it = .true. |
1237 |
< |
return |
1238 |
< |
endif |
1239 |
< |
endif |
1222 |
> |
!! this situation should only arise in MPI simulations |
1223 |
> |
if (unique_id_1 == unique_id_2) then |
1224 |
> |
skip_it = .true. |
1225 |
> |
return |
1226 |
> |
end if |
1227 |
> |
|
1228 |
> |
!! this prevents us from doing the pair on multiple processors |
1229 |
> |
if (unique_id_1 < unique_id_2) then |
1230 |
> |
if (mod(unique_id_1 + unique_id_2,2) == 0) then |
1231 |
> |
skip_it = .true. |
1232 |
> |
return |
1233 |
> |
endif |
1234 |
> |
else |
1235 |
> |
if (mod(unique_id_1 + unique_id_2,2) == 1) then |
1236 |
> |
skip_it = .true. |
1237 |
> |
return |
1238 |
> |
endif |
1239 |
> |
endif |
1240 |
|
#endif |
1241 |
< |
|
1242 |
< |
!! the rest of these situations can happen in all simulations: |
1243 |
< |
do i = 1, nExcludes_global |
1244 |
< |
if ((excludesGlobal(i) == unique_id_1) .or. & |
1245 |
< |
(excludesGlobal(i) == unique_id_2)) then |
1246 |
< |
skip_it = .true. |
1247 |
< |
return |
1248 |
< |
endif |
1249 |
< |
enddo |
1250 |
< |
|
1251 |
< |
do i = 1, nSkipsForAtom(atom1) |
1252 |
< |
if (skipsForAtom(atom1, i) .eq. unique_id_2) then |
1253 |
< |
skip_it = .true. |
1254 |
< |
return |
1255 |
< |
endif |
1256 |
< |
end do |
1257 |
< |
|
1258 |
< |
return |
1259 |
< |
end function skipThisPair |
1260 |
< |
|
1261 |
< |
function FF_UsesDirectionalAtoms() result(doesit) |
1262 |
< |
logical :: doesit |
1263 |
< |
doesit = FF_uses_dipoles .or. FF_uses_sticky .or. & |
1264 |
< |
FF_uses_GB .or. FF_uses_RF |
1265 |
< |
end function FF_UsesDirectionalAtoms |
1266 |
< |
|
1267 |
< |
function FF_RequiresPrepairCalc() result(doesit) |
1268 |
< |
logical :: doesit |
1269 |
< |
doesit = FF_uses_EAM |
1270 |
< |
end function FF_RequiresPrepairCalc |
1271 |
< |
|
1272 |
< |
function FF_RequiresPostpairCalc() result(doesit) |
1273 |
< |
logical :: doesit |
1274 |
< |
doesit = FF_uses_RF |
1275 |
< |
end function FF_RequiresPostpairCalc |
1276 |
< |
|
1241 |
> |
|
1242 |
> |
!! the rest of these situations can happen in all simulations: |
1243 |
> |
do i = 1, nExcludes_global |
1244 |
> |
if ((excludesGlobal(i) == unique_id_1) .or. & |
1245 |
> |
(excludesGlobal(i) == unique_id_2)) then |
1246 |
> |
skip_it = .true. |
1247 |
> |
return |
1248 |
> |
endif |
1249 |
> |
enddo |
1250 |
> |
|
1251 |
> |
do i = 1, nSkipsForAtom(atom1) |
1252 |
> |
if (skipsForAtom(atom1, i) .eq. unique_id_2) then |
1253 |
> |
skip_it = .true. |
1254 |
> |
return |
1255 |
> |
endif |
1256 |
> |
end do |
1257 |
> |
|
1258 |
> |
return |
1259 |
> |
end function skipThisPair |
1260 |
> |
|
1261 |
> |
function FF_UsesDirectionalAtoms() result(doesit) |
1262 |
> |
logical :: doesit |
1263 |
> |
doesit = FF_uses_DirectionalAtoms .or. FF_uses_Dipoles .or. & |
1264 |
> |
FF_uses_Quadrupoles .or. FF_uses_Sticky .or. & |
1265 |
> |
FF_uses_StickyPower .or. FF_uses_GayBerne .or. FF_uses_Shapes |
1266 |
> |
end function FF_UsesDirectionalAtoms |
1267 |
> |
|
1268 |
> |
function FF_RequiresPrepairCalc() result(doesit) |
1269 |
> |
logical :: doesit |
1270 |
> |
doesit = FF_uses_EAM |
1271 |
> |
end function FF_RequiresPrepairCalc |
1272 |
> |
|
1273 |
> |
function FF_RequiresPostpairCalc() result(doesit) |
1274 |
> |
logical :: doesit |
1275 |
> |
doesit = FF_uses_RF |
1276 |
> |
end function FF_RequiresPostpairCalc |
1277 |
> |
|
1278 |
|
#ifdef PROFILE |
1279 |
< |
function getforcetime() result(totalforcetime) |
1280 |
< |
real(kind=dp) :: totalforcetime |
1281 |
< |
totalforcetime = forcetime |
1282 |
< |
end function getforcetime |
1279 |
> |
function getforcetime() result(totalforcetime) |
1280 |
> |
real(kind=dp) :: totalforcetime |
1281 |
> |
totalforcetime = forcetime |
1282 |
> |
end function getforcetime |
1283 |
|
#endif |
1158 |
– |
|
1159 |
– |
!! This cleans componets of force arrays belonging only to fortran |
1284 |
|
|
1285 |
< |
subroutine add_stress_tensor(dpair, fpair) |
1162 |
< |
|
1163 |
< |
real( kind = dp ), dimension(3), intent(in) :: dpair, fpair |
1164 |
< |
|
1165 |
< |
! because the d vector is the rj - ri vector, and |
1166 |
< |
! because fx, fy, fz are the force on atom i, we need a |
1167 |
< |
! negative sign here: |
1168 |
< |
|
1169 |
< |
tau_Temp(1) = tau_Temp(1) - dpair(1) * fpair(1) |
1170 |
< |
tau_Temp(2) = tau_Temp(2) - dpair(1) * fpair(2) |
1171 |
< |
tau_Temp(3) = tau_Temp(3) - dpair(1) * fpair(3) |
1172 |
< |
tau_Temp(4) = tau_Temp(4) - dpair(2) * fpair(1) |
1173 |
< |
tau_Temp(5) = tau_Temp(5) - dpair(2) * fpair(2) |
1174 |
< |
tau_Temp(6) = tau_Temp(6) - dpair(2) * fpair(3) |
1175 |
< |
tau_Temp(7) = tau_Temp(7) - dpair(3) * fpair(1) |
1176 |
< |
tau_Temp(8) = tau_Temp(8) - dpair(3) * fpair(2) |
1177 |
< |
tau_Temp(9) = tau_Temp(9) - dpair(3) * fpair(3) |
1178 |
< |
|
1179 |
< |
virial_Temp = virial_Temp + & |
1180 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
1181 |
< |
|
1182 |
< |
end subroutine add_stress_tensor |
1183 |
< |
|
1184 |
< |
end module doForces |
1285 |
> |
!! This cleans componets of force arrays belonging only to fortran |
1286 |
|
|
1287 |
< |
!! Interfaces for C programs to module.... |
1287 |
> |
subroutine add_stress_tensor(dpair, fpair) |
1288 |
|
|
1289 |
< |
subroutine initFortranFF(LJMIXPOLICY, use_RF_c, thisStat) |
1189 |
< |
use doForces, ONLY: init_FF |
1190 |
< |
integer, intent(in) :: LJMIXPOLICY |
1191 |
< |
logical, intent(in) :: use_RF_c |
1289 |
> |
real( kind = dp ), dimension(3), intent(in) :: dpair, fpair |
1290 |
|
|
1291 |
< |
integer, intent(out) :: thisStat |
1292 |
< |
call init_FF(LJMIXPOLICY, use_RF_c, thisStat) |
1291 |
> |
! because the d vector is the rj - ri vector, and |
1292 |
> |
! because fx, fy, fz are the force on atom i, we need a |
1293 |
> |
! negative sign here: |
1294 |
|
|
1295 |
< |
end subroutine initFortranFF |
1295 |
> |
tau_Temp(1) = tau_Temp(1) - dpair(1) * fpair(1) |
1296 |
> |
tau_Temp(2) = tau_Temp(2) - dpair(1) * fpair(2) |
1297 |
> |
tau_Temp(3) = tau_Temp(3) - dpair(1) * fpair(3) |
1298 |
> |
tau_Temp(4) = tau_Temp(4) - dpair(2) * fpair(1) |
1299 |
> |
tau_Temp(5) = tau_Temp(5) - dpair(2) * fpair(2) |
1300 |
> |
tau_Temp(6) = tau_Temp(6) - dpair(2) * fpair(3) |
1301 |
> |
tau_Temp(7) = tau_Temp(7) - dpair(3) * fpair(1) |
1302 |
> |
tau_Temp(8) = tau_Temp(8) - dpair(3) * fpair(2) |
1303 |
> |
tau_Temp(9) = tau_Temp(9) - dpair(3) * fpair(3) |
1304 |
|
|
1305 |
< |
subroutine doForceloop(q, q_group, A, u_l, f, t, tau, pot, & |
1306 |
< |
do_pot_c, do_stress_c, error) |
1200 |
< |
|
1201 |
< |
use definitions, ONLY: dp |
1202 |
< |
use simulation |
1203 |
< |
use doForces, ONLY: do_force_loop |
1204 |
< |
!! Position array provided by C, dimensioned by getNlocal |
1205 |
< |
real ( kind = dp ), dimension(3, nLocal) :: q |
1206 |
< |
!! molecular center-of-mass position array |
1207 |
< |
real ( kind = dp ), dimension(3, nGroups) :: q_group |
1208 |
< |
!! Rotation Matrix for each long range particle in simulation. |
1209 |
< |
real( kind = dp), dimension(9, nLocal) :: A |
1210 |
< |
!! Unit vectors for dipoles (lab frame) |
1211 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
1212 |
< |
!! Force array provided by C, dimensioned by getNlocal |
1213 |
< |
real ( kind = dp ), dimension(3,nLocal) :: f |
1214 |
< |
!! Torsion array provided by C, dimensioned by getNlocal |
1215 |
< |
real( kind = dp ), dimension(3,nLocal) :: t |
1305 |
> |
virial_Temp = virial_Temp + & |
1306 |
> |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
1307 |
|
|
1308 |
< |
!! Stress Tensor |
1309 |
< |
real( kind = dp), dimension(9) :: tau |
1310 |
< |
real ( kind = dp ) :: pot |
1220 |
< |
logical ( kind = 2) :: do_pot_c, do_stress_c |
1221 |
< |
integer :: error |
1222 |
< |
|
1223 |
< |
call do_force_loop(q, q_group, A, u_l, f, t, tau, pot, & |
1224 |
< |
do_pot_c, do_stress_c, error) |
1225 |
< |
|
1226 |
< |
end subroutine doForceloop |
1308 |
> |
end subroutine add_stress_tensor |
1309 |
> |
|
1310 |
> |
end module doForces |