Skip to content

Add Input-Output HEOM feature#2590

Draft
nwlambert wants to merge 4 commits into
qutip:masterfrom
nwlambert:input-output-heom
Draft

Add Input-Output HEOM feature#2590
nwlambert wants to merge 4 commits into
qutip:masterfrom
nwlambert:input-output-heom

Conversation

@nwlambert
Copy link
Copy Markdown
Member

@nwlambert nwlambert commented Dec 23, 2024

Checklist

  • Complete tests (partially done)
  • Add documentation
  • Change log

Description
This is a first attempt at adding support for what is called ''input output'' baths in the HEOM solver, first introduced here https://arxiv.org/abs/2408.12221

Usually HEOM comes with 3 caveats: (i) the bath operator the system couples to be must be linear and the free bath evolution should preserve Gaussianity, (ii) the initial state of the bath must be Gaussian and (iii) we can only obtain limited bath information (usually some kind of statistics about the bath coupling operator, but not, e.g., bath occupation at different frequencies/spatial positions).

Input-output HEOM removes (ii) and (iii) via the use of additional ADOs incorporating the statistics about linear bath operators applied to the bath at arbitrary times. If this is done at t=0 we can interpret them as changing the initial state of the bath, hence ''input'', and resolving (ii). If they are done at the final observation time, we can interpret them as informing us about bath properties, hence "output", and resolving (iii) (to some degree). In principle they can also be done at intermediate times, but for simplicity here we stick with this input-output language.

In the HEOM construction we augment the bath with InputOutputBath objects, which are a lot like normal HEOM baths except: they truncate exactly at tier 2, and the couple to other ADOs with time-dependent coupling operators. Essentially, generally speaking we don't need to do the normal exponential decomposition for the statistics these baths encode (unless we want to, so for output we also support such decompositions, this will be demonstrated in the example notebooks/docs).

To include these in the QuTiP HEOM solver, I did two slightly suspicious things, hence the draft nature of this PR:

  1. Introduce a new bath type, InputOutputBath, which inherits from the existing parent bath classes introduced recently, and uses the exponents type to store the information about the correlation information needed for both input and output. The interface to this new bath needs some polishing and checks, and the use of the exponents type is a little bit bad, as now the 'ck' information for some of the terms must be time-dependent functions. When then sent to bofin_solvers I check for these new terms, by their new type names, and treat them a bit differently in _GatherHEOMRHS (see below).

@ytdHuang suggested instead introducing a new DynamicalFields type. This would be conceptually nicer, but require a bit more sweeping changes to bofin_solvers, and I kinda like that we can still use a lot of the existing exponents functions for this. Anyways, open to suggestions!

  1. For the first time we need to support time-dependent ADO couplings in the RHS of the HEOM (previously we only supported time-dependence in the system Hamiltonian). I experimented a little bit with different ways to do this. Reverting back to making everything QobjEvo and using kronecker products made the RHS very slow on large problem sizes. Generalizing _from_csr_blocks() to support qobjevo somehow failed miserably (much beyond my paygrade).

After some chats with @pmenczel the optimal solution was a half-way house where we treat TD-terms separately, group them by common TD-function pre-factors, use the existing _from_csr_blocks() to build those groups and then QojbEvo() them. Seems to work well so far. But a more robust solution would be nice in the long term if we want to support totally general RHS time dependence for other reasons.

On a final point, using the results requires a bit of finesse, manipulating ADOs with .extract() and so on (see examples). I would like to automate this a bit, and also add some predefined input/output functions for common existing baths. I feel like this will be a separate PR though, as there is a lot of work to be done in that direction.

Related issues or PRs
I will add examples to qutip-tutorials in a separate PR. qutip/qutip-tutorials#118

Additional edit comment:
Forgot to mention, no support for fermions yet.

commit 09e222c
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 23 15:21:04 2024 +0900

    Add additional missing docstring

commit d01a9f6
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 23 15:17:29 2024 +0900

    one more CR to fix

commit a03e6f0
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 23 15:14:48 2024 +0900

    undo some whitespace change

    Some experiences with qobjevo left unwanted whitespace, just undoing it.

commit e40fa6e
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 23 15:12:19 2024 +0900

    Update environment.py docstrings, add tests

    Note:  in adding tests, i fixed a couple of bugs in existing tests.

commit 912a6ed
Merge: 8946824 c5761bb
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 23 10:29:05 2024 +0900

    Merge branch 'qutip:master' into heom_mauro_inputoutpuit

commit 8946824
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Sun Dec 22 20:46:55 2024 +0900

    Fix some docstrings and comments in bofin_solvers

commit 50dc67a
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Sun Dec 22 14:31:56 2024 +0900

    change definition to be consistent with paper

commit 422f2ea
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Fri Dec 20 16:57:48 2024 +0900

    fix some linting issues

commit f9b55f0
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Fri Dec 20 16:20:16 2024 +0900

    Fix docstrings and linter things

commit 141ccd9
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Thu Dec 19 22:41:06 2024 +0900

    small bug fix

commit 609a23b
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 16 16:23:33 2024 +0900

    fix bug in output functions

commit 49c886d
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 16 16:18:54 2024 +0900

    add output in function form

commit 9401c30
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Wed Dec 11 16:36:09 2024 +0900

    refactor to custom inputoutputbath

    Undid changes to environment.py,  instead collated this all in a new inputoutput class in bofin_baths. i think this is conceptually much simpler and easier to extend in the future

commit 3d9b5f5
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Wed Dec 11 15:41:03 2024 +0900

    stable working version

    all bugs are fixed, but having this in environment.py doesn't make much sense. rework in progress

commit 690afd7
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 9 16:52:20 2024 +0900

    Merge conflict changes

    Gradually merging with environments.py

commit 87abdae
Merge: 9175faa c185699
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Dec 9 14:43:07 2024 +0900

    Merge remote-tracking branch 'upstream/master' into heom_mauro_inputoutpuit

commit 9175faa
Merge: 6ca7c1b 464112a
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Fri Nov 1 11:40:53 2024 +0900

    Merge branch 'qutip:master' into heom_mauro_inputoutpuit

commit 6ca7c1b
Merge: 3734237 ad35160
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Sep 9 15:03:27 2024 +0900

    Merge branch 'qutip:master' into heom_mauro_inputoutpuit

commit 3734237
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Thu Sep 5 19:46:44 2024 +0900

    spacing fix

commit 6a250ab
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Thu Sep 5 17:35:11 2024 +0900

    optimize time-dep ops  remove cython experiments

    The time-dep ops are now collated per ck_func, and then turned into qobjevos. this is much faster than old method.

commit 1635862
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Wed Sep 4 18:01:45 2024 +0900

    added output

    fixed output exponents definitions and solver equations

commit 3f19f25
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Thu Aug 29 17:24:36 2024 +0900

    refactor to just include TD on input terms

    Reverted back to using data objects of Ops,  and made a new list to store only time-dependent ops for input ADOS. Solves slow RHS construction problem (partially)

commit 233627c
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Mon Aug 19 07:53:06 2024 +0900

    Experiments with speedup

    Trying to speed up RHS construction. all failures so far.

commit 8efc188
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Tue Aug 13 09:58:25 2024 +0900

    small refactor

    rename and reduce number of variables needed todefine input/output, etc

commit 70dd299
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Sat Aug 10 13:14:27 2024 +0900

    small big fixes

    fixed some small bugs! now works for input

commit 2f7c2a7
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Fri Aug 9 17:05:42 2024 +0900

    Refactor and time-dependent terms

    Regressed to the old kron based construction so we can use qobjev in blocks and support time-dep Rin terms.

commit f0cc7f2
Author: Neill Lambert <nwlambert@gmail.com>
Date:   Fri Aug 9 08:35:11 2024 +0900

    add input/output exponents

    Add 4 new exponents for real imaginary parts of input output
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 87.718% (+0.01%) from 87.706%
when pulling 61bc43e on nwlambert:input-output-heom
into c5761bb on qutip:master.

Added args parameter to solver, and have it passed to the gather function.  Also, made sure args for TD hamiltonian were supported in heomsolve.
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.

2 participants