54 |
|
|
55 |
|
PRIVATE |
56 |
|
|
57 |
+ |
#define __FORTRAN90 |
58 |
+ |
#include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" |
59 |
+ |
|
60 |
|
!! these prefactors convert the multipole interactions into kcal / mol |
61 |
|
!! all were computed assuming distances are measured in angstroms |
62 |
|
!! Charge-Charge, assuming charges are measured in electrons |
71 |
|
!! This unit is also known affectionately as an esu centi-barn. |
72 |
|
real(kind=dp), parameter :: pre14 = 69.13373_dp |
73 |
|
|
74 |
+ |
!! variables to handle different summation methods for long-range electrostatics: |
75 |
+ |
integer, save :: summationMethod = NONE |
76 |
+ |
real(kind=DP), save :: defaultCutoff = 0.0_DP |
77 |
+ |
logical, save :: haveDefaultCutoff = .false. |
78 |
+ |
real(kind=DP), save :: dampingAlpha = 0.0_DP |
79 |
+ |
logical, save :: haveDampingAlpha = .false. |
80 |
+ |
real(kind=DP), save :: dielectric = 0.0_DP |
81 |
+ |
logical, save :: haveDielectric = .false. |
82 |
+ |
real(kind=DP), save :: constERFC = 0.0_DP |
83 |
+ |
real(kind=DP), save :: constEXP = 0.0_DP |
84 |
+ |
logical, save :: haveDWAconstants = .false. |
85 |
+ |
|
86 |
+ |
|
87 |
+ |
public :: setElectrostaticSummationMethod |
88 |
+ |
public :: setElectrostaticCutoffRadius |
89 |
+ |
public :: setDampedWolfAlpha |
90 |
+ |
public :: setReactionFieldDielectric |
91 |
|
public :: newElectrostaticType |
92 |
|
public :: setCharge |
93 |
|
public :: setDipoleMoment |
115 |
|
type(Electrostatic), dimension(:), allocatable :: ElectrostaticMap |
116 |
|
|
117 |
|
contains |
118 |
+ |
|
119 |
+ |
subroutine setElectrostaticSummationMethod(the_ESM) |
120 |
+ |
|
121 |
+ |
integer, intent(in) :: the_ESM |
122 |
+ |
|
123 |
+ |
if ((the_ESM .le. 0) .or. (the_ESM .gt. REACTION_FIELD)) then |
124 |
+ |
call handleError("setElectrostaticSummationMethod", "Unsupported Summation Method") |
125 |
+ |
endif |
126 |
+ |
|
127 |
+ |
end subroutine setElectrostaticSummationMethod |
128 |
+ |
|
129 |
+ |
subroutine setElectrostaticCutoffRadius(thisRcut) |
130 |
+ |
real(kind=dp), intent(in) :: thisRcut |
131 |
+ |
defaultCutoff = thisRcut |
132 |
+ |
haveDefaultCutoff = .true. |
133 |
+ |
end subroutine setElectrostaticCutoffRadius |
134 |
+ |
|
135 |
+ |
subroutine setDampedWolfAlpha(thisAlpha) |
136 |
+ |
real(kind=dp), intent(in) :: thisAlpha |
137 |
+ |
dampingAlpha = thisAlpha |
138 |
+ |
haveDampingAlpha = .true. |
139 |
+ |
end subroutine setDampedWolfAlpha |
140 |
+ |
|
141 |
+ |
subroutine setReactionFieldDielectric(thisDielectric) |
142 |
+ |
real(kind=dp), intent(in) :: thisDielectric |
143 |
+ |
dielectric = thisDielectric |
144 |
+ |
haveDielectric = .true. |
145 |
+ |
end subroutine setReactionFieldDielectric |
146 |
|
|
147 |
|
subroutine newElectrostaticType(c_ident, is_Charge, is_Dipole, & |
148 |
|
is_SplitDipole, is_Quadrupole, is_Tap, status) |
353 |
|
|
354 |
|
dm = ElectrostaticMap(atid)%dipole_moment |
355 |
|
end function getDipoleMoment |
356 |
+ |
|
357 |
+ |
subroutine checkSummationMethod() |
358 |
+ |
|
359 |
+ |
if (summationMethod .eq. DAMPED_WOLF) then |
360 |
+ |
if (.not.haveDWAconstants) then |
361 |
+ |
|
362 |
+ |
if (.not.haveDampingAlpha) then |
363 |
+ |
call handleError("checkSummationMethod", "no Damping Alpha set!") |
364 |
+ |
endif |
365 |
+ |
|
366 |
+ |
if (.not.have....) |
367 |
+ |
constEXP = |
368 |
+ |
constERFC = |
369 |
+ |
|
370 |
+ |
haveDWAconstants = .true. |
371 |
+ |
endif |
372 |
+ |
endif |
373 |
|
|
374 |
+ |
end subroutine checkSummationMethod |
375 |
+ |
|
376 |
+ |
|
377 |
+ |
|
378 |
|
subroutine doElectrostaticPair(atom1, atom2, d, rij, r2, sw, & |
379 |
|
vpair, fpair, pot, eFrame, f, t, do_pot, corrMethod, rcuti) |
380 |
|
|
421 |
|
call handleError("electrostatic", "no ElectrostaticMap was present before first call of do_electrostatic_pair!") |
422 |
|
return |
423 |
|
end if |
424 |
+ |
|
425 |
+ |
if (.not.summationMethodChecked) then |
426 |
+ |
call checkSummationMethod() |
427 |
+ |
endif |
428 |
|
|
429 |
+ |
|
430 |
|
#ifdef IS_MPI |
431 |
|
me1 = atid_Row(atom1) |
432 |
|
me2 = atid_Col(atom2) |