LCOV - code coverage report
Current view: top level - src/62_ctqmc - m_CtqmcInterface.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 88.3 % 120 106
Test Date: 2026-11-09 20:57:54 Functions: 57.1 % 7 4
Branches: 32.5 % 412 134

             Branch data     Line data    Source code
       1                 :             : 
       2                 :             : #if defined HAVE_CONFIG_H
       3                 :             : #include "config.h"
       4                 :             : #endif
       5                 :             : !!****m* ABINIT/m_CtqmcInterface
       6                 :             : !! NAME
       7                 :             : !!  m_CtqmcInterface
       8                 :             : !!
       9                 :             : !! FUNCTION
      10                 :             : !!  Manage a ctqmc simulation.
      11                 :             : !!  friendly interface for the user
      12                 :             : !!
      13                 :             : !! COPYRIGHT
      14                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
      15                 :             : !!  This file is distributed under the terms of the
      16                 :             : !!  GNU General Public License, see ~abinit/COPYING
      17                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      18                 :             : !!
      19                 :             : !! NOTES
      20                 :             : !!
      21                 :             : !! SOURCE
      22                 :             : 
      23                 :             : #include "defs.h"
      24                 :             : MODULE m_CtqmcInterface
      25                 :             : USE m_Ctqmc
      26                 :             : USE m_global
      27                 :             : 
      28                 :             : IMPLICIT NONE
      29                 :             : 
      30                 :             : !!***
      31                 :             : 
      32                 :             : PRIVATE
      33                 :             : 
      34                 :             : !!****t* m_CtqmcInterface/CtqmcInterface
      35                 :             : !! NAME
      36                 :             : !!  CtqmcInterface
      37                 :             : !!
      38                 :             : !! FUNCTION
      39                 :             : !!  This structured datatype contains the necessary data
      40                 :             : !!
      41                 :             : !! COPYRIGHT
      42                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
      43                 :             : !!  This file is distributed under the terms of the
      44                 :             : !!  GNU General Public License, see ~abinit/COPYING
      45                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      46                 :             : !!
      47                 :             : !! SOURCE
      48                 :             : 
      49                 :             : TYPE, PUBLIC :: CtqmcInterface
      50                 :             :   TYPE(Ctqmc), POINTER        :: Hybrid
      51                 :             :   TYPE(Ctqmc), ALLOCATABLE    :: Hybrid_chains(:)
      52                 :             :   INTEGER _PRIVATE :: num_chains   = 1
      53                 :             :   INTEGER _PRIVATE :: opt_fk       = 0
      54                 :             :   INTEGER _PRIVATE :: opt_order    = 0
      55                 :             :   INTEGER _PRIVATE :: opt_histo    = 0
      56                 :             :   INTEGER _PRIVATE :: opt_movie    = 0
      57                 :             :   INTEGER _PRIVATE :: opt_analysis = 0
      58                 :             :   INTEGER _PRIVATE :: opt_check    = 0
      59                 :             :   INTEGER _PRIVATE :: opt_spectra  = 0
      60                 :             :   INTEGER _PRIVATE :: opt_noise    = 0
      61                 :             :   INTEGER _PRIVATE :: opt_gMove    = 0
      62                 :             : END TYPE CtqmcInterface
      63                 :             : !!***
      64                 :             : 
      65                 :             : PUBLIC :: CtqmcInterface_init
      66                 :             : PUBLIC :: CtqmcInterface_setOpts
      67                 :             : PUBLIC :: CtqmcInterface_run
      68                 :             : PUBLIC :: CtqmcInterface_setSweeps
      69                 :             : PUBLIC :: CtqmcInterface_finalize
      70                 :             : 
      71                 :             : CONTAINS
      72                 :             : !!***
      73                 :             : 
      74                 :             : !!****f* ABINIT/m_CtqmcInterface/CtqmcInterface_init
      75                 :             : !! NAME
      76                 :             : !!  CtqmcInterface_init
      77                 :             : !!
      78                 :             : !! FUNCTION
      79                 :             : !!  Initialize with permanent parameters
      80                 :             : !!
      81                 :             : !! COPYRIGHT
      82                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
      83                 :             : !!  This file is distributed under the terms of the
      84                 :             : !!  GNU General Public License, see ~abinit/COPYING
      85                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      86                 :             : !!
      87                 :             : !! INPUTS
      88                 :             : !!  this=ctqmcinterface
      89                 :             : !!  iseed=seed for rng
      90                 :             : !!  sweeps=number of sweeps for the run
      91                 :             : !!  thermalization=number of sweeps to thermalize
      92                 :             : !!  measurements=how often we measure (modulo)
      93                 :             : !!  flavors=number of orbitals (spin degenerated)
      94                 :             : !!  samples=imaginary time slices
      95                 :             : !!  beta=inverse temperature
      96                 :             : !!  U=interaction parameter
      97                 :             : !!  ostream=where to write output
      98                 :             : !!  MPI_COMM=mpi communicator for the run
      99                 :             : !!
     100                 :             : !! OUTPUT
     101                 :             : !!
     102                 :             : !! SIDE EFFECTS
     103                 :             : !!
     104                 :             : !! NOTES
     105                 :             : !!
     106                 :             : !! SOURCE
     107                 :             : 
     108                 :          72 : SUBROUTINE CtqmcInterface_init(this,iseed,sweeps,thermalization,measurements,flavors,samples,beta,U,ostream,num_chains,&
     109                 :             : &    MPI_COMM,nspinor)
     110                 :             : 
     111                 :             : !Arguments ------------------------------------
     112                 :             :   TYPE(CtqmcInterface), INTENT(INOUT), TARGET :: this
     113                 :             :   INTEGER, OPTIONAL, INTENT(IN) :: MPI_COMM
     114                 :             :   INTEGER, INTENT(IN) :: iseed
     115                 :             :   DOUBLE PRECISION, INTENT(IN) :: sweeps
     116                 :             :   INTEGER, INTENT(IN) :: thermalization
     117                 :             :   INTEGER, INTENT(IN) :: measurements
     118                 :             :   INTEGER, INTENT(IN) :: flavors
     119                 :             :   INTEGER, INTENT(IN) :: samples
     120                 :             :   !INTEGER, INTENT(IN) :: Wmax
     121                 :             :   INTEGER, INTENT(IN) :: ostream
     122                 :             :   INTEGER, INTENT(IN) :: num_chains
     123                 :             :   INTEGER, INTENT(IN) :: nspinor
     124                 :             :   DOUBLE PRECISION, INTENT(IN) :: beta
     125                 :             :   DOUBLE PRECISION, INTENT(IN) :: u
     126                 :             :   !DOUBLE PRECISION, INTENT(IN) :: mu
     127                 :             : !Local arguements -----------------------------
     128                 :             :   INTEGER          :: ifstream,ichain!,opt_nondiag
     129                 :             :   DOUBLE PRECISION, DIMENSION(1:10) :: buffer
     130                 :             :  ! opt_nondiag=0
     131                 :             : 
     132                 :          72 :   ifstream = 42
     133                 :             : 
     134                 :          72 :   buffer(1)=DBLE(iseed)
     135                 :          72 :   buffer(2)=sweeps
     136                 :          72 :   buffer(3)=DBLE(thermalization)
     137                 :          72 :   buffer(4)=DBLE(measurements)
     138                 :          72 :   buffer(5)=DBLE(flavors)
     139                 :          72 :   buffer(6)=DBLE(samples)
     140                 :          72 :   buffer(7)=beta
     141                 :          72 :   buffer(8)=U
     142                 :          72 :   buffer(9)=GREENHYB_TAU
     143                 :          72 :   buffer(10)=nspinor
     144                 :             :  ! buffer(10)=DBLE(opt_nondiag)
     145                 :             :   !buffer(9)=0.d0!mu
     146                 :             :   !buffer(9)=DBLE(Wmax)
     147                 :          72 :   this%num_chains = num_chains
     148   [ -  +  +  -  :         666 :   MALLOC(this%Hybrid_chains, (this%num_chains))
          +  -  +  -  -  
          +  -  +  -  +  
          +  +  +  +  -  
          +  -  +  -  -  
          -  -  -  -  -  
          -  -  -  -  -  
          -  -  -  +  -  
          +  -  +  +  +  
                   -  + ]
     149                 :          72 :   this%Hybrid => this%Hybrid_chains(1)
     150         [ +  - ]:          72 :   IF ( PRESENT( MPI_COMM ) ) THEN
     151                 :          72 :     CALL Ctqmc_init(this%Hybrid, ostream, ifstream, .FALSE., MY_COMM=MPI_COMM,iBuffer=buffer)
     152                 :             :   ELSE
     153                 :           0 :     CALL Ctqmc_init(this%Hybrid, ostream, ifstream, .FALSE.,iBuffer=buffer)
     154                 :             :   END IF
     155         [ +  + ]:          72 :   if(this%num_chains > 1) then
     156         [ +  + ]:          40 :     do ichain=2,this%num_chains
     157         [ +  - ]:          40 :       IF ( PRESENT( MPI_COMM ) ) THEN
     158                 :          30 :         CALL Ctqmc_init(this%Hybrid_chains(ichain), ostream, ifstream, .FALSE., MY_COMM=MPI_COMM,iBuffer=buffer)
     159                 :             :       ELSE
     160                 :           0 :         CALL Ctqmc_init(this%Hybrid_chains(ichain), ostream, ifstream, .FALSE.,iBuffer=buffer)
     161                 :             :       END IF
     162                 :             :     end do
     163                 :             :   end if
     164                 :          72 :   this%opt_fk       = 0
     165                 :          72 :   this%opt_order    = 0
     166                 :          72 :   this%opt_histo    = 0
     167                 :          72 :   this%opt_movie    = 0
     168                 :          72 :   this%opt_analysis = 0
     169                 :          72 :   this%opt_check    = 0
     170                 :          72 :   this%opt_noise    = 0
     171                 :          72 :   this%opt_spectra  = 0
     172                 :          72 : END SUBROUTINE CtqmcInterface_init
     173                 :             : !!***
     174                 :             : 
     175                 :             : !!****f* ABINIT/m_CtqmcInterface/CtqmcInterface_setOpts
     176                 :             : !! NAME
     177                 :             : !!  CtqmcInterface_setOpts
     178                 :             : !!
     179                 :             : !! FUNCTION
     180                 :             : !!  Set and save options for many runs
     181                 :             : !!
     182                 :             : !! COPYRIGHT
     183                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
     184                 :             : !!  This file is distributed under the terms of the
     185                 :             : !!  GNU General Public License, see ~abinit/COPYING
     186                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     187                 :             : !!
     188                 :             : !! INPUTS
     189                 :             : !!  this=ctqmcinterface
     190                 :             : !!  opt_Fk=0 if we give us Gw0 and 1 if 1/Gw0+iwn
     191                 :             : !!  opt_order=maximal perturbation order to scope(>0)
     192                 :             : !!  opt_movie=print a latex file (0 or 1)
     193                 :             : !!  opt_analysis=measure correlations (0 or 1)
     194                 :             : !!  opt_check=check fast calculation :0 nothing
     195                 :             : !!                                    1 Impurity
     196                 :             : !!                                    2 Bath
     197                 :             : !!                                    3 Both
     198                 :             : !!  opt_noise=calculate noise ofr green functions(0 ro 1)
     199                 :             : !!  opt_spectra=fourier transform of time evolution of number of electrons
     200                 :             : !!               (0 or 1)
     201                 :             : !!  opt_gMove=number of global moves (>0)
     202                 :             : !!
     203                 :             : !! OUTPUT
     204                 :             : !!
     205                 :             : !! SIDE EFFECTS
     206                 :             : !!
     207                 :             : !! NOTES
     208                 :             : !!
     209                 :             : !! SOURCE
     210                 :             : 
     211                 :          72 : SUBROUTINE CtqmcInterface_setOpts(this,opt_Fk,opt_order,opt_histo,opt_movie,&
     212                 :             : & opt_analysis,opt_check, opt_noise, opt_spectra, opt_gMove)
     213                 :             : 
     214                 :             : !Arguments ------------------------------------
     215                 :             :   TYPE(CtqmcInterface), INTENT(INOUT) :: this
     216                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_Fk
     217                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_order
     218                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_histo
     219                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_movie
     220                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_analysis
     221                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_check
     222                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_noise
     223                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_spectra
     224                 :             :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_gMove
     225                 :             : 
     226         [ +  - ]:          72 :   IF ( PRESENT(opt_Fk) ) &
     227                 :          72 :     this%opt_Fk = opt_fk
     228         [ +  - ]:          72 :   IF ( PRESENT(opt_order) ) &
     229                 :          72 :     this%opt_order = opt_order
     230         [ +  - ]:          72 :   IF ( PRESENT(opt_histo) ) &
     231                 :          72 :     this%opt_histo = opt_histo
     232         [ +  - ]:          72 :   IF ( PRESENT(opt_analysis) ) &
     233                 :          72 :     this%opt_analysis = opt_analysis
     234         [ +  - ]:          72 :   IF ( PRESENT(opt_check) ) &
     235                 :          72 :     this%opt_check = opt_check
     236         [ +  - ]:          72 :   IF ( PRESENT(opt_movie) ) &
     237                 :          72 :     this%opt_movie = opt_movie
     238         [ +  - ]:          72 :   IF ( PRESENT(opt_noise) ) &
     239                 :          72 :     this%opt_noise = opt_noise
     240         [ +  - ]:          72 :   IF ( PRESENT(opt_spectra) ) &
     241                 :          72 :     this%opt_spectra = opt_spectra
     242         [ +  - ]:          72 :   IF ( PRESENT(opt_gMove) ) &
     243                 :          72 :     this%opt_gMove = opt_gMove
     244                 :             : 
     245                 :          72 : END SUBROUTINE CtqmcInterface_setOpts
     246                 :             : !!***
     247                 :             : 
     248                 :             : !!****f* ABINIT/m_CtqmcInterface/CtqmcInterface_run
     249                 :             : !! NAME
     250                 :             : !!  CtqmcInterface_run
     251                 :             : !!
     252                 :             : !! FUNCTION
     253                 :             : !!  run a ctqmc simu and get results
     254                 :             : !!
     255                 :             : !! COPYRIGHT
     256                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
     257                 :             : !!  This file is distributed under the terms of the
     258                 :             : !!  GNU General Public License, see ~abinit/COPYING
     259                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     260                 :             : !!
     261                 :             : !! INPUTS
     262                 :             : !!  this=ctqmcinterface
     263                 :             : !!  G0omega=Gw0 (according to opt_Fk)
     264                 :             : !!  matU=interaction matrice
     265                 :             : !!  opt_sym=weight factors to symmetrise G
     266                 :             : !!  opt_levels=energy for each level (with respect to fermi level)
     267                 :             : !!
     268                 :             : !! OUTPUT
     269                 :             : !!  Gtau=G(tau)
     270                 :             : !!  Gw=fourier transform of Gtau
     271                 :             : !!  D=full double occupancy
     272                 :             : !!  E=Interaction energy
     273                 :             : !!  Noise=Noise on E
     274                 :             : !!
     275                 :             : !! SIDE EFFECTS
     276                 :             : !!
     277                 :             : !! NOTES
     278                 :             : !!
     279                 :             : !! SOURCE
     280                 :             : 
     281   [ +  -  +  -  :          34 : SUBROUTINE CtqmcInterface_run(this,G0omega, Gtau, Gw, D,E,Noise,matU,opt_sym,opt_levels,Magmom_orb,Magmom_spin,Magmom_tot,Iatom, &
          -  +  -  +  +  
          -  +  -  -  +  
          +  -  +  -  -  
          +  +  -  +  -  
          -  +  +  -  +  
          -  -  +  -  +  
          -  -  -  -  +  
          -  +  -  -  +  
          +  -  +  -  -  
          +  +  -  +  -  
                   -  + ]
     282                 :             : &fname)
     283                 :             : 
     284                 :             : !Arguments ------------------------------------
     285                 :             :   TYPE(CtqmcInterface), INTENT(INOUT) :: this
     286                 :             :   COMPLEX(KIND=8) , DIMENSION(:,:)          , INTENT(IN   ) :: G0omega
     287                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(  OUT) :: Gtau
     288                 :             :   COMPLEX(KIND=8) , DIMENSION(:,:), OPTIONAL, INTENT(INOUT) :: Gw
     289                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(  OUT) :: D
     290                 :             :   DOUBLE PRECISION                , OPTIONAL, INTENT(  OUT) :: E
     291                 :             :   DOUBLE PRECISION                , OPTIONAL, INTENT(  OUT) :: Noise
     292                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(IN   ) :: matU
     293                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(IN   ) :: opt_sym
     294                 :             :   DOUBLE PRECISION, DIMENSION(:  ), OPTIONAL, INTENT(IN   ) :: opt_levels
     295                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(IN ) :: Magmom_orb
     296                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(IN ) :: Magmom_spin
     297                 :             :   DOUBLE PRECISION, DIMENSION(:,:), OPTIONAL, INTENT(IN ) :: Magmom_tot
     298                 :             :   INTEGER, INTENT(IN )  :: Iatom
     299                 :             :   INTEGER               :: base_seed,ichain
     300                 :             :   character(len=fnlen), INTENT(INOUT) :: fname
     301                 :          34 :   CALL Ctqmc_reset(this%Hybrid)
     302         [ +  + ]:          34 :   if(this%num_chains > 1) then
     303         [ +  + ]:          20 :     do ichain=2,this%num_chains
     304                 :          20 :       CALL Ctqmc_reset(this%Hybrid_chains(ichain))
     305                 :             :     end do
     306                 :             :   end if
     307                 :             : 
     308                 :             : !  ifstream = 42
     309                 :             : !
     310                 :             : !  OPEN(UNIT=ifstream, FILE="Gw.dat")
     311                 :             : !  CALL Ctqmc_setG0w(Hybrid, ifstream)
     312                 :             : !  CLOSE(ifstream)
     313                 :             : !
     314                 :             : 
     315         [ +  - ]:          34 :   IF ( PRESENT(opt_levels) ) &
     316                 :          34 :     CALL Ctqmc_setMu(this%Hybrid, opt_levels)
     317                 :             : 
     318                 :          34 :   CALL Ctqmc_setG0wTab(this%Hybrid, G0omega,this%opt_fk)
     319                 :             : 
     320         [ +  - ]:          34 :   IF ( PRESENT(matU) ) &
     321                 :          34 :     CALL Ctqmc_setU(this%Hybrid, matU)
     322                 :             : 
     323         [ +  - ]:          34 :   IF ( PRESENT(Magmom_orb) ) &
     324                 :          34 :     CALL Ctqmc_setMagmom(this%Hybrid, Magmom_orb, Magmom_spin, Magmom_tot)
     325                 :             : 
     326         [ +  + ]:          34 :   if(this%num_chains > 1) then
     327         [ +  + ]:          20 :     do ichain=2,this%num_chains
     328         [ +  - ]:          15 :       IF ( PRESENT(opt_levels) ) &
     329                 :          15 :         CALL Ctqmc_setMu(this%Hybrid_chains(ichain), opt_levels)
     330                 :             : 
     331                 :          15 :       CALL Ctqmc_setG0wTab(this%Hybrid_chains(ichain), G0omega,this%opt_fk)
     332                 :             : 
     333         [ +  - ]:          15 :       IF ( PRESENT(matU) ) &
     334                 :          15 :         CALL Ctqmc_setU(this%Hybrid_chains(ichain), matU)
     335                 :             : 
     336         [ +  - ]:          15 :       IF ( PRESENT(Magmom_orb) ) &
     337                 :          20 :         CALL Ctqmc_setMagmom(this%Hybrid_chains(ichain), Magmom_orb, Magmom_spin, Magmom_tot)
     338                 :             :     end do
     339                 :             :   end if
     340                 :             : 
     341         [ +  + ]:          34 :   IF (this%Hybrid_chains(1)%rank == 0) THEN
     342                 :             :     WRITE(this%Hybrid_chains(1)%ostream,'(a,i0,a)') &
     343                 :          19 :       ' Ctqmc_run_parallel: Using ', this%num_chains, ' OpenMP chains'
     344                 :             :   END IF
     345                 :             : 
     346                 :             :   ! If only 1 chain requested, just run serial version directly
     347         [ +  + ]:          34 :   IF (this%num_chains == 1) THEN
     348         [ +  + ]:          29 :     IF (this%Hybrid_chains(1)%rank == 0) THEN
     349                 :             :       WRITE(this%Hybrid_chains(1)%ostream,'(a)') &
     350                 :          17 :         'Running single chain (serial mode)'
     351                 :             :     END IF
     352                 :             :     CALL Ctqmc_run(this%Hybrid_chains(1), &
     353                 :             :                    opt_order=this%opt_order, &
     354                 :             :                    opt_histo=this%opt_histo, &
     355                 :             :                    opt_movie=this%opt_movie, &
     356                 :             :                    opt_analysis=this%opt_analysis, &
     357                 :             :                    opt_check=this%opt_check, &
     358                 :             :                    opt_noise=this%opt_noise, &
     359                 :             :                    opt_spectra=this%opt_spectra, &
     360                 :          29 :                    opt_gMove=this%opt_gMove)
     361                 :             :   ELSE
     362                 :             : 
     363         [ +  + ]:           5 :     IF (this%Hybrid_chains(1)%rank == 0) THEN
     364                 :             :       WRITE(this%Hybrid_chains(1)%ostream,'(a,i0,a)') &
     365                 :           2 :         'Running ', this%num_chains, ' parallel CTQMC chains with OpenMP threads'
     366                 :             :     END IF
     367                 :             : 
     368                 :             : 
     369                 :             :     ! Save base seed and check template integrity
     370                 :           5 :     base_seed = this%Hybrid_chains(1)%seed
     371                 :             : 
     372                 :             :     ! Copy template to each chain and set unique seed
     373         [ +  + ]:          25 :     DO ichain = 1, this%num_chains
     374                 :             :       ! Each chain gets a unique seed offset
     375                 :          20 :       this%Hybrid_chains(ichain)%seed = base_seed + (ichain - 1)*this%Hybrid%size
     376                 :          20 :       this%Hybrid_chains(ichain)%sweeps = this%Hybrid_chains(ichain)%sweeps / this%num_chains
     377                 :          25 :       this%Hybrid_chains(ichain)%tid = ichain
     378                 :             :     END DO
     379                 :             : 
     380                 :             :     ! Run chains in parallel
     381                 :             :     !$omp parallel default(shared) private(ichain)
     382                 :             :     !$omp do schedule(static)
     383         [ +  + ]:          25 :     DO ichain = 1, this%num_chains
     384                 :             :       ! Each thread runs one chain
     385         [ +  + ]:          20 :       IF (this%Hybrid_chains(1)%rank == 0) THEN
     386                 :             :         !$omp critical
     387                 :             :         WRITE(this%Hybrid_chains(1)%ostream,'(a,i0,a,i0,a,i0)') &
     388                 :           8 :           '   Thread ', xomp_get_thread_num(), ' running chain ', ichain, &
     389                 :          16 :           ' with seed ', this%Hybrid_chains(ichain)%seed
     390                 :             :         !$omp end critical
     391                 :             :       END IF
     392                 :             : 
     393                 :             :       ! Call with optional parameters
     394                 :             :       CALL Ctqmc_run(this%Hybrid_chains(ichain), &
     395                 :             :                      opt_order=this%opt_order, &
     396                 :             :                      opt_histo=this%opt_histo, &
     397                 :             :                      opt_movie=this%opt_movie, &
     398                 :             :                      opt_analysis=this%opt_analysis, &
     399                 :             :                      opt_check=this%opt_check, &
     400                 :             :                      opt_noise=this%opt_noise, &
     401                 :             :                      opt_spectra=this%opt_spectra, &
     402                 :          25 :                      opt_gMove=this%opt_gMove)
     403                 :             :     END DO
     404                 :             :     !$omp end do
     405                 :             :     !$omp end parallel
     406                 :             : 
     407                 :             :   END IF
     408                 :             : 
     409                 :          34 :   CALL Ctqmc_getResult(this%Hybrid,this%num_chains,this%Hybrid_chains,Iatom,fname)
     410                 :             : 
     411         [ -  + ]:          34 :   IF ( PRESENT(opt_sym) ) THEN
     412                 :           0 :     CALL Ctqmc_symmetrizeGreen(this%Hybrid,opt_sym)
     413                 :             :   END IF
     414                 :             : 
     415         [ +  - ]:          34 :   IF ( PRESENT(Gtau) .AND. PRESENT(Gw) ) THEN
     416                 :          34 :     CALL Ctqmc_getGreen(this%Hybrid, Gtau=Gtau, Gw=Gw)
     417                 :             :   !      write(6,*) "size",size(Gw,dim=1),size(gw,dim=2)
     418                 :             :   !      IF ( hybrid%rank .EQ. 0 ) write(389,*) Gw(:,hybrid%flavors+1)
     419                 :             :   !      call flush(389)
     420         [ #  # ]:           0 :   ELSE IF ( PRESENT(Gtau) .AND. .NOT. PRESENT(Gw) ) THEN
     421         [ #  # ]:           0 :     CALL Ctqmc_getGreen(this%Hybrid, Gtau=Gtau)
     422         [ #  # ]:           0 :   ELSE IF ( .NOT. PRESENT(Gtau) .AND. PRESENT(Gw) ) THEN
     423         [ #  # ]:           0 :     CALL Ctqmc_getGreen(this%Hybrid, Gw=Gw)
     424                 :             :   END IF
     425                 :             : 
     426         [ +  - ]:          34 :   IF ( PRESENT(D) ) &
     427                 :          34 :   CALL Ctqmc_getD(this%Hybrid, D)
     428                 :             : 
     429         [ -  + ]:          34 :   IF ( PRESENT(E) .AND. PRESENT(Noise) ) THEN
     430                 :           0 :     CALL Ctqmc_getE(this%Hybrid, E=E, Noise=Noise)
     431         [ +  - ]:          34 :   ELSE IF ( PRESENT(E) .AND. .NOT. PRESENT(Noise) ) THEN
     432                 :          34 :     CALL Ctqmc_getE(this%Hybrid, E=E)
     433         [ #  # ]:           0 :   ELSE IF ( .NOT. PRESENT(E) .AND. PRESENT(Noise) ) THEN
     434                 :           0 :     CALL Ctqmc_getE(this%Hybrid, Noise=noise)
     435                 :             :   END IF
     436                 :             : 
     437                 :             : 
     438                 :          34 :   CALL Ctqmc_printAll(this%Hybrid, this%num_chains)
     439                 :             :   !CALL Ctqmc_printQMC(this%Hybrid)
     440                 :             : 
     441                 :          34 : END SUBROUTINE CtqmcInterface_run
     442                 :             : !!***
     443                 :             : 
     444                 :             : !!****f* ABINIT/m_CtqmcInterface/CtqmcInterface_setSweeps
     445                 :             : !! NAME
     446                 :             : !!  CtqmcInterface_setSweeps
     447                 :             : !!
     448                 :             : !! FUNCTION
     449                 :             : !!  change sweeps on the fly
     450                 :             : !!
     451                 :             : !! COPYRIGHT
     452                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
     453                 :             : !!  This file is distributed under the terms of the
     454                 :             : !!  GNU General Public License, see ~abinit/COPYING
     455                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     456                 :             : !!
     457                 :             : !! INPUTS
     458                 :             : !!  this=ctqmcinterface
     459                 :             : !!  sweeps=new number of sweeps
     460                 :             : !!
     461                 :             : !! OUTPUT
     462                 :             : !!
     463                 :             : !! SIDE EFFECTS
     464                 :             : !!
     465                 :             : !! NOTES
     466                 :             : !!
     467                 :             : !! SOURCE
     468                 :             : 
     469                 :           0 : SUBROUTINE CtqmcInterface_setSweeps(this, sweeps)
     470                 :             : 
     471                 :             : !Arguments ------------------------------------
     472                 :             :   TYPE(CtqmcInterface), INTENT(INOUT) :: this
     473                 :             :   DOUBLE PRECISION, INTENT(IN) :: sweeps
     474                 :             : 
     475                 :           0 :   CALL Ctqmc_setSweeps(this%Hybrid,sweeps)
     476                 :           0 : END SUBROUTINE CtqmcInterface_setSweeps
     477                 :             : !!***
     478                 :             : 
     479                 :             : !!****f* ABINIT/m_CtqmcInterface/CtqmcInterface_finalize
     480                 :             : !! NAME
     481                 :             : !!  CtqmcInterface_finalize
     482                 :             : !!
     483                 :             : !! FUNCTION
     484                 :             : !!  Destroy simulation
     485                 :             : !!
     486                 :             : !! COPYRIGHT
     487                 :             : !!  Copyright (C) 2013-2026 ABINIT group (J. Bieder)
     488                 :             : !!  This file is distributed under the terms of the
     489                 :             : !!  GNU General Public License, see ~abinit/COPYING
     490                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
     491                 :             : !!
     492                 :             : !! INPUTS
     493                 :             : !!  this=ctqmcinterface
     494                 :             : !!
     495                 :             : !! OUTPUT
     496                 :             : !!
     497                 :             : !! SIDE EFFECTS
     498                 :             : !!
     499                 :             : !! NOTES
     500                 :             : !!
     501                 :             : !! SOURCE
     502                 :             : 
     503                 :         100 : SUBROUTINE CtqmcInterface_finalize(this)
     504                 :             : 
     505                 :             : !Arguments ------------------------------------
     506                 :             :   TYPE(CtqmcInterface), INTENT(INOUT) :: this
     507                 :             :   INTEGER :: ichain
     508                 :             : 
     509                 :             :   !IF ( this%Hybrid%init .EQV. .TRUE. ) THEN
     510                 :             : !    CALL Ctqmc_printAll(this%Hybrid)
     511         [ +  + ]:         100 :   if(allocated(this%Hybrid_chains)) then
     512         [ +  + ]:         174 :     do ichain=1,this%num_chains
     513                 :         174 :       CALL Ctqmc_destroy(this%Hybrid_chains(ichain))
     514                 :             :     end do
     515   [ +  -  +  +  :         378 :     FREE(this%Hybrid_chains)
          -  +  -  +  -  
          -  -  -  -  -  
          -  -  -  -  -  
          -  -  -  -  +  
          -  +  -  +  +  
          +  -  +  -  +  
          -  -  -  -  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  -  -  
          -  -  -  -  -  
          -  +  -  -  -  
          -  -  -  -  -  
          -  +  -  +  -  
          +  -  +  -  +  
          -  -  -  -  -  
          +  -  +  -  +  
             -  +  -  + ]
     516                 :             :   end if
     517                 :             :   !END IF
     518                 :             : 
     519                 :         100 : END SUBROUTINE CtqmcInterface_finalize
     520                 :             : !!***
     521                 :             : 
     522   [ #  #  #  #  :           0 : END MODULE m_CtqmcInterface
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     523                 :             : !!***
        

Generated by: LCOV version 2.3-1