-
Notifications
You must be signed in to change notification settings - Fork 8
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
Introducing the current Operator #227
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #227 +/- ##
==========================================
- Coverage 92.60% 92.36% -0.24%
==========================================
Files 34 34
Lines 5460 5477 +17
==========================================
+ Hits 5056 5059 +3
- Misses 404 418 +14 ☔ View full report in Codecov by Sentry. |
Keeping the Hamiltonian as the central quantity and defining operators on "top of" the hamiltonian makes sense to me! This replicates the way we typical model system: define a Hamiltonian and they compute observables from it. I assume that this would also work for Could you please explain the |
Yes, absolutely, since
Ah, that's just to allow you to compute generalized currents, such as spin currents. I'm not sure I did the generalization correctly though, I will need to check again. |
cb05a28
to
3336ce9
Compare
When writing tests for this PR, I realised that And with that, this is good to go. |
The construction of the current operator is simply a modification of the original Hamiltonian hoppings and onsites terms. The structure of more general operators is completelly unrelated to the Hamiltonian (for example a dipole operator). For this case, it would be useuful to be able to to this:
Is this possible at the present? |
There is a long-standing design issue around how to represent quantum operators that are not Hamiltonians. We could opt to rename
Hamiltonian
/ParametricHamiltonian
/AbstractHamiltonian
toOperator
/ParametricOperator
/AbstractOperator
, and also renamehamiltonian
tooperator
. However that seems a design mistake. All the language we use for modelling (onsite, hoppings...) are actually meant to represent Hamiltonians, and that is actually what we want to model most of the time. It would also be breaking.We could also just rename the structs, and keep the
hamiltonian
API unchanged. The output would just be anAbstractOperator
, without any type information indicating it is actually a Hamiltonian. But then it would be weird to haveGreenFunction
s accept any generic operator that is not anAbstractHamiltonian
.In this PR we take a more conservative approach: we keep the AbstractHamiltonian as the central object, and make
Operator
a derived object that is constructed from anAbstractHamiltonian
.This is completely non-breaking and keeps all the present structures and APIs untouched, so we can experiment for a while with this, and revert if we find the approach lacking.
As a first example we introduce an API method
current(h::AbstractHamiltonian; charge = -I, direction = 1)
, which returns anOperator
representing the currentJᵢ = ∂h/∂Aᵢ
along a givendirection = i
.CC @BacAmorim