From 810a0976a644c8f1dee58e7b6c1a0be8f4e8ce13 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Tue, 20 Sep 2022 16:48:53 +1200 Subject: [PATCH 01/14] added impurity example --- scripts/Impurity-example.jl | 145 ++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 scripts/Impurity-example.jl diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl new file mode 100644 index 000000000..38a89c1e4 --- /dev/null +++ b/scripts/Impurity-example.jl @@ -0,0 +1,145 @@ +# # Example 4: Impurity Yrast States + +# This is an example calculation of the lowest energy eigenstates of a mobile +# impurity coupled with a one-dimensional Bose gas. We will be using MPI parallelisation +# as such calculations are typically expensive. + +# A runnable script for this example is located +# [here](https://github.com/joachimbrand/Rimu.jl/blob/develop/scripts/Impurity-example.jl). +# Run it with `mpirun -np [# of CPUs] julia Impurity-example.jl`. + +# Firstly, we load all needed modules. +# `Rimu` and `Rimu.RMPI` for parallel FCIQMC calculation, and `DataFrames` for output + +using Rimu +using Rimu.RMPI +using DataFrames + +# Firstly, let's define a function for constructing the starting vector based on +# the total momentum of the coupled system `P`, the number of modes `m` and the +# number of non-impurity bosons `n`. The maximum allowed total momentum equals to the total +# number of particles including the impurity, hence `n+1`. Apart from the zero and the maximum +# total momentum states, we will have more than one configurations in the starting vector +# to reflect various possible excitation options based on intuitions in physics. +function init_dv(P,m,n) + aIni = BoseFS2C(BoseFS([n; zeros(Int, m-1)]), BoseFS([1; zeros(Int, m-1)])) + dv = InitiatorDVec(aIni=>1.0;style=IsDynamicSemistochastic()) + empty!(dv) + c = (m+1)÷2 # finding the zero-momentum mode + if P == 0 # zero total momentum + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) + bfs1[c] = n; bfs2[c] = 1 + dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 + elseif P == (n+1) # maximum total momentum + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) + bfs1[c+1] = n; bfs2[c+1] = 1 + dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 + else + # move impurity to c+1 + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) + bfs1[c] = n-(P-1); bfs1[c+1] = P-1; bfs2[c+1] = 1 + dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 + # move bosons to c+1 + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) + bfs1[c] = n-P; bfs1[c+1] = P; bfs2[c] = 1 + dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 + # move impurity to c+P + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) + bfs1[c] = n; bfs2[c+P] = 1 + dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 + # move impurity to c-1 and a boson to c+1 + if (n-1) >= P >(n÷2) + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) + bfs1[c] = n-(P+1); bfs1[c+1] = P+1; bfs2[c-1] = 1 + dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 + end + end + return dv +end + +# Now let's first do some MPI sanity checks and print some information: +mpi_barrier() # optional, use for debugging and sanity checks +@info "After barrier 1" mpi_rank() mpi_size() Threads.nthreads() + +# Now we specify parameters for constructing a two-component Hamiltonian +P = 3 # total momentum +m = 8 # number of modes +na= 4 # number of non-impurity bosons +γ = 0.2 # boson-boson coupling strength, dimensionless quantity +η = 0.5 # impurity-boson coupling strength, dimensionless quantity +T = m^2/2 # normalised hopping strength +U = m*γ*na/(γ*na/(m*π^2) + 1) # converting γ to U +V = m*η*na/(η*na/(m*π^2) + 1) # converting η to V +# Here we use an initial address `aIni` for constructing the Hamiltonian, but +# it will not be used in the starting vector +aIni = BoseFS2C(BoseFS([na; zeros(Int, m-1)]), BoseFS([1; zeros(Int, m-1)])) +ham = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V,dispersion=continuum_dispersion) + +# Here we are constructing a secondary Hamiltonian `ham2` with equal boson-boson and impurity coupling +# strength. We use this Hamiltonian to further generate a batter staring vector. From previous experiences +# calculating impurity problems, this setup can significantly speed up the convergence and help FCIQMC to +# sample the important part of the Hilbert space, especially useful when `η` is very small. +η2 = γ +V2 = m*η2*na/(η2*na/(m*π^2) + 1) +ham2 = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V2,dispersion=continuum_dispersion) + +# Now we can setup the Monte Carlo parameters +steps_warmup = 10_000 # number of QMC steps running with `ham2` +steps_equilibrate = 10_000 # number of QMC steps running with the real `ham` +steps_final = 1_000 # number of QMC steps running with G2 correlators, very slow, be caution! +tw = 1_000 # number of walkers + +# Specifying the shift strategy: +s_strat = DoubleLogUpdateAfterTargetWalkers(targetwalkers = tw) +# We use very small time-step size and high starting value of shift +params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 3_000.0) +# As we only use the secondary Hamiltonian `ham2` to generate a staring vector, we don't have to +# save any data in this stage +r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root()) + +# Wrapping `dv` for MPI: +dv = MPIData(init_dv(P,m,na)) + +# Now we run FCIQMC with `lomc!()` and track the elapsed time. +# Both `df` and `state` will be overwritten late with the "real" data +el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) +@mpi_root @info "Initial fciqmc completed in $(el) seconds." + +# New we are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. +# We save the Monte Carlo data every 1000 steps. +r_strat = ReportToFile( + save_if = is_mpi_root(), + filename = "mpi_df_$(η)_$(P).arrow", + chunk_size = 1000, + return_df = true # change it to `false` when running the real job + ) + +# We will turn on the replica, but without operators for a fast equilibration. +el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica=AllOverlaps(2, nothing), + laststep=(steps_equilibrate+steps_warmup)) +@mpi_root @info "Replica fciqmc completed in $(el2) seconds." + + +# We now at the last stage of the calculation, doing replica FCIQMC with a serious of +# G2 correlators with distance `d` from `0` to `m`. See [`G2Correlator`](@ref). +# Save data every 10 steps as they are slow and you don't want to loose too much data if +# the job stops before finishes. +r_strat = ReportToFile( + save_if = is_mpi_root(), + filename = "mpi_df_g2_$(η)_$(P).arrow", + chunk_size = 10, + return_df = true # change it to `false` when running the real job + ) + +# Setting up a tuple of G2 correlators: +g = Tuple(G2Correlator.(0:m)) + +# Carry over information from the previous stage and set up a new `QMCState`: +new_state = Rimu.QMCState( + state.hamiltonian, state.replicas, Ref(Int(state.maxlength)), + state.m_strat, r_strat, state.s_strat, state.τ_strat, state.threading, state.post_step, AllOverlaps(2, g) + ) +# The final stage +el3 = @elapsed df2, state2 = lomc!(new_state;laststep=(steps_equilibrate+steps_warmup+steps_final)) +@mpi_root @info "Replica fciqmc with G2 completed in $(el3) seconds." +@mpi_root println("Done!") \ No newline at end of file From 9e60c54b4d62236665f5ad95e140f49d04d81c96 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 11:19:15 +1200 Subject: [PATCH 02/14] more text --- scripts/Impurity-example.jl | 45 ++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 38a89c1e4..a8e7d7aa8 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -4,10 +4,20 @@ # impurity coupled with a one-dimensional Bose gas. We will be using MPI parallelisation # as such calculations are typically expensive. +# The aim of this example is to showcase how a two-component Hamiltonian in momentum-space can be set up, +# as well as how a multi-stage FCIQMC can be run. + +# A detailed description of the physical system and the physics behind the model can be found +# at our published paper (open access) "Polaron-Depleton Transition in the Yrast Excitations of a One-Dimensional +# Bose Gas with a Mobile Impurity", M. Yang, M. Čufar, E. Pahl, J. Brand, +# [*Condens. Matter* **7**, 15 (2022)](https://www.mdpi.com/2410-3896/7/1/15). + # A runnable script for this example is located # [here](https://github.com/joachimbrand/Rimu.jl/blob/develop/scripts/Impurity-example.jl). # Run it with `mpirun -np [# of CPUs] julia Impurity-example.jl`. +### Setup + # Firstly, we load all needed modules. # `Rimu` and `Rimu.RMPI` for parallel FCIQMC calculation, and `DataFrames` for output @@ -86,13 +96,13 @@ ham2 = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V2,dispersion=continuum_dispersi # Now we can setup the Monte Carlo parameters steps_warmup = 10_000 # number of QMC steps running with `ham2` steps_equilibrate = 10_000 # number of QMC steps running with the real `ham` -steps_final = 1_000 # number of QMC steps running with G2 correlators, very slow, be caution! +steps_final = 10_000 # number of QMC steps running with G2 correlators, very slow, be caution! tw = 1_000 # number of walkers # Specifying the shift strategy: s_strat = DoubleLogUpdateAfterTargetWalkers(targetwalkers = tw) # We use very small time-step size and high starting value of shift -params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 3_000.0) +params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 200.0) # As we only use the secondary Hamiltonian `ham2` to generate a staring vector, we don't have to # save any data in this stage r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root()) @@ -100,11 +110,18 @@ r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, wri # Wrapping `dv` for MPI: dv = MPIData(init_dv(P,m,na)) +# Let's have a look of the starting vector: +@mpi_root @show dv + +### Stage 1: Running the "dummy" Hamiltonian + # Now we run FCIQMC with `lomc!()` and track the elapsed time. # Both `df` and `state` will be overwritten late with the "real" data el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) @mpi_root @info "Initial fciqmc completed in $(el) seconds." +### Stage 2: Running the real Hamiltonian with replica but no observables + # New we are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. # We save the Monte Carlo data every 1000 steps. r_strat = ReportToFile( @@ -119,20 +136,25 @@ el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica=AllOv laststep=(steps_equilibrate+steps_warmup)) @mpi_root @info "Replica fciqmc completed in $(el2) seconds." +### Stage 3: Running the real Hamiltonian with replica with observables # We now at the last stage of the calculation, doing replica FCIQMC with a serious of # G2 correlators with distance `d` from `0` to `m`. See [`G2Correlator`](@ref). -# Save data every 10 steps as they are slow and you don't want to loose too much data if -# the job stops before finishes. +# Here we save data every 1000 steps, but using a smaller `chunk_size` like 10 or even 1 +# is highly recommended as replica FCIQMC with many observables being calculated are very +# expensive and you don't want to loose too much data if the job stops before finishes. r_strat = ReportToFile( save_if = is_mpi_root(), filename = "mpi_df_g2_$(η)_$(P).arrow", - chunk_size = 10, + chunk_size = 1000, return_df = true # change it to `false` when running the real job ) # Setting up a tuple of G2 correlators: g = Tuple(G2Correlator.(0:m)) +# By default, for a two-component system the cross-component G2 operators are set up. +# If you want to calculate the correlations within a single component, `G2Correlator(d,:first)` +# or `G2Correlator(d,:second)` can be called based on your choice. # Carry over information from the previous stage and set up a new `QMCState`: new_state = Rimu.QMCState( @@ -142,4 +164,15 @@ new_state = Rimu.QMCState( # The final stage el3 = @elapsed df2, state2 = lomc!(new_state;laststep=(steps_equilibrate+steps_warmup+steps_final)) @mpi_root @info "Replica fciqmc with G2 completed in $(el3) seconds." -@mpi_root println("Done!") \ No newline at end of file +@mpi_root println("MPI run finished!") + +# Typically, one should not include any analyses when using MPI, as they will be calculated multiple +# time unless you put the `@mpi_root` macro everywhere. +# But here, let's have a look of the calculated G2 correlations: +@mpi_root println("Two-body correlator from 2 replicas:") +@mpi_root for d in 0:m + r = rayleigh_replica_estimator(df2; op_name = "Op$(d+1)", skip=1_000) + println(" G2($d) = $(r.f) ± $(r.σ_f)") +end +# A symmetry between `G2(d)` and `G2(m-d)` can be observed above, which is the expected outcome due +# the periodic boundary conditions. \ No newline at end of file From 05bea4e1642a632764a3b174f33dab31ab57e884 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 11:36:31 +1200 Subject: [PATCH 03/14] fixed the init_dv() function bloacking doc deploy --- scripts/Impurity-example.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index a8e7d7aa8..03dae30fc 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -45,22 +45,22 @@ function init_dv(P,m,n) bfs1[c+1] = n; bfs2[c+1] = 1 dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 else - # move impurity to c+1 + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) - bfs1[c] = n-(P-1); bfs1[c+1] = P-1; bfs2[c+1] = 1 + bfs1[c] = n-(P-1); bfs1[c+1] = P-1; bfs2[c+1] = 1 # move impurity to c+1 dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 - # move bosons to c+1 + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) - bfs1[c] = n-P; bfs1[c+1] = P; bfs2[c] = 1 + bfs1[c] = n-P; bfs1[c+1] = P; bfs2[c] = 1 # move bosons to c+1 dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 - # move impurity to c+P + bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) - bfs1[c] = n; bfs2[c+P] = 1 + bfs1[c] = n; bfs2[c+P] = 1 # move impurity to c+P dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 - # move impurity to c-1 and a boson to c+1 + if (n-1) >= P >(n÷2) bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) - bfs1[c] = n-(P+1); bfs1[c+1] = P+1; bfs2[c-1] = 1 + bfs1[c] = n-(P+1); bfs1[c+1] = P+1; bfs2[c-1] = 1 # move impurity to c-1 and a boson to c+1 dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 end end From fc4e82f2023df80788d6c99e7741584c4dc49a31 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 11:38:20 +1200 Subject: [PATCH 04/14] removed empty line --- scripts/Impurity-example.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 03dae30fc..13d45a648 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -45,7 +45,6 @@ function init_dv(P,m,n) bfs1[c+1] = n; bfs2[c+1] = 1 dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 else - bfs1 = zeros(Int, m);bfs2 = zeros(Int, m) bfs1[c] = n-(P-1); bfs1[c+1] = P-1; bfs2[c+1] = 1 # move impurity to c+1 dv[BoseFS2C(BoseFS(bfs1),BoseFS(bfs2))]+=1.0 From 265e07c5b80eaf87ed882a08cfd2be4d46ac9fda Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 11:49:48 +1200 Subject: [PATCH 05/14] fixed md subtitles --- scripts/Impurity-example.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 13d45a648..613c48f83 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -16,7 +16,7 @@ # [here](https://github.com/joachimbrand/Rimu.jl/blob/develop/scripts/Impurity-example.jl). # Run it with `mpirun -np [# of CPUs] julia Impurity-example.jl`. -### Setup +# ## Setup # Firstly, we load all needed modules. # `Rimu` and `Rimu.RMPI` for parallel FCIQMC calculation, and `DataFrames` for output @@ -112,14 +112,14 @@ dv = MPIData(init_dv(P,m,na)) # Let's have a look of the starting vector: @mpi_root @show dv -### Stage 1: Running the "dummy" Hamiltonian +# ## Stage 1: Running the "dummy" Hamiltonian # Now we run FCIQMC with `lomc!()` and track the elapsed time. # Both `df` and `state` will be overwritten late with the "real" data el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) @mpi_root @info "Initial fciqmc completed in $(el) seconds." -### Stage 2: Running the real Hamiltonian with replica but no observables +# ## Stage 2: Running the real Hamiltonian with replica but no observables # New we are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. # We save the Monte Carlo data every 1000 steps. @@ -135,7 +135,7 @@ el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica=AllOv laststep=(steps_equilibrate+steps_warmup)) @mpi_root @info "Replica fciqmc completed in $(el2) seconds." -### Stage 3: Running the real Hamiltonian with replica with observables +# ## Stage 3: Running the real Hamiltonian with replica with observables # We now at the last stage of the calculation, doing replica FCIQMC with a serious of # G2 correlators with distance `d` from `0` to `m`. See [`G2Correlator`](@ref). @@ -165,6 +165,8 @@ el3 = @elapsed df2, state2 = lomc!(new_state;laststep=(steps_equilibrate+steps_w @mpi_root @info "Replica fciqmc with G2 completed in $(el3) seconds." @mpi_root println("MPI run finished!") +# ## Post-calculation analysis + # Typically, one should not include any analyses when using MPI, as they will be calculated multiple # time unless you put the `@mpi_root` macro everywhere. # But here, let's have a look of the calculated G2 correlations: From d6d09e6bbe868cde5e6c26451334c185763c6380 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 12:27:06 +1200 Subject: [PATCH 06/14] trying to fix stdout problem by using println() --- scripts/Impurity-example.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 613c48f83..bf392db63 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -117,7 +117,7 @@ dv = MPIData(init_dv(P,m,na)) # Now we run FCIQMC with `lomc!()` and track the elapsed time. # Both `df` and `state` will be overwritten late with the "real" data el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) -@mpi_root @info "Initial fciqmc completed in $(el) seconds." +@mpi_root println("Initial fciqmc completed in $(el) seconds.") # ## Stage 2: Running the real Hamiltonian with replica but no observables @@ -133,7 +133,7 @@ r_strat = ReportToFile( # We will turn on the replica, but without operators for a fast equilibration. el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica=AllOverlaps(2, nothing), laststep=(steps_equilibrate+steps_warmup)) -@mpi_root @info "Replica fciqmc completed in $(el2) seconds." +@mpi_root println("Replica fciqmc completed in $(el2) seconds.") # ## Stage 3: Running the real Hamiltonian with replica with observables @@ -162,7 +162,7 @@ new_state = Rimu.QMCState( ) # The final stage el3 = @elapsed df2, state2 = lomc!(new_state;laststep=(steps_equilibrate+steps_warmup+steps_final)) -@mpi_root @info "Replica fciqmc with G2 completed in $(el3) seconds." +@mpi_root println("Replica fciqmc with G2 completed in $(el3) seconds.") @mpi_root println("MPI run finished!") # ## Post-calculation analysis From 42bd529c578f03719af404e23cd34f81a37836be Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 12:36:35 +1200 Subject: [PATCH 07/14] removed all @info --- scripts/Impurity-example.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index bf392db63..d2bf6d2e4 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -68,7 +68,7 @@ end # Now let's first do some MPI sanity checks and print some information: mpi_barrier() # optional, use for debugging and sanity checks -@info "After barrier 1" mpi_rank() mpi_size() Threads.nthreads() +println("After barrier 1 mpi_rank() = $(mpi_rank()) mpi_size() = $(mpi_size()) Threads.nthreads() = $(Threads.nthreads())") # Now we specify parameters for constructing a two-component Hamiltonian P = 3 # total momentum From a1c41db8af861272cf34027765a6b87ea50ff6f5 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 12:48:40 +1200 Subject: [PATCH 08/14] removed all @mpi_root --- scripts/Impurity-example.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index d2bf6d2e4..a233218c4 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -68,7 +68,7 @@ end # Now let's first do some MPI sanity checks and print some information: mpi_barrier() # optional, use for debugging and sanity checks -println("After barrier 1 mpi_rank() = $(mpi_rank()) mpi_size() = $(mpi_size()) Threads.nthreads() = $(Threads.nthreads())") +@info "After barrier 1" mpi_rank() mpi_size() Threads.nthreads() # Now we specify parameters for constructing a two-component Hamiltonian P = 3 # total momentum @@ -110,14 +110,14 @@ r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, wri dv = MPIData(init_dv(P,m,na)) # Let's have a look of the starting vector: -@mpi_root @show dv +@show dv # ## Stage 1: Running the "dummy" Hamiltonian # Now we run FCIQMC with `lomc!()` and track the elapsed time. # Both `df` and `state` will be overwritten late with the "real" data el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) -@mpi_root println("Initial fciqmc completed in $(el) seconds.") +@info "Initial fciqmc completed in $(el) seconds." # ## Stage 2: Running the real Hamiltonian with replica but no observables @@ -133,7 +133,7 @@ r_strat = ReportToFile( # We will turn on the replica, but without operators for a fast equilibration. el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica=AllOverlaps(2, nothing), laststep=(steps_equilibrate+steps_warmup)) -@mpi_root println("Replica fciqmc completed in $(el2) seconds.") +@info "Replica fciqmc completed in $(el2) seconds." # ## Stage 3: Running the real Hamiltonian with replica with observables @@ -162,16 +162,16 @@ new_state = Rimu.QMCState( ) # The final stage el3 = @elapsed df2, state2 = lomc!(new_state;laststep=(steps_equilibrate+steps_warmup+steps_final)) -@mpi_root println("Replica fciqmc with G2 completed in $(el3) seconds.") -@mpi_root println("MPI run finished!") +@info "Replica fciqmc with G2 completed in $(el3) seconds." +println("MPI run finished!") # ## Post-calculation analysis # Typically, one should not include any analyses when using MPI, as they will be calculated multiple # time unless you put the `@mpi_root` macro everywhere. # But here, let's have a look of the calculated G2 correlations: -@mpi_root println("Two-body correlator from 2 replicas:") -@mpi_root for d in 0:m +println("Two-body correlator from 2 replicas:") +for d in 0:m r = rayleigh_replica_estimator(df2; op_name = "Op$(d+1)", skip=1_000) println(" G2($d) = $(r.f) ± $(r.σ_f)") end From 0ac82b4f90fd05b3b1da468f6b3978143e63cfdb Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 13:00:43 +1200 Subject: [PATCH 09/14] trying io = devnull --- scripts/Impurity-example.jl | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index a233218c4..40eec20a7 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -104,20 +104,20 @@ s_strat = DoubleLogUpdateAfterTargetWalkers(targetwalkers = tw) params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 200.0) # As we only use the secondary Hamiltonian `ham2` to generate a staring vector, we don't have to # save any data in this stage -r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root()) +r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root(), io = devnull) # Wrapping `dv` for MPI: dv = MPIData(init_dv(P,m,na)) # Let's have a look of the starting vector: -@show dv +@mpi_root @show dv # ## Stage 1: Running the "dummy" Hamiltonian # Now we run FCIQMC with `lomc!()` and track the elapsed time. # Both `df` and `state` will be overwritten late with the "real" data el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) -@info "Initial fciqmc completed in $(el) seconds." +@mpi_root @info "Initial fciqmc completed in $(el) seconds." # ## Stage 2: Running the real Hamiltonian with replica but no observables @@ -127,13 +127,13 @@ r_strat = ReportToFile( save_if = is_mpi_root(), filename = "mpi_df_$(η)_$(P).arrow", chunk_size = 1000, - return_df = true # change it to `false` when running the real job + return_df = true, # change it to `false` when running the real job + io=devnull ) # We will turn on the replica, but without operators for a fast equilibration. -el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica=AllOverlaps(2, nothing), - laststep=(steps_equilibrate+steps_warmup)) -@info "Replica fciqmc completed in $(el2) seconds." +el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica = AllOverlaps(2, nothing), laststep = (steps_equilibrate+steps_warmup)) +@mpi_root @info "Replica fciqmc completed in $(el2) seconds." # ## Stage 3: Running the real Hamiltonian with replica with observables @@ -146,7 +146,8 @@ r_strat = ReportToFile( save_if = is_mpi_root(), filename = "mpi_df_g2_$(η)_$(P).arrow", chunk_size = 1000, - return_df = true # change it to `false` when running the real job + return_df = true, # change it to `false` when running the real job + io = devnull ) # Setting up a tuple of G2 correlators: @@ -161,8 +162,8 @@ new_state = Rimu.QMCState( state.m_strat, r_strat, state.s_strat, state.τ_strat, state.threading, state.post_step, AllOverlaps(2, g) ) # The final stage -el3 = @elapsed df2, state2 = lomc!(new_state;laststep=(steps_equilibrate+steps_warmup+steps_final)) -@info "Replica fciqmc with G2 completed in $(el3) seconds." +el3 = @elapsed df2, state2 = lomc!(new_state; laststep = (steps_equilibrate+steps_warmup+steps_final)) +@mpi_root @info "Replica fciqmc with G2 completed in $(el3) seconds." println("MPI run finished!") # ## Post-calculation analysis @@ -170,9 +171,9 @@ println("MPI run finished!") # Typically, one should not include any analyses when using MPI, as they will be calculated multiple # time unless you put the `@mpi_root` macro everywhere. # But here, let's have a look of the calculated G2 correlations: -println("Two-body correlator from 2 replicas:") -for d in 0:m - r = rayleigh_replica_estimator(df2; op_name = "Op$(d+1)", skip=1_000) +@mpi_root println("Two-body correlator from 2 replicas:") +@mpi_root for d in 0:m + r = rayleigh_replica_estimator(df2; op_name = "Op$(d+1)", skip = 1_000) println(" G2($d) = $(r.f) ± $(r.σ_f)") end # A symmetry between `G2(d)` and `G2(m-d)` can be observed above, which is the expected outcome due From a34764b9d433fdc10d473c5e285a17c58a74c221 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 13:06:20 +1200 Subject: [PATCH 10/14] added more text --- scripts/Impurity-example.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 40eec20a7..4f56671d8 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -103,7 +103,7 @@ s_strat = DoubleLogUpdateAfterTargetWalkers(targetwalkers = tw) # We use very small time-step size and high starting value of shift params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 200.0) # As we only use the secondary Hamiltonian `ham2` to generate a staring vector, we don't have to -# save any data in this stage +# save any data in this stage. Progress messages are suppressed with `io=devnull`. r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root(), io = devnull) # Wrapping `dv` for MPI: @@ -123,6 +123,8 @@ el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) # New we are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. # We save the Monte Carlo data every 1000 steps. +# Progress messages are suppressed with `io=devnull`, for a real job one should remove the +# line to invoke the default `io` and reenable the output messages. r_strat = ReportToFile( save_if = is_mpi_root(), filename = "mpi_df_$(η)_$(P).arrow", @@ -142,6 +144,8 @@ el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica = All # Here we save data every 1000 steps, but using a smaller `chunk_size` like 10 or even 1 # is highly recommended as replica FCIQMC with many observables being calculated are very # expensive and you don't want to loose too much data if the job stops before finishes. +# Progress messages are suppressed with `io=devnull`, for a real job one should remove the +# line to invoke the default `io` and reenable the output messages. r_strat = ReportToFile( save_if = is_mpi_root(), filename = "mpi_df_g2_$(η)_$(P).arrow", From 5b3b6b589939bfa6fd865179cf21fce2b14e678c Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 14:04:20 +1200 Subject: [PATCH 11/14] added test, hopefully it's hidden with #src --- scripts/Impurity-example.jl | 55 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 4f56671d8..92a282e92 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -5,7 +5,8 @@ # as such calculations are typically expensive. # The aim of this example is to showcase how a two-component Hamiltonian in momentum-space can be set up, -# as well as how a multi-stage FCIQMC can be run. +# as well as how a multi-stage FCIQMC can be run. Furthermore, this momentum-space setup will incur the +# sign problem, hence the initiator approach for FCIQMC will be used. # A detailed description of the physical system and the physics behind the model can be found # at our published paper (open access) "Polaron-Depleton Transition in the Yrast Excitations of a One-Dimensional @@ -23,7 +24,7 @@ using Rimu using Rimu.RMPI -using DataFrames +# using DataFrames # Firstly, let's define a function for constructing the starting vector based on # the total momentum of the coupled system `P`, the number of modes `m` and the @@ -66,6 +67,9 @@ function init_dv(P,m,n) return dv end +# Note that the `dv` will be constructed with `InitiatorDVec()`, meaning +# that the initiator-FCIQMC algorithm will be used. + # Now let's first do some MPI sanity checks and print some information: mpi_barrier() # optional, use for debugging and sanity checks @info "After barrier 1" mpi_rank() mpi_size() Threads.nthreads() @@ -109,29 +113,30 @@ r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, wri # Wrapping `dv` for MPI: dv = MPIData(init_dv(P,m,na)) -# Let's have a look of the starting vector: +# Let's have a look of the starting vector, in this particular case, all 4 different ways of +# distributing total momenta `P` with `init_dv()` are triggered: @mpi_root @show dv # ## Stage 1: Running the "dummy" Hamiltonian # Now we run FCIQMC with `lomc!()` and track the elapsed time. -# Both `df` and `state` will be overwritten late with the "real" data +# Both `df` and `state` will be overwritten late with the "real" data. el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) @mpi_root @info "Initial fciqmc completed in $(el) seconds." # ## Stage 2: Running the real Hamiltonian with replica but no observables -# New we are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. +# We are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. # We save the Monte Carlo data every 1000 steps. # Progress messages are suppressed with `io=devnull`, for a real job one should remove the # line to invoke the default `io` and reenable the output messages. r_strat = ReportToFile( - save_if = is_mpi_root(), - filename = "mpi_df_$(η)_$(P).arrow", - chunk_size = 1000, - return_df = true, # change it to `false` when running the real job - io=devnull - ) + save_if = is_mpi_root(), + filename = "mpi_df_$(η)_$(P).arrow", + chunk_size = 1000, + return_df = true, # change it to `false` when running the real job + io=devnull # remove this line when running the real job + ) # We will turn on the replica, but without operators for a fast equilibration. el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica = AllOverlaps(2, nothing), laststep = (steps_equilibrate+steps_warmup)) @@ -147,12 +152,12 @@ el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica = All # Progress messages are suppressed with `io=devnull`, for a real job one should remove the # line to invoke the default `io` and reenable the output messages. r_strat = ReportToFile( - save_if = is_mpi_root(), - filename = "mpi_df_g2_$(η)_$(P).arrow", - chunk_size = 1000, - return_df = true, # change it to `false` when running the real job - io = devnull - ) + save_if = is_mpi_root(), + filename = "mpi_df_g2_$(η)_$(P).arrow", + chunk_size = 1000, + return_df = true, # change it to `false` when running the real job + io = devnull # remove this line when running the real job + ) # Setting up a tuple of G2 correlators: g = Tuple(G2Correlator.(0:m)) @@ -162,9 +167,9 @@ g = Tuple(G2Correlator.(0:m)) # Carry over information from the previous stage and set up a new `QMCState`: new_state = Rimu.QMCState( - state.hamiltonian, state.replicas, Ref(Int(state.maxlength)), - state.m_strat, r_strat, state.s_strat, state.τ_strat, state.threading, state.post_step, AllOverlaps(2, g) - ) + state.hamiltonian, state.replicas, Ref(Int(state.maxlength)), + state.m_strat, r_strat, state.s_strat, state.τ_strat, state.threading, state.post_step, AllOverlaps(2, g) + ) # The final stage el3 = @elapsed df2, state2 = lomc!(new_state; laststep = (steps_equilibrate+steps_warmup+steps_final)) @mpi_root @info "Replica fciqmc with G2 completed in $(el3) seconds." @@ -177,8 +182,14 @@ println("MPI run finished!") # But here, let's have a look of the calculated G2 correlations: @mpi_root println("Two-body correlator from 2 replicas:") @mpi_root for d in 0:m - r = rayleigh_replica_estimator(df2; op_name = "Op$(d+1)", skip = 1_000) + r = rayleigh_replica_estimator(df2; op_name = "Op$(d+1)", skip = 5_000) println(" G2($d) = $(r.f) ± $(r.σ_f)") end # A symmetry between `G2(d)` and `G2(m-d)` can be observed above, which is the expected outcome due -# the periodic boundary conditions. \ No newline at end of file +# the periodic boundary conditions. + +# Finished ! + +using Test #src +r = rayleigh_replica_estimator(df2; op_name = "Op1", skip = 5_000) #src +@test r.f ≈ 0.6294961872457038 rtol = 0.01 #src \ No newline at end of file From daa700e30865bb9b8f6a82fe48bcc28cbf04616a Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 14:35:20 +1200 Subject: [PATCH 12/14] removed unused modules; added more text --- scripts/Impurity-example.jl | 44 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 92a282e92..ace01e790 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -1,8 +1,9 @@ # # Example 4: Impurity Yrast States -# This is an example calculation of the lowest energy eigenstates of a mobile +# This is an example calculation of the lowest energy eigenstates at given total momentum (yrast states) of a mobile # impurity coupled with a one-dimensional Bose gas. We will be using MPI parallelisation -# as such calculations are typically expensive. +# as such calculations are typically expensive. This script is designed to be run effectively +# on a high performance computing (HPC) unit. # The aim of this example is to showcase how a two-component Hamiltonian in momentum-space can be set up, # as well as how a multi-stage FCIQMC can be run. Furthermore, this momentum-space setup will incur the @@ -17,16 +18,14 @@ # [here](https://github.com/joachimbrand/Rimu.jl/blob/develop/scripts/Impurity-example.jl). # Run it with `mpirun -np [# of CPUs] julia Impurity-example.jl`. -# ## Setup +# ## Initial setup and parameters -# Firstly, we load all needed modules. -# `Rimu` and `Rimu.RMPI` for parallel FCIQMC calculation, and `DataFrames` for output +# Firstly, we load all needed modules `Rimu` and `Rimu.RMPI` for parallel FCIQMC calculation. using Rimu using Rimu.RMPI -# using DataFrames -# Firstly, let's define a function for constructing the starting vector based on +# Let's define a function for constructing the starting vector based on # the total momentum of the coupled system `P`, the number of modes `m` and the # number of non-impurity bosons `n`. The maximum allowed total momentum equals to the total # number of particles including the impurity, hence `n+1`. Apart from the zero and the maximum @@ -84,23 +83,17 @@ T = m^2/2 # normalised hopping strength U = m*γ*na/(γ*na/(m*π^2) + 1) # converting γ to U V = m*η*na/(η*na/(m*π^2) + 1) # converting η to V # Here we use an initial address `aIni` for constructing the Hamiltonian, but -# it will not be used in the starting vector +# it will not be used in the starting vector. aIni = BoseFS2C(BoseFS([na; zeros(Int, m-1)]), BoseFS([1; zeros(Int, m-1)])) ham = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V,dispersion=continuum_dispersion) -# Here we are constructing a secondary Hamiltonian `ham2` with equal boson-boson and impurity coupling -# strength. We use this Hamiltonian to further generate a batter staring vector. From previous experiences -# calculating impurity problems, this setup can significantly speed up the convergence and help FCIQMC to -# sample the important part of the Hilbert space, especially useful when `η` is very small. -η2 = γ -V2 = m*η2*na/(η2*na/(m*π^2) + 1) -ham2 = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V2,dispersion=continuum_dispersion) + # Now we can setup the Monte Carlo parameters steps_warmup = 10_000 # number of QMC steps running with `ham2` steps_equilibrate = 10_000 # number of QMC steps running with the real `ham` steps_final = 10_000 # number of QMC steps running with G2 correlators, very slow, be caution! -tw = 1_000 # number of walkers +tw = 1_000 # number of walkers, be sure to use a larger enough number to eliminate biases # Specifying the shift strategy: s_strat = DoubleLogUpdateAfterTargetWalkers(targetwalkers = tw) @@ -111,20 +104,28 @@ params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root(), io = devnull) # Wrapping `dv` for MPI: -dv = MPIData(init_dv(P,m,na)) +dv = MPIData(init_dv(P,m,na)); # Let's have a look of the starting vector, in this particular case, all 4 different ways of # distributing total momenta `P` with `init_dv()` are triggered: @mpi_root @show dv -# ## Stage 1: Running the "dummy" Hamiltonian +# ## Stage 1: Running with the "dummy" Hamiltonian + +# Here we are constructing a secondary Hamiltonian `ham2` with equal boson-boson and impurity coupling +# strength. We use this Hamiltonian to further generate a batter staring vector. From previous experiences +# calculating impurity problems, this setup can significantly speed up the convergence and help FCIQMC to +# sample the important part of the Hilbert space, especially useful when `η` is very small. +η2 = γ +V2 = m*η2*na/(η2*na/(m*π^2) + 1) +ham2 = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V2,dispersion=continuum_dispersion) # Now we run FCIQMC with `lomc!()` and track the elapsed time. # Both `df` and `state` will be overwritten late with the "real" data. el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) @mpi_root @info "Initial fciqmc completed in $(el) seconds." -# ## Stage 2: Running the real Hamiltonian with replica but no observables +# ## Stage 2: Running with the real Hamiltonian with replica but no observables # We are ready to run the real Hamiltonian, here we redefine some variables for saving outputs. # We save the Monte Carlo data every 1000 steps. @@ -142,7 +143,7 @@ r_strat = ReportToFile( el2 = @elapsed df, state = lomc!(ham,dv; params, s_strat, r_strat, replica = AllOverlaps(2, nothing), laststep = (steps_equilibrate+steps_warmup)) @mpi_root @info "Replica fciqmc completed in $(el2) seconds." -# ## Stage 3: Running the real Hamiltonian with replica with observables +# ## Stage 3: Running with the real Hamiltonian with replica and observables # We now at the last stage of the calculation, doing replica FCIQMC with a serious of # G2 correlators with distance `d` from `0` to `m`. See [`G2Correlator`](@ref). @@ -178,7 +179,8 @@ println("MPI run finished!") # ## Post-calculation analysis # Typically, one should not include any analyses when using MPI, as they will be calculated multiple -# time unless you put the `@mpi_root` macro everywhere. +# time unless you put the `@mpi_root` macro everywhere. Even so, all other MPI ranks apart from the root +# will be idling and wasting CPU hours on a HPC unit. # But here, let's have a look of the calculated G2 correlations: @mpi_root println("Two-body correlator from 2 replicas:") @mpi_root for d in 0:m From 206d1afc9d08a85707c475b27123a7921810afe7 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Wed, 21 Sep 2022 15:08:05 +1200 Subject: [PATCH 13/14] changed orders of some lines; fixed typos --- scripts/Impurity-example.jl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index ace01e790..2172741ba 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -90,18 +90,13 @@ ham = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V,dispersion=continuum_dispersion # Now we can setup the Monte Carlo parameters -steps_warmup = 10_000 # number of QMC steps running with `ham2` +steps_warmup = 10_000 # number of QMC steps running with a dummy Hamiltonian, see Stage 1 steps_equilibrate = 10_000 # number of QMC steps running with the real `ham` steps_final = 10_000 # number of QMC steps running with G2 correlators, very slow, be caution! tw = 1_000 # number of walkers, be sure to use a larger enough number to eliminate biases # Specifying the shift strategy: s_strat = DoubleLogUpdateAfterTargetWalkers(targetwalkers = tw) -# We use very small time-step size and high starting value of shift -params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 200.0) -# As we only use the secondary Hamiltonian `ham2` to generate a staring vector, we don't have to -# save any data in this stage. Progress messages are suppressed with `io=devnull`. -r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root(), io = devnull) # Wrapping `dv` for MPI: dv = MPIData(init_dv(P,m,na)); @@ -120,8 +115,14 @@ dv = MPIData(init_dv(P,m,na)); V2 = m*η2*na/(η2*na/(m*π^2) + 1) ham2 = BoseHubbardMom1D2C(aIni;ta=T,tb=T,ua=U,v=V2,dispersion=continuum_dispersion) +# We use very small time-step size and high starting value of shift +params = RunTillLastStep(step = 0, dτ = 0.00001, laststep = steps_warmup,shift = 200.0) +# As we only use the secondary Hamiltonian `ham2` to generate a staring vector, we don't have to +# save any data in this stage. Progress messages are suppressed with `io=devnull`. +r_strat = ReportDFAndInfo(reporting_interval = 1_000, info_interval = 1_000, writeinfo = is_mpi_root(), io = devnull) + # Now we run FCIQMC with `lomc!()` and track the elapsed time. -# Both `df` and `state` will be overwritten late with the "real" data. +# Both `df` and `state` will be overwritten later with the "real" data. el = @elapsed df, state = lomc!(ham2, dv; params, s_strat, r_strat,) @mpi_root @info "Initial fciqmc completed in $(el) seconds." From 6785d3747643f59454b6594855b7bc4e1c9b0963 Mon Sep 17 00:00:00 2001 From: Ray Yang Date: Fri, 1 Sep 2023 16:56:01 -0500 Subject: [PATCH 14/14] made the example to run again --- scripts/Impurity-example.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Impurity-example.jl b/scripts/Impurity-example.jl index 2172741ba..3e5e457c1 100644 --- a/scripts/Impurity-example.jl +++ b/scripts/Impurity-example.jl @@ -170,7 +170,7 @@ g = Tuple(G2Correlator.(0:m)) # Carry over information from the previous stage and set up a new `QMCState`: new_state = Rimu.QMCState( state.hamiltonian, state.replicas, Ref(Int(state.maxlength)), - state.m_strat, r_strat, state.s_strat, state.τ_strat, state.threading, state.post_step, AllOverlaps(2, g) + r_strat, state.s_strat, state.τ_strat, state.post_step, AllOverlaps(2, g) ) # The final stage el3 = @elapsed df2, state2 = lomc!(new_state; laststep = (steps_equilibrate+steps_warmup+steps_final))