45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.40 2005-09-07 22:44:48 chuckv Exp $, $Date: 2005-09-07 22:44:48 $, $Name: not supported by cvs2svn $, $Revision: 1.40 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.43 2005-09-15 02:48:43 chuckv Exp $, $Date: 2005-09-15 02:48:43 $, $Name: not supported by cvs2svn $, $Revision: 1.43 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
58 |
|
use lj |
59 |
|
use sticky |
60 |
|
use electrostatic_module |
61 |
< |
use reaction_field |
61 |
> |
use reaction_field_module |
62 |
|
use gb_pair |
63 |
|
use shapes |
64 |
|
use vector_class |
74 |
|
#define __FORTRAN90 |
75 |
|
#include "UseTheForce/fSwitchingFunction.h" |
76 |
|
#include "UseTheForce/fCutoffPolicy.h" |
77 |
+ |
#include "UseTheForce/fCoulombicCorrection.h" |
78 |
|
#include "UseTheForce/DarkSide/fInteractionMap.h" |
79 |
|
|
80 |
|
|
136 |
|
type(gtypeCutoffs), dimension(:,:), allocatable :: gtypeCutoffMap |
137 |
|
|
138 |
|
integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY |
139 |
+ |
integer, save :: coulombicCorrection = NONE |
140 |
|
real(kind=dp),save :: defaultRcut, defaultRsw, defaultRlist |
141 |
+ |
real(kind=dp),save :: rcuti |
142 |
|
|
143 |
|
contains |
144 |
|
|
280 |
|
nGroupsInRow = getNgroupsInRow(plan_group_row) |
281 |
|
#endif |
282 |
|
nAtypes = getSize(atypes) |
283 |
< |
|
283 |
> |
! Set all of the initial cutoffs to zero. |
284 |
> |
atypeMaxCutoff = 0.0_dp |
285 |
|
do i = 1, nAtypes |
286 |
|
if (SimHasAtype(i)) then |
287 |
|
call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ) |
292 |
|
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
293 |
|
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
294 |
|
|
295 |
< |
atypeMaxCutoff(i) = 0.0_dp |
295 |
> |
|
296 |
|
if (i_is_LJ) then |
297 |
|
thisRcut = getSigma(i) * 2.5_dp |
298 |
|
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
342 |
|
allocate(groupToGtype(iend)) |
343 |
|
allocate(groupMaxCutoff(iend)) |
344 |
|
allocate(gtypeMaxCutoff(iend)) |
345 |
+ |
groupMaxCutoff = 0.0_dp |
346 |
+ |
gtypeMaxCutoff = 0.0_dp |
347 |
|
endif |
348 |
|
!! first we do a single loop over the cutoff groups to find the |
349 |
|
!! largest cutoff for any atypes present in this group. We also |
414 |
|
enddo |
415 |
|
|
416 |
|
haveGtypeCutoffMap = .true. |
417 |
< |
|
412 |
< |
end subroutine createGtypeCutoffMap |
413 |
< |
|
414 |
< |
subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy) |
415 |
< |
real(kind=dp),intent(in) :: defRcut, defRsw, defRlist |
416 |
< |
integer, intent(in) :: cutPolicy |
417 |
< |
|
418 |
< |
defaultRcut = defRcut |
419 |
< |
defaultRsw = defRsw |
420 |
< |
defaultRlist = defRlist |
421 |
< |
cutoffPolicy = cutPolicy |
422 |
< |
end subroutine setDefaultCutoffs |
423 |
< |
|
424 |
< |
subroutine setCutoffPolicy(cutPolicy) |
417 |
> |
end subroutine createGtypeCutoffMap |
418 |
|
|
419 |
+ |
subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy) |
420 |
+ |
real(kind=dp),intent(in) :: defRcut, defRsw, defRlist |
421 |
|
integer, intent(in) :: cutPolicy |
422 |
+ |
|
423 |
+ |
defaultRcut = defRcut |
424 |
+ |
defaultRsw = defRsw |
425 |
+ |
defaultRlist = defRlist |
426 |
|
cutoffPolicy = cutPolicy |
427 |
< |
call createGtypeCutoffMap() |
427 |
> |
rcuti = 1.0_dp / defaultRcut |
428 |
> |
end subroutine setDefaultCutoffs |
429 |
|
|
430 |
+ |
subroutine setCutoffPolicy(cutPolicy) |
431 |
+ |
|
432 |
+ |
integer, intent(in) :: cutPolicy |
433 |
+ |
cutoffPolicy = cutPolicy |
434 |
+ |
call createGtypeCutoffMap() |
435 |
|
end subroutine setCutoffPolicy |
436 |
|
|
437 |
|
|
438 |
|
subroutine setSimVariables() |
439 |
|
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
440 |
|
SIM_uses_EAM = SimUsesEAM() |
436 |
– |
SIM_uses_RF = SimUsesRF() |
441 |
|
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
442 |
|
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
443 |
|
SIM_uses_PBC = SimUsesPBC() |
444 |
+ |
SIM_uses_RF = SimUsesRF() |
445 |
|
|
446 |
|
haveSIMvariables = .true. |
447 |
|
|
508 |
|
end subroutine doReadyCheck |
509 |
|
|
510 |
|
|
511 |
< |
subroutine init_FF(use_RF, use_UW, use_DW, thisStat) |
511 |
> |
subroutine init_FF(use_RF, correctionMethod, dampingAlpha, thisStat) |
512 |
|
|
513 |
|
logical, intent(in) :: use_RF |
514 |
< |
logical, intent(in) :: use_UW |
515 |
< |
logical, intent(in) :: use_DW |
514 |
> |
integer, intent(in) :: correctionMethod |
515 |
> |
real(kind=dp), intent(in) :: dampingAlpha |
516 |
|
integer, intent(out) :: thisStat |
517 |
|
integer :: my_status, nMatches |
513 |
– |
integer :: corrMethod |
518 |
|
integer, pointer :: MatchList(:) => null() |
519 |
|
real(kind=dp) :: rcut, rrf, rt, dielect |
520 |
|
|
525 |
|
FF_uses_RF = use_RF |
526 |
|
|
527 |
|
!! set the electrostatic correction method |
528 |
< |
if (use_UW) then |
528 |
> |
select case(coulombicCorrection) |
529 |
> |
case(NONE) |
530 |
> |
corrMethod = 0 |
531 |
> |
case(UNDAMPED_WOLF) |
532 |
|
corrMethod = 1 |
533 |
< |
elseif (use_DW) then |
533 |
> |
case(WOLF) |
534 |
|
corrMethod = 2 |
535 |
< |
else |
536 |
< |
corrMethod = 0 |
537 |
< |
endif |
538 |
< |
|
535 |
> |
case (REACTION_FIELD) |
536 |
> |
corrMethod = 3 |
537 |
> |
case default |
538 |
> |
call handleError("init_FF", "Unknown Coulombic Correction Method") |
539 |
> |
return |
540 |
> |
end select |
541 |
> |
|
542 |
|
!! init_FF is called *after* all of the atom types have been |
543 |
|
!! defined in atype_module using the new_atype subroutine. |
544 |
|
!! |
576 |
|
call initialize_rf(dielect) |
577 |
|
endif |
578 |
|
else |
579 |
< |
if (FF_uses_RF) then |
579 |
> |
if ((corrMethod == 3) .or. FF_uses_RF) then |
580 |
|
write(default_error,*) 'Using Reaction Field with no dipoles? Huh?' |
581 |
|
thisStat = -1 |
582 |
|
haveSaneForceField = .false. |
994 |
|
|
995 |
|
if (FF_RequiresPostpairCalc() .and. SIM_requires_postpair_calc) then |
996 |
|
|
997 |
< |
if (FF_uses_RF .and. SIM_uses_RF) then |
997 |
> |
if ((FF_uses_RF .and. SIM_uses_RF) .or. (corrMethod == 3)) then |
998 |
|
|
999 |
|
#ifdef IS_MPI |
1000 |
|
call scatter(rf_Row,rf,plan_atom_row_3d) |
1078 |
|
real ( kind = dp ), intent(inout) :: rijsq |
1079 |
|
real ( kind = dp ) :: r |
1080 |
|
real ( kind = dp ), intent(inout) :: d(3) |
1071 |
– |
real ( kind = dp ) :: ebalance |
1081 |
|
integer :: me_i, me_j |
1082 |
|
|
1083 |
|
integer :: iHash |
1102 |
|
|
1103 |
|
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1104 |
|
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1105 |
< |
pot, eFrame, f, t, do_pot, corrMethod) |
1105 |
> |
pot, eFrame, f, t, do_pot, corrMethod, rcuti) |
1106 |
|
|
1107 |
< |
if (FF_uses_RF .and. SIM_uses_RF) then |
1107 |
> |
if ((FF_uses_RF .and. SIM_uses_RF) .or. (corrMethod == 3)) then |
1108 |
|
|
1109 |
|
! CHECK ME (RF needs to know about all electrostatic types) |
1110 |
|
call accumulate_rf(i, j, r, eFrame, sw) |
1167 |
|
|
1168 |
|
integer :: me_i, me_j, iHash |
1169 |
|
|
1170 |
+ |
r = sqrt(rijsq) |
1171 |
+ |
|
1172 |
|
#ifdef IS_MPI |
1173 |
|
me_i = atid_row(i) |
1174 |
|
me_j = atid_col(j) |
1387 |
|
function FF_RequiresPostpairCalc() result(doesit) |
1388 |
|
logical :: doesit |
1389 |
|
doesit = FF_uses_RF |
1390 |
+ |
if (corrMethod == 3) doesit = .true. |
1391 |
|
end function FF_RequiresPostpairCalc |
1392 |
|
|
1393 |
|
#ifdef PROFILE |