diff --git a/jupyterbook/myst.yml b/jupyterbook/myst.yml index 0a451df..9a972f0 100644 --- a/jupyterbook/myst.yml +++ b/jupyterbook/myst.yml @@ -32,8 +32,8 @@ project: children: - file: source/08-fortran/downloading.md - file: source/08-fortran/dimensional_crossover.md - - file: source/08-fortran/t_V_Model.md - file: source/08-fortran/Adding_observable.md + - file: source/08-fortran/t_V_Model.md site: template: book-theme diff --git a/jupyterbook/source/08-fortran/Adding_observable.md b/jupyterbook/source/08-fortran/Adding_observable.md index 48ec727..6c8fad8 100644 --- a/jupyterbook/source/08-fortran/Adding_observable.md +++ b/jupyterbook/source/08-fortran/Adding_observable.md @@ -38,7 +38,7 @@ GR(i,j,\sigma) & = \left\langle \hat{c}^{\phantom\dagger}_{i,\sigma}\hat{c}^\dag #### Necessary code modifications -In the directory `Solutions/Exercise_3` we have the modified and original submodule `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90` found in `$ALF_DIR/Prog/Hamiltonians` (which we here shorten to "`Vanilla`"), as well as reference data and the necessary `Start` directory (remember to copy its contents to every new `Run` directory, and to have a different `Run` directory for each simulation). The following are the essential steps to be carried out: +In [solution](Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_3) we have the modified submodule `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90`, as well as the [parameter](Solutions/Exercise_3/Start/parameters) file. The following are the essential steps to be carried out: - Introduce the new observable and allocate the memory required to store the measurements. This is done in the subroutine `Alloc_obs(Ltau)` by increasing the length of the array `Obs_eq` appropriately and adding a new case to specify the filename in which the results are stored on disc. (You might want to revisit this section later on to add the time-displaced version of the correlation function by changing `Obs_tau` in the same fashion.) - The actual measurements are taken in the subroutine `Obser(GR,Phase,Ntau)`. While `GR` is passed to the subroutine, the first lines of code already implement the construct $\mathtt{GRC}=1-\mathtt{GR}^T$. (This section does not have to be modified, but it is useful to keep this in mind for future reference when you implement a new model from scratch.) diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_1a b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_1a new file mode 100644 index 0000000..47a2597 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_1a @@ -0,0 +1,864 @@ +! Copyright (C) 2016 - 2020 The ALF project +! +! The ALF project is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! The ALF project is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with ALF. If not, see http://www.gnu.org/licenses/. +! +! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms: +! +! - It is our hope that this program makes a contribution to the scientific community. Being +! part of that community we feel that it is reasonable to require you to give an attribution +! back to the original authors if you have benefitted from this program. +! Guidelines for a proper citation can be found on the project's homepage +! http://alf.physik.uni-wuerzburg.de +! +! - We require the preservation of the above copyright notice and this license in all original files. +! +! - We prohibit the misrepresentation of the origin of the original source files. To obtain +! the original source files please visit the homepage http://alf.physik.uni-wuerzburg.de . +! +! - If you make substantial changes to the program we require you to either consider contributing +! to the ALF project or to mark your material in a reasonable way as different from the original version + + +!-------------------------------------------------------------------- +!> @author +!> ALF-project +!> +!> @brief +!> This module defines the Hamiltonian and observables. Here, we have included a +!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models +!> on honeycomb, pi-flux and square lattices. + +!> @details +!> The public variables of this module are the following +!> +!> +!> @param [public] OP_V +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice. +!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim +!> +!> @param [public] OP_T +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> Sequence of operators accounting for the hopping on a time slice. This can include various +!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to +!> the flavor index. \endverbatim +!> * The progagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is +!> first the hopping and then the potential energy. +!> +!>@param [public] WF_L +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Left trial wave function. \endverbatim +!> +!> @param [public] WF_R +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim +!> +!> @param [public] nsigma +!> \verbatim Type(Fields) +!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator +!> sequence. The second through the time slices. \endverbatim +! +!> @param [public] Ndim +!> \verbatim Integer +!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim +! +!> @param [public] N_FL +!> \verbatim Integer +!> # of flavors. Propagation is block diagonal in flavors. \endverbatim +! +!> @param [public] N_SUN +!> \verbatim Integer +!> # of colors. Propagation is color independent. \endverbatim +!> +!> @param [public] Ltrot +!> \verbatim Integer +!> Available measurment interval in units of Delta Tau. \endverbatim +!> +!> @param [public] Thtrot +!> \verbatim Integer +!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim +!> +!> @param [public] Projector +!> \verbatim Logical +!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim +!> +!> @param [public] Group_Comm +!> \verbatim Integer +!> Defines MPI communicator \endverbatim +! +!> @param [public] Symm +!> \verbatim Logical \endverbatim +!> If set to true then the green functions will be symmetrized +!> before being sent to the Obser, ObserT subroutines. +!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$ +!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that +!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed +!> symmetrically. If Symm is true, the propagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$ +!> +!> +!> You still have to add some docu for the other private variables in this module. +!> +!-------------------------------------------------------------------- + + submodule (Hamiltonian_main) ham_Hubbard_Plain_Vanilla_smod + + Use Operator_mod + Use WaveFunction_mod + Use Lattices_v3 + Use MyMats + Use Random_Wrap + Use Files_mod + Use Matrix + Use Observables + Use Fields_mod + Use Predefined_Hoppings + Use LRC_Mod + use runtime_error_mod + + + Implicit none + + type, extends(ham_base) :: ham_Hubbard_Plain_Vanilla + contains + ! Set Hamiltonian-specific procedures + procedure, nopass :: Ham_Set + procedure, nopass :: Alloc_obs + procedure, nopass :: Obser + procedure, nopass :: ObserT + procedure, nopass :: weight_reconstruction + procedure, nopass :: GR_reconstruction + procedure, nopass :: GRT_reconstruction +#ifdef HDF5 + procedure, nopass :: write_parameters_hdf5 +#endif + end type ham_Hubbard_Plain_Vanilla + + !#PARAMETERS START# VAR_lattice + Character (len=64) :: Model = '' ! Value irrelevant + Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square' + Integer :: L1 = 6 ! Length in direction a_1 + Integer :: L2 = 6 ! Length in direction a_2 + !#PARAMETERS END# + + !#PARAMETERS START# VAR_Hubbard_Plain_Vanilla + real(Kind=Kind(0.d0)) :: ham_T = 1.d0 ! Hopping parameter +!!!!!!! Modifications for Exercise 1a + real (Kind=Kind(0.d0)) :: Ham_Ty = 1.d0 ! Hopping parameter in y +!!!!!!! + real(Kind=Kind(0.d0)) :: Ham_chem = 0.d0 ! Chemical potential + real(Kind=Kind(0.d0)) :: Ham_U = 4.d0 ! Hubbard interaction + real(Kind=Kind(0.d0)) :: Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau + real(Kind=Kind(0.d0)) :: Beta = 5.d0 ! Inverse temperature + !logical :: Projector= .false. ! Whether the projective algorithm is used + real(Kind=Kind(0.d0)) :: Theta = 10.d0 ! Projection parameter + !logical :: Symm = .true. ! Whether symmetrization takes place + Integer :: N_part = -1 ! Number of particles in trial wave function. If N_part < 0 -> N_part = L1*L2/2 + !#PARAMETERS END# + + Type (Lattice), target :: Latt + Type (Unit_cell), target :: Latt_unit + INTEGER :: nf_calc, nf_reconst + + contains + + module Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + allocate(ham_Hubbard_Plain_Vanilla::ham) + end Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + +! Dynamically generated on compile time from parameters list. +! Supplies the subroutines read_parameters and write_parameters_hdf5. +#include "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hamiltonian +!-------------------------------------------------------------------- + Subroutine Ham_Set + +#if defined (MPI) || defined(TEMPERING) + Use mpi +#endif + Implicit none + + integer :: ierr, nf, unit_info + Character (len=64) :: file_info + + + +#ifdef MPI + Integer :: Isize, Irank, irank_g, isize_g, igroup + Integer :: STATUS(MPI_STATUS_SIZE) + CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR) + CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR) + call MPI_Comm_rank(Group_Comm, irank_g, ierr) + call MPI_Comm_size(Group_Comm, isize_g, ierr) + igroup = irank/isize_g +#endif + + ! From dynamically generated file "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + call read_parameters() + + + If (L1 == 1) then + Write(6,*) 'For one-dimensional lattices set L2=1' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + endif + + if (N_part < 0) N_part = L1*L2/2 + Ltrot = nint(beta/dtau) + Thtrot = 0 + if (Projector) Thtrot = nint(theta/dtau) + Ltrot = Ltrot+2*Thtrot + N_SUN = 1 + N_FL = 2 + + ! Setup the Bravais lattice + Call Ham_Latt + + ! Setup the hopping / single-particle part + Call Ham_Hop + + ! Setup the interaction. + call Ham_V + + ! Setup the trival wave function, in case of a projector approach + if (Projector) Call Ham_Trial() + +#ifdef MPI + If (Irank_g == 0) then +#endif + File_info = "info" +#if defined(TEMPERING) + write(File_info,'(A,I0,A)') "Temp_",igroup,"/info" +#endif + + Open(newunit=unit_info, file=file_info, status="unknown", position="append") + Write(unit_info,*) '=====================================' + Write(unit_info,*) 'Model is : Hubbard_Plain_Vanilla' + Write(unit_info,*) 'Lattice is : ', Lattice_type + Write(unit_info,*) 'L1 : ', L1 + Write(unit_info,*) 'L2 : ', L2 + Write(unit_info,*) '# of orbitals : ', Ndim + Write(unit_info,*) 'Symm. decomp : ', Symm + if (Projector) then + Write(unit_info,*) 'Projective version' + Write(unit_info,*) 'Theta : ', Theta + Write(unit_info,*) 'Tau_max : ', beta + Write(unit_info,*) '# of particles: ', N_part + else + Write(unit_info,*) 'Finite temperture version' + Write(unit_info,*) 'Beta : ', Beta + endif + Write(unit_info,*) 'dtau,Ltrot_eff: ', dtau,Ltrot + Write(unit_info,*) 't : ', Ham_T +!!!!!!! Modifications for Exercise 1a + Write(unit_info,*) 'ty : ', Ham_Ty +!!!!!!! + Write(unit_info,*) 'Ham_U : ', Ham_U + Write(unit_info,*) 'Ham_chem : ', Ham_chem + If ( Ham_U >=0.d0 .and. Ham_chem == 0.d0 ) then + Write(unit_info,*) 'Assuming particle hole symmetry' + endif + If ( Ham_U < 0.d0 ) then + Write(unit_info,*) 'Assuming time reversal symmetry' + endif + if (Projector) then + Do nf = 1,N_FL + Write(unit_info,*) 'Degen of right trial wave function: ', WF_R(nf)%Degen + Write(unit_info,*) 'Degen of left trial wave function: ', WF_L(nf)%Degen + enddo + endif + Close(unit_info) +#ifdef MPI + Endif +#endif + + ! Particle-hole symmetry for repulsive U only if chemical potential vanishes + ! Time reversal symmetry for attractive U + If ( (Ham_U >= 0.d0 .and. Ham_chem == 0.d0) .or. Ham_U < 0.d0 ) then + allocate(Calc_Fl(N_FL)) + nf_calc=2 + nf_reconst=1 + Calc_Fl(nf_calc)=.True. + Calc_Fl(nf_reconst)=.False. + endif + + + End Subroutine Ham_Set + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Lattice +!-------------------------------------------------------------------- + Subroutine Ham_Latt + + + Implicit none + Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2) + + If (Lattice_Type /= "Square") then + Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif + + Latt_unit%Norb = 1 + Latt_unit%N_coord = 2 + allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2)) + Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0] + + a1_p(1) = 1.0 ; a1_p(2) = 0.d0 + a2_p(1) = 0.0 ; a2_p(2) = 1.d0 + L1_p = dble(L1)*a1_p + L2_p = dble(L2)*a2_p + Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt ) + + Ndim = Latt%N*Latt_unit%Norb + + end Subroutine Ham_Latt +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hopping +!-------------------------------------------------------------------- + Subroutine Ham_Hop + + Implicit none + + Integer :: nf , I, Ix, Iy + allocate(Op_T(1,N_FL)) + do nf = 1,N_FL + Call Op_make(Op_T(1,nf),Ndim) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + If ( L2 > 1 ) then + Iy = Latt%nnlist(I,0,1) +!!!!!!! Modifications for Exercise 1a + !Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + !Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_Ty, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_Ty, 0.d0, kind(0.D0)) +!!!!!!! + endif + Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0)) + Op_T(1,nf)%P(i) = i + Enddo + Op_T(1,nf)%g = -Dtau + Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0)) + Call Op_set(Op_T(1,nf)) + enddo + + + end Subroutine Ham_Hop +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the trial wave function +!-------------------------------------------------------------------- + Subroutine Ham_Trial() + + Use Predefined_Trial + + Implicit none + + Integer :: nf, Ix, Iy, I, n + Real (Kind=Kind(0.d0)), allocatable :: H0(:,:), U0(:,:), E0(:) + Real (Kind=Kind(0.d0)) :: Pi = acos(-1.d0), Delta = 0.01d0 + + Allocate(WF_L(N_FL),WF_R(N_FL)) + do nf=1,N_FL + Call WF_alloc(WF_L(nf),Ndim,N_part) + Call WF_alloc(WF_R(nf),Ndim,N_part) + enddo + + + Allocate(H0(Ndim,Ndim), U0(Ndim, Ndim), E0(Ndim) ) + H0 = 0.d0; U0 = 0.d0; E0=0.d0 + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + H0(I, Ix) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + H0(Ix, I ) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + If (L2 > 1 ) Then + Iy = Latt%nnlist(I,0,1) +!!!!!!! Modifications for Exercise 1a + !H0(I, Iy) = -Ham_T *(1.d0 - Delta) + !H0(Iy, I ) = -Ham_T *(1.d0 - Delta) + H0(I, Iy) = -Ham_Ty *(1.d0 - Delta) + H0(Iy, I ) = -Ham_Ty *(1.d0 - Delta) +!!!!!!! + Endif + Enddo + Call Diag(H0,U0,E0) +!!$ Do I = 1,Ndim +!!$ Write(6,*) I,E0(I) +!!$ Enddo + Do nf = 1,N_FL + do n=1,N_part + do I=1,Ndim + WF_L(nf)%P(I,n)=U0(I,n) + WF_R(nf)%P(I,n)=U0(I,n) + enddo + enddo + WF_L(nf)%Degen = E0(N_part+1) - E0(N_part) + WF_R(nf)%Degen = E0(N_part+1) - E0(N_part) + enddo + + Deallocate(H0, U0, E0 ) + + end Subroutine Ham_Trial + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the interaction +!-------------------------------------------------------------------- + Subroutine Ham_V + + Use Predefined_Int + Implicit none + + Integer :: nf, I + Real (Kind=Kind(0.d0)) :: X + + + Allocate(Op_V(Ndim,N_FL)) + + do nf = 1,N_FL + do i = 1, Ndim + Call Op_make(Op_V(i,nf), 1) + enddo + enddo + + Do nf = 1,N_FL + X = 1.d0 + if (nf == 2) X = -1.d0 + Do i = 1,Ndim + Op_V(i,nf)%P(1) = I + Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%g = X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0))) + Op_V(i,nf)%alpha = cmplx(-0.5d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%type = 2 + Call Op_set( Op_V(i,nf) ) + Enddo + Enddo + + + end Subroutine Ham_V + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Specifiy the equal time and time displaced observables +!> @details +!-------------------------------------------------------------------- + Subroutine Alloc_obs(Ltau) + + Implicit none + !> Ltau=1 if time displaced correlations are considered. + Integer, Intent(In) :: Ltau + Integer :: i, N, Nt + Character (len=64) :: Filename + Character (len=2) :: Channel + + + ! Scalar observables + Allocate ( Obs_scal(4) ) + Do I = 1,Size(Obs_scal,1) + select case (I) + case (1) + N = 1; Filename ="Kin" + case (2) + N = 1; Filename ="Pot" + case (3) + N = 1; Filename ="Part" + case (4) + N = 1; Filename ="Ener" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Call Obser_Vec_make(Obs_scal(I),N,Filename) + enddo + + ! Equal time correlators + Allocate ( Obs_eq(5) ) + Do I = 1,Size(Obs_eq,1) + select case (I) + case (1) + Filename = "Green" + case (2) + Filename = "SpinZ" + case (3) + Filename = "SpinXY" + case (4) + Filename = "SpinT" + case (5) + Filename = "Den" + case default + Write(6,*) "Error in Alloc_obs" + end select + Nt = 1 + Channel = "--" + Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + + If (Ltau == 1) then + ! time-displaced correlators + Allocate ( Obs_tau(5) ) + Do I = 1,Size(Obs_tau,1) + select case (I) + case (1) + Channel = 'P' ; Filename = "Green" + case (2) + Channel = 'PH'; Filename = "SpinZ" + case (3) + Channel = 'PH'; Filename = "SpinXY" + case (4) + Channel = 'PH'; Filename = "SpinT" + case (5) + Channel = 'PH'; Filename = "Den" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Nt = Ltrot+1-2*Thtrot + If(Projector) Channel = 'T0' + Call Obser_Latt_make(Obs_tau(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + endif + + End Subroutine Alloc_obs + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes equal time observables +!> @details +!> @param [IN] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!> @param [IN] Ntau Integer +!> \verbatim +!> Time slice +!> \endverbatim +!------------------------------------------------------------------- + subroutine Obser(GR,Phase,Ntau, Mc_step_weight) + + Use Predefined_Obs + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GR(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), Intent(IN) :: PHASE + Integer, INTENT(IN) :: Ntau + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Local + Complex (Kind=Kind(0.d0)) :: GRC(Ndim,Ndim,N_FL), ZK + Complex (Kind=Kind(0.d0)) :: Zrho, Zkin, ZPot, Z, ZP,ZS, ZZ, ZXY, ZDen + Integer :: I,J, imj, nf, Ix, Iy + Real (Kind=Kind(0.d0)) :: X + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + + ZS = ZS*Mc_step_weight + + + + Do nf = 1,N_FL + Do I = 1,Ndim + Do J = 1,Ndim + GRC(I, J, nf) = -GR(J, I, nf) + Enddo + GRC(I, I, nf) = 1.D0 + GRC(I, I, nf) + Enddo + Enddo + ! GRC(i,j,nf) = < c^{dagger}_{i,nf } c_{j,nf } > + + ! Compute scalar observables. + Do I = 1,Size(Obs_scal,1) + Obs_scal(I)%N = Obs_scal(I)%N + 1 + Obs_scal(I)%Ave_sign = Obs_scal(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + + Zkin = cmplx(0.d0, 0.d0, kind(0.D0)) + Zkin = Zkin* dble(N_SUN) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) & + & + GRC(I,Ix,2) + GRC(Ix,I,2) + Enddo + If (L2 > 1) then + Do I = 1,Latt%N + Iy = Latt%nnlist(I,0,1) + Zkin = Zkin + GRC(I,Iy,2) + GRC(Iy,I,2) & + & + GRC(I,Iy,1) + GRC(Iy,I,1) + Enddo + Endif + Zkin = Zkin*cmplx(-Ham_T,0.d0,Kind(0.d0)) + Obs_scal(1)%Obs_vec(1) = Obs_scal(1)%Obs_vec(1) + Zkin *ZP* ZS + + + ZPot = cmplx(0.d0, 0.d0, kind(0.D0)) + Do I = 1,Ndim + ZPot = ZPot + Grc(i,i,1) * Grc(i,i, 2) + Enddo + Zpot = Zpot*ham_U + Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + Zpot * ZP*ZS + + + Zrho = cmplx(0.d0,0.d0, kind(0.D0)) + Do I = 1,Ndim + Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) + enddo + Obs_scal(3)%Obs_vec(1) = Obs_scal(3)%Obs_vec(1) + Zrho * ZP*ZS + Obs_scal(4)%Obs_vec(1) = Obs_scal(4)%Obs_vec(1) + (Zkin + Zpot)*ZP*ZS + + Do I = 1,Size(Obs_eq,1) + Obs_eq(I)%N = Obs_eq(I)%N + 1 + Obs_eq(I)%Ave_sign = Obs_eq(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + ZXY = GRC(I,J,1) * GR(I,J,2) + GRC(I,J,2) * GR(I,J,1) + ZZ = GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + & + (GRC(I,I,2) - GRC(I,I,1))*(GRC(J,J,2) - GRC(J,J,1)) + + ZDen = (GRC(I,I,1) + GRC(I,I,2)) * (GRC(J,J,1) + GRC(J,J,2)) + & + & GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + + Obs_eq(1)%Obs_Latt(imj,1,1,1) = Obs_eq(1)%Obs_Latt(imj,1,1,1) + (GRC(I,J,1) + GRC(I,J,2))*ZP*ZS + Obs_eq(2)%Obs_Latt(imj,1,1,1) = Obs_eq(2)%Obs_Latt(imj,1,1,1) + ZZ *ZP*ZS + Obs_eq(3)%Obs_Latt(imj,1,1,1) = Obs_eq(3)%Obs_Latt(imj,1,1,1) + ZXY *ZP*ZS + Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_eq(5)%Obs_Latt(imj,1,1,1) = Obs_eq(5)%Obs_Latt(imj,1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_eq(5)%Obs_Latt0(1) = Obs_eq(5)%Obs_Latt0(1) + (GRC(I,I,1) + GRC(I,I,2)) * ZP*ZS + enddo + + + + + end Subroutine Obser +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes time displaced observables +!> @details +!> @param [IN] NT, Integer +!> \verbatim +!> Imaginary time +!> \endverbatim +!> @param [IN] GT0, GTT, G00, GTT, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> G00(I,J,nf) = +!> GTT(I,J,nf) = +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!------------------------------------------------------------------- + Subroutine ObserT(NT, GT0,G0T,G00,GTT, PHASE, Mc_step_weight ) + + Use Predefined_Obs + + Implicit none + + Integer , INTENT(IN) :: NT + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GT0(Ndim,Ndim,N_FL),G0T(Ndim,Ndim,N_FL),G00(Ndim,Ndim,N_FL),GTT(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), INTENT(IN) :: Phase + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Locals + Complex (Kind=Kind(0.d0)) :: Z, ZP, ZS, ZZ, ZXY, ZDEN + Real (Kind=Kind(0.d0)) :: X + Integer :: IMJ, I, J, I1, J1, no_I, no_J + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + ZS = ZS*Mc_step_weight + + If (NT == 0 ) then + Do I = 1,Size(Obs_tau,1) + Obs_tau(I)%N = Obs_tau(I)%N + 1 + Obs_tau(I)%Ave_sign = Obs_tau(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + Endif + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + + ZZ = (GTT(I,I,1) - GTT(I,I,2) ) * ( G00(J,J,1) - G00(J,J,2) ) & + & - G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + ZXY = - G0T(J,I,1) * GT0(I,J,2) - G0T(J,I,2) * GT0(I,J,1) + + + ZDen = (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2) ) * & + & (cmplx(2.d0,0.d0,kind(0.d0)) - G00(J,J,1) - G00(J,J,2) ) & + & -G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + + Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) + (GT0(I,J,1) + GT0(I,J,2))*ZP*ZS + Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) + ZZ *ZP*ZS + Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) + ZXY *ZP*ZS + Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_tau(5)%Obs_Latt0(1) = Obs_tau(5)%Obs_Latt0(1) + & + & (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2)) * ZP*ZS + enddo + + + + end Subroutine OBSERT + +!-------------------------------------------------------------------- +!> @brief +!> Reconstructs dependent flavors of the configuration's weight. +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!-------------------------------------------------------------------- + subroutine weight_reconstruction(weight) + implicit none + complex (Kind=Kind(0.d0)), Intent(inout) :: weight(:) + + weight(nf_reconst) = conjg(Weight(nf_calc)) + + end subroutine weight_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of equal time Greens function +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!------------------------------------------------------------------- + subroutine GR_reconstruction(GR) + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GR(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Ndim + Do I = 1,Ndim + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + ! write(*,*) Latt%list(I,:),Latt%list(J,:),mod(Latt%list(imj,1)+Latt%list(imj,2),2), X + ZZ=0.d0 + if (I==J) ZZ=1.d0 + GR(I,J,nf_reconst) = ZZ - X*GR(J,I,nf_calc) + Enddo + Enddo + else + Do J = 1,Ndim + Do I = 1,Ndim + GR(I,J,nf_reconst) = Conjg(GR(I,J,nf_calc)) + Enddo + Enddo + Endif + end Subroutine GR_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of time displaced Greens function G0T and GT0 +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] GT0, G0T, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> \endverbatim +!------------------------------------------------------------------- + Subroutine GRT_reconstruction(GT0, G0T) + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GT0(Ndim,Ndim,N_FL), G0T(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Latt%N + Do I = 1,Latt%N + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + G0T(I,J,nf_reconst) = -X*conjg(GT0(J,I,nf_calc)) + GT0(I,J,nf_reconst) = -X*conjg(G0T(J,I,nf_calc)) + enddo + enddo + else + Do J = 1,Latt%N + Do I = 1,Latt%N + G0T(I,J,nf_reconst) = conjg(G0T(I,J,nf_calc)) + GT0(I,J,nf_reconst) = conjg(GT0(I,J,nf_calc)) + enddo + enddo + endif + end Subroutine GRT_reconstruction + + end submodule ham_Hubbard_Plain_Vanilla_smod diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original new file mode 100644 index 0000000..a7c7563 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original @@ -0,0 +1,851 @@ +! Copyright (C) 2016 - 2020 The ALF project +! +! The ALF project is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! The ALF project is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with ALF. If not, see http://www.gnu.org/licenses/. +! +! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms: +! +! - It is our hope that this program makes a contribution to the scientific community. Being +! part of that community we feel that it is reasonable to require you to give an attribution +! back to the original authors if you have benefitted from this program. +! Guidelines for a proper citation can be found on the project's homepage +! http://alf.physik.uni-wuerzburg.de +! +! - We require the preservation of the above copyright notice and this license in all original files. +! +! - We prohibit the misrepresentation of the origin of the original source files. To obtain +! the original source files please visit the homepage http://alf.physik.uni-wuerzburg.de . +! +! - If you make substantial changes to the program we require you to either consider contributing +! to the ALF project or to mark your material in a reasonable way as different from the original version + + +!-------------------------------------------------------------------- +!> @author +!> ALF-project +!> +!> @brief +!> This module defines the Hamiltonian and observables. Here, we have included a +!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models +!> on honeycomb, pi-flux and square lattices. + +!> @details +!> The public variables of this module are the following +!> +!> +!> @param [public] OP_V +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice. +!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim +!> +!> @param [public] OP_T +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> Sequence of operators accounting for the hopping on a time slice. This can include various +!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to +!> the flavor index. \endverbatim +!> * The progagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is +!> first the hopping and then the potential energy. +!> +!>@param [public] WF_L +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Left trial wave function. \endverbatim +!> +!> @param [public] WF_R +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim +!> +!> @param [public] nsigma +!> \verbatim Type(Fields) +!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator +!> sequence. The second through the time slices. \endverbatim +! +!> @param [public] Ndim +!> \verbatim Integer +!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim +! +!> @param [public] N_FL +!> \verbatim Integer +!> # of flavors. Propagation is block diagonal in flavors. \endverbatim +! +!> @param [public] N_SUN +!> \verbatim Integer +!> # of colors. Propagation is color independent. \endverbatim +!> +!> @param [public] Ltrot +!> \verbatim Integer +!> Available measurment interval in units of Delta Tau. \endverbatim +!> +!> @param [public] Thtrot +!> \verbatim Integer +!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim +!> +!> @param [public] Projector +!> \verbatim Logical +!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim +!> +!> @param [public] Group_Comm +!> \verbatim Integer +!> Defines MPI communicator \endverbatim +! +!> @param [public] Symm +!> \verbatim Logical \endverbatim +!> If set to true then the green functions will be symmetrized +!> before being sent to the Obser, ObserT subroutines. +!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$ +!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that +!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed +!> symmetrically. If Symm is true, the propagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$ +!> +!> +!> You still have to add some docu for the other private variables in this module. +!> +!-------------------------------------------------------------------- + + + submodule (Hamiltonian_main) ham_Hubbard_Plain_Vanilla_smod + + Use Operator_mod + Use WaveFunction_mod + Use Lattices_v3 + Use MyMats + Use Random_Wrap + Use Files_mod + Use Matrix + Use Observables + Use Fields_mod + Use Predefined_Hoppings + Use LRC_Mod + use runtime_error_mod + + + Implicit none + + type, extends(ham_base) :: ham_Hubbard_Plain_Vanilla + contains + ! Set Hamiltonian-specific procedures + procedure, nopass :: Ham_Set + procedure, nopass :: Alloc_obs + procedure, nopass :: Obser + procedure, nopass :: ObserT + procedure, nopass :: weight_reconstruction + procedure, nopass :: GR_reconstruction + procedure, nopass :: GRT_reconstruction +#ifdef HDF5 + procedure, nopass :: write_parameters_hdf5 +#endif + end type ham_Hubbard_Plain_Vanilla + + !#PARAMETERS START# VAR_lattice + Character (len=64) :: Model = '' ! Value irrelevant + Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square' + Integer :: L1 = 6 ! Length in direction a_1 + Integer :: L2 = 6 ! Length in direction a_2 + !#PARAMETERS END# + + !#PARAMETERS START# VAR_Hubbard_Plain_Vanilla + real(Kind=Kind(0.d0)) :: ham_T = 1.d0 ! Hopping parameter + real(Kind=Kind(0.d0)) :: Ham_chem = 0.d0 ! Chemical potential + real(Kind=Kind(0.d0)) :: Ham_U = 4.d0 ! Hubbard interaction + real(Kind=Kind(0.d0)) :: Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau + real(Kind=Kind(0.d0)) :: Beta = 5.d0 ! Inverse temperature + !logical :: Projector= .false. ! Whether the projective algorithm is used + real(Kind=Kind(0.d0)) :: Theta = 10.d0 ! Projection parameter + !logical :: Symm = .true. ! Whether symmetrization takes place + Integer :: N_part = -1 ! Number of particles in trial wave function. If N_part < 0 -> N_part = L1*L2/2 + !#PARAMETERS END# + + Type (Lattice), target :: Latt + Type (Unit_cell), target :: Latt_unit + INTEGER :: nf_calc, nf_reconst + + contains + + module Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + allocate(ham_Hubbard_Plain_Vanilla::ham) + end Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + +! Dynamically generated on compile time from parameters list. +! Supplies the subroutines read_parameters and write_parameters_hdf5. +#include "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hamiltonian +!-------------------------------------------------------------------- + Subroutine Ham_Set + +#if defined (MPI) || defined(TEMPERING) + Use mpi +#endif + Implicit none + + integer :: ierr, nf, unit_info + Character (len=64) :: file_info + + + +#ifdef MPI + Integer :: Isize, Irank, irank_g, isize_g, igroup + Integer :: STATUS(MPI_STATUS_SIZE) + CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR) + CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR) + call MPI_Comm_rank(Group_Comm, irank_g, ierr) + call MPI_Comm_size(Group_Comm, isize_g, ierr) + igroup = irank/isize_g +#endif + + ! From dynamically generated file "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + call read_parameters() + + + If (L1 == 1) then + Write(6,*) 'For one-dimensional lattices set L2=1' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + endif + + if (N_part < 0) N_part = L1*L2/2 + Ltrot = nint(beta/dtau) + Thtrot = 0 + if (Projector) Thtrot = nint(theta/dtau) + Ltrot = Ltrot+2*Thtrot + N_SUN = 1 + N_FL = 2 + + ! Setup the Bravais lattice + Call Ham_Latt + + ! Setup the hopping / single-particle part + Call Ham_Hop + + ! Setup the interaction. + call Ham_V + + ! Setup the trival wave function, in case of a projector approach + if (Projector) Call Ham_Trial() + +#ifdef MPI + If (Irank_g == 0) then +#endif + File_info = "info" +#if defined(TEMPERING) + write(File_info,'(A,I0,A)') "Temp_",igroup,"/info" +#endif + + Open(newunit=unit_info, file=file_info, status="unknown", position="append") + Write(unit_info,*) '=====================================' + Write(unit_info,*) 'Model is : Hubbard_Plain_Vanilla' + Write(unit_info,*) 'Lattice is : ', Lattice_type + Write(unit_info,*) 'L1 : ', L1 + Write(unit_info,*) 'L2 : ', L2 + Write(unit_info,*) '# of orbitals : ', Ndim + Write(unit_info,*) 'Symm. decomp : ', Symm + if (Projector) then + Write(unit_info,*) 'Projective version' + Write(unit_info,*) 'Theta : ', Theta + Write(unit_info,*) 'Tau_max : ', beta + Write(unit_info,*) '# of particles: ', N_part + else + Write(unit_info,*) 'Finite temperture version' + Write(unit_info,*) 'Beta : ', Beta + endif + Write(unit_info,*) 'dtau,Ltrot_eff: ', dtau,Ltrot + Write(unit_info,*) 't : ', Ham_T + Write(unit_info,*) 'Ham_U : ', Ham_U + Write(unit_info,*) 'Ham_chem : ', Ham_chem + If ( Ham_U >=0.d0 .and. Ham_chem == 0.d0 ) then + Write(unit_info,*) 'Assuming particle hole symmetry' + endif + If ( Ham_U < 0.d0 ) then + Write(unit_info,*) 'Assuming time reversal symmetry' + endif + if (Projector) then + Do nf = 1,N_FL + Write(unit_info,*) 'Degen of right trial wave function: ', WF_R(nf)%Degen + Write(unit_info,*) 'Degen of left trial wave function: ', WF_L(nf)%Degen + enddo + endif + Close(unit_info) +#ifdef MPI + Endif +#endif + + ! Particle-hole symmetry for repulsive U only if chemical potential vanishes + ! Time reversal symmetry for attractive U + If ( (Ham_U >= 0.d0 .and. Ham_chem == 0.d0) .or. Ham_U < 0.d0 ) then + allocate(Calc_Fl(N_FL)) + nf_calc=2 + nf_reconst=1 + Calc_Fl(nf_calc)=.True. + Calc_Fl(nf_reconst)=.False. + endif + + + End Subroutine Ham_Set + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Lattice +!-------------------------------------------------------------------- + Subroutine Ham_Latt + + + Implicit none + Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2) + + If (Lattice_Type /= "Square") then + Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif + + Latt_unit%Norb = 1 + Latt_unit%N_coord = 2 + allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2)) + Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0] + + a1_p(1) = 1.0 ; a1_p(2) = 0.d0 + a2_p(1) = 0.0 ; a2_p(2) = 1.d0 + L1_p = dble(L1)*a1_p + L2_p = dble(L2)*a2_p + Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt ) + + Ndim = Latt%N*Latt_unit%Norb + + end Subroutine Ham_Latt +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hopping +!-------------------------------------------------------------------- + Subroutine Ham_Hop + + Implicit none + + Integer :: nf , I, Ix, Iy + allocate(Op_T(1,N_FL)) + do nf = 1,N_FL + Call Op_make(Op_T(1,nf),Ndim) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + If ( L2 > 1 ) then + Iy = Latt%nnlist(I,0,1) + Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + endif + Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0)) + Op_T(1,nf)%P(i) = i + Enddo + Op_T(1,nf)%g = -Dtau + Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0)) + Call Op_set(Op_T(1,nf)) + enddo + + + end Subroutine Ham_Hop +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the trial wave function +!-------------------------------------------------------------------- + Subroutine Ham_Trial() + + Use Predefined_Trial + + Implicit none + + Integer :: nf, Ix, Iy, I, n + Real (Kind=Kind(0.d0)), allocatable :: H0(:,:), U0(:,:), E0(:) + Real (Kind=Kind(0.d0)) :: Pi = acos(-1.d0), Delta = 0.01d0 + + Allocate(WF_L(N_FL),WF_R(N_FL)) + do nf=1,N_FL + Call WF_alloc(WF_L(nf),Ndim,N_part) + Call WF_alloc(WF_R(nf),Ndim,N_part) + enddo + + + Allocate(H0(Ndim,Ndim), U0(Ndim, Ndim), E0(Ndim) ) + H0 = 0.d0; U0 = 0.d0; E0=0.d0 + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + H0(I, Ix) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + H0(Ix, I ) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + If (L2 > 1 ) Then + Iy = Latt%nnlist(I,0,1) + H0(I, Iy) = -Ham_T *(1.d0 - Delta) + H0(Iy, I ) = -Ham_T *(1.d0 - Delta) + Endif + Enddo + Call Diag(H0,U0,E0) +!!$ Do I = 1,Ndim +!!$ Write(6,*) I,E0(I) +!!$ Enddo + Do nf = 1,N_FL + do n=1,N_part + do I=1,Ndim + WF_L(nf)%P(I,n)=U0(I,n) + WF_R(nf)%P(I,n)=U0(I,n) + enddo + enddo + WF_L(nf)%Degen = E0(N_part+1) - E0(N_part) + WF_R(nf)%Degen = E0(N_part+1) - E0(N_part) + enddo + + Deallocate(H0, U0, E0 ) + + end Subroutine Ham_Trial + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the interaction +!-------------------------------------------------------------------- + Subroutine Ham_V + + Use Predefined_Int + Implicit none + + Integer :: nf, I + Real (Kind=Kind(0.d0)) :: X + + + Allocate(Op_V(Ndim,N_FL)) + + do nf = 1,N_FL + do i = 1, Ndim + Call Op_make(Op_V(i,nf), 1) + enddo + enddo + + Do nf = 1,N_FL + X = 1.d0 + if (nf == 2) X = -1.d0 + Do i = 1,Ndim + Op_V(i,nf)%P(1) = I + Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%g = X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0))) + Op_V(i,nf)%alpha = cmplx(-0.5d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%type = 2 + Call Op_set( Op_V(i,nf) ) + Enddo + Enddo + + + end Subroutine Ham_V + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Specifiy the equal time and time displaced observables +!> @details +!-------------------------------------------------------------------- + Subroutine Alloc_obs(Ltau) + + Implicit none + !> Ltau=1 if time displaced correlations are considered. + Integer, Intent(In) :: Ltau + Integer :: i, N, Nt + Character (len=64) :: Filename + Character (len=2) :: Channel + + + ! Scalar observables + Allocate ( Obs_scal(4) ) + Do I = 1,Size(Obs_scal,1) + select case (I) + case (1) + N = 1; Filename ="Kin" + case (2) + N = 1; Filename ="Pot" + case (3) + N = 1; Filename ="Part" + case (4) + N = 1; Filename ="Ener" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Call Obser_Vec_make(Obs_scal(I),N,Filename) + enddo + + ! Equal time correlators + Allocate ( Obs_eq(5) ) + Do I = 1,Size(Obs_eq,1) + select case (I) + case (1) + Filename = "Green" + case (2) + Filename = "SpinZ" + case (3) + Filename = "SpinXY" + case (4) + Filename = "SpinT" + case (5) + Filename = "Den" + case default + Write(6,*) "Error in Alloc_obs" + end select + Nt = 1 + Channel = "--" + Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + + If (Ltau == 1) then + ! time-displaced correlators + Allocate ( Obs_tau(5) ) + Do I = 1,Size(Obs_tau,1) + select case (I) + case (1) + Channel = 'P' ; Filename = "Green" + case (2) + Channel = 'PH'; Filename = "SpinZ" + case (3) + Channel = 'PH'; Filename = "SpinXY" + case (4) + Channel = 'PH'; Filename = "SpinT" + case (5) + Channel = 'PH'; Filename = "Den" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Nt = Ltrot+1-2*Thtrot + If(Projector) Channel = 'T0' + Call Obser_Latt_make(Obs_tau(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + endif + + End Subroutine Alloc_obs + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes equal time observables +!> @details +!> @param [IN] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!> @param [IN] Ntau Integer +!> \verbatim +!> Time slice +!> \endverbatim +!------------------------------------------------------------------- + subroutine Obser(GR,Phase,Ntau, Mc_step_weight) + + Use Predefined_Obs + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GR(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), Intent(IN) :: PHASE + Integer, INTENT(IN) :: Ntau + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Local + Complex (Kind=Kind(0.d0)) :: GRC(Ndim,Ndim,N_FL), ZK + Complex (Kind=Kind(0.d0)) :: Zrho, Zkin, ZPot, Z, ZP,ZS, ZZ, ZXY, ZDen + Integer :: I,J, imj, nf, Ix, Iy + Real (Kind=Kind(0.d0)) :: X + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + + ZS = ZS*Mc_step_weight + + + + Do nf = 1,N_FL + Do I = 1,Ndim + Do J = 1,Ndim + GRC(I, J, nf) = -GR(J, I, nf) + Enddo + GRC(I, I, nf) = 1.D0 + GRC(I, I, nf) + Enddo + Enddo + ! GRC(i,j,nf) = < c^{dagger}_{i,nf } c_{j,nf } > + + ! Compute scalar observables. + Do I = 1,Size(Obs_scal,1) + Obs_scal(I)%N = Obs_scal(I)%N + 1 + Obs_scal(I)%Ave_sign = Obs_scal(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + + Zkin = cmplx(0.d0, 0.d0, kind(0.D0)) + Zkin = Zkin* dble(N_SUN) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) & + & + GRC(I,Ix,2) + GRC(Ix,I,2) + Enddo + If (L2 > 1) then + Do I = 1,Latt%N + Iy = Latt%nnlist(I,0,1) + Zkin = Zkin + GRC(I,Iy,2) + GRC(Iy,I,2) & + & + GRC(I,Iy,1) + GRC(Iy,I,1) + Enddo + Endif + Zkin = Zkin*cmplx(-Ham_T,0.d0,Kind(0.d0)) + Obs_scal(1)%Obs_vec(1) = Obs_scal(1)%Obs_vec(1) + Zkin *ZP* ZS + + + ZPot = cmplx(0.d0, 0.d0, kind(0.D0)) + Do I = 1,Ndim + ZPot = ZPot + Grc(i,i,1) * Grc(i,i, 2) + Enddo + Zpot = Zpot*ham_U + Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + Zpot * ZP*ZS + + + Zrho = cmplx(0.d0,0.d0, kind(0.D0)) + Do I = 1,Ndim + Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) + enddo + Obs_scal(3)%Obs_vec(1) = Obs_scal(3)%Obs_vec(1) + Zrho * ZP*ZS + Obs_scal(4)%Obs_vec(1) = Obs_scal(4)%Obs_vec(1) + (Zkin + Zpot)*ZP*ZS + + Do I = 1,Size(Obs_eq,1) + Obs_eq(I)%N = Obs_eq(I)%N + 1 + Obs_eq(I)%Ave_sign = Obs_eq(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + ZXY = GRC(I,J,1) * GR(I,J,2) + GRC(I,J,2) * GR(I,J,1) + ZZ = GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + & + (GRC(I,I,2) - GRC(I,I,1))*(GRC(J,J,2) - GRC(J,J,1)) + + ZDen = (GRC(I,I,1) + GRC(I,I,2)) * (GRC(J,J,1) + GRC(J,J,2)) + & + & GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + + Obs_eq(1)%Obs_Latt(imj,1,1,1) = Obs_eq(1)%Obs_Latt(imj,1,1,1) + (GRC(I,J,1) + GRC(I,J,2))*ZP*ZS + Obs_eq(2)%Obs_Latt(imj,1,1,1) = Obs_eq(2)%Obs_Latt(imj,1,1,1) + ZZ *ZP*ZS + Obs_eq(3)%Obs_Latt(imj,1,1,1) = Obs_eq(3)%Obs_Latt(imj,1,1,1) + ZXY *ZP*ZS + Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_eq(5)%Obs_Latt(imj,1,1,1) = Obs_eq(5)%Obs_Latt(imj,1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_eq(5)%Obs_Latt0(1) = Obs_eq(5)%Obs_Latt0(1) + (GRC(I,I,1) + GRC(I,I,2)) * ZP*ZS + enddo + + + + + end Subroutine Obser +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes time displaced observables +!> @details +!> @param [IN] NT, Integer +!> \verbatim +!> Imaginary time +!> \endverbatim +!> @param [IN] GT0, GTT, G00, GTT, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> G00(I,J,nf) = +!> GTT(I,J,nf) = +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!------------------------------------------------------------------- + Subroutine ObserT(NT, GT0,G0T,G00,GTT, PHASE, Mc_step_weight ) + + Use Predefined_Obs + + Implicit none + + Integer , INTENT(IN) :: NT + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GT0(Ndim,Ndim,N_FL),G0T(Ndim,Ndim,N_FL),G00(Ndim,Ndim,N_FL),GTT(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), INTENT(IN) :: Phase + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Locals + Complex (Kind=Kind(0.d0)) :: Z, ZP, ZS, ZZ, ZXY, ZDEN + Real (Kind=Kind(0.d0)) :: X + Integer :: IMJ, I, J, I1, J1, no_I, no_J + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + ZS = ZS*Mc_step_weight + + If (NT == 0 ) then + Do I = 1,Size(Obs_tau,1) + Obs_tau(I)%N = Obs_tau(I)%N + 1 + Obs_tau(I)%Ave_sign = Obs_tau(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + Endif + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + + ZZ = (GTT(I,I,1) - GTT(I,I,2) ) * ( G00(J,J,1) - G00(J,J,2) ) & + & - G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + ZXY = - G0T(J,I,1) * GT0(I,J,2) - G0T(J,I,2) * GT0(I,J,1) + + + ZDen = (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2) ) * & + & (cmplx(2.d0,0.d0,kind(0.d0)) - G00(J,J,1) - G00(J,J,2) ) & + & -G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + + Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) + (GT0(I,J,1) + GT0(I,J,2))*ZP*ZS + Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) + ZZ *ZP*ZS + Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) + ZXY *ZP*ZS + Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_tau(5)%Obs_Latt0(1) = Obs_tau(5)%Obs_Latt0(1) + & + & (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2)) * ZP*ZS + enddo + + + + end Subroutine OBSERT + +!-------------------------------------------------------------------- +!> @brief +!> Reconstructs dependent flavors of the configuration's weight. +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!-------------------------------------------------------------------- + subroutine weight_reconstruction(weight) + implicit none + complex (Kind=Kind(0.d0)), Intent(inout) :: weight(:) + + weight(nf_reconst) = conjg(Weight(nf_calc)) + + end subroutine weight_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of equal time Greens function +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!------------------------------------------------------------------- + subroutine GR_reconstruction(GR) + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GR(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Ndim + Do I = 1,Ndim + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + ! write(*,*) Latt%list(I,:),Latt%list(J,:),mod(Latt%list(imj,1)+Latt%list(imj,2),2), X + ZZ=0.d0 + if (I==J) ZZ=1.d0 + GR(I,J,nf_reconst) = ZZ - X*GR(J,I,nf_calc) + Enddo + Enddo + else + Do J = 1,Ndim + Do I = 1,Ndim + GR(I,J,nf_reconst) = Conjg(GR(I,J,nf_calc)) + Enddo + Enddo + Endif + end Subroutine GR_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of time displaced Greens function G0T and GT0 +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] GT0, G0T, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> \endverbatim +!------------------------------------------------------------------- + Subroutine GRT_reconstruction(GT0, G0T) + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GT0(Ndim,Ndim,N_FL), G0T(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Latt%N + Do I = 1,Latt%N + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + G0T(I,J,nf_reconst) = -X*conjg(GT0(J,I,nf_calc)) + GT0(I,J,nf_reconst) = -X*conjg(G0T(J,I,nf_calc)) + enddo + enddo + else + Do J = 1,Latt%N + Do I = 1,Latt%N + G0T(I,J,nf_reconst) = conjg(G0T(I,J,nf_calc)) + GT0(I,J,nf_reconst) = conjg(GT0(I,J,nf_calc)) + enddo + enddo + endif + end Subroutine GRT_reconstruction + + end submodule ham_Hubbard_Plain_Vanilla_smod diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/README.txt b/jupyterbook/source/08-fortran/Solutions/Exercise_1/README.txt new file mode 100644 index 0000000..957cd98 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/README.txt @@ -0,0 +1,6 @@ +This directory contains: + +- Reference solution files for Exercise 1, "Dimensional crossover", of Part II from the ALF Tutorial: modified (and original) Hamiltonian submodule, Start folder. +- Reference data and plot (ladder.dat, ladder.pdf, the latter generated by the gnuplot script ladder.plt; check ladder.dat for expected formatting). + +Built with ALF version: 2.3 beta, commit d80ca7f19937fbf40e1376fa8144e5d473c36374 diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/analysis.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/analysis.sh new file mode 100755 index 0000000..a22f06f --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/analysis.sh @@ -0,0 +1,62 @@ +export ANNAL=${ALF_DIR}"/Analysis/" + +for filename in *_scal; do + echo $filename + export filename1=$filename"J" +# if [ "$filename1" -ot "$filename" ]; then + cp $filename Var_scal + $ANNAL/cov_scal.out + mv "Var_scalJ" $filename"J" + for filename2 in Var_scal_Auto_*; do + if [ -e "${filename2}" ]; then + NewName=`echo ${filename2} | sed s/Var_scal/${filename}/` + mv $filename2 $NewName + fi + done + rm Var_scal +# fi +done + +for filename in *_eq; do + echo $filename + export filename1=$filename"J" +# if [ "$filename1" -ot "$filename" ]; then + ln $filename ineq + $ANNAL/cov_eq.out + mv "equalJ" $filename"JK" + mv "equalJR" $filename"JR" + for filename2 in Var_eq_Auto_Tr*; do + if [ -e "${filename2}" ]; then + NewName=`echo ${filename2} | sed s/Var_eq/${filename}/` + mv $filename2 $NewName + fi + done + rm ineq +# fi +done + + +for filename in *_tau; do + echo $filename + ln $filename intau + if [ "$filename" = "Green_tau" ]; then + $ANNAL/cov_tau.out + else + $ANNAL/cov_tau_ph.out + fi + rm intau + mv SuscepJ $filename"JK" + for filename1 in g_*; do + echo $filename1 + export Name=`echo ${filename} | sed s/_tau//` + export Dir=`echo ${filename1} | sed s/g_/${Name}_/` + echo $Dir + if [ ! -e $Dir ]; then + mkdir $Dir + fi + cd $Dir + mv ../$filename1 . + cd .. + done +done + diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/job.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/job.sh new file mode 100644 index 0000000..1c771d1 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/job.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# The following jobscript contains a few 'variables' marked by the ##...## pattern. +# The user has to provide the appropriate values, e.g. replace ##Nnodes## by 1 if the job is supposed to run on a single node. +# Most variables are selfexplaning, one exceptions might be Nthreads, which is refering to the number of OpenMP threads per MPI task. +# Useful configurations on SuperMUC-NG (48 cores) for Nthreads are 1,2,4,6,12,24 and NtaskPnode = 48/Nthreads +# In general we found that ALF does not profit from hyperthreading such that we suggest to only use physical cores. +# +#SBATCH --job-name DIR_R +#SBATCH --output=out.%j.log +#SBATCH --error=err.%j.log +#Notification and type +#SBATCH --mail-type=ALL +#SBATCH --mail-user=assaad@physik.uni-wuerzburg.de +# Wall clock limit (HH:MM:SS): +#SBATCH --time=48:00:00 +#SBATCH --no-requeue +#Setup of execution environment +#SBATCH --export=NONE +#SBATCH --get-user-env +#SBATCH --account=pr53ju + + +#available partitions: test, micro, general, large, fat +#SBATCH --partition=micro +#SBATCH --nodes=16 +#SBATCH --ntasks-per-node=24 +#SBATCH --cpus-per-task=2 + +#Switch off Energy Aware Runtime for profiling or benchmarking +# #SBATCH --ear=off + +#Important +module load slurm_setup + +module load mpi.intel +module load intel +module load mkl + +cd /hppfs/work/pr53ju/lu57gek5/AF_F_Run/DIR_R +touch RUNNING + +# the follwing eviroment variables generate an optimal pinning (to the best of our knowledge) +# This DOES NOT have to be addepted to the choice of Ntasks +# FIRST EXCEPTION: If you chose to use hyperthreading (not recommended) you should set I_MPI_PIN_CELL=cpu +# SECOND EXCEPTION: The following enviroment variables are Intel specific. +#export KMP_AFFINITY=verbose,granularity=fine,compact +export KMP_AFFINITY=granularity=fine,compact +export I_MPI_PIN_CELL=core +export I_MPI_PIN_DOMAIN=auto:cache +export I_MPI_PIN_ORDER=scatter + +export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK +echo $SLURM_NTASKS $SLURM_CPUS_PER_TASK + +bash ./out_to_in.sh +mpiexec -n $SLURM_NTASKS /dss/dsshome1/05/lu57gek5/AF_F_Code/Prog/AF_F.out + +rm RUNNING diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/out_to_in.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/out_to_in.sh new file mode 100755 index 0000000..01daa39 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/out_to_in.sh @@ -0,0 +1,21 @@ +#!/bin/bash +shopt -s extglob + +if [ -e confout_0.h5 ] && [ -e confout_0 ]; then + >&2 echo "out_to_in.sh: Both plain text and HDF5 configuration present. Please remove one of them." + exit 1 +fi + +if [ -e confout_0.h5 ]; then + for file_out in confout_+([0-9]).h5; do + file_in=${file_out/out/in} + echo "mv $file_out to $file_in" + mv "$file_out" "$file_in" + done +elif [ -e confout_0 ]; then + for file_out in confout_+([0-9]); do + file_in=${file_out/out/in} + echo "mv $file_out to $file_in" + mv "$file_out" "$file_in" + done +fi diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/parameters b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/parameters new file mode 100644 index 0000000..f56bbe6 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/parameters @@ -0,0 +1,157 @@ +!======================================================================================= +! Input variables for a general ALF run +!--------------------------------------------------------------------------------------- +&VAR_ham_name +ham_name = "Hubbard_Plain_Vanilla" +/ + +&VAR_lattice !! Parameters defining the specific lattice and base model +L1 = 14 ! Length in direction a_1 +L2 = 2 ! Length in direction a_2 +Lattice_type = "Square" ! Sets a_1 = (1,0), a_2=(0,1), Norb=1, N_coord=2 +Model = "Hubbard" ! Sets the Hubbard model, to be specified in &VAR_Hubbard +/ + +&VAR_Model_Generic !! Common model parameters +Checkerboard = .T. ! Whether checkerboard decomposition is used +Symm = .T. ! Whether symmetrization takes place +N_SUN = 2 ! Number of colors +N_FL = 1 ! Number of flavors +Phi_X = 0.d0 ! Twist along the L_1 direction, in units of the flux quanta +Phi_Y = 0.d0 ! Twist along the L_2 direction, in units of the flux quanta +Bulk = .T. ! Twist as a vector potential (.T.), or at the boundary (.F.) +N_Phi = 0 ! Total number of flux quanta traversing the lattice +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +/ + +&VAR_QMC !! Variables for the QMC run +Nwrap = 10 ! Stabilization. Green functions will be computed from + ! scratch after each time interval Nwrap*Dtau +NSweep = 20 ! Number of sweeps +NBin = 5 ! Number of bins +Ltau = 1 ! 1 to calculate time-displaced Green functions; 0 otherwise +LOBS_ST = 0 ! Start measurements at time slice LOBS_ST +LOBS_EN = 0 ! End measurements at time slice LOBS_EN +CPU_MAX = 0.0 ! Code stops after CPU_MAX hours, if 0 or not + ! specified, the code stops after Nbin bins +Propose_S0 = .F. ! Proposes single spin flip moves with probability exp(-S0) +Global_moves = .F. ! Allows for global moves in space and time +N_Global = 1 ! Number of global moves per sweep +Global_tau_moves = .F. ! Allows for global moves on a single time slice. +N_Global_tau = 1 ! Number of global moves that will be carried out on a + ! single time slice +Nt_sequential_start = 0 ! One can combine sequential and global moves on a time slice +Nt_sequential_end = -1 ! The program then carries out sequential local moves in the + ! range [Nt_sequential_start, Nt_sequential_end] followed by + ! N_Global_tau global moves +Langevin = .F. ! Langevin update +Delta_t_Langevin_HMC=0.1 ! Default time step for Langevin and HMC updates +Max_Force = 5.0 ! Max Force for Langevin +HMC = .F. ! HMC update +Leapfrog_steps = 0 ! Number of leapfrog interations +/ + +&VAR_errors !! Variables for analysis programs +n_skip = 1 ! Number of bins that to be skipped. +N_rebin = 1 ! Rebinning +N_Cov = 0 ! If set to 1 covariance computed for non-equal-time + ! correlation functions +/ + +&VAR_TEMP !! Variables for parallel tempering +N_exchange_steps = 6 ! Number of exchange moves #[see Eq.~\eqref{eq:exchangestep}]# +N_Tempering_frequency = 10 ! The frequency in units of sweeps at which the + ! exchange moves are carried out +mpi_per_parameter_set = 2 ! Number of mpi-processes per parameter set +Tempering_calc_det = .T. ! Specifies whether the fermion weight has to be taken + ! into account while tempering. The default is .true., + ! and it can be set to .F. if the parameters that + ! get varied only enter the Ising action S_0 +/ + +&VAR_Max_Stoch !! Variables for Stochastic Maximum entropy +Ngamma = 400 ! Number of Dirac delta-functions for parametrization +Om_st = -10.d0 ! Frequency range lower bound +Om_en = 10.d0 ! Frequency range upper bound +NDis = 2000 ! Number of boxes for histogram +Nbins = 250 ! Number of bins for Monte Carlo +Nsweeps = 70 ! Number of sweeps per bin +NWarm = 20 ! The Nwarm first bins will be ommitted +N_alpha = 14 ! Number of temperatures +alpha_st = 1.d0 ! Smallest inverse temperature increment for inverse +R = 1.2d0 ! temperature (see above) +Checkpoint = .F. ! Whether to produce dump files, allowing the simulation + ! to be resumed later on +Tolerance = 0.1d0 ! Data points for which the relative error exceeds the + ! tolerance threshold will be omitted. +/ + +&VAR_Hubbard !! Variables for the specific model +Mz = .T. ! When true, sets the M_z-Hubbard model: Nf=2, demands that + ! N_sun is even, HS field couples to the z-component of + ! magnetization; otherwise, HS field couples to the density +Continuous = .F. ! Uses (T: continuous; F: discrete) HS transformation +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_U2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +/ + +&VAR_Hubbard_Plain_Vanilla !! Variables for the specific model +ham_T = 1.d0 ! Hopping parameter +ham_Ty = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +Symm = .T. ! Whether symmetrization takes place +/ + +&VAR_tV !! Variables for the t-V class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_V = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_V2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +ham_Vperp = 1.d0 ! For bilayer systems +/ + +&VAR_Kondo !! Variables for the Kondo class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_Uc = 0.d0 ! Hubbard interaction on c-orbitals Uc +ham_Uf = 2.d0 ! Hubbard interaction on f-orbials Uf +ham_JK = 2.d0 ! Kondo Coupling J +/ + +&VAR_LRC !! Variables for the Long Range Coulomb class +ham_T = 1.0 ! Specifies the hopping and chemical potential +ham_T2 = 1.0 ! For bilayer systems +ham_Tperp = 1.0 ! For bilayer systems +ham_chem = 1.0 ! Chemical potential +ham_U = 4.0 ! On-site interaction +ham_alpha = 0.1 ! Coulomb tail magnitude +Percent_change = 0.1 ! Parameter P +/ + +&VAR_Z2_Matter !! Variables for the Z_2 class +ham_T = 1.0 ! Hopping for fermions +ham_TZ2 = 1.0 ! Hopping for orthogonal fermions +ham_chem = 0.0 ! Chemical potential for fermions +ham_U = 0.0 ! Hubbard for fermions +Ham_J = 1.0 ! Hopping Z2 matter fields +Ham_K = 1.0 ! Plaquette term for gauge fields +Ham_h = 1.0 ! sigma^x-term for matter +Ham_g = 1.0 ! tau^x-term for gauge +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +/ +! slash terminates namelist statement - DO NOT REMOVE diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/seeds b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/seeds new file mode 100644 index 0000000..8139943 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/Start/seeds @@ -0,0 +1,2297 @@ + 790789 + 452938 + 1048 + 814342 + 227372 + 538812 + 718356 + 402600 + 483443 + 212397 + 361162 + 448281 + 422328 + 433028 + 200386 + 801224 + 678595 + 729131 + 901235 + 573718 + 513521 + 256820 + 472421 + 917847 + 608058 + 45986 + 652882 + 490334 + 793308 + 433895 + 735999 + 604885 + 718486 + 686278 + 831314 + 72032 + 456393 + 805928 + 563751 + 726475 + 46379 + 528791 + 210334 + 641930 + 974820 + 507563 + 274404 + 33470 + 593079 + 682778 + 497340 + 847369 + 472980 + 841410 + 307776 + 38444 + 699773 + 362961 + 708323 + 534905 + 102605 + 153053 + 599781 + 890690 + 422490 + 764529 + 542867 + 625315 + 417774 + 706040 + 957426 + 251217 + 907106 + 938142 + 759152 + 988594 + 749907 + 556890 + 433810 + 167755 + 764337 + 664929 + 548951 + 318956 + 582768 + 430090 + 703129 + 949752 + 444746 + 331485 + 912628 + 9834 + 927466 + 593097 + 435671 + 43376 + 613738 + 804876 + 34144 + 28879 + 697454 + 731335 + 672817 + 906512 + 526561 + 307637 + 656054 + 792961 + 83526 + 823197 + 202042 + 883765 + 403308 + 292770 + 454504 + 43169 + 928824 + 15047 + 931917 + 81458 + 803917 + 318747 + 414235 + 719810 + 103829 + 496215 + 267105 + 242633 + 3166 + 924509 + 203583 + 837411 + 881369 + 374000 + 483361 + 622050 + 365681 + 504464 + 549477 + 359717 + 311616 + 548672 + 102537 + 861189 + 720929 + 183490 + 612438 + 74693 + 597084 + 588468 + 267578 + 863249 + 738221 + 691935 + 361582 + 469519 + 467630 + 604593 + 117520 + 668146 + 301714 + 240613 + 949621 + 605599 + 555458 + 126224 + 162497 + 327517 + 885405 + 395809 + 87858 + 993552 + 770114 + 975502 + 658733 + 779715 + 928137 + 954276 + 421189 + 468216 + 673486 + 142541 + 983548 + 724813 + 208598 + 818235 + 903107 + 63650 + 854808 + 660421 + 10355 + 499605 + 220317 + 870377 + 170696 + 888130 + 305658 + 480193 + 483661 + 952600 + 546669 + 848861 + 919635 + 999151 + 794956 + 345874 + 394067 + 319028 + 235870 + 222315 + 279196 + 278427 + 243968 + 669453 + 353266 + 95838 + 175984 + 64836 + 187246 + 306890 + 101300 + 405885 + 969047 + 916696 + 469914 + 930988 + 765245 + 239692 + 717906 + 928095 + 220292 + 426988 + 810411 + 730807 + 693245 + 681203 + 722082 + 901977 + 831977 + 158818 + 855066 + 604795 + 584896 + 560012 + 394466 + 161392 + 650169 + 406011 + 601316 + 798924 + 362437 + 3927 + 43044 + 583173 + 17034 + 99107 + 761442 + 539634 + 631705 + 214973 + 378140 + 962118 + 145827 + 680367 + 137568 + 908835 + 57127 + 344396 + 887428 + 885996 + 495899 + 978772 + 996661 + 718904 + 736726 + 367660 + 210920 + 610545 + 147695 + 85019 + 445533 + 387688 + 577119 + 959447 + 515976 + 934471 + 177752 + 226525 + 805839 + 813502 + 668514 + 368659 + 872298 + 74449 + 33703 + 642426 + 989079 + 250132 + 659717 + 293416 + 626931 + 540121 + 909273 + 458576 + 871594 + 181828 + 133124 + 756056 + 779265 + 9101 + 119281 + 562550 + 669572 + 198314 + 979727 + 978138 + 356035 + 201969 + 474640 + 478638 + 314042 + 869780 + 774110 + 255438 + 786316 + 757275 + 657358 + 242851 + 825880 + 621885 + 149453 + 832951 + 276529 + 106538 + 595534 + 277919 + 690802 + 610756 + 172528 + 779890 + 185441 + 349245 + 838364 + 268291 + 234370 + 597991 + 718700 + 864689 + 399157 + 127853 + 931135 + 35133 + 996989 + 825655 + 846931 + 429998 + 706132 + 502785 + 790229 + 411330 + 108909 + 891282 + 174773 + 267688 + 172161 + 827435 + 78122 + 116489 + 665222 + 622875 + 253374 + 493848 + 515383 + 623167 + 578383 + 631930 + 100864 + 953906 + 942476 + 423786 + 481282 + 454310 + 570674 + 75698 + 565617 + 798315 + 785412 + 447026 + 217685 + 803165 + 205754 + 77552 + 299103 + 925511 + 384113 + 902316 + 649762 + 945000 + 880472 + 653971 + 5792 + 835372 + 774101 + 952619 + 855030 + 823053 + 612773 + 83155 + 229993 + 633246 + 799491 + 460116 + 438345 + 923529 + 416696 + 780020 + 730863 + 904946 + 487993 + 861211 + 906910 + 150603 + 677370 + 171202 + 857401 + 591759 + 425912 + 41522 + 45272 + 701420 + 526024 + 570055 + 923449 + 865435 + 133145 + 210888 + 290319 + 941090 + 214974 + 51653 + 582694 + 3198 + 438183 + 778368 + 106285 + 277696 + 492636 + 327787 + 203666 + 262738 + 853111 + 227238 + 359747 + 37287 + 978515 + 621969 + 244739 + 757213 + 948607 + 989992 + 694626 + 338882 + 538213 + 544427 + 629131 + 330252 + 728945 + 323345 + 907187 + 969467 + 658423 + 967111 + 119904 + 430951 + 6990 + 183229 + 321038 + 259000 + 821934 + 898687 + 694962 + 988876 + 779203 + 99796 + 162132 + 955404 + 882627 + 359540 + 922055 + 289062 + 600636 + 52415 + 933763 + 99574 + 440478 + 256776 + 333776 + 847010 + 959938 + 344676 + 791573 + 900371 + 216557 + 259217 + 802561 + 283692 + 654350 + 479387 + 918543 + 609627 + 428026 + 672406 + 915690 + 200550 + 164706 + 33572 + 900002 + 397142 + 163142 + 313603 + 350287 + 54492 + 30436 + 533479 + 98621 + 225684 + 756256 + 386788 + 248320 + 32895 + 224561 + 329570 + 29413 + 725990 + 162813 + 357659 + 591602 + 928608 + 528699 + 471528 + 734737 + 71766 + 334350 + 828633 + 576786 + 14945 + 908058 + 583255 + 159296 + 854688 + 593499 + 413845 + 990372 + 920691 + 886444 + 737870 + 525136 + 959398 + 8985 + 614151 + 583702 + 505097 + 921252 + 332713 + 706645 + 438510 + 770629 + 692123 + 447964 + 732887 + 778475 + 964341 + 605558 + 387603 + 564343 + 547054 + 389188 + 549250 + 907697 + 303530 + 525951 + 820229 + 947134 + 589954 + 303247 + 754846 + 817098 + 970276 + 549246 + 542905 + 722102 + 618553 + 550859 + 880803 + 448449 + 408792 + 909207 + 30119 + 313443 + 692298 + 332587 + 63716 + 552116 + 762512 + 366942 + 299327 + 141443 + 7358 + 63834 + 920653 + 62060 + 749086 + 585904 + 785954 + 997485 + 771617 + 749850 + 424146 + 470835 + 535385 + 506889 + 218392 + 419045 + 79680 + 360729 + 777199 + 204588 + 612497 + 723036 + 493006 + 64692 + 787871 + 206405 + 288283 + 998059 + 670730 + 854828 + 549124 + 89088 + 389231 + 311661 + 246339 + 269585 + 474611 + 925093 + 244049 + 517991 + 888522 + 791119 + 795777 + 496094 + 737884 + 734002 + 228047 + 623251 + 677222 + 224248 + 811473 + 588107 + 998513 + 234069 + 819356 + 297813 + 408530 + 30359 + 773775 + 264743 + 493682 + 905153 + 879183 + 430715 + 872362 + 843607 + 643499 + 428709 + 34791 + 129456 + 686702 + 282088 + 870356 + 887991 + 736927 + 541311 + 882460 + 566523 + 814056 + 858158 + 90864 + 352354 + 600814 + 997445 + 621529 + 528245 + 1359 + 286244 + 983961 + 765383 + 887380 + 500603 + 36055 + 353855 + 31690 + 189761 + 636438 + 370608 + 229317 + 437870 + 984314 + 784929 + 606101 + 63213 + 646806 + 501403 + 114784 + 254924 + 273802 + 340389 + 218608 + 647203 + 295 + 955986 + 762408 + 831038 + 536232 + 691500 + 31201 + 303423 + 943853 + 372418 + 996286 + 854078 + 36870 + 748834 + 389664 + 861146 + 603604 + 120983 + 195504 + 877868 + 477451 + 494433 + 634805 + 147561 + 92294 + 796535 + 285370 + 216596 + 391538 + 683890 + 513823 + 85202 + 246080 + 913443 + 487324 + 797309 + 809773 + 901069 + 622788 + 717893 + 812399 + 467679 + 473605 + 497815 + 790137 + 772801 + 53861 + 726174 + 253531 + 435684 + 600051 + 270141 + 792958 + 843885 + 770301 + 302308 + 121600 + 649367 + 281088 + 15531 + 55907 + 452090 + 981457 + 25273 + 433574 + 671106 + 364740 + 459449 + 968999 + 603153 + 517774 + 735768 + 46264 + 668747 + 507622 + 26578 + 449593 + 845780 + 205790 + 411209 + 31326 + 290607 + 549946 + 715819 + 317389 + 146646 + 243138 + 40734 + 50259 + 540468 + 890514 + 975293 + 669434 + 765394 + 573541 + 500195 + 729405 + 652585 + 861724 + 577338 + 255118 + 129638 + 261821 + 427166 + 34951 + 966678 + 104567 + 493512 + 851175 + 709957 + 868889 + 95939 + 647927 + 802939 + 943628 + 769591 + 636680 + 894902 + 826753 + 292526 + 339208 + 337026 + 762086 + 400570 + 568056 + 865991 + 813514 + 189655 + 344511 + 475068 + 376713 + 205664 + 754067 + 472712 + 128365 + 221775 + 739397 + 728660 + 412876 + 703304 + 830821 + 107520 + 66595 + 960052 + 814273 + 89869 + 679534 + 986143 + 336770 + 580841 + 294585 + 987373 + 449386 + 906228 + 544241 + 596050 + 87711 + 996068 + 224812 + 773341 + 489829 + 755741 + 308145 + 399114 + 551783 + 624563 + 390844 + 549281 + 120540 + 321879 + 580987 + 460643 + 224469 + 780657 + 822345 + 183234 + 241299 + 268583 + 656102 + 920163 + 3596 + 696651 + 420071 + 54961 + 841729 + 115262 + 885418 + 866420 + 564336 + 397812 + 330874 + 930941 + 376298 + 111793 + 54458 + 212377 + 734203 + 577379 + 322696 + 839373 + 139318 + 113524 + 757338 + 570216 + 868055 + 471556 + 159577 + 945174 + 639944 + 456269 + 771769 + 126340 + 223095 + 734519 + 976649 + 424978 + 977175 + 434053 + 516368 + 333869 + 313412 + 655136 + 342142 + 214854 + 160411 + 14088 + 700139 + 387265 + 323346 + 197358 + 521738 + 756667 + 470781 + 90367 + 836710 + 597518 + 922403 + 101729 + 425558 + 721145 + 770116 + 924972 + 159359 + 581205 + 186633 + 737755 + 27113 + 316661 + 921573 + 838584 + 850580 + 732247 + 985053 + 721036 + 686632 + 216434 + 518782 + 585474 + 917088 + 596907 + 854653 + 288268 + 26063 + 933525 + 760839 + 728510 + 64813 + 248795 + 875386 + 672237 + 804075 + 195840 + 327309 + 14150 + 573910 + 663863 + 545179 + 476827 + 791051 + 321126 + 253226 + 747448 + 173746 + 95407 + 654925 + 52012 + 644097 + 591977 + 804094 + 167053 + 917911 + 449066 + 163486 + 868862 + 782037 + 630831 + 350884 + 820205 + 59213 + 657824 + 72694 + 894540 + 260411 + 774965 + 245037 + 937739 + 924678 + 57008 + 302347 + 967303 + 646481 + 451506 + 693461 + 809084 + 790551 + 759288 + 565215 + 171501 + 894227 + 552420 + 633535 + 157262 + 757297 + 29680 + 242034 + 212579 + 219345 + 809520 + 608105 + 513890 + 624596 + 660541 + 256512 + 792075 + 974255 + 169460 + 640487 + 594177 + 766352 + 346575 + 950322 + 982621 + 523091 + 168739 + 109465 + 671928 + 5684 + 59827 + 958109 + 602941 + 116707 + 308701 + 624291 + 954539 + 489932 + 424686 + 82484 + 592856 + 767677 + 430531 + 899689 + 958002 + 565651 + 92885 + 169029 + 388279 + 125294 + 90261 + 630847 + 881902 + 653620 + 118503 + 981293 + 296217 + 350567 + 368425 + 984418 + 123833 + 332960 + 75796 + 869769 + 991226 + 71756 + 393551 + 957321 + 170504 + 720021 + 677023 + 283131 + 856719 + 454802 + 592822 + 300979 + 687065 + 790793 + 552432 + 706591 + 893215 + 248305 + 333304 + 699351 + 141168 + 958730 + 887447 + 681529 + 58597 + 207515 + 337529 + 394991 + 449684 + 914627 + 160462 + 495423 + 197471 + 52524 + 558502 + 564047 + 853700 + 1623 + 17839 + 556841 + 916160 + 843269 + 54694 + 691259 + 793525 + 590203 + 148909 + 770446 + 457705 + 354530 + 865045 + 944962 + 783685 + 453193 + 160972 + 911996 + 576869 + 450932 + 883965 + 552086 + 287925 + 140763 + 454297 + 3340 + 415129 + 461942 + 736331 + 173152 + 594209 + 355430 + 97120 + 687423 + 375685 + 556871 + 652491 + 277278 + 689719 + 327051 + 700648 + 603284 + 998453 + 119875 + 343259 + 517172 + 135857 + 187828 + 294055 + 761053 + 835070 + 124952 + 874920 + 104139 + 943244 + 347308 + 199486 + 916958 + 323889 + 510947 + 544227 + 183076 + 446717 + 867379 + 907052 + 948316 + 664984 + 556544 + 753401 + 207474 + 180334 + 837276 + 949835 + 228541 + 695146 + 255275 + 885132 + 314418 + 752373 + 748575 + 778884 + 2140 + 762888 + 690513 + 177581 + 699588 + 720327 + 870197 + 638217 + 759713 + 603437 + 410477 + 599375 + 992255 + 465912 + 623408 + 439823 + 612956 + 213743 + 803227 + 724611 + 630285 + 70059 + 956815 + 638658 + 669655 + 727472 + 471669 + 607853 + 235139 + 187919 + 721370 + 107645 + 408693 + 290010 + 608552 + 659137 + 986870 + 923864 + 45370 + 12679 + 55045 + 933461 + 371469 + 518965 + 999126 + 706481 + 709454 + 687622 + 954781 + 451650 + 257856 + 933308 + 694148 + 163579 + 521605 + 509305 + 950063 + 275117 + 479994 + 628608 + 177771 + 997184 + 692151 + 772527 + 754149 + 346123 + 340006 + 186774 + 614424 + 858541 + 208762 + 565058 + 326389 + 993649 + 604861 + 920183 + 602128 + 223113 + 211454 + 642635 + 247228 + 808392 + 881370 + 746681 + 547501 + 265584 + 367584 + 303963 + 93203 + 517769 + 991188 + 64586 + 40753 + 734854 + 246855 + 265718 + 811947 + 860916 + 345814 + 627680 + 230686 + 829045 + 696313 + 537542 + 97185 + 463688 + 321591 + 420216 + 199698 + 70494 + 215346 + 297049 + 763736 + 713657 + 634705 + 531917 + 338782 + 180760 + 330690 + 764820 + 122513 + 635116 + 716188 + 32973 + 722520 + 955618 + 971420 + 79403 + 355524 + 764076 + 86912 + 849042 + 484094 + 140064 + 843958 + 172319 + 890868 + 23265 + 732595 + 636254 + 190274 + 303312 + 807068 + 643053 + 777741 + 597133 + 478800 + 656204 + 216427 + 713795 + 246859 + 634063 + 61430 + 806846 + 365931 + 650957 + 121513 + 214163 + 451783 + 705772 + 158317 + 985290 + 24238 + 718049 + 23085 + 96286 + 987636 + 711575 + 230878 + 352069 + 48812 + 185482 + 972292 + 976255 + 72558 + 672834 + 562681 + 888507 + 374592 + 486727 + 328874 + 669376 + 952031 + 653880 + 933391 + 212645 + 651356 + 35726 + 136166 + 65175 + 273883 + 637012 + 993764 + 454245 + 618729 + 101887 + 496098 + 2399 + 463285 + 397500 + 640650 + 129786 + 481179 + 685089 + 944190 + 144010 + 97751 + 378579 + 391994 + 17466 + 283017 + 390677 + 824561 + 852191 + 282141 + 566458 + 761834 + 32202 + 283399 + 304467 + 664919 + 63344 + 23655 + 365310 + 635302 + 100630 + 331324 + 867744 + 551568 + 163088 + 606841 + 472279 + 643623 + 36104 + 240633 + 752261 + 504407 + 861264 + 968587 + 752477 + 539117 + 413698 + 165015 + 735239 + 851925 + 66927 + 73127 + 113985 + 570197 + 445204 + 972999 + 574368 + 606208 + 763355 + 287039 + 382853 + 856369 + 854131 + 622959 + 882808 + 837935 + 883043 + 754242 + 178100 + 763234 + 750711 + 538113 + 4187 + 51379 + 182705 + 771002 + 786713 + 277487 + 506891 + 981522 + 887601 + 559404 + 118273 + 160928 + 38648 + 381916 + 631337 + 431092 + 962616 + 858472 + 719898 + 649970 + 181830 + 430402 + 644437 + 954572 + 14266 + 3636 + 466951 + 241426 + 757152 + 522921 + 953294 + 584554 + 58054 + 983543 + 163021 + 590935 + 473476 + 880543 + 726731 + 693475 + 214951 + 95435 + 810914 + 381480 + 82635 + 220430 + 770291 + 368616 + 586399 + 320147 + 487659 + 698388 + 254427 + 130839 + 401234 + 787100 + 129305 + 697107 + 219499 + 404330 + 451621 + 446121 + 323540 + 590896 + 531049 + 699338 + 856898 + 514322 + 804954 + 621721 + 502907 + 261813 + 84477 + 608456 + 949540 + 570721 + 988133 + 109176 + 41752 + 496509 + 562904 + 889671 + 621325 + 18229 + 92832 + 731118 + 54211 + 581482 + 95114 + 566787 + 445374 + 578892 + 503694 + 56272 + 541138 + 768074 + 40360 + 597201 + 319026 + 627101 + 773333 + 774459 + 265106 + 647473 + 863365 + 246905 + 338837 + 564588 + 497329 + 71591 + 625408 + 525708 + 9318 + 465482 + 675585 + 195431 + 189232 + 4675 + 533054 + 798654 + 778879 + 261113 + 449265 + 101050 + 155561 + 876811 + 285774 + 327028 + 203175 + 75569 + 604090 + 15210 + 370802 + 612195 + 443016 + 811392 + 918803 + 159218 + 783493 + 199019 + 352412 + 131113 + 700946 + 167151 + 42830 + 946017 + 205126 + 815931 + 35816 + 724948 + 767451 + 899554 + 47788 + 428523 + 535858 + 306740 + 649407 + 431176 + 237136 + 478694 + 636681 + 532881 + 766778 + 764586 + 589548 + 408365 + 466323 + 714508 + 617980 + 493833 + 88195 + 309952 + 295569 + 311180 + 448054 + 131775 + 780626 + 229714 + 764634 + 465667 + 124771 + 665376 + 687091 + 345120 + 769028 + 717453 + 9841 + 531900 + 227421 + 242804 + 74912 + 434010 + 958064 + 367572 + 861779 + 961166 + 421758 + 436409 + 764716 + 317758 + 328081 + 399188 + 57631 + 733324 + 68987 + 635228 + 46419 + 130518 + 339894 + 215010 + 908799 + 730576 + 948283 + 599394 + 221659 + 596289 + 809788 + 776342 + 175902 + 112467 + 131790 + 835132 + 478788 + 403914 + 784514 + 978082 + 943779 + 690888 + 859620 + 969762 + 767881 + 582080 + 416296 + 23720 + 496489 + 305072 + 414854 + 126696 + 675730 + 874316 + 837823 + 800342 + 192307 + 196596 + 998541 + 300442 + 300844 + 113998 + 37254 + 253627 + 338728 + 384381 + 604701 + 731599 + 128454 + 599342 + 733218 + 762846 + 67467 + 39691 + 895321 + 281863 + 905507 + 468411 + 249810 + 515867 + 209455 + 861134 + 75357 + 809021 + 515672 + 74109 + 391598 + 884149 + 169845 + 449664 + 767733 + 541955 + 854333 + 359185 + 318614 + 797745 + 803007 + 683576 + 888343 + 455641 + 703595 + 231233 + 421362 + 120304 + 287529 + 93510 + 521049 + 646149 + 607282 + 937689 + 195813 + 24066 + 1218 + 237448 + 792683 + 705640 + 745934 + 440832 + 118408 + 364867 + 396102 + 75719 + 748045 + 97373 + 811814 + 792788 + 521056 + 57135 + 873426 + 345992 + 224902 + 530697 + 883900 + 510524 + 466134 + 448892 + 658652 + 938284 + 728992 + 336057 + 302891 + 950851 + 621491 + 696755 + 676465 + 269951 + 309021 + 839991 + 546204 + 685424 + 135440 + 140934 + 425765 + 660696 + 431665 + 740132 + 102974 + 875744 + 511766 + 680232 + 854672 + 707566 + 856565 + 480203 + 349056 + 648152 + 484723 + 147048 + 235526 + 659949 + 511336 + 625026 + 422024 + 468835 + 894031 + 682371 + 39883 + 794580 + 366558 + 235512 + 96168 + 518823 + 559882 + 110788 + 813521 + 790535 + 310780 + 243669 + 657501 + 68990 + 157934 + 315476 + 51434 + 104235 + 25522 + 827598 + 778751 + 855055 + 94315 + 613209 + 72836 + 344445 + 860270 + 786492 + 394367 + 452578 + 380622 + 129352 + 896160 + 647273 + 707481 + 915640 + 575515 + 651965 + 508921 + 172866 + 114057 + 51172 + 877579 + 381423 + 405082 + 833465 + 326745 + 611304 + 768398 + 871937 + 973958 + 96318 + 852672 + 342170 + 912098 + 245813 + 225271 + 77707 + 767980 + 93893 + 649608 + 863018 + 448451 + 186136 + 49983 + 663968 + 73977 + 903812 + 163932 + 795788 + 99744 + 225606 + 882062 + 28544 + 624248 + 926831 + 275405 + 630105 + 885388 + 216152 + 310252 + 346608 + 944062 + 809801 + 250506 + 320435 + 555259 + 443298 + 747518 + 945674 + 226655 + 820667 + 617434 + 661092 + 464705 + 1158 + 306041 + 680601 + 208235 + 223466 + 41106 + 661230 + 449540 + 167444 + 672223 + 308590 + 42976 + 653330 + 198157 + 919847 + 701050 + 778459 + 981684 + 864188 + 178020 + 491485 + 651941 + 788 + 640986 + 604100 + 694264 + 34284 + 228482 + 240251 + 727533 + 807738 + 796572 + 722859 + 469019 + 533111 + 852442 + 898039 + 386724 + 959228 + 675496 + 896820 + 39227 + 477247 + 625949 + 334358 + 103025 + 163631 + 640918 + 946662 + 87381 + 760613 + 918022 + 664807 + 736665 + 594166 + 786467 + 126658 + 120197 + 429473 + 765648 + 626082 + 409593 + 263893 + 811239 + 499674 + 343607 + 57435 + 748784 + 950970 + 380475 + 400719 + 894798 + 312169 + 537761 + 120452 + 865355 + 743352 + 919698 + 822392 + 572181 + 369198 + 932031 + 371820 + 406253 + 853205 + 184365 + 311506 + 608889 + 409408 + 80005 + 217178 + 830341 + 251598 + 93301 + 990495 + 875893 + 480041 + 734491 + 89510 + 639451 + 405694 + 202046 + 696642 + 224636 + 311930 + 722514 + 824143 + 253381 + 653750 + 577862 + 357069 + 362025 + 694506 + 820321 + 33748 + 884901 + 580116 + 674729 + 363746 + 725438 + 850789 + 628375 + 483339 + 414749 + 390237 + 208344 + 948482 + 357723 + 812398 + 446359 + 465275 + 266628 + 285651 + 31124 + 557933 + 782195 + 794540 + 148173 + 174258 + 282216 + 838990 + 7206 + 228600 + 877638 + 571022 + 56939 + 82333 + 596155 + 368978 + 887444 + 961823 + 753304 + 849238 + 819994 + 313891 + 511058 + 315436 + 184410 + 98790 + 623916 + 645182 + 283898 + 20666 + 372505 + 614277 + 47397 + 695531 + 684664 + 658437 + 369425 + 756733 + 444047 + 72508 + 137417 + 897920 + 986208 + 647183 + 946571 + 853514 + 782201 + 743228 + 502197 + 316675 + 309674 + 803192 + 709551 + 794774 + 111456 + 300633 + 451187 + 402357 + 41660 + 126831 + 51796 + 591620 + 699268 + 415010 + 430553 + 820372 + 49231 + 802058 + 940958 + 157506 + 231060 + 127742 + 898181 + 825969 + 554921 + 571429 + 793907 + 683227 + 685227 + 226304 + 198676 + 639240 + 11734 + 111090 + 351732 + 11923 + 208132 + 619265 + 438361 + 820122 + 978141 + 405782 + 554740 + 14077 + 989104 + 711288 + 360278 + 643395 + 993082 + 123841 + 417459 + 962516 + 135444 + 778130 + 219187 + 473683 + 450966 + 992195 + 903632 + 907411 + 547421 + 341643 + 656569 + 140454 + 476673 + 171367 + 801225 + 51277 + 793271 + 544769 + 575621 + 313020 + 800547 + 630473 + 597419 + 123972 + 984202 + 526547 + 16260 + 875536 + 633405 + 522223 + 353616 + 757698 + 649386 + 797110 + 30123 + 302000 + 541531 + 557920 + 580435 + 862002 + 610970 + 612682 + 555563 + 31256 + 321677 + 382462 + 112717 + 998773 + 859063 + 350583 + 292654 + 841990 + 876066 + 949341 + 984518 + 757244 + 426748 + 884226 + 578188 + 227733 + 87388 + 895641 + 304116 + 128992 + 265074 + 958118 + 260675 + 771858 + 693801 + 917041 + 129004 + 882939 + 118061 + 562860 + 575346 + 522583 + 163935 + 142813 + 340897 + 940348 + 397694 + 310145 + 19147 + 367970 + 571885 + 510824 + 520727 + 749829 + 58931 + 807762 + 225747 + 410924 + 472218 + 142533 + 823646 + 662334 + 474695 + 34593 + 840532 + 344193 + 774966 + 717995 + 854025 + 306158 + 310882 + 715613 + 395604 + 825372 + 620634 + 850857 + 540451 + 961941 + 401352 + 696892 + 184789 + 851896 + 255193 + 463359 + 10732 diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.dat b/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.dat new file mode 100644 index 0000000..6e2850a --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.dat @@ -0,0 +1,34 @@ +#ty = 0 + +.00000000000000000E+000 0.80087285415693787E+000 0.20364045785825824E-002 +0.10000000000000000E+001 -0.41246466798652831E+000 0.58719770815059474E-002 +0.20000000000000000E+001 0.13444768233114479E+000 0.36640373525590351E-002 +0.30000000000000000E+001 -0.10041401167949351E+000 0.18366352320403423E-002 +0.40000000000000000E+001 0.61318833501215066E-001 0.98839136867371006E-002 +0.50000000000000000E+001 -0.39684587988747938E-001 0.12681564698161578E-001 +0.60000000000000000E+001 0.30374206884811135E-001 0.14254662962470842E-001 +0.70000000000000000E+001 -0.19746402386900883E-001 0.11073612077605712E-001 + + +#ty = 1 + +0.00000000000000000E+000 0.77502866536858084E+000 0.23355506366194456E-002 +0.10000000000000000E+001 -0.34545413878193948E+000 0.17290847257967326E-001 +0.20000000000000000E+001 0.11342400829354173E+000 0.55143042114028252E-002 +0.30000000000000000E+001 -0.98162765127248794E-001 0.12100660079297278E-001 +0.40000000000000000E+001 0.70628658068037461E-001 0.92040062353415178E-002 +0.50000000000000000E+001 -0.49180843628820831E-001 0.14750338702691154E-001 +0.60000000000000000E+001 0.46388617113667319E-001 0.27255426007052941E-001 +0.70000000000000000E+001 -0.29880262290898359E-001 0.16965960334631807E-001 + + +#ty = 2 + +0.00000000000000000E+000 0.73511627221090126E+000 0.54912829432050044E-003 +0.10000000000000000E+001 -0.77954862933545754E-001 0.75173745261179325E-002 +0.20000000000000000E+001 0.22031934078852369E-001 0.42817016245693318E-002 +0.30000000000000000E+001 -0.91804429722397683E-002 0.29445528362570185E-002 +0.40000000000000000E+001 0.29692365818215728E-002 0.30572628252887521E-002 +0.50000000000000000E+001 0.18892662748750067E-003 0.39793813717428550E-002 +0.60000000000000000E+001 0.24890563385449394E-002 0.54807827912358668E-002 +0.70000000000000000E+001 0.15576832889772946E-002 0.68570470862257147E-002 diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.pdf b/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.pdf new file mode 100644 index 0000000..42ae9b3 Binary files /dev/null and b/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.pdf differ diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.plt b/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.plt new file mode 100644 index 0000000..42f7ea2 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_1/ladder.plt @@ -0,0 +1,17 @@ +set terminal postscript eps enhanced solid color 'Times-Roman' 18 +set size 0.8,0.8 +set title "{L=14 Hubbard Ladder, {/Symbol b}t=10, U/t=4 }" +set out 'ladder.eps' +set fit errorvariables +set xlabel "r" +set ylabel "S(r,0)" + +plot "ladder.dat" i 0 u 1:2:3 w e lc rgb "black" lt 1 pt 7 lw 2 t "t_y=0" , \ + '' i 0 u 1:2 w l lc rgb "black" lt 1 lw 2 t "" , \ + '' i 1 u 1:2:3 w e lc rgb "red" lt 1 pt 7 lw 2 t "t_y=1" , \ + '' i 1 u 1:2 w l lc rgb "red" lt 1 lw 2 t "" , \ + '' i 2 u 1:2:3 w e lc rgb "royalblue" lt 1 pt 7 lw 2 t "t_y=2" ,\ + '' i 2 u 1:2 w l lc rgb "royalblue" lt 1 lw 2 t "" + +!epstopdf ladder.eps +!evince ladder.pdf diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_2 b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_2 new file mode 100644 index 0000000..1186e90 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_2 @@ -0,0 +1,948 @@ +! Copyright (C) 2016 - 2020 The ALF project +! +! The ALF project is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! The ALF project is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with ALF. If not, see http://www.gnu.org/licenses/. +! +! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms: +! +! - It is our hope that this program makes a contribution to the scientific community. Being +! part of that community we feel that it is reasonable to require you to give an attribution +! back to the original authors if you have benefitted from this program. +! Guidelines for a proper citation can be found on the project's homepage +! http://alf.physik.uni-wuerzburg.de +! +! - We require the preservation of the above copyright notice and this license in all original files. +! +! - We prohibit the misrepresentation of the origin of the original source files. To obtain +! the original source files please visit the homepage http://alf.physik.uni-wuerzburg.de . +! +! - If you make substantial changes to the program we require you to either consider contributing +! to the ALF project or to mark your material in a reasonable way as different from the original version + + +!-------------------------------------------------------------------- +!> @author +!> ALF-project +!> +!> @brief +!> This module defines the Hamiltonian and observables. Here, we have included a +!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models +!> on honeycomb, pi-flux and square lattices. + +!> @details +!> The public variables of this module are the following +!> +!> +!> @param [public] OP_V +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice. +!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim +!> +!> @param [public] OP_T +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> Sequence of operators accounting for the hopping on a time slice. This can include various +!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to +!> the flavor index. \endverbatim +!> * The progagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is +!> first the hopping and then the potential energy. +!> +!>@param [public] WF_L +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Left trial wave function. \endverbatim +!> +!> @param [public] WF_R +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim +!> +!> @param [public] nsigma +!> \verbatim Type(Fields) +!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator +!> sequence. The second through the time slices. \endverbatim +! +!> @param [public] Ndim +!> \verbatim Integer +!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim +! +!> @param [public] N_FL +!> \verbatim Integer +!> # of flavors. Propagation is block diagonal in flavors. \endverbatim +! +!> @param [public] N_SUN +!> \verbatim Integer +!> # of colors. Propagation is color independent. \endverbatim +!> +!> @param [public] Ltrot +!> \verbatim Integer +!> Available measurment interval in units of Delta Tau. \endverbatim +!> +!> @param [public] Thtrot +!> \verbatim Integer +!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim +!> +!> @param [public] Projector +!> \verbatim Logical +!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim +!> +!> @param [public] Group_Comm +!> \verbatim Integer +!> Defines MPI communicator \endverbatim +! +!> @param [public] Symm +!> \verbatim Logical \endverbatim +!> If set to true then the green functions will be symmetrized +!> before being sent to the Obser, ObserT subroutines. +!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$ +!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that +!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed +!> symmetrically. If Symm is true, the propagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$ +!> +!> +!> You still have to add some docu for the other private variables in this module. +!> +!-------------------------------------------------------------------- + + submodule (Hamiltonian_main) ham_Hubbard_Plain_Vanilla_smod + + Use Operator_mod + Use WaveFunction_mod + Use Lattices_v3 + Use MyMats + Use Random_Wrap + Use Files_mod + Use Matrix + Use Observables + Use Fields_mod + Use Predefined_Hoppings + Use LRC_Mod + use runtime_error_mod + + + Implicit none + + type, extends(ham_base) :: ham_Hubbard_Plain_Vanilla + contains + ! Set Hamiltonian-specific procedures + procedure, nopass :: Ham_Set + procedure, nopass :: Alloc_obs + procedure, nopass :: Obser + procedure, nopass :: ObserT + procedure, nopass :: weight_reconstruction + procedure, nopass :: GR_reconstruction + procedure, nopass :: GRT_reconstruction +#ifdef HDF5 + procedure, nopass :: write_parameters_hdf5 +#endif + end type ham_Hubbard_Plain_Vanilla + + !#PARAMETERS START# VAR_lattice + Character (len=64) :: Model = '' ! Value irrelevant + Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square' + Integer :: L1 = 6 ! Length in direction a_1 + Integer :: L2 = 6 ! Length in direction a_2 + !#PARAMETERS END# + + !#PARAMETERS START# VAR_Hubbard_Plain_Vanilla + real(Kind=Kind(0.d0)) :: ham_T = 1.d0 ! Hopping parameter + real(Kind=Kind(0.d0)) :: Ham_chem = 0.d0 ! Chemical potential + real(Kind=Kind(0.d0)) :: Ham_U = 4.d0 ! Hubbard interaction +!!!!! Modifications for Exercise 2 + real (Kind=Kind(0.d0)) :: Ham_Vint = 2.d0 +!!!!! + real(Kind=Kind(0.d0)) :: Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau + real(Kind=Kind(0.d0)) :: Beta = 5.d0 ! Inverse temperature + !logical :: Projector= .false. ! Whether the projective algorithm is used + real(Kind=Kind(0.d0)) :: Theta = 10.d0 ! Projection parameter + !logical :: Symm = .true. ! Whether symmetrization takes place + Integer :: N_part = -1 ! Number of particles in trial wave function. If N_part < 0 -> N_part = L1*L2/2 + !#PARAMETERS END# + + Type (Lattice), target :: Latt + Type (Unit_cell), target :: Latt_unit + INTEGER :: nf_calc, nf_reconst + + contains + + module Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + allocate(ham_Hubbard_Plain_Vanilla::ham) + end Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + +! Dynamically generated on compile time from parameters list. +! Supplies the subroutines read_parameters and write_parameters_hdf5. +#include "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hamiltonian +!-------------------------------------------------------------------- + Subroutine Ham_Set + +#if defined (MPI) || defined(TEMPERING) + Use mpi +#endif + Implicit none + + integer :: ierr, nf, unit_info + Character (len=64) :: file_info + + + +#ifdef MPI + Integer :: Isize, Irank, irank_g, isize_g, igroup + Integer :: STATUS(MPI_STATUS_SIZE) + CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR) + CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR) + call MPI_Comm_rank(Group_Comm, irank_g, ierr) + call MPI_Comm_size(Group_Comm, isize_g, ierr) + igroup = irank/isize_g +#endif + + ! From dynamically generated file "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + call read_parameters() + + + If (L1 == 1) then + Write(6,*) 'For one-dimensional lattices set L2=1' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + endif + + if (N_part < 0) N_part = L1*L2/2 + Ltrot = nint(beta/dtau) + Thtrot = 0 + if (Projector) Thtrot = nint(theta/dtau) + Ltrot = Ltrot+2*Thtrot + N_SUN = 1 +!!!!! Modifications for Exercise 2 + !N_FL = 2 + N_FL = 1 + If (L2 /= 1) then + Write(6,*) "The t_V model is implemented only for L2 = 1" + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif +!!!!! + + ! Setup the Bravais lattice + Call Ham_Latt + + ! Setup the hopping / single-particle part + Call Ham_Hop + + ! Setup the interaction. + call Ham_V + + ! Setup the trival wave function, in case of a projector approach + if (Projector) Call Ham_Trial() + +#ifdef MPI + If (Irank_g == 0) then +#endif + File_info = "info" +#if defined(TEMPERING) + write(File_info,'(A,I0,A)') "Temp_",igroup,"/info" +#endif + + Open(newunit=unit_info, file=file_info, status="unknown", position="append") + Write(unit_info,*) '=====================================' + Write(unit_info,*) 'Model is : Hubbard_Plain_Vanilla' + Write(unit_info,*) 'Lattice is : ', Lattice_type + Write(unit_info,*) 'L1 : ', L1 + Write(unit_info,*) 'L2 : ', L2 + Write(unit_info,*) '# of orbitals : ', Ndim + Write(unit_info,*) 'Symm. decomp : ', Symm + if (Projector) then + Write(unit_info,*) 'Projective version' + Write(unit_info,*) 'Theta : ', Theta + Write(unit_info,*) 'Tau_max : ', beta + Write(unit_info,*) '# of particles: ', N_part + else + Write(unit_info,*) 'Finite temperture version' + Write(unit_info,*) 'Beta : ', Beta + endif + Write(unit_info,*) 'dtau,Ltrot_eff: ', dtau,Ltrot + Write(unit_info,*) 't : ', Ham_T +!!!!! Modifications for Exercise 2 + !Write(unit_info,*) 'Ham_U : ', Ham_U + Write(unit_info,*) 'Ham_Vint : ', Ham_Vint +!!!!! + Write(unit_info,*) 'Ham_chem : ', Ham_chem + If ( Ham_U >=0.d0 .and. Ham_chem == 0.d0 ) then + Write(unit_info,*) 'Assuming particle hole symmetry' + endif + If ( Ham_U < 0.d0 ) then + Write(unit_info,*) 'Assuming time reversal symmetry' + endif + if (Projector) then + Do nf = 1,N_FL + Write(unit_info,*) 'Degen of right trial wave function: ', WF_R(nf)%Degen + Write(unit_info,*) 'Degen of left trial wave function: ', WF_L(nf)%Degen + enddo + endif + Close(unit_info) +#ifdef MPI + Endif +#endif + + ! Particle-hole symmetry for repulsive U only if chemical potential vanishes + ! Time reversal symmetry for attractive U + If ( (Ham_U >= 0.d0 .and. Ham_chem == 0.d0) .or. Ham_U < 0.d0 ) then + allocate(Calc_Fl(N_FL)) + nf_calc=2 + nf_reconst=1 + Calc_Fl(nf_calc)=.True. + Calc_Fl(nf_reconst)=.False. + endif + + + End Subroutine Ham_Set + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Lattice +!-------------------------------------------------------------------- + Subroutine Ham_Latt + + + Implicit none + Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2) + + If (Lattice_Type /= "Square") then + Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif + + Latt_unit%Norb = 1 + Latt_unit%N_coord = 2 + allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2)) + Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0] + + a1_p(1) = 1.0 ; a1_p(2) = 0.d0 + a2_p(1) = 0.0 ; a2_p(2) = 1.d0 + L1_p = dble(L1)*a1_p + L2_p = dble(L2)*a2_p + Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt ) + + Ndim = Latt%N*Latt_unit%Norb + + end Subroutine Ham_Latt +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hopping +!-------------------------------------------------------------------- + Subroutine Ham_Hop + + Implicit none + + Integer :: nf , I, Ix, Iy + allocate(Op_T(1,N_FL)) + do nf = 1,N_FL + Call Op_make(Op_T(1,nf),Ndim) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + If ( L2 > 1 ) then + Iy = Latt%nnlist(I,0,1) + Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + endif + Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0)) + Op_T(1,nf)%P(i) = i + Enddo + Op_T(1,nf)%g = -Dtau + Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0)) + Call Op_set(Op_T(1,nf)) + enddo + + + end Subroutine Ham_Hop +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the trial wave function +!-------------------------------------------------------------------- + Subroutine Ham_Trial() + + Use Predefined_Trial + + Implicit none + + Integer :: nf, Ix, Iy, I, n + Real (Kind=Kind(0.d0)), allocatable :: H0(:,:), U0(:,:), E0(:) + Real (Kind=Kind(0.d0)) :: Pi = acos(-1.d0), Delta = 0.01d0 + + Allocate(WF_L(N_FL),WF_R(N_FL)) + do nf=1,N_FL + Call WF_alloc(WF_L(nf),Ndim,N_part) + Call WF_alloc(WF_R(nf),Ndim,N_part) + enddo + + + Allocate(H0(Ndim,Ndim), U0(Ndim, Ndim), E0(Ndim) ) + H0 = 0.d0; U0 = 0.d0; E0=0.d0 + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + H0(I, Ix) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + H0(Ix, I ) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + If (L2 > 1 ) Then + Iy = Latt%nnlist(I,0,1) + H0(I, Iy) = -Ham_T *(1.d0 - Delta) + H0(Iy, I ) = -Ham_T *(1.d0 - Delta) + Endif + Enddo + Call Diag(H0,U0,E0) +!!$ Do I = 1,Ndim +!!$ Write(6,*) I,E0(I) +!!$ Enddo + Do nf = 1,N_FL + do n=1,N_part + do I=1,Ndim + WF_L(nf)%P(I,n)=U0(I,n) + WF_R(nf)%P(I,n)=U0(I,n) + enddo + enddo + WF_L(nf)%Degen = E0(N_part+1) - E0(N_part) + WF_R(nf)%Degen = E0(N_part+1) - E0(N_part) + enddo + + Deallocate(H0, U0, E0 ) + + end Subroutine Ham_Trial + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the interaction +!-------------------------------------------------------------------- + Subroutine Ham_V + + Use Predefined_Int + Implicit none + + Integer :: nf, I + Real (Kind=Kind(0.d0)) :: X +!!!!! Modifications for Exercise 2 + Integer :: i2 +!!!!! + + + Allocate(Op_V(Ndim,N_FL)) + + do nf = 1,N_FL + do i = 1, Ndim +!!!!! Modifications for Exercise 2 + !Call Op_make(Op_V(i,nf), 1) + Call Op_make(Op_V(i,nf), 2) +!!!!! + enddo + enddo + + Do nf = 1,N_FL + X = 1.d0 + if (nf == 2) X = -1.d0 + Do i = 1,Ndim +!!!!! Modifications for Exercise 2 + !Op_V(i,nf)%P(1) = I + !Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0)) + !Op_V(i,nf)%g = X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0))) + !Op_V(i,nf)%alpha = cmplx(0.d0, 0.d0, kind(0.D0)) + !Op_V(i,nf)%type = 2 + i2 = Latt%nnlist(i,1,0) + Op_V(i,nf)%P(1) = i + Op_V(i,nf)%P(2) = i2 + Op_V(i,nf)%O(1,2) = cmplx(1.d0 ,0.d0, kind(0.d0)) + Op_V(i,nf)%O(2,1) = cmplx(1.d0 ,0.d0, kind(0.d0)) + Op_V(i,nf)%g = sqrt(cmplx(Dtau*Ham_Vint/2.d0, 0.d0, kind(0.d0))) + Op_V(i,nf)%alpha = cmplx(0d0 ,0.d0, kind(0.d0)) + Op_V(i,nf)%type = 2 +!!!!! + Call Op_set( Op_V(i,nf) ) + Enddo + Enddo + + + end Subroutine Ham_V + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Specifiy the equal time and time displaced observables +!> @details +!-------------------------------------------------------------------- + Subroutine Alloc_obs(Ltau) + + Implicit none + !> Ltau=1 if time displaced correlations are considered. + Integer, Intent(In) :: Ltau + Integer :: i, N, Nt + Character (len=64) :: Filename + Character (len=2) :: Channel + + + ! Scalar observables + Allocate ( Obs_scal(4) ) + Do I = 1,Size(Obs_scal,1) + select case (I) + case (1) + N = 1; Filename ="Kin" + case (2) + N = 1; Filename ="Pot" + case (3) + N = 1; Filename ="Part" + case (4) + N = 1; Filename ="Ener" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Call Obser_Vec_make(Obs_scal(I),N,Filename) + enddo + + ! Equal time correlators +!!!!! Modifications for Exercise 2 + !Allocate ( Obs_eq(5) ) + Allocate ( Obs_eq(3) ) +!!!!! + Do I = 1,Size(Obs_eq,1) + select case (I) + case (1) + Filename = "Green" + case (2) + Filename = "SpinZ" + case (3) +!!!!! Modifications for Exercise 2 + ! Filename ="SpinXY" + !case (4) + ! Filename ="SpinT" + !case (5) + Filename ="Den" +!!!!! + case default + Write(6,*) "Error in Alloc_obs" + end select + Nt = 1 + Channel = "--" + Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + + If (Ltau == 1) then + ! time-displaced correlators +!!!!! Modifications for Exercise 2 + !Allocate ( Obs_tau(5) ) + Allocate ( Obs_tau(3) ) +!!!!! + Do I = 1,Size(Obs_tau,1) + select case (I) + case (1) + Channel = 'P' ; Filename = "Green" + case (2) + Channel = 'PH'; Filename = "SpinZ" + case (3) +!!!!! Modifications for Exercise 2 + ! Channel = 'PH'; Filename ="SpinXY" + !case (4) + ! Channel = 'PH'; Filename ="SpinT" + !case (5) + Channel = 'PH'; Filename ="Den" +!!!!! + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Nt = Ltrot+1-2*Thtrot + If(Projector) Channel = 'T0' + Call Obser_Latt_make(Obs_tau(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + endif + + End Subroutine Alloc_obs + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes equal time observables +!> @details +!> @param [IN] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!> @param [IN] Ntau Integer +!> \verbatim +!> Time slice +!> \endverbatim +!------------------------------------------------------------------- + subroutine Obser(GR,Phase,Ntau, Mc_step_weight) + + Use Predefined_Obs + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GR(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), Intent(IN) :: PHASE + Integer, INTENT(IN) :: Ntau + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Local + Complex (Kind=Kind(0.d0)) :: GRC(Ndim,Ndim,N_FL), ZK + Complex (Kind=Kind(0.d0)) :: Zrho, Zkin, ZPot, Z, ZP,ZS, ZZ, ZXY, ZDen + Integer :: I,J, imj, nf, Ix, Iy + Real (Kind=Kind(0.d0)) :: X +!!!!! Modifications for Exercise 2 + Integer :: I1, J1, no_I, no_J +!!!!! + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + + ZS = ZS*Mc_step_weight + + + + Do nf = 1,N_FL + Do I = 1,Ndim + Do J = 1,Ndim + GRC(I, J, nf) = -GR(J, I, nf) + Enddo + GRC(I, I, nf) = 1.D0 + GRC(I, I, nf) + Enddo + Enddo + ! GRC(i,j,nf) = < c^{dagger}_{i,nf } c_{j,nf } > + + ! Compute scalar observables. + Do I = 1,Size(Obs_scal,1) + Obs_scal(I)%N = Obs_scal(I)%N + 1 + Obs_scal(I)%Ave_sign = Obs_scal(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + + Zkin = cmplx(0.d0, 0.d0, kind(0.D0)) + Zkin = Zkin* dble(N_SUN) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) +!!!!! Modifications for Exercise 2 + !Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) & + ! & + GRC(I,Ix,2) + GRC(Ix,I,2) + !!!Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) + Zkin = Zkin + sum(Op_T(1,1)%O(:, i)*Grc(:, i, 1)) +!!!!! + Enddo + If (L2 > 1) then + Do I = 1,Latt%N + Iy = Latt%nnlist(I,0,1) + Zkin = Zkin + GRC(I,Iy,2) + GRC(Iy,I,2) & + & + GRC(I,Iy,1) + GRC(Iy,I,1) + Enddo + Endif + Zkin = Zkin*cmplx(-Ham_T,0.d0,Kind(0.d0)) + Obs_scal(1)%Obs_vec(1) = Obs_scal(1)%Obs_vec(1) + Zkin *ZP* ZS + + + ZPot = cmplx(0.d0, 0.d0, kind(0.D0)) + Do I = 1,Ndim +!!!!! Modifications for Exercise 2 + !ZPot = ZPot + Grc(i,i,1) * Grc(i,i, 2) + i1 = Latt%nnlist(i,1,0) + ZPot = ZPot + Grc(i,i,1)*Grc(i1,i1, 1) + Grc(i,i1,1)*Gr(i,i1,1) + Enddo + !Zpot = Zpot*ham_U + Zpot = Zpot*Ham_Vint +!!!!! + Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + Zpot * ZP*ZS + + + Zrho = cmplx(0.d0,0.d0, kind(0.D0)) + Do I = 1,Ndim +!!!!! Modifications for Exercise 2 + !Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) + Zrho = Zrho + Grc(i,i,1) +!!!!! + enddo + Obs_scal(3)%Obs_vec(1) = Obs_scal(3)%Obs_vec(1) + Zrho * ZP*ZS + Obs_scal(4)%Obs_vec(1) = Obs_scal(4)%Obs_vec(1) + (Zkin + Zpot)*ZP*ZS + + Do I = 1,Size(Obs_eq,1) + Obs_eq(I)%N = Obs_eq(I)%N + 1 + Obs_eq(I)%Ave_sign = Obs_eq(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + +!!!!! Modifications for Exercise 2 + !Do I = 1,Latt%N + ! Do J = 1,Latt%N + ! imj = latt%imj(I,J) + ! ZXY = GRC(I,J,1) * GR(I,J,2) + GRC(I,J,2) * GR(I,J,1) + ! ZZ = GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + & + ! (GRC(I,I,2) - GRC(I,I,1))*(GRC(J,J,2) - GRC(J,J,1)) + + ! ZDen = (GRC(I,I,1) + GRC(I,I,2)) * (GRC(I,I,1) + GRC(I,I,2)) + & + ! & GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + ! Obs_eq(1)%Obs_Latt(imj,1,1,1) = Obs_eq(1)%Obs_Latt(imj,1,1,1) + (GRC(I,J,1) + GRC(I,J,2))*ZP*ZS + ! Obs_eq(2)%Obs_Latt(imj,1,1,1) = Obs_eq(2)%Obs_Latt(imj,1,1,1) + ZZ *ZP*ZS + ! Obs_eq(3)%Obs_Latt(imj,1,1,1) = Obs_eq(3)%Obs_Latt(imj,1,1,1) + ZXY *ZP*ZS + ! Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + ! Obs_eq(5)%Obs_Latt(imj,1,1,1) = Obs_eq(5)%Obs_Latt(imj,1,1,1) + ZDen * ZP * ZS + + ! enddo + ! Obs_eq(5)%Obs_Latt0(1) = Obs_eq(5)%Obs_Latt0(1) + (GRC(I,I,1) + GRC(I,I,2)) * ZP*ZS + !enddo + Z = cmplx(dble(N_SUN), 0.d0, kind(0.D0)) + Do I1 = 1,Ndim + I = I1 !List(I1,1) + no_I = 1 !List(I1,2) + Do J1 = 1,Ndim + J = J1 !List(J1,1) + no_J = 1 !List(J1,2) + imj = latt%imj(I,J) + Obs_eq(1)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(1)%Obs_Latt(imj,1,no_I,no_J) + & + & Z * GRC(I1,J1,1) * ZP*ZS ! Green + Obs_eq(2)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(2)%Obs_Latt(imj,1,no_I,no_J) + & + & Z * GRC(I1,J1,1) * GR(I1,J1,1) * ZP*ZS ! SpinZ + !Obs_eq(3)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(3)%Obs_Latt(imj,1,no_I,no_J) + & + ! & Z * GRC(I1,J1,1) * GR(I1,J1,1) * ZP*ZS ! SpinXY + Obs_eq(3)%Obs_Latt(imj,1,no_I,no_J) = Obs_eq(3)%Obs_Latt(imj,1,no_I,no_J) + & + & ( GRC(I1,I1,1) * GRC(J1,J1,1) * Z + & + !!!& ( GRC(I1,I1,1) * GRC(I1,I1,1) * Z + & + & GRC(I1,J1,1) * GR(I1,J1,1 ) ) * Z * ZP*ZS ! Den + enddo + Obs_eq(3)%Obs_Latt0(no_I) = Obs_eq(3)%Obs_Latt0(no_I) + Z * GRC(I1,I1,1) * ZP * ZS + enddo +!!!!! + + + + end Subroutine Obser +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes time displaced observables +!> @details +!> @param [IN] NT, Integer +!> \verbatim +!> Imaginary time +!> \endverbatim +!> @param [IN] GT0, GTT, G00, GTT, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> G00(I,J,nf) = +!> GTT(I,J,nf) = +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!------------------------------------------------------------------- + Subroutine ObserT(NT, GT0,G0T,G00,GTT, PHASE, Mc_step_weight ) + + Use Predefined_Obs + + Implicit none + + Integer , INTENT(IN) :: NT + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GT0(Ndim,Ndim,N_FL),G0T(Ndim,Ndim,N_FL),G00(Ndim,Ndim,N_FL),GTT(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), INTENT(IN) :: Phase + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Locals + Complex (Kind=Kind(0.d0)) :: Z, ZP, ZS, ZZ, ZXY, ZDEN + Real (Kind=Kind(0.d0)) :: X + Integer :: IMJ, I, J, I1, J1, no_I, no_J + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + ZS = ZS*Mc_step_weight + + If (NT == 0 ) then + Do I = 1,Size(Obs_tau,1) + Obs_tau(I)%N = Obs_tau(I)%N + 1 + Obs_tau(I)%Ave_sign = Obs_tau(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + Endif +!!!!! Modifications for Exercise 2 +! Do I = 1,Latt%N +! Do J = 1,Latt%N +! imj = latt%imj(I,J) +! +! ZZ = (GTT(I,I,1) - GTT(I,I,2) ) * ( G00(J,J,1) - G00(J,J,2) ) & +! & - G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) +! ZXY = - G0T(J,I,1) * GT0(I,J,2) - G0T(J,I,2) * GT0(I,J,1) +! +! +! ZDen = (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2) ) * & +! & (cmplx(2.d0,0.d0,kind(0.d0)) - G00(J,J,1) - G00(J,J,2) ) & +! & -G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) +! +! Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) + (GT0(I,J,1) + GT0(I,J,2))*ZP*ZS +! Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) + ZZ *ZP*ZS +! Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) + ZXY *ZP*ZS +! Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 +! Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) + ZDen * ZP * ZS +! +! enddo +! Obs_tau(5)%Obs_Latt0(1) = Obs_tau(5)%Obs_Latt0(1) + & +! & (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2)) * ZP*ZS +! enddo + Z = cmplx(dble(N_SUN),0.d0, kind(0.D0)) + Do I1 = 1,Ndim + I = I1 !List(I1,1) + no_I = 1 !List(I1,2) + Do J1 = 1,Ndim + J = J1 !List(J1,1) + no_J = 1 !List(J1,2) + imj = latt%imj(I,J) + Obs_tau(1)%Obs_Latt(imj,nt+1,no_I,no_J) = Obs_tau(1)%Obs_Latt(imj,nt+1,no_I,no_J) & + & + Z * GT0(I1,J1,1) * ZP*ZS ! Green + Obs_tau(2)%Obs_Latt(imj,nt+1,no_I,no_J) = Obs_tau(2)%Obs_Latt(imj,nt+1,no_I,no_J) & + & - Z * G0T(J1,I1,1) * GT0(I1,J1,1) *ZP*ZS ! SpinZ + !Obs_tau(3)%Obs_Latt(imj,nt+1,no_I,no_J) = Obs_tau(3)%Obs_Latt(imj,nt+1,no_I,no_J) & + ! & - Z * G0T(J1,I1,1) * GT0(I1,J1,1) *ZP*ZS ! SpinXY + Obs_tau(3)%Obs_Latt(imj,nt+1,no_I,no_J) = Obs_tau(3)%Obs_Latt(imj,nt+1,no_I,no_J) & + & + ( Z*Z*(cmplx(1.d0,0.d0,kind(0.d0)) - GTT(I1,I1,1))* & + & (cmplx(1.d0,0.d0,kind(0.d0)) - G00(J1,J1,1)) - & + & Z * GT0(I1,J1,1)*G0T(J1,I1,1) ) * ZP * ZS ! Den + enddo + Obs_tau(3)%Obs_Latt0(no_I) = Obs_tau(3)%Obs_Latt0(no_I) + & + & Z*(cmplx(1.d0,0.d0,kind(0.d0)) - GTT(I1,I1,1)) * ZP * ZS + enddo +!!!!! + + + + end Subroutine OBSERT + +!-------------------------------------------------------------------- +!> @brief +!> Reconstructs dependent flavors of the configuration's weight. +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!-------------------------------------------------------------------- + subroutine weight_reconstruction(weight) + implicit none + complex (Kind=Kind(0.d0)), Intent(inout) :: weight(:) + + weight(nf_reconst) = conjg(Weight(nf_calc)) + + end subroutine weight_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of equal time Greens function +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!------------------------------------------------------------------- + subroutine GR_reconstruction(GR) + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GR(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Ndim + Do I = 1,Ndim + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + ! write(*,*) Latt%list(I,:),Latt%list(J,:),mod(Latt%list(imj,1)+Latt%list(imj,2),2), X + ZZ=0.d0 + if (I==J) ZZ=1.d0 + GR(I,J,nf_reconst) = ZZ - X*GR(J,I,nf_calc) + Enddo + Enddo + else + Do J = 1,Ndim + Do I = 1,Ndim + GR(I,J,nf_reconst) = Conjg(GR(I,J,nf_calc)) + Enddo + Enddo + Endif + end Subroutine GR_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of time displaced Greens function G0T and GT0 +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] GT0, G0T, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> \endverbatim +!------------------------------------------------------------------- + Subroutine GRT_reconstruction(GT0, G0T) + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GT0(Ndim,Ndim,N_FL), G0T(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Latt%N + Do I = 1,Latt%N + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + G0T(I,J,nf_reconst) = -X*conjg(GT0(J,I,nf_calc)) + GT0(I,J,nf_reconst) = -X*conjg(G0T(J,I,nf_calc)) + enddo + enddo + else + Do J = 1,Latt%N + Do I = 1,Latt%N + G0T(I,J,nf_reconst) = conjg(G0T(I,J,nf_calc)) + GT0(I,J,nf_reconst) = conjg(GT0(I,J,nf_calc)) + enddo + enddo + endif + end Subroutine GRT_reconstruction + + end submodule ham_Hubbard_Plain_Vanilla_smod diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original new file mode 100644 index 0000000..a7c7563 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original @@ -0,0 +1,851 @@ +! Copyright (C) 2016 - 2020 The ALF project +! +! The ALF project is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! The ALF project is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with ALF. If not, see http://www.gnu.org/licenses/. +! +! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms: +! +! - It is our hope that this program makes a contribution to the scientific community. Being +! part of that community we feel that it is reasonable to require you to give an attribution +! back to the original authors if you have benefitted from this program. +! Guidelines for a proper citation can be found on the project's homepage +! http://alf.physik.uni-wuerzburg.de +! +! - We require the preservation of the above copyright notice and this license in all original files. +! +! - We prohibit the misrepresentation of the origin of the original source files. To obtain +! the original source files please visit the homepage http://alf.physik.uni-wuerzburg.de . +! +! - If you make substantial changes to the program we require you to either consider contributing +! to the ALF project or to mark your material in a reasonable way as different from the original version + + +!-------------------------------------------------------------------- +!> @author +!> ALF-project +!> +!> @brief +!> This module defines the Hamiltonian and observables. Here, we have included a +!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models +!> on honeycomb, pi-flux and square lattices. + +!> @details +!> The public variables of this module are the following +!> +!> +!> @param [public] OP_V +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice. +!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim +!> +!> @param [public] OP_T +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> Sequence of operators accounting for the hopping on a time slice. This can include various +!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to +!> the flavor index. \endverbatim +!> * The progagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is +!> first the hopping and then the potential energy. +!> +!>@param [public] WF_L +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Left trial wave function. \endverbatim +!> +!> @param [public] WF_R +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim +!> +!> @param [public] nsigma +!> \verbatim Type(Fields) +!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator +!> sequence. The second through the time slices. \endverbatim +! +!> @param [public] Ndim +!> \verbatim Integer +!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim +! +!> @param [public] N_FL +!> \verbatim Integer +!> # of flavors. Propagation is block diagonal in flavors. \endverbatim +! +!> @param [public] N_SUN +!> \verbatim Integer +!> # of colors. Propagation is color independent. \endverbatim +!> +!> @param [public] Ltrot +!> \verbatim Integer +!> Available measurment interval in units of Delta Tau. \endverbatim +!> +!> @param [public] Thtrot +!> \verbatim Integer +!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim +!> +!> @param [public] Projector +!> \verbatim Logical +!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim +!> +!> @param [public] Group_Comm +!> \verbatim Integer +!> Defines MPI communicator \endverbatim +! +!> @param [public] Symm +!> \verbatim Logical \endverbatim +!> If set to true then the green functions will be symmetrized +!> before being sent to the Obser, ObserT subroutines. +!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$ +!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that +!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed +!> symmetrically. If Symm is true, the propagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$ +!> +!> +!> You still have to add some docu for the other private variables in this module. +!> +!-------------------------------------------------------------------- + + + submodule (Hamiltonian_main) ham_Hubbard_Plain_Vanilla_smod + + Use Operator_mod + Use WaveFunction_mod + Use Lattices_v3 + Use MyMats + Use Random_Wrap + Use Files_mod + Use Matrix + Use Observables + Use Fields_mod + Use Predefined_Hoppings + Use LRC_Mod + use runtime_error_mod + + + Implicit none + + type, extends(ham_base) :: ham_Hubbard_Plain_Vanilla + contains + ! Set Hamiltonian-specific procedures + procedure, nopass :: Ham_Set + procedure, nopass :: Alloc_obs + procedure, nopass :: Obser + procedure, nopass :: ObserT + procedure, nopass :: weight_reconstruction + procedure, nopass :: GR_reconstruction + procedure, nopass :: GRT_reconstruction +#ifdef HDF5 + procedure, nopass :: write_parameters_hdf5 +#endif + end type ham_Hubbard_Plain_Vanilla + + !#PARAMETERS START# VAR_lattice + Character (len=64) :: Model = '' ! Value irrelevant + Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square' + Integer :: L1 = 6 ! Length in direction a_1 + Integer :: L2 = 6 ! Length in direction a_2 + !#PARAMETERS END# + + !#PARAMETERS START# VAR_Hubbard_Plain_Vanilla + real(Kind=Kind(0.d0)) :: ham_T = 1.d0 ! Hopping parameter + real(Kind=Kind(0.d0)) :: Ham_chem = 0.d0 ! Chemical potential + real(Kind=Kind(0.d0)) :: Ham_U = 4.d0 ! Hubbard interaction + real(Kind=Kind(0.d0)) :: Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau + real(Kind=Kind(0.d0)) :: Beta = 5.d0 ! Inverse temperature + !logical :: Projector= .false. ! Whether the projective algorithm is used + real(Kind=Kind(0.d0)) :: Theta = 10.d0 ! Projection parameter + !logical :: Symm = .true. ! Whether symmetrization takes place + Integer :: N_part = -1 ! Number of particles in trial wave function. If N_part < 0 -> N_part = L1*L2/2 + !#PARAMETERS END# + + Type (Lattice), target :: Latt + Type (Unit_cell), target :: Latt_unit + INTEGER :: nf_calc, nf_reconst + + contains + + module Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + allocate(ham_Hubbard_Plain_Vanilla::ham) + end Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + +! Dynamically generated on compile time from parameters list. +! Supplies the subroutines read_parameters and write_parameters_hdf5. +#include "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hamiltonian +!-------------------------------------------------------------------- + Subroutine Ham_Set + +#if defined (MPI) || defined(TEMPERING) + Use mpi +#endif + Implicit none + + integer :: ierr, nf, unit_info + Character (len=64) :: file_info + + + +#ifdef MPI + Integer :: Isize, Irank, irank_g, isize_g, igroup + Integer :: STATUS(MPI_STATUS_SIZE) + CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR) + CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR) + call MPI_Comm_rank(Group_Comm, irank_g, ierr) + call MPI_Comm_size(Group_Comm, isize_g, ierr) + igroup = irank/isize_g +#endif + + ! From dynamically generated file "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + call read_parameters() + + + If (L1 == 1) then + Write(6,*) 'For one-dimensional lattices set L2=1' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + endif + + if (N_part < 0) N_part = L1*L2/2 + Ltrot = nint(beta/dtau) + Thtrot = 0 + if (Projector) Thtrot = nint(theta/dtau) + Ltrot = Ltrot+2*Thtrot + N_SUN = 1 + N_FL = 2 + + ! Setup the Bravais lattice + Call Ham_Latt + + ! Setup the hopping / single-particle part + Call Ham_Hop + + ! Setup the interaction. + call Ham_V + + ! Setup the trival wave function, in case of a projector approach + if (Projector) Call Ham_Trial() + +#ifdef MPI + If (Irank_g == 0) then +#endif + File_info = "info" +#if defined(TEMPERING) + write(File_info,'(A,I0,A)') "Temp_",igroup,"/info" +#endif + + Open(newunit=unit_info, file=file_info, status="unknown", position="append") + Write(unit_info,*) '=====================================' + Write(unit_info,*) 'Model is : Hubbard_Plain_Vanilla' + Write(unit_info,*) 'Lattice is : ', Lattice_type + Write(unit_info,*) 'L1 : ', L1 + Write(unit_info,*) 'L2 : ', L2 + Write(unit_info,*) '# of orbitals : ', Ndim + Write(unit_info,*) 'Symm. decomp : ', Symm + if (Projector) then + Write(unit_info,*) 'Projective version' + Write(unit_info,*) 'Theta : ', Theta + Write(unit_info,*) 'Tau_max : ', beta + Write(unit_info,*) '# of particles: ', N_part + else + Write(unit_info,*) 'Finite temperture version' + Write(unit_info,*) 'Beta : ', Beta + endif + Write(unit_info,*) 'dtau,Ltrot_eff: ', dtau,Ltrot + Write(unit_info,*) 't : ', Ham_T + Write(unit_info,*) 'Ham_U : ', Ham_U + Write(unit_info,*) 'Ham_chem : ', Ham_chem + If ( Ham_U >=0.d0 .and. Ham_chem == 0.d0 ) then + Write(unit_info,*) 'Assuming particle hole symmetry' + endif + If ( Ham_U < 0.d0 ) then + Write(unit_info,*) 'Assuming time reversal symmetry' + endif + if (Projector) then + Do nf = 1,N_FL + Write(unit_info,*) 'Degen of right trial wave function: ', WF_R(nf)%Degen + Write(unit_info,*) 'Degen of left trial wave function: ', WF_L(nf)%Degen + enddo + endif + Close(unit_info) +#ifdef MPI + Endif +#endif + + ! Particle-hole symmetry for repulsive U only if chemical potential vanishes + ! Time reversal symmetry for attractive U + If ( (Ham_U >= 0.d0 .and. Ham_chem == 0.d0) .or. Ham_U < 0.d0 ) then + allocate(Calc_Fl(N_FL)) + nf_calc=2 + nf_reconst=1 + Calc_Fl(nf_calc)=.True. + Calc_Fl(nf_reconst)=.False. + endif + + + End Subroutine Ham_Set + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Lattice +!-------------------------------------------------------------------- + Subroutine Ham_Latt + + + Implicit none + Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2) + + If (Lattice_Type /= "Square") then + Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif + + Latt_unit%Norb = 1 + Latt_unit%N_coord = 2 + allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2)) + Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0] + + a1_p(1) = 1.0 ; a1_p(2) = 0.d0 + a2_p(1) = 0.0 ; a2_p(2) = 1.d0 + L1_p = dble(L1)*a1_p + L2_p = dble(L2)*a2_p + Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt ) + + Ndim = Latt%N*Latt_unit%Norb + + end Subroutine Ham_Latt +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hopping +!-------------------------------------------------------------------- + Subroutine Ham_Hop + + Implicit none + + Integer :: nf , I, Ix, Iy + allocate(Op_T(1,N_FL)) + do nf = 1,N_FL + Call Op_make(Op_T(1,nf),Ndim) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + If ( L2 > 1 ) then + Iy = Latt%nnlist(I,0,1) + Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + endif + Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0)) + Op_T(1,nf)%P(i) = i + Enddo + Op_T(1,nf)%g = -Dtau + Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0)) + Call Op_set(Op_T(1,nf)) + enddo + + + end Subroutine Ham_Hop +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the trial wave function +!-------------------------------------------------------------------- + Subroutine Ham_Trial() + + Use Predefined_Trial + + Implicit none + + Integer :: nf, Ix, Iy, I, n + Real (Kind=Kind(0.d0)), allocatable :: H0(:,:), U0(:,:), E0(:) + Real (Kind=Kind(0.d0)) :: Pi = acos(-1.d0), Delta = 0.01d0 + + Allocate(WF_L(N_FL),WF_R(N_FL)) + do nf=1,N_FL + Call WF_alloc(WF_L(nf),Ndim,N_part) + Call WF_alloc(WF_R(nf),Ndim,N_part) + enddo + + + Allocate(H0(Ndim,Ndim), U0(Ndim, Ndim), E0(Ndim) ) + H0 = 0.d0; U0 = 0.d0; E0=0.d0 + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + H0(I, Ix) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + H0(Ix, I ) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + If (L2 > 1 ) Then + Iy = Latt%nnlist(I,0,1) + H0(I, Iy) = -Ham_T *(1.d0 - Delta) + H0(Iy, I ) = -Ham_T *(1.d0 - Delta) + Endif + Enddo + Call Diag(H0,U0,E0) +!!$ Do I = 1,Ndim +!!$ Write(6,*) I,E0(I) +!!$ Enddo + Do nf = 1,N_FL + do n=1,N_part + do I=1,Ndim + WF_L(nf)%P(I,n)=U0(I,n) + WF_R(nf)%P(I,n)=U0(I,n) + enddo + enddo + WF_L(nf)%Degen = E0(N_part+1) - E0(N_part) + WF_R(nf)%Degen = E0(N_part+1) - E0(N_part) + enddo + + Deallocate(H0, U0, E0 ) + + end Subroutine Ham_Trial + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the interaction +!-------------------------------------------------------------------- + Subroutine Ham_V + + Use Predefined_Int + Implicit none + + Integer :: nf, I + Real (Kind=Kind(0.d0)) :: X + + + Allocate(Op_V(Ndim,N_FL)) + + do nf = 1,N_FL + do i = 1, Ndim + Call Op_make(Op_V(i,nf), 1) + enddo + enddo + + Do nf = 1,N_FL + X = 1.d0 + if (nf == 2) X = -1.d0 + Do i = 1,Ndim + Op_V(i,nf)%P(1) = I + Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%g = X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0))) + Op_V(i,nf)%alpha = cmplx(-0.5d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%type = 2 + Call Op_set( Op_V(i,nf) ) + Enddo + Enddo + + + end Subroutine Ham_V + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Specifiy the equal time and time displaced observables +!> @details +!-------------------------------------------------------------------- + Subroutine Alloc_obs(Ltau) + + Implicit none + !> Ltau=1 if time displaced correlations are considered. + Integer, Intent(In) :: Ltau + Integer :: i, N, Nt + Character (len=64) :: Filename + Character (len=2) :: Channel + + + ! Scalar observables + Allocate ( Obs_scal(4) ) + Do I = 1,Size(Obs_scal,1) + select case (I) + case (1) + N = 1; Filename ="Kin" + case (2) + N = 1; Filename ="Pot" + case (3) + N = 1; Filename ="Part" + case (4) + N = 1; Filename ="Ener" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Call Obser_Vec_make(Obs_scal(I),N,Filename) + enddo + + ! Equal time correlators + Allocate ( Obs_eq(5) ) + Do I = 1,Size(Obs_eq,1) + select case (I) + case (1) + Filename = "Green" + case (2) + Filename = "SpinZ" + case (3) + Filename = "SpinXY" + case (4) + Filename = "SpinT" + case (5) + Filename = "Den" + case default + Write(6,*) "Error in Alloc_obs" + end select + Nt = 1 + Channel = "--" + Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + + If (Ltau == 1) then + ! time-displaced correlators + Allocate ( Obs_tau(5) ) + Do I = 1,Size(Obs_tau,1) + select case (I) + case (1) + Channel = 'P' ; Filename = "Green" + case (2) + Channel = 'PH'; Filename = "SpinZ" + case (3) + Channel = 'PH'; Filename = "SpinXY" + case (4) + Channel = 'PH'; Filename = "SpinT" + case (5) + Channel = 'PH'; Filename = "Den" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Nt = Ltrot+1-2*Thtrot + If(Projector) Channel = 'T0' + Call Obser_Latt_make(Obs_tau(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + endif + + End Subroutine Alloc_obs + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes equal time observables +!> @details +!> @param [IN] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!> @param [IN] Ntau Integer +!> \verbatim +!> Time slice +!> \endverbatim +!------------------------------------------------------------------- + subroutine Obser(GR,Phase,Ntau, Mc_step_weight) + + Use Predefined_Obs + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GR(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), Intent(IN) :: PHASE + Integer, INTENT(IN) :: Ntau + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Local + Complex (Kind=Kind(0.d0)) :: GRC(Ndim,Ndim,N_FL), ZK + Complex (Kind=Kind(0.d0)) :: Zrho, Zkin, ZPot, Z, ZP,ZS, ZZ, ZXY, ZDen + Integer :: I,J, imj, nf, Ix, Iy + Real (Kind=Kind(0.d0)) :: X + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + + ZS = ZS*Mc_step_weight + + + + Do nf = 1,N_FL + Do I = 1,Ndim + Do J = 1,Ndim + GRC(I, J, nf) = -GR(J, I, nf) + Enddo + GRC(I, I, nf) = 1.D0 + GRC(I, I, nf) + Enddo + Enddo + ! GRC(i,j,nf) = < c^{dagger}_{i,nf } c_{j,nf } > + + ! Compute scalar observables. + Do I = 1,Size(Obs_scal,1) + Obs_scal(I)%N = Obs_scal(I)%N + 1 + Obs_scal(I)%Ave_sign = Obs_scal(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + + Zkin = cmplx(0.d0, 0.d0, kind(0.D0)) + Zkin = Zkin* dble(N_SUN) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) & + & + GRC(I,Ix,2) + GRC(Ix,I,2) + Enddo + If (L2 > 1) then + Do I = 1,Latt%N + Iy = Latt%nnlist(I,0,1) + Zkin = Zkin + GRC(I,Iy,2) + GRC(Iy,I,2) & + & + GRC(I,Iy,1) + GRC(Iy,I,1) + Enddo + Endif + Zkin = Zkin*cmplx(-Ham_T,0.d0,Kind(0.d0)) + Obs_scal(1)%Obs_vec(1) = Obs_scal(1)%Obs_vec(1) + Zkin *ZP* ZS + + + ZPot = cmplx(0.d0, 0.d0, kind(0.D0)) + Do I = 1,Ndim + ZPot = ZPot + Grc(i,i,1) * Grc(i,i, 2) + Enddo + Zpot = Zpot*ham_U + Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + Zpot * ZP*ZS + + + Zrho = cmplx(0.d0,0.d0, kind(0.D0)) + Do I = 1,Ndim + Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) + enddo + Obs_scal(3)%Obs_vec(1) = Obs_scal(3)%Obs_vec(1) + Zrho * ZP*ZS + Obs_scal(4)%Obs_vec(1) = Obs_scal(4)%Obs_vec(1) + (Zkin + Zpot)*ZP*ZS + + Do I = 1,Size(Obs_eq,1) + Obs_eq(I)%N = Obs_eq(I)%N + 1 + Obs_eq(I)%Ave_sign = Obs_eq(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + ZXY = GRC(I,J,1) * GR(I,J,2) + GRC(I,J,2) * GR(I,J,1) + ZZ = GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + & + (GRC(I,I,2) - GRC(I,I,1))*(GRC(J,J,2) - GRC(J,J,1)) + + ZDen = (GRC(I,I,1) + GRC(I,I,2)) * (GRC(J,J,1) + GRC(J,J,2)) + & + & GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + + Obs_eq(1)%Obs_Latt(imj,1,1,1) = Obs_eq(1)%Obs_Latt(imj,1,1,1) + (GRC(I,J,1) + GRC(I,J,2))*ZP*ZS + Obs_eq(2)%Obs_Latt(imj,1,1,1) = Obs_eq(2)%Obs_Latt(imj,1,1,1) + ZZ *ZP*ZS + Obs_eq(3)%Obs_Latt(imj,1,1,1) = Obs_eq(3)%Obs_Latt(imj,1,1,1) + ZXY *ZP*ZS + Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_eq(5)%Obs_Latt(imj,1,1,1) = Obs_eq(5)%Obs_Latt(imj,1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_eq(5)%Obs_Latt0(1) = Obs_eq(5)%Obs_Latt0(1) + (GRC(I,I,1) + GRC(I,I,2)) * ZP*ZS + enddo + + + + + end Subroutine Obser +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes time displaced observables +!> @details +!> @param [IN] NT, Integer +!> \verbatim +!> Imaginary time +!> \endverbatim +!> @param [IN] GT0, GTT, G00, GTT, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> G00(I,J,nf) = +!> GTT(I,J,nf) = +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!------------------------------------------------------------------- + Subroutine ObserT(NT, GT0,G0T,G00,GTT, PHASE, Mc_step_weight ) + + Use Predefined_Obs + + Implicit none + + Integer , INTENT(IN) :: NT + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GT0(Ndim,Ndim,N_FL),G0T(Ndim,Ndim,N_FL),G00(Ndim,Ndim,N_FL),GTT(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), INTENT(IN) :: Phase + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Locals + Complex (Kind=Kind(0.d0)) :: Z, ZP, ZS, ZZ, ZXY, ZDEN + Real (Kind=Kind(0.d0)) :: X + Integer :: IMJ, I, J, I1, J1, no_I, no_J + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + ZS = ZS*Mc_step_weight + + If (NT == 0 ) then + Do I = 1,Size(Obs_tau,1) + Obs_tau(I)%N = Obs_tau(I)%N + 1 + Obs_tau(I)%Ave_sign = Obs_tau(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + Endif + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + + ZZ = (GTT(I,I,1) - GTT(I,I,2) ) * ( G00(J,J,1) - G00(J,J,2) ) & + & - G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + ZXY = - G0T(J,I,1) * GT0(I,J,2) - G0T(J,I,2) * GT0(I,J,1) + + + ZDen = (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2) ) * & + & (cmplx(2.d0,0.d0,kind(0.d0)) - G00(J,J,1) - G00(J,J,2) ) & + & -G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + + Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) + (GT0(I,J,1) + GT0(I,J,2))*ZP*ZS + Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) + ZZ *ZP*ZS + Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) + ZXY *ZP*ZS + Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_tau(5)%Obs_Latt0(1) = Obs_tau(5)%Obs_Latt0(1) + & + & (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2)) * ZP*ZS + enddo + + + + end Subroutine OBSERT + +!-------------------------------------------------------------------- +!> @brief +!> Reconstructs dependent flavors of the configuration's weight. +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!-------------------------------------------------------------------- + subroutine weight_reconstruction(weight) + implicit none + complex (Kind=Kind(0.d0)), Intent(inout) :: weight(:) + + weight(nf_reconst) = conjg(Weight(nf_calc)) + + end subroutine weight_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of equal time Greens function +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!------------------------------------------------------------------- + subroutine GR_reconstruction(GR) + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GR(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Ndim + Do I = 1,Ndim + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + ! write(*,*) Latt%list(I,:),Latt%list(J,:),mod(Latt%list(imj,1)+Latt%list(imj,2),2), X + ZZ=0.d0 + if (I==J) ZZ=1.d0 + GR(I,J,nf_reconst) = ZZ - X*GR(J,I,nf_calc) + Enddo + Enddo + else + Do J = 1,Ndim + Do I = 1,Ndim + GR(I,J,nf_reconst) = Conjg(GR(I,J,nf_calc)) + Enddo + Enddo + Endif + end Subroutine GR_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of time displaced Greens function G0T and GT0 +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] GT0, G0T, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> \endverbatim +!------------------------------------------------------------------- + Subroutine GRT_reconstruction(GT0, G0T) + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GT0(Ndim,Ndim,N_FL), G0T(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Latt%N + Do I = 1,Latt%N + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + G0T(I,J,nf_reconst) = -X*conjg(GT0(J,I,nf_calc)) + GT0(I,J,nf_reconst) = -X*conjg(G0T(J,I,nf_calc)) + enddo + enddo + else + Do J = 1,Latt%N + Do I = 1,Latt%N + G0T(I,J,nf_reconst) = conjg(G0T(I,J,nf_calc)) + GT0(I,J,nf_reconst) = conjg(GT0(I,J,nf_calc)) + enddo + enddo + endif + end Subroutine GRT_reconstruction + + end submodule ham_Hubbard_Plain_Vanilla_smod diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/README.txt b/jupyterbook/source/08-fortran/Solutions/Exercise_2/README.txt new file mode 100644 index 0000000..403afb2 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/README.txt @@ -0,0 +1,4 @@ +This directory contains: + +- Reference solution files for Exercise 2, "Defining a new model" of Part II from the ALF Tutorial: modified (and original) Hamiltonian submodule, Start folder. +- Reference data and plot (tV.dat, tV.pdf, the latter generated by the gnuplot script tV.plt). diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/analysis.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/analysis.sh new file mode 100755 index 0000000..a22f06f --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/analysis.sh @@ -0,0 +1,62 @@ +export ANNAL=${ALF_DIR}"/Analysis/" + +for filename in *_scal; do + echo $filename + export filename1=$filename"J" +# if [ "$filename1" -ot "$filename" ]; then + cp $filename Var_scal + $ANNAL/cov_scal.out + mv "Var_scalJ" $filename"J" + for filename2 in Var_scal_Auto_*; do + if [ -e "${filename2}" ]; then + NewName=`echo ${filename2} | sed s/Var_scal/${filename}/` + mv $filename2 $NewName + fi + done + rm Var_scal +# fi +done + +for filename in *_eq; do + echo $filename + export filename1=$filename"J" +# if [ "$filename1" -ot "$filename" ]; then + ln $filename ineq + $ANNAL/cov_eq.out + mv "equalJ" $filename"JK" + mv "equalJR" $filename"JR" + for filename2 in Var_eq_Auto_Tr*; do + if [ -e "${filename2}" ]; then + NewName=`echo ${filename2} | sed s/Var_eq/${filename}/` + mv $filename2 $NewName + fi + done + rm ineq +# fi +done + + +for filename in *_tau; do + echo $filename + ln $filename intau + if [ "$filename" = "Green_tau" ]; then + $ANNAL/cov_tau.out + else + $ANNAL/cov_tau_ph.out + fi + rm intau + mv SuscepJ $filename"JK" + for filename1 in g_*; do + echo $filename1 + export Name=`echo ${filename} | sed s/_tau//` + export Dir=`echo ${filename1} | sed s/g_/${Name}_/` + echo $Dir + if [ ! -e $Dir ]; then + mkdir $Dir + fi + cd $Dir + mv ../$filename1 . + cd .. + done +done + diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/job.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/job.sh new file mode 100644 index 0000000..1c771d1 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/job.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# The following jobscript contains a few 'variables' marked by the ##...## pattern. +# The user has to provide the appropriate values, e.g. replace ##Nnodes## by 1 if the job is supposed to run on a single node. +# Most variables are selfexplaning, one exceptions might be Nthreads, which is refering to the number of OpenMP threads per MPI task. +# Useful configurations on SuperMUC-NG (48 cores) for Nthreads are 1,2,4,6,12,24 and NtaskPnode = 48/Nthreads +# In general we found that ALF does not profit from hyperthreading such that we suggest to only use physical cores. +# +#SBATCH --job-name DIR_R +#SBATCH --output=out.%j.log +#SBATCH --error=err.%j.log +#Notification and type +#SBATCH --mail-type=ALL +#SBATCH --mail-user=assaad@physik.uni-wuerzburg.de +# Wall clock limit (HH:MM:SS): +#SBATCH --time=48:00:00 +#SBATCH --no-requeue +#Setup of execution environment +#SBATCH --export=NONE +#SBATCH --get-user-env +#SBATCH --account=pr53ju + + +#available partitions: test, micro, general, large, fat +#SBATCH --partition=micro +#SBATCH --nodes=16 +#SBATCH --ntasks-per-node=24 +#SBATCH --cpus-per-task=2 + +#Switch off Energy Aware Runtime for profiling or benchmarking +# #SBATCH --ear=off + +#Important +module load slurm_setup + +module load mpi.intel +module load intel +module load mkl + +cd /hppfs/work/pr53ju/lu57gek5/AF_F_Run/DIR_R +touch RUNNING + +# the follwing eviroment variables generate an optimal pinning (to the best of our knowledge) +# This DOES NOT have to be addepted to the choice of Ntasks +# FIRST EXCEPTION: If you chose to use hyperthreading (not recommended) you should set I_MPI_PIN_CELL=cpu +# SECOND EXCEPTION: The following enviroment variables are Intel specific. +#export KMP_AFFINITY=verbose,granularity=fine,compact +export KMP_AFFINITY=granularity=fine,compact +export I_MPI_PIN_CELL=core +export I_MPI_PIN_DOMAIN=auto:cache +export I_MPI_PIN_ORDER=scatter + +export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK +echo $SLURM_NTASKS $SLURM_CPUS_PER_TASK + +bash ./out_to_in.sh +mpiexec -n $SLURM_NTASKS /dss/dsshome1/05/lu57gek5/AF_F_Code/Prog/AF_F.out + +rm RUNNING diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/parameters b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/parameters new file mode 100644 index 0000000..014e27a --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/parameters @@ -0,0 +1,161 @@ +!======================================================================================= +! Input variables for a general ALF run +!--------------------------------------------------------------------------------------- +&VAR_ham_name +ham_name = "Hubbard_Plain_Vanilla" +/ + +&VAR_lattice !! Parameters defining the specific lattice and base model +!!!!!! Modifications for Exercise 2 +L1 = 28 ! Length in direction a_1 +L2 = 1 ! Length in direction a_2 +Lattice_type = "Square" ! Sets a_1 = (1,0), a_2=(0,1), Norb=1, N_coord=2 +Model = "Hubbard_Plain_Vanilla" ! Sets (after modified) the t-V model +!!!!!! +/ + +&VAR_Model_Generic !! Common model parameters +Checkerboard = .T. ! Whether checkerboard decomposition is used +Symm = .T. ! Whether symmetrization takes place +N_SUN = 2 ! Number of colors +N_FL = 1 ! Number of flavors +Phi_X = 0.d0 ! Twist along the L_1 direction, in units of the flux quanta +Phi_Y = 0.d0 ! Twist along the L_2 direction, in units of the flux quanta +Bulk = .T. ! Twist as a vector potential (.T.), or at the boundary (.F.) +N_Phi = 0 ! Total number of flux quanta traversing the lattice +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 5.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +/ + +&VAR_QMC !! Variables for the QMC run +Nwrap = 10 ! Stabilization. Green functions will be computed from + ! scratch after each time interval Nwrap*Dtau +NSweep = 100 ! Number of sweeps +NBin = 10 ! Number of bins +Ltau = 1 ! 1 to calculate time-displaced Green functions; 0 otherwise +LOBS_ST = 0 ! Start measurements at time slice LOBS_ST +LOBS_EN = 0 ! End measurements at time slice LOBS_EN +CPU_MAX = 0.03 ! Code stops after CPU_MAX hours, if 0 or not + ! specified, the code stops after Nbin bins +Propose_S0 = .F. ! Proposes single spin flip moves with probability exp(-S0) +Global_moves = .F. ! Allows for global moves in space and time +N_Global = 1 ! Number of global moves per sweep +Global_tau_moves = .F. ! Allows for global moves on a single time slice. +N_Global_tau = 1 ! Number of global moves that will be carried out on a + ! single time slice +Nt_sequential_start = 0 ! One can combine sequential and global moves on a time slice +Nt_sequential_end = -1 ! The program then carries out sequential local moves in the + ! range [Nt_sequential_start, Nt_sequential_end] followed by + ! N_Global_tau global moves +Langevin = .F. ! Langevin update +Delta_t_Langevin_HMC=0.1 ! Default time step for Langevin and HMC updates +Max_Force = 5.0 ! Max Force for Langevin +HMC = .F. ! HMC update +Leapfrog_steps = 0 ! Number of leapfrog interations +/ + +&VAR_errors !! Variables for analysis programs +n_skip = 1 ! Number of bins that to be skipped. +N_rebin = 1 ! Rebinning +N_Cov = 0 ! If set to 1 covariance computed for non-equal-time + ! correlation functions +/ + +&VAR_TEMP !! Variables for parallel tempering +N_exchange_steps = 6 ! Number of exchange moves #[see Eq.~\eqref{eq:exchangestep}]# +N_Tempering_frequency = 10 ! The frequency in units of sweeps at which the + ! exchange moves are carried out +mpi_per_parameter_set = 2 ! Number of mpi-processes per parameter set +Tempering_calc_det = .T. ! Specifies whether the fermion weight has to be taken + ! into account while tempering. The default is .true., + ! and it can be set to .F. if the parameters that + ! get varied only enter the Ising action S_0 +/ + +&VAR_Max_Stoch !! Variables for Stochastic Maximum entropy +Ngamma = 400 ! Number of Dirac delta-functions for parametrization +Om_st = -10.d0 ! Frequency range lower bound +Om_en = 10.d0 ! Frequency range upper bound +NDis = 2000 ! Number of boxes for histogram +Nbins = 250 ! Number of bins for Monte Carlo +Nsweeps = 70 ! Number of sweeps per bin +NWarm = 20 ! The Nwarm first bins will be ommitted +N_alpha = 14 ! Number of temperatures +alpha_st = 1.d0 ! Smallest inverse temperature increment for inverse +R = 1.2d0 ! temperature (see above) +Checkpoint = .F. ! Whether to produce dump files, allowing the simulation + ! to be resumed later on +Tolerance = 0.1d0 ! Data points for which the relative error exceeds the + ! tolerance threshold will be omitted. +/ + +&VAR_Hubbard !! Variables for the specific model +Mz = .T. ! When true, sets the M_z-Hubbard model: Nf=2, demands that + ! N_sun is even, HS field couples to the z-component of + ! magnetization; otherwise, HS field couples to the density +Continuous = .F. ! Uses (T: continuous; F: discrete) HS transformation +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_U2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +/ + +&VAR_Hubbard_Plain_Vanilla !! Variables for the specific model +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +!!!!!! Modifications for Exercise 2 +!ham_U = 4.d0 ! Hubbard interaction +Ham_Vint = 2.d0 ! Hubbard interaction +!!!!!! +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 20.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +Symm = .T. ! Whether symmetrization takes place +/ + +&VAR_tV !! Variables for the t-V class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_V = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_V2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +ham_Vperp = 1.d0 ! For bilayer systems +/ + +&VAR_Kondo !! Variables for the Kondo class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_Uc = 0.d0 ! Hubbard interaction on c-orbitals Uc +ham_Uf = 2.d0 ! Hubbard interaction on f-orbials Uf +ham_JK = 2.d0 ! Kondo Coupling J +/ + +&VAR_LRC !! Variables for the Long Range Coulomb class +ham_T = 1.0 ! Specifies the hopping and chemical potential +ham_T2 = 1.0 ! For bilayer systems +ham_Tperp = 1.0 ! For bilayer systems +ham_chem = 1.0 ! Chemical potential +ham_U = 4.0 ! On-site interaction +ham_alpha = 0.1 ! Coulomb tail magnitude +Percent_change = 0.1 ! Parameter P +/ + +&VAR_Z2_Matter !! Variables for the Z_2 class +ham_T = 1.0 ! Hopping for fermions +ham_TZ2 = 1.0 ! Hopping for orthogonal fermions +ham_chem = 0.0 ! Chemical potential for fermions +ham_U = 0.0 ! Hubbard for fermions +Ham_J = 1.0 ! Hopping Z2 matter fields +Ham_K = 1.0 ! Plaquette term for gauge fields +Ham_h = 1.0 ! sigma^x-term for matter +Ham_g = 1.0 ! tau^x-term for gauge +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +/ +! slash terminates namelist statement - DO NOT REMOVE diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/parameters-original b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/parameters-original new file mode 100644 index 0000000..64337dd --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/parameters-original @@ -0,0 +1,156 @@ +!======================================================================================= +! Input variables for a general ALF run +!--------------------------------------------------------------------------------------- +&VAR_ham_name +ham_name = "Hubbard" +/ + +&VAR_lattice !! Parameters defining the specific lattice and base model +L1 = 6 ! Length in direction a_1 +L2 = 6 ! Length in direction a_2 +Lattice_type = "Square" ! Sets a_1 = (1,0), a_2=(0,1), Norb=1, N_coord=2 +Model = "Hubbard" ! Sets the Hubbard model, to be specified in &VAR_Hubbard +/ + +&VAR_Model_Generic !! Common model parameters +Checkerboard = .T. ! Whether checkerboard decomposition is used +Symm = .T. ! Whether symmetrization takes place +N_SUN = 2 ! Number of colors +N_FL = 1 ! Number of flavors +Phi_X = 0.d0 ! Twist along the L_1 direction, in units of the flux quanta +Phi_Y = 0.d0 ! Twist along the L_2 direction, in units of the flux quanta +Bulk = .T. ! Twist as a vector potential (.T.), or at the boundary (.F.) +N_Phi = 0 ! Total number of flux quanta traversing the lattice +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 5.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +/ + +&VAR_QMC !! Variables for the QMC run +Nwrap = 10 ! Stabilization. Green functions will be computed from + ! scratch after each time interval Nwrap*Dtau +NSweep = 20 ! Number of sweeps +NBin = 5 ! Number of bins +Ltau = 1 ! 1 to calculate time-displaced Green functions; 0 otherwise +LOBS_ST = 0 ! Start measurements at time slice LOBS_ST +LOBS_EN = 0 ! End measurements at time slice LOBS_EN +CPU_MAX = 0.0 ! Code stops after CPU_MAX hours, if 0 or not + ! specified, the code stops after Nbin bins +Propose_S0 = .F. ! Proposes single spin flip moves with probability exp(-S0) +Global_moves = .F. ! Allows for global moves in space and time +N_Global = 1 ! Number of global moves per sweep +Global_tau_moves = .F. ! Allows for global moves on a single time slice. +N_Global_tau = 1 ! Number of global moves that will be carried out on a + ! single time slice +Nt_sequential_start = 0 ! One can combine sequential and global moves on a time slice +Nt_sequential_end = -1 ! The program then carries out sequential local moves in the + ! range [Nt_sequential_start, Nt_sequential_end] followed by + ! N_Global_tau global moves +Langevin = .F. ! Langevin update +Delta_t_Langevin_HMC=0.1 ! Default time step for Langevin and HMC updates +Max_Force = 5.0 ! Max Force for Langevin +HMC = .F. ! HMC update +Leapfrog_steps = 0 ! Number of leapfrog interations +/ + +&VAR_errors !! Variables for analysis programs +n_skip = 1 ! Number of bins that to be skipped. +N_rebin = 1 ! Rebinning +N_Cov = 0 ! If set to 1 covariance computed for non-equal-time + ! correlation functions +/ + +&VAR_TEMP !! Variables for parallel tempering +N_exchange_steps = 6 ! Number of exchange moves #[see Eq.~\eqref{eq:exchangestep}]# +N_Tempering_frequency = 10 ! The frequency in units of sweeps at which the + ! exchange moves are carried out +mpi_per_parameter_set = 2 ! Number of mpi-processes per parameter set +Tempering_calc_det = .T. ! Specifies whether the fermion weight has to be taken + ! into account while tempering. The default is .true., + ! and it can be set to .F. if the parameters that + ! get varied only enter the Ising action S_0 +/ + +&VAR_Max_Stoch !! Variables for Stochastic Maximum entropy +Ngamma = 400 ! Number of Dirac delta-functions for parametrization +Om_st = -10.d0 ! Frequency range lower bound +Om_en = 10.d0 ! Frequency range upper bound +NDis = 2000 ! Number of boxes for histogram +Nbins = 250 ! Number of bins for Monte Carlo +Nsweeps = 70 ! Number of sweeps per bin +NWarm = 20 ! The Nwarm first bins will be ommitted +N_alpha = 14 ! Number of temperatures +alpha_st = 1.d0 ! Smallest inverse temperature increment for inverse +R = 1.2d0 ! temperature (see above) +Checkpoint = .F. ! Whether to produce dump files, allowing the simulation + ! to be resumed later on +Tolerance = 0.1d0 ! Data points for which the relative error exceeds the + ! tolerance threshold will be omitted. +/ + +&VAR_Hubbard !! Variables for the specific model +Mz = .T. ! When true, sets the M_z-Hubbard model: Nf=2, demands that + ! N_sun is even, HS field couples to the z-component of + ! magnetization; otherwise, HS field couples to the density +Continuous = .F. ! Uses (T: continuous; F: discrete) HS transformation +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_U2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +/ + +&VAR_Hubbard_Plain_Vanilla !! Variables for the specific model +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 5.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +Symm = .T. ! Whether symmetrization takes place +/ + +&VAR_tV !! Variables for the t-V class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_V = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_V2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +ham_Vperp = 1.d0 ! For bilayer systems +/ + +&VAR_Kondo !! Variables for the Kondo class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_Uc = 0.d0 ! Hubbard interaction on c-orbitals Uc +ham_Uf = 2.d0 ! Hubbard interaction on f-orbials Uf +ham_JK = 2.d0 ! Kondo Coupling J +/ + +&VAR_LRC !! Variables for the Long Range Coulomb class +ham_T = 1.0 ! Specifies the hopping and chemical potential +ham_T2 = 1.0 ! For bilayer systems +ham_Tperp = 1.0 ! For bilayer systems +ham_chem = 1.0 ! Chemical potential +ham_U = 4.0 ! On-site interaction +ham_alpha = 0.1 ! Coulomb tail magnitude +Percent_change = 0.1 ! Parameter P +/ + +&VAR_Z2_Matter !! Variables for the Z_2 class +ham_T = 1.0 ! Hopping for fermions +ham_TZ2 = 1.0 ! Hopping for orthogonal fermions +ham_chem = 0.0 ! Chemical potential for fermions +ham_U = 0.0 ! Hubbard for fermions +Ham_J = 1.0 ! Hopping Z2 matter fields +Ham_K = 1.0 ! Plaquette term for gauge fields +Ham_h = 1.0 ! sigma^x-term for matter +Ham_g = 1.0 ! tau^x-term for gauge +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +/ +! slash terminates namelist statement - DO NOT REMOVE diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/seeds b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/seeds new file mode 100644 index 0000000..8139943 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/Start/seeds @@ -0,0 +1,2297 @@ + 790789 + 452938 + 1048 + 814342 + 227372 + 538812 + 718356 + 402600 + 483443 + 212397 + 361162 + 448281 + 422328 + 433028 + 200386 + 801224 + 678595 + 729131 + 901235 + 573718 + 513521 + 256820 + 472421 + 917847 + 608058 + 45986 + 652882 + 490334 + 793308 + 433895 + 735999 + 604885 + 718486 + 686278 + 831314 + 72032 + 456393 + 805928 + 563751 + 726475 + 46379 + 528791 + 210334 + 641930 + 974820 + 507563 + 274404 + 33470 + 593079 + 682778 + 497340 + 847369 + 472980 + 841410 + 307776 + 38444 + 699773 + 362961 + 708323 + 534905 + 102605 + 153053 + 599781 + 890690 + 422490 + 764529 + 542867 + 625315 + 417774 + 706040 + 957426 + 251217 + 907106 + 938142 + 759152 + 988594 + 749907 + 556890 + 433810 + 167755 + 764337 + 664929 + 548951 + 318956 + 582768 + 430090 + 703129 + 949752 + 444746 + 331485 + 912628 + 9834 + 927466 + 593097 + 435671 + 43376 + 613738 + 804876 + 34144 + 28879 + 697454 + 731335 + 672817 + 906512 + 526561 + 307637 + 656054 + 792961 + 83526 + 823197 + 202042 + 883765 + 403308 + 292770 + 454504 + 43169 + 928824 + 15047 + 931917 + 81458 + 803917 + 318747 + 414235 + 719810 + 103829 + 496215 + 267105 + 242633 + 3166 + 924509 + 203583 + 837411 + 881369 + 374000 + 483361 + 622050 + 365681 + 504464 + 549477 + 359717 + 311616 + 548672 + 102537 + 861189 + 720929 + 183490 + 612438 + 74693 + 597084 + 588468 + 267578 + 863249 + 738221 + 691935 + 361582 + 469519 + 467630 + 604593 + 117520 + 668146 + 301714 + 240613 + 949621 + 605599 + 555458 + 126224 + 162497 + 327517 + 885405 + 395809 + 87858 + 993552 + 770114 + 975502 + 658733 + 779715 + 928137 + 954276 + 421189 + 468216 + 673486 + 142541 + 983548 + 724813 + 208598 + 818235 + 903107 + 63650 + 854808 + 660421 + 10355 + 499605 + 220317 + 870377 + 170696 + 888130 + 305658 + 480193 + 483661 + 952600 + 546669 + 848861 + 919635 + 999151 + 794956 + 345874 + 394067 + 319028 + 235870 + 222315 + 279196 + 278427 + 243968 + 669453 + 353266 + 95838 + 175984 + 64836 + 187246 + 306890 + 101300 + 405885 + 969047 + 916696 + 469914 + 930988 + 765245 + 239692 + 717906 + 928095 + 220292 + 426988 + 810411 + 730807 + 693245 + 681203 + 722082 + 901977 + 831977 + 158818 + 855066 + 604795 + 584896 + 560012 + 394466 + 161392 + 650169 + 406011 + 601316 + 798924 + 362437 + 3927 + 43044 + 583173 + 17034 + 99107 + 761442 + 539634 + 631705 + 214973 + 378140 + 962118 + 145827 + 680367 + 137568 + 908835 + 57127 + 344396 + 887428 + 885996 + 495899 + 978772 + 996661 + 718904 + 736726 + 367660 + 210920 + 610545 + 147695 + 85019 + 445533 + 387688 + 577119 + 959447 + 515976 + 934471 + 177752 + 226525 + 805839 + 813502 + 668514 + 368659 + 872298 + 74449 + 33703 + 642426 + 989079 + 250132 + 659717 + 293416 + 626931 + 540121 + 909273 + 458576 + 871594 + 181828 + 133124 + 756056 + 779265 + 9101 + 119281 + 562550 + 669572 + 198314 + 979727 + 978138 + 356035 + 201969 + 474640 + 478638 + 314042 + 869780 + 774110 + 255438 + 786316 + 757275 + 657358 + 242851 + 825880 + 621885 + 149453 + 832951 + 276529 + 106538 + 595534 + 277919 + 690802 + 610756 + 172528 + 779890 + 185441 + 349245 + 838364 + 268291 + 234370 + 597991 + 718700 + 864689 + 399157 + 127853 + 931135 + 35133 + 996989 + 825655 + 846931 + 429998 + 706132 + 502785 + 790229 + 411330 + 108909 + 891282 + 174773 + 267688 + 172161 + 827435 + 78122 + 116489 + 665222 + 622875 + 253374 + 493848 + 515383 + 623167 + 578383 + 631930 + 100864 + 953906 + 942476 + 423786 + 481282 + 454310 + 570674 + 75698 + 565617 + 798315 + 785412 + 447026 + 217685 + 803165 + 205754 + 77552 + 299103 + 925511 + 384113 + 902316 + 649762 + 945000 + 880472 + 653971 + 5792 + 835372 + 774101 + 952619 + 855030 + 823053 + 612773 + 83155 + 229993 + 633246 + 799491 + 460116 + 438345 + 923529 + 416696 + 780020 + 730863 + 904946 + 487993 + 861211 + 906910 + 150603 + 677370 + 171202 + 857401 + 591759 + 425912 + 41522 + 45272 + 701420 + 526024 + 570055 + 923449 + 865435 + 133145 + 210888 + 290319 + 941090 + 214974 + 51653 + 582694 + 3198 + 438183 + 778368 + 106285 + 277696 + 492636 + 327787 + 203666 + 262738 + 853111 + 227238 + 359747 + 37287 + 978515 + 621969 + 244739 + 757213 + 948607 + 989992 + 694626 + 338882 + 538213 + 544427 + 629131 + 330252 + 728945 + 323345 + 907187 + 969467 + 658423 + 967111 + 119904 + 430951 + 6990 + 183229 + 321038 + 259000 + 821934 + 898687 + 694962 + 988876 + 779203 + 99796 + 162132 + 955404 + 882627 + 359540 + 922055 + 289062 + 600636 + 52415 + 933763 + 99574 + 440478 + 256776 + 333776 + 847010 + 959938 + 344676 + 791573 + 900371 + 216557 + 259217 + 802561 + 283692 + 654350 + 479387 + 918543 + 609627 + 428026 + 672406 + 915690 + 200550 + 164706 + 33572 + 900002 + 397142 + 163142 + 313603 + 350287 + 54492 + 30436 + 533479 + 98621 + 225684 + 756256 + 386788 + 248320 + 32895 + 224561 + 329570 + 29413 + 725990 + 162813 + 357659 + 591602 + 928608 + 528699 + 471528 + 734737 + 71766 + 334350 + 828633 + 576786 + 14945 + 908058 + 583255 + 159296 + 854688 + 593499 + 413845 + 990372 + 920691 + 886444 + 737870 + 525136 + 959398 + 8985 + 614151 + 583702 + 505097 + 921252 + 332713 + 706645 + 438510 + 770629 + 692123 + 447964 + 732887 + 778475 + 964341 + 605558 + 387603 + 564343 + 547054 + 389188 + 549250 + 907697 + 303530 + 525951 + 820229 + 947134 + 589954 + 303247 + 754846 + 817098 + 970276 + 549246 + 542905 + 722102 + 618553 + 550859 + 880803 + 448449 + 408792 + 909207 + 30119 + 313443 + 692298 + 332587 + 63716 + 552116 + 762512 + 366942 + 299327 + 141443 + 7358 + 63834 + 920653 + 62060 + 749086 + 585904 + 785954 + 997485 + 771617 + 749850 + 424146 + 470835 + 535385 + 506889 + 218392 + 419045 + 79680 + 360729 + 777199 + 204588 + 612497 + 723036 + 493006 + 64692 + 787871 + 206405 + 288283 + 998059 + 670730 + 854828 + 549124 + 89088 + 389231 + 311661 + 246339 + 269585 + 474611 + 925093 + 244049 + 517991 + 888522 + 791119 + 795777 + 496094 + 737884 + 734002 + 228047 + 623251 + 677222 + 224248 + 811473 + 588107 + 998513 + 234069 + 819356 + 297813 + 408530 + 30359 + 773775 + 264743 + 493682 + 905153 + 879183 + 430715 + 872362 + 843607 + 643499 + 428709 + 34791 + 129456 + 686702 + 282088 + 870356 + 887991 + 736927 + 541311 + 882460 + 566523 + 814056 + 858158 + 90864 + 352354 + 600814 + 997445 + 621529 + 528245 + 1359 + 286244 + 983961 + 765383 + 887380 + 500603 + 36055 + 353855 + 31690 + 189761 + 636438 + 370608 + 229317 + 437870 + 984314 + 784929 + 606101 + 63213 + 646806 + 501403 + 114784 + 254924 + 273802 + 340389 + 218608 + 647203 + 295 + 955986 + 762408 + 831038 + 536232 + 691500 + 31201 + 303423 + 943853 + 372418 + 996286 + 854078 + 36870 + 748834 + 389664 + 861146 + 603604 + 120983 + 195504 + 877868 + 477451 + 494433 + 634805 + 147561 + 92294 + 796535 + 285370 + 216596 + 391538 + 683890 + 513823 + 85202 + 246080 + 913443 + 487324 + 797309 + 809773 + 901069 + 622788 + 717893 + 812399 + 467679 + 473605 + 497815 + 790137 + 772801 + 53861 + 726174 + 253531 + 435684 + 600051 + 270141 + 792958 + 843885 + 770301 + 302308 + 121600 + 649367 + 281088 + 15531 + 55907 + 452090 + 981457 + 25273 + 433574 + 671106 + 364740 + 459449 + 968999 + 603153 + 517774 + 735768 + 46264 + 668747 + 507622 + 26578 + 449593 + 845780 + 205790 + 411209 + 31326 + 290607 + 549946 + 715819 + 317389 + 146646 + 243138 + 40734 + 50259 + 540468 + 890514 + 975293 + 669434 + 765394 + 573541 + 500195 + 729405 + 652585 + 861724 + 577338 + 255118 + 129638 + 261821 + 427166 + 34951 + 966678 + 104567 + 493512 + 851175 + 709957 + 868889 + 95939 + 647927 + 802939 + 943628 + 769591 + 636680 + 894902 + 826753 + 292526 + 339208 + 337026 + 762086 + 400570 + 568056 + 865991 + 813514 + 189655 + 344511 + 475068 + 376713 + 205664 + 754067 + 472712 + 128365 + 221775 + 739397 + 728660 + 412876 + 703304 + 830821 + 107520 + 66595 + 960052 + 814273 + 89869 + 679534 + 986143 + 336770 + 580841 + 294585 + 987373 + 449386 + 906228 + 544241 + 596050 + 87711 + 996068 + 224812 + 773341 + 489829 + 755741 + 308145 + 399114 + 551783 + 624563 + 390844 + 549281 + 120540 + 321879 + 580987 + 460643 + 224469 + 780657 + 822345 + 183234 + 241299 + 268583 + 656102 + 920163 + 3596 + 696651 + 420071 + 54961 + 841729 + 115262 + 885418 + 866420 + 564336 + 397812 + 330874 + 930941 + 376298 + 111793 + 54458 + 212377 + 734203 + 577379 + 322696 + 839373 + 139318 + 113524 + 757338 + 570216 + 868055 + 471556 + 159577 + 945174 + 639944 + 456269 + 771769 + 126340 + 223095 + 734519 + 976649 + 424978 + 977175 + 434053 + 516368 + 333869 + 313412 + 655136 + 342142 + 214854 + 160411 + 14088 + 700139 + 387265 + 323346 + 197358 + 521738 + 756667 + 470781 + 90367 + 836710 + 597518 + 922403 + 101729 + 425558 + 721145 + 770116 + 924972 + 159359 + 581205 + 186633 + 737755 + 27113 + 316661 + 921573 + 838584 + 850580 + 732247 + 985053 + 721036 + 686632 + 216434 + 518782 + 585474 + 917088 + 596907 + 854653 + 288268 + 26063 + 933525 + 760839 + 728510 + 64813 + 248795 + 875386 + 672237 + 804075 + 195840 + 327309 + 14150 + 573910 + 663863 + 545179 + 476827 + 791051 + 321126 + 253226 + 747448 + 173746 + 95407 + 654925 + 52012 + 644097 + 591977 + 804094 + 167053 + 917911 + 449066 + 163486 + 868862 + 782037 + 630831 + 350884 + 820205 + 59213 + 657824 + 72694 + 894540 + 260411 + 774965 + 245037 + 937739 + 924678 + 57008 + 302347 + 967303 + 646481 + 451506 + 693461 + 809084 + 790551 + 759288 + 565215 + 171501 + 894227 + 552420 + 633535 + 157262 + 757297 + 29680 + 242034 + 212579 + 219345 + 809520 + 608105 + 513890 + 624596 + 660541 + 256512 + 792075 + 974255 + 169460 + 640487 + 594177 + 766352 + 346575 + 950322 + 982621 + 523091 + 168739 + 109465 + 671928 + 5684 + 59827 + 958109 + 602941 + 116707 + 308701 + 624291 + 954539 + 489932 + 424686 + 82484 + 592856 + 767677 + 430531 + 899689 + 958002 + 565651 + 92885 + 169029 + 388279 + 125294 + 90261 + 630847 + 881902 + 653620 + 118503 + 981293 + 296217 + 350567 + 368425 + 984418 + 123833 + 332960 + 75796 + 869769 + 991226 + 71756 + 393551 + 957321 + 170504 + 720021 + 677023 + 283131 + 856719 + 454802 + 592822 + 300979 + 687065 + 790793 + 552432 + 706591 + 893215 + 248305 + 333304 + 699351 + 141168 + 958730 + 887447 + 681529 + 58597 + 207515 + 337529 + 394991 + 449684 + 914627 + 160462 + 495423 + 197471 + 52524 + 558502 + 564047 + 853700 + 1623 + 17839 + 556841 + 916160 + 843269 + 54694 + 691259 + 793525 + 590203 + 148909 + 770446 + 457705 + 354530 + 865045 + 944962 + 783685 + 453193 + 160972 + 911996 + 576869 + 450932 + 883965 + 552086 + 287925 + 140763 + 454297 + 3340 + 415129 + 461942 + 736331 + 173152 + 594209 + 355430 + 97120 + 687423 + 375685 + 556871 + 652491 + 277278 + 689719 + 327051 + 700648 + 603284 + 998453 + 119875 + 343259 + 517172 + 135857 + 187828 + 294055 + 761053 + 835070 + 124952 + 874920 + 104139 + 943244 + 347308 + 199486 + 916958 + 323889 + 510947 + 544227 + 183076 + 446717 + 867379 + 907052 + 948316 + 664984 + 556544 + 753401 + 207474 + 180334 + 837276 + 949835 + 228541 + 695146 + 255275 + 885132 + 314418 + 752373 + 748575 + 778884 + 2140 + 762888 + 690513 + 177581 + 699588 + 720327 + 870197 + 638217 + 759713 + 603437 + 410477 + 599375 + 992255 + 465912 + 623408 + 439823 + 612956 + 213743 + 803227 + 724611 + 630285 + 70059 + 956815 + 638658 + 669655 + 727472 + 471669 + 607853 + 235139 + 187919 + 721370 + 107645 + 408693 + 290010 + 608552 + 659137 + 986870 + 923864 + 45370 + 12679 + 55045 + 933461 + 371469 + 518965 + 999126 + 706481 + 709454 + 687622 + 954781 + 451650 + 257856 + 933308 + 694148 + 163579 + 521605 + 509305 + 950063 + 275117 + 479994 + 628608 + 177771 + 997184 + 692151 + 772527 + 754149 + 346123 + 340006 + 186774 + 614424 + 858541 + 208762 + 565058 + 326389 + 993649 + 604861 + 920183 + 602128 + 223113 + 211454 + 642635 + 247228 + 808392 + 881370 + 746681 + 547501 + 265584 + 367584 + 303963 + 93203 + 517769 + 991188 + 64586 + 40753 + 734854 + 246855 + 265718 + 811947 + 860916 + 345814 + 627680 + 230686 + 829045 + 696313 + 537542 + 97185 + 463688 + 321591 + 420216 + 199698 + 70494 + 215346 + 297049 + 763736 + 713657 + 634705 + 531917 + 338782 + 180760 + 330690 + 764820 + 122513 + 635116 + 716188 + 32973 + 722520 + 955618 + 971420 + 79403 + 355524 + 764076 + 86912 + 849042 + 484094 + 140064 + 843958 + 172319 + 890868 + 23265 + 732595 + 636254 + 190274 + 303312 + 807068 + 643053 + 777741 + 597133 + 478800 + 656204 + 216427 + 713795 + 246859 + 634063 + 61430 + 806846 + 365931 + 650957 + 121513 + 214163 + 451783 + 705772 + 158317 + 985290 + 24238 + 718049 + 23085 + 96286 + 987636 + 711575 + 230878 + 352069 + 48812 + 185482 + 972292 + 976255 + 72558 + 672834 + 562681 + 888507 + 374592 + 486727 + 328874 + 669376 + 952031 + 653880 + 933391 + 212645 + 651356 + 35726 + 136166 + 65175 + 273883 + 637012 + 993764 + 454245 + 618729 + 101887 + 496098 + 2399 + 463285 + 397500 + 640650 + 129786 + 481179 + 685089 + 944190 + 144010 + 97751 + 378579 + 391994 + 17466 + 283017 + 390677 + 824561 + 852191 + 282141 + 566458 + 761834 + 32202 + 283399 + 304467 + 664919 + 63344 + 23655 + 365310 + 635302 + 100630 + 331324 + 867744 + 551568 + 163088 + 606841 + 472279 + 643623 + 36104 + 240633 + 752261 + 504407 + 861264 + 968587 + 752477 + 539117 + 413698 + 165015 + 735239 + 851925 + 66927 + 73127 + 113985 + 570197 + 445204 + 972999 + 574368 + 606208 + 763355 + 287039 + 382853 + 856369 + 854131 + 622959 + 882808 + 837935 + 883043 + 754242 + 178100 + 763234 + 750711 + 538113 + 4187 + 51379 + 182705 + 771002 + 786713 + 277487 + 506891 + 981522 + 887601 + 559404 + 118273 + 160928 + 38648 + 381916 + 631337 + 431092 + 962616 + 858472 + 719898 + 649970 + 181830 + 430402 + 644437 + 954572 + 14266 + 3636 + 466951 + 241426 + 757152 + 522921 + 953294 + 584554 + 58054 + 983543 + 163021 + 590935 + 473476 + 880543 + 726731 + 693475 + 214951 + 95435 + 810914 + 381480 + 82635 + 220430 + 770291 + 368616 + 586399 + 320147 + 487659 + 698388 + 254427 + 130839 + 401234 + 787100 + 129305 + 697107 + 219499 + 404330 + 451621 + 446121 + 323540 + 590896 + 531049 + 699338 + 856898 + 514322 + 804954 + 621721 + 502907 + 261813 + 84477 + 608456 + 949540 + 570721 + 988133 + 109176 + 41752 + 496509 + 562904 + 889671 + 621325 + 18229 + 92832 + 731118 + 54211 + 581482 + 95114 + 566787 + 445374 + 578892 + 503694 + 56272 + 541138 + 768074 + 40360 + 597201 + 319026 + 627101 + 773333 + 774459 + 265106 + 647473 + 863365 + 246905 + 338837 + 564588 + 497329 + 71591 + 625408 + 525708 + 9318 + 465482 + 675585 + 195431 + 189232 + 4675 + 533054 + 798654 + 778879 + 261113 + 449265 + 101050 + 155561 + 876811 + 285774 + 327028 + 203175 + 75569 + 604090 + 15210 + 370802 + 612195 + 443016 + 811392 + 918803 + 159218 + 783493 + 199019 + 352412 + 131113 + 700946 + 167151 + 42830 + 946017 + 205126 + 815931 + 35816 + 724948 + 767451 + 899554 + 47788 + 428523 + 535858 + 306740 + 649407 + 431176 + 237136 + 478694 + 636681 + 532881 + 766778 + 764586 + 589548 + 408365 + 466323 + 714508 + 617980 + 493833 + 88195 + 309952 + 295569 + 311180 + 448054 + 131775 + 780626 + 229714 + 764634 + 465667 + 124771 + 665376 + 687091 + 345120 + 769028 + 717453 + 9841 + 531900 + 227421 + 242804 + 74912 + 434010 + 958064 + 367572 + 861779 + 961166 + 421758 + 436409 + 764716 + 317758 + 328081 + 399188 + 57631 + 733324 + 68987 + 635228 + 46419 + 130518 + 339894 + 215010 + 908799 + 730576 + 948283 + 599394 + 221659 + 596289 + 809788 + 776342 + 175902 + 112467 + 131790 + 835132 + 478788 + 403914 + 784514 + 978082 + 943779 + 690888 + 859620 + 969762 + 767881 + 582080 + 416296 + 23720 + 496489 + 305072 + 414854 + 126696 + 675730 + 874316 + 837823 + 800342 + 192307 + 196596 + 998541 + 300442 + 300844 + 113998 + 37254 + 253627 + 338728 + 384381 + 604701 + 731599 + 128454 + 599342 + 733218 + 762846 + 67467 + 39691 + 895321 + 281863 + 905507 + 468411 + 249810 + 515867 + 209455 + 861134 + 75357 + 809021 + 515672 + 74109 + 391598 + 884149 + 169845 + 449664 + 767733 + 541955 + 854333 + 359185 + 318614 + 797745 + 803007 + 683576 + 888343 + 455641 + 703595 + 231233 + 421362 + 120304 + 287529 + 93510 + 521049 + 646149 + 607282 + 937689 + 195813 + 24066 + 1218 + 237448 + 792683 + 705640 + 745934 + 440832 + 118408 + 364867 + 396102 + 75719 + 748045 + 97373 + 811814 + 792788 + 521056 + 57135 + 873426 + 345992 + 224902 + 530697 + 883900 + 510524 + 466134 + 448892 + 658652 + 938284 + 728992 + 336057 + 302891 + 950851 + 621491 + 696755 + 676465 + 269951 + 309021 + 839991 + 546204 + 685424 + 135440 + 140934 + 425765 + 660696 + 431665 + 740132 + 102974 + 875744 + 511766 + 680232 + 854672 + 707566 + 856565 + 480203 + 349056 + 648152 + 484723 + 147048 + 235526 + 659949 + 511336 + 625026 + 422024 + 468835 + 894031 + 682371 + 39883 + 794580 + 366558 + 235512 + 96168 + 518823 + 559882 + 110788 + 813521 + 790535 + 310780 + 243669 + 657501 + 68990 + 157934 + 315476 + 51434 + 104235 + 25522 + 827598 + 778751 + 855055 + 94315 + 613209 + 72836 + 344445 + 860270 + 786492 + 394367 + 452578 + 380622 + 129352 + 896160 + 647273 + 707481 + 915640 + 575515 + 651965 + 508921 + 172866 + 114057 + 51172 + 877579 + 381423 + 405082 + 833465 + 326745 + 611304 + 768398 + 871937 + 973958 + 96318 + 852672 + 342170 + 912098 + 245813 + 225271 + 77707 + 767980 + 93893 + 649608 + 863018 + 448451 + 186136 + 49983 + 663968 + 73977 + 903812 + 163932 + 795788 + 99744 + 225606 + 882062 + 28544 + 624248 + 926831 + 275405 + 630105 + 885388 + 216152 + 310252 + 346608 + 944062 + 809801 + 250506 + 320435 + 555259 + 443298 + 747518 + 945674 + 226655 + 820667 + 617434 + 661092 + 464705 + 1158 + 306041 + 680601 + 208235 + 223466 + 41106 + 661230 + 449540 + 167444 + 672223 + 308590 + 42976 + 653330 + 198157 + 919847 + 701050 + 778459 + 981684 + 864188 + 178020 + 491485 + 651941 + 788 + 640986 + 604100 + 694264 + 34284 + 228482 + 240251 + 727533 + 807738 + 796572 + 722859 + 469019 + 533111 + 852442 + 898039 + 386724 + 959228 + 675496 + 896820 + 39227 + 477247 + 625949 + 334358 + 103025 + 163631 + 640918 + 946662 + 87381 + 760613 + 918022 + 664807 + 736665 + 594166 + 786467 + 126658 + 120197 + 429473 + 765648 + 626082 + 409593 + 263893 + 811239 + 499674 + 343607 + 57435 + 748784 + 950970 + 380475 + 400719 + 894798 + 312169 + 537761 + 120452 + 865355 + 743352 + 919698 + 822392 + 572181 + 369198 + 932031 + 371820 + 406253 + 853205 + 184365 + 311506 + 608889 + 409408 + 80005 + 217178 + 830341 + 251598 + 93301 + 990495 + 875893 + 480041 + 734491 + 89510 + 639451 + 405694 + 202046 + 696642 + 224636 + 311930 + 722514 + 824143 + 253381 + 653750 + 577862 + 357069 + 362025 + 694506 + 820321 + 33748 + 884901 + 580116 + 674729 + 363746 + 725438 + 850789 + 628375 + 483339 + 414749 + 390237 + 208344 + 948482 + 357723 + 812398 + 446359 + 465275 + 266628 + 285651 + 31124 + 557933 + 782195 + 794540 + 148173 + 174258 + 282216 + 838990 + 7206 + 228600 + 877638 + 571022 + 56939 + 82333 + 596155 + 368978 + 887444 + 961823 + 753304 + 849238 + 819994 + 313891 + 511058 + 315436 + 184410 + 98790 + 623916 + 645182 + 283898 + 20666 + 372505 + 614277 + 47397 + 695531 + 684664 + 658437 + 369425 + 756733 + 444047 + 72508 + 137417 + 897920 + 986208 + 647183 + 946571 + 853514 + 782201 + 743228 + 502197 + 316675 + 309674 + 803192 + 709551 + 794774 + 111456 + 300633 + 451187 + 402357 + 41660 + 126831 + 51796 + 591620 + 699268 + 415010 + 430553 + 820372 + 49231 + 802058 + 940958 + 157506 + 231060 + 127742 + 898181 + 825969 + 554921 + 571429 + 793907 + 683227 + 685227 + 226304 + 198676 + 639240 + 11734 + 111090 + 351732 + 11923 + 208132 + 619265 + 438361 + 820122 + 978141 + 405782 + 554740 + 14077 + 989104 + 711288 + 360278 + 643395 + 993082 + 123841 + 417459 + 962516 + 135444 + 778130 + 219187 + 473683 + 450966 + 992195 + 903632 + 907411 + 547421 + 341643 + 656569 + 140454 + 476673 + 171367 + 801225 + 51277 + 793271 + 544769 + 575621 + 313020 + 800547 + 630473 + 597419 + 123972 + 984202 + 526547 + 16260 + 875536 + 633405 + 522223 + 353616 + 757698 + 649386 + 797110 + 30123 + 302000 + 541531 + 557920 + 580435 + 862002 + 610970 + 612682 + 555563 + 31256 + 321677 + 382462 + 112717 + 998773 + 859063 + 350583 + 292654 + 841990 + 876066 + 949341 + 984518 + 757244 + 426748 + 884226 + 578188 + 227733 + 87388 + 895641 + 304116 + 128992 + 265074 + 958118 + 260675 + 771858 + 693801 + 917041 + 129004 + 882939 + 118061 + 562860 + 575346 + 522583 + 163935 + 142813 + 340897 + 940348 + 397694 + 310145 + 19147 + 367970 + 571885 + 510824 + 520727 + 749829 + 58931 + 807762 + 225747 + 410924 + 472218 + 142533 + 823646 + 662334 + 474695 + 34593 + 840532 + 344193 + 774966 + 717995 + 854025 + 306158 + 310882 + 715613 + 395604 + 825372 + 620634 + 850857 + 540451 + 961941 + 401352 + 696892 + 184789 + 851896 + 255193 + 463359 + 10732 diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.dat b/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.dat new file mode 100644 index 0000000..8677f59 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.dat @@ -0,0 +1,54 @@ +# V = 1.0 + +0.00000000000000000E+000 0.25000000000000006E+000 0.16653345369377348E-015 +0.10000000000000000E+001 -0.12485847564928568E+000 0.78978988278179821E-004 +0.20000000000000000E+001 0.27158236593575795E-001 0.99917302496996933E-004 +0.30000000000000000E+001 -0.24436319288825371E-001 0.11884951515079272E-003 +0.40000000000000000E+001 0.11054191328338689E-001 0.90225765962491931E-004 +0.50000000000000000E+001 -0.11075517531997861E-001 0.88607405473823761E-004 +0.60000000000000000E+001 0.63122232869041563E-002 0.67679950160548941E-004 +0.70000000000000000E+001 -0.66468567340347388E-002 0.80365913027573068E-004 +0.80000000000000000E+001 0.42946836373764863E-002 0.68765269537706333E-004 +0.90000000000000000E+001 -0.46428064713458332E-002 0.58056637822345776E-004 +0.10000000000000000E+002 0.32993692606376490E-002 0.58510894546516086E-004 +0.11000000000000000E+002 -0.36891505751310751E-002 0.53363806033937644E-004 +0.12000000000000000E+002 0.28124342838241382E-002 0.52570717921318117E-004 +0.13000000000000000E+002 -0.32664061956325739E-002 0.59202484259488879E-004 +0.14000000000000000E+002 0.26438009307607887E-002 0.53347899225270481E-004 + + +# V = 2.0 + +0.00000000000000000E+000 0.25000000000000000E+000 0.16653345369377348E-015 +0.10000000000000000E+001 -0.14837326709044846E+000 0.33855088519035880E-003 +0.20000000000000000E+001 0.61645826537780411E-001 0.45354555955149235E-003 +0.30000000000000000E+001 -0.52220998437308916E-001 0.49036216367773070E-003 +0.40000000000000000E+001 0.36940890281688725E-001 0.54013692238879466E-003 +0.50000000000000000E+001 -0.33602555439462445E-001 0.41664692820826308E-003 +0.60000000000000000E+001 0.27194817524732684E-001 0.45872418687599529E-003 +0.70000000000000000E+001 -0.25814772550406467E-001 0.52870098689907928E-003 +0.80000000000000000E+001 0.22695390541997738E-001 0.62870392828494174E-003 +0.90000000000000000E+001 -0.22137039028389670E-001 0.59279948475522844E-003 +0.10000000000000000E+002 0.19773059836247286E-001 0.49850041221950227E-003 +0.11000000000000000E+002 -0.19620277847282253E-001 0.46269005073006287E-003 +0.12000000000000000E+002 0.18473754356985304E-001 0.43469550686785143E-003 +0.13000000000000000E+002 -0.18845837298137279E-001 0.47781082978364442E-003 +0.14000000000000000E+002 0.18153031421910017E-001 0.54249507645360065E-003 + + +# V = 2.5 +0.00000000000000000E+000 0.25000000000000006E+000 0.12412670766236366E-015 +0.10000000000000000E+001 -0.16063352997834843E+000 0.74311578849755255E-003 +0.20000000000000000E+001 0.81619654082300958E-001 0.11419670612491703E-002 +0.30000000000000000E+001 -0.71525630952384497E-001 0.95670571785530804E-003 +0.40000000000000000E+001 0.57435236165254040E-001 0.95659576819908895E-003 +0.50000000000000000E+001 -0.53693305078941815E-001 0.11933519151418083E-002 +0.60000000000000000E+001 0.47216729196167553E-001 0.13911888994578424E-002 +0.70000000000000000E+001 -0.44795167211723018E-001 0.16474956309752175E-002 +0.80000000000000000E+001 0.41558729073216220E-001 0.19274374202130366E-002 +0.90000000000000000E+001 -0.41185302714945991E-001 0.18550610720036392E-002 +0.10000000000000000E+002 0.39028243457991087E-001 0.17854428741840283E-002 +0.11000000000000000E+002 -0.39169755571875631E-001 0.17894958792504521E-002 +0.12000000000000000E+002 0.38151050081908632E-001 0.20786337274436035E-002 +0.13000000000000000E+002 -0.37132146190050577E-001 0.20526868044026215E-002 +0.14000000000000000E+002 0.36332021230633234E-001 0.19181967274737532E-002 diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.pdf b/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.pdf new file mode 100644 index 0000000..e8487a0 Binary files /dev/null and b/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.pdf differ diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.plt b/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.plt new file mode 100644 index 0000000..6aac96b --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_2/tV.plt @@ -0,0 +1,17 @@ +set terminal postscript eps enhanced solid color 'Times-Roman' 18 +set size 0.8,0.8 +set title "{L=28 tV model, {/Symbol b}t=20}" +set out 'tV.eps' +set fit errorvariables +set xlabel "r" +set ylabel "" + +plot "tV.dat" i 0 u 1:2:3 w e lc rgb "black" lt 1 pt 7 lw 2 t "V/t=1" , \ + '' i 0 u 1:2 w l lc rgb "black" lt 1 lw 2 t "" , \ + '' i 1 u 1:2:3 w e lc rgb "red" lt 1 pt 7 lw 2 t "V/t=2" , \ + '' i 1 u 1:2 w l lc rgb "red" lt 1 lw 2 t "" , \ + '' i 2 u 1:2:3 w e lc rgb "royalblue" lt 1 pt 7 lw 2 t "V/t=2.5" ,\ + '' i 2 u 1:2 w l lc rgb "royalblue" lt 1 lw 2 t "" + +!epstopdf tV.eps +!evince tV.pdf diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_3 b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_3 new file mode 100644 index 0000000..fb5f19f --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_3 @@ -0,0 +1,920 @@ +! Copyright (C) 2016 - 2020 The ALF project +! +! The ALF project is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! The ALF project is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with ALF. If not, see http://www.gnu.org/licenses/. +! +! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms: +! +! - It is our hope that this program makes a contribution to the scientific community. Being +! part of that community we feel that it is reasonable to require you to give an attribution +! back to the original authors if you have benefitted from this program. +! Guidelines for a proper citation can be found on the project's homepage +! http://alf.physik.uni-wuerzburg.de +! +! - We require the preservation of the above copyright notice and this license in all original files. +! +! - We prohibit the misrepresentation of the origin of the original source files. To obtain +! the original source files please visit the homepage http://alf.physik.uni-wuerzburg.de . +! +! - If you make substantial changes to the program we require you to either consider contributing +! to the ALF project or to mark your material in a reasonable way as different from the original version + + +!-------------------------------------------------------------------- +!> @author +!> ALF-project +!> +!> @brief +!> This module defines the Hamiltonian and observables. Here, we have included a +!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models +!> on honeycomb, pi-flux and square lattices. + +!> @details +!> The public variables of this module are the following +!> +!> +!> @param [public] OP_V +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice. +!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim +!> +!> @param [public] OP_T +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> Sequence of operators accounting for the hopping on a time slice. This can include various +!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to +!> the flavor index. \endverbatim +!> * The progagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is +!> first the hopping and then the potential energy. +!> +!>@param [public] WF_L +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Left trial wave function. \endverbatim +!> +!> @param [public] WF_R +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim +!> +!> @param [public] nsigma +!> \verbatim Type(Fields) +!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator +!> sequence. The second through the time slices. \endverbatim +! +!> @param [public] Ndim +!> \verbatim Integer +!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim +! +!> @param [public] N_FL +!> \verbatim Integer +!> # of flavors. Propagation is block diagonal in flavors. \endverbatim +! +!> @param [public] N_SUN +!> \verbatim Integer +!> # of colors. Propagation is color independent. \endverbatim +!> +!> @param [public] Ltrot +!> \verbatim Integer +!> Available measurment interval in units of Delta Tau. \endverbatim +!> +!> @param [public] Thtrot +!> \verbatim Integer +!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim +!> +!> @param [public] Projector +!> \verbatim Logical +!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim +!> +!> @param [public] Group_Comm +!> \verbatim Integer +!> Defines MPI communicator \endverbatim +! +!> @param [public] Symm +!> \verbatim Logical \endverbatim +!> If set to true then the green functions will be symmetrized +!> before being sent to the Obser, ObserT subroutines. +!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$ +!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that +!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed +!> symmetrically. If Symm is true, the propagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$ +!> +!> +!> You still have to add some docu for the other private variables in this module. +!> +!-------------------------------------------------------------------- + + submodule (Hamiltonian_main) ham_Hubbard_Plain_Vanilla_smod + + Use Operator_mod + Use WaveFunction_mod + Use Lattices_v3 + Use MyMats + Use Random_Wrap + Use Files_mod + Use Matrix + Use Observables + Use Fields_mod + Use Predefined_Hoppings + Use LRC_Mod + use runtime_error_mod + + + Implicit none + + type, extends(ham_base) :: ham_Hubbard_Plain_Vanilla + contains + ! Set Hamiltonian-specific procedures + procedure, nopass :: Ham_Set + procedure, nopass :: Alloc_obs + procedure, nopass :: Obser + procedure, nopass :: ObserT + procedure, nopass :: weight_reconstruction + procedure, nopass :: GR_reconstruction + procedure, nopass :: GRT_reconstruction +#ifdef HDF5 + procedure, nopass :: write_parameters_hdf5 +#endif + end type ham_Hubbard_Plain_Vanilla + + !#PARAMETERS START# VAR_lattice + Character (len=64) :: Model = '' ! Value irrelevant + Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square' + Integer :: L1 = 6 ! Length in direction a_1 + Integer :: L2 = 6 ! Length in direction a_2 + !#PARAMETERS END# + + !#PARAMETERS START# VAR_Hubbard_Plain_Vanilla + real(Kind=Kind(0.d0)) :: ham_T = 1.d0 ! Hopping parameter + real(Kind=Kind(0.d0)) :: Ham_chem = 0.d0 ! Chemical potential + real(Kind=Kind(0.d0)) :: Ham_U = 4.d0 ! Hubbard interaction + real(Kind=Kind(0.d0)) :: Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau + real(Kind=Kind(0.d0)) :: Beta = 5.d0 ! Inverse temperature + !logical :: Projector= .false. ! Whether the projective algorithm is used + real(Kind=Kind(0.d0)) :: Theta = 10.d0 ! Projection parameter + !logical :: Symm = .true. ! Whether symmetrization takes place + Integer :: N_part = -1 ! Number of particles in trial wave function. If N_part < 0 -> N_part = L1*L2/2 + !#PARAMETERS END# + + Type (Lattice), target :: Latt + Type (Unit_cell), target :: Latt_unit + INTEGER :: nf_calc, nf_reconst + + contains + + module Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + allocate(ham_Hubbard_Plain_Vanilla::ham) + end Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + +! Dynamically generated on compile time from parameters list. +! Supplies the subroutines read_parameters and write_parameters_hdf5. +#include "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hamiltonian +!-------------------------------------------------------------------- + Subroutine Ham_Set + +#if defined (MPI) || defined(TEMPERING) + Use mpi +#endif + Implicit none + + integer :: ierr, nf, unit_info + Character (len=64) :: file_info + + + +#ifdef MPI + Integer :: Isize, Irank, irank_g, isize_g, igroup + Integer :: STATUS(MPI_STATUS_SIZE) + CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR) + CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR) + call MPI_Comm_rank(Group_Comm, irank_g, ierr) + call MPI_Comm_size(Group_Comm, isize_g, ierr) + igroup = irank/isize_g +#endif + + ! From dynamically generated file "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + call read_parameters() + + + If (L1 == 1) then + Write(6,*) 'For one-dimensional lattices set L2=1' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + endif + + if (N_part < 0) N_part = L1*L2/2 + Ltrot = nint(beta/dtau) + Thtrot = 0 + if (Projector) Thtrot = nint(theta/dtau) + Ltrot = Ltrot+2*Thtrot + N_SUN = 1 + N_FL = 2 + + ! Setup the Bravais lattice + Call Ham_Latt + + ! Setup the hopping / single-particle part + Call Ham_Hop + + ! Setup the interaction. + call Ham_V + + ! Setup the trival wave function, in case of a projector approach + if (Projector) Call Ham_Trial() + +#ifdef MPI + If (Irank_g == 0) then +#endif + File_info = "info" +#if defined(TEMPERING) + write(File_info,'(A,I0,A)') "Temp_",igroup,"/info" +#endif + + Open(newunit=unit_info, file=file_info, status="unknown", position="append") + Write(unit_info,*) '=====================================' + Write(unit_info,*) 'Model is : Hubbard_Plain_Vanilla' + Write(unit_info,*) 'Lattice is : ', Lattice_type + Write(unit_info,*) 'L1 : ', L1 + Write(unit_info,*) 'L2 : ', L2 + Write(unit_info,*) '# of orbitals : ', Ndim + Write(unit_info,*) 'Symm. decomp : ', Symm + if (Projector) then + Write(unit_info,*) 'Projective version' + Write(unit_info,*) 'Theta : ', Theta + Write(unit_info,*) 'Tau_max : ', beta + Write(unit_info,*) '# of particles: ', N_part + else + Write(unit_info,*) 'Finite temperture version' + Write(unit_info,*) 'Beta : ', Beta + endif + Write(unit_info,*) 'dtau,Ltrot_eff: ', dtau,Ltrot + Write(unit_info,*) 't : ', Ham_T + Write(unit_info,*) 'Ham_U : ', Ham_U + Write(unit_info,*) 'Ham_chem : ', Ham_chem + If ( Ham_U >=0.d0 .and. Ham_chem == 0.d0 ) then + Write(unit_info,*) 'Assuming particle hole symmetry' + endif + If ( Ham_U < 0.d0 ) then + Write(unit_info,*) 'Assuming time reversal symmetry' + endif + if (Projector) then + Do nf = 1,N_FL + Write(unit_info,*) 'Degen of right trial wave function: ', WF_R(nf)%Degen + Write(unit_info,*) 'Degen of left trial wave function: ', WF_L(nf)%Degen + enddo + endif + Close(unit_info) +#ifdef MPI + Endif +#endif + + ! Particle-hole symmetry for repulsive U only if chemical potential vanishes + ! Time reversal symmetry for attractive U + If ( (Ham_U >= 0.d0 .and. Ham_chem == 0.d0) .or. Ham_U < 0.d0 ) then + allocate(Calc_Fl(N_FL)) + nf_calc=2 + nf_reconst=1 + Calc_Fl(nf_calc)=.True. + Calc_Fl(nf_reconst)=.False. + endif + + + End Subroutine Ham_Set + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Lattice +!-------------------------------------------------------------------- + Subroutine Ham_Latt + + + Implicit none + Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2) + + If (Lattice_Type /= "Square") then + Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif + + Latt_unit%Norb = 1 + Latt_unit%N_coord = 2 + allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2)) + Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0] + + a1_p(1) = 1.0 ; a1_p(2) = 0.d0 + a2_p(1) = 0.0 ; a2_p(2) = 1.d0 + L1_p = dble(L1)*a1_p + L2_p = dble(L2)*a2_p + Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt ) + + Ndim = Latt%N*Latt_unit%Norb + + end Subroutine Ham_Latt +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hopping +!-------------------------------------------------------------------- + Subroutine Ham_Hop + + Implicit none + + Integer :: nf , I, Ix, Iy + allocate(Op_T(1,N_FL)) + do nf = 1,N_FL + Call Op_make(Op_T(1,nf),Ndim) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + If ( L2 > 1 ) then + Iy = Latt%nnlist(I,0,1) + Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + endif + Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0)) + Op_T(1,nf)%P(i) = i + Enddo + Op_T(1,nf)%g = -Dtau + Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0)) + Call Op_set(Op_T(1,nf)) + enddo + + + end Subroutine Ham_Hop +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the trial wave function +!-------------------------------------------------------------------- + Subroutine Ham_Trial() + + Use Predefined_Trial + + Implicit none + + Integer :: nf, Ix, Iy, I, n + Real (Kind=Kind(0.d0)), allocatable :: H0(:,:), U0(:,:), E0(:) + Real (Kind=Kind(0.d0)) :: Pi = acos(-1.d0), Delta = 0.01d0 + + Allocate(WF_L(N_FL),WF_R(N_FL)) + do nf=1,N_FL + Call WF_alloc(WF_L(nf),Ndim,N_part) + Call WF_alloc(WF_R(nf),Ndim,N_part) + enddo + + + Allocate(H0(Ndim,Ndim), U0(Ndim, Ndim), E0(Ndim) ) + H0 = 0.d0; U0 = 0.d0; E0=0.d0 + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + H0(I, Ix) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + H0(Ix, I ) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + If (L2 > 1 ) Then + Iy = Latt%nnlist(I,0,1) + H0(I, Iy) = -Ham_T *(1.d0 - Delta) + H0(Iy, I ) = -Ham_T *(1.d0 - Delta) + Endif + Enddo + Call Diag(H0,U0,E0) +!!$ Do I = 1,Ndim +!!$ Write(6,*) I,E0(I) +!!$ Enddo + Do nf = 1,N_FL + do n=1,N_part + do I=1,Ndim + WF_L(nf)%P(I,n)=U0(I,n) + WF_R(nf)%P(I,n)=U0(I,n) + enddo + enddo + WF_L(nf)%Degen = E0(N_part+1) - E0(N_part) + WF_R(nf)%Degen = E0(N_part+1) - E0(N_part) + enddo + + Deallocate(H0, U0, E0 ) + + end Subroutine Ham_Trial + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the interaction +!-------------------------------------------------------------------- + Subroutine Ham_V + + Use Predefined_Int + Implicit none + + Integer :: nf, I + Real (Kind=Kind(0.d0)) :: X + + + Allocate(Op_V(Ndim,N_FL)) + + do nf = 1,N_FL + do i = 1, Ndim + Call Op_make(Op_V(i,nf), 1) + enddo + enddo + + Do nf = 1,N_FL + X = 1.d0 + if (nf == 2) X = -1.d0 + Do i = 1,Ndim + Op_V(i,nf)%P(1) = I + Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%g = X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0))) + Op_V(i,nf)%alpha = cmplx(-0.5d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%type = 2 + Call Op_set( Op_V(i,nf) ) + Enddo + Enddo + + + end Subroutine Ham_V + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Specifiy the equal time and time displaced observables +!> @details +!-------------------------------------------------------------------- + Subroutine Alloc_obs(Ltau) + + Implicit none + !> Ltau=1 if time displaced correlations are considered. + Integer, Intent(In) :: Ltau + Integer :: i, N, Nt + Character (len=64) :: Filename + Character (len=2) :: Channel + + + ! Scalar observables + Allocate ( Obs_scal(4) ) + Do I = 1,Size(Obs_scal,1) + select case (I) + case (1) + N = 1; Filename ="Kin" + case (2) + N = 1; Filename ="Pot" + case (3) + N = 1; Filename ="Part" + case (4) + N = 1; Filename ="Ener" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Call Obser_Vec_make(Obs_scal(I),N,Filename) + enddo + + ! Equal time correlators +!!!! Modifications for Exercise 3 + !Allocate ( Obs_eq(5) ) + Allocate ( Obs_eq(6) ) ! memory for new observable +!!!! End modifications + Do I = 1,Size(Obs_eq,1) + select case (I) + case (1) + Filename = "Green" + case (2) + Filename = "SpinZ" + case (3) + Filename = "SpinXY" + case (4) + Filename = "SpinT" + case (5) + Filename = "Den" +!!!! Modifications for Exercise 3 + case (6) + Filename = "Kin" ! new observable +!!!! End modifications + case default + Write(6,*) "Error in Alloc_obs" + end select + Nt = 1 + Channel = "--" + Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + + If (Ltau == 1) then + ! time-displaced correlators +!!!! Modifications for Exercise 3 + !Allocate ( Obs_tau(5) ) + Allocate ( Obs_tau(6) ) ! memory for new observable +!!!! End modifications + Do I = 1,Size(Obs_tau,1) + select case (I) + case (1) + Channel = 'P' ; Filename = "Green" + case (2) + Channel = 'PH'; Filename = "SpinZ" + case (3) + Channel = 'PH'; Filename = "SpinXY" + case (4) + Channel = 'PH'; Filename = "SpinT" + case (5) + Channel = 'PH'; Filename = "Den" +!!!! Modifications for Exercise 3 + case (6) + Channel = 'PH'; Filename = "Kin" +!!!! End modifications + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Nt = Ltrot+1-2*Thtrot + If(Projector) Channel = 'T0' + Call Obser_Latt_make(Obs_tau(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + endif + + End Subroutine Alloc_obs + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes equal time observables +!> @details +!> @param [IN] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!> @param [IN] Ntau Integer +!> \verbatim +!> Time slice +!> \endverbatim +!------------------------------------------------------------------- + subroutine Obser(GR,Phase,Ntau, Mc_step_weight) + + Use Predefined_Obs + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GR(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), Intent(IN) :: PHASE + Integer, INTENT(IN) :: Ntau + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Local + Complex (Kind=Kind(0.d0)) :: GRC(Ndim,Ndim,N_FL), ZK + Complex (Kind=Kind(0.d0)) :: Zrho, Zkin, ZPot, Z, ZP,ZS, ZZ, ZXY, ZDen + Integer :: I,J, imj, nf, Ix, Iy +!!!! Modifications for Exercise 3 + Integer :: Jx +!!!! End modifications + Real (Kind=Kind(0.d0)) :: X + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + + ZS = ZS*Mc_step_weight + + + + Do nf = 1,N_FL + Do I = 1,Ndim + Do J = 1,Ndim + GRC(I, J, nf) = -GR(J, I, nf) + Enddo + GRC(I, I, nf) = 1.D0 + GRC(I, I, nf) + Enddo + Enddo + ! GRC(i,j,nf) = < c^{dagger}_{i,nf } c_{j,nf } > + + ! Compute scalar observables. + Do I = 1,Size(Obs_scal,1) + Obs_scal(I)%N = Obs_scal(I)%N + 1 + Obs_scal(I)%Ave_sign = Obs_scal(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + + Zkin = cmplx(0.d0, 0.d0, kind(0.D0)) + Zkin = Zkin* dble(N_SUN) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) & + & + GRC(I,Ix,2) + GRC(Ix,I,2) + Enddo + If (L2 > 1) then + Do I = 1,Latt%N + Iy = Latt%nnlist(I,0,1) + Zkin = Zkin + GRC(I,Iy,2) + GRC(Iy,I,2) & + & + GRC(I,Iy,1) + GRC(Iy,I,1) + Enddo + Endif + Zkin = Zkin*cmplx(-Ham_T,0.d0,Kind(0.d0)) + Obs_scal(1)%Obs_vec(1) = Obs_scal(1)%Obs_vec(1) + Zkin *ZP* ZS + + + ZPot = cmplx(0.d0, 0.d0, kind(0.D0)) + Do I = 1,Ndim + ZPot = ZPot + Grc(i,i,1) * Grc(i,i, 2) + Enddo + Zpot = Zpot*ham_U + Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + Zpot * ZP*ZS + + + Zrho = cmplx(0.d0,0.d0, kind(0.D0)) + Do I = 1,Ndim + Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) + enddo + Obs_scal(3)%Obs_vec(1) = Obs_scal(3)%Obs_vec(1) + Zrho * ZP*ZS + Obs_scal(4)%Obs_vec(1) = Obs_scal(4)%Obs_vec(1) + (Zkin + Zpot)*ZP*ZS + + Do I = 1,Size(Obs_eq,1) + Obs_eq(I)%N = Obs_eq(I)%N + 1 + Obs_eq(I)%Ave_sign = Obs_eq(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + ZXY = GRC(I,J,1) * GR(I,J,2) + GRC(I,J,2) * GR(I,J,1) + ZZ = GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + & + (GRC(I,I,2) - GRC(I,I,1))*(GRC(J,J,2) - GRC(J,J,1)) + + ZDen = (GRC(I,I,1) + GRC(I,I,2)) * (GRC(J,J,1) + GRC(J,J,2)) + & + & GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + + Obs_eq(1)%Obs_Latt(imj,1,1,1) = Obs_eq(1)%Obs_Latt(imj,1,1,1) + (GRC(I,J,1) + GRC(I,J,2))*ZP*ZS + Obs_eq(2)%Obs_Latt(imj,1,1,1) = Obs_eq(2)%Obs_Latt(imj,1,1,1) + ZZ *ZP*ZS + Obs_eq(3)%Obs_Latt(imj,1,1,1) = Obs_eq(3)%Obs_Latt(imj,1,1,1) + ZXY *ZP*ZS + Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_eq(5)%Obs_Latt(imj,1,1,1) = Obs_eq(5)%Obs_Latt(imj,1,1,1) + ZDen * ZP * ZS + +!!!! Modifications for Exercise 3 + Zkin=0.0d0 !re-use Zkin for equal-time correlation function + Ix = Latt%nnlist(I,1,0) + Jx = Latt%nnlist(J,1,0) + !(i,i+1) - (j,j+1) contribution + Zkin = Zkin + (GRC(I,Ix,1) + GRC(I,Ix,2)) * (GRC(J,Jx,1) + GRC(J,Jx,2)) + & + & GRC(I,Jx,1) * GR(Ix,J,1) + GRC(I,Jx,2) * GR(Ix,J,2) + !(i,i+1) - (j+1,j) contribution + Zkin = Zkin + (GRC(I,Ix,1) + GRC(I,Ix,2)) * (GRC(Jx,J,1) + GRC(Jx,J,2)) + & + & GRC(I,J,1) * GR(Ix,Jx,1) + GRC(I,J,2) * GR(Ix,Jx,2) + !(i+1,i) - (j,j+1) contribution + Zkin = Zkin + (GRC(Ix,I,1) + GRC(Ix,I,2)) * (GRC(J,Jx,1) + GRC(J,Jx,2)) + & + & GRC(Ix,Jx,1) * GR(I,J,1) + GRC(Ix,Jx,2) * GR(I,J,2) + !(i+1,i) - (j+1,j) contribution + Zkin = Zkin + (GRC(Ix,I,1) + GRC(Ix,I,2)) * (GRC(Jx,J,1) + GRC(Jx,J,2)) + & + & GRC(Ix,J,1) * GR(I,Jx,1) + GRC(Ix,J,2) * GR(I,Jx,2) + Obs_eq(6)%Obs_Latt(imj,1,1,1) = Obs_eq(6)%Obs_Latt(imj,1,1,1) + ZKin * ZP * ZS +!!!! End modifications + + + enddo + Obs_eq(5)%Obs_Latt0(1) = Obs_eq(5)%Obs_Latt0(1) + (GRC(I,I,1) + GRC(I,I,2)) * ZP*ZS +!!!! Modifications for Exercise 3 + Ix = Latt%nnlist(I,1,0) + Obs_eq(6)%Obs_Latt0(1) = Obs_eq(6)%Obs_Latt0(1) + (GRC(I,Ix,1) + GRC(I,Ix,2) + & + & GRC(Ix,I,1) + GRC(Ix,I,2) ) * ZP*ZS +!!!! End modifications + enddo + + + + + end Subroutine Obser +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes time displaced observables +!> @details +!> @param [IN] NT, Integer +!> \verbatim +!> Imaginary time +!> \endverbatim +!> @param [IN] GT0, GTT, G00, GTT, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> G00(I,J,nf) = +!> GTT(I,J,nf) = +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!------------------------------------------------------------------- + Subroutine ObserT(NT, GT0,G0T,G00,GTT, PHASE, Mc_step_weight ) + + Use Predefined_Obs + + Implicit none + + Integer , INTENT(IN) :: NT + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GT0(Ndim,Ndim,N_FL),G0T(Ndim,Ndim,N_FL),G00(Ndim,Ndim,N_FL),GTT(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), INTENT(IN) :: Phase + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Locals + Complex (Kind=Kind(0.d0)) :: Z, ZP, ZS, ZZ, ZXY, ZDEN +!!!! Modifications for Exercise 3 + Complex (Kind=Kind(0.d0)) :: Zkin + Integer :: Ix, Jx +!!!! End modifications + Real (Kind=Kind(0.d0)) :: X + Integer :: IMJ, I, J, I1, J1, no_I, no_J + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + ZS = ZS*Mc_step_weight + + If (NT == 0 ) then + Do I = 1,Size(Obs_tau,1) + Obs_tau(I)%N = Obs_tau(I)%N + 1 + Obs_tau(I)%Ave_sign = Obs_tau(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + Endif + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + + ZZ = (GTT(I,I,1) - GTT(I,I,2) ) * ( G00(J,J,1) - G00(J,J,2) ) & + & - G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + ZXY = - G0T(J,I,1) * GT0(I,J,2) - G0T(J,I,2) * GT0(I,J,1) + + + ZDen = (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2) ) * & + & (cmplx(2.d0,0.d0,kind(0.d0)) - G00(J,J,1) - G00(J,J,2) ) & + & -G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + + Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) + (GT0(I,J,1) + GT0(I,J,2))*ZP*ZS + Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) + ZZ *ZP*ZS + Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) + ZXY *ZP*ZS + Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) + ZDen * ZP * ZS + +!!!! Modifications for Exercise 3 + Zkin=0.0d0 !re-use Zkin for equal-time correlation function + Ix = Latt%nnlist(I,1,0) + Jx = Latt%nnlist(J,1,0) + !(i,i+1) - (j,j+1) contribution + Zkin = Zkin + (GTT(I,Ix,1) + GTT(I,Ix,2)) * (G00(J,Jx,1) + G00(J,Jx,2)) - & + & GT0(I,Jx,1) * G0T(J,Ix,1) - GT0(I,Jx,2) * G0T(J,Ix,2) + !(i,i+1) - (j+1,j) contribution + Zkin = Zkin + (GTT(I,Ix,1) + GTT(I,Ix,2)) * (G00(Jx,J,1) + G00(Jx,J,2)) - & + & GT0(I,J,1) * G0T(Jx,Ix,1) - GT0(I,J,2) * G0T(Jx,Ix,2) + !(i+1,i) - (j,j+1) contribution + Zkin = Zkin + (GTT(Ix,I,1) + GTT(Ix,I,2)) * (G00(J,Jx,1) + G00(J,Jx,2)) - & + & GT0(Ix,Jx,1) * G0T(J,I,1) - GT0(Ix,Jx,2) * G0T(J,I,2) + !(i+1,i) - (j+1,j) contribution + Zkin = Zkin + (GTT(Ix,I,1) + GTT(Ix,I,2)) * (G00(Jx,J,1) + G00(Jx,J,2)) - & + & GT0(Ix,J,1) * G0T(Jx,I,1) - GT0(Ix,J,2) * G0T(Jx,I,2) + Obs_tau(6)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(6)%Obs_Latt(imj,NT+1,1,1) + ZKin * ZP * ZS + +!!!! End modifications + + + enddo + Obs_tau(5)%Obs_Latt0(1) = Obs_tau(5)%Obs_Latt0(1) + & + & (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2)) * ZP*ZS +!!!! Modifications for Exercise 3 + Ix = Latt%nnlist(I,1,0) + Obs_tau(6)%Obs_Latt0(1) = Obs_tau(6)%Obs_Latt0(1) - & + & (GTT(I,Ix,1) + GTT(I,Ix,2) + GTT(Ix,I,1) + GTT(Ix,I,2)) * ZP*ZS +!!!! End modifications + enddo + + + + end Subroutine OBSERT + +!-------------------------------------------------------------------- +!> @brief +!> Reconstructs dependent flavors of the configuration's weight. +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!-------------------------------------------------------------------- + subroutine weight_reconstruction(weight) + implicit none + complex (Kind=Kind(0.d0)), Intent(inout) :: weight(:) + + weight(nf_reconst) = conjg(Weight(nf_calc)) + + end subroutine weight_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of equal time Greens function +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!------------------------------------------------------------------- + subroutine GR_reconstruction(GR) + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GR(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Ndim + Do I = 1,Ndim + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + ! write(*,*) Latt%list(I,:),Latt%list(J,:),mod(Latt%list(imj,1)+Latt%list(imj,2),2), X + ZZ=0.d0 + if (I==J) ZZ=1.d0 + GR(I,J,nf_reconst) = ZZ - X*GR(J,I,nf_calc) + Enddo + Enddo + else + Do J = 1,Ndim + Do I = 1,Ndim + GR(I,J,nf_reconst) = Conjg(GR(I,J,nf_calc)) + Enddo + Enddo + Endif + end Subroutine GR_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of time displaced Greens function G0T and GT0 +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] GT0, G0T, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> \endverbatim +!------------------------------------------------------------------- + Subroutine GRT_reconstruction(GT0, G0T) + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GT0(Ndim,Ndim,N_FL), G0T(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Latt%N + Do I = 1,Latt%N + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + G0T(I,J,nf_reconst) = -X*conjg(GT0(J,I,nf_calc)) + GT0(I,J,nf_reconst) = -X*conjg(G0T(J,I,nf_calc)) + enddo + enddo + else + Do J = 1,Latt%N + Do I = 1,Latt%N + G0T(I,J,nf_reconst) = conjg(G0T(I,J,nf_calc)) + GT0(I,J,nf_reconst) = conjg(GT0(I,J,nf_calc)) + enddo + enddo + endif + end Subroutine GRT_reconstruction + + end submodule ham_Hubbard_Plain_Vanilla_smod diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original new file mode 100644 index 0000000..a7c7563 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original @@ -0,0 +1,851 @@ +! Copyright (C) 2016 - 2020 The ALF project +! +! The ALF project is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! The ALF project is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with ALF. If not, see http://www.gnu.org/licenses/. +! +! Under Section 7 of GPL version 3 we require you to fulfill the following additional terms: +! +! - It is our hope that this program makes a contribution to the scientific community. Being +! part of that community we feel that it is reasonable to require you to give an attribution +! back to the original authors if you have benefitted from this program. +! Guidelines for a proper citation can be found on the project's homepage +! http://alf.physik.uni-wuerzburg.de +! +! - We require the preservation of the above copyright notice and this license in all original files. +! +! - We prohibit the misrepresentation of the origin of the original source files. To obtain +! the original source files please visit the homepage http://alf.physik.uni-wuerzburg.de . +! +! - If you make substantial changes to the program we require you to either consider contributing +! to the ALF project or to mark your material in a reasonable way as different from the original version + + +!-------------------------------------------------------------------- +!> @author +!> ALF-project +!> +!> @brief +!> This module defines the Hamiltonian and observables. Here, we have included a +!> set of predefined Hamiltonians. They include the Hubbard and SU(N) tV models +!> on honeycomb, pi-flux and square lattices. + +!> @details +!> The public variables of this module are the following +!> +!> +!> @param [public] OP_V +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> List of operators of type=1,2 and 3 describing the sequence of interactions on a time slice. +!> The first index runs over this sequence. The second corresponds to the flavor index. \endverbatim +!> +!> @param [public] OP_T +!> \verbatim +!> Type (Operator), dimension(:,:), allocatable +!> Sequence of operators accounting for the hopping on a time slice. This can include various +!> checkerboard decompositions. The first index runs over this sequence. The second corresponds to +!> the flavor index. \endverbatim +!> * The progagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n} \f$. That is +!> first the hopping and then the potential energy. +!> +!>@param [public] WF_L +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Left trial wave function. \endverbatim +!> +!> @param [public] WF_R +!> \verbatim Type (WaveFunction), dimension(:), allocatable +!> Right trial wave function. For both wave functions the index runs over the flavor index. \endverbatim +!> +!> @param [public] nsigma +!> \verbatim Type(Fields) +!> Contains all auxiliary fields in the variable f(:,:). The first index runs through the operator +!> sequence. The second through the time slices. \endverbatim +! +!> @param [public] Ndim +!> \verbatim Integer +!> Total number of orbitals. e.g. # unit cells * # orbitals per unit cell. \endverbatim +! +!> @param [public] N_FL +!> \verbatim Integer +!> # of flavors. Propagation is block diagonal in flavors. \endverbatim +! +!> @param [public] N_SUN +!> \verbatim Integer +!> # of colors. Propagation is color independent. \endverbatim +!> +!> @param [public] Ltrot +!> \verbatim Integer +!> Available measurment interval in units of Delta Tau. \endverbatim +!> +!> @param [public] Thtrot +!> \verbatim Integer +!> Effective projection parameter in units of Delta Tau. (Only relevant if projective option is turned on) \endverbatim +!> +!> @param [public] Projector +!> \verbatim Logical +!> Flag for projector. If true then the total number of time slices will correspond to Ltrot + 2*Thtrot \endverbatim +!> +!> @param [public] Group_Comm +!> \verbatim Integer +!> Defines MPI communicator \endverbatim +! +!> @param [public] Symm +!> \verbatim Logical \endverbatim +!> If set to true then the green functions will be symmetrized +!> before being sent to the Obser, ObserT subroutines. +!> In particular, the transformation, \f$ \tilde{G} = e^{-\Delta \tau T /2 } G e^{\Delta \tau T /2 } \f$ +!> will be carried out and \f$ \tilde{G} \f$ will be sent to the Obser and ObserT subroutines. Note that +!> if you want to use this feature, then you have to be sure the hopping and interaction terms are decomposed +!> symmetrically. If Symm is true, the propagation reads: +!> \f$ \prod_{\tau} \; \; \prod_{n=N_T}^{1}e^{T_n/2} \prod_{n=1}^{N_V}e^{V_n(\tau)} \prod_{n=1}^{N_T}e^{T_n/2} \f$ +!> +!> +!> You still have to add some docu for the other private variables in this module. +!> +!-------------------------------------------------------------------- + + + submodule (Hamiltonian_main) ham_Hubbard_Plain_Vanilla_smod + + Use Operator_mod + Use WaveFunction_mod + Use Lattices_v3 + Use MyMats + Use Random_Wrap + Use Files_mod + Use Matrix + Use Observables + Use Fields_mod + Use Predefined_Hoppings + Use LRC_Mod + use runtime_error_mod + + + Implicit none + + type, extends(ham_base) :: ham_Hubbard_Plain_Vanilla + contains + ! Set Hamiltonian-specific procedures + procedure, nopass :: Ham_Set + procedure, nopass :: Alloc_obs + procedure, nopass :: Obser + procedure, nopass :: ObserT + procedure, nopass :: weight_reconstruction + procedure, nopass :: GR_reconstruction + procedure, nopass :: GRT_reconstruction +#ifdef HDF5 + procedure, nopass :: write_parameters_hdf5 +#endif + end type ham_Hubbard_Plain_Vanilla + + !#PARAMETERS START# VAR_lattice + Character (len=64) :: Model = '' ! Value irrelevant + Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square' + Integer :: L1 = 6 ! Length in direction a_1 + Integer :: L2 = 6 ! Length in direction a_2 + !#PARAMETERS END# + + !#PARAMETERS START# VAR_Hubbard_Plain_Vanilla + real(Kind=Kind(0.d0)) :: ham_T = 1.d0 ! Hopping parameter + real(Kind=Kind(0.d0)) :: Ham_chem = 0.d0 ! Chemical potential + real(Kind=Kind(0.d0)) :: Ham_U = 4.d0 ! Hubbard interaction + real(Kind=Kind(0.d0)) :: Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau + real(Kind=Kind(0.d0)) :: Beta = 5.d0 ! Inverse temperature + !logical :: Projector= .false. ! Whether the projective algorithm is used + real(Kind=Kind(0.d0)) :: Theta = 10.d0 ! Projection parameter + !logical :: Symm = .true. ! Whether symmetrization takes place + Integer :: N_part = -1 ! Number of particles in trial wave function. If N_part < 0 -> N_part = L1*L2/2 + !#PARAMETERS END# + + Type (Lattice), target :: Latt + Type (Unit_cell), target :: Latt_unit + INTEGER :: nf_calc, nf_reconst + + contains + + module Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + allocate(ham_Hubbard_Plain_Vanilla::ham) + end Subroutine Ham_Alloc_Hubbard_Plain_Vanilla + +! Dynamically generated on compile time from parameters list. +! Supplies the subroutines read_parameters and write_parameters_hdf5. +#include "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hamiltonian +!-------------------------------------------------------------------- + Subroutine Ham_Set + +#if defined (MPI) || defined(TEMPERING) + Use mpi +#endif + Implicit none + + integer :: ierr, nf, unit_info + Character (len=64) :: file_info + + + +#ifdef MPI + Integer :: Isize, Irank, irank_g, isize_g, igroup + Integer :: STATUS(MPI_STATUS_SIZE) + CALL MPI_COMM_SIZE(MPI_COMM_WORLD,ISIZE,IERR) + CALL MPI_COMM_RANK(MPI_COMM_WORLD,IRANK,IERR) + call MPI_Comm_rank(Group_Comm, irank_g, ierr) + call MPI_Comm_size(Group_Comm, isize_g, ierr) + igroup = irank/isize_g +#endif + + ! From dynamically generated file "Hamiltonian_Hubbard_Plain_Vanilla_read_write_parameters.F90" + call read_parameters() + + + If (L1 == 1) then + Write(6,*) 'For one-dimensional lattices set L2=1' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + endif + + if (N_part < 0) N_part = L1*L2/2 + Ltrot = nint(beta/dtau) + Thtrot = 0 + if (Projector) Thtrot = nint(theta/dtau) + Ltrot = Ltrot+2*Thtrot + N_SUN = 1 + N_FL = 2 + + ! Setup the Bravais lattice + Call Ham_Latt + + ! Setup the hopping / single-particle part + Call Ham_Hop + + ! Setup the interaction. + call Ham_V + + ! Setup the trival wave function, in case of a projector approach + if (Projector) Call Ham_Trial() + +#ifdef MPI + If (Irank_g == 0) then +#endif + File_info = "info" +#if defined(TEMPERING) + write(File_info,'(A,I0,A)') "Temp_",igroup,"/info" +#endif + + Open(newunit=unit_info, file=file_info, status="unknown", position="append") + Write(unit_info,*) '=====================================' + Write(unit_info,*) 'Model is : Hubbard_Plain_Vanilla' + Write(unit_info,*) 'Lattice is : ', Lattice_type + Write(unit_info,*) 'L1 : ', L1 + Write(unit_info,*) 'L2 : ', L2 + Write(unit_info,*) '# of orbitals : ', Ndim + Write(unit_info,*) 'Symm. decomp : ', Symm + if (Projector) then + Write(unit_info,*) 'Projective version' + Write(unit_info,*) 'Theta : ', Theta + Write(unit_info,*) 'Tau_max : ', beta + Write(unit_info,*) '# of particles: ', N_part + else + Write(unit_info,*) 'Finite temperture version' + Write(unit_info,*) 'Beta : ', Beta + endif + Write(unit_info,*) 'dtau,Ltrot_eff: ', dtau,Ltrot + Write(unit_info,*) 't : ', Ham_T + Write(unit_info,*) 'Ham_U : ', Ham_U + Write(unit_info,*) 'Ham_chem : ', Ham_chem + If ( Ham_U >=0.d0 .and. Ham_chem == 0.d0 ) then + Write(unit_info,*) 'Assuming particle hole symmetry' + endif + If ( Ham_U < 0.d0 ) then + Write(unit_info,*) 'Assuming time reversal symmetry' + endif + if (Projector) then + Do nf = 1,N_FL + Write(unit_info,*) 'Degen of right trial wave function: ', WF_R(nf)%Degen + Write(unit_info,*) 'Degen of left trial wave function: ', WF_L(nf)%Degen + enddo + endif + Close(unit_info) +#ifdef MPI + Endif +#endif + + ! Particle-hole symmetry for repulsive U only if chemical potential vanishes + ! Time reversal symmetry for attractive U + If ( (Ham_U >= 0.d0 .and. Ham_chem == 0.d0) .or. Ham_U < 0.d0 ) then + allocate(Calc_Fl(N_FL)) + nf_calc=2 + nf_reconst=1 + Calc_Fl(nf_calc)=.True. + Calc_Fl(nf_reconst)=.False. + endif + + + End Subroutine Ham_Set + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Lattice +!-------------------------------------------------------------------- + Subroutine Ham_Latt + + + Implicit none + Real (Kind=Kind(0.d0)) :: a1_p(2), a2_p(2), L1_p(2), L2_p(2) + + If (Lattice_Type /= "Square") then + Write(6,*) 'The plain vanilla Hubbard model is only defined for the square lattice' + Call Terminate_on_error(ERROR_HAMILTONIAN,__FILE__,__LINE__) + Endif + + Latt_unit%Norb = 1 + Latt_unit%N_coord = 2 + allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2)) + Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0] + + a1_p(1) = 1.0 ; a1_p(2) = 0.d0 + a2_p(1) = 0.0 ; a2_p(2) = 1.d0 + L1_p = dble(L1)*a1_p + L2_p = dble(L2)*a2_p + Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt ) + + Ndim = Latt%N*Latt_unit%Norb + + end Subroutine Ham_Latt +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the Hopping +!-------------------------------------------------------------------- + Subroutine Ham_Hop + + Implicit none + + Integer :: nf , I, Ix, Iy + allocate(Op_T(1,N_FL)) + do nf = 1,N_FL + Call Op_make(Op_T(1,nf),Ndim) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + If ( L2 > 1 ) then + Iy = Latt%nnlist(I,0,1) + Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T, 0.d0, kind(0.D0)) + endif + Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0)) + Op_T(1,nf)%P(i) = i + Enddo + Op_T(1,nf)%g = -Dtau + Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0)) + Call Op_set(Op_T(1,nf)) + enddo + + + end Subroutine Ham_Hop +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the trial wave function +!-------------------------------------------------------------------- + Subroutine Ham_Trial() + + Use Predefined_Trial + + Implicit none + + Integer :: nf, Ix, Iy, I, n + Real (Kind=Kind(0.d0)), allocatable :: H0(:,:), U0(:,:), E0(:) + Real (Kind=Kind(0.d0)) :: Pi = acos(-1.d0), Delta = 0.01d0 + + Allocate(WF_L(N_FL),WF_R(N_FL)) + do nf=1,N_FL + Call WF_alloc(WF_L(nf),Ndim,N_part) + Call WF_alloc(WF_R(nf),Ndim,N_part) + enddo + + + Allocate(H0(Ndim,Ndim), U0(Ndim, Ndim), E0(Ndim) ) + H0 = 0.d0; U0 = 0.d0; E0=0.d0 + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + H0(I, Ix) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + H0(Ix, I ) = -Ham_T*(1.d0 + Delta*cos(Pi*real(Latt%list(I,1) + Latt%list(I,2),Kind(0.d0)))) + If (L2 > 1 ) Then + Iy = Latt%nnlist(I,0,1) + H0(I, Iy) = -Ham_T *(1.d0 - Delta) + H0(Iy, I ) = -Ham_T *(1.d0 - Delta) + Endif + Enddo + Call Diag(H0,U0,E0) +!!$ Do I = 1,Ndim +!!$ Write(6,*) I,E0(I) +!!$ Enddo + Do nf = 1,N_FL + do n=1,N_part + do I=1,Ndim + WF_L(nf)%P(I,n)=U0(I,n) + WF_R(nf)%P(I,n)=U0(I,n) + enddo + enddo + WF_L(nf)%Degen = E0(N_part+1) - E0(N_part) + WF_R(nf)%Degen = E0(N_part+1) - E0(N_part) + enddo + + Deallocate(H0, U0, E0 ) + + end Subroutine Ham_Trial + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Sets the interaction +!-------------------------------------------------------------------- + Subroutine Ham_V + + Use Predefined_Int + Implicit none + + Integer :: nf, I + Real (Kind=Kind(0.d0)) :: X + + + Allocate(Op_V(Ndim,N_FL)) + + do nf = 1,N_FL + do i = 1, Ndim + Call Op_make(Op_V(i,nf), 1) + enddo + enddo + + Do nf = 1,N_FL + X = 1.d0 + if (nf == 2) X = -1.d0 + Do i = 1,Ndim + Op_V(i,nf)%P(1) = I + Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%g = X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0))) + Op_V(i,nf)%alpha = cmplx(-0.5d0, 0.d0, kind(0.D0)) + Op_V(i,nf)%type = 2 + Call Op_set( Op_V(i,nf) ) + Enddo + Enddo + + + end Subroutine Ham_V + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Specifiy the equal time and time displaced observables +!> @details +!-------------------------------------------------------------------- + Subroutine Alloc_obs(Ltau) + + Implicit none + !> Ltau=1 if time displaced correlations are considered. + Integer, Intent(In) :: Ltau + Integer :: i, N, Nt + Character (len=64) :: Filename + Character (len=2) :: Channel + + + ! Scalar observables + Allocate ( Obs_scal(4) ) + Do I = 1,Size(Obs_scal,1) + select case (I) + case (1) + N = 1; Filename ="Kin" + case (2) + N = 1; Filename ="Pot" + case (3) + N = 1; Filename ="Part" + case (4) + N = 1; Filename ="Ener" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Call Obser_Vec_make(Obs_scal(I),N,Filename) + enddo + + ! Equal time correlators + Allocate ( Obs_eq(5) ) + Do I = 1,Size(Obs_eq,1) + select case (I) + case (1) + Filename = "Green" + case (2) + Filename = "SpinZ" + case (3) + Filename = "SpinXY" + case (4) + Filename = "SpinT" + case (5) + Filename = "Den" + case default + Write(6,*) "Error in Alloc_obs" + end select + Nt = 1 + Channel = "--" + Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + + If (Ltau == 1) then + ! time-displaced correlators + Allocate ( Obs_tau(5) ) + Do I = 1,Size(Obs_tau,1) + select case (I) + case (1) + Channel = 'P' ; Filename = "Green" + case (2) + Channel = 'PH'; Filename = "SpinZ" + case (3) + Channel = 'PH'; Filename = "SpinXY" + case (4) + Channel = 'PH'; Filename = "SpinT" + case (5) + Channel = 'PH'; Filename = "Den" + case default + Write(6,*) ' Error in Alloc_obs ' + end select + Nt = Ltrot+1-2*Thtrot + If(Projector) Channel = 'T0' + Call Obser_Latt_make(Obs_tau(I), Nt, Filename, Latt, Latt_unit, Channel, dtau) + enddo + endif + + End Subroutine Alloc_obs + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes equal time observables +!> @details +!> @param [IN] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!> @param [IN] Ntau Integer +!> \verbatim +!> Time slice +!> \endverbatim +!------------------------------------------------------------------- + subroutine Obser(GR,Phase,Ntau, Mc_step_weight) + + Use Predefined_Obs + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GR(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), Intent(IN) :: PHASE + Integer, INTENT(IN) :: Ntau + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Local + Complex (Kind=Kind(0.d0)) :: GRC(Ndim,Ndim,N_FL), ZK + Complex (Kind=Kind(0.d0)) :: Zrho, Zkin, ZPot, Z, ZP,ZS, ZZ, ZXY, ZDen + Integer :: I,J, imj, nf, Ix, Iy + Real (Kind=Kind(0.d0)) :: X + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + + ZS = ZS*Mc_step_weight + + + + Do nf = 1,N_FL + Do I = 1,Ndim + Do J = 1,Ndim + GRC(I, J, nf) = -GR(J, I, nf) + Enddo + GRC(I, I, nf) = 1.D0 + GRC(I, I, nf) + Enddo + Enddo + ! GRC(i,j,nf) = < c^{dagger}_{i,nf } c_{j,nf } > + + ! Compute scalar observables. + Do I = 1,Size(Obs_scal,1) + Obs_scal(I)%N = Obs_scal(I)%N + 1 + Obs_scal(I)%Ave_sign = Obs_scal(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + + Zkin = cmplx(0.d0, 0.d0, kind(0.D0)) + Zkin = Zkin* dble(N_SUN) + Do I = 1,Latt%N + Ix = Latt%nnlist(I,1,0) + Zkin = Zkin + GRC(I,Ix,1) + GRC(Ix,I,1) & + & + GRC(I,Ix,2) + GRC(Ix,I,2) + Enddo + If (L2 > 1) then + Do I = 1,Latt%N + Iy = Latt%nnlist(I,0,1) + Zkin = Zkin + GRC(I,Iy,2) + GRC(Iy,I,2) & + & + GRC(I,Iy,1) + GRC(Iy,I,1) + Enddo + Endif + Zkin = Zkin*cmplx(-Ham_T,0.d0,Kind(0.d0)) + Obs_scal(1)%Obs_vec(1) = Obs_scal(1)%Obs_vec(1) + Zkin *ZP* ZS + + + ZPot = cmplx(0.d0, 0.d0, kind(0.D0)) + Do I = 1,Ndim + ZPot = ZPot + Grc(i,i,1) * Grc(i,i, 2) + Enddo + Zpot = Zpot*ham_U + Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + Zpot * ZP*ZS + + + Zrho = cmplx(0.d0,0.d0, kind(0.D0)) + Do I = 1,Ndim + Zrho = Zrho + Grc(i,i,1) + Grc(i,i,2) + enddo + Obs_scal(3)%Obs_vec(1) = Obs_scal(3)%Obs_vec(1) + Zrho * ZP*ZS + Obs_scal(4)%Obs_vec(1) = Obs_scal(4)%Obs_vec(1) + (Zkin + Zpot)*ZP*ZS + + Do I = 1,Size(Obs_eq,1) + Obs_eq(I)%N = Obs_eq(I)%N + 1 + Obs_eq(I)%Ave_sign = Obs_eq(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + ZXY = GRC(I,J,1) * GR(I,J,2) + GRC(I,J,2) * GR(I,J,1) + ZZ = GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + & + (GRC(I,I,2) - GRC(I,I,1))*(GRC(J,J,2) - GRC(J,J,1)) + + ZDen = (GRC(I,I,1) + GRC(I,I,2)) * (GRC(J,J,1) + GRC(J,J,2)) + & + & GRC(I,J,1) * GR(I,J,1) + GRC(I,J,2) * GR(I,J,2) + + Obs_eq(1)%Obs_Latt(imj,1,1,1) = Obs_eq(1)%Obs_Latt(imj,1,1,1) + (GRC(I,J,1) + GRC(I,J,2))*ZP*ZS + Obs_eq(2)%Obs_Latt(imj,1,1,1) = Obs_eq(2)%Obs_Latt(imj,1,1,1) + ZZ *ZP*ZS + Obs_eq(3)%Obs_Latt(imj,1,1,1) = Obs_eq(3)%Obs_Latt(imj,1,1,1) + ZXY *ZP*ZS + Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_eq(5)%Obs_Latt(imj,1,1,1) = Obs_eq(5)%Obs_Latt(imj,1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_eq(5)%Obs_Latt0(1) = Obs_eq(5)%Obs_Latt0(1) + (GRC(I,I,1) + GRC(I,I,2)) * ZP*ZS + enddo + + + + + end Subroutine Obser +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Computes time displaced observables +!> @details +!> @param [IN] NT, Integer +!> \verbatim +!> Imaginary time +!> \endverbatim +!> @param [IN] GT0, GTT, G00, GTT, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> G00(I,J,nf) = +!> GTT(I,J,nf) = +!> \endverbatim +!> @param [IN] Phase Complex +!> \verbatim +!> Phase +!> \endverbatim +!------------------------------------------------------------------- + Subroutine ObserT(NT, GT0,G0T,G00,GTT, PHASE, Mc_step_weight ) + + Use Predefined_Obs + + Implicit none + + Integer , INTENT(IN) :: NT + Complex (Kind=Kind(0.d0)), INTENT(IN) :: GT0(Ndim,Ndim,N_FL),G0T(Ndim,Ndim,N_FL),G00(Ndim,Ndim,N_FL),GTT(Ndim,Ndim,N_FL) + Complex (Kind=Kind(0.d0)), INTENT(IN) :: Phase + Real (Kind=Kind(0.d0)), INTENT(IN) :: Mc_step_weight + + !Locals + Complex (Kind=Kind(0.d0)) :: Z, ZP, ZS, ZZ, ZXY, ZDEN + Real (Kind=Kind(0.d0)) :: X + Integer :: IMJ, I, J, I1, J1, no_I, no_J + + ZP = PHASE/Real(Phase, kind(0.D0)) + ZS = Real(Phase, kind(0.D0))/Abs(Real(Phase, kind(0.D0))) + ZS = ZS*Mc_step_weight + + If (NT == 0 ) then + Do I = 1,Size(Obs_tau,1) + Obs_tau(I)%N = Obs_tau(I)%N + 1 + Obs_tau(I)%Ave_sign = Obs_tau(I)%Ave_sign + Real(ZS,kind(0.d0)) + Enddo + Endif + Do I = 1,Latt%N + Do J = 1,Latt%N + imj = latt%imj(I,J) + + ZZ = (GTT(I,I,1) - GTT(I,I,2) ) * ( G00(J,J,1) - G00(J,J,2) ) & + & - G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + ZXY = - G0T(J,I,1) * GT0(I,J,2) - G0T(J,I,2) * GT0(I,J,1) + + + ZDen = (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2) ) * & + & (cmplx(2.d0,0.d0,kind(0.d0)) - G00(J,J,1) - G00(J,J,2) ) & + & -G0T(J,I,1) * GT0(I,J,1) - G0T(J,I,2) * GT0(I,J,2) + + Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(1)%Obs_Latt(imj,NT+1,1,1) + (GT0(I,J,1) + GT0(I,J,2))*ZP*ZS + Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(2)%Obs_Latt(imj,NT+1,1,1) + ZZ *ZP*ZS + Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(3)%Obs_Latt(imj,NT+1,1,1) + ZXY *ZP*ZS + Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(4)%Obs_Latt(imj,NT+1,1,1) + (2.d0*ZXY + ZZ)*ZP*ZS/3.d0 + Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) = Obs_tau(5)%Obs_Latt(imj,NT+1,1,1) + ZDen * ZP * ZS + + + enddo + Obs_tau(5)%Obs_Latt0(1) = Obs_tau(5)%Obs_Latt0(1) + & + & (cmplx(2.d0,0.d0,kind(0.d0)) - GTT(I,I,1) - GTT(I,I,2)) * ZP*ZS + enddo + + + + end Subroutine OBSERT + +!-------------------------------------------------------------------- +!> @brief +!> Reconstructs dependent flavors of the configuration's weight. +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!-------------------------------------------------------------------- + subroutine weight_reconstruction(weight) + implicit none + complex (Kind=Kind(0.d0)), Intent(inout) :: weight(:) + + weight(nf_reconst) = conjg(Weight(nf_calc)) + + end subroutine weight_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of equal time Greens function +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] Gr Complex(:,:,:) +!> \verbatim +!> Green function: Gr(I,J,nf) = on time slice ntau +!> \endverbatim +!------------------------------------------------------------------- + subroutine GR_reconstruction(GR) + + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GR(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Ndim + Do I = 1,Ndim + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + ! write(*,*) Latt%list(I,:),Latt%list(J,:),mod(Latt%list(imj,1)+Latt%list(imj,2),2), X + ZZ=0.d0 + if (I==J) ZZ=1.d0 + GR(I,J,nf_reconst) = ZZ - X*GR(J,I,nf_calc) + Enddo + Enddo + else + Do J = 1,Ndim + Do I = 1,Ndim + GR(I,J,nf_reconst) = Conjg(GR(I,J,nf_calc)) + Enddo + Enddo + Endif + end Subroutine GR_reconstruction + + +!-------------------------------------------------------------------- +!> @author +!> ALF Collaboration +!> +!> @brief +!> Reconstructs dependent flavors of time displaced Greens function G0T and GT0 +!> @details +!> This has to be overloaded in the Hamiltonian submodule. +!> @param [INOUT] GT0, G0T, Complex(:,:,:) +!> \verbatim +!> Green functions: +!> GT0(I,J,nf) = +!> G0T(I,J,nf) = +!> \endverbatim +!------------------------------------------------------------------- + Subroutine GRT_reconstruction(GT0, G0T) + Implicit none + + Complex (Kind=Kind(0.d0)), INTENT(INOUT) :: GT0(Ndim,Ndim,N_FL), G0T(Ndim,Ndim,N_FL) + Integer :: I,J,imj + real (kind=kind(0.d0)) :: X, ZZ + + If (Ham_U >= 0.d0) then + Do J = 1,Latt%N + Do I = 1,Latt%N + X=-1.0 + imj = latt%imj(I,J) + if (mod(Latt%list(imj,1)+Latt%list(imj,2),2)==0) X=1.d0 + G0T(I,J,nf_reconst) = -X*conjg(GT0(J,I,nf_calc)) + GT0(I,J,nf_reconst) = -X*conjg(G0T(J,I,nf_calc)) + enddo + enddo + else + Do J = 1,Latt%N + Do I = 1,Latt%N + G0T(I,J,nf_reconst) = conjg(G0T(I,J,nf_calc)) + GT0(I,J,nf_reconst) = conjg(GT0(I,J,nf_calc)) + enddo + enddo + endif + end Subroutine GRT_reconstruction + + end submodule ham_Hubbard_Plain_Vanilla_smod diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/README.txt b/jupyterbook/source/08-fortran/Solutions/Exercise_3/README.txt new file mode 100644 index 0000000..06114c2 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/README.txt @@ -0,0 +1,4 @@ +This directory contains: + +- Reference solution files for Exercise3, "Defining a new observable", of Part II from the ALF Tutorial: modified (and original) Hamiltonian submodule, Start folder. + diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/analysis.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/analysis.sh new file mode 100755 index 0000000..a22f06f --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/analysis.sh @@ -0,0 +1,62 @@ +export ANNAL=${ALF_DIR}"/Analysis/" + +for filename in *_scal; do + echo $filename + export filename1=$filename"J" +# if [ "$filename1" -ot "$filename" ]; then + cp $filename Var_scal + $ANNAL/cov_scal.out + mv "Var_scalJ" $filename"J" + for filename2 in Var_scal_Auto_*; do + if [ -e "${filename2}" ]; then + NewName=`echo ${filename2} | sed s/Var_scal/${filename}/` + mv $filename2 $NewName + fi + done + rm Var_scal +# fi +done + +for filename in *_eq; do + echo $filename + export filename1=$filename"J" +# if [ "$filename1" -ot "$filename" ]; then + ln $filename ineq + $ANNAL/cov_eq.out + mv "equalJ" $filename"JK" + mv "equalJR" $filename"JR" + for filename2 in Var_eq_Auto_Tr*; do + if [ -e "${filename2}" ]; then + NewName=`echo ${filename2} | sed s/Var_eq/${filename}/` + mv $filename2 $NewName + fi + done + rm ineq +# fi +done + + +for filename in *_tau; do + echo $filename + ln $filename intau + if [ "$filename" = "Green_tau" ]; then + $ANNAL/cov_tau.out + else + $ANNAL/cov_tau_ph.out + fi + rm intau + mv SuscepJ $filename"JK" + for filename1 in g_*; do + echo $filename1 + export Name=`echo ${filename} | sed s/_tau//` + export Dir=`echo ${filename1} | sed s/g_/${Name}_/` + echo $Dir + if [ ! -e $Dir ]; then + mkdir $Dir + fi + cd $Dir + mv ../$filename1 . + cd .. + done +done + diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/job.sh b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/job.sh new file mode 100644 index 0000000..1c771d1 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/job.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# The following jobscript contains a few 'variables' marked by the ##...## pattern. +# The user has to provide the appropriate values, e.g. replace ##Nnodes## by 1 if the job is supposed to run on a single node. +# Most variables are selfexplaning, one exceptions might be Nthreads, which is refering to the number of OpenMP threads per MPI task. +# Useful configurations on SuperMUC-NG (48 cores) for Nthreads are 1,2,4,6,12,24 and NtaskPnode = 48/Nthreads +# In general we found that ALF does not profit from hyperthreading such that we suggest to only use physical cores. +# +#SBATCH --job-name DIR_R +#SBATCH --output=out.%j.log +#SBATCH --error=err.%j.log +#Notification and type +#SBATCH --mail-type=ALL +#SBATCH --mail-user=assaad@physik.uni-wuerzburg.de +# Wall clock limit (HH:MM:SS): +#SBATCH --time=48:00:00 +#SBATCH --no-requeue +#Setup of execution environment +#SBATCH --export=NONE +#SBATCH --get-user-env +#SBATCH --account=pr53ju + + +#available partitions: test, micro, general, large, fat +#SBATCH --partition=micro +#SBATCH --nodes=16 +#SBATCH --ntasks-per-node=24 +#SBATCH --cpus-per-task=2 + +#Switch off Energy Aware Runtime for profiling or benchmarking +# #SBATCH --ear=off + +#Important +module load slurm_setup + +module load mpi.intel +module load intel +module load mkl + +cd /hppfs/work/pr53ju/lu57gek5/AF_F_Run/DIR_R +touch RUNNING + +# the follwing eviroment variables generate an optimal pinning (to the best of our knowledge) +# This DOES NOT have to be addepted to the choice of Ntasks +# FIRST EXCEPTION: If you chose to use hyperthreading (not recommended) you should set I_MPI_PIN_CELL=cpu +# SECOND EXCEPTION: The following enviroment variables are Intel specific. +#export KMP_AFFINITY=verbose,granularity=fine,compact +export KMP_AFFINITY=granularity=fine,compact +export I_MPI_PIN_CELL=core +export I_MPI_PIN_DOMAIN=auto:cache +export I_MPI_PIN_ORDER=scatter + +export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK +echo $SLURM_NTASKS $SLURM_CPUS_PER_TASK + +bash ./out_to_in.sh +mpiexec -n $SLURM_NTASKS /dss/dsshome1/05/lu57gek5/AF_F_Code/Prog/AF_F.out + +rm RUNNING diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/parameters b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/parameters new file mode 100644 index 0000000..6a7f156 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/parameters @@ -0,0 +1,156 @@ +!======================================================================================= +! Input variables for a general ALF run +!--------------------------------------------------------------------------------------- +&VAR_ham_name +ham_name = "Hubbard_Plain_Vanilla" +/ + +&VAR_lattice !! Parameters defining the specific lattice and base model +L1 = 6 ! Length in direction a_1 +L2 = 6 ! Length in direction a_2 +Lattice_type = "Square" ! Sets a_1 = (1,0), a_2=(0,1), Norb=1, N_coord=2 +Model = "Hubbard_Plain_Vanilla" ! Sets the Hubbard Plain Vanilla model +/ + +&VAR_Model_Generic !! Common model parameters +Checkerboard = .T. ! Whether checkerboard decomposition is used +Symm = .T. ! Whether symmetrization takes place +N_SUN = 2 ! Number of colors +N_FL = 1 ! Number of flavors +Phi_X = 0.d0 ! Twist along the L_1 direction, in units of the flux quanta +Phi_Y = 0.d0 ! Twist along the L_2 direction, in units of the flux quanta +Bulk = .T. ! Twist as a vector potential (.T.), or at the boundary (.F.) +N_Phi = 0 ! Total number of flux quanta traversing the lattice +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 5.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +/ + +&VAR_QMC !! Variables for the QMC run +Nwrap = 10 ! Stabilization. Green functions will be computed from + ! scratch after each time interval Nwrap*Dtau +NSweep = 20 ! Number of sweeps +NBin = 5 ! Number of bins +Ltau = 1 ! 1 to calculate time-displaced Green functions; 0 otherwise +LOBS_ST = 0 ! Start measurements at time slice LOBS_ST +LOBS_EN = 0 ! End measurements at time slice LOBS_EN +CPU_MAX = 0.05 ! Code stops after CPU_MAX hours, if 0 or not + ! specified, the code stops after Nbin bins +Propose_S0 = .F. ! Proposes single spin flip moves with probability exp(-S0) +Global_moves = .F. ! Allows for global moves in space and time +N_Global = 1 ! Number of global moves per sweep +Global_tau_moves = .F. ! Allows for global moves on a single time slice. +N_Global_tau = 1 ! Number of global moves that will be carried out on a + ! single time slice +Nt_sequential_start = 0 ! One can combine sequential and global moves on a time slice +Nt_sequential_end = -1 ! The program then carries out sequential local moves in the + ! range [Nt_sequential_start, Nt_sequential_end] followed by + ! N_Global_tau global moves +Langevin = .F. ! Langevin update +Delta_t_Langevin_HMC=0.1 ! Default time step for Langevin and HMC updates +Max_Force = 5.0 ! Max Force for Langevin +HMC = .F. ! HMC update +Leapfrog_steps = 0 ! Number of leapfrog interations +/ + +&VAR_errors !! Variables for analysis programs +n_skip = 1 ! Number of bins that to be skipped. +N_rebin = 1 ! Rebinning +N_Cov = 0 ! If set to 1 covariance computed for non-equal-time + ! correlation functions +/ + +&VAR_TEMP !! Variables for parallel tempering +N_exchange_steps = 6 ! Number of exchange moves #[see Eq.~\eqref{eq:exchangestep}]# +N_Tempering_frequency = 10 ! The frequency in units of sweeps at which the + ! exchange moves are carried out +mpi_per_parameter_set = 2 ! Number of mpi-processes per parameter set +Tempering_calc_det = .T. ! Specifies whether the fermion weight has to be taken + ! into account while tempering. The default is .true., + ! and it can be set to .F. if the parameters that + ! get varied only enter the Ising action S_0 +/ + +&VAR_Max_Stoch !! Variables for Stochastic Maximum entropy +Ngamma = 400 ! Number of Dirac delta-functions for parametrization +Om_st = -10.d0 ! Frequency range lower bound +Om_en = 10.d0 ! Frequency range upper bound +NDis = 2000 ! Number of boxes for histogram +Nbins = 250 ! Number of bins for Monte Carlo +Nsweeps = 70 ! Number of sweeps per bin +NWarm = 20 ! The Nwarm first bins will be ommitted +N_alpha = 14 ! Number of temperatures +alpha_st = 1.d0 ! Smallest inverse temperature increment for inverse +R = 1.2d0 ! temperature (see above) +Checkpoint = .F. ! Whether to produce dump files, allowing the simulation + ! to be resumed later on +Tolerance = 0.1d0 ! Data points for which the relative error exceeds the + ! tolerance threshold will be omitted. +/ + +&VAR_Hubbard !! Variables for the specific model +Mz = .T. ! When true, sets the M_z-Hubbard model: Nf=2, demands that + ! N_sun is even, HS field couples to the z-component of + ! magnetization; otherwise, HS field couples to the density +Continuous = .F. ! Uses (T: continuous; F: discrete) HS transformation +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_U2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +/ + +&VAR_Hubbard_Plain_Vanilla !! Variables for the specific model +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 20.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +Symm = .T. ! Whether symmetrization takes place +/ + +&VAR_tV !! Variables for the t-V class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_V = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_V2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +ham_Vperp = 1.d0 ! For bilayer systems +/ + +&VAR_Kondo !! Variables for the Kondo class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_Uc = 0.d0 ! Hubbard interaction on c-orbitals Uc +ham_Uf = 2.d0 ! Hubbard interaction on f-orbials Uf +ham_JK = 2.d0 ! Kondo Coupling J +/ + +&VAR_LRC !! Variables for the Long Range Coulomb class +ham_T = 1.0 ! Specifies the hopping and chemical potential +ham_T2 = 1.0 ! For bilayer systems +ham_Tperp = 1.0 ! For bilayer systems +ham_chem = 1.0 ! Chemical potential +ham_U = 4.0 ! On-site interaction +ham_alpha = 0.1 ! Coulomb tail magnitude +Percent_change = 0.1 ! Parameter P +/ + +&VAR_Z2_Matter !! Variables for the Z_2 class +ham_T = 1.0 ! Hopping for fermions +ham_TZ2 = 1.0 ! Hopping for orthogonal fermions +ham_chem = 0.0 ! Chemical potential for fermions +ham_U = 0.0 ! Hubbard for fermions +Ham_J = 1.0 ! Hopping Z2 matter fields +Ham_K = 1.0 ! Plaquette term for gauge fields +Ham_h = 1.0 ! sigma^x-term for matter +Ham_g = 1.0 ! tau^x-term for gauge +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +/ +! slash terminates namelist statement - DO NOT REMOVE diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/parameters-original b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/parameters-original new file mode 100644 index 0000000..64337dd --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/parameters-original @@ -0,0 +1,156 @@ +!======================================================================================= +! Input variables for a general ALF run +!--------------------------------------------------------------------------------------- +&VAR_ham_name +ham_name = "Hubbard" +/ + +&VAR_lattice !! Parameters defining the specific lattice and base model +L1 = 6 ! Length in direction a_1 +L2 = 6 ! Length in direction a_2 +Lattice_type = "Square" ! Sets a_1 = (1,0), a_2=(0,1), Norb=1, N_coord=2 +Model = "Hubbard" ! Sets the Hubbard model, to be specified in &VAR_Hubbard +/ + +&VAR_Model_Generic !! Common model parameters +Checkerboard = .T. ! Whether checkerboard decomposition is used +Symm = .T. ! Whether symmetrization takes place +N_SUN = 2 ! Number of colors +N_FL = 1 ! Number of flavors +Phi_X = 0.d0 ! Twist along the L_1 direction, in units of the flux quanta +Phi_Y = 0.d0 ! Twist along the L_2 direction, in units of the flux quanta +Bulk = .T. ! Twist as a vector potential (.T.), or at the boundary (.F.) +N_Phi = 0 ! Total number of flux quanta traversing the lattice +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 5.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +/ + +&VAR_QMC !! Variables for the QMC run +Nwrap = 10 ! Stabilization. Green functions will be computed from + ! scratch after each time interval Nwrap*Dtau +NSweep = 20 ! Number of sweeps +NBin = 5 ! Number of bins +Ltau = 1 ! 1 to calculate time-displaced Green functions; 0 otherwise +LOBS_ST = 0 ! Start measurements at time slice LOBS_ST +LOBS_EN = 0 ! End measurements at time slice LOBS_EN +CPU_MAX = 0.0 ! Code stops after CPU_MAX hours, if 0 or not + ! specified, the code stops after Nbin bins +Propose_S0 = .F. ! Proposes single spin flip moves with probability exp(-S0) +Global_moves = .F. ! Allows for global moves in space and time +N_Global = 1 ! Number of global moves per sweep +Global_tau_moves = .F. ! Allows for global moves on a single time slice. +N_Global_tau = 1 ! Number of global moves that will be carried out on a + ! single time slice +Nt_sequential_start = 0 ! One can combine sequential and global moves on a time slice +Nt_sequential_end = -1 ! The program then carries out sequential local moves in the + ! range [Nt_sequential_start, Nt_sequential_end] followed by + ! N_Global_tau global moves +Langevin = .F. ! Langevin update +Delta_t_Langevin_HMC=0.1 ! Default time step for Langevin and HMC updates +Max_Force = 5.0 ! Max Force for Langevin +HMC = .F. ! HMC update +Leapfrog_steps = 0 ! Number of leapfrog interations +/ + +&VAR_errors !! Variables for analysis programs +n_skip = 1 ! Number of bins that to be skipped. +N_rebin = 1 ! Rebinning +N_Cov = 0 ! If set to 1 covariance computed for non-equal-time + ! correlation functions +/ + +&VAR_TEMP !! Variables for parallel tempering +N_exchange_steps = 6 ! Number of exchange moves #[see Eq.~\eqref{eq:exchangestep}]# +N_Tempering_frequency = 10 ! The frequency in units of sweeps at which the + ! exchange moves are carried out +mpi_per_parameter_set = 2 ! Number of mpi-processes per parameter set +Tempering_calc_det = .T. ! Specifies whether the fermion weight has to be taken + ! into account while tempering. The default is .true., + ! and it can be set to .F. if the parameters that + ! get varied only enter the Ising action S_0 +/ + +&VAR_Max_Stoch !! Variables for Stochastic Maximum entropy +Ngamma = 400 ! Number of Dirac delta-functions for parametrization +Om_st = -10.d0 ! Frequency range lower bound +Om_en = 10.d0 ! Frequency range upper bound +NDis = 2000 ! Number of boxes for histogram +Nbins = 250 ! Number of bins for Monte Carlo +Nsweeps = 70 ! Number of sweeps per bin +NWarm = 20 ! The Nwarm first bins will be ommitted +N_alpha = 14 ! Number of temperatures +alpha_st = 1.d0 ! Smallest inverse temperature increment for inverse +R = 1.2d0 ! temperature (see above) +Checkpoint = .F. ! Whether to produce dump files, allowing the simulation + ! to be resumed later on +Tolerance = 0.1d0 ! Data points for which the relative error exceeds the + ! tolerance threshold will be omitted. +/ + +&VAR_Hubbard !! Variables for the specific model +Mz = .T. ! When true, sets the M_z-Hubbard model: Nf=2, demands that + ! N_sun is even, HS field couples to the z-component of + ! magnetization; otherwise, HS field couples to the density +Continuous = .F. ! Uses (T: continuous; F: discrete) HS transformation +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_U2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +/ + +&VAR_Hubbard_Plain_Vanilla !! Variables for the specific model +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_U = 4.d0 ! Hubbard interaction +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 5.d0 ! Inverse temperature +Projector = .F. ! Whether the projective algorithm is used +Theta = 10.d0 ! Projection parameter +Symm = .T. ! Whether symmetrization takes place +/ + +&VAR_tV !! Variables for the t-V class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_V = 4.d0 ! Hubbard interaction +ham_T2 = 1.d0 ! For bilayer systems +ham_V2 = 4.d0 ! For bilayer systems +ham_Tperp = 1.d0 ! For bilayer systems +ham_Vperp = 1.d0 ! For bilayer systems +/ + +&VAR_Kondo !! Variables for the Kondo class +ham_T = 1.d0 ! Hopping parameter +ham_chem = 0.d0 ! Chemical potential +ham_Uc = 0.d0 ! Hubbard interaction on c-orbitals Uc +ham_Uf = 2.d0 ! Hubbard interaction on f-orbials Uf +ham_JK = 2.d0 ! Kondo Coupling J +/ + +&VAR_LRC !! Variables for the Long Range Coulomb class +ham_T = 1.0 ! Specifies the hopping and chemical potential +ham_T2 = 1.0 ! For bilayer systems +ham_Tperp = 1.0 ! For bilayer systems +ham_chem = 1.0 ! Chemical potential +ham_U = 4.0 ! On-site interaction +ham_alpha = 0.1 ! Coulomb tail magnitude +Percent_change = 0.1 ! Parameter P +/ + +&VAR_Z2_Matter !! Variables for the Z_2 class +ham_T = 1.0 ! Hopping for fermions +ham_TZ2 = 1.0 ! Hopping for orthogonal fermions +ham_chem = 0.0 ! Chemical potential for fermions +ham_U = 0.0 ! Hubbard for fermions +Ham_J = 1.0 ! Hopping Z2 matter fields +Ham_K = 1.0 ! Plaquette term for gauge fields +Ham_h = 1.0 ! sigma^x-term for matter +Ham_g = 1.0 ! tau^x-term for gauge +Dtau = 0.1d0 ! Thereby Ltrot=Beta/dtau +Beta = 10.d0 ! Inverse temperature +/ +! slash terminates namelist statement - DO NOT REMOVE diff --git a/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/seeds b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/seeds new file mode 100644 index 0000000..8139943 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/Exercise_3/Start/seeds @@ -0,0 +1,2297 @@ + 790789 + 452938 + 1048 + 814342 + 227372 + 538812 + 718356 + 402600 + 483443 + 212397 + 361162 + 448281 + 422328 + 433028 + 200386 + 801224 + 678595 + 729131 + 901235 + 573718 + 513521 + 256820 + 472421 + 917847 + 608058 + 45986 + 652882 + 490334 + 793308 + 433895 + 735999 + 604885 + 718486 + 686278 + 831314 + 72032 + 456393 + 805928 + 563751 + 726475 + 46379 + 528791 + 210334 + 641930 + 974820 + 507563 + 274404 + 33470 + 593079 + 682778 + 497340 + 847369 + 472980 + 841410 + 307776 + 38444 + 699773 + 362961 + 708323 + 534905 + 102605 + 153053 + 599781 + 890690 + 422490 + 764529 + 542867 + 625315 + 417774 + 706040 + 957426 + 251217 + 907106 + 938142 + 759152 + 988594 + 749907 + 556890 + 433810 + 167755 + 764337 + 664929 + 548951 + 318956 + 582768 + 430090 + 703129 + 949752 + 444746 + 331485 + 912628 + 9834 + 927466 + 593097 + 435671 + 43376 + 613738 + 804876 + 34144 + 28879 + 697454 + 731335 + 672817 + 906512 + 526561 + 307637 + 656054 + 792961 + 83526 + 823197 + 202042 + 883765 + 403308 + 292770 + 454504 + 43169 + 928824 + 15047 + 931917 + 81458 + 803917 + 318747 + 414235 + 719810 + 103829 + 496215 + 267105 + 242633 + 3166 + 924509 + 203583 + 837411 + 881369 + 374000 + 483361 + 622050 + 365681 + 504464 + 549477 + 359717 + 311616 + 548672 + 102537 + 861189 + 720929 + 183490 + 612438 + 74693 + 597084 + 588468 + 267578 + 863249 + 738221 + 691935 + 361582 + 469519 + 467630 + 604593 + 117520 + 668146 + 301714 + 240613 + 949621 + 605599 + 555458 + 126224 + 162497 + 327517 + 885405 + 395809 + 87858 + 993552 + 770114 + 975502 + 658733 + 779715 + 928137 + 954276 + 421189 + 468216 + 673486 + 142541 + 983548 + 724813 + 208598 + 818235 + 903107 + 63650 + 854808 + 660421 + 10355 + 499605 + 220317 + 870377 + 170696 + 888130 + 305658 + 480193 + 483661 + 952600 + 546669 + 848861 + 919635 + 999151 + 794956 + 345874 + 394067 + 319028 + 235870 + 222315 + 279196 + 278427 + 243968 + 669453 + 353266 + 95838 + 175984 + 64836 + 187246 + 306890 + 101300 + 405885 + 969047 + 916696 + 469914 + 930988 + 765245 + 239692 + 717906 + 928095 + 220292 + 426988 + 810411 + 730807 + 693245 + 681203 + 722082 + 901977 + 831977 + 158818 + 855066 + 604795 + 584896 + 560012 + 394466 + 161392 + 650169 + 406011 + 601316 + 798924 + 362437 + 3927 + 43044 + 583173 + 17034 + 99107 + 761442 + 539634 + 631705 + 214973 + 378140 + 962118 + 145827 + 680367 + 137568 + 908835 + 57127 + 344396 + 887428 + 885996 + 495899 + 978772 + 996661 + 718904 + 736726 + 367660 + 210920 + 610545 + 147695 + 85019 + 445533 + 387688 + 577119 + 959447 + 515976 + 934471 + 177752 + 226525 + 805839 + 813502 + 668514 + 368659 + 872298 + 74449 + 33703 + 642426 + 989079 + 250132 + 659717 + 293416 + 626931 + 540121 + 909273 + 458576 + 871594 + 181828 + 133124 + 756056 + 779265 + 9101 + 119281 + 562550 + 669572 + 198314 + 979727 + 978138 + 356035 + 201969 + 474640 + 478638 + 314042 + 869780 + 774110 + 255438 + 786316 + 757275 + 657358 + 242851 + 825880 + 621885 + 149453 + 832951 + 276529 + 106538 + 595534 + 277919 + 690802 + 610756 + 172528 + 779890 + 185441 + 349245 + 838364 + 268291 + 234370 + 597991 + 718700 + 864689 + 399157 + 127853 + 931135 + 35133 + 996989 + 825655 + 846931 + 429998 + 706132 + 502785 + 790229 + 411330 + 108909 + 891282 + 174773 + 267688 + 172161 + 827435 + 78122 + 116489 + 665222 + 622875 + 253374 + 493848 + 515383 + 623167 + 578383 + 631930 + 100864 + 953906 + 942476 + 423786 + 481282 + 454310 + 570674 + 75698 + 565617 + 798315 + 785412 + 447026 + 217685 + 803165 + 205754 + 77552 + 299103 + 925511 + 384113 + 902316 + 649762 + 945000 + 880472 + 653971 + 5792 + 835372 + 774101 + 952619 + 855030 + 823053 + 612773 + 83155 + 229993 + 633246 + 799491 + 460116 + 438345 + 923529 + 416696 + 780020 + 730863 + 904946 + 487993 + 861211 + 906910 + 150603 + 677370 + 171202 + 857401 + 591759 + 425912 + 41522 + 45272 + 701420 + 526024 + 570055 + 923449 + 865435 + 133145 + 210888 + 290319 + 941090 + 214974 + 51653 + 582694 + 3198 + 438183 + 778368 + 106285 + 277696 + 492636 + 327787 + 203666 + 262738 + 853111 + 227238 + 359747 + 37287 + 978515 + 621969 + 244739 + 757213 + 948607 + 989992 + 694626 + 338882 + 538213 + 544427 + 629131 + 330252 + 728945 + 323345 + 907187 + 969467 + 658423 + 967111 + 119904 + 430951 + 6990 + 183229 + 321038 + 259000 + 821934 + 898687 + 694962 + 988876 + 779203 + 99796 + 162132 + 955404 + 882627 + 359540 + 922055 + 289062 + 600636 + 52415 + 933763 + 99574 + 440478 + 256776 + 333776 + 847010 + 959938 + 344676 + 791573 + 900371 + 216557 + 259217 + 802561 + 283692 + 654350 + 479387 + 918543 + 609627 + 428026 + 672406 + 915690 + 200550 + 164706 + 33572 + 900002 + 397142 + 163142 + 313603 + 350287 + 54492 + 30436 + 533479 + 98621 + 225684 + 756256 + 386788 + 248320 + 32895 + 224561 + 329570 + 29413 + 725990 + 162813 + 357659 + 591602 + 928608 + 528699 + 471528 + 734737 + 71766 + 334350 + 828633 + 576786 + 14945 + 908058 + 583255 + 159296 + 854688 + 593499 + 413845 + 990372 + 920691 + 886444 + 737870 + 525136 + 959398 + 8985 + 614151 + 583702 + 505097 + 921252 + 332713 + 706645 + 438510 + 770629 + 692123 + 447964 + 732887 + 778475 + 964341 + 605558 + 387603 + 564343 + 547054 + 389188 + 549250 + 907697 + 303530 + 525951 + 820229 + 947134 + 589954 + 303247 + 754846 + 817098 + 970276 + 549246 + 542905 + 722102 + 618553 + 550859 + 880803 + 448449 + 408792 + 909207 + 30119 + 313443 + 692298 + 332587 + 63716 + 552116 + 762512 + 366942 + 299327 + 141443 + 7358 + 63834 + 920653 + 62060 + 749086 + 585904 + 785954 + 997485 + 771617 + 749850 + 424146 + 470835 + 535385 + 506889 + 218392 + 419045 + 79680 + 360729 + 777199 + 204588 + 612497 + 723036 + 493006 + 64692 + 787871 + 206405 + 288283 + 998059 + 670730 + 854828 + 549124 + 89088 + 389231 + 311661 + 246339 + 269585 + 474611 + 925093 + 244049 + 517991 + 888522 + 791119 + 795777 + 496094 + 737884 + 734002 + 228047 + 623251 + 677222 + 224248 + 811473 + 588107 + 998513 + 234069 + 819356 + 297813 + 408530 + 30359 + 773775 + 264743 + 493682 + 905153 + 879183 + 430715 + 872362 + 843607 + 643499 + 428709 + 34791 + 129456 + 686702 + 282088 + 870356 + 887991 + 736927 + 541311 + 882460 + 566523 + 814056 + 858158 + 90864 + 352354 + 600814 + 997445 + 621529 + 528245 + 1359 + 286244 + 983961 + 765383 + 887380 + 500603 + 36055 + 353855 + 31690 + 189761 + 636438 + 370608 + 229317 + 437870 + 984314 + 784929 + 606101 + 63213 + 646806 + 501403 + 114784 + 254924 + 273802 + 340389 + 218608 + 647203 + 295 + 955986 + 762408 + 831038 + 536232 + 691500 + 31201 + 303423 + 943853 + 372418 + 996286 + 854078 + 36870 + 748834 + 389664 + 861146 + 603604 + 120983 + 195504 + 877868 + 477451 + 494433 + 634805 + 147561 + 92294 + 796535 + 285370 + 216596 + 391538 + 683890 + 513823 + 85202 + 246080 + 913443 + 487324 + 797309 + 809773 + 901069 + 622788 + 717893 + 812399 + 467679 + 473605 + 497815 + 790137 + 772801 + 53861 + 726174 + 253531 + 435684 + 600051 + 270141 + 792958 + 843885 + 770301 + 302308 + 121600 + 649367 + 281088 + 15531 + 55907 + 452090 + 981457 + 25273 + 433574 + 671106 + 364740 + 459449 + 968999 + 603153 + 517774 + 735768 + 46264 + 668747 + 507622 + 26578 + 449593 + 845780 + 205790 + 411209 + 31326 + 290607 + 549946 + 715819 + 317389 + 146646 + 243138 + 40734 + 50259 + 540468 + 890514 + 975293 + 669434 + 765394 + 573541 + 500195 + 729405 + 652585 + 861724 + 577338 + 255118 + 129638 + 261821 + 427166 + 34951 + 966678 + 104567 + 493512 + 851175 + 709957 + 868889 + 95939 + 647927 + 802939 + 943628 + 769591 + 636680 + 894902 + 826753 + 292526 + 339208 + 337026 + 762086 + 400570 + 568056 + 865991 + 813514 + 189655 + 344511 + 475068 + 376713 + 205664 + 754067 + 472712 + 128365 + 221775 + 739397 + 728660 + 412876 + 703304 + 830821 + 107520 + 66595 + 960052 + 814273 + 89869 + 679534 + 986143 + 336770 + 580841 + 294585 + 987373 + 449386 + 906228 + 544241 + 596050 + 87711 + 996068 + 224812 + 773341 + 489829 + 755741 + 308145 + 399114 + 551783 + 624563 + 390844 + 549281 + 120540 + 321879 + 580987 + 460643 + 224469 + 780657 + 822345 + 183234 + 241299 + 268583 + 656102 + 920163 + 3596 + 696651 + 420071 + 54961 + 841729 + 115262 + 885418 + 866420 + 564336 + 397812 + 330874 + 930941 + 376298 + 111793 + 54458 + 212377 + 734203 + 577379 + 322696 + 839373 + 139318 + 113524 + 757338 + 570216 + 868055 + 471556 + 159577 + 945174 + 639944 + 456269 + 771769 + 126340 + 223095 + 734519 + 976649 + 424978 + 977175 + 434053 + 516368 + 333869 + 313412 + 655136 + 342142 + 214854 + 160411 + 14088 + 700139 + 387265 + 323346 + 197358 + 521738 + 756667 + 470781 + 90367 + 836710 + 597518 + 922403 + 101729 + 425558 + 721145 + 770116 + 924972 + 159359 + 581205 + 186633 + 737755 + 27113 + 316661 + 921573 + 838584 + 850580 + 732247 + 985053 + 721036 + 686632 + 216434 + 518782 + 585474 + 917088 + 596907 + 854653 + 288268 + 26063 + 933525 + 760839 + 728510 + 64813 + 248795 + 875386 + 672237 + 804075 + 195840 + 327309 + 14150 + 573910 + 663863 + 545179 + 476827 + 791051 + 321126 + 253226 + 747448 + 173746 + 95407 + 654925 + 52012 + 644097 + 591977 + 804094 + 167053 + 917911 + 449066 + 163486 + 868862 + 782037 + 630831 + 350884 + 820205 + 59213 + 657824 + 72694 + 894540 + 260411 + 774965 + 245037 + 937739 + 924678 + 57008 + 302347 + 967303 + 646481 + 451506 + 693461 + 809084 + 790551 + 759288 + 565215 + 171501 + 894227 + 552420 + 633535 + 157262 + 757297 + 29680 + 242034 + 212579 + 219345 + 809520 + 608105 + 513890 + 624596 + 660541 + 256512 + 792075 + 974255 + 169460 + 640487 + 594177 + 766352 + 346575 + 950322 + 982621 + 523091 + 168739 + 109465 + 671928 + 5684 + 59827 + 958109 + 602941 + 116707 + 308701 + 624291 + 954539 + 489932 + 424686 + 82484 + 592856 + 767677 + 430531 + 899689 + 958002 + 565651 + 92885 + 169029 + 388279 + 125294 + 90261 + 630847 + 881902 + 653620 + 118503 + 981293 + 296217 + 350567 + 368425 + 984418 + 123833 + 332960 + 75796 + 869769 + 991226 + 71756 + 393551 + 957321 + 170504 + 720021 + 677023 + 283131 + 856719 + 454802 + 592822 + 300979 + 687065 + 790793 + 552432 + 706591 + 893215 + 248305 + 333304 + 699351 + 141168 + 958730 + 887447 + 681529 + 58597 + 207515 + 337529 + 394991 + 449684 + 914627 + 160462 + 495423 + 197471 + 52524 + 558502 + 564047 + 853700 + 1623 + 17839 + 556841 + 916160 + 843269 + 54694 + 691259 + 793525 + 590203 + 148909 + 770446 + 457705 + 354530 + 865045 + 944962 + 783685 + 453193 + 160972 + 911996 + 576869 + 450932 + 883965 + 552086 + 287925 + 140763 + 454297 + 3340 + 415129 + 461942 + 736331 + 173152 + 594209 + 355430 + 97120 + 687423 + 375685 + 556871 + 652491 + 277278 + 689719 + 327051 + 700648 + 603284 + 998453 + 119875 + 343259 + 517172 + 135857 + 187828 + 294055 + 761053 + 835070 + 124952 + 874920 + 104139 + 943244 + 347308 + 199486 + 916958 + 323889 + 510947 + 544227 + 183076 + 446717 + 867379 + 907052 + 948316 + 664984 + 556544 + 753401 + 207474 + 180334 + 837276 + 949835 + 228541 + 695146 + 255275 + 885132 + 314418 + 752373 + 748575 + 778884 + 2140 + 762888 + 690513 + 177581 + 699588 + 720327 + 870197 + 638217 + 759713 + 603437 + 410477 + 599375 + 992255 + 465912 + 623408 + 439823 + 612956 + 213743 + 803227 + 724611 + 630285 + 70059 + 956815 + 638658 + 669655 + 727472 + 471669 + 607853 + 235139 + 187919 + 721370 + 107645 + 408693 + 290010 + 608552 + 659137 + 986870 + 923864 + 45370 + 12679 + 55045 + 933461 + 371469 + 518965 + 999126 + 706481 + 709454 + 687622 + 954781 + 451650 + 257856 + 933308 + 694148 + 163579 + 521605 + 509305 + 950063 + 275117 + 479994 + 628608 + 177771 + 997184 + 692151 + 772527 + 754149 + 346123 + 340006 + 186774 + 614424 + 858541 + 208762 + 565058 + 326389 + 993649 + 604861 + 920183 + 602128 + 223113 + 211454 + 642635 + 247228 + 808392 + 881370 + 746681 + 547501 + 265584 + 367584 + 303963 + 93203 + 517769 + 991188 + 64586 + 40753 + 734854 + 246855 + 265718 + 811947 + 860916 + 345814 + 627680 + 230686 + 829045 + 696313 + 537542 + 97185 + 463688 + 321591 + 420216 + 199698 + 70494 + 215346 + 297049 + 763736 + 713657 + 634705 + 531917 + 338782 + 180760 + 330690 + 764820 + 122513 + 635116 + 716188 + 32973 + 722520 + 955618 + 971420 + 79403 + 355524 + 764076 + 86912 + 849042 + 484094 + 140064 + 843958 + 172319 + 890868 + 23265 + 732595 + 636254 + 190274 + 303312 + 807068 + 643053 + 777741 + 597133 + 478800 + 656204 + 216427 + 713795 + 246859 + 634063 + 61430 + 806846 + 365931 + 650957 + 121513 + 214163 + 451783 + 705772 + 158317 + 985290 + 24238 + 718049 + 23085 + 96286 + 987636 + 711575 + 230878 + 352069 + 48812 + 185482 + 972292 + 976255 + 72558 + 672834 + 562681 + 888507 + 374592 + 486727 + 328874 + 669376 + 952031 + 653880 + 933391 + 212645 + 651356 + 35726 + 136166 + 65175 + 273883 + 637012 + 993764 + 454245 + 618729 + 101887 + 496098 + 2399 + 463285 + 397500 + 640650 + 129786 + 481179 + 685089 + 944190 + 144010 + 97751 + 378579 + 391994 + 17466 + 283017 + 390677 + 824561 + 852191 + 282141 + 566458 + 761834 + 32202 + 283399 + 304467 + 664919 + 63344 + 23655 + 365310 + 635302 + 100630 + 331324 + 867744 + 551568 + 163088 + 606841 + 472279 + 643623 + 36104 + 240633 + 752261 + 504407 + 861264 + 968587 + 752477 + 539117 + 413698 + 165015 + 735239 + 851925 + 66927 + 73127 + 113985 + 570197 + 445204 + 972999 + 574368 + 606208 + 763355 + 287039 + 382853 + 856369 + 854131 + 622959 + 882808 + 837935 + 883043 + 754242 + 178100 + 763234 + 750711 + 538113 + 4187 + 51379 + 182705 + 771002 + 786713 + 277487 + 506891 + 981522 + 887601 + 559404 + 118273 + 160928 + 38648 + 381916 + 631337 + 431092 + 962616 + 858472 + 719898 + 649970 + 181830 + 430402 + 644437 + 954572 + 14266 + 3636 + 466951 + 241426 + 757152 + 522921 + 953294 + 584554 + 58054 + 983543 + 163021 + 590935 + 473476 + 880543 + 726731 + 693475 + 214951 + 95435 + 810914 + 381480 + 82635 + 220430 + 770291 + 368616 + 586399 + 320147 + 487659 + 698388 + 254427 + 130839 + 401234 + 787100 + 129305 + 697107 + 219499 + 404330 + 451621 + 446121 + 323540 + 590896 + 531049 + 699338 + 856898 + 514322 + 804954 + 621721 + 502907 + 261813 + 84477 + 608456 + 949540 + 570721 + 988133 + 109176 + 41752 + 496509 + 562904 + 889671 + 621325 + 18229 + 92832 + 731118 + 54211 + 581482 + 95114 + 566787 + 445374 + 578892 + 503694 + 56272 + 541138 + 768074 + 40360 + 597201 + 319026 + 627101 + 773333 + 774459 + 265106 + 647473 + 863365 + 246905 + 338837 + 564588 + 497329 + 71591 + 625408 + 525708 + 9318 + 465482 + 675585 + 195431 + 189232 + 4675 + 533054 + 798654 + 778879 + 261113 + 449265 + 101050 + 155561 + 876811 + 285774 + 327028 + 203175 + 75569 + 604090 + 15210 + 370802 + 612195 + 443016 + 811392 + 918803 + 159218 + 783493 + 199019 + 352412 + 131113 + 700946 + 167151 + 42830 + 946017 + 205126 + 815931 + 35816 + 724948 + 767451 + 899554 + 47788 + 428523 + 535858 + 306740 + 649407 + 431176 + 237136 + 478694 + 636681 + 532881 + 766778 + 764586 + 589548 + 408365 + 466323 + 714508 + 617980 + 493833 + 88195 + 309952 + 295569 + 311180 + 448054 + 131775 + 780626 + 229714 + 764634 + 465667 + 124771 + 665376 + 687091 + 345120 + 769028 + 717453 + 9841 + 531900 + 227421 + 242804 + 74912 + 434010 + 958064 + 367572 + 861779 + 961166 + 421758 + 436409 + 764716 + 317758 + 328081 + 399188 + 57631 + 733324 + 68987 + 635228 + 46419 + 130518 + 339894 + 215010 + 908799 + 730576 + 948283 + 599394 + 221659 + 596289 + 809788 + 776342 + 175902 + 112467 + 131790 + 835132 + 478788 + 403914 + 784514 + 978082 + 943779 + 690888 + 859620 + 969762 + 767881 + 582080 + 416296 + 23720 + 496489 + 305072 + 414854 + 126696 + 675730 + 874316 + 837823 + 800342 + 192307 + 196596 + 998541 + 300442 + 300844 + 113998 + 37254 + 253627 + 338728 + 384381 + 604701 + 731599 + 128454 + 599342 + 733218 + 762846 + 67467 + 39691 + 895321 + 281863 + 905507 + 468411 + 249810 + 515867 + 209455 + 861134 + 75357 + 809021 + 515672 + 74109 + 391598 + 884149 + 169845 + 449664 + 767733 + 541955 + 854333 + 359185 + 318614 + 797745 + 803007 + 683576 + 888343 + 455641 + 703595 + 231233 + 421362 + 120304 + 287529 + 93510 + 521049 + 646149 + 607282 + 937689 + 195813 + 24066 + 1218 + 237448 + 792683 + 705640 + 745934 + 440832 + 118408 + 364867 + 396102 + 75719 + 748045 + 97373 + 811814 + 792788 + 521056 + 57135 + 873426 + 345992 + 224902 + 530697 + 883900 + 510524 + 466134 + 448892 + 658652 + 938284 + 728992 + 336057 + 302891 + 950851 + 621491 + 696755 + 676465 + 269951 + 309021 + 839991 + 546204 + 685424 + 135440 + 140934 + 425765 + 660696 + 431665 + 740132 + 102974 + 875744 + 511766 + 680232 + 854672 + 707566 + 856565 + 480203 + 349056 + 648152 + 484723 + 147048 + 235526 + 659949 + 511336 + 625026 + 422024 + 468835 + 894031 + 682371 + 39883 + 794580 + 366558 + 235512 + 96168 + 518823 + 559882 + 110788 + 813521 + 790535 + 310780 + 243669 + 657501 + 68990 + 157934 + 315476 + 51434 + 104235 + 25522 + 827598 + 778751 + 855055 + 94315 + 613209 + 72836 + 344445 + 860270 + 786492 + 394367 + 452578 + 380622 + 129352 + 896160 + 647273 + 707481 + 915640 + 575515 + 651965 + 508921 + 172866 + 114057 + 51172 + 877579 + 381423 + 405082 + 833465 + 326745 + 611304 + 768398 + 871937 + 973958 + 96318 + 852672 + 342170 + 912098 + 245813 + 225271 + 77707 + 767980 + 93893 + 649608 + 863018 + 448451 + 186136 + 49983 + 663968 + 73977 + 903812 + 163932 + 795788 + 99744 + 225606 + 882062 + 28544 + 624248 + 926831 + 275405 + 630105 + 885388 + 216152 + 310252 + 346608 + 944062 + 809801 + 250506 + 320435 + 555259 + 443298 + 747518 + 945674 + 226655 + 820667 + 617434 + 661092 + 464705 + 1158 + 306041 + 680601 + 208235 + 223466 + 41106 + 661230 + 449540 + 167444 + 672223 + 308590 + 42976 + 653330 + 198157 + 919847 + 701050 + 778459 + 981684 + 864188 + 178020 + 491485 + 651941 + 788 + 640986 + 604100 + 694264 + 34284 + 228482 + 240251 + 727533 + 807738 + 796572 + 722859 + 469019 + 533111 + 852442 + 898039 + 386724 + 959228 + 675496 + 896820 + 39227 + 477247 + 625949 + 334358 + 103025 + 163631 + 640918 + 946662 + 87381 + 760613 + 918022 + 664807 + 736665 + 594166 + 786467 + 126658 + 120197 + 429473 + 765648 + 626082 + 409593 + 263893 + 811239 + 499674 + 343607 + 57435 + 748784 + 950970 + 380475 + 400719 + 894798 + 312169 + 537761 + 120452 + 865355 + 743352 + 919698 + 822392 + 572181 + 369198 + 932031 + 371820 + 406253 + 853205 + 184365 + 311506 + 608889 + 409408 + 80005 + 217178 + 830341 + 251598 + 93301 + 990495 + 875893 + 480041 + 734491 + 89510 + 639451 + 405694 + 202046 + 696642 + 224636 + 311930 + 722514 + 824143 + 253381 + 653750 + 577862 + 357069 + 362025 + 694506 + 820321 + 33748 + 884901 + 580116 + 674729 + 363746 + 725438 + 850789 + 628375 + 483339 + 414749 + 390237 + 208344 + 948482 + 357723 + 812398 + 446359 + 465275 + 266628 + 285651 + 31124 + 557933 + 782195 + 794540 + 148173 + 174258 + 282216 + 838990 + 7206 + 228600 + 877638 + 571022 + 56939 + 82333 + 596155 + 368978 + 887444 + 961823 + 753304 + 849238 + 819994 + 313891 + 511058 + 315436 + 184410 + 98790 + 623916 + 645182 + 283898 + 20666 + 372505 + 614277 + 47397 + 695531 + 684664 + 658437 + 369425 + 756733 + 444047 + 72508 + 137417 + 897920 + 986208 + 647183 + 946571 + 853514 + 782201 + 743228 + 502197 + 316675 + 309674 + 803192 + 709551 + 794774 + 111456 + 300633 + 451187 + 402357 + 41660 + 126831 + 51796 + 591620 + 699268 + 415010 + 430553 + 820372 + 49231 + 802058 + 940958 + 157506 + 231060 + 127742 + 898181 + 825969 + 554921 + 571429 + 793907 + 683227 + 685227 + 226304 + 198676 + 639240 + 11734 + 111090 + 351732 + 11923 + 208132 + 619265 + 438361 + 820122 + 978141 + 405782 + 554740 + 14077 + 989104 + 711288 + 360278 + 643395 + 993082 + 123841 + 417459 + 962516 + 135444 + 778130 + 219187 + 473683 + 450966 + 992195 + 903632 + 907411 + 547421 + 341643 + 656569 + 140454 + 476673 + 171367 + 801225 + 51277 + 793271 + 544769 + 575621 + 313020 + 800547 + 630473 + 597419 + 123972 + 984202 + 526547 + 16260 + 875536 + 633405 + 522223 + 353616 + 757698 + 649386 + 797110 + 30123 + 302000 + 541531 + 557920 + 580435 + 862002 + 610970 + 612682 + 555563 + 31256 + 321677 + 382462 + 112717 + 998773 + 859063 + 350583 + 292654 + 841990 + 876066 + 949341 + 984518 + 757244 + 426748 + 884226 + 578188 + 227733 + 87388 + 895641 + 304116 + 128992 + 265074 + 958118 + 260675 + 771858 + 693801 + 917041 + 129004 + 882939 + 118061 + 562860 + 575346 + 522583 + 163935 + 142813 + 340897 + 940348 + 397694 + 310145 + 19147 + 367970 + 571885 + 510824 + 520727 + 749829 + 58931 + 807762 + 225747 + 410924 + 472218 + 142533 + 823646 + 662334 + 474695 + 34593 + 840532 + 344193 + 774966 + 717995 + 854025 + 306158 + 310882 + 715613 + 395604 + 825372 + 620634 + 850857 + 540451 + 961941 + 401352 + 696892 + 184789 + 851896 + 255193 + 463359 + 10732 diff --git a/jupyterbook/source/08-fortran/Solutions/filter_data.sh b/jupyterbook/source/08-fortran/Solutions/filter_data.sh new file mode 100755 index 0000000..5112650 --- /dev/null +++ b/jupyterbook/source/08-fortran/Solutions/filter_data.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# This script filters the output data from ALF's ana.out for facilitating +# plotting the solutions of ALF tutorial + +USAGE="Usage: $0 \n\ +where is generated by ana.out and the script output is _plot.\n\ +This script has not been extensively tested. No warrants.\n" + +if [ "$1" == "-h" -o "$1" == "--help" -o "$#" -lt 1 ] ; then + printf "$USAGE" + exit 0 +fi + +echo "Deleting $1_plot if exists." +rm -f $1"_plot" +echo "Reading $1 and printing some of its lines to $1_plot." +while read x y +do + echo $x $y + if (( $(echo "$x < 0.00" | sed 's/E./*10^/g' | bc -l) )) ; then + read line + else + read o p best err dump + if (( $(echo "$y == 0.00" | sed 's/E./*10^/g' | bc -l) )) ; then + echo $x $best $err >> $1"_plot" + fi + fi +done < $1 diff --git a/jupyterbook/source/08-fortran/dimensional_crossover.md b/jupyterbook/source/08-fortran/dimensional_crossover.md index 8c483ce..1f869f4 100644 --- a/jupyterbook/source/08-fortran/dimensional_crossover.md +++ b/jupyterbook/source/08-fortran/dimensional_crossover.md @@ -5,9 +5,8 @@ Here we will modify the code so as to allow for different hopping matrix element #### Modifying the hopping -To do so we start from the submodule `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90`, which we here shorten to "`Vanilla`", found in `$ALF_DIR/Prog/Hamiltonians/`, proceeding as follows: +To do so we start from the submodule `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90`, found in `$ALF_DIR/Prog/Hamiltonians/`, proceeding as follows: -- Add `Ham_Ty` to the `VAR_Hubbard_Plain_Vanilla` name space in the parameter file `parameters`. - Declare a new variable, `Ham_Ty`, in the module's specification on a new line between `!#PARAMETERS START# VAR_Hubbard_Plain_Vanilla` and the corresponding `!#PARAMETERS END#`. - Modify the hopping matrix in the subroutine `Ham_Hop` in `Vanilla`: @@ -32,9 +31,13 @@ Enddo -It is a good idea as well to get the new simulation parameter written into the file `info`, also a change in `Ham_Set`. +- It is a good idea as well to get the new simulation parameter written into the file `info`, also a change in `Ham_Set`. -In the directory `Solutions/Exercise_1` we have the modified and original submodules, as well as reference data and the necessary `Start` directory (remember to copy its contents to every new `Run` directory, and to have a different `Run` directory for each simulation). +- Add `Ham_Ty` to the `VAR_Hubbard_Plain_Vanilla` name space in the parameter file `parameters`. This can be found in `Scripts_and_Parameters_files/Start`. Also set `ham_name` to `Hubbard_Plain_Vanilla`. The variable `Model` can be left unchanged as it is irrelevant. + +After these changes, one can proceed with the workflow introduced in [Downloading and using the code and tutorial](downloading.md). + + The modified `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90` file can be downloaded from [solution](Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_1a). The corresponding `parameters` can be downloaded from [parameters](Solutions/Exercise_1/Start/parameters). In case something went horribly wrong the original can be downloaded from [original](Solutions/Exercise_1/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Original). As an application of this code, we can once again consider a ladder system (e.g, a 2-leg ladder with `L1=14` and `L2=2`), for different values of `Ham_Ty`. The results you should obtain for the total spin correlation function (file `SpinT_eqJR`) are summarized in [](#fig-ladder). diff --git a/jupyterbook/source/08-fortran/downloading.md b/jupyterbook/source/08-fortran/downloading.md index 96470f9..891307d 100644 --- a/jupyterbook/source/08-fortran/downloading.md +++ b/jupyterbook/source/08-fortran/downloading.md @@ -4,16 +4,11 @@ One can use the ALF package downloaded automatically by the Python script in the first part of this tutorial, or manually, by typing ```bash -git clone https://git.physik.uni-wuerzburg.de/ALF/ALF.git +git clone https://github.com/ALF-QMC/ALF.git ``` -in a shell. Similarly, to download the tutorial, including solutions, enter: - -```bash -git clone https://git.physik.uni-wuerzburg.de/ALF/ALF_Tutorial.git -``` - -This document is found in the directory `Tutorial-ALF-{tutALFver}`. +in a shell. + The necessary environment variables and the directives for compiling the code are set by the script `configure.sh`: @@ -26,7 +21,7 @@ followed by the command `make`. Details and further options are described in the A workflow you can adopt for solving the exercises — or indeed using ALF in general — is the following: 1. Compile the modified Hamiltonian module, for instance: - `make all` + `make` 2. Create a data directory with the content of `Start`: `cp -r ./Scripts_and_Parameters_files/Start ./Run && cd ./Run/` 3. Run its executable, e.g., serially: diff --git a/jupyterbook/source/08-fortran/t_V_Model.md b/jupyterbook/source/08-fortran/t_V_Model.md index 0b83205..5a605d1 100644 --- a/jupyterbook/source/08-fortran/t_V_Model.md +++ b/jupyterbook/source/08-fortran/t_V_Model.md @@ -19,7 +19,7 @@ Note that the t-V model is already implemented in ALF in the module `Hamiltonian #### Define new model -In the directory `Solutions/Exercise_2` we have duplicated the ALF and commented the changes that have to be carried out to the file `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90`, which we here shorten to "`Vanilla`", found in `$ALF_DIR/Prog/Hamiltonians/`. The following are the essential steps to be carried out: +In [solution](Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod.F90-Exercise_2) we have duplicated the ALF and commented the changes that have to be carried out to the file `Hamiltonian_Hubbard_Plain_Vanilla_smod.F90`. The following are the essential steps to be carried out: - Add the `VAR_t_V` name space in the file `parameters` and set the necessary variables — or simply rename the `VAR_Hubbard_Plain_Vanilla` name space to `VAR_t_V` and, within it, `Ham_U` to `Ham_Vint`. (Ignore the name space `VAR_tV`, which is used by the general implementation mentioned above.) - Declare a new variable, `Ham_Vint`, in `Vanilla`'s specification. @@ -58,7 +58,7 @@ Allocate(Op_V(Ndim,N_FL)) - Finally, you have to update the `Obser` and `ObserT` routines for the calculation of equal- and time-displaced correlations. For the `t_V` model you can essentially use the same observables as for the `Hubbard_SU(2)` model in 1D — a step which requires a number of changes with respect to the `Vanilla` base, such as: ```fortran -!!!!! Modifications for Exercise 2 +!!!!! Modifications for Exercise 3 !Zpot = Zpot*ham_U ! Vanilla Zpot = Zpot*Ham_Vint ! t-V !!!!! @@ -96,9 +96,7 @@ Z = cmplx(dble(N_SUN), 0.d0, kind(0.D0)) among other changes — with similar ones in the `ObserT` routine. -All necessary changes are implemented and clearly indicated in the solution provided in `Solutions/Exercise_2/Hamiltonian_Hubbard_Plain_Vanilla_smod-Exercise_2.F90`. - -In the directory `Solutions/Exercise_2` we have the modified and original submodules, as well as reference data and the necessary `Start` directory (remember to copy its contents to every new `Run` directory, and to have a different `Run` directory for each simulation). +[Here](Solutions/Exercise_2/Start/parameters) the modified parameter file can be downloaded. #### Phase transition