Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aamaricci/EDIpack2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aamaricci committed Oct 31, 2024
2 parents 59ab5d9 + 1770f7b commit dde8474
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 31 deletions.
2 changes: 1 addition & 1 deletion doc/structure/io/ed_io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Input / Output Functions
=========================


The module :f:mod:`ED_IO` contains a set of functions that retrieve quantities such as Green's function, self-energy and observables and pass them to the user.
The module :f:mod:`ED_IO` contains a set of functions that retrieve quantities such as Green's functions self-energies (see :f:mod:`ed_greens_functions` ) and observables (from :f:mod:`ed_observables` ) and pass them to the user.

.. f:automodule:: ed_io
8 changes: 3 additions & 5 deletions doc/structure/nonsu2/05_observables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ Observables
============================




How observables are generated


In the :code:`nonsu2` case, the following observables are calculated in addition tp the :code:`normal` ones

.. f:automodule:: ed_observables_nonsu2
:members: magx,magy,exct_tx,exct_ty,observables_nonsu2,local_energy_nonsu2




Expand Down
1 change: 1 addition & 0 deletions doc/structure/normal/05_observables.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Observables
============================

In the :code:`normal` case, the following observables are calculated

.. f:automodule:: ed_observables_normal
:forceadd-members: dens,dens_up,dens_dw,docc,magz,n2,sz2,exct_s0,exct_tz,zimp,simp,dens_ph,X_ph, X2_ph,s2tot,Egs,Prob,prob_ph,pdf_ph,pdf_part,w_ph,prob_distr_ph,get_szr,write_legend,write_energy_info,write_observables,write_energy,write_pdf,prob_distr_ph,hermite
Expand Down
14 changes: 7 additions & 7 deletions src/ED_GREENS_FUNCTIONS.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ subroutine buildGF_impurity()
! Build the quantum impurity electrons Green's functions :math:`\hat{G}` , the self-energy :math:`\hat{\Sigma}` and the phonons Green's function :math:`\hat{D}` , calling the correct procedure according to the value of :f:var:`ed_mode` .
! Write the results on file according to the values of input variables :f:var:`ed_print_g` , :f:var:`ed_print_sigma` and :f:var:`ed_print_g0` .
!
! * :f:var:`normal` : :f:var:`build_gf_normal` and :f:var:`build_sigma_normal`
! * :f:var:`superc` : :f:var:`build_gf_superc` and :f:var:`build_sigma_superc`
! * :f:var:`nonsu2` : :f:var:`build_gf_nonsu2` and :f:var:`build_sigma_nonsu2`
! * :code:`normal` : :f:func:`build_gf_normal` and :f:func:`build_sigma_normal`
! * :code:`superc` : :f:func:`build_gf_superc` and :f:func:`build_sigma_superc`
! * :code:`nonsu2` : :f:func:`build_gf_nonsu2` and :f:func:`build_sigma_nonsu2`
!
!
#ifdef _DEBUG
Expand Down Expand Up @@ -96,11 +96,11 @@ end subroutine buildGF_impurity

subroutine rebuildGF_impurity()
! Re-build the quantum impurity electrons Green's functions :math:`\hat{G}` , the self-energy :math:`\hat{\Sigma}` and the phonons Green's function :math:`\hat{D}` , calling the correct procedure according to the value of :f:var:`ed_mode` using the :f:var:`impgmatrix` .
! Write the results on file according to the values of input variables :f:var:`ed_print_g` , :f:var:`ed_print_sigma` and :f:var:`ed_print_g0` .
! Write the results on file according to the values of input variables :f:func:`ed_print_g` , :f:func:`ed_print_sigma` and :f:func:`ed_print_g0` .
!
! * :f:var:`normal` : :f:var:`rebuild_gf_normal` and :f:var:`build_sigma_normal`
! * :f:var:`superc` : :f:var:`rebuild_gf_superc` and :f:var:`build_sigma_superc`
! * :f:var:`nonsu2` : :f:var:`rebuild_gf_nonsu2` and :f:var:`build_sigma_nonsu2`
! * :code:`normal` : :f:func:`rebuild_gf_normal` and :f:func:`build_sigma_normal`
! * :code:`superc` : :f:func:`rebuild_gf_superc` and :f:func:`build_sigma_superc`
! * :code:`nonsu2` : :f:func:`rebuild_gf_nonsu2` and :f:func:`build_sigma_nonsu2`
#ifdef _DEBUG
write(Logfile,"(A)")"DEBUG rebuild_GF: re-building GF"
#endif
Expand Down
38 changes: 26 additions & 12 deletions src/ED_NONSU2/ED_OBSERVABLES_NONSU2.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
MODULE ED_OBSERVABLES_NONSU2
!This module calculates a series of observables, and stores them in aptly named plain-text files. :f:var:`ed_mode` = :code:`nonsu2`
USE SF_CONSTANTS, only:zero,pi,xi
USE SF_IOTOOLS, only:free_unit,reg,txtfy
USE SF_ARRAYS, only: arange
Expand All @@ -20,18 +21,24 @@ MODULE ED_OBSERVABLES_NONSU2


logical,save :: iolegend=.true.
real(8),dimension(:),allocatable :: dens,dens_up,dens_dw
real(8),dimension(:),allocatable :: docc
real(8),dimension(:),allocatable :: magZ,magX,magY
real(8),dimension(:),allocatable :: phisc
real(8),dimension(:,:),allocatable :: sz2,n2
real(8),dimension(:,:),allocatable :: exct_s0
real(8),dimension(:,:),allocatable :: exct_tz
real(8),dimension(:,:),allocatable :: exct_tx
real(8),dimension(:,:),allocatable :: exct_ty
real(8),dimensioN(:,:),allocatable :: zimp,simp
real(8) :: s2tot
real(8) :: Egs
real(8),dimension(:),allocatable :: dens ! orbital-resolved charge density
real(8),dimension(:),allocatable :: dens_up ! orbital-resolved spin-:math:`\uparrow` electron density
real(8),dimension(:),allocatable :: dens_dw ! orbital-resolved spin-:math:`\downarrow` electron density
real(8),dimension(:),allocatable :: docc ! orbital-resolved double occupation
real(8),dimension(:),allocatable :: magx ! orbital-resolved magnetization ( :code:`x` component )
real(8),dimension(:),allocatable :: magy ! orbital-resolved magnetization ( :code:`y` component )
real(8),dimension(:),allocatable :: magz ! orbital-resolved magnetization ( :code:`z` component )
real(8),dimension(:),allocatable :: phisc ! superconductive order parameter
real(8),dimension(:,:),allocatable :: n2 ! :math:`\langle n_{i} n_{j} \rangle` for i,j orbitals
real(8),dimension(:,:),allocatable :: sz2! :math:`\langle S^{z}_{i} S^{z}_{j} \rangle` for i,j orbitals
real(8),dimension(:,:),allocatable :: exct_s0 ! excitonic order parameter :math:`\langle c^{\dagger}_{is}\sigma^{0}c_{js^{'}} \rangle`
real(8),dimension(:,:),allocatable :: exct_tx ! excitonic order parameter :math:`\langle c^{\dagger}_{is}\sigma^{x}c_{js^{'}} \rangle`
real(8),dimension(:,:),allocatable :: exct_ty ! excitonic order parameter :math:`\langle c^{\dagger}_{is}\sigma^{y}c_{js^{'}} \rangle`
real(8),dimension(:,:),allocatable :: exct_tz ! excitonic order parameter :math:`\langle c^{\dagger}_{is}\sigma^{z}c_{js^{'}} \rangle`
real(8),dimension(:,:),allocatable :: zimp ! quasiparticle weight
real(8),dimension(:,:),allocatable :: simp ! scattering rate
real(8) :: s2tot ! :math:`\langle S_{z}^{2} \rangle`
real(8) :: Egs ! Ground-state energy
real(8) :: Ei
!
integer :: iorb,jorb,istate
Expand Down Expand Up @@ -68,6 +75,7 @@ MODULE ED_OBSERVABLES_NONSU2
!PURPOSE : Evaluate and print out many interesting physical qties
!+-------------------------------------------------------------------+
subroutine observables_nonsu2()
!Calculate the values of the local observables
integer,dimension(2*Ns) :: ib
integer,dimension(2,Ns) :: Nud
integer,dimension(Ns) :: IbUp,IbDw
Expand Down Expand Up @@ -655,6 +663,7 @@ end subroutine observables_nonsu2
!PURPOSE : Get internal energy from the Impurity problem.
!+-------------------------------------------------------------------+
subroutine local_energy_nonsu2()
!Calculate the value of the local energy components
integer,dimension(2*Ns) :: ib
integer,dimension(2,Ns) :: Nud
integer,dimension(Ns) :: IbUp,IbDw
Expand Down Expand Up @@ -911,6 +920,7 @@ end subroutine local_energy_nonsu2
!PURPOSE : get scattering rate and renormalization constant Z
!+-------------------------------------------------------------------+
subroutine get_szr()
!Calculate the values of the scattering rate and quasiparticle weight
integer :: ispin,iorb
real(8) :: wm1,wm2
wm1 = pi/beta ; wm2=3d0*pi/beta
Expand All @@ -929,6 +939,7 @@ end subroutine get_szr
!PURPOSE : write legend, i.e. info about columns
!+-------------------------------------------------------------------+
subroutine write_legend()
!Write a plain-text file called :code:`observables_info.ed` detailing the names and contents of the observable output files
integer :: unit,iorb,jorb,ispin
!
unit = free_unit()
Expand Down Expand Up @@ -1008,6 +1019,8 @@ end subroutine write_energy_info
!PURPOSE : write observables to file
!+-------------------------------------------------------------------+
subroutine write_observables()
!Write the observable output files. Filenames with suffix :code:`_all` contain values for all DMFT interations, those with suffix :code:`_last`
!only values for the last iteration
integer :: unit
integer :: iorb,jorb,ispin
!
Expand Down Expand Up @@ -1171,6 +1184,7 @@ subroutine write_observables()
end subroutine write_observables

subroutine write_energy()
!Write the latest iteration values of energy observables
integer :: unit
unit = free_unit()
open(unit,file="energy_last"//reg(ed_file_suffix)//".ed")
Expand Down
11 changes: 5 additions & 6 deletions src/ED_NORMAL/ED_OBSERVABLES_NORMAL.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
MODULE ED_OBSERVABLES_NORMAL
!This module calculates, starting from the impurity problem eigenvectors, a series of observables, and stores
!them in aptly named plain-text files. Unless explicitly specified, the dimensions of the observables are scalar
!or array-like with each component of length :f:var:`norb` .
!This module calculates a series of observables, and stores them in aptly named plain-text files. :f:var:`ed_mode` = :code:`normal`
USE SF_CONSTANTS, only:zero,pi,xi
USE SF_IOTOOLS, only:free_unit,reg,txtfy
USE SF_ARRAYS, only: arange
Expand Down Expand Up @@ -75,7 +73,7 @@ MODULE ED_OBSERVABLES_NORMAL
!PURPOSE : Lanc method
!+-------------------------------------------------------------------+
subroutine observables_normal()
!Calculate the values of the local observalbes
!Calculate the values of the local observables
integer :: iprob,istate,Nud(2,Ns),iud(2),jud(2),val
integer,dimension(2*Ns_Ud) :: Indices,Jndices
integer,dimension(Ns_Ud,Ns_Orb) :: Nups,Ndws ![1,Ns]-[Norb,1+Nbath]
Expand Down Expand Up @@ -711,7 +709,7 @@ end subroutine local_energy_normal
!PURPOSE : get scattering rate and renormalization constant Z
!+-------------------------------------------------------------------+
subroutine get_szr()
!Calculate the values of the scattering rate and quasiparticle weight
!Calculate the values of the scattering rate and quasiparticle weight
integer :: ispin,iorb
real(8) :: wm1,wm2
wm1 = pi/beta ; wm2=3d0*pi/beta
Expand Down Expand Up @@ -806,7 +804,8 @@ end subroutine write_energy_info
!PURPOSE : write observables to file
!+-------------------------------------------------------------------+
subroutine write_observables()
!Write the observable output files
!Write the observable output files. Filenames with suffix :code:`_all` contain values for all DMFT interations, those with suffix :code:`_last`
!only values for the last iteration
integer :: unit
integer :: iorb,jorb,ispin
!
Expand Down
16 changes: 16 additions & 0 deletions src/ED_OBSERVABLES.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ MODULE ED_OBSERVABLES


subroutine observables_impurity()
!
! Calculate the local observables calling the correct procedure according to the value of :f:var:`ed_mode` .
! Write the results on plain-text files.
!
! * :code:`normal` : :f:func:`observables_normal`
! * :code:`superc` : :f:func:`observables_superc`
! * :code:`nonsu2` : :f:func:`observables_nonsu2`
!
write(LOGfile,"(A)")"Get observables:"
select case(ed_mode)
case default ;call observables_normal()
Expand All @@ -36,6 +44,14 @@ end subroutine observables_impurity


subroutine local_energy_impurity()
!
! Calculate the local energy calling the correct procedure according to the value of :f:var:`ed_mode` .
! Write the results on plain-text files.
!
! * :code:`normal` : :f:func:`local_energy_normal`
! * :code:`superc` : :f:func:`local_energy_superc`
! * :code:`nonsu2` : :f:func:`local_energy_nonsu2`
!
write(LOGfile,"(A)")"Get local energy:"
select case(ed_mode)
case default ;call local_energy_normal()
Expand Down

0 comments on commit dde8474

Please sign in to comment.