Octopus
poisson_cutoff.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
22 use global_oct_m
23 use, intrinsic :: iso_fortran_env
25
26 implicit none
27
28 private
29 public :: &
38
39
41 real(real64) function c_poisson_cutoff_3d_1d_finite(gx, gperp, xsize, rsize)
42 use, intrinsic :: iso_fortran_env
43 implicit none
44 real(real64), intent(in) :: gx, gperp, rsize, xsize
45 end function c_poisson_cutoff_3d_1d_finite
46 end interface poisson_cutoff_3d_1d_finite
47
48 interface poisson_cutoff_2d_0d
49 real(real64) function c_poisson_cutoff_2d_0d(x, y)
50 use, intrinsic :: iso_fortran_env
51 implicit none
52 real(real64), intent(in) :: x, y
53 end function c_poisson_cutoff_2d_0d
54 end interface poisson_cutoff_2d_0d
55
56 interface poisson_cutoff_2d_1d
57 real(real64) function c_poisson_cutoff_2d_1d(gy, gx, r_c)
58 use, intrinsic :: iso_fortran_env
59 implicit none
60 real(real64), intent(in) :: gy, gx, r_c
61 end function c_poisson_cutoff_2d_1d
62 end interface poisson_cutoff_2d_1d
63
64 interface poisson_cutoff_1d_0d
65 real(real64) function c_poisson_cutoff_1d_0d(g, a, r_c)
66 use, intrinsic :: iso_fortran_env
67 implicit none
68 real(real64), intent(in) :: g, a, r_c
69 end function c_poisson_cutoff_1d_0d
70 end interface poisson_cutoff_1d_0d
71
73 real(real64) function intcoslog(mu, gy, gx)
74 use, intrinsic :: iso_fortran_env
75 implicit none
76 real(real64), intent(in) :: mu, gy, gx
77 end function intcoslog
78 end interface poisson_cutoff_intcoslog
79
80
81contains
82
83
84 ! ---------------------------------------------------------
85 real(real64) function poisson_cutoff_3D_0D(x, r) result(cutoff)
86 real(real64), intent(in) :: x, r
87
88 !no PUSH_SUB, called too often
89
90 cutoff = m_one - cos(x*r)
91
92 end function poisson_cutoff_3d_0d
93 ! ---------------------------------------------------------
94
95
96 ! ---------------------------------------------------------
97 real(real64) function poisson_cutoff_3D_1D(x, p, rmax) result(cutoff)
98 real(real64), intent(in) :: x, p, rmax
99
100 integer :: j
101 real(real64) :: dr, r, sum
102
103 integer, parameter :: nr = 1000_real64
104
105 !no PUSH_SUB, called too often
106
107 if (abs(x) < m_epsilon) then
108 ! Simpson rule for the G_x = 0 contribution -log(r)
109 dr = rmax/real(nr, real64)
110 sum = m_zero
111 do j = 1, nr - 1, 2
112 r = j*dr
113 sum = sum - m_four*r*loct_bessel_j0(p*r)*log(r)
114 r = (j+1)*dr
115 sum = sum - m_two*r*loct_bessel_j0(p*r)*log(r)
116 end do
117 sum = sum - rmax*loct_bessel_j0(p*rmax)*log(rmax)
118 cutoff = (p**2)*m_third*sum*dr
119 else
120 cutoff = m_one + p*rmax*loct_bessel_j1(p*rmax)*loct_bessel_k0(x*rmax) &
121 - x*rmax*loct_bessel_j0(p*rmax)*loct_bessel_k1(x*rmax)
122 end if
123
124 end function poisson_cutoff_3d_1d
125
126 ! ---------------------------------------------------------
127 real(real64) function poisson_cutoff_3D_2D(p, z, r) result(cutoff)
128 real(real64), intent(in) :: p, z, r
129
130 !no PUSH_SUB, called too often
131
132 if (abs(p) < m_epsilon) then
133 cutoff = m_one - cos(z*r) - z*r*sin(z*r)
134 else
135 cutoff = m_one + exp(-p*r)*(z*sin(z*r)/p-cos(z*r))
136 end if
137
138 end function poisson_cutoff_3d_2d
139 ! ---------------------------------------------------------
140
143!! Local Variables:
144!! mode: f90
145!! coding: utf-8
146!! End:
double log(double __x) __attribute__((__nothrow__
double exp(double __x) __attribute__((__nothrow__
double sin(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
real(real64) function, public poisson_cutoff_3d_2d(p, z, r)
real(real64) function, public poisson_cutoff_3d_1d(x, p, rmax)
real(real64) function, public poisson_cutoff_3d_0d(x, r)