<div dir="ltr">I am trying to retrieve the values of the a matrix in dbcsr_example_2.F from <span style="font-family: Menlo; font-size: 16px;">libdbcsr_svn18128.</span><div><span style="font-family: Menlo; font-size: 16px;">As suggested in the previous post whose title is "</span>returning values from a dbcsr matrix<span style="font-family: Menlo; font-size: 16px;">"</span></div><div><span style="font-family: Menlo; font-size: 16px;">I am employing the subroutine </span><span style="color: rgb(83, 48, 225); font-family: Menlo; font-size: 16px;">dbcsr_get_block_p (real*8).</span></div><div><span style="color: rgb(83, 48, 225); font-family: Menlo; font-size: 16px;">To do so, I add in the code:</span></div><div><span style="color: rgb(83, 48, 225); font-family: Menlo; font-size: 16px;"><br></span></div><div><p style="font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(83, 48, 225);"><span style="font-variant-ligatures: no-common-ligatures"> call dbcsr_get_block_p(matrix_a,1,1,bb,salida)</span></p><p style="font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(83, 48, 225);"><span style="font-variant-ligatures: no-common-ligatures"><br></span></p><p style="font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(83, 48, 225);"><span style="font-variant-ligatures: no-common-ligatures">where bb and salida have been defined previously:</span></p><p style="font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(83, 48, 225);"><span style="font-variant-ligatures: no-common-ligatures"><br></span></p><p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #34bd26"> real</span><span style="font-variant-ligatures: no-common-ligatures">(real_8), dimension(:), </span><span style="font-variant-ligatures: no-common-ligatures; color: #34bd26">pointer</span><span style="font-variant-ligatures: no-common-ligatures"> :: bb</span></p><p style="font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(83, 48, 225);"><span style="font-variant-ligatures: no-common-ligatures">
</span></p><p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #34bd26"> LOGICAL</span><span style="font-variant-ligatures: no-common-ligatures"> :: salida</span></p><div><span style="font-variant-ligatures: no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures: no-common-ligatures">I did it because in the subroutine dbcsr_get_block_p can be written the following:</span></div><div><span style="font-variant-ligatures: no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures: no-common-ligatures"><p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> SUBROUTINE dbcsr_get_block_p_d (matrix,row,col,block,found, row_size, col_size)</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> TYPE(dbcsr_type), INTENT(IN) :: matrix</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> INTEGER, INTENT(IN) :: row, col</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> REAL(kind=real_8), DIMENSION(:), POINTER :: block</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> LOGICAL, INTENT(OUT) :: found</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> INTEGER, INTENT(OUT), OPTIONAL :: row_size, col_size</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo; min-height: 19px;"><span style="font-variant-ligatures: no-common-ligatures"></span><br></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> LOGICAL :: tr</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo; min-height: 19px;"><span style="font-variant-ligatures: no-common-ligatures"></span><br></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> CALL dbcsr_get_block_p_prv(matrix%prv,row,col,block,tr,found, row_size, col_size)</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> IF(tr)&</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> CPABORT("CP2K does not handle transposed blocks.")</span></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo; min-height: 19px;"><span style="font-variant-ligatures: no-common-ligatures"></span><br></p>
<p style="font-size: 16px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> END SUBROUTINE dbcsr_get_block_p_d</span></p><div><span style="font-variant-ligatures: no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures: no-common-ligatures">I mean, "block" and "bb" must be pointers (in this example I am interested in the 1 1 block).</span></div><div><span style="font-variant-ligatures: no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures: no-common-ligatures">In dbcsr_example_2.F I am able to print out the array-pointer bb and its 4 values.</span></div><div><span style="font-variant-ligatures: no-common-ligatures">But the problem comes when I try to "transfer" that information to a "local" array, defined in</span></div><div><span style="font-variant-ligatures: no-common-ligatures">the dbcsr_example_2.F code.</span></div><div><span style="font-variant-ligatures: no-common-ligatures"> My aim is to collect all the values of the matrix_a, which are distributed in many processors,</span></div><div><span style="font-variant-ligatures: no-common-ligatures">in one only array in the dbcsr_example_2.F Afterwards, this array, with the elements of</span></div><div><span style="font-variant-ligatures: no-common-ligatures">the a matrix, could be used for any other purposes. But the key point is to transfer the </span></div><div><span style="font-variant-ligatures: no-common-ligatures">elements of the a matrix to the dbcsr_example_2.F code, instead of leaving those </span></div><div><span style="font-variant-ligatures: no-common-ligatures">elements in the "inner" subroutines.</span></div><div><span style="font-variant-ligatures: no-common-ligatures"> I have checked the post whose title is "returning values from a dbcsr matrix"; but </span></div><div><span style="font-variant-ligatures: no-common-ligatures">I don't understand completely the explanation.</span></div><div><span style="font-variant-ligatures: no-common-ligatures"> Thank you very much for your help, David.</span></div></span></div><p style="font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(83, 48, 225);"><span style="font-variant-ligatures: no-common-ligatures"><br></span></p></div></div>