LCOV - code coverage report
Current view: top level - src/62_ctqmc - m_CtqmcoffdiagInterfaceComplex.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 81 0
Test Date: 2026-09-19 15:24:51 Functions: 0.0 % 7 0

            Line data    Source code
       1              : 
       2              : #if defined HAVE_CONFIG_H
       3              : #include "config.h"
       4              : #endif
       5              : !!****m* ABINIT/m_CtqmcoffdiagInterfaceComplex
       6              : !! NAME
       7              : !!  m_CtqmcoffdiagInterfaceComplex
       8              : !!
       9              : !! FUNCTION
      10              : !!  Manage a ctqmc simulation.
      11              : !!  friendly interface for the user
      12              : !!
      13              : !! COPYRIGHT
      14              : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder, B. Amadon, J. Denier)
      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_CtqmcoffdiagInterfaceComplex
      25              : USE m_CtqmcoffdiagComplex
      26              : use defs_basis
      27              : 
      28              : IMPLICIT NONE
      29              : 
      30              : !!***
      31              : 
      32              : !!****t* m_CtqmcoffdiagInterfaceComplex/CtqmcoffdiagInterfaceComplex
      33              : !! NAME
      34              : !!  CtqmcoffdiagInterfaceComplex
      35              : !!
      36              : !! FUNCTION
      37              : !!  This structured datatype contains the necessary data
      38              : !!
      39              : !! COPYRIGHT
      40              : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
      41              : !!  This file is distributed under the terms of the
      42              : !!  GNU General Public License, see ~abinit/COPYING
      43              : !!  or http://www.gnu.org/copyleft/gpl.txt .
      44              : !!
      45              : !! SOURCE
      46              : 
      47              : TYPE CtqmcoffdiagInterfaceComplex
      48              :   TYPE(CtqmcoffdiagComplex) :: Hybrid
      49              :   INTEGER :: opt_fk       = 0
      50              :   INTEGER :: opt_order    = 0
      51              :   INTEGER :: opt_histo    = 0
      52              :   INTEGER :: opt_movie    = 0
      53              :   INTEGER :: opt_analysis = 0
      54              :   INTEGER :: opt_check    = 0
      55              :   INTEGER :: opt_spectra  = 0
      56              :   INTEGER :: opt_noise    = 0
      57              :   INTEGER :: opt_gMove    = 0
      58              : END TYPE CtqmcoffdiagInterfaceComplex
      59              : !!***
      60              : 
      61              : CONTAINS
      62              : !!***
      63              : 
      64              : !!****f* ABINIT/m_CtqmcoffdiagInterfaceComplex/CtqmcoffdiagInterfaceComplex_init
      65              : !! NAME
      66              : !!  CtqmcoffdiagInterfaceComplex_init
      67              : !!
      68              : !! FUNCTION
      69              : !!  Initialize with permanent parameters
      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              : !!  op=ctqmcinterface
      79              : !!  iseed=seed for rng
      80              : !!  sweeps=number of sweeps for the run
      81              : !!  thermalization=number of sweeps to thermalize
      82              : !!  measurements=how often we measure (modulo)
      83              : !!  flavors=number of orbitals (spin degenerated)
      84              : !!  samples=imaginary time slices
      85              : !!  beta=inverse temperature
      86              : !!  U=interaction parameter
      87              : !!  ostream=where to write output
      88              : !!  MPI_COMM=mpi communicator for the run
      89              : !!  nspinor=number of spinor
      90              : !!
      91              : !! OUTPUT
      92              : !!
      93              : !! SIDE EFFECTS
      94              : !!
      95              : !! NOTES
      96              : !!
      97              : !! SOURCE
      98              : 
      99            0 : SUBROUTINE CtqmcoffdiagInterfaceComplex_init(op,iseed,sweeps,thermalization,&
     100              : &measurements,flavors,samples,beta,U,ostream,MPI_COMM,opt_nondiag,nspinor)
     101              : 
     102              : !Arguments ------------------------------------
     103              :   TYPE(CtqmcoffdiagInterfaceComplex), INTENT(INOUT) :: op
     104              :   INTEGER, OPTIONAL, INTENT(IN) :: MPI_COMM
     105              :   INTEGER, INTENT(IN) :: iseed
     106              :   DOUBLE PRECISION, INTENT(IN) :: sweeps
     107              :   INTEGER, INTENT(IN) :: thermalization
     108              :   INTEGER, INTENT(IN) :: measurements
     109              :   INTEGER, INTENT(IN) :: flavors
     110              :   INTEGER, INTENT(IN) :: samples
     111              :   !INTEGER, INTENT(IN) :: Wmax
     112              :   INTEGER, INTENT(IN) :: ostream
     113              :   INTEGER, INTENT(IN) :: opt_nondiag
     114              :   DOUBLE PRECISION, INTENT(IN) :: beta
     115              :   DOUBLE PRECISION, INTENT(IN) :: u
     116              :   INTEGER, INTENT(IN) :: nspinor
     117              :   !DOUBLE PRECISION, INTENT(IN) :: mu
     118              : !Local arguements -----------------------------
     119              :   INTEGER          :: ifstream
     120              :   DOUBLE PRECISION, DIMENSION(1:11) :: buffer
     121              : 
     122            0 :   ifstream = 42
     123              : 
     124            0 :   buffer(1)=DBLE(iseed)
     125            0 :   buffer(2)=sweeps
     126            0 :   buffer(3)=DBLE(thermalization)
     127            0 :   buffer(4)=DBLE(measurements)
     128            0 :   buffer(5)=DBLE(flavors)
     129            0 :   buffer(6)=DBLE(samples)
     130            0 :   buffer(7)=beta
     131            0 :   buffer(8)=U
     132            0 :   buffer(9)=GREENHYB_TAU
     133            0 :   buffer(10)=DBLE(opt_nondiag)
     134            0 :   buffer(11)=nspinor
     135              :   !buffer(9)=0.d0!mu
     136              :   !buffer(9)=DBLE(Wmax)
     137              : 
     138            0 :   IF ( PRESENT( MPI_COMM ) ) THEN
     139            0 :     CALL CtqmcoffdiagComplex_init(op%Hybrid, ostream, ifstream, .FALSE., MPI_COMM,buffer)
     140              :   ELSE
     141            0 :     CALL CtqmcoffdiagComplex_init(op%Hybrid, ostream, ifstream, .FALSE.,iBuffer=buffer)
     142              :   END IF
     143            0 :   op%opt_fk       = 0
     144            0 :   op%opt_order    = 0
     145            0 :   op%opt_histo    = 0
     146            0 :   op%opt_movie    = 0
     147            0 :   op%opt_analysis = 0
     148            0 :   op%opt_check    = 0
     149            0 :   op%opt_noise    = 0
     150            0 :   op%opt_spectra  = 0
     151            0 : END SUBROUTINE CtqmcoffdiagInterfaceComplex_init
     152              : !!***
     153              : 
     154              : !!****f* ABINIT/m_CtqmcoffdiagInterfaceComplex/CtqmcoffdiagInterfaceComplex_setOpts
     155              : !! NAME
     156              : !!  CtqmcoffdiagInterfaceComplex_setOpts
     157              : !!
     158              : !! FUNCTION
     159              : !!  Set and save options for many runs
     160              : !!
     161              : !! COPYRIGHT
     162              : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     163              : !!  This file is distributed under the terms of the
     164              : !!  GNU General Public License, see ~abinit/COPYING
     165              : !!  or http://www.gnu.org/copyleft/gpl.txt .
     166              : !!
     167              : !! INPUTS
     168              : !!  op=ctqmcinterface
     169              : !!  opt_Fk=0 if we give us Gw0 and 1 if 1/Gw0+iwn
     170              : !!  opt_order=maximal perturbation order to scope(>0)
     171              : !!  opt_movie=print a latex file (0 or 1)
     172              : !!  opt_analysis=measure correlations (0 or 1)
     173              : !!  opt_check=check fast calculation :0 nothing
     174              : !!                                    1 Impurity
     175              : !!                                    2 Bath
     176              : !!                                    3 Both
     177              : !!  opt_noise=calculate noise ofr green functions(0 ro 1)
     178              : !!  opt_spectra=fourier transform of time evolution of number of electrons
     179              : !!               (0 or 1)
     180              : !!  opt_gMove=number of global moves (>0)
     181              : !!
     182              : !! OUTPUT
     183              : !!
     184              : !! SIDE EFFECTS
     185              : !!
     186              : !! NOTES
     187              : !!
     188              : !! SOURCE
     189              : 
     190            0 : SUBROUTINE CtqmcoffdiagInterfaceComplex_setOpts(op,opt_Fk,opt_order,opt_histo,opt_movie,&
     191              : & opt_analysis,opt_check, opt_noise, opt_spectra, opt_gMove)
     192              : 
     193              : !Arguments ------------------------------------
     194              :   TYPE(CtqmcoffdiagInterfaceComplex), INTENT(INOUT) :: op
     195              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_Fk
     196              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_order
     197              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_histo
     198              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_movie
     199              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_analysis
     200              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_check
     201              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_noise
     202              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_spectra
     203              :   INTEGER , OPTIONAL  , INTENT(IN   ) :: opt_gMove
     204              : 
     205            0 :   IF ( PRESENT(opt_Fk) ) &
     206            0 :     op%opt_Fk = opt_fk
     207            0 :   IF ( PRESENT(opt_order) ) &
     208            0 :     op%opt_order = opt_order
     209            0 :   IF ( PRESENT(opt_histo) ) &
     210            0 :     op%opt_histo = opt_histo
     211            0 :   IF ( PRESENT(opt_analysis) ) &
     212            0 :     op%opt_analysis = opt_analysis
     213            0 :   IF ( PRESENT(opt_check) ) &
     214            0 :     op%opt_check = opt_check
     215            0 :   IF ( PRESENT(opt_movie) ) &
     216            0 :     op%opt_movie = opt_movie
     217            0 :   IF ( PRESENT(opt_noise) ) &
     218            0 :     op%opt_noise = opt_noise
     219            0 :   IF ( PRESENT(opt_spectra) ) &
     220            0 :     op%opt_spectra = opt_spectra
     221            0 :   IF ( PRESENT(opt_gMove) ) &
     222            0 :     op%opt_gMove = opt_gMove
     223              : 
     224            0 : END SUBROUTINE CtqmcoffdiagInterfaceComplex_setOpts
     225              : !!***
     226              : 
     227              : !!****f* ABINIT/m_CtqmcoffdiagInterfaceComplex/CtqmcoffdiagInterfaceComplex_run
     228              : !! NAME
     229              : !!  CtqmcoffdiagInterfaceComplex_run
     230              : !!
     231              : !! FUNCTION
     232              : !!  run a ctqmc simu and get results
     233              : !!
     234              : !! COPYRIGHT
     235              : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     236              : !!  This file is distributed under the terms of the
     237              : !!  GNU General Public License, see ~abinit/COPYING
     238              : !!  or http://www.gnu.org/copyleft/gpl.txt .
     239              : !!
     240              : !! INPUTS
     241              : !!  op=ctqmcinterface
     242              : !!  G0omega=Gw0 (according to opt_Fk)
     243              : !!  matU=interaction matrice
     244              : !!  opt_sym=weight factors to symmetrise G
     245              : !!  opt_levels=energy for each level (with respect to fermi level)
     246              : !!
     247              : !! OUTPUT
     248              : !!  Gtau=G(tau)
     249              : !!  Gw=fourier transform of Gtau
     250              : !!  D=full double occupancy
     251              : !!  E=Interaction energy
     252              : !!  Noise=Noise on E
     253              : !!
     254              : !! SIDE EFFECTS
     255              : !!
     256              : !! NOTES
     257              : !!
     258              : !! SOURCE
     259              : 
     260            0 : SUBROUTINE CtqmcoffdiagInterfaceComplex_run(op,G0omega, Gtau, Gw, D,E,Noise,matU,Docc,opt_sym,opt_levels,hybri_limit,Magmom_orb,&
     261            0 : &Magmom_spin,Magmom_tot,Iatom,fname,opthybri)
     262              : 
     263              : !Arguments ------------------------------------
     264              :   TYPE(CtqmcoffdiagInterfaceComplex), INTENT(INOUT) :: op
     265              :   COMPLEX(KIND=8)      , DIMENSION(:,:,:), INTENT(IN ) :: G0omega
     266              :   COMPLEX(KIND=8), DIMENSION(:,:,:), OPTIONAL, INTENT(OUT) :: Gtau
     267              :   COMPLEX(KIND=8)      , DIMENSION(:,:,:), OPTIONAL, INTENT(INOUT) :: Gw
     268              :   DOUBLE PRECISION, OPTIONAL      , INTENT(OUT) :: D
     269              :   DOUBLE PRECISION, OPTIONAL      , INTENT(OUT) :: E
     270              :   DOUBLE PRECISION, OPTIONAL      , INTENT(OUT) :: Noise
     271              :   COMPLEX(KIND=8), DIMENSION(:,:), OPTIONAL, INTENT(IN ) :: matU
     272              :   DOUBLE PRECISION, DIMENSION(:,:),OPTIONAL,  INTENT(OUT ) :: Docc
     273              :   DOUBLE PRECISION, DIMENSION(:,:),OPTIONAL,  INTENT(IN ) :: opt_sym
     274              :   COMPLEX(KIND=8), DIMENSION(:), OPTIONAL, INTENT(IN ) :: opt_levels
     275              :   COMPLEX(KIND=8) , DIMENSION(:,:),OPTIONAL,  INTENT(IN ) :: hybri_limit
     276              :   DOUBLE PRECISION, DIMENSION(:,:),OPTIONAL, INTENT(IN ) :: Magmom_orb
     277              :   DOUBLE PRECISION, DIMENSION(:,:),OPTIONAL, INTENT(IN ) :: Magmom_spin
     278              :   DOUBLE PRECISION, DIMENSION(:,:),OPTIONAL, INTENT(IN ) :: Magmom_tot
     279              :   INTEGER, INTENT(IN ) :: Iatom
     280              :   INTEGER, INTENT(IN ) :: opthybri
     281              :   character(len=fnlen), INTENT(INOUT) :: fname
     282              : !local variables--------------------------------
     283              : !  INTEGER :: iflavor1,iflavor2
     284              : 
     285              :  ! do iflavor1=1,10
     286              :  !   do iflavor2=1,10
     287              :  !      if(iflavor1==iflavor2) THEN
     288              :  !        write(6,*) iflavor1, iflavor2, Magmom(iflavor1,iflavor2)
     289              :  !      end if
     290              :  !   end do
     291              :  ! end do
     292              : 
     293            0 :   CALL CtqmcoffdiagComplex_reset(op%Hybrid)
     294              : 
     295            0 :   IF ( PRESENT(opt_levels)) &
     296            0 :     CALL CtqmcoffdiagComplex_setMu(op%Hybrid, opt_levels)
     297              : 
     298            0 :   IF ( PRESENT(hybri_limit)) &
     299            0 :     CALL CtqmcoffdiagComplex_sethybri_limit(op%Hybrid, hybri_limit,opthybri)
     300              : 
     301              :      !call xmpi_barrier(op%Hybrid%MY_COMM)
     302            0 :   CALL CtqmcoffdiagComplex_setG0wTab(op%Hybrid, G0omega,op%opt_fk,Iatom,fname)
     303              :      !call xmpi_barrier(op%Hybrid%MY_COMM)
     304              : 
     305            0 :   IF ( PRESENT(matU) ) &
     306            0 :     CALL CtqmcoffdiagComplex_setU(op%Hybrid, matU)
     307              :      !call xmpi_barrier(op%Hybrid%MY_COMM)
     308              : 
     309            0 :   IF ( PRESENT(Magmom_orb) ) &
     310            0 :     CALL CtqmcoffdiagComplex_setMagmom(op%Hybrid, Magmom_orb, Magmom_spin, Magmom_tot)
     311              :      !call xmpi_barrier(op%Hybrid%MY_COMM)
     312              : 
     313              : 
     314              :   CALL CtqmcoffdiagComplex_run(op%Hybrid,opt_order=op%opt_order, &
     315              :                            opt_histo=op%opt_histo, &
     316              :                            opt_movie=op%opt_movie, &
     317              :                            opt_analysis=op%opt_analysis, &
     318              :                            opt_check=op%opt_check, &
     319              :                            opt_noise=op%opt_noise, &
     320              :                            opt_spectra=op%opt_spectra, &
     321            0 :                            opt_gMove=op%opt_gMove)
     322              :      !call xmpi_barrier(op%Hybrid%MY_COMM)
     323              : 
     324              :  ! write(6,*) "op%Hybrid%stats",op%Hybrid%stats
     325              :  ! write(6,*) "opt_gMove",op%opt_gMove
     326              : 
     327            0 :   CALL CtqmcoffdiagComplex_getResult(op%Hybrid,Iatom,fname)
     328              : 
     329            0 :   IF ( PRESENT(opt_sym) ) THEN
     330            0 :     CALL CtqmcoffdiagComplex_symmetrizeGreen(op%Hybrid,opt_sym)
     331              :   END IF
     332              : 
     333              :  ! write(6,*) "op%Hybrid%stats",op%Hybrid%stats
     334              : 
     335            0 :   IF ( PRESENT(Gtau) .AND. PRESENT(Gw) ) THEN
     336            0 :     CALL CtqmcoffdiagComplex_getGreen(op%Hybrid, Gtau=Gtau, Gw=Gw)
     337              :   !      write(6,*) "size",size(Gw,dim=1),size(gw,dim=2)
     338              :   !      IF ( hybrid%rank .EQ. 0 ) write(389,*) Gw(:,hybrid%flavors+1)
     339              :   !      call flush(389)
     340            0 :   ELSE IF ( PRESENT(Gtau) .AND. .NOT. PRESENT(Gw) ) THEN
     341            0 :     CALL CtqmcoffdiagComplex_getGreen(op%Hybrid, Gtau=Gtau)
     342            0 :   ELSE IF ( .NOT. PRESENT(Gtau) .AND. PRESENT(Gw) ) THEN
     343            0 :     CALL CtqmcoffdiagComplex_getGreen(op%Hybrid, Gw=Gw)
     344              :   END IF
     345              : 
     346              :   !write(6,*) "op%Hybrid%stats",op%Hybrid%stats
     347              : 
     348            0 :   IF ( PRESENT(D) ) &
     349            0 :   CALL CtqmcoffdiagComplex_getD(op%Hybrid, D)
     350            0 :   Docc=op%Hybrid%measDE
     351              : 
     352              :   !write(6,*) "op%Hybrid%stats",op%Hybrid%stats
     353              : 
     354            0 :   IF ( PRESENT(E) .AND. PRESENT(Noise) ) &
     355            0 :   CALL CtqmcoffdiagComplex_getE(op%Hybrid, E, Noise)
     356              : 
     357            0 :   CALL CtqmcoffdiagComplex_printAll(op%Hybrid)
     358              :   !CALL CtqmcoffdiagComplex_printQMC(op%Hybrid)
     359              : 
     360            0 : END SUBROUTINE CtqmcoffdiagInterfaceComplex_run
     361              : !!***
     362              : 
     363              : !!****f* ABINIT/m_CtqmcoffdiagInterfaceComplex/CtqmcoffdiagInterfaceComplex_setSweeps
     364              : !! NAME
     365              : !!  CtqmcoffdiagInterfaceComplex_setSweeps
     366              : !!
     367              : !! FUNCTION
     368              : !!  change sweeps on the fly
     369              : !!
     370              : !! COPYRIGHT
     371              : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     372              : !!  This file is distributed under the terms of the
     373              : !!  GNU General Public License, see ~abinit/COPYING
     374              : !!  or http://www.gnu.org/copyleft/gpl.txt .
     375              : !!
     376              : !! INPUTS
     377              : !!  op=ctqmcinterface
     378              : !!  sweeps=new number of sweeps
     379              : !!
     380              : !! OUTPUT
     381              : !!
     382              : !! SIDE EFFECTS
     383              : !!
     384              : !! NOTES
     385              : !!
     386              : !! SOURCE
     387              : 
     388            0 : SUBROUTINE CtqmcoffdiagInterfaceComplex_setSweeps(op, sweeps)
     389              : 
     390              : !Arguments ------------------------------------
     391              :   TYPE(CtqmcoffdiagInterfaceComplex), INTENT(INOUT) :: op
     392              :   DOUBLE PRECISION, INTENT(IN) :: sweeps
     393              : 
     394            0 :   CALL CtqmcoffdiagComplex_setSweeps(op%Hybrid,sweeps)
     395            0 : END SUBROUTINE CtqmcoffdiagInterfaceComplex_setSweeps
     396              : !!***
     397              : 
     398              : !!****f* ABINIT/m_CtqmcoffdiagInterfaceComplex/CtqmcoffdiagInterfaceComplex_finalize
     399              : !! NAME
     400              : !!  CtqmcoffdiagInterfaceComplex_finalize
     401              : !!
     402              : !! FUNCTION
     403              : !!  Destroy simulation
     404              : !!
     405              : !! COPYRIGHT
     406              : !!  Copyright (C) 2013-2025 ABINIT group (J. Bieder)
     407              : !!  This file is distributed under the terms of the
     408              : !!  GNU General Public License, see ~abinit/COPYING
     409              : !!  or http://www.gnu.org/copyleft/gpl.txt .
     410              : !!
     411              : !! INPUTS
     412              : !!  op=ctqmcinterface
     413              : !!
     414              : !! OUTPUT
     415              : !!
     416              : !! SIDE EFFECTS
     417              : !!
     418              : !! NOTES
     419              : !!
     420              : !! SOURCE
     421              : 
     422            0 : SUBROUTINE CtqmcoffdiagInterfaceComplex_finalize(op)
     423              : 
     424              : !Arguments ------------------------------------
     425              :   TYPE(CtqmcoffdiagInterfaceComplex), INTENT(INOUT) :: op
     426              : 
     427              :   !IF ( op%Hybrid%init .EQV. .TRUE. ) THEN
     428              : !    CALL CtqmcoffdiagComplex_printAll(op%Hybrid)
     429              :          !write(6,*) "before ctqmc_destroy in CtqmcoffdiagComplexinterface_finalize"
     430            0 :     CALL CtqmcoffdiagComplex_destroy(op%Hybrid)
     431              :   !END IF
     432              : 
     433            0 : END SUBROUTINE CtqmcoffdiagInterfaceComplex_finalize
     434              : !!***
     435              : 
     436            0 : END MODULE m_CtqmcoffdiagInterfaceComplex
     437              : !!***
        

Generated by: LCOV version 2.3-1