10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 06:33:49 +01:00
QuantumPackage/src/utils/prim_in_r.irp.f

43 lines
1.2 KiB
Fortran
Raw Normal View History

2020-04-24 16:12:25 +02:00
double precision function primitive_value_explicit(power_prim,center_prim,alpha,r)
implicit none
BEGIN_DOC
2020-04-24 16:14:59 +02:00
! Evaluates at "r" a primitive of type :
! (x - center_prim(1))**power_prim(1) (y - center_prim(2))**power_prim(2) * (z - center_prim(3))**power_prim(3)
!
! exp(-alpha * [(x - center_prim(1))**2 + (y - center_prim(2))**2 + (z - center_prim(3))**2] )
2020-04-24 16:12:25 +02:00
END_DOC
integer, intent(in) :: power_prim(3)
double precision, intent(in) :: center_prim(3),alpha
double precision, intent(in) :: r(3)
double precision :: dx,dy,dz,r2
dx = (r(1) - center_prim(1))
dy = (r(2) - center_prim(2))
dz = (r(3) - center_prim(3))
r2 = dx*dx + dy*dy + dz*dz
dx = dx**power_prim(1)
dy = dy**power_prim(2)
dz = dz**power_prim(3)
primitive_value_explicit = dexp(-alpha*r2) * dx * dy * dz
end
double precision function give_pol_in_r(r,pol,center, alpha,iorder, max_dim)
2020-05-20 11:45:41 +02:00
implicit none
2020-04-24 16:12:25 +02:00
integer, intent(in) :: iorder(3), max_dim
2020-05-20 11:45:41 +02:00
double precision :: r(3), center(3), alpha,pol(0:max_dim,3)
2020-04-24 16:12:25 +02:00
integer :: i,m
double precision :: gauss(3), x
gauss = 0.d0
do m = 1, 3
x = r(m) - center(m)
do i = 0, iorder(m)
2020-05-20 11:45:41 +02:00
gauss(m) += pol(i,m) * dexp(-alpha *x*x ) * x**i
2020-04-24 16:12:25 +02:00
enddo
enddo
give_pol_in_r = gauss(1) * gauss(2) * gauss(3)
end