[CP2K:3090] cp_dbcsr_p_type to REAL(dp),

Urban Borštnik urban.b... at gmail.com
Tue Feb 8 11:39:52 UTC 2011


On Tue, 2011-02-08 at 01:52 -0800, Andrey wrote:
> Dear cp2k developers,
> Is it possible to transform the ks_matrix which has the
> (cp_dbcsr_p_type), DIMENSION(:), POINTER type
> to vector, REAL(dp), DIMENSION(:), POINTER  type?
> What routine should I use?

There is no completely direct way because in the parallel case you have
to be able to define a data distribution.  Therefore we support a
conversion to CP2K-wrapped BLACS matrices ("FM" matrices) via the
copy_dbcsr_to_fm subroutine defined in cp_dbcsr_operations.  It does not
create the FM matrix from scratch, so you have to create a valid one
first.  For this you need a
     1. cp_para_env_type (a valid one can be found in, e.g.,
        qs_env_type), which is needed for
     2. cp_blacs_env_type (you can create it from cp_para_env using
        cp_blacs_env/cp_blacs_env_create, or find a valid existing one),
        from which you create
     3. cp_fm_struct_type, to which you have to pass the matrix size (in
        elements) besides the cp_blacs_env_type and cp_para_env_type
        using cp_fm_struct/cp_fm_struct_create.
>>From these you can create an FM matrix using cp_fm_types/cp_fm_create.

Please not that your first line is an array of (many) cp_dbcsr_p_type
matrices while your second line is a real vector.  I assume you mean to
convert *one* cp_dbcsr_p_type matrix to a REAL(KIND=dp), DIMENSION(:,:)
array (note the 2 dimensions here)?


More information about the CP2K-user mailing list