.. _utils: .. program:: utils .. default-role:: option ===== utils ===== Contains general purpose utilities (sorting, maps, etc). Providers --------- .. c:var:: binom .. code:: text double precision, allocatable :: binom (0:40,0:40) double precision, allocatable :: binom_transp (0:40,0:40) File: :file:`util.irp.f` Binomial coefficients .. c:var:: binom_int .. code:: text integer*8, allocatable :: binom_int (0:40,0:40) integer*8, allocatable :: binom_int_transp (0:40,0:40) File: :file:`util.irp.f` Binomial coefficients, as integers*8 .. c:var:: binom_int_transp .. code:: text integer*8, allocatable :: binom_int (0:40,0:40) integer*8, allocatable :: binom_int_transp (0:40,0:40) File: :file:`util.irp.f` Binomial coefficients, as integers*8 .. c:var:: binom_transp .. code:: text double precision, allocatable :: binom (0:40,0:40) double precision, allocatable :: binom_transp (0:40,0:40) File: :file:`util.irp.f` Binomial coefficients .. c:var:: degree_max_integration_lebedev .. code:: text integer :: degree_max_integration_lebedev File: :file:`angular_integration.irp.f` integrate correctly a polynom of order "degree_max_integration_lebedev" needed for the angular integration according to LEBEDEV formulae .. c:var:: dtranspose .. code:: text recursive subroutine dtranspose(A,LDA,B,LDB,d1,d2) File: :file:`transpose.irp.f` Transpose input matrix A into output matrix B .. c:var:: fact_inv .. code:: text double precision, allocatable :: fact_inv (128) File: :file:`util.irp.f` 1/n! .. c:var:: i2radix_sort .. code:: text recursive subroutine i2radix_sort(x,iorder,isize,iradix) File: :file:`sort.irp.f_template_644` Sort integer array x(isize) using the radix sort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. iradix should be -1 in input. .. c:var:: i8radix_sort .. code:: text recursive subroutine i8radix_sort(x,iorder,isize,iradix) File: :file:`sort.irp.f_template_644` Sort integer array x(isize) using the radix sort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. iradix should be -1 in input. .. c:var:: i8radix_sort_big .. code:: text recursive subroutine i8radix_sort_big(x,iorder,isize,iradix) File: :file:`sort.irp.f_template_644` Sort integer array x(isize) using the radix sort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. iradix should be -1 in input. .. c:var:: inv_int .. code:: text double precision, allocatable :: inv_int (128) File: :file:`util.irp.f` 1/i .. c:var:: iradix_sort .. code:: text recursive subroutine iradix_sort(x,iorder,isize,iradix) File: :file:`sort.irp.f_template_644` Sort integer array x(isize) using the radix sort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. iradix should be -1 in input. .. c:var:: iradix_sort_big .. code:: text recursive subroutine iradix_sort_big(x,iorder,isize,iradix) File: :file:`sort.irp.f_template_644` Sort integer array x(isize) using the radix sort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. iradix should be -1 in input. .. c:var:: n_points_integration_angular_lebedev .. code:: text integer :: n_points_integration_angular_lebedev File: :file:`angular_integration.irp.f` Number of points needed for the angular integral .. c:var:: nproc .. code:: text integer :: nproc File: :file:`util.irp.f` Number of current OpenMP threads .. c:var:: overlap_gaussian_xyz .. code:: text subroutine overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,& power_B,overlap_x,overlap_y,overlap_z,overlap,dim) File: :file:`one_e_integration.irp.f` .. math:: S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ S = S_x S_y S_z .. c:var:: phi_angular_integration_lebedev .. code:: text double precision, allocatable :: theta_angular_integration_lebedev (n_points_integration_angular_lebedev) double precision, allocatable :: phi_angular_integration_lebedev (n_points_integration_angular_lebedev) double precision, allocatable :: weights_angular_integration_lebedev (n_points_integration_angular_lebedev) File: :file:`angular_integration.irp.f` Theta phi values together with the weights values for the angular integration : integral [dphi,dtheta] f(x,y,z) = 4 * pi * sum (1 where i is the basis function and psi_j is the j th eigenvector .. c:function:: lapack_diagd .. code:: text subroutine lapack_diagd(eigvalues,eigvectors,H,nmax,n) File: :file:`linear_algebra.irp.f` Diagonalize matrix H H is untouched between input and ouptut eigevalues(i) = ith lowest eigenvalue of the H matrix eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector .. c:function:: logfact .. code:: text double precision function logfact(n) File: :file:`util.irp.f` n! .. c:function:: lowercase .. code:: text subroutine lowercase(txt,n) File: :file:`util.irp.f` Transform to lower case .. c:function:: map_load_from_disk .. code:: text subroutine map_load_from_disk(filename,map) File: :file:`map_functions.irp.f` .. c:function:: map_save_to_disk .. code:: text subroutine map_save_to_disk(filename,map) File: :file:`map_functions.irp.f` .. c:function:: memory_of_double .. code:: text double precision function memory_of_double(n) File: :file:`memory.irp.f` Computes the memory required for n double precision elements in gigabytes. .. c:function:: memory_of_int .. code:: text double precision function memory_of_int(n) File: :file:`memory.irp.f` Computes the memory required for n double precision elements in gigabytes. .. c:function:: multiply_poly .. code:: text subroutine multiply_poly(b,nb,c,nc,d,nd) File: :file:`integration.irp.f` Multiply two polynomials D(t) =! D(t) +( B(t)*C(t)) .. c:function:: normalize .. code:: text subroutine normalize(u,sze) File: :file:`util.irp.f` Normalizes vector u .. c:function:: ortho_canonical .. code:: text subroutine ortho_canonical(overlap,LDA,N,C,LDC,m) File: :file:`linear_algebra.irp.f` Compute C_new=C_old.U.s^-1/2 canonical orthogonalization. overlap : overlap matrix LDA : leftmost dimension of overlap array N : Overlap matrix is NxN (array is (LDA,N) ) C : Coefficients of the vectors to orthogonalize. On exit, orthogonal vectors LDC : leftmost dimension of C m : Coefficients matrix is MxN, ( array is (LDC,N) ) .. c:function:: ortho_lowdin .. code:: text subroutine ortho_lowdin(overlap,LDA,N,C,LDC,m) File: :file:`linear_algebra.irp.f` Compute C_new=C_old.S^-1/2 orthogonalization. overlap : overlap matrix LDA : leftmost dimension of overlap array N : Overlap matrix is NxN (array is (LDA,N) ) C : Coefficients of the vectors to orthogonalize. On exit, orthogonal vectors LDC : leftmost dimension of C M : Coefficients matrix is MxN, ( array is (LDC,N) ) .. c:function:: ortho_qr .. code:: text subroutine ortho_qr(A,LDA,m,n) File: :file:`linear_algebra.irp.f` Orthogonalization using Q.R factorization A : matrix to orthogonalize LDA : leftmost dimension of A n : Number of rows of A m : Number of columns of A .. c:function:: ortho_qr_unblocked .. code:: text subroutine ortho_qr_unblocked(A,LDA,m,n) File: :file:`linear_algebra.irp.f` Orthogonalization using Q.R factorization A : matrix to orthogonalize LDA : leftmost dimension of A n : Number of rows of A m : Number of columns of A .. c:function:: overlap_gaussian_x .. code:: text double precision function overlap_gaussian_x(A_center,B_center,alpha,beta,power_A,power_B,dim) File: :file:`one_e_integration.irp.f` .. math:: \sum_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha(x-A_x)^2) exp(-beta(x-B_X)^2) dx .. c:function:: overlap_x_abs .. code:: text subroutine overlap_x_abs(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,lower_exp_val,dx,nx) File: :file:`one_e_integration.irp.f` .. math :: \int_{-infty}^{+infty} (x-A_center)^(power_A) * (x-B_center)^power_B * exp(-alpha(x-A_center)^2) * exp(-beta(x-B_center)^2) dx .. c:function:: print_memory_usage .. code:: text subroutine print_memory_usage() File: :file:`memory.irp.f` Prints the memory usage in the output .. c:function:: quick_dsort .. code:: text subroutine quick_dsort(x, iorder, isize) File: :file:`sort.irp.f_template_261` Sort array x(isize) using the quicksort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. .. c:function:: quick_i2sort .. code:: text subroutine quick_i2sort(x, iorder, isize) File: :file:`sort.irp.f_template_261` Sort array x(isize) using the quicksort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. .. c:function:: quick_i8sort .. code:: text subroutine quick_i8sort(x, iorder, isize) File: :file:`sort.irp.f_template_261` Sort array x(isize) using the quicksort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. .. c:function:: quick_isort .. code:: text subroutine quick_isort(x, iorder, isize) File: :file:`sort.irp.f_template_261` Sort array x(isize) using the quicksort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. .. c:function:: quick_sort .. code:: text subroutine quick_sort(x, iorder, isize) File: :file:`sort.irp.f_template_261` Sort array x(isize) using the quicksort algorithm. iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. .. c:function:: recentered_poly2 .. code:: text subroutine recentered_poly2(P_new,x_A,x_P,a,P_new2,x_B,x_Q,b) File: :file:`integration.irp.f` Recenter two polynomials .. c:function:: resident_memory .. code:: text subroutine resident_memory(value) File: :file:`memory.irp.f` Returns the current used memory in gigabytes used by the current process. .. c:function:: rint .. code:: text double precision function rint(n,rho) File: :file:`integration.irp.f` .. math:: \int_0^1 dx \exp(-p x^2) x^n .. c:function:: rint1 .. code:: text double precision function rint1(n,rho) File: :file:`integration.irp.f` Standard version of rint .. c:function:: rint_large_n .. code:: text double precision function rint_large_n(n,rho) File: :file:`integration.irp.f` Version of rint for large values of n .. c:function:: rint_sum .. code:: text double precision function rint_sum(n_pt_out,rho,d1) File: :file:`integration.irp.f` Needed for the calculation of two-electron integrals. .. c:function:: rinteg .. code:: text double precision function rinteg(n,u) File: :file:`need.irp.f` .. c:function:: rintgauss .. code:: text double precision function rintgauss(n) File: :file:`need.irp.f` .. c:function:: sabpartial .. code:: text double precision function SABpartial(zA,zB,A,B,nA,nB,gamA,gamB,l) File: :file:`need.irp.f` .. c:function:: set_order .. code:: text subroutine set_order(x,iorder,isize) File: :file:`sort.irp.f_template_347` array A has already been sorted, and iorder has contains the new order of elements of A. This subroutine changes the order of x to match the new order of A. .. c:function:: set_order_big .. code:: text subroutine set_order_big(x,iorder,isize) File: :file:`sort.irp.f_template_412` array A has already been sorted, and iorder has contains the new order of elements of A. This subroutine changes the order of x to match the new order of A. This is a version for very large arrays where the indices need to be in integer*8 format .. c:function:: sort .. code:: text subroutine sort(x,iorder,isize) File: :file:`sort.irp.f_template_293` Sort array x(isize). iorder in input should be (1,2,3,...,isize), and in output contains the new order of the elements. .. c:function:: sorted_dnumber .. code:: text subroutine sorted_dnumber(x,isize,n) File: :file:`sort.irp.f_template_261` Returns the number of sorted elements .. c:function:: sorted_i2number .. code:: text subroutine sorted_i2number(x,isize,n) File: :file:`sort.irp.f_template_261` Returns the number of sorted elements .. c:function:: sorted_i8number .. code:: text subroutine sorted_i8number(x,isize,n) File: :file:`sort.irp.f_template_261` Returns the number of sorted elements .. c:function:: sorted_inumber .. code:: text subroutine sorted_inumber(x,isize,n) File: :file:`sort.irp.f_template_261` Returns the number of sorted elements .. c:function:: sorted_number .. code:: text subroutine sorted_number(x,isize,n) File: :file:`sort.irp.f_template_261` Returns the number of sorted elements .. c:function:: svd .. code:: text subroutine svd(A,LDA,U,LDU,D,Vt,LDVt,m,n) File: :file:`linear_algebra.irp.f` Compute A = U.D.Vt LDx : leftmost dimension of x Dimsneion of A is m x n .. c:function:: total_memory .. code:: text subroutine total_memory(value) File: :file:`memory.irp.f` Returns the current used memory in gigabytes used by the current process. .. c:function:: u_dot_u .. code:: text double precision function u_dot_u(u,sze) File: :file:`util.irp.f` Compute .. c:function:: u_dot_v .. code:: text double precision function u_dot_v(u,v,sze) File: :file:`util.irp.f` Compute .. c:function:: wall_time .. code:: text subroutine wall_time(t) File: :file:`util.irp.f` The equivalent of cpu_time, but for the wall time. .. c:function:: write_git_log .. code:: text subroutine write_git_log(iunit) File: :file:`util.irp.f` Write the last git commit in file iunit.