[Kwant-devel] (Composite) systems

```Overview
========

In the past, we discussed a new format for Kwant systems [1] that will
allow more general symmetries.  Joe and Daniel have implemented a
prototype [2] that supports general symmetries.  Since general
symmetries turn out to be tricky, the current consensus is to
concentrate on translational symmetries at a first time.  More general
symmetries can then be added later.  This staged approach does not have
to complicate the final format since it seems anyway a good idea to have
separate layers for translational and other spatial symmetries.  This
way the non-translational symmetries can remain hidden from solvers who
are not interested in them.```
```
There is another important aspect of the "new system" effort: we need a
way to couple systems of different symmetry into one composite system.
Such composite systems exist in today's Kwant but are not a separate
concept from finite systems (this is easy to overcome).  However, they
are limited to attaching 1d leads to 0d scattering regions.  Overcoming
this limitation is tricky and I'd like to start a discussion on how to
best do it.

[1] https://www.mail-archive.com/kwant-devel@kwant-project.org/msg00063.html
[2] https://gitlab.kwant-project.org/kwant/system2

Idea 1: unique sites
====================

Our experience has shown that it is useful to associate high-level sites
with low-level systems.  Users who build systems in terms of such
high-level sites expect to find them again in the low-level systems.

One attractive way of defining composite systems is to give additional
importance to high-level sites: to require that they have a unique
identity *across* the multiple systems that constitute a composite
system.  Observe that this is not the case in current Kwant: it is
possible to attach a lead to the center of a ring even if both share the
same lattice.  The sites where the lead "hovers" over a sector of the
ring exist twice as physical degrees of freedom.

This "unique site" approach allows to elegantly specify complex
composite systems.  For example, to embed a 0d island in a 2d bulk it is
enough to describe both constituents separately and to specify that sites
From the lower-symmetry subsystem "overwrite" sites from the
higher-symmetry subsystem.

The "unique site" approach has the problem of not defining any canonical
dense numbering of the present degrees of freedom.  However any solver
that performs useful computations for a composite system will have to
establish such a numbering.  Since the different parts of the composite
system are connected using sites the usage of hash-tables to map sites
to integer site indices (that necessarily appear at some point) seems
inevitable.

An additional problem is that the coupling between different parts is
implicit and must be computed.  For example a composite system that
consists of a 0d central region with an attached 1d lead would require a
precalculation that is equivalent to today's Builder.attach_lead()
function.  This preprocessing is also tricky: consider the simple
configuration of a central region with two parallel leads (both
belonging to the same lattice).  Nothing remarkable happens if one lead
is rotated slightly *away* from the other, but rotating it *towards* the
other suddenly changes the very topology of the composite system!  This
simple example shows that correctly interpreting a composite system that
uses the "unique site" approach is rather tricky.  If this preprocessing
can be done in a general way, it should obviously be cached but then
shouldn't the cached results *become* the low-level composite system

Idea 2: Systems as numbering schemes for degrees of freedom
===========================================================

The following is an attempt to reconcile various ideas that came up
recently (e.g. putting all operators on equal footing, reunifying
symmetries of lattices with system symmetries) with a low-level format
that is easy and efficient to use by solvers.

I propose to redefine "system" within Kwant to mean a numbering scheme
for degrees of freedom together with associated symmetries.  This
corresponds to what we understand today as system minus the Hamiltonian
operator.

An example of a very basic system is a single site (numbered 0) with two
orthogonal translational symmetries.  Note that this can be interpreted
as a lattice!

Thanks to the numbering, operators that act on a system can be defined
easily.  An operator is a mapping from group elements of the system's
symmetry to (sparse) matrices of some form.

We can introduce systems that correspond to a parent system but with a
reduced symmetry.  For example, a 1d wire could be derived from the
above 2d lattice by picking 3 sites of the lattice (e.g. at the
coordinates (0, 0), (0, 1), (0, 2)), numbering them starting with 0, and
specifying the remaining symmetry (which must be compatible with that of
the parent system).  Note that the choice of the sites fixes the unit
cell of the wire.  Operators on the wire are specified by a mapping from
the remaining symmetry to 3x3 matrices.

A particular kind of derived system that seems useful are interrupted
systems.  That would make it explicit that a system with n-dimensional
symmetry has been interrupted (in some way) to turn it into a system
with n-1-dimensional symmetry.  For example, a 1d wire could be turned
into a semi-inifinite lead.  A lead could be also represented as a
reduced-symmetry system derived from a wire that adds a barrier but this
will make it difficult to distinguish the specific case of a 1d lead
From the general case of a 1d wire with some perturbation.  Interrupted
systems would provide an explicit way of creating semi-inifinite
systems.  Note that in the same spirit, a 2d plane could be
"interrupted" to become a half-plane.

Finally, in order to be able to represent general composite systems,
another kind of derived system will be necessary: one that combines
multiple systems with the same symmetry into one.  This can be seen as
addition of systems.  For simplicity, we could require that operator
matrices may only couple a first "central" subsystem to any of the
others.

I will now discuss some concrete examples.

Example a: A 0d central region with two 1d leads
------------------------------------------------

This would be represented as follows:

- A 2d square lattice is made.  A 1d wire of some width is derived from
that.  The lead "interrupted system" is derived from the wire (by having
it stop at some unit cell)

- A 0d central system is derived from the same lattice as the wire.

- A composite system is defined that couples the central system twice
(at different placed) to the lead.  Note that this corresponds to two
physically separate leads, even if they have the same Hamiltonian.

I have deliberately chosen this example to highlight a difference with
the "unique site" approach.  In practice it is preferable to have a
builder that follows the "unique site" approach and creates two separate
leads that live at different regions of space.  But I want to emphasize
that the low-level format is agnostic to this.  It describes the system
in a bottom-up, simple and explicit way.

Example b: a wire with a local perturbation
-------------------------------------------

- The wire is defined like in the previous example.

- A 0d reduced-symmetry system is derived from the wire that modifies
some of its elements locally.

Note that this could be also realized (already in today's Kwant) as a
central region with two attached leads.  But this description makes it
explicit that the left and right lead are the same wire and that there
is only a (possibly small) perturbation.

Remark 1
--------

The above says nothing about how the matrices that define operators are
to be represented.  That could be vanilla sparse matrices, but this is
probably not the right approach if we want to be able to evaluate them
in a vectorized way.  Probably something along [2] is preferable.  But,
you see, this is a discussion that is independent from the present one,
that concerns only numbering of degrees of freedom.

Remark 2
--------

Another kind of derived systems could be useful: one that zeros-out all
sites of the parent system that are not explicitly listed.  That would
make it possible to "cut-out" a wire (or a dot) from a 2d bulk.

Remark 3
--------

Multiplication of systems could be naturally defined as tensor product,
e.g. the product of the following

- 1d chain in x direction
- 1d chain in y direction
- spin 1/2

would give a 2d plane with spin.  The product of 2 2d planes would be a
2-particle system, etc.

Rempark 4
---------

I think we should adopt numbering the real degrees of freedom instead of
sites that may contain multiple orbitals.  I.e. even if a system
consists of 3 sites of 2 orbitals each, it seems preferable to number
them 0, 2, 4.  This way, the same scheme is used for numbering sites and
degrees of freedom.
```

smime.p7s
Description: S/MIME cryptographic signature