4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @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 $ |
7 |
> |
!! @version $Id: doForces.F90,v 1.7 2004-11-04 16:20:28 gezelter Exp $, $Date: 2004-11-04 16:20:28 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $ |
8 |
|
|
9 |
|
module doForces |
10 |
|
use force_globals |
19 |
|
use charge_charge |
20 |
|
use reaction_field |
21 |
|
use gb_pair |
22 |
+ |
use shapes |
23 |
|
use vector_class |
24 |
|
use eam |
25 |
|
use status |
41 |
|
logical, save :: haveSIMvariables = .false. |
42 |
|
logical, save :: havePropertyMap = .false. |
43 |
|
logical, save :: haveSaneForceField = .false. |
44 |
< |
logical, save :: FF_uses_LJ |
45 |
< |
logical, save :: FF_uses_sticky |
44 |
> |
|
45 |
> |
logical, save :: FF_uses_DirectionalAtoms |
46 |
> |
logical, save :: FF_uses_LennardJones |
47 |
> |
logical, save :: FF_uses_Electrostatic |
48 |
|
logical, save :: FF_uses_charges |
49 |
|
logical, save :: FF_uses_dipoles |
50 |
< |
logical, save :: FF_uses_RF |
51 |
< |
logical, save :: FF_uses_GB |
50 |
> |
logical, save :: FF_uses_sticky |
51 |
> |
logical, save :: FF_uses_GayBerne |
52 |
|
logical, save :: FF_uses_EAM |
53 |
< |
logical, save :: SIM_uses_LJ |
54 |
< |
logical, save :: SIM_uses_sticky |
55 |
< |
logical, save :: SIM_uses_charges |
56 |
< |
logical, save :: SIM_uses_dipoles |
57 |
< |
logical, save :: SIM_uses_RF |
58 |
< |
logical, save :: SIM_uses_GB |
53 |
> |
logical, save :: FF_uses_Shapes |
54 |
> |
logical, save :: FF_uses_FLARB |
55 |
> |
logical, save :: FF_uses_RF |
56 |
> |
|
57 |
> |
logical, save :: SIM_uses_DirectionalAtoms |
58 |
> |
logical, save :: SIM_uses_LennardJones |
59 |
> |
logical, save :: SIM_uses_Electrostatics |
60 |
> |
logical, save :: SIM_uses_Charges |
61 |
> |
logical, save :: SIM_uses_Dipoles |
62 |
> |
logical, save :: SIM_uses_Sticky |
63 |
> |
logical, save :: SIM_uses_GayBerne |
64 |
|
logical, save :: SIM_uses_EAM |
65 |
+ |
logical, save :: SIM_uses_Shapes |
66 |
+ |
logical, save :: SIM_uses_FLARB |
67 |
+ |
logical, save :: SIM_uses_RF |
68 |
|
logical, save :: SIM_requires_postpair_calc |
69 |
|
logical, save :: SIM_requires_prepair_calc |
59 |
– |
logical, save :: SIM_uses_directional_atoms |
70 |
|
logical, save :: SIM_uses_PBC |
71 |
|
logical, save :: SIM_uses_molecular_cutoffs |
72 |
|
|
84 |
|
#endif |
85 |
|
|
86 |
|
type :: Properties |
87 |
< |
logical :: is_lj = .false. |
88 |
< |
logical :: is_sticky = .false. |
89 |
< |
logical :: is_dp = .false. |
90 |
< |
logical :: is_gb = .false. |
91 |
< |
logical :: is_eam = .false. |
92 |
< |
logical :: is_charge = .false. |
93 |
< |
real(kind=DP) :: charge = 0.0_DP |
94 |
< |
real(kind=DP) :: dipole_moment = 0.0_DP |
87 |
> |
logical :: is_Directional = .false. |
88 |
> |
logical :: is_LennardJones = .false. |
89 |
> |
logical :: is_Electrostatic = .false. |
90 |
> |
logical :: is_Charge = .false. |
91 |
> |
logical :: is_Dipole = .false. |
92 |
> |
logical :: is_Sticky = .false. |
93 |
> |
logical :: is_GayBerne = .false. |
94 |
> |
logical :: is_EAM = .false. |
95 |
> |
logical :: is_Shape = .false. |
96 |
> |
logical :: is_FLARB = .false. |
97 |
|
end type Properties |
98 |
|
|
99 |
|
type(Properties), dimension(:),allocatable :: PropertyMap |
132 |
|
endif |
133 |
|
|
134 |
|
do i = 1, nAtypes |
135 |
< |
call getElementProperty(atypes, i, "is_LJ", thisProperty) |
136 |
< |
PropertyMap(i)%is_LJ = thisProperty |
135 |
> |
call getElementProperty(atypes, i, "is_Directional", thisProperty) |
136 |
> |
PropertyMap(i)%is_Directional = thisProperty |
137 |
|
|
138 |
+ |
call getElementProperty(atypes, i, "is_LennardJones", thisProperty) |
139 |
+ |
PropertyMap(i)%is_LennardJones = thisProperty |
140 |
+ |
|
141 |
+ |
call getElementProperty(atypes, i, "is_Electrostatic", thisProperty) |
142 |
+ |
PropertyMap(i)%is_Electrostatic = thisProperty |
143 |
+ |
|
144 |
|
call getElementProperty(atypes, i, "is_Charge", thisProperty) |
145 |
|
PropertyMap(i)%is_Charge = thisProperty |
146 |
|
|
147 |
< |
if (thisProperty) then |
148 |
< |
call getElementProperty(atypes, i, "charge", thisDPproperty) |
131 |
< |
PropertyMap(i)%charge = thisDPproperty |
132 |
< |
endif |
147 |
> |
call getElementProperty(atypes, i, "is_Dipole", thisProperty) |
148 |
> |
PropertyMap(i)%is_Dipole = thisProperty |
149 |
|
|
134 |
– |
call getElementProperty(atypes, i, "is_DP", thisProperty) |
135 |
– |
PropertyMap(i)%is_DP = thisProperty |
136 |
– |
|
137 |
– |
if (thisProperty) then |
138 |
– |
call getElementProperty(atypes, i, "dipole_moment", thisDPproperty) |
139 |
– |
PropertyMap(i)%dipole_moment = thisDPproperty |
140 |
– |
endif |
141 |
– |
|
150 |
|
call getElementProperty(atypes, i, "is_Sticky", thisProperty) |
151 |
|
PropertyMap(i)%is_Sticky = thisProperty |
152 |
< |
call getElementProperty(atypes, i, "is_GB", thisProperty) |
153 |
< |
PropertyMap(i)%is_GB = thisProperty |
152 |
> |
|
153 |
> |
call getElementProperty(atypes, i, "is_GayBerne", thisProperty) |
154 |
> |
PropertyMap(i)%is_GayBerne = thisProperty |
155 |
> |
|
156 |
|
call getElementProperty(atypes, i, "is_EAM", thisProperty) |
157 |
|
PropertyMap(i)%is_EAM = thisProperty |
158 |
+ |
|
159 |
+ |
call getElementProperty(atypes, i, "is_Shape", thisProperty) |
160 |
+ |
PropertyMap(i)%is_Shape = thisProperty |
161 |
+ |
|
162 |
+ |
call getElementProperty(atypes, i, "is_FLARB", thisProperty) |
163 |
+ |
PropertyMap(i)%is_FLARB = thisProperty |
164 |
|
end do |
165 |
|
|
166 |
|
havePropertyMap = .true. |
168 |
|
end subroutine createPropertyMap |
169 |
|
|
170 |
|
subroutine setSimVariables() |
171 |
< |
SIM_uses_LJ = SimUsesLJ() |
172 |
< |
SIM_uses_sticky = SimUsesSticky() |
173 |
< |
SIM_uses_charges = SimUsesCharges() |
174 |
< |
SIM_uses_dipoles = SimUsesDipoles() |
175 |
< |
SIM_uses_RF = SimUsesRF() |
176 |
< |
SIM_uses_GB = SimUsesGB() |
171 |
> |
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
172 |
> |
SIM_uses_LennardJones = SimUsesLennardJones() |
173 |
> |
SIM_uses_Electrostatics = SimUsesElectrostatics() |
174 |
> |
SIM_uses_Charges = SimUsesCharges() |
175 |
> |
SIM_uses_Dipoles = SimUsesDipoles() |
176 |
> |
SIM_uses_Sticky = SimUsesSticky() |
177 |
> |
SIM_uses_GayBerne = SimUsesGayBerne() |
178 |
|
SIM_uses_EAM = SimUsesEAM() |
179 |
+ |
SIM_uses_Shapes = SimUsesShapes() |
180 |
+ |
SIM_uses_FLARB = SimUsesFLARB() |
181 |
+ |
SIM_uses_RF = SimUsesRF() |
182 |
|
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
183 |
|
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
164 |
– |
SIM_uses_directional_atoms = SimUsesDirectionalAtoms() |
184 |
|
SIM_uses_PBC = SimUsesPBC() |
166 |
– |
!SIM_uses_molecular_cutoffs = SimUsesMolecularCutoffs() |
185 |
|
|
186 |
|
haveSIMvariables = .true. |
187 |
|
|
262 |
|
!! this will scan through the known atypes and figure out what |
263 |
|
!! interactions are used by the force field. |
264 |
|
|
265 |
< |
FF_uses_LJ = .false. |
266 |
< |
FF_uses_sticky = .false. |
267 |
< |
FF_uses_charges = .false. |
268 |
< |
FF_uses_dipoles = .false. |
269 |
< |
FF_uses_GB = .false. |
265 |
> |
FF_uses_DirectionalAtoms = .false. |
266 |
> |
FF_uses_LennardJones = .false. |
267 |
> |
FF_uses_Electrostatic = .false. |
268 |
> |
FF_uses_Charges = .false. |
269 |
> |
FF_uses_Dipoles = .false. |
270 |
> |
FF_uses_Sticky = .false. |
271 |
> |
FF_uses_GayBerne = .false. |
272 |
|
FF_uses_EAM = .false. |
273 |
+ |
FF_uses_Shapes = .false. |
274 |
+ |
FF_uses_FLARB = .false. |
275 |
|
|
276 |
< |
call getMatchingElementList(atypes, "is_LJ", .true., nMatches, MatchList) |
277 |
< |
if (nMatches .gt. 0) FF_uses_LJ = .true. |
278 |
< |
|
279 |
< |
call getMatchingElementList(atypes, "is_Charge", .true., nMatches, MatchList) |
280 |
< |
if (nMatches .gt. 0) FF_uses_charges = .true. |
276 |
> |
call getMatchingElementList(atypes, "is_Directional", .true., & |
277 |
> |
nMatches, MatchList) |
278 |
> |
if (nMatches .gt. 0) FF_uses_DirectionalAtoms = .true. |
279 |
> |
|
280 |
> |
call getMatchingElementList(atypes, "is_LennardJones", .true., & |
281 |
> |
nMatches, MatchList) |
282 |
> |
if (nMatches .gt. 0) FF_uses_LennardJones = .true. |
283 |
|
|
284 |
< |
call getMatchingElementList(atypes, "is_DP", .true., nMatches, MatchList) |
285 |
< |
if (nMatches .gt. 0) FF_uses_dipoles = .true. |
284 |
> |
call getMatchingElementList(atypes, "is_Electrostatic", .true., & |
285 |
> |
nMatches, MatchList) |
286 |
> |
if (nMatches .gt. 0) then |
287 |
> |
FF_uses_Electrostatic = .true. |
288 |
> |
endif |
289 |
> |
|
290 |
> |
call getMatchingElementList(atypes, "is_Charge", .true., & |
291 |
> |
nMatches, MatchList) |
292 |
> |
if (nMatches .gt. 0) then |
293 |
> |
FF_uses_charges = .true. |
294 |
> |
FF_uses_electrostatic = .true. |
295 |
> |
endif |
296 |
|
|
297 |
+ |
call getMatchingElementList(atypes, "is_Dipole", .true., & |
298 |
+ |
nMatches, MatchList) |
299 |
+ |
if (nMatches .gt. 0) then |
300 |
+ |
FF_uses_dipoles = .true. |
301 |
+ |
FF_uses_electrostatic = .true. |
302 |
+ |
FF_uses_DirectionalAtoms = .true. |
303 |
+ |
endif |
304 |
+ |
|
305 |
|
call getMatchingElementList(atypes, "is_Sticky", .true., nMatches, & |
306 |
|
MatchList) |
307 |
< |
if (nMatches .gt. 0) FF_uses_Sticky = .true. |
307 |
> |
if (nMatches .gt. 0) then |
308 |
> |
FF_uses_Sticky = .true. |
309 |
> |
FF_uses_DirectionalAtoms = .true. |
310 |
> |
endif |
311 |
|
|
312 |
< |
call getMatchingElementList(atypes, "is_GB", .true., nMatches, MatchList) |
313 |
< |
if (nMatches .gt. 0) FF_uses_GB = .true. |
312 |
> |
call getMatchingElementList(atypes, "is_GayBerne", .true., & |
313 |
> |
nMatches, MatchList) |
314 |
> |
if (nMatches .gt. 0) then |
315 |
> |
FF_uses_GayBerne = .true. |
316 |
> |
FF_uses_DirectionalAtoms = .true. |
317 |
> |
endif |
318 |
|
|
319 |
|
call getMatchingElementList(atypes, "is_EAM", .true., nMatches, MatchList) |
320 |
|
if (nMatches .gt. 0) FF_uses_EAM = .true. |
321 |
|
|
322 |
+ |
call getMatchingElementList(atypes, "is_Shape", .true., & |
323 |
+ |
nMatches, MatchList) |
324 |
+ |
if (nMatches .gt. 0) then |
325 |
+ |
FF_uses_Shapes = .true. |
326 |
+ |
FF_uses_DirectionalAtoms = .true. |
327 |
+ |
endif |
328 |
+ |
|
329 |
+ |
call getMatchingElementList(atypes, "is_FLARB", .true., & |
330 |
+ |
nMatches, MatchList) |
331 |
+ |
if (nMatches .gt. 0) FF_uses_FLARB = .true. |
332 |
+ |
|
333 |
|
!! Assume sanity (for the sake of argument) |
334 |
|
haveSaneForceField = .true. |
335 |
|
|
368 |
|
end if |
369 |
|
endif |
370 |
|
|
371 |
< |
if (FF_uses_GB) then |
371 |
> |
if (FF_uses_GayBerne) then |
372 |
|
call check_gb_pair_FF(my_status) |
373 |
|
if (my_status .ne. 0) then |
374 |
|
thisStat = -1 |
377 |
|
endif |
378 |
|
endif |
379 |
|
|
380 |
< |
if (FF_uses_GB .and. FF_uses_LJ) then |
380 |
> |
if (FF_uses_GayBerne .and. FF_uses_LennardJones) then |
381 |
|
endif |
382 |
< |
|
382 |
> |
|
383 |
|
if (.not. haveNeighborList) then |
384 |
|
!! Create neighbor lists |
385 |
|
call expandNeighborList(nLocal, my_status) |
479 |
|
call gather(q_group, q_group_Row, plan_group_row_3d) |
480 |
|
call gather(q_group, q_group_Col, plan_group_col_3d) |
481 |
|
|
482 |
< |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then |
482 |
> |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
483 |
|
call gather(u_l, u_l_Row, plan_atom_row_3d) |
484 |
|
call gather(u_l, u_l_Col, plan_atom_col_3d) |
485 |
|
|
733 |
|
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
734 |
|
end do |
735 |
|
|
736 |
< |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then |
736 |
> |
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
737 |
|
t_temp = 0.0_dp |
738 |
|
call scatter(t_Row,t_temp,plan_atom_row_3d) |
739 |
|
do i = 1,nlocal |
788 |
|
me_i = atid(i) |
789 |
|
#endif |
790 |
|
|
791 |
< |
if (PropertyMap(me_i)%is_DP) then |
791 |
> |
if (PropertyMap(me_i)%is_Dipole) then |
792 |
|
|
793 |
< |
mu_i = PropertyMap(me_i)%dipole_moment |
793 |
> |
mu_i = getDipoleMoment(me_i) |
794 |
|
|
795 |
|
!! The reaction field needs to include a self contribution |
796 |
|
!! to the field: |
865 |
|
me_i = atid(i) |
866 |
|
me_j = atid(j) |
867 |
|
#endif |
868 |
+ |
|
869 |
+ |
write(*,*) i, j, me_i, me_j |
870 |
|
|
871 |
< |
if (FF_uses_LJ .and. SIM_uses_LJ) then |
871 |
> |
if (FF_uses_LennardJones .and. SIM_uses_LennardJones) then |
872 |
|
|
873 |
< |
if ( PropertyMap(me_i)%is_LJ .and. PropertyMap(me_j)%is_LJ ) then |
873 |
> |
if ( PropertyMap(me_i)%is_LennardJones .and. & |
874 |
> |
PropertyMap(me_j)%is_LennardJones ) then |
875 |
|
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
876 |
|
endif |
877 |
|
|
880 |
|
if (FF_uses_charges .and. SIM_uses_charges) then |
881 |
|
|
882 |
|
if (PropertyMap(me_i)%is_Charge .and. PropertyMap(me_j)%is_Charge) then |
883 |
< |
call do_charge_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
883 |
> |
call do_charge_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
884 |
> |
pot, f, do_pot) |
885 |
|
endif |
886 |
|
|
887 |
|
endif |
888 |
|
|
889 |
|
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
890 |
|
|
891 |
< |
if ( PropertyMap(me_i)%is_DP .and. PropertyMap(me_j)%is_DP) then |
892 |
< |
call do_dipole_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, u_l, f, t, & |
893 |
< |
do_pot) |
891 |
> |
if ( PropertyMap(me_i)%is_Dipole .and. PropertyMap(me_j)%is_Dipole) then |
892 |
> |
call do_dipole_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
893 |
> |
pot, u_l, f, t, do_pot) |
894 |
|
if (FF_uses_RF .and. SIM_uses_RF) then |
895 |
|
call accumulate_rf(i, j, r, u_l, sw) |
896 |
|
call rf_correct_forces(i, j, d, r, u_l, sw, f, fpair) |
897 |
< |
endif |
897 |
> |
endif |
898 |
|
endif |
899 |
|
|
900 |
|
endif |
902 |
|
if (FF_uses_Sticky .and. SIM_uses_sticky) then |
903 |
|
|
904 |
|
if ( PropertyMap(me_i)%is_Sticky .and. PropertyMap(me_j)%is_Sticky) then |
905 |
< |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, A, f, t, & |
906 |
< |
do_pot) |
905 |
> |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
906 |
> |
pot, A, f, t, do_pot) |
907 |
|
endif |
908 |
< |
|
908 |
> |
|
909 |
|
endif |
910 |
|
|
911 |
|
|
912 |
< |
if (FF_uses_GB .and. SIM_uses_GB) then |
913 |
< |
|
914 |
< |
if ( PropertyMap(me_i)%is_GB .and. PropertyMap(me_j)%is_GB) then |
915 |
< |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, u_l, f, t, & |
916 |
< |
do_pot) |
912 |
> |
if (FF_uses_GayBerne .and. SIM_uses_GayBerne) then |
913 |
> |
|
914 |
> |
if ( PropertyMap(me_i)%is_GayBerne .and. & |
915 |
> |
PropertyMap(me_j)%is_GayBerne) then |
916 |
> |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
917 |
> |
pot, u_l, f, t, do_pot) |
918 |
|
endif |
854 |
– |
|
855 |
– |
endif |
919 |
|
|
920 |
+ |
endif |
921 |
+ |
|
922 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
923 |
|
|
924 |
|
if ( PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) then |
925 |
|
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
926 |
|
do_pot) |
927 |
+ |
endif |
928 |
+ |
|
929 |
+ |
endif |
930 |
+ |
|
931 |
+ |
|
932 |
+ |
write(*,*) PropertyMap(me_i)%is_Shape,PropertyMap(me_j)%is_Shape |
933 |
+ |
|
934 |
+ |
if (FF_uses_Shapes .and. SIM_uses_Shapes) then |
935 |
+ |
if ( PropertyMap(me_i)%is_Shape .and. & |
936 |
+ |
PropertyMap(me_j)%is_Shape ) then |
937 |
+ |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
938 |
+ |
pot, A, f, t, do_pot) |
939 |
|
endif |
940 |
|
|
941 |
|
endif |
1178 |
|
|
1179 |
|
function FF_UsesDirectionalAtoms() result(doesit) |
1180 |
|
logical :: doesit |
1181 |
< |
doesit = FF_uses_dipoles .or. FF_uses_sticky .or. & |
1182 |
< |
FF_uses_GB .or. FF_uses_RF |
1181 |
> |
doesit = FF_uses_DirectionalAtoms .or. FF_uses_Dipoles .or. & |
1182 |
> |
FF_uses_Sticky .or. FF_uses_GayBerne .or. FF_uses_Shapes |
1183 |
|
end function FF_UsesDirectionalAtoms |
1184 |
|
|
1185 |
|
function FF_RequiresPrepairCalc() result(doesit) |