Documentation for module cp_dbcsr_operations

DBCSR operations in CP2K

source: cp_dbcsr_operations.F
Loading...

public Subroutines/Functions:

Copy a BLACS matrix to a dbcsr matrix.
Copy a DBCSR matrix to a BLACS matrix
SUBROUTINE
copy_dbcsr_to_fm (matrix, fm)
Copy a DBCSR matrix to a BLACS matrix
Copy a DBCSR_BLACS matrix to a BLACS matrix
Copy a BLACS matrix to a dbcsr matrix.
Copy a BLACS matrix to a dbcsr matrix with a special block-cyclic distribution, which requires no complete redistribution.
Creates a DBCSR distribution from a distribution_2d
Utility function to create dbcsr matrix, m x n matrix (n arbitrary) with the same processor grid and row distribution as the template matrix col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default)
Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the template matrix both row sizes and col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default)
performs the multiplication sparse_matrix+dense_mat*dens_mat^T if matrix_g is not explicitly given, matrix_v^T will be used this can be important to save the necessary redistribute for a different matrix_g and increase performance.
multiply a dbcsr with a fm matrix
Utility function to copy a specially shaped fm to dbcsr_matrix The result matrix will be the matrix in dbcsr format with the row blocks sizes according to the block_sizes of the template and the col blocks sizes evenly blocked with the internal dbcsr conversion size (32 is the current default)
hack for dbcsr_copy_columns
Creates a new distribution for the right matrix in a matrix multiplication with unrotated grid.
multiply a dbcsr with a replicated array c = alpha_scalar * A (dbscr) * b + c

Module variables:

INTEGER
:: max_elements_per_block = 32

SUBROUTINEcopy_cfm_to_dbcsr(fm, matrix, keep_sparsity)

Copy a BLACS matrix to a dbcsr matrix.

Arguments:
POINTER
:: fm full matrix
TYPE(dbcsr_type),
INTENT(inout)
:: matrix DBCSR matrix
LOGICAL,
INTENT(in),
OPTIONAL
:: keep_sparsity retains the sparsity of the input matrix

SUBROUTINEcopy_dbcsr_to_cfm(matrix, fm)

Copy a DBCSR matrix to a BLACS matrix

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: matrix DBCSR matrix
POINTER
:: fm full matrix

SUBROUTINEcopy_dbcsr_to_fm(matrix, fm)

Copy a DBCSR matrix to a BLACS matrix

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: matrix DBCSR matrix
TYPE(cp_fm_type),
POINTER
:: fm full matrix

SUBROUTINEcopy_dbcsr_to_fm_bc(bc_mat, fm)

Copy a DBCSR_BLACS matrix to a BLACS matrix

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: bc_mat DBCSR matrix
TYPE(cp_fm_type),
POINTER
:: fm full matrix

SUBROUTINEcopy_fm_to_dbcsr(fm, matrix, keep_sparsity)

Copy a BLACS matrix to a dbcsr matrix.

Arguments:
TYPE(cp_fm_type),
POINTER
:: fm full matrix
TYPE(dbcsr_type),
INTENT(inout)
:: matrix DBCSR matrix
LOGICAL,
INTENT(in),
OPTIONAL
:: keep_sparsity retains the sparsity of the input matrix

SUBROUTINEcopy_fm_to_dbcsr_bc(fm, bc_mat)

Copy a BLACS matrix to a dbcsr matrix with a special block-cyclic distribution, which requires no complete redistribution.

Arguments:
TYPE(cp_fm_type),
POINTER
:: fm ...
:: bc_mat ...

SUBROUTINEcp_dbcsr_dist2d_to_dist(dist2d, dist)

Creates a DBCSR distribution from a distribution_2d

Arguments:
INTENT(in),
TARGET
:: dist2d distribution_2d
INTENT(out)
:: dist DBCSR distribution

SUBROUTINEcp_dbcsr_m_by_n_from_row_template(matrix, template, n, sym, data_type)

Utility function to create dbcsr matrix, m x n matrix (n arbitrary) with the same processor grid and row distribution as the template matrix col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default)

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: matrix dbcsr matrix to be created
TYPE(dbcsr_type),
INTENT(inout)
:: template template dbcsr matrix giving its mp_env
INTEGER
:: n global col size of output matrix
CHARACTER,
OPTIONAL
:: sym ...
INTEGER,
OPTIONAL
:: data_type ...

SUBROUTINEcp_dbcsr_m_by_n_from_template(matrix, template, m, n, sym, data_type)

Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the template matrix both row sizes and col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default)

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: matrix dbcsr matrix to be created
TYPE(dbcsr_type),
INTENT(inout)
:: template template dbcsr matrix giving its mp_env
INTEGER
:: m global row size of output matrix
INTEGER
:: n global col size of output matrix
CHARACTER,
OPTIONAL
:: sym ...
INTEGER,
OPTIONAL
:: data_type ...

SUBROUTINEcp_dbcsr_plus_fm_fm_t(sparse_matrix, matrix_v, matrix_g, ncol, alpha, keep_sparsity)

performs the multiplication sparse_matrix+dense_mat*dens_mat^T if matrix_g is not explicitly given, matrix_v^T will be used this can be important to save the necessary redistribute for a different matrix_g and increase performance.

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: sparse_matrix ...
TYPE(cp_fm_type),
POINTER
:: matrix_v ...
TYPE(cp_fm_type),
OPTIONAL, POINTER
:: matrix_g ...
INTEGER,
INTENT(in)
:: ncol ...
REAL(dp),
INTENT(in),
OPTIONAL
:: alpha ...
LOGICAL,
INTENT(in),
OPTIONAL
:: keep_sparsity Determines if the sparsity of sparse_matrix is retained by default it is TRUE

SUBROUTINEcp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)

multiply a dbcsr with a fm matrix

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: matrix DBCSR matrix
TYPE(cp_fm_type),
POINTER
:: fm_in full matrix
TYPE(cp_fm_type),
POINTER
:: fm_out full matrix
INTEGER,
INTENT(in)
:: ncol nbr of columns
REAL(dp),
INTENT(in),
OPTIONAL
:: alpha alpha
REAL(dp),
INTENT(in),
OPTIONAL
:: beta beta

SUBROUTINEcp_fm_to_dbcsr_row_template(matrix, fm_in, template)

Utility function to copy a specially shaped fm to dbcsr_matrix The result matrix will be the matrix in dbcsr format with the row blocks sizes according to the block_sizes of the template and the col blocks sizes evenly blocked with the internal dbcsr conversion size (32 is the current default)

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: matrix ...
TYPE(cp_fm_type),
POINTER
:: fm_in ...
TYPE(dbcsr_type),
INTENT(in)
:: template ...

SUBROUTINEdbcsr_copy_columns_hack(matrix_b, matrix_a, ncol, source_start, target_start, para_env, blacs_env)

hack for dbcsr_copy_columns

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: matrix_b ...
TYPE(dbcsr_type),
INTENT(in)
:: matrix_a ...
INTEGER,
INTENT(in)
:: ncol ...
INTEGER,
INTENT(in)
:: source_start ...
INTEGER,
INTENT(in)
:: target_start ...
POINTER
:: para_env ...
POINTER
:: blacs_env ...

SUBROUTINEdbcsr_create_dist_r_unrot(dist_right, dist_left, ncolumns, right_col_blk_sizes)

Creates a new distribution for the right matrix in a matrix multiplication with unrotated grid.

Arguments:
INTENT(out)
:: dist_right new distribution for the right matrix
INTENT(in)
:: dist_left the distribution of the left matrix
INTEGER,
INTENT(in)
:: ncolumns number of columns in right matrix
INTEGER,
INTENT(out),
POINTER
:: right_col_blk_sizes(:) sizes of blocks in the created column

SUBROUTINEdbcsr_multiply_local(matrix_a, vec_b, vec_c, ncol, alpha)

multiply a dbcsr with a replicated array c = alpha_scalar * A (dbscr) * b + c

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: matrix_a DBSCR matrxx
REAL(dp),
INTENT(in)
:: vec_b(:,:) vectors b
REAL(dp),
INTENT(inout)
:: vec_c(:,:) vectors c
INTEGER,
INTENT(in),
OPTIONAL
:: ncol nbr of columns
REAL(dp),
INTENT(in),
OPTIONAL
:: alpha alpha