## Documentation for module ai_contraction

Set of routines to: Contract integrals over primitive Gaussians Decontract (density) matrices Trace matrices to get forces Block copy and add matrices

source: ai_contraction.F

#### Generic procedures:

contraction
decontraction
force_trace

Copy a block out of a matrix and add it to another matrix SAB = SAB + QAB or QAB = QAB + SAB QAB(ia:,ib:) and SAB(1:,1:)

CHARACTER(*),
INTENT(in)
:: dir ×
REAL(dp),
INTENT(inout)
:: sab(:,:) ×
INTEGER,
INTENT(in)
:: na ×
INTEGER,
INTENT(in)
:: nb ×
REAL(dp),
INTENT(inout)
:: qab(:,:) ×
INTEGER,
INTENT(in)
:: ia ×
INTEGER,
INTENT(in)
:: ib ×
LOGICAL,
INTENT(in),
OPTIONAL
:: trans ×

...

REAL(dp),
INTENT(in)
:: sab(:,:) ×
REAL(dp),
INTENT(inout)
:: qab(:,:) ×
REAL(dp),
INTENT(in),
OPTIONAL
:: ca(:,:) × ×
INTEGER,
INTENT(in),
OPTIONAL
:: na × ×
INTEGER,
INTENT(in),
OPTIONAL
:: ma × ×
REAL(dp),
INTENT(in),
OPTIONAL
:: cb(:,:) × ×
INTEGER,
INTENT(in),
OPTIONAL
:: nb × ×
INTEGER,
INTENT(in),
OPTIONAL
:: mb × ×
REAL(dp),
INTENT(in),
OPTIONAL
:: fscale ×
LOGICAL,
INTENT(in),
OPTIONAL
:: trans ×
REAL(dp),
INTENT(in)
:: sabc(:,:,:) ×
REAL(dp),
INTENT(inout)
:: qabc(:,:,:) ×
REAL(dp),
INTENT(in),
OPTIONAL
:: cc(:,:) ×
INTEGER,
INTENT(in),
OPTIONAL
:: nc ×
INTEGER,
INTENT(in),
OPTIONAL
:: mc ×

#### Generic procedure decontraction^

Applying the de-contraction coefficents to a matrix QAB <- CA * SAB * CB(T) Variable "trans" requests the input matrix to be SAB(T) Active dimensions are: QAB(na,nb), SAB(ma,mb)

REAL(dp),
INTENT(in)
:: sab(:,:) ×
REAL(dp),
INTENT(inout)
:: qab(:,:) ×
REAL(dp),
INTENT(in)
:: ca(:,:) ×
INTEGER,
INTENT(in)
:: na ×
INTEGER,
INTENT(in)
:: ma ×
REAL(dp),
INTENT(in)
:: cb(:,:) ×
INTEGER,
INTENT(in)
:: nb ×
INTEGER,
INTENT(in)
:: mb ×
LOGICAL,
INTENT(in),
OPTIONAL
:: trans ×

#### Generic procedure force_trace^

Routine to trace a series of matrices with another matrix Calculate forces of type f(:) = Trace(Pab*Sab(:))

REAL(dp),
INTENT(inout)
:: force(:) ×
REAL(dp),
INTENT(in)
:: sab(:,:,:) ×
REAL(dp),
INTENT(in)
:: pab(:,:) ×
INTEGER,
INTENT(in)
:: na ×
INTEGER,
INTENT(in)
:: nb ×
INTEGER,
INTENT(in)
:: m ×
LOGICAL,
INTENT(in),
OPTIONAL
:: trans ×

#### SUBROUTINEblock_add_ab(dir, sab, na, nb, qab, ia, ib, trans)^

Copy a block out of a matrix and add it to another matrix SAB = SAB + QAB or QAB = QAB + SAB QAB(ia:,ib:) and SAB(1:,1:)

##### Arguments:
 CHARACTER(*), INTENT(in) :: dir "IN" and "OUT" defines direction of copy REAL(dp), INTENT(inout) :: sab(:,:) Matrix input for "IN", output for "OUT" INTEGER, INTENT(in) :: na first dimension of matrix to copy INTEGER, INTENT(in) :: nb second dimension of matrix to copy REAL(dp), INTENT(inout) :: qab(:,:) Matrix output for "IN", input for "OUT" Use subblock of this matrix INTEGER, INTENT(in) :: ia Starting index in qab first dimension INTEGER, INTENT(in) :: ib Starting index in qab second dimension LOGICAL, INTENT(in), OPTIONAL :: trans Matrices (qab and sab) are transposed

#### SUBROUTINEcontraction_ab(sab, qab, ca, na, ma, cb, nb, mb, fscale, trans)^

Applying the contraction coefficents to a set of two-center primitive integrals QAB <- CA(T) * SAB * CB QAB is optionally scaled with "fscale" Variable "trans" requests the output to be QAB(T) If only one of the transformation matrix is given, only a half transformation is done Active dimensions are: QAB(ma,mb), SAB(na,nb)

##### Arguments:
 REAL(dp), INTENT(in) :: sab(:,:) Input matrix, dimension(:,:) REAL(dp), INTENT(inout) :: qab(:,:) Output matrix, dimension(:,:) REAL(dp), INTENT(in), OPTIONAL :: ca(:,:) Left transformation matrix, optional INTEGER, INTENT(in), OPTIONAL :: na First dimension of ca, optional INTEGER, INTENT(in), OPTIONAL :: ma Second dimension of ca, optional REAL(dp), INTENT(in), OPTIONAL :: cb(:,:) Right transformation matrix, optional INTEGER, INTENT(in), OPTIONAL :: nb First dimension of cb, optional INTEGER, INTENT(in), OPTIONAL :: mb Second dimension of cb, optional REAL(dp), INTENT(in), OPTIONAL :: fscale Optional scaling of output LOGICAL, INTENT(in), OPTIONAL :: trans Optional transposition of output

#### SUBROUTINEcontraction_abc(sabc, qabc, ca, na, ma, cb, nb, mb, cc, nc, mc)^

Applying the contraction coefficents to a tripple set integrals QABC <- CA(T) * SABC * CB * CC If only one or two of the transformation matrices are given, only a part transformation is done

##### Arguments:
 REAL(dp), INTENT(in) :: sabc(:,:,:) Input matrix, dimension(:,:) REAL(dp), INTENT(inout) :: qabc(:,:,:) Output matrix, dimension(:,:) REAL(dp), INTENT(in), OPTIONAL :: ca(:,:) Transformation matrix (index 1), optional INTEGER, INTENT(in), OPTIONAL :: na First dimension of ca, optional INTEGER, INTENT(in), OPTIONAL :: ma Second dimension of ca, optional REAL(dp), INTENT(in), OPTIONAL :: cb(:,:) Transformation matrix (index 2), optional INTEGER, INTENT(in), OPTIONAL :: nb First dimension of cb, optional INTEGER, INTENT(in), OPTIONAL :: mb Second dimension of cb, optional REAL(dp), INTENT(in), OPTIONAL :: cc(:,:) Transformation matrix (index 3), optional INTEGER, INTENT(in), OPTIONAL :: nc First dimension of cc, optional INTEGER, INTENT(in), OPTIONAL :: mc Second dimension of cc, optional

#### SUBROUTINEdecontraction_ab(sab, qab, ca, na, ma, cb, nb, mb, trans)^

Applying the de-contraction coefficents to a matrix QAB <- CA * SAB * CB(T) Variable "trans" requests the input matrix to be SAB(T) Active dimensions are: QAB(na,nb), SAB(ma,mb)

##### Arguments:
 REAL(dp), INTENT(in) :: sab(:,:) Input matrix, dimension(:,:) REAL(dp), INTENT(inout) :: qab(:,:) Output matrix, dimension(:,:) REAL(dp), INTENT(in) :: ca(:,:) Left transformation matrix INTEGER, INTENT(in) :: na First dimension of ca INTEGER, INTENT(in) :: ma Second dimension of ca REAL(dp), INTENT(in) :: cb(:,:) Right transformation matrix INTEGER, INTENT(in) :: nb First dimension of cb INTEGER, INTENT(in) :: mb Second dimension of cb LOGICAL, INTENT(in), OPTIONAL :: trans Optional transposition of input matrix

#### SUBROUTINEforce_trace_ab(force, sab, pab, na, nb, m, trans)^

Routine to trace a series of matrices with another matrix Calculate forces of type f(:) = Trace(Pab*Sab(:))

##### Arguments:
 REAL(dp), INTENT(inout) :: force(:) Vector to hold output forces REAL(dp), INTENT(in) :: sab(:,:,:) Input vector of matrices, dimension (:,:,:) REAL(dp), INTENT(in) :: pab(:,:) Input matrix INTEGER, INTENT(in) :: na Active first dimension INTEGER, INTENT(in) :: nb Active second dimension INTEGER, INTENT(in) :: m Number of matrices to be traced LOGICAL, INTENT(in), OPTIONAL :: trans Matrices are transposed (Sab and Pab)