LCOV - code coverage report
Current view: top level - src/62_ctqmc - m_VectorComplex.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 61 0
Test Date: 2026-11-10 14:34:30 Functions: 0.0 % 9 0
Branches: 0.0 % 78 0

             Branch data     Line data    Source code
       1                 :             : 
       2                 :             : #if defined HAVE_CONFIG_H
       3                 :             : #include "config.h"
       4                 :             : #endif
       5                 :             : !!****m* ABINIT/m_VectorComplex
       6                 :             : !! NAME
       7                 :             : !!  m_VectorComplex
       8                 :             : !!
       9                 :             : !! FUNCTION
      10                 :             : !!  Manage a double precision vector
      11                 :             : !!
      12                 :             : !! COPYRIGHT
      13                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
      14                 :             : !!  This file is distributed under the terms of the
      15                 :             : !!  GNU General Public License, see ~abinit/COPYING
      16                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      17                 :             : !!
      18                 :             : !! NOTES
      19                 :             : !!
      20                 :             : !! SOURCE
      21                 :             : 
      22                 :             : #include "defs.h"
      23                 :             : MODULE m_VectorComplex
      24                 :             : USE m_Global
      25                 :             : IMPLICIT NONE
      26                 :             : 
      27                 :             : !!***
      28                 :             : 
      29                 :             : PRIVATE
      30                 :             : 
      31                 :             : !!****t* m_VectorComplex/VectorComplex
      32                 :             : !! NAME
      33                 :             : !!  VectorComplex
      34                 :             : !!
      35                 :             : !! FUNCTION
      36                 :             : !!  This structured datatype contains the necessary data
      37                 :             : !!
      38                 :             : !! COPYRIGHT
      39                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
      40                 :             : !!  This file is distributed under the terms of the
      41                 :             : !!  GNU General Public License, see ~abinit/COPYING
      42                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      43                 :             : !!
      44                 :             : !! SOURCE
      45                 :             : 
      46                 :             : TYPE, PUBLIC :: VectorComplex
      47                 :             :   INTEGER         :: size
      48                 :             :   INTEGER         :: tail
      49                 :             :   COMPLEX(KIND=8), ALLOCATABLE, DIMENSION(:)         :: vec
      50                 :             : END TYPE VectorComplex
      51                 :             : !!***
      52                 :             : 
      53                 :             : PUBLIC :: VectorComplex_init
      54                 :             : PUBLIC :: VectorComplex_setSize
      55                 :             : PUBLIC :: VectorComplex_enlarge
      56                 :             : PUBLIC :: VectorComplex_pushBack
      57                 :             : PUBLIC :: VectorComplex_clear
      58                 :             : PUBLIC :: VectorComplex_print
      59                 :             : PUBLIC :: VectorComplex_destroy
      60                 :             : 
      61                 :             : CONTAINS
      62                 :             : !!***
      63                 :             : 
      64                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_init
      65                 :             : !! NAME
      66                 :             : !!  VectorComplex_init
      67                 :             : !!
      68                 :             : !! FUNCTION
      69                 :             : !!  initialize
      70                 :             : !!
      71                 :             : !! COPYRIGHT
      72                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
      73                 :             : !!  This file is distributed under the terms of the
      74                 :             : !!  GNU General Public License, see ~abinit/COPYING
      75                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      76                 :             : !!
      77                 :             : !! INPUTS
      78                 :             : !!  this=vector
      79                 :             : !!  size=size of initialization
      80                 :             : !!
      81                 :             : !! OUTPUT
      82                 :             : !!
      83                 :             : !! SIDE EFFECTS
      84                 :             : !!
      85                 :             : !! NOTES
      86                 :             : !!
      87                 :             : !! SOURCE
      88                 :             : 
      89                 :           0 : SUBROUTINE VectorComplex_init(this, size)
      90                 :             : 
      91                 :             : !Arguments ------------------------------------
      92                 :             :   TYPE(VectorComplex)     , INTENT(INOUT) :: this
      93                 :             :   INTEGER, OPTIONAL, INTENT(IN   ) :: size
      94                 :             : !Local variables ------------------------------
      95                 :             :   INTEGER                          :: size_val
      96                 :             : 
      97                 :           0 :   size_val = Global_SIZE
      98         [ #  # ]:           0 :   IF ( PRESENT(size) ) size_val = size
      99                 :           0 :   this%size = size_val
     100         [ #  # ]:           0 :   FREEIF(this%vec)
     101   [ #  #  #  #  :           0 :   MALLOC(this%vec,(1:size_val))
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     102                 :           0 :   this%tail     = 0
     103         [ #  # ]:           0 :   this%vec = cmplx(0.d0,0.d0,kind=8)
     104                 :           0 : END SUBROUTINE VectorComplex_init
     105                 :             : !!***
     106                 :             : 
     107                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_setSize
     108                 :             : !! NAME
     109                 :             : !!  VectorComplex_setSize
     110                 :             : !!
     111                 :             : !! FUNCTION
     112                 :             : !!  impose size
     113                 :             : !!
     114                 :             : !! COPYRIGHT
     115                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     116                 :             : !!  This file is distributed under the terms of the
     117                 :             : !!  GNU General Public License, see ~abinit/COPYING
     118                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     119                 :             : !!
     120                 :             : !! INPUTS
     121                 :             : !!  this=vector
     122                 :             : !!  new_tail=new_size
     123                 :             : !!
     124                 :             : !! OUTPUT
     125                 :             : !!
     126                 :             : !! SIDE EFFECTS
     127                 :             : !!
     128                 :             : !! NOTES
     129                 :             : !!
     130                 :             : !! SOURCE
     131                 :             : 
     132                 :           0 : SUBROUTINE VectorComplex_setSize(this,new_tail)
     133                 :             : 
     134                 :             : !Arguments ------------------------------------
     135                 :             :   TYPE(VectorComplex), INTENT(INOUT) :: this
     136                 :             :   INTEGER     , INTENT(IN   ) :: new_tail
     137                 :             : !Local variables ------------------------------
     138                 :             :   INTEGER                     :: size
     139                 :             : 
     140         [ #  # ]:           0 :   IF ( .NOT. ALLOCATED(this%vec) ) THEN
     141                 :           0 :     CALL VectorComplex_init(this,new_tail)
     142                 :             :   ELSE
     143                 :           0 :     size = this%size
     144         [ #  # ]:           0 :     IF( new_tail .GT. size ) THEN
     145                 :           0 :       CALL VectorComplex_enlarge(this,MAX(Global_SIZE,new_tail-size))
     146                 :             :     END IF
     147                 :             :   END IF
     148                 :           0 :   this%tail = new_tail
     149                 :           0 : END SUBROUTINE VectorComplex_setSize
     150                 :             : !!***
     151                 :             : 
     152                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_enlarge
     153                 :             : !! NAME
     154                 :             : !!  VectorComplex_enlarge
     155                 :             : !!
     156                 :             : !! FUNCTION
     157                 :             : !!  enlarge memory size
     158                 :             : !!
     159                 :             : !! COPYRIGHT
     160                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     161                 :             : !!  This file is distributed under the terms of the
     162                 :             : !!  GNU General Public License, see ~abinit/COPYING
     163                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     164                 :             : !!
     165                 :             : !! INPUTS
     166                 :             : !!  this=vector
     167                 :             : !!  size=memory size to add
     168                 :             : !!
     169                 :             : !! OUTPUT
     170                 :             : !!
     171                 :             : !! SIDE EFFECTS
     172                 :             : !!
     173                 :             : !! NOTES
     174                 :             : !!
     175                 :             : !! SOURCE
     176                 :             : 
     177                 :           0 : SUBROUTINE VectorComplex_enlarge(this, size)
     178                 :             : 
     179                 :             : !Arguments ------------------------------------
     180                 :             :   TYPE(VectorComplex)     , INTENT(INOUT)        :: this
     181                 :             :   INTEGER          , INTENT(IN   )        :: size
     182                 :             : !Local variables ------------------------------
     183                 :             :   INTEGER                                 :: width
     184                 :             :   INTEGER                                 :: tail
     185                 :           0 :   COMPLEX(KIND=8), ALLOCATABLE, DIMENSION(:) :: thistemp
     186                 :             :   INTEGER                                 :: size_val
     187                 :             : 
     188         [ #  # ]:           0 :   IF ( ALLOCATED(this%vec) ) THEN
     189                 :             :     FREEIF(thistemp)
     190                 :           0 :     width = this%size
     191                 :           0 :     tail  = this%tail
     192                 :           0 :     size_val = size
     193   [ #  #  #  #  :           0 :     MALLOC(thistemp,(1:tail))
          #  #  #  #  #  
                #  #  # ]
     194         [ #  # ]:           0 :     thistemp(1:tail) = this%vec(1:tail)
     195                 :           0 :     FREE(this%vec)
     196                 :           0 :     this%size = width + size_val
     197   [ #  #  #  #  :           0 :     MALLOC(this%vec,(1:this%size))
          #  #  #  #  #  
                #  #  # ]
     198         [ #  # ]:           0 :     this%vec(1:tail) = thistemp(1:tail)
     199         [ #  # ]:           0 :     FREE(thistemp)
     200                 :             :   ELSE
     201                 :           0 :     CALL VectorComplex_init(this, Global_SIZE)
     202                 :             :   END IF
     203                 :           0 : END SUBROUTINE VectorComplex_enlarge
     204                 :             : !!***
     205                 :             : 
     206                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_pushBack
     207                 :             : !! NAME
     208                 :             : !!  VectorComplex_pushBack
     209                 :             : !!
     210                 :             : !! FUNCTION
     211                 :             : !!  push an element at the end
     212                 :             : !!
     213                 :             : !! COPYRIGHT
     214                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     215                 :             : !!  This file is distributed under the terms of the
     216                 :             : !!  GNU General Public License, see ~abinit/COPYING
     217                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     218                 :             : !!
     219                 :             : !! INPUTS
     220                 :             : !!  this=vector
     221                 :             : !!  value=value to add
     222                 :             : !!
     223                 :             : !! OUTPUT
     224                 :             : !!
     225                 :             : !! SIDE EFFECTS
     226                 :             : !!
     227                 :             : !! NOTES
     228                 :             : !!
     229                 :             : !! SOURCE
     230                 :             : 
     231                 :           0 : SUBROUTINE VectorComplex_pushBack(this, value)
     232                 :             : 
     233                 :             : !Arguments ------------------------------------
     234                 :             :   TYPE(VectorComplex)    , INTENT(INOUT) :: this
     235                 :             :   COMPLEX(KIND=8), INTENT(IN   ) :: value
     236                 :             : !Local variables ------------------------------
     237                 :             :   INTEGER                         :: tail
     238                 :             : 
     239         [ #  # ]:           0 :   IF ( this%size .EQ. 0 ) THEN
     240                 :           0 :     CALL VectorComplex_init(this, Global_SIZE)
     241                 :             :   END IF
     242                 :           0 :   tail = this%tail
     243                 :           0 :   tail = tail + 1
     244         [ #  # ]:           0 :   IF ( tail .GT. this%size ) THEN
     245                 :           0 :     CALL VectorComplex_enlarge(this,Global_SIZE)
     246                 :             :   END IF
     247                 :           0 :   this%vec(tail) = value
     248                 :           0 :   this%tail      = tail
     249                 :           0 : END SUBROUTINE VectorComplex_pushBack
     250                 :             : !!***
     251                 :             : 
     252                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_clear
     253                 :             : !! NAME
     254                 :             : !!  VectorComplex_clear
     255                 :             : !!
     256                 :             : !! FUNCTION
     257                 :             : !!  Clear vector
     258                 :             : !!
     259                 :             : !! COPYRIGHT
     260                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     261                 :             : !!  This file is distributed under the terms of the
     262                 :             : !!  GNU General Public License, see ~abinit/COPYING
     263                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     264                 :             : !!
     265                 :             : !! INPUTS
     266                 :             : !!  this=vector
     267                 :             : !!
     268                 :             : !! OUTPUT
     269                 :             : !!
     270                 :             : !! SIDE EFFECTS
     271                 :             : !!
     272                 :             : !! NOTES
     273                 :             : !!
     274                 :             : !! SOURCE
     275                 :             : 
     276                 :           0 : SUBROUTINE VectorComplex_clear(this)
     277                 :             : 
     278                 :             : !Arguments ------------------------------------
     279                 :             :   TYPE(VectorComplex), INTENT(INOUT) :: this
     280                 :           0 :   this%tail = 0
     281                 :           0 : END SUBROUTINE VectorComplex_clear
     282                 :             : !!***
     283                 :             : 
     284                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_print
     285                 :             : !! NAME
     286                 :             : !!  VectorComplex_print
     287                 :             : !!
     288                 :             : !! FUNCTION
     289                 :             : !!  print vector
     290                 :             : !!
     291                 :             : !! COPYRIGHT
     292                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     293                 :             : !!  This file is distributed under the terms of the
     294                 :             : !!  GNU General Public License, see ~abinit/COPYING
     295                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     296                 :             : !!
     297                 :             : !! INPUTS
     298                 :             : !!  this=vector
     299                 :             : !!  ostream=file stream
     300                 :             : !!
     301                 :             : !! OUTPUT
     302                 :             : !!
     303                 :             : !! SIDE EFFECTS
     304                 :             : !!
     305                 :             : !! NOTES
     306                 :             : !!
     307                 :             : !! SOURCE
     308                 :             : 
     309                 :           0 : SUBROUTINE VectorComplex_print(this,ostream)
     310                 :             : 
     311                 :             : !Arguments ------------------------------------
     312                 :             :   TYPE(VectorComplex), INTENT(IN) :: this
     313                 :             :   INTEGER, OPTIONAL, INTENT(IN) :: ostream
     314                 :             : !Local variables ------------------------------
     315                 :             :   INTEGER                       :: ostream_val
     316                 :             :   INTEGER                       :: it1
     317                 :             :   CHARACTER(LEN=4 )             :: size
     318                 :             :   CHARACTER(LEN=15)             :: string
     319                 :             : 
     320                 :           0 :   ostream_val = 6
     321         [ #  # ]:           0 :   IF ( PRESENT(ostream) ) ostream_val = ostream
     322                 :           0 :   WRITE(size,'(I4)') this%tail
     323                 :           0 :   WRITE(ostream_val,'(A)') "("
     324                 :           0 :   string ='(1x,1ES10.2)'
     325         [ #  # ]:           0 :   DO it1 = 1, this%tail
     326                 :           0 :     WRITE(ostream_val,string) this%vec(it1)
     327                 :             :   END DO
     328                 :           0 :   WRITE(ostream_val,'(A)') ")"
     329                 :           0 : END SUBROUTINE VectorComplex_print
     330                 :             : !!***
     331                 :             : 
     332                 :             : !!****f* ABINIT/m_VectorComplex/VectorComplex_destroy
     333                 :             : !! NAME
     334                 :             : !!  VectorComplex_destroy
     335                 :             : !!
     336                 :             : !! FUNCTION
     337                 :             : !!  Destroy vector
     338                 :             : !!
     339                 :             : !! COPYRIGHT
     340                 :             : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     341                 :             : !!  This file is distributed under the terms of the
     342                 :             : !!  GNU General Public License, see ~abinit/COPYING
     343                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     344                 :             : !!
     345                 :             : !! INPUTS
     346                 :             : !!  this=vector
     347                 :             : !!
     348                 :             : !! OUTPUT
     349                 :             : !!
     350                 :             : !! SIDE EFFECTS
     351                 :             : !!
     352                 :             : !! NOTES
     353                 :             : !!
     354                 :             : !! SOURCE
     355                 :             : 
     356                 :           0 : SUBROUTINE VectorComplex_destroy(this)
     357                 :             : 
     358                 :             : !Arguments ------------------------------------
     359                 :             :   TYPE(VectorComplex), INTENT(INOUT) :: this
     360                 :             : 
     361         [ #  # ]:           0 :   FREEIF(this%vec)
     362                 :             : 
     363                 :           0 :   this%tail     = 0
     364                 :           0 :   this%size     = 0
     365                 :           0 : END SUBROUTINE VectorComplex_destroy
     366                 :             : !!***
     367                 :             : 
     368   [ #  #  #  #  :           0 : END MODULE m_VectorComplex
          #  #  #  #  #  
                #  #  # ]
     369                 :             : !!***
     370                 :             : 
        

Generated by: LCOV version 2.3-1