22#include "./base/base_uses.f90"
28 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mscfg_types'
44 LOGICAL :: is_fast_dirty = .false., &
48 INTEGER :: nfrags = -1
49 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: energy_of_frag
50 INTEGER,
DIMENSION(:),
ALLOCATABLE :: nmosets_of_frag
51 TYPE(
dbcsr_type),
DIMENSION(:, :),
ALLOCATABLE :: mos_of_frag
68 INTEGER,
INTENT(IN) :: nfrags
78 IF (nfrags .GT. 0)
THEN
79 ALLOCATE (env%energy_of_frag(nfrags))
80 ALLOCATE (env%nmosets_of_frag(nfrags))
97 INTEGER :: ifrag, jfrag
99 IF (
ALLOCATED(env%mos_of_frag))
THEN
100 DO ifrag = 1,
SIZE(env%mos_of_frag, 1)
101 DO jfrag = 1, env%nmosets_of_frag(ifrag)
105 DEALLOCATE (env%mos_of_frag)
107 IF (
ALLOCATED(env%energy_of_frag))
DEALLOCATE (env%energy_of_frag)
108 IF (
ALLOCATED(env%nmosets_of_frag))
DEALLOCATE (env%nmosets_of_frag)
127 INTEGER,
INTENT(IN) :: iset
129 CHARACTER(len=*),
PARAMETER :: routinen =
'get_matrix_from_submatrices'
131 INTEGER :: handle, ifrag
132 INTEGER,
DIMENSION(2) :: matrix_size, offset, submatrix_size
135 CALL timeset(routinen, handle)
140 template=matrix_out, &
141 matrix_type=dbcsr_type_no_symmetry)
143 CALL dbcsr_get_info(matrix_out, nfullrows_total=matrix_size(1), nfullcols_total=matrix_size(2))
149 DO ifrag = 1, mscfg_env%nfrags
151 cpassert(iset .LE. mscfg_env%nmosets_of_frag(ifrag))
154 nfullrows_total=submatrix_size(1), nfullcols_total=submatrix_size(2))
155 CALL copy_submatrix_into_matrix(mscfg_env%mos_of_frag(ifrag, iset), &
156 matrix_temp, offset, submatrix_size, matrix_size)
158 CALL dbcsr_add(matrix_out, matrix_temp, 1.0_dp, 1.0_dp)
160 offset(1) = offset(1) + submatrix_size(1)
161 offset(2) = offset(2) + submatrix_size(2)
169 cpassert(offset(1) .EQ. matrix_size(1))
170 cpassert(offset(2) .EQ. matrix_size(2))
174 CALL timestop(handle)
189 SUBROUTINE copy_submatrix_into_matrix(submatrix_in, matrix_out, &
190 offset, submatrix_size, matrix_size)
194 INTEGER,
DIMENSION(2),
INTENT(IN) :: offset, submatrix_size, matrix_size
196 INTEGER :: add_blocks_after, dimen, iblock_col, &
197 iblock_row, iblock_size, nblocks, &
198 nblocks_new, start_index, trailing_size
199 INTEGER,
DIMENSION(2) :: add_blocks_before
200 INTEGER,
DIMENSION(:),
POINTER :: blk_distr, blk_sizes, block_sizes_new, col_distr_new, &
201 col_sizes_new, distr_new_array, row_distr_new, row_sizes_new
202 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: data_p
213 add_blocks_before(dimen) = 0
216 trailing_size = matrix_size(dimen) - offset(dimen) - submatrix_size(dimen)
217 IF (offset(dimen) .GT. 0)
THEN
218 add_blocks_before(dimen) = add_blocks_before(dimen) + 1
221 IF (trailing_size .GT. 0)
THEN
222 add_blocks_after = add_blocks_after + 1
232 nblocks =
SIZE(blk_sizes)
234 nblocks_new = nblocks + add_blocks_before(dimen) + add_blocks_after
235 ALLOCATE (block_sizes_new(nblocks_new))
236 ALLOCATE (distr_new_array(nblocks_new))
240 IF (add_blocks_before(dimen) .GT. 0)
THEN
241 block_sizes_new(1) = offset(dimen)
242 distr_new_array(1) = 0
247 block_sizes_new(start_index:nblocks + start_index - 1) = blk_sizes(1:nblocks)
248 distr_new_array(start_index:nblocks + start_index - 1) = blk_distr(1:nblocks)
252 IF (add_blocks_after .GT. 0)
THEN
253 block_sizes_new(nblocks_new) = trailing_size
254 distr_new_array(nblocks_new) = 0
262 row_sizes_new => block_sizes_new
263 row_distr_new => distr_new_array
266 col_sizes_new => block_sizes_new
267 col_distr_new => distr_new_array
274 row_dist=row_distr_new, col_dist=col_distr_new, &
280 dist_new, dbcsr_type_no_symmetry, &
281 row_sizes_new, col_sizes_new, &
303 row=iblock_row + add_blocks_before(1), &
304 col=iblock_col + add_blocks_before(2), &
317 END SUBROUTINE copy_submatrix_into_matrix
subroutine, public dbcsr_distribution_release(dist)
...
subroutine, public dbcsr_distribution_new(dist, template, group, pgrid, row_dist, col_dist, reuse_arrays)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset)
...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_work_create(matrix, nblks_guess, sizedata_guess, n, work_mutable)
...
subroutine, public dbcsr_finalize(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_complete_redistribute(matrix, redist)
...
subroutine, public dbcsr_iterator_readonly_start(iterator, matrix, shared, dynamic, dynamic_byrows)
Like dbcsr_iterator_start() but with matrix being INTENT(IN). When invoking this routine,...
subroutine, public dbcsr_put_block(matrix, row, col, block, summation)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_distribution_get(dist, row_dist, col_dist, nrows, ncols, has_threads, group, mynode, numnodes, nprows, npcols, myprow, mypcol, pgrid, subgroups_defined, prow_group, pcol_group)
...
Defines the basic variable types.
integer, parameter, public dp
Types used to generate the molecular SCF guess.
integer, parameter, public mscfg_max_moset_size
subroutine, public get_matrix_from_submatrices(mscfg_env, matrix_out, iset)
Creates a distributed matrix from MOs on fragments.
subroutine, public molecular_scf_guess_env_destroy(env)
Destroyes both data and environment.
subroutine, public molecular_scf_guess_env_init(env, nfrags)
Allocates data.