TABLE OF CONTENTS


ABINIT/check/test_radsintr [ Programs ]

[ Top ] [ Programs ]

NAME

  test_radsintr

FUNCTION

  Tests the routine src/32_util/radsintr.F90 that performs
  radial Fourier transform.

COPYRIGHT

  Copyright (C) 2011-2021 ABINIT group (CE)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  (main routine)

OUTPUT

  (main routine)

NOTES

  All required data are generated internally. This program
  performs radial FT of a gaussian function and then transforms
  it back to real space to check possible differences.

PARENTS

CHILDREN

      radsintr

SOURCE

 33 #if defined HAVE_CONFIG_H
 34 #include "config.h"
 35 #endif
 36 
 37 #include "abi_common.h"
 38 
 39 program test_radsintr
 40 
 41  use defs_basis
 42  use m_abicore
 43  use m_errors
 44 
 45  use m_integrals,     only : radsintr
 46 
 47  implicit none
 48 
 49 !Arguments ------------------------------------
 50 
 51 !Local variables-------------------------------
 52 !scalars
 53  integer :: ii,qmesh_size,rmesh_size
 54  real(dp) :: qstep,rstep,yq1,yqn,yr1,yrn
 55 !character(len=500) :: message ! to be uncommented, if needed
 56 !arrays
 57  real(dp), allocatable :: funr(:),funr2(:),funq(:),qmesh(:),rmesh(:)
 58 
 59 ! *************************************************************************
 60 
 61 !Parameters for the generation of the grids
 62  rmesh_size = 150
 63  rstep = 0.02d0
 64  qmesh_size = 50
 65  qstep = 0.04
 66 
 67 !Initialization of meshes
 68  ABI_MALLOC(rmesh,(rmesh_size))
 69  ABI_MALLOC(qmesh,(qmesh_size))
 70  do ii=1,rmesh_size
 71    rmesh(ii) =rstep*dble(ii-1)
 72  end do
 73  do ii=1,qmesh_size
 74    qmesh(ii) =qstep*dble(ii-1)
 75  end do
 76 
 77  ABI_MALLOC(funr,(rmesh_size))
 78  ABI_MALLOC(funq,(qmesh_size))
 79  ABI_MALLOC(funr2,(rmesh_size))
 80 
 81  do ii=1,rmesh_size
 82    funr(ii)=exp(-((rmesh(ii)-one)**two)/0.1d0)
 83  end do
 84 
 85  call radsintr(funr,funq,qmesh_size,rmesh_size,qmesh,rmesh,yq1,yqn)
 86 
 87  write(std_out,*) ch10, 'r  F(r):',ch10
 88  do ii=1,rmesh_size
 89    write(std_out,*) rmesh(ii), funr(ii)
 90  end do
 91 
 92  write(std_out,*) ch10, 'q  F(q):',ch10
 93  do ii=1,qmesh_size
 94    write(std_out,*) qmesh(ii), funq(ii)
 95  end do
 96 
 97  call radsintr(funq,funr2,rmesh_size,qmesh_size,rmesh,qmesh,yr1,yrn)
 98 
 99  write(std_out,*) ch10, 'r  F2(r):',ch10
100  do ii=1,rmesh_size
101    write(std_out,*) rmesh(ii), funr2(ii)
102  end do
103 
104  ABI_FREE(funq)
105  ABI_FREE(funr)
106  ABI_FREE(funr2)
107  ABI_FREE(rmesh)
108  ABI_FREE(qmesh)
109 
110  end program test_radsintr