returning values from a dbcsr matrix - a bit more help ...

David Lopez dlope... at gmail.com
Wed Jan 24 12:54:05 UTC 2018


I am trying to retrieve the values of the a matrix in dbcsr_example_2.F 
from libdbcsr_svn18128.
As suggested in the previous post whose title is "returning values from a 
dbcsr matrix"
I am employing the subroutine dbcsr_get_block_p (real*8).
To do so, I add in the code:

   call dbcsr_get_block_p(matrix_a,1,1,bb,salida)


where bb and salida have been defined previously:


    real(real_8), dimension(:), pointer :: bb

    LOGICAL                      :: salida

I did it because in the subroutine dbcsr_get_block_p can be written the 
following:

  SUBROUTINE dbcsr_get_block_p_d (matrix,row,col,block,found, row_size, 
col_size)

    TYPE(dbcsr_type), INTENT(IN)              :: matrix

    INTEGER, INTENT(IN)                       :: row, col

    REAL(kind=real_8), DIMENSION(:), POINTER            :: block

    LOGICAL, INTENT(OUT)                      :: found

    INTEGER, INTENT(OUT), OPTIONAL            :: row_size, col_size


    LOGICAL                                   :: tr


    CALL dbcsr_get_block_p_prv(matrix%prv,row,col,block,tr,found, row_size, 
col_size)

    IF(tr)&

       CPABORT("CP2K does not handle transposed blocks.")


  END SUBROUTINE dbcsr_get_block_p_d

I mean, "block" and "bb" must be pointers (in this example I am interested 
in the 1 1 block).

In dbcsr_example_2.F I am able to print out the array-pointer bb and its 4 
values.
But the problem comes when I try to "transfer" that information to a 
"local" array, defined in
the dbcsr_example_2.F code.
 My aim is to collect all the values of the matrix_a, which are distributed 
in many processors,
in one only array in the dbcsr_example_2.F  Afterwards, this array, with 
the elements of
the a matrix, could be used for any other purposes. But the key point is to 
transfer the 
elements of the a matrix to the dbcsr_example_2.F code, instead of leaving 
those 
elements in the "inner" subroutines.
 I have checked the post whose title is "returning values from a dbcsr 
matrix"; but 
I don't understand completely the explanation.
 Thank you very much for your help, David.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20180124/7e0bf570/attachment.htm>


More information about the CP2K-user mailing list