[CP2K:3071] Matrix Operations
Urban Borštnik
urban.b... at gmail.com
Sun Jan 23 21:08:26 UTC 2011
Hello,
to be able to release() a matrix, you should first create() it in some
manner. The cp_dbcsr_init() call acts only as something similar to a
nullify(). So between lines 7 & 8 you should call some thing like
cp_dbcsr_create (exx_kernel(ispin), template=exx_energy, ...)
(or use another routine to populate the matrix, such as cp_dbcsr_copy or
similar.
Cheers,
Urban
On Sun, 2011-01-23 at 09:19 -0800, Andrey wrote:
> Dear cp2k developers,
>
> I have the code, which works without errors:
> 1)
> TYPE(cp_dbcsr_p_type), DIMENSION(:), POINTER :: exx_kernel
> TYPE (qs_energy_type), POINTER :: exx_energy
>
> .....
> 1 NULLIFY(exx_energy, exx_kernel)
> 2 CALL allocate_qs_energy(exx_energy)
> 3
> 4 CALL
> cp_dbcsr_allocate_matrix_set(exx_kernel,nspins,error=error)
> 5 DO ispin=1,nspins
> 6 ALLOCATE(exx_kernel(ispin)%matrix)
> 7 CALL cp_dbcsr_init(exx_kernel(ispin)
> %matrix,error=error)
> 8 END DO
> 9
> 10 CALL deallocate_qs_energy(exx_energy)
> ......
>
> 2) When CALL cp_dbcsr_deallocate_matrix_set(exx_kernel,error=error)
> added,
> .....
> 9 CALL
> cp_dbcsr_deallocate_matrix_set(exx_kernel,error=error)
> 10 CALL deallocate_qs_energy(exx_energy) ASSERTION
> FAILED: F
>
> program finishes well, but noncritical error messages appear.
>
> dbcsr_error_print_stack
> error%msg=
> Matrix not
> initialized
>
> error%routine=
>
> dbcsr_release
>
> error%etype= 1
> error%level= 1
> error%line= 413
> error%stack%level= 0
> dbcsr_error_stack_size= 10
>
>
>
> 3) If CALL cp_dbcsr_set(exx_kernel(ispin)%matrix,0.0_dp,error=error)
> is set (between lines 7 and 8)
> then program does not pass it and crashes at this point.
>
> forrtl: severe (174): SIGSEGV, segmentation fault occurred
>
> Could you, please, help me to understand what is wrong in my code.
>
More information about the CP2K-user
mailing list