Commit 9e7338b9 authored by Francesco Parisen Toldin's avatar Francesco Parisen Toldin
Browse files

Merge branch '195-automatic-computation-of-hopping_matrix_type-multiplicity'

Resolve "Automatic computation of Hopping_Matrix_Type%Multiplicity"

Closes #195

See merge request !116
parents 6cd972e0 eaf1238d
Pipeline #12837 passed with stages
in 109 minutes and 14 seconds
# Log of backward compatibility changes and critical bugs
## 2021-11-21 Automatic computation of Hopping_Matrix_Type%Multiplicity
Author : F. Parisen Toldin <br>
Merge request !116
### Breaking changes
1) Hopping_Matrix_Type%Multiplicity is now a private member, automatically initialized
## 2021-03-22 Implementing Submodule Hamiltonians / All hamiltonians in one binary
......
No preview for this file type
......@@ -92,11 +92,10 @@ The right hand side of the above equation is given the type \texttt{Hopping\_
\begin{equation}
\hat{\mathcal{H}}_{T} = \sum_{i=1}^{N_T} \sum_{k \in \mathcal{S}^{T}_i} \hat{T}^{(k)},
\end{equation}
with the rule that if $k$ and $k'$ belong to the same set $\mathcal{S}^{T}_i $ then $ \big[ \hat{T}^{(k)} , \hat{T}^{(k')} \big] = 0 $. In the checkerboard decomposition, $\hat{T}^{(k)}$ corresponds to hopping on a bond. The checkerboard decomposition depends on the lattice type, as well as on the hopping matrix elements. The required information is stored in \texttt{Hopping\_matrix\_type}. In this data type, \texttt{N\_FAM} corresponds to the number of sets (or families) ($N_T$ in the above equation). \texttt{L\_FAM(1:N\_FAM)} corresponds to the number of bonds in the set, and finally, \texttt{LIST\_FAM(1:N\_FAM, 1:max(L\_FAM(:)), 2)} contains information concerning the two legs of the bonds. In the checkerboard decomposition, care has to be taken for local terms: each site occurs multiple times in the list of bonds. Since we have postulated translation symmetry, a one-dimensional array, \texttt{Multiplicity}, of length given by the number of orbitals per unit cell suffices to encode the required information.
with the rule that if $k$ and $k'$ belong to the same set $\mathcal{S}^{T}_i $ then $ \big[ \hat{T}^{(k)} , \hat{T}^{(k')} \big] = 0 $. In the checkerboard decomposition, $\hat{T}^{(k)}$ corresponds to hopping on a bond. The checkerboard decomposition depends on the lattice type, as well as on the hopping matrix elements. The required information is stored in \texttt{Hopping\_matrix\_type}. In this data type, \texttt{N\_FAM} corresponds to the number of sets (or families) ($N_T$ in the above equation). \texttt{L\_FAM(1:N\_FAM)} corresponds to the number of bonds in the set, and finally, \texttt{LIST\_FAM(1:N\_FAM, 1:max(L\_FAM(:)), 2)} contains information concerning the two legs of the bonds.
Finally, to be able to generate the imaginary time step of length $\Delta \tau$ we have to know by which fraction of $\Delta \tau$ we have to propagate each set. This information is given in the array \texttt{Prop\_Fam}.
As an example we can consider the three-leg ladder lattice of Figure~\ref{fig_predefined_lattices}(c). Here the number of sets (or families) \texttt{N\_FAM} is equal to four, corresponding to the red, green, black and blue bonds. It is clear from the figure that bonds in a given set do not have common legs, so that hopping instances on the bonds of a given set commute. For this three-leg ladder, we see that the middle orbital in a unit cell appears in each set or family. It hence has a multiplicity of four. On the other hand, the top and bottom orbitals have a multiplicity of 3 since they appear in only three of the four sets.
As an example we can consider the three-leg ladder lattice of Figure~\ref{fig_predefined_lattices}(c). Here the number of sets (or families) \texttt{N\_FAM} is equal to four, corresponding to the red, green, black and blue bonds. It is clear from the figure that bonds in a given set do not have common legs, so that hopping instances on the bonds of a given set commute.
\paragraph*{Usage: the \texttt{Hopping\_Matrix\_type} } %\label{Hopping_Matrix_type.sec}
......@@ -123,10 +122,9 @@ There are \path{N_bonds} hopping matrix elements emanating from a given unit cel
\texttt{L\_Fam(N\_FAM)} & \texttt{int} & Number of bonds per set $\mathcal{S}^{T}$ \\
\texttt{List\_Fam(N\_FAM,max(L\_FAM(:)),2)}& \texttt{int} & \texttt{List\_Fam($ \bullet,\bullet $,1)} = Unit cell \\
& & \texttt{List\_Fam($\bullet,\bullet$,2)} = Bond number \\
\texttt{Multiplicity(Norb)}& \texttt{int} & Number of times a given orbital occurs in the list of bonds \\
\texttt{Prop\_Fam(N\_FAM)} & \texttt{dble} & The fraction of $\Delta \tau$ with which the set will be propagated \\\bottomrule
\end{tabular}
\caption{Member variables of the \texttt{Hopping\_Matrix\_type} type.
\caption{Public member variables of the \texttt{Hopping\_Matrix\_type} type.
\label{table:Hopping_matrix}}
\end{center}
\end{table}
......@@ -173,9 +171,7 @@ do I = 1,Latt%N
List_Fam(nf,I,2) = nf ! The bond
enddo
enddo
Multiplicity = 3
\end{lstlisting}
Since each site of the honeycomb lattice occurs in the three sets, their multiplicity is equal to 3.
%-----------------------------------------------------------------------------------
......
......@@ -71,9 +71,10 @@
! For Checkerboard decomposition
Integer :: N_Fam
Integer , pointer :: L_Fam(:), List_Fam(:,:,:), Multiplicity(:)
Integer , pointer :: L_Fam(:), List_Fam(:,:,:)
Real (Kind=Kind(0.d0)), pointer :: Prop_Fam(:)
Integer, private , pointer :: Multiplicity(:) !> Numer of times a given orbital occurs in the list of bonds, automatically computed
End type Hopping_Matrix_Type
......@@ -224,11 +225,10 @@
!Set Checkerboard
if ( Ham_T_max > Zero ) then
this(1)%N_FAM = 4
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM), this(1)%Multiplicity(Latt_unit%Norb) )
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM))
this(1)%L_FAM = Latt%N/2
this(1)%Prop_Fam= 1.d0
Allocate (this(1)%List_Fam(this(1)%N_FAM,this(1)%L_Fam(1),2))
this(1)%Multiplicity = 4
this(1)%L_FAM = 0
do I = 1,Latt%N
if ( mod(Latt%List(I,1) + Latt%List(I,2),2) == 0 ) then
......@@ -316,14 +316,9 @@
enddo
! Set Checkerboard
Allocate ( this(1)%Multiplicity(Latt_unit%Norb) )
If ( Latt_Unit%Norb <= 2 ) then
this(1)%Multiplicity = 1
this(1)%N_FAM = 1
else
this(1)%Multiplicity = 2
this(1)%Multiplicity(1) = 1
this(1)%Multiplicity(Latt_unit%Norb) = 1
this(1)%N_FAM = 2
endif
Allocate ( this(1)%L_Fam( this(1)%N_FAM ), this(1)%Prop_Fam( this(1)%N_FAM ) )
......@@ -392,17 +387,11 @@
! Write(6,*) Latt_unit%Norb
! Set Checkerboard
Allocate ( this(1)%Multiplicity(Latt_unit%Norb) )
If ( Latt_Unit%Norb == 1 ) then
this(1)%Multiplicity = 2
this(1)%N_FAM = 2
elseif ( Latt_Unit%Norb == 2 ) then
this(1)%Multiplicity = 3
this(1)%N_FAM = 3
else
this(1)%Multiplicity = 4
this(1)%Multiplicity(1) = 3
this(1)%Multiplicity(Latt_unit%Norb) = 3
this(1)%N_FAM = 4
endif
Allocate ( this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM) )
......@@ -529,11 +518,10 @@
! Set Checkerboard
this(1)%N_FAM = 3
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM), this(1)%Multiplicity(Latt_unit%Norb) )
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM))
this(1)%L_FAM = Latt%N
this(1)%Prop_Fam= 1.d0
Allocate (this(1)%List_Fam(this(1)%N_FAM,this(1)%L_Fam(1),2))
this(1)%Multiplicity = 3
do I = 1,Latt%N
Do nf = 1,this(1)%N_FAM
this(1)%List_Fam(nf,I,1) = I ! Unit cell
......@@ -656,7 +644,7 @@
this(1)%N_FAM = 4
if (abs(Ham_Tperp_max) > Zero ) this(1)%N_FAM=5
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM), this(1)%Multiplicity(Latt_unit%Norb) )
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM))
this(1)%Prop_Fam= 1.d0
No_Shift = 0
......@@ -665,21 +653,16 @@
If ( abs(Ham_T2_max) < Zero .and. abs(Ham_Tperp_max) < Zero) then
this(1)%L_FAM = Latt%N/2
Allocate (this(1)%List_Fam(this(1)%N_FAM,Latt%N/2,2))
this(1)%Multiplicity = 4
elseif ( abs(Ham_T2_max) < Zero .and. abs(Ham_Tperp_max) > Zero) then
this(1)%L_FAM = Latt%N/2
this(1)%L_Fam(5) = Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,Latt%N,2))
this(1)%Multiplicity(1) = 5
this(1)%Multiplicity(2) = 1
elseif ( abs(Ham_T2_max) > Zero .and. abs(Ham_Tperp_max) < Zero) then
this(1)%L_FAM = Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,Latt%N,2))
this(1)%Multiplicity = 4
elseif ( abs(Ham_T2_max) > Zero .and. abs(Ham_Tperp_max) > Zero) then
this(1)%L_FAM = Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,Latt%N,2))
this(1)%Multiplicity = 5
No_Shift = 1
endif
this(1)%L_FAM = 0
......@@ -882,7 +865,7 @@
! Set Checkerboard
this(1)%N_FAM = 3
If ( abs(Ham_Tperp_Max) > Zero ) this(1)%N_FAM = 4
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM), this(1)%Multiplicity(Latt_unit%Norb) )
Allocate (this(1)%L_Fam(this(1)%N_FAM), this(1)%Prop_Fam(this(1)%N_FAM))
this(1)%Prop_Fam= 1.d0
No_Shift = 0
......@@ -891,23 +874,16 @@
If ( abs(Ham_T2_Max) < Zero .and. abs(Ham_Tperp_Max) < Zero) then
this(1)%L_FAM = Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,Latt%N,2))
this(1)%Multiplicity = 3
elseif ( abs(Ham_T2_Max) < Zero .and. abs(Ham_Tperp_Max) > Zero) then
this(1)%L_FAM = Latt%N
this(1)%L_Fam(4) = 2*Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,2*Latt%N,2))
this(1)%Multiplicity(1) = 4
this(1)%Multiplicity(2) = 4
this(1)%Multiplicity(3) = 1
this(1)%Multiplicity(4) = 1
elseif ( abs(Ham_T2_Max) > Zero .and. abs(Ham_Tperp_Max) < Zero) then
this(1)%L_FAM = 2*Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,2*Latt%N,2))
this(1)%Multiplicity = 3
elseif ( abs(Ham_T2_Max) > Zero .and. abs(Ham_Tperp_Max) > Zero) then
this(1)%L_FAM = 2*Latt%N
Allocate (this(1)%List_Fam(this(1)%N_FAM,2*Latt%N,2))
this(1)%Multiplicity = 4
No_Shift = 2
endif
......@@ -1061,7 +1037,7 @@
! Local
Integer :: Ndim, N_FL, N_Phi, I, J, I1, J1, no_I, no_J, nf
Integer :: n_1, n_2, Nb, n_f,l_f, n_l, N, nc
Integer :: n_1, n_2, Nb, n_f,l_f, n_l, N, nc, orb
Real (Kind=Kind(0.d0)) :: Ham_T, Ham_Chem, Phi_X, Phi_Y
Logical :: Bulk
Complex(Kind=Kind(0.d0)) :: Z
......@@ -1148,6 +1124,16 @@
enddo
allocate(Op_T(N,N_FL))
do nf = 1,N_FL
! Compute Multiplicity
allocate(this(nf)%Multiplicity(Latt_Unit%Norb))
this(nf)%Multiplicity = 0
do i = 1, size(this(nf)%List, 1)
orb = this(nf)%List(i, 1)
this(nf)%Multiplicity(orb) = this(nf)%Multiplicity(orb) + 1
orb = this(nf)%List(i, 2)
this(nf)%Multiplicity(orb) = this(nf)%Multiplicity(orb) + 1
end do
N_Phi = this(nf)%N_Phi
Phi_X = this(nf)%Phi_X
Phi_Y = this(nf)%Phi_Y
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment