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.2 2004-10-21 20:15:22 gezelter Exp $, $Date: 2004-10-21 20:15:22 $, $Name: not supported by cvs2svn $, $Revision: 1.2 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.12 2005-03-21 20:51:06 chrisfen Exp $, $Date: 2005-03-21 20:51:06 $, $Name: not supported by cvs2svn $, $Revision: 1.12 $ |
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 |
82 |
|
logical, save :: haveSIMvariables = .false. |
83 |
|
logical, save :: havePropertyMap = .false. |
84 |
|
logical, save :: haveSaneForceField = .false. |
85 |
< |
logical, save :: FF_uses_LJ |
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_charges |
46 |
< |
logical, save :: FF_uses_dipoles |
47 |
< |
logical, save :: FF_uses_RF |
48 |
< |
logical, save :: FF_uses_GB |
93 |
> |
logical, save :: FF_uses_GayBerne |
94 |
|
logical, save :: FF_uses_EAM |
95 |
< |
logical, save :: SIM_uses_LJ |
96 |
< |
logical, save :: SIM_uses_sticky |
97 |
< |
logical, save :: SIM_uses_charges |
98 |
< |
logical, save :: SIM_uses_dipoles |
99 |
< |
logical, save :: SIM_uses_RF |
100 |
< |
logical, save :: SIM_uses_GB |
95 |
> |
logical, save :: FF_uses_Shapes |
96 |
> |
logical, save :: FF_uses_FLARB |
97 |
> |
logical, save :: FF_uses_RF |
98 |
> |
|
99 |
> |
logical, save :: SIM_uses_DirectionalAtoms |
100 |
> |
logical, save :: SIM_uses_LennardJones |
101 |
> |
logical, save :: SIM_uses_Electrostatics |
102 |
> |
logical, save :: SIM_uses_Charges |
103 |
> |
logical, save :: SIM_uses_Dipoles |
104 |
> |
logical, save :: SIM_uses_Quadrupoles |
105 |
> |
logical, save :: SIM_uses_Sticky |
106 |
> |
logical, save :: SIM_uses_GayBerne |
107 |
|
logical, save :: SIM_uses_EAM |
108 |
+ |
logical, save :: SIM_uses_Shapes |
109 |
+ |
logical, save :: SIM_uses_FLARB |
110 |
+ |
logical, save :: SIM_uses_RF |
111 |
|
logical, save :: SIM_requires_postpair_calc |
112 |
|
logical, save :: SIM_requires_prepair_calc |
59 |
– |
logical, save :: SIM_uses_directional_atoms |
113 |
|
logical, save :: SIM_uses_PBC |
114 |
|
logical, save :: SIM_uses_molecular_cutoffs |
115 |
|
|
127 |
|
#endif |
128 |
|
|
129 |
|
type :: Properties |
130 |
< |
logical :: is_lj = .false. |
131 |
< |
logical :: is_sticky = .false. |
132 |
< |
logical :: is_dp = .false. |
133 |
< |
logical :: is_gb = .false. |
134 |
< |
logical :: is_eam = .false. |
135 |
< |
logical :: is_charge = .false. |
136 |
< |
real(kind=DP) :: charge = 0.0_DP |
137 |
< |
real(kind=DP) :: dipole_moment = 0.0_DP |
130 |
> |
logical :: is_Directional = .false. |
131 |
> |
logical :: is_LennardJones = .false. |
132 |
> |
logical :: is_Electrostatic = .false. |
133 |
> |
logical :: is_Charge = .false. |
134 |
> |
logical :: is_Dipole = .false. |
135 |
> |
logical :: is_Quadrupole = .false. |
136 |
> |
logical :: is_Sticky = .false. |
137 |
> |
logical :: is_GayBerne = .false. |
138 |
> |
logical :: is_EAM = .false. |
139 |
> |
logical :: is_Shape = .false. |
140 |
> |
logical :: is_FLARB = .false. |
141 |
|
end type Properties |
142 |
|
|
143 |
|
type(Properties), dimension(:),allocatable :: PropertyMap |
176 |
|
endif |
177 |
|
|
178 |
|
do i = 1, nAtypes |
179 |
< |
call getElementProperty(atypes, i, "is_LJ", thisProperty) |
180 |
< |
PropertyMap(i)%is_LJ = thisProperty |
179 |
> |
call getElementProperty(atypes, i, "is_Directional", thisProperty) |
180 |
> |
PropertyMap(i)%is_Directional = thisProperty |
181 |
|
|
182 |
+ |
call getElementProperty(atypes, i, "is_LennardJones", thisProperty) |
183 |
+ |
PropertyMap(i)%is_LennardJones = thisProperty |
184 |
+ |
|
185 |
+ |
call getElementProperty(atypes, i, "is_Electrostatic", thisProperty) |
186 |
+ |
PropertyMap(i)%is_Electrostatic = thisProperty |
187 |
+ |
|
188 |
|
call getElementProperty(atypes, i, "is_Charge", thisProperty) |
189 |
|
PropertyMap(i)%is_Charge = thisProperty |
190 |
|
|
191 |
< |
if (thisProperty) then |
192 |
< |
call getElementProperty(atypes, i, "charge", thisDPproperty) |
131 |
< |
PropertyMap(i)%charge = thisDPproperty |
132 |
< |
endif |
191 |
> |
call getElementProperty(atypes, i, "is_Dipole", thisProperty) |
192 |
> |
PropertyMap(i)%is_Dipole = thisProperty |
193 |
|
|
194 |
< |
call getElementProperty(atypes, i, "is_DP", thisProperty) |
195 |
< |
PropertyMap(i)%is_DP = thisProperty |
194 |
> |
call getElementProperty(atypes, i, "is_Quadrupole", thisProperty) |
195 |
> |
PropertyMap(i)%is_Quadrupole = thisProperty |
196 |
|
|
137 |
– |
if (thisProperty) then |
138 |
– |
call getElementProperty(atypes, i, "dipole_moment", thisDPproperty) |
139 |
– |
PropertyMap(i)%dipole_moment = thisDPproperty |
140 |
– |
endif |
141 |
– |
|
197 |
|
call getElementProperty(atypes, i, "is_Sticky", thisProperty) |
198 |
|
PropertyMap(i)%is_Sticky = thisProperty |
199 |
< |
call getElementProperty(atypes, i, "is_GB", thisProperty) |
200 |
< |
PropertyMap(i)%is_GB = thisProperty |
199 |
> |
|
200 |
> |
call getElementProperty(atypes, i, "is_GayBerne", thisProperty) |
201 |
> |
PropertyMap(i)%is_GayBerne = thisProperty |
202 |
> |
|
203 |
|
call getElementProperty(atypes, i, "is_EAM", thisProperty) |
204 |
|
PropertyMap(i)%is_EAM = thisProperty |
205 |
+ |
|
206 |
+ |
call getElementProperty(atypes, i, "is_Shape", thisProperty) |
207 |
+ |
PropertyMap(i)%is_Shape = thisProperty |
208 |
+ |
|
209 |
+ |
call getElementProperty(atypes, i, "is_FLARB", thisProperty) |
210 |
+ |
PropertyMap(i)%is_FLARB = thisProperty |
211 |
|
end do |
212 |
|
|
213 |
|
havePropertyMap = .true. |
215 |
|
end subroutine createPropertyMap |
216 |
|
|
217 |
|
subroutine setSimVariables() |
218 |
< |
SIM_uses_LJ = SimUsesLJ() |
219 |
< |
SIM_uses_sticky = SimUsesSticky() |
220 |
< |
SIM_uses_charges = SimUsesCharges() |
221 |
< |
SIM_uses_dipoles = SimUsesDipoles() |
222 |
< |
SIM_uses_RF = SimUsesRF() |
223 |
< |
SIM_uses_GB = SimUsesGB() |
218 |
> |
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
219 |
> |
SIM_uses_LennardJones = SimUsesLennardJones() |
220 |
> |
SIM_uses_Electrostatics = SimUsesElectrostatics() |
221 |
> |
SIM_uses_Charges = SimUsesCharges() |
222 |
> |
SIM_uses_Dipoles = SimUsesDipoles() |
223 |
> |
SIM_uses_Sticky = SimUsesSticky() |
224 |
> |
SIM_uses_GayBerne = SimUsesGayBerne() |
225 |
|
SIM_uses_EAM = SimUsesEAM() |
226 |
+ |
SIM_uses_Shapes = SimUsesShapes() |
227 |
+ |
SIM_uses_FLARB = SimUsesFLARB() |
228 |
+ |
SIM_uses_RF = SimUsesRF() |
229 |
|
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
230 |
|
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
164 |
– |
SIM_uses_directional_atoms = SimUsesDirectionalAtoms() |
231 |
|
SIM_uses_PBC = SimUsesPBC() |
166 |
– |
!SIM_uses_molecular_cutoffs = SimUsesMolecularCutoffs() |
232 |
|
|
233 |
|
haveSIMvariables = .true. |
234 |
|
|
309 |
|
!! this will scan through the known atypes and figure out what |
310 |
|
!! interactions are used by the force field. |
311 |
|
|
312 |
< |
FF_uses_LJ = .false. |
313 |
< |
FF_uses_sticky = .false. |
314 |
< |
FF_uses_charges = .false. |
315 |
< |
FF_uses_dipoles = .false. |
316 |
< |
FF_uses_GB = .false. |
312 |
> |
FF_uses_DirectionalAtoms = .false. |
313 |
> |
FF_uses_LennardJones = .false. |
314 |
> |
FF_uses_Electrostatics = .false. |
315 |
> |
FF_uses_Charges = .false. |
316 |
> |
FF_uses_Dipoles = .false. |
317 |
> |
FF_uses_Sticky = .false. |
318 |
> |
FF_uses_GayBerne = .false. |
319 |
|
FF_uses_EAM = .false. |
320 |
+ |
FF_uses_Shapes = .false. |
321 |
+ |
FF_uses_FLARB = .false. |
322 |
|
|
323 |
< |
call getMatchingElementList(atypes, "is_LJ", .true., nMatches, MatchList) |
324 |
< |
if (nMatches .gt. 0) FF_uses_LJ = .true. |
323 |
> |
call getMatchingElementList(atypes, "is_Directional", .true., & |
324 |
> |
nMatches, MatchList) |
325 |
> |
if (nMatches .gt. 0) FF_uses_DirectionalAtoms = .true. |
326 |
> |
|
327 |
> |
call getMatchingElementList(atypes, "is_LennardJones", .true., & |
328 |
> |
nMatches, MatchList) |
329 |
> |
if (nMatches .gt. 0) FF_uses_LennardJones = .true. |
330 |
|
|
331 |
< |
call getMatchingElementList(atypes, "is_Charge", .true., nMatches, MatchList) |
332 |
< |
if (nMatches .gt. 0) FF_uses_charges = .true. |
331 |
> |
call getMatchingElementList(atypes, "is_Electrostatic", .true., & |
332 |
> |
nMatches, MatchList) |
333 |
> |
if (nMatches .gt. 0) then |
334 |
> |
FF_uses_Electrostatics = .true. |
335 |
> |
endif |
336 |
> |
|
337 |
> |
call getMatchingElementList(atypes, "is_Charge", .true., & |
338 |
> |
nMatches, MatchList) |
339 |
> |
if (nMatches .gt. 0) then |
340 |
> |
FF_uses_Charges = .true. |
341 |
> |
FF_uses_Electrostatics = .true. |
342 |
> |
endif |
343 |
|
|
344 |
< |
call getMatchingElementList(atypes, "is_DP", .true., nMatches, MatchList) |
345 |
< |
if (nMatches .gt. 0) FF_uses_dipoles = .true. |
344 |
> |
call getMatchingElementList(atypes, "is_Dipole", .true., & |
345 |
> |
nMatches, MatchList) |
346 |
> |
if (nMatches .gt. 0) then |
347 |
> |
FF_uses_Dipoles = .true. |
348 |
> |
FF_uses_Electrostatics = .true. |
349 |
> |
FF_uses_DirectionalAtoms = .true. |
350 |
> |
endif |
351 |
> |
|
352 |
> |
call getMatchingElementList(atypes, "is_Quadrupole", .true., & |
353 |
> |
nMatches, MatchList) |
354 |
> |
if (nMatches .gt. 0) then |
355 |
> |
FF_uses_Quadrupoles = .true. |
356 |
> |
FF_uses_Electrostatics = .true. |
357 |
> |
FF_uses_DirectionalAtoms = .true. |
358 |
> |
endif |
359 |
|
|
360 |
|
call getMatchingElementList(atypes, "is_Sticky", .true., nMatches, & |
361 |
|
MatchList) |
362 |
< |
if (nMatches .gt. 0) FF_uses_Sticky = .true. |
362 |
> |
if (nMatches .gt. 0) then |
363 |
> |
FF_uses_Sticky = .true. |
364 |
> |
FF_uses_DirectionalAtoms = .true. |
365 |
> |
endif |
366 |
|
|
367 |
< |
call getMatchingElementList(atypes, "is_GB", .true., nMatches, MatchList) |
368 |
< |
if (nMatches .gt. 0) FF_uses_GB = .true. |
367 |
> |
call getMatchingElementList(atypes, "is_GayBerne", .true., & |
368 |
> |
nMatches, MatchList) |
369 |
> |
if (nMatches .gt. 0) then |
370 |
> |
FF_uses_GayBerne = .true. |
371 |
> |
FF_uses_DirectionalAtoms = .true. |
372 |
> |
endif |
373 |
|
|
374 |
|
call getMatchingElementList(atypes, "is_EAM", .true., nMatches, MatchList) |
375 |
|
if (nMatches .gt. 0) FF_uses_EAM = .true. |
376 |
|
|
377 |
+ |
call getMatchingElementList(atypes, "is_Shape", .true., & |
378 |
+ |
nMatches, MatchList) |
379 |
+ |
if (nMatches .gt. 0) then |
380 |
+ |
FF_uses_Shapes = .true. |
381 |
+ |
FF_uses_DirectionalAtoms = .true. |
382 |
+ |
endif |
383 |
+ |
|
384 |
+ |
call getMatchingElementList(atypes, "is_FLARB", .true., & |
385 |
+ |
nMatches, MatchList) |
386 |
+ |
if (nMatches .gt. 0) FF_uses_FLARB = .true. |
387 |
+ |
|
388 |
|
!! Assume sanity (for the sake of argument) |
389 |
|
haveSaneForceField = .true. |
390 |
|
|
404 |
|
endif |
405 |
|
endif |
406 |
|
|
407 |
< |
if (FF_uses_sticky) then |
408 |
< |
call check_sticky_FF(my_status) |
409 |
< |
if (my_status /= 0) then |
410 |
< |
thisStat = -1 |
411 |
< |
haveSaneForceField = .false. |
412 |
< |
return |
413 |
< |
end if |
414 |
< |
endif |
407 |
> |
!sticky module does not contain check_sticky_FF anymore |
408 |
> |
!if (FF_uses_sticky) then |
409 |
> |
! call check_sticky_FF(my_status) |
410 |
> |
! if (my_status /= 0) then |
411 |
> |
! thisStat = -1 |
412 |
> |
! haveSaneForceField = .false. |
413 |
> |
! return |
414 |
> |
! end if |
415 |
> |
!endif |
416 |
|
|
417 |
|
if (FF_uses_EAM) then |
418 |
|
call init_EAM_FF(my_status) |
424 |
|
end if |
425 |
|
endif |
426 |
|
|
427 |
< |
if (FF_uses_GB) then |
427 |
> |
if (FF_uses_GayBerne) then |
428 |
|
call check_gb_pair_FF(my_status) |
429 |
|
if (my_status .ne. 0) then |
430 |
|
thisStat = -1 |
433 |
|
endif |
434 |
|
endif |
435 |
|
|
436 |
< |
if (FF_uses_GB .and. FF_uses_LJ) then |
436 |
> |
if (FF_uses_GayBerne .and. FF_uses_LennardJones) then |
437 |
|
endif |
438 |
< |
|
438 |
> |
|
439 |
|
if (.not. haveNeighborList) then |
440 |
|
!! Create neighbor lists |
441 |
|
call expandNeighborList(nLocal, my_status) |
452 |
|
|
453 |
|
!! Does force loop over i,j pairs. Calls do_pair to calculates forces. |
454 |
|
!-------------------------------------------------------------> |
455 |
< |
subroutine do_force_loop(q, q_group, A, u_l, f, t, tau, pot, & |
455 |
> |
subroutine do_force_loop(q, q_group, A, eFrame, f, t, tau, pot, & |
456 |
|
do_pot_c, do_stress_c, error) |
457 |
|
!! Position array provided by C, dimensioned by getNlocal |
458 |
|
real ( kind = dp ), dimension(3, nLocal) :: q |
461 |
|
!! Rotation Matrix for each long range particle in simulation. |
462 |
|
real( kind = dp), dimension(9, nLocal) :: A |
463 |
|
!! Unit vectors for dipoles (lab frame) |
464 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
464 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
465 |
|
!! Force array provided by C, dimensioned by getNlocal |
466 |
|
real ( kind = dp ), dimension(3,nLocal) :: f |
467 |
|
!! Torsion array provided by C, dimensioned by getNlocal |
535 |
|
call gather(q_group, q_group_Row, plan_group_row_3d) |
536 |
|
call gather(q_group, q_group_Col, plan_group_col_3d) |
537 |
|
|
538 |
< |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then |
539 |
< |
call gather(u_l, u_l_Row, plan_atom_row_3d) |
540 |
< |
call gather(u_l, u_l_Col, plan_atom_col_3d) |
538 |
> |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
539 |
> |
call gather(eFrame, eFrame_Row, plan_atom_row_rotation) |
540 |
> |
call gather(eFrame, eFrame_Col, plan_atom_col_rotation) |
541 |
|
|
542 |
|
call gather(A, A_Row, plan_atom_row_rotation) |
543 |
|
call gather(A, A_Col, plan_atom_col_rotation) |
683 |
|
#ifdef IS_MPI |
684 |
|
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
685 |
|
rgrpsq, d_grp, do_pot, do_stress, & |
686 |
< |
u_l, A, f, t, pot_local) |
686 |
> |
eFrame, A, f, t, pot_local) |
687 |
|
#else |
688 |
|
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
689 |
|
rgrpsq, d_grp, do_pot, do_stress, & |
690 |
< |
u_l, A, f, t, pot) |
690 |
> |
eFrame, A, f, t, pot) |
691 |
|
#endif |
692 |
|
else |
693 |
|
#ifdef IS_MPI |
694 |
|
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
695 |
|
do_pot, & |
696 |
< |
u_l, A, f, t, pot_local, vpair, fpair) |
696 |
> |
eFrame, A, f, t, pot_local, vpair, fpair) |
697 |
|
#else |
698 |
|
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
699 |
|
do_pot, & |
700 |
< |
u_l, A, f, t, pot, vpair, fpair) |
700 |
> |
eFrame, A, f, t, pot, vpair, fpair) |
701 |
|
#endif |
702 |
|
|
703 |
|
vij = vij + vpair |
789 |
|
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
790 |
|
end do |
791 |
|
|
792 |
< |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then |
792 |
> |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
793 |
|
t_temp = 0.0_dp |
794 |
|
call scatter(t_Row,t_temp,plan_atom_row_3d) |
795 |
|
do i = 1,nlocal |
844 |
|
me_i = atid(i) |
845 |
|
#endif |
846 |
|
|
847 |
< |
if (PropertyMap(me_i)%is_DP) then |
847 |
> |
if (PropertyMap(me_i)%is_Dipole) then |
848 |
|
|
849 |
< |
mu_i = PropertyMap(me_i)%dipole_moment |
850 |
< |
|
849 |
> |
mu_i = getDipoleMoment(me_i) |
850 |
> |
|
851 |
|
!! The reaction field needs to include a self contribution |
852 |
|
!! to the field: |
853 |
< |
call accumulate_self_rf(i, mu_i, u_l) |
853 |
> |
call accumulate_self_rf(i, mu_i, eFrame) |
854 |
|
!! Get the reaction field contribution to the |
855 |
|
!! potential and torques: |
856 |
< |
call reaction_field_final(i, mu_i, u_l, rfpot, t, do_pot) |
856 |
> |
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
857 |
|
#ifdef IS_MPI |
858 |
|
pot_local = pot_local + rfpot |
859 |
|
#else |
893 |
|
end subroutine do_force_loop |
894 |
|
|
895 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
896 |
< |
u_l, A, f, t, pot, vpair, fpair) |
896 |
> |
eFrame, A, f, t, pot, vpair, fpair) |
897 |
|
|
898 |
|
real( kind = dp ) :: pot, vpair, sw |
899 |
|
real( kind = dp ), dimension(3) :: fpair |
900 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
901 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
901 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
902 |
|
real( kind = dp ), dimension(9,nLocal) :: A |
903 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
904 |
|
real( kind = dp ), dimension(3,nLocal) :: t |
921 |
|
me_i = atid(i) |
922 |
|
me_j = atid(j) |
923 |
|
#endif |
924 |
+ |
|
925 |
+ |
! write(*,*) i, j, me_i, me_j |
926 |
|
|
927 |
< |
if (FF_uses_LJ .and. SIM_uses_LJ) then |
927 |
> |
if (FF_uses_LennardJones .and. SIM_uses_LennardJones) then |
928 |
|
|
929 |
< |
if ( PropertyMap(me_i)%is_LJ .and. PropertyMap(me_j)%is_LJ ) then |
929 |
> |
if ( PropertyMap(me_i)%is_LennardJones .and. & |
930 |
> |
PropertyMap(me_j)%is_LennardJones ) then |
931 |
|
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
932 |
|
endif |
933 |
|
|
934 |
|
endif |
935 |
|
|
936 |
< |
if (FF_uses_charges .and. SIM_uses_charges) then |
936 |
> |
if (FF_uses_Electrostatics .and. SIM_uses_Electrostatics) then |
937 |
|
|
938 |
< |
if (PropertyMap(me_i)%is_Charge .and. PropertyMap(me_j)%is_Charge) then |
939 |
< |
call do_charge_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
938 |
> |
if (PropertyMap(me_i)%is_Electrostatic .and. & |
939 |
> |
PropertyMap(me_j)%is_Electrostatic) then |
940 |
> |
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
941 |
> |
pot, eFrame, f, t, do_pot) |
942 |
|
endif |
943 |
|
|
944 |
+ |
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
945 |
+ |
if ( PropertyMap(me_i)%is_Dipole .and. & |
946 |
+ |
PropertyMap(me_j)%is_Dipole) then |
947 |
+ |
if (FF_uses_RF .and. SIM_uses_RF) then |
948 |
+ |
call accumulate_rf(i, j, r, eFrame, sw) |
949 |
+ |
call rf_correct_forces(i, j, d, r, eFrame, sw, f, fpair) |
950 |
+ |
endif |
951 |
+ |
endif |
952 |
+ |
endif |
953 |
|
endif |
824 |
– |
|
825 |
– |
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
826 |
– |
|
827 |
– |
if ( PropertyMap(me_i)%is_DP .and. PropertyMap(me_j)%is_DP) then |
828 |
– |
call do_dipole_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, u_l, f, t, & |
829 |
– |
do_pot) |
830 |
– |
if (FF_uses_RF .and. SIM_uses_RF) then |
831 |
– |
call accumulate_rf(i, j, r, u_l, sw) |
832 |
– |
call rf_correct_forces(i, j, d, r, u_l, sw, f, fpair) |
833 |
– |
endif |
834 |
– |
endif |
954 |
|
|
836 |
– |
endif |
955 |
|
|
956 |
|
if (FF_uses_Sticky .and. SIM_uses_sticky) then |
957 |
|
|
958 |
|
if ( PropertyMap(me_i)%is_Sticky .and. PropertyMap(me_j)%is_Sticky) then |
959 |
< |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, A, f, t, & |
960 |
< |
do_pot) |
959 |
> |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
960 |
> |
pot, A, f, t, do_pot) |
961 |
|
endif |
962 |
< |
|
962 |
> |
|
963 |
|
endif |
964 |
|
|
965 |
|
|
966 |
< |
if (FF_uses_GB .and. SIM_uses_GB) then |
966 |
> |
if (FF_uses_GayBerne .and. SIM_uses_GayBerne) then |
967 |
|
|
968 |
< |
if ( PropertyMap(me_i)%is_GB .and. PropertyMap(me_j)%is_GB) then |
969 |
< |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, u_l, f, t, & |
970 |
< |
do_pot) |
968 |
> |
if ( PropertyMap(me_i)%is_GayBerne .and. & |
969 |
> |
PropertyMap(me_j)%is_GayBerne) then |
970 |
> |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
971 |
> |
pot, A, f, t, do_pot) |
972 |
|
endif |
854 |
– |
|
855 |
– |
endif |
973 |
|
|
974 |
+ |
endif |
975 |
+ |
|
976 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
977 |
|
|
978 |
|
if ( PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) then |
981 |
|
endif |
982 |
|
|
983 |
|
endif |
984 |
+ |
|
985 |
+ |
|
986 |
+ |
! write(*,*) PropertyMap(me_i)%is_Shape,PropertyMap(me_j)%is_Shape |
987 |
+ |
|
988 |
+ |
if (FF_uses_Shapes .and. SIM_uses_Shapes) then |
989 |
+ |
if ( PropertyMap(me_i)%is_Shape .and. & |
990 |
+ |
PropertyMap(me_j)%is_Shape ) then |
991 |
+ |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
992 |
+ |
pot, A, f, t, do_pot) |
993 |
+ |
endif |
994 |
+ |
|
995 |
+ |
endif |
996 |
|
|
997 |
|
end subroutine do_pair |
998 |
|
|
999 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1000 |
< |
do_pot, do_stress, u_l, A, f, t, pot) |
1000 |
> |
do_pot, do_stress, eFrame, A, f, t, pot) |
1001 |
|
|
1002 |
|
real( kind = dp ) :: pot, sw |
1003 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
1003 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1004 |
|
real (kind=dp), dimension(9,nLocal) :: A |
1005 |
|
real (kind=dp), dimension(3,nLocal) :: f |
1006 |
|
real (kind=dp), dimension(3,nLocal) :: t |
1115 |
|
q_group_Row = 0.0_dp |
1116 |
|
q_group_Col = 0.0_dp |
1117 |
|
|
1118 |
< |
u_l_Row = 0.0_dp |
1119 |
< |
u_l_Col = 0.0_dp |
1118 |
> |
eFrame_Row = 0.0_dp |
1119 |
> |
eFrame_Col = 0.0_dp |
1120 |
|
|
1121 |
|
A_Row = 0.0_dp |
1122 |
|
A_Col = 0.0_dp |
1232 |
|
|
1233 |
|
function FF_UsesDirectionalAtoms() result(doesit) |
1234 |
|
logical :: doesit |
1235 |
< |
doesit = FF_uses_dipoles .or. FF_uses_sticky .or. & |
1236 |
< |
FF_uses_GB .or. FF_uses_RF |
1235 |
> |
doesit = FF_uses_DirectionalAtoms .or. FF_uses_Dipoles .or. & |
1236 |
> |
FF_uses_Quadrupoles .or. FF_uses_Sticky .or. & |
1237 |
> |
FF_uses_GayBerne .or. FF_uses_Shapes |
1238 |
|
end function FF_UsesDirectionalAtoms |
1239 |
|
|
1240 |
|
function FF_RequiresPrepairCalc() result(doesit) |
1280 |
|
end subroutine add_stress_tensor |
1281 |
|
|
1282 |
|
end module doForces |
1151 |
– |
|
1152 |
– |
!! Interfaces for C programs to module.... |
1153 |
– |
|
1154 |
– |
subroutine initFortranFF(use_RF_c, thisStat) |
1155 |
– |
use doForces, ONLY: init_FF |
1156 |
– |
logical, intent(in) :: use_RF_c |
1157 |
– |
|
1158 |
– |
integer, intent(out) :: thisStat |
1159 |
– |
call init_FF(use_RF_c, thisStat) |
1160 |
– |
|
1161 |
– |
end subroutine initFortranFF |
1162 |
– |
|
1163 |
– |
subroutine doForceloop(q, q_group, A, u_l, f, t, tau, pot, & |
1164 |
– |
do_pot_c, do_stress_c, error) |
1165 |
– |
|
1166 |
– |
use definitions, ONLY: dp |
1167 |
– |
use simulation |
1168 |
– |
use doForces, ONLY: do_force_loop |
1169 |
– |
!! Position array provided by C, dimensioned by getNlocal |
1170 |
– |
real ( kind = dp ), dimension(3, nLocal) :: q |
1171 |
– |
!! molecular center-of-mass position array |
1172 |
– |
real ( kind = dp ), dimension(3, nGroups) :: q_group |
1173 |
– |
!! Rotation Matrix for each long range particle in simulation. |
1174 |
– |
real( kind = dp), dimension(9, nLocal) :: A |
1175 |
– |
!! Unit vectors for dipoles (lab frame) |
1176 |
– |
real( kind = dp ), dimension(3,nLocal) :: u_l |
1177 |
– |
!! Force array provided by C, dimensioned by getNlocal |
1178 |
– |
real ( kind = dp ), dimension(3,nLocal) :: f |
1179 |
– |
!! Torsion array provided by C, dimensioned by getNlocal |
1180 |
– |
real( kind = dp ), dimension(3,nLocal) :: t |
1181 |
– |
|
1182 |
– |
!! Stress Tensor |
1183 |
– |
real( kind = dp), dimension(9) :: tau |
1184 |
– |
real ( kind = dp ) :: pot |
1185 |
– |
logical ( kind = 2) :: do_pot_c, do_stress_c |
1186 |
– |
integer :: error |
1187 |
– |
|
1188 |
– |
call do_force_loop(q, q_group, A, u_l, f, t, tau, pot, & |
1189 |
– |
do_pot_c, do_stress_c, error) |
1190 |
– |
|
1191 |
– |
end subroutine doForceloop |