mimic_tensors Module

This module provides procedures for computing interactions tensors in packed form (one-dimensional arrays) and includes several operations involving tensors.



Contents


Variables

TypeVisibilityAttributesNameInitial
integer, private, parameter:: MAX_ORDER =42

maximum order of derivative

real(kind=dp), private, dimension(0:MAX_ORDER,0:MAX_ORDER,1:2*MAX_ORDER+1), save:: tensor_coefficient =huge(0.0_dp)

needed for open-ended computation of derivatives of

real(kind=dp), public, dimension(0:MAX_ORDER), save:: factorial =huge(0.0_dp)

factorials computed and stored during initialization

real(kind=dp), public, dimension(-1:MAX_ORDER), save:: double_factorial =huge(0.0_dp)

double factorials computed and stored during initialization

real(kind=dp), public, dimension(0:3*MAX_ORDER,0:MAX_ORDER), save:: binomial =huge(0.0_dp)

binomial coefficients computed and stores during initialization

real(kind=dp), public, dimension(0:MAX_ORDER,0:MAX_ORDER,0:MAX_ORDER), save:: trinomial =huge(0.0_dp)

trinomial coefficients computed and stores during initialization


Functions

public pure function tensor_element(i, j, k, r)

compute element of multipole interaction tensor (C. E. Dykstra, J. Comput. Chem., 9 (1988), 476) which in multi-index notation this is

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: i

order of the derivative wrt -component of

integer, intent(in) :: j

order of the derivative wrt -component of

integer, intent(in) :: k

order of the derivative wrt -component of

real(kind=dp), intent(in), dimension(:):: r

coordinate vector -

Return Value real(kind=dp)

public pure function tensor_trace(A, ax, ay, az, order)

compute trace of a packed tensor

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in), dimension(:):: A
integer, intent(in) :: ax
integer, intent(in) :: ay
integer, intent(in) :: az
integer, intent(in), optional :: order

Return Value real(kind=dp)

public pure function convert_index(ax, ay, az)

convert from multi-index to packed tensor index

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: ax

first () component of multi-index

integer, intent(in) :: ay

second () component of multi-index

integer, intent(in) :: az

third () component of multi-index

Return Value integer

public pure function tensor_rank(A)

compute rank of tensor

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in), dimension(:):: A

Return Value integer

public pure function tensor_size(rank)

compute size of tensor of given rank

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: rank

Return Value integer

public pure function polytensor_size(max_rank)

compute size of first degree polytensor with tensors up to maxmimum rank

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: max_rank

Return Value integer


Subroutines

public subroutine initialize_tensors()

initialize tensor module

Arguments

None

public subroutine terminate_tensors()

Arguments

None

private subroutine compute_tensor_coefficients()

compute tensor coefficients needed to compute open-ended derivatives of (from C. E. Dykstra, J. Comput. Chem., 9 (1988), 476, where C^(n)_ij are stored as tensor_coefficient(j,i,n))

Arguments

None

private subroutine compute_factorials()

compute and store factorials upto 12!

Arguments

None

private subroutine compute_double_factorials()

compute and store double factorials upto 12!!

Arguments

None

private subroutine compute_binomial_coefficients()

Calculate binomial coefficients using recursive algorithm by Sten Rettrup and Ruben Pauncz, Int. J. Quantum Chem., 60: 91–98 (1996) DOI: 10.1002/(SICI)1097-461X(1996)60:1<91::AID-QUA10>3.0.CO;2-A

Arguments

None

private subroutine compute_trinomial_coefficients()

compute trinomial coefficients ()

Arguments

None

public pure subroutine contract_tensors(A, B, C)

contract tensors A and B according to rank of C and return result in C

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in), dimension(:):: A
real(kind=dp), intent(in), dimension(:):: B
real(kind=dp), intent(inout), dimension(:):: C

public pure subroutine interaction_tensor(r_ab, T, da, db)

Compute multipole interaction tensor containing derivatives of , i.e. the da'th derivative wrt and db'th derivative wrt . Tensor is returned in a one-dimensional array with elements in anticanonical ordering, e.g. xx, xy, xz, yy, yz, zz.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in), dimension(:):: r_ab

coordinate

real(kind=dp), intent(out), dimension(:):: T

the interaction tensor

integer, intent(in) :: da

order of derivative wrt

integer, intent(in) :: db

order of derivative wrt

public pure subroutine folded_interaction_tensor(r_ab, T, da, db)

Compute folded multipole interaction tensor containing derivatives of , i.e. the da'th derivative wrt and db'th derivative wrt . Tensor is returned in a one-dimensional array with elements in anticanonical ordering, e.g. xx, xy, xz, yy, yz, zz.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in), dimension(:):: r_ab

coordinate

real(kind=dp), intent(out), dimension(:):: T

the interaction tensor

integer, intent(in) :: da

order of derivative wrt

integer, intent(in) :: db

order of derivative wrt

public pure subroutine detrace_tensor(A)

convert tensor to traceless tensor

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(inout), dimension(:):: A