2020-03-25 10:39:45 +01:00
|
|
|
subroutine build_grid(nNuc,ZNuc,rNuc,nShell,TotAngMomShell,ExpShell,max_ang_mom,min_exponent,max_exponent, &
|
2020-03-25 11:25:48 +01:00
|
|
|
radial_precision,nRad,nAng,nGrid,weight,root)
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
! Compute quadrature grid with numgrid (Radovan Bast)
|
|
|
|
|
|
|
|
use numgrid
|
|
|
|
use, intrinsic :: iso_c_binding, only: c_ptr
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
include 'parameters.h'
|
|
|
|
|
|
|
|
! Input variables
|
|
|
|
|
|
|
|
integer,intent(in) :: nNuc
|
|
|
|
double precision,intent(in) :: ZNuc(nNuc)
|
|
|
|
double precision,intent(in) :: rNuc(nNuc,ncart)
|
|
|
|
|
|
|
|
integer,intent(in) :: nShell
|
|
|
|
integer,intent(in) :: TotAngMomShell(maxShell)
|
|
|
|
double precision,intent(in) :: ExpShell(maxShell,maxK)
|
|
|
|
|
|
|
|
integer,intent(in) :: max_ang_mom(nNuc)
|
|
|
|
double precision,intent(in) :: min_exponent(nNuc,maxL+1)
|
|
|
|
double precision,intent(in) :: max_exponent(nNuc)
|
|
|
|
|
2020-03-25 11:25:48 +01:00
|
|
|
double precision,intent(in) :: radial_precision
|
|
|
|
integer,intent(in) :: nAng
|
2020-03-25 10:39:45 +01:00
|
|
|
integer,intent(in) :: nGrid
|
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
2020-03-25 13:03:31 +01:00
|
|
|
logical :: dump_grid = .false.
|
2020-03-25 10:39:45 +01:00
|
|
|
integer :: iNuc
|
|
|
|
integer :: iG
|
|
|
|
|
|
|
|
integer :: min_num_angular_points
|
|
|
|
integer :: max_num_angular_points
|
|
|
|
integer :: num_points
|
2020-03-25 13:31:15 +01:00
|
|
|
integer :: num_radial_points
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
integer :: center_index
|
|
|
|
type(c_ptr) :: context
|
|
|
|
|
|
|
|
! Output variables
|
|
|
|
|
2020-03-25 13:31:15 +01:00
|
|
|
integer,intent(out) :: nRad
|
2020-03-25 10:39:45 +01:00
|
|
|
double precision,intent(out) :: root(ncart,nGrid)
|
|
|
|
double precision,intent(out) :: weight(nGrid)
|
|
|
|
|
|
|
|
! Set useful variables
|
|
|
|
|
2020-03-25 11:25:48 +01:00
|
|
|
min_num_angular_points = nAng
|
|
|
|
max_num_angular_points = nAng
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
!------------------------------------------------------------------------
|
|
|
|
! Main loop over atoms
|
|
|
|
!------------------------------------------------------------------------
|
|
|
|
|
|
|
|
iG = 0
|
2020-03-25 13:31:15 +01:00
|
|
|
nRad = 0
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
do iNuc=1,nNuc
|
|
|
|
|
2020-03-25 12:56:28 +01:00
|
|
|
context = numgrid_new_atom_grid(radial_precision,min_num_angular_points,max_num_angular_points, &
|
|
|
|
int(ZNuc(iNuc)),max_exponent(iNuc),max_ang_mom(iNuc), &
|
|
|
|
min_exponent(iNuc,1:max_ang_mom(iNuc)+1))
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
center_index = iNuc - 1
|
|
|
|
num_points = numgrid_get_num_grid_points(context)
|
2020-03-25 13:31:15 +01:00
|
|
|
num_radial_points = numgrid_get_num_radial_grid_points(context)
|
|
|
|
|
2020-03-25 10:39:45 +01:00
|
|
|
|
2020-03-25 12:56:28 +01:00
|
|
|
call numgrid_get_grid(context,nNuc,center_index,rNuc(:,1),rNuc(:,2),rNuc(:,3),int(ZNuc(:)), &
|
2020-03-25 13:03:31 +01:00
|
|
|
root(1,iG+1:iG+num_points),root(2,iG+1:iG+num_points),root(3,iG+1:iG+num_points), &
|
|
|
|
weight(iG+1:iG+num_points))
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
iG = iG + num_points
|
2020-03-25 13:31:15 +01:00
|
|
|
nRad = nRad + num_radial_points
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
call numgrid_free_atom_grid(context)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
!------------------------------------------------------------------------
|
|
|
|
! End main loop over atoms
|
|
|
|
!------------------------------------------------------------------------
|
|
|
|
|
|
|
|
! Print grid
|
|
|
|
|
2020-03-25 13:31:15 +01:00
|
|
|
write(*,*)
|
|
|
|
write(*,'(A30,E10.1)') 'Radial precision = ',radial_precision
|
|
|
|
write(*,'(A30,I10)') 'Number of radial points = ',nRad
|
|
|
|
write(*,'(A30,I10)') 'Number of angular points = ',nAng
|
|
|
|
write(*,'(A30,I10)') 'Total number of points = ',nGrid
|
|
|
|
write(*,*)
|
|
|
|
|
2020-03-25 13:03:31 +01:00
|
|
|
if(dump_grid) then
|
|
|
|
|
|
|
|
write(*,*) ' ***********************'
|
|
|
|
write(*,*) ' *** QUADRATURE GRID ***'
|
|
|
|
write(*,*) ' ***********************'
|
2020-03-25 13:31:15 +01:00
|
|
|
|
2020-03-25 13:03:31 +01:00
|
|
|
write(*,'(A10,3X,3A15)') 'Grid point','X','Y','Z'
|
|
|
|
do iG=1,nGrid
|
|
|
|
write(*,'(I10,3X,4F15.10)') iG,weight(iG),root(:,iG)
|
|
|
|
end do
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
end if
|
2020-03-25 10:39:45 +01:00
|
|
|
|
|
|
|
end subroutine build_grid
|