18 USE dbcsr_api,
ONLY: &
19 dbcsr_add, dbcsr_copy, dbcsr_deallocate_matrix, dbcsr_get_block_p, dbcsr_get_info, &
20 dbcsr_init_p, dbcsr_p_type, dbcsr_set, dbcsr_type
32 #include "./base/base_uses.f90"
37 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'negf_matrix_utils'
38 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .true.
55 TYPE(qs_subsys_type),
POINTER :: subsys
56 INTEGER,
DIMENSION(:),
INTENT(in),
OPTIONAL :: atom_list
59 INTEGER :: iatom, natoms
60 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nsgfs
61 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
62 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
64 CALL qs_subsys_get(subsys, particle_set=particle_set, qs_kind_set=qs_kind_set)
65 ALLOCATE (nsgfs(
SIZE(particle_set)))
68 IF (
PRESENT(atom_list))
THEN
69 natoms =
SIZE(atom_list)
73 nao = nao + nsgfs(atom_list(iatom))
94 TYPE(cp_fm_type),
INTENT(IN) :: fm
95 TYPE(dbcsr_type),
POINTER :: matrix
96 INTEGER,
DIMENSION(:),
INTENT(in) :: atomlist_row, atomlist_col
97 TYPE(qs_subsys_type),
POINTER :: subsys
99 CHARACTER(LEN=*),
PARAMETER :: routinen =
'negf_copy_fm_submat_to_dbcsr'
101 INTEGER :: first_sgf_col, first_sgf_row, handle, iatom_col, iatom_row, icol, irow, &
102 natoms_col, natoms_row, ncols, nparticles, nrows
103 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nsgfs
105 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: fm_block
106 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: sm_block
107 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
108 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
110 CALL timeset(routinen, handle)
112 cpassert(
ASSOCIATED(matrix))
113 cpassert(
ASSOCIATED(subsys))
117 CALL qs_subsys_get(subsys, particle_set=particle_set, qs_kind_set=qs_kind_set)
119 natoms_row =
SIZE(atomlist_row)
120 natoms_col =
SIZE(atomlist_col)
121 nparticles =
SIZE(particle_set)
123 ALLOCATE (nsgfs(nparticles))
126 ALLOCATE (fm_block(nrows, ncols))
130 DO iatom_col = 1, natoms_col
132 DO iatom_row = 1, natoms_row
133 CALL dbcsr_get_block_p(matrix=matrix, row=atomlist_row(iatom_row), col=atomlist_col(iatom_col), &
134 block=sm_block, found=found)
139 nrows = nsgfs(atomlist_row(iatom_row))
140 ncols = nsgfs(atomlist_col(iatom_col))
143 sm_block(irow, icol) = fm_block(first_sgf_row + irow - 1, first_sgf_col + icol - 1)
148 first_sgf_row = first_sgf_row + nsgfs(atomlist_row(iatom_row))
150 first_sgf_col = first_sgf_col + nsgfs(atomlist_col(iatom_col))
153 DEALLOCATE (fm_block)
156 CALL timestop(handle)
180 mpi_comm_global, do_upper_diag, do_lower)
181 TYPE(dbcsr_type),
POINTER :: matrix
182 TYPE(cp_fm_type),
INTENT(IN) :: fm
183 INTEGER,
DIMENSION(:),
INTENT(in) :: atomlist_row, atomlist_col
184 TYPE(qs_subsys_type),
POINTER :: subsys
186 CLASS(mp_comm_type),
INTENT(in) :: mpi_comm_global
187 LOGICAL,
INTENT(in) :: do_upper_diag, do_lower
189 CHARACTER(LEN=*),
PARAMETER :: routinen =
'negf_copy_sym_dbcsr_to_fm_submat'
191 INTEGER :: handle, iatom_col, iatom_row, icol, irow, natoms_col, natoms_row, ncols_fm, &
192 nparticles, nrows_fm, offset_sgf_col, offset_sgf_row
193 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nsgfs
195 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r2d
196 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: sm_block
197 TYPE(mp_para_env_type),
POINTER :: para_env
198 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
199 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
201 CALL timeset(routinen, handle)
203 cpassert(
ASSOCIATED(matrix))
204 cpassert(
ASSOCIATED(subsys))
206 CALL qs_subsys_get(subsys, particle_set=particle_set, qs_kind_set=qs_kind_set)
208 natoms_row =
SIZE(atomlist_row)
209 natoms_col =
SIZE(atomlist_col)
210 nparticles =
SIZE(particle_set)
212 ALLOCATE (nsgfs(nparticles))
215 CALL cp_fm_get_info(fm, nrow_global=nrows_fm, ncol_global=ncols_fm, para_env=para_env)
217 IF (debug_this_module)
THEN
218 cpassert(sum(nsgfs(atomlist_row(:))) == nrows_fm)
219 cpassert(sum(nsgfs(atomlist_col(:))) == ncols_fm)
222 ALLOCATE (r2d(nrows_fm, ncols_fm))
226 DO iatom_col = 1, natoms_col
229 DO iatom_row = 1, natoms_row
230 IF (atomlist_row(iatom_row) <= atomlist_col(iatom_col))
THEN
231 IF (do_upper_diag)
THEN
232 CALL dbcsr_get_block_p(matrix=matrix, row=atomlist_row(iatom_row), col=atomlist_col(iatom_col), &
233 block=sm_block, found=found)
237 CALL dbcsr_get_block_p(matrix=matrix, row=atomlist_col(iatom_col), col=atomlist_row(iatom_row), &
238 block=sm_block, found=found)
243 IF (atomlist_row(iatom_row) <= atomlist_col(iatom_col))
THEN
244 IF (do_upper_diag)
THEN
245 DO icol = nsgfs(atomlist_col(iatom_col)), 1, -1
246 DO irow = nsgfs(atomlist_row(iatom_row)), 1, -1
247 r2d(offset_sgf_row + irow, offset_sgf_col + icol) = sm_block(irow, icol)
253 DO icol = nsgfs(atomlist_col(iatom_col)), 1, -1
254 DO irow = nsgfs(atomlist_row(iatom_row)), 1, -1
255 r2d(offset_sgf_row + irow, offset_sgf_col + icol) = sm_block(icol, irow)
262 offset_sgf_row = offset_sgf_row + nsgfs(atomlist_row(iatom_row))
264 offset_sgf_col = offset_sgf_col + nsgfs(atomlist_col(iatom_col))
267 CALL mpi_comm_global%sum(r2d)
274 CALL timestop(handle)
296 atom_list0, atom_list1, subsys, mpi_comm_global, is_same_cell, matrix_ref)
297 TYPE(cp_fm_type),
INTENT(IN) :: fm_cell0, fm_cell1
298 INTEGER,
INTENT(in) :: direction_axis
299 TYPE(dbcsr_p_type),
DIMENSION(:),
INTENT(in) :: matrix_kp
300 INTEGER,
DIMENSION(:, :),
INTENT(in) :: index_to_cell
301 INTEGER,
DIMENSION(:),
INTENT(in) :: atom_list0, atom_list1
302 TYPE(qs_subsys_type),
POINTER :: subsys
304 CLASS(mp_comm_type),
INTENT(in) :: mpi_comm_global
305 INTEGER,
DIMENSION(:, :),
INTENT(inout) :: is_same_cell
306 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: matrix_ref
308 CHARACTER(LEN=*),
PARAMETER :: routinen =
'negf_copy_contact_matrix'
310 INTEGER :: direction_axis_abs, handle, iatom_col, &
311 iatom_row, image, natoms, nimages, &
314 REAL(kind=
dp) :: error_diff, error_same
315 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: block_dest, block_src
316 TYPE(dbcsr_p_type),
ALLOCATABLE,
DIMENSION(:) :: matrix_cells_raw
317 TYPE(dbcsr_type),
POINTER :: matrix_cell_0, matrix_cell_1, &
320 CALL timeset(routinen, handle)
322 cpassert(
ASSOCIATED(subsys))
324 nimages =
SIZE(index_to_cell, 2)
325 direction_axis_abs = abs(direction_axis)
332 ALLOCATE (matrix_cells_raw(-2:2))
334 NULLIFY (matrix_cells_raw(rep)%matrix)
335 CALL dbcsr_init_p(matrix_cells_raw(rep)%matrix)
336 CALL dbcsr_copy(matrix_cells_raw(rep)%matrix, matrix_kp(1)%matrix)
337 CALL dbcsr_set(matrix_cells_raw(rep)%matrix, 0.0_dp)
340 NULLIFY (matrix_cell_0, matrix_cell_1, matrix_cell_minus1)
342 CALL dbcsr_init_p(matrix_cell_0)
343 CALL dbcsr_copy(matrix_cell_0, matrix_kp(1)%matrix)
344 CALL dbcsr_set(matrix_cell_0, 0.0_dp)
346 CALL dbcsr_init_p(matrix_cell_1)
347 CALL dbcsr_copy(matrix_cell_1, matrix_kp(1)%matrix)
348 CALL dbcsr_set(matrix_cell_1, 0.0_dp)
350 CALL dbcsr_init_p(matrix_cell_minus1)
351 CALL dbcsr_copy(matrix_cell_minus1, matrix_kp(1)%matrix)
352 CALL dbcsr_set(matrix_cell_minus1, 0.0_dp)
354 DO image = 1, nimages
355 rep = index_to_cell(direction_axis_abs, image)
358 CALL dbcsr_add(matrix_cells_raw(rep)%matrix, matrix_kp(image)%matrix, 1.0_dp, 1.0_dp)
361 CALL dbcsr_get_info(matrix_cell_0, nblkrows_total=natoms)
363 IF (
PRESENT(matrix_ref))
THEN
366 is_same_cell(:, :) = 0
368 DO iatom_col = 1, natoms
369 DO iatom_row = 1, iatom_col
370 CALL dbcsr_get_block_p(matrix=matrix_ref, &
371 row=iatom_row, col=iatom_col, &
372 block=block_src, found=found)
377 IF (mod(iatom_col - iatom_row, 2) == 0)
THEN
383 CALL dbcsr_get_block_p(matrix=matrix_cells_raw(0)%matrix, &
384 row=iatom_row, col=iatom_col, &
385 block=block_dest, found=found)
388 error_same = maxval(abs(block_dest(:, :) - block_src(:, :)))
390 CALL dbcsr_get_block_p(matrix=matrix_cells_raw(phase)%matrix, &
391 row=iatom_row, col=iatom_col, &
392 block=block_dest, found=found)
394 error_diff = maxval(abs(block_dest(:, :) - block_src(:, :)))
396 IF (error_same <= error_diff)
THEN
397 is_same_cell(iatom_row, iatom_col) = 0
399 is_same_cell(iatom_row, iatom_col) = 1
406 DO iatom_col = 1, natoms
407 DO iatom_row = 1, iatom_col
408 CALL dbcsr_get_block_p(matrix=matrix_cell_0, &
409 row=iatom_row, col=iatom_col, block=block_dest, found=found)
413 IF (mod(iatom_col - iatom_row, 2) == 0)
THEN
418 rep = phase*is_same_cell(iatom_row, iatom_col)
423 CALL dbcsr_get_block_p(matrix=matrix_cells_raw(rep)%matrix, &
424 row=iatom_row, col=iatom_col, block=block_src, found=found)
426 block_dest(:, :) = block_src(:, :)
431 CALL dbcsr_get_block_p(matrix=matrix_cell_1, &
432 row=iatom_row, col=iatom_col, block=block_dest, found=found)
434 CALL dbcsr_get_block_p(matrix=matrix_cells_raw(rep + phase)%matrix, &
435 row=iatom_row, col=iatom_col, block=block_src, found=found)
437 block_dest(:, :) = block_src(:, :)
442 CALL dbcsr_get_block_p(matrix=matrix_cell_minus1, &
443 row=iatom_row, col=iatom_col, block=block_dest, found=found)
445 CALL dbcsr_get_block_p(matrix=matrix_cells_raw(rep - phase)%matrix, &
446 row=iatom_row, col=iatom_col, block=block_src, found=found)
448 block_dest(:, :) = block_src(:, :)
453 IF (direction_axis >= 0)
THEN
456 subsys, mpi_comm_global, do_upper_diag=.true., do_lower=.false.)
459 subsys, mpi_comm_global, do_upper_diag=.false., do_lower=.true.)
463 subsys, mpi_comm_global, do_upper_diag=.true., do_lower=.false.)
466 subsys, mpi_comm_global, do_upper_diag=.false., do_lower=.true.)
473 subsys, mpi_comm_global, do_upper_diag=.true., do_lower=.true.)
475 CALL dbcsr_deallocate_matrix(matrix_cell_0)
476 CALL dbcsr_deallocate_matrix(matrix_cell_1)
477 CALL dbcsr_deallocate_matrix(matrix_cell_minus1)
480 CALL dbcsr_deallocate_matrix(matrix_cells_raw(rep)%matrix)
482 DEALLOCATE (matrix_cells_raw)
484 CALL timestop(handle)
497 TYPE(dbcsr_type),
POINTER :: matrix_contact, matrix_device
498 INTEGER,
DIMENSION(:),
INTENT(in) :: atom_list
499 TYPE(negf_atom_map_type),
DIMENSION(:),
INTENT(in) :: atom_map
500 TYPE(mp_para_env_type),
POINTER :: para_env
502 CHARACTER(LEN=*),
PARAMETER :: routinen =
'negf_reference_contact_matrix'
504 INTEGER :: handle, i1, i2, iatom_col, iatom_row, &
505 icol, iproc, irow, max_atom, &
506 mepos_plus1, n1, n2, natoms, offset
507 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: recv_nelems, send_nelems
508 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: rank_contact, rank_device
509 LOGICAL :: found, transp
510 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: rblock
511 TYPE(mp_request_type),
ALLOCATABLE,
DIMENSION(:) :: recv_handlers, send_handlers
512 TYPE(negf_allocatable_rvector),
ALLOCATABLE, &
513 DIMENSION(:) :: recv_packed_blocks, send_packed_blocks
515 CALL timeset(routinen, handle)
516 mepos_plus1 = para_env%mepos + 1
518 natoms =
SIZE(atom_list)
520 DO iatom_row = 1, natoms
521 IF (atom_map(iatom_row)%iatom > max_atom) max_atom = atom_map(iatom_row)%iatom
525 ALLOCATE (rank_contact(max_atom, max_atom))
526 ALLOCATE (rank_device(max_atom, max_atom))
528 rank_contact(:, :) = 0
529 rank_device(:, :) = 0
531 DO iatom_col = 1, natoms
532 DO iatom_row = 1, iatom_col
533 IF (atom_map(iatom_row)%iatom <= atom_map(iatom_col)%iatom)
THEN
534 icol = atom_map(iatom_col)%iatom
535 irow = atom_map(iatom_row)%iatom
537 icol = atom_map(iatom_row)%iatom
538 irow = atom_map(iatom_col)%iatom
541 CALL dbcsr_get_block_p(matrix=matrix_device, &
542 row=atom_list(iatom_row), col=atom_list(iatom_col), &
543 block=rblock, found=found)
544 IF (found) rank_device(irow, icol) = mepos_plus1
546 CALL dbcsr_get_block_p(matrix=matrix_contact, row=irow, col=icol, block=rblock, found=found)
547 IF (found) rank_contact(irow, icol) = mepos_plus1
551 CALL para_env%sum(rank_device)
552 CALL para_env%sum(rank_contact)
555 ALLOCATE (recv_nelems(para_env%num_pe))
556 ALLOCATE (send_nelems(para_env%num_pe))
560 DO iatom_col = 1, natoms
561 DO iatom_row = 1, iatom_col
562 IF (atom_map(iatom_row)%iatom <= atom_map(iatom_col)%iatom)
THEN
563 icol = atom_map(iatom_col)%iatom
564 irow = atom_map(iatom_row)%iatom
566 icol = atom_map(iatom_row)%iatom
567 irow = atom_map(iatom_col)%iatom
570 CALL dbcsr_get_block_p(matrix=matrix_device, &
571 row=atom_list(iatom_row), col=atom_list(iatom_col), &
572 block=rblock, found=found)
574 iproc = rank_contact(irow, icol)
576 send_nelems(iproc) = send_nelems(iproc) +
SIZE(rblock)
579 CALL dbcsr_get_block_p(matrix=matrix_contact, row=irow, col=icol, block=rblock, found=found)
581 iproc = rank_device(irow, icol)
583 recv_nelems(iproc) = recv_nelems(iproc) +
SIZE(rblock)
589 ALLOCATE (recv_packed_blocks(para_env%num_pe))
590 DO iproc = 1, para_env%num_pe
591 IF (iproc /= mepos_plus1 .AND. recv_nelems(iproc) > 0) &
592 ALLOCATE (recv_packed_blocks(iproc)%vector(recv_nelems(iproc)))
595 ALLOCATE (send_packed_blocks(para_env%num_pe))
596 DO iproc = 1, para_env%num_pe
597 IF (send_nelems(iproc) > 0) &
598 ALLOCATE (send_packed_blocks(iproc)%vector(send_nelems(iproc)))
602 DO iatom_col = 1, natoms
603 DO iatom_row = 1, iatom_col
604 IF (atom_map(iatom_row)%iatom <= atom_map(iatom_col)%iatom)
THEN
605 icol = atom_map(iatom_col)%iatom
606 irow = atom_map(iatom_row)%iatom
609 icol = atom_map(iatom_row)%iatom
610 irow = atom_map(iatom_col)%iatom
614 iproc = rank_contact(irow, icol)
616 CALL dbcsr_get_block_p(matrix=matrix_device, &
617 row=atom_list(iatom_row), col=atom_list(iatom_col), &
618 block=rblock, found=found)
620 offset = send_nelems(iproc)
627 send_packed_blocks(iproc)%vector(offset + i2) = rblock(i1, i2)
634 send_packed_blocks(iproc)%vector(offset + i1) = rblock(i1, i2)
640 send_nelems(iproc) = offset
647 ALLOCATE (recv_handlers(para_env%num_pe), send_handlers(para_env%num_pe))
649 DO iproc = 1, para_env%num_pe
650 IF (iproc /= mepos_plus1 .AND. send_nelems(iproc) > 0)
THEN
651 CALL para_env%isend(send_packed_blocks(iproc)%vector, iproc - 1, send_handlers(iproc), 1)
656 DO iproc = 1, para_env%num_pe
657 IF (iproc /= mepos_plus1)
THEN
658 IF (recv_nelems(iproc) > 0)
THEN
659 CALL para_env%irecv(recv_packed_blocks(iproc)%vector, iproc - 1, recv_handlers(iproc), 1)
662 IF (
ALLOCATED(send_packed_blocks(iproc)%vector)) &
663 CALL move_alloc(send_packed_blocks(iproc)%vector, recv_packed_blocks(iproc)%vector)
668 DO iproc = 1, para_env%num_pe
669 IF (iproc /= mepos_plus1 .AND. recv_nelems(iproc) > 0) &
670 CALL recv_handlers(iproc)%wait()
674 DO iatom_col = 1, natoms
675 DO iatom_row = 1, iatom_col
676 IF (atom_map(iatom_row)%iatom <= atom_map(iatom_col)%iatom)
THEN
677 icol = atom_map(iatom_col)%iatom
678 irow = atom_map(iatom_row)%iatom
680 icol = atom_map(iatom_row)%iatom
681 irow = atom_map(iatom_col)%iatom
684 iproc = rank_device(irow, icol)
686 CALL dbcsr_get_block_p(matrix=matrix_contact, row=irow, col=icol, block=rblock, found=found)
689 offset = recv_nelems(iproc)
695 rblock(i1, i2) = recv_packed_blocks(iproc)%vector(offset + i1)
700 recv_nelems(iproc) = offset
706 DO iproc = 1, para_env%num_pe
707 IF (iproc /= mepos_plus1 .AND. send_nelems(iproc) > 0) &
708 CALL send_handlers(iproc)%wait()
712 DEALLOCATE (recv_handlers, send_handlers)
714 DO iproc = para_env%num_pe, 1, -1
715 IF (
ALLOCATED(send_packed_blocks(iproc)%vector)) &
716 DEALLOCATE (send_packed_blocks(iproc)%vector)
718 DEALLOCATE (send_packed_blocks)
720 DO iproc = para_env%num_pe, 1, -1
721 IF (
ALLOCATED(recv_packed_blocks(iproc)%vector)) &
722 DEALLOCATE (recv_packed_blocks(iproc)%vector)
724 DEALLOCATE (recv_packed_blocks)
726 DEALLOCATE (rank_contact, rank_device)
727 CALL timestop(handle)
739 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
740 INTEGER,
INTENT(in) :: nimages
741 INTEGER,
DIMENSION(3, nimages),
INTENT(out) :: index_to_cell
743 CHARACTER(LEN=*),
PARAMETER :: routinen =
'invert_cell_to_index'
745 INTEGER :: handle, i1, i2, i3, image
746 INTEGER,
DIMENSION(3) :: lbounds, ubounds
748 CALL timeset(routinen, handle)
750 index_to_cell(:, :) = 0
751 lbounds = lbound(cell_to_index)
752 ubounds = ubound(cell_to_index)
754 DO i3 = lbounds(3), ubounds(3)
755 DO i2 = lbounds(2), ubounds(2)
756 DO i1 = lbounds(1), ubounds(1)
757 image = cell_to_index(i1, i2, i3)
758 IF (image > 0 .AND. image <= nimages)
THEN
759 index_to_cell(1, image) = i1
760 index_to_cell(2, image) = i2
761 index_to_cell(3, image) = i3
767 CALL timestop(handle)
781 INTEGER,
DIMENSION(3),
INTENT(in) :: cell
782 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
785 IF (lbound(cell_to_index, 1) <= cell(1) .AND. ubound(cell_to_index, 1) >= cell(1) .AND. &
786 lbound(cell_to_index, 2) <= cell(2) .AND. ubound(cell_to_index, 2) >= cell(2) .AND. &
787 lbound(cell_to_index, 3) <= cell(3) .AND. ubound(cell_to_index, 3) >= cell(3))
THEN
789 image = cell_to_index(cell(1), cell(2), cell(3))
basic linear algebra operations for full matrices
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_set_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
Allocatable vectors for NEGF based quantum transport calculations.
Map atoms between various force environments.
Helper routines to manipulate with matrices.
subroutine, public negf_reference_contact_matrix(matrix_contact, matrix_device, atom_list, atom_map, para_env)
Extract part of the DBCSR matrix based on selected atoms and copy it into another DBCSR matrix.
integer function, public number_of_atomic_orbitals(subsys, atom_list)
Compute the number of atomic orbitals of the given set of atoms.
pure integer function, public get_index_by_cell(cell, cell_to_index)
Helper routine to obtain index of a DBCSR matrix image by its unit cell replica. Can be used with any...
subroutine, public invert_cell_to_index(cell_to_index, nimages, index_to_cell)
Invert cell_to_index mapping between unit cells and DBCSR matrix images.
subroutine, public negf_copy_fm_submat_to_dbcsr(fm, matrix, atomlist_row, atomlist_col, subsys)
Populate relevant blocks of the DBCSR matrix using data from a ScaLAPACK matrix. Irrelevant blocks of...
subroutine, public negf_copy_contact_matrix(fm_cell0, fm_cell1, direction_axis, matrix_kp, index_to_cell, atom_list0, atom_list1, subsys, mpi_comm_global, is_same_cell, matrix_ref)
Driver routine to extract diagonal and off-diagonal blocks from a symmetric DBCSR matrix.
subroutine, public negf_copy_sym_dbcsr_to_fm_submat(matrix, fm, atomlist_row, atomlist_col, subsys, mpi_comm_global, do_upper_diag, do_lower)
Extract part of the DBCSR matrix based on selected atoms and copy it into a dense matrix.
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis)
Get the components of a particle set.
Define the data structure for the particle information.
Define the quickstep kind type and their sub types.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...