dbcsr_mutable_new Subroutine

public subroutine dbcsr_mutable_new(mutable, data_type)

Creates a new mutable instance.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mutable_obj), intent(inout) :: mutable

mutable data

integer, intent(in) :: data_type

data type to be stored here (see dbcsr_types for possibilities)


Source Code

   SUBROUTINE dbcsr_mutable_new(mutable, data_type)
      !! Creates a new mutable instance.

      TYPE(dbcsr_mutable_obj), INTENT(INOUT)             :: mutable
         !! mutable data
      INTEGER, INTENT(IN)                                :: data_type
         !! data type to be stored here (see dbcsr_types for possibilities)

!   ---------------------------------------------------------------------------

      IF (ASSOCIATED(mutable%m)) &
         DBCSR_ABORT("Mutable data area already instantiated")
      IF (data_type .NE. dbcsr_type_real_4 &
          .AND. data_type .NE. dbcsr_type_real_8 &
          .AND. data_type .NE. dbcsr_type_complex_4 &
          .AND. data_type .NE. dbcsr_type_complex_8) &
         DBCSR_ABORT("Invalid data type")
      ALLOCATE (mutable%m)
      mutable%m%refcount = 1
      mutable%m%data_type = data_type
      CALL btree_new(mutable%m%btree_s)
      CALL btree_new(mutable%m%btree_d)
      CALL btree_new(mutable%m%btree_c)
      CALL btree_new(mutable%m%btree_z)
   END SUBROUTINE dbcsr_mutable_new