Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time dependent TDVP #52

Closed
wants to merge 96 commits into from
Closed

Time dependent TDVP #52

wants to merge 96 commits into from

Conversation

DaanMaertens
Copy link
Collaborator

A TDVP implementation for time dependent Hamiltonians (see file in examples).

@codecov
Copy link

codecov bot commented Apr 29, 2023

Codecov Report

Attention: 123 lines in your changes are missing coverage. Please review.

Comparison is base (deb1e76) 84.72% compared to head (748ea45) 82.35%.
Report is 2 commits behind head on master.

❗ Current head 748ea45 differs from pull request most recent head c05e56b. Consider uploading reports for the commit c05e56b to get more accurate results

Files Patch % Lines
src/algorithms/timestep/windowtdvp.jl 44.24% 63 Missing ⚠️
src/algorithms/expval.jl 58.18% 23 Missing ⚠️
src/algorithms/timestep/time_evolve.jl 0.00% 14 Missing ⚠️
src/operators/sumofoperators.jl 45.00% 11 Missing ⚠️
src/operators/multipliedoperator.jl 75.00% 6 Missing ⚠️
src/states/windowmps.jl 0.00% 2 Missing ⚠️
src/algorithms/timestep/integrators.jl 83.33% 1 Missing ⚠️
src/environments/multipleenv.jl 93.75% 1 Missing ⚠️
src/states/finitemps.jl 0.00% 1 Missing ⚠️
src/states/window.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
- Coverage   84.72%   82.35%   -2.38%     
==========================================
  Files          61       67       +6     
  Lines        3784     3989     +205     
==========================================
+ Hits         3206     3285      +79     
- Misses        578      704     +126     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maartenvd
Copy link
Collaborator

In principle we should add some tests that cover the new functionality (and maybe explore interplay with blockade.jl) - but I don't particularly mind merging already and sorting that out later? @DaanMaertens @lkdvos

Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some general comments, but in principle I am okay with merging this

src/MPSKit.jl Outdated Show resolved Hide resolved
src/environments/timedepenv.jl Outdated Show resolved Hide resolved
src/environments/timedepenv.jl Outdated Show resolved Hide resolved
src/environments/timedepenv.jl Outdated Show resolved Hide resolved
src/algorithms/derivatives.jl Outdated Show resolved Hide resolved
src/algorithms/timestep/integrators.jl Outdated Show resolved Hide resolved
src/algorithms/timestep/integrators.jl Outdated Show resolved Hide resolved
@lkdvos lkdvos marked this pull request as ready for review October 16, 2023 13:42
@DaanMaertens
Copy link
Collaborator Author

DaanMaertens commented Oct 20, 2023

I agree with that the syntax of expectation_value for time-dependent operators should be
expectation_value(ψ, O(t), [location], [environments])
Currently this is accomplished by defining O(t)=O.f(t)*O.op. However this has some overhead since the method *(O,x::Number) is called while in principle one only needs to multiply O.f(t) with the expectation value of O.op. We could keep the O(t) interface in expectation_value and hide the "smart" multiplication from the users. This could be done by having an intermediate type UntimedOperator such that O(t)=UntimedOperator(O.op,O.f(t)) and then typing the expectation_value on UntimedOperator as expectation_value(ψ, O::UntimedOperator, [location], [environments])=O.f*expectation_value(ψ, O.op [location]. Thoughts?

@@ -23,6 +23,8 @@ const TimedOperator{O} = MultipliedOperator{O,<:Function}
const UntimedOperator{O} = MultipliedOperator{O,<:Union{Real,Nothing}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This honestly seems to be getting a bit out of hand, a MultipliedOperator{O,<:Nothing} should probably never exist, and just be a O, thus alleviating the need of the const TimedUnion, which is a also not a great name for timed + untimed operators, which are just any MultipliedOperators... If nothing else, you could create a trivially multiplied operator by using the hard One() from VectorInterface, which should in principle not actually execute multiplications?

(x::SumOfOperators{UntimedOperator})() = sum(ConvertOperator,x)
Base.sum(x::SumOfOperators{UntimedOperator}) = x()
Base.sum(x::SumOfOperators{TimedUnion},t::Number) = sum(y->ConvertOperator(y,t),x)
Base.sum(x::SumOfOperators{TimedUnion}) = throw(MethodError(sum,(x,)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a bit weird, calling sum on this, I would expect it to explicitly carry out the sum, and return a single operator. Throwing a method error as an overload for a base also prevents anyone from overloading Base.sum for SumOfOperators, which might not be something to enforce

@lkdvos
Copy link
Member

lkdvos commented Dec 21, 2023

Closed in favour of #91 #104

@lkdvos lkdvos closed this Dec 21, 2023
@lkdvos lkdvos deleted the TimeDependent branch November 28, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants