Add selector_hartree
and selector_fock
to meanfield
#326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When doing meanfield calculations, sometimes we want long-range Hartree interactions (which take the form of purely onsite terms), but don't need long-range Fock terms (which induce long-range hoppings, which in turn often make calculations more expensive).
Currently, the
selector
kwarg inmeanfield
sets the interacting site pairs for building both the Hartree onsite terms and the Fock hopping terms. The only way to switch off Fock is to setfock = 0
, but that doesn't eliminate the Fock hopping terms, it just makes them zero, producing unnecessary overhead in some solvers (e.g. GS.Schur, which then requires building a large supercell to preserve only nearest-cell hoppings).In this PR we provide
selector_hartree
that applies to the calculation of Hartree onsite terms, overriding the generalselector
that applies to both Hatree and Fock by default. In this way, we can setselector = (; range = 0)
(i.e. the default),fock = 0
andselector_hartree = (; range = large_distance)
, and have long-range Hartree-only meanfields without the long-range hopping overhead.EDIT: we also add
selector_fock
for completeness and symmetry. Both default toselector
, which is the one to use when we don't want to make a difference, just aspotential
is the one to use, instead ofhartree
andfock
, when we want to treat hartree and fock consistently.