Smooth polynomial switch for realspace cutoffs
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | r | |||
| real(kind=wp), | intent(in) | :: | cutoff | |||
| real(kind=wp), | intent(in) | :: | width | |||
| real(kind=wp), | intent(out) | :: | sw | |||
| real(kind=wp), | intent(out) | :: | dswdr |
pure subroutine smooth_cutoff(r, cutoff, width, sw, dswdr) real(wp), intent(in) :: r real(wp), intent(in) :: cutoff real(wp), intent(in) :: width real(wp), intent(out) :: sw real(wp), intent(out) :: dswdr real(wp) :: inner, x if (width <= 0.0_wp .or. width >= cutoff) then sw = 1.0_wp dswdr = 0.0_wp else inner = cutoff - width if (r <= inner) then sw = 1.0_wp dswdr = 0.0_wp else if (r >= cutoff) then sw = 0.0_wp dswdr = 0.0_wp else x = (cutoff - r) / width sw = x**3 * (10.0_wp + x*(-15.0_wp + 6.0_wp*x)) dswdr = -30.0_wp * x**2 * (1.0_wp - x)**2 / width end if end if end subroutine smooth_cutoff