Browse code

move infinite system docstring from mixin to abstract base class

The docstring refers to site orderings, and explicit references to
the graph; these are things that vectorized systems keep for
backwards compatibility, but we wish to move away from. For this
reason we move the docstring to the (unvectorized) infinite system
class and add a more specific docstring to the vectorize infinite
system class.

Joseph Weston authored on 04/12/2019 15:16:00
Showing 1 changed files
... ...
@@ -576,50 +576,7 @@ def is_finite(syst):
576 576
 
577 577
 
578 578
 class InfiniteSystemMixin(metaclass=abc.ABCMeta):
579
-    """Abstract infinite low-level system.
580
-
581
-    An infinite system consists of an infinite series of identical cells.
582
-    Adjacent cells are connected by identical inter-cell hoppings.
583
-
584
-    Attributes
585
-    ----------
586
-    cell_size : integer
587
-        The number of sites in a single cell of the system.
588
-
589
-    Notes
590
-    -----
591
-    The system graph of an infinite systems contains a single cell, as well as
592
-    the part of the previous cell which is connected to it.  The first
593
-    `cell_size` sites form one complete single cell.  The remaining ``N`` sites
594
-    of the graph (``N`` equals ``graph.num_nodes - cell_size``) belong to the
595
-    previous cell.  They are included so that hoppings between cells can be
596
-    represented.  The N sites of the previous cell correspond to the first
597
-    ``N`` sites of the fully included cell.  When an ``InfiniteSystem`` is used
598
-    as a lead, ``N`` acts also as the number of interface sites to which it
599
-    must be connected.
600
-
601
-    The drawing shows three cells of an infinite system.  Each cell consists
602
-    of three sites.  Numbers denote sites which are included into the system
603
-    graph.  Stars denote sites which are not included.  Hoppings are included
604
-    in the graph if and only if they occur between two sites which are part of
605
-    the graph::
606
-
607
-            * 2 *
608
-        ... | | | ...
609
-            * 0 3
610
-            |/|/|
611
-            *-1-4
612
-
613
-        <-- order of cells
614 579
 
615
-    The numbering of sites in the drawing is one of the two valid ones for that
616
-    infinite system.  The other scheme has the numbers of site 0 and 1
617
-    exchanged, as well as of site 3 and 4.
618
-
619
-    Sites in the fundamental domain cell must belong to a different site array
620
-    than the sites in the previous cell. In the above example this means that
621
-    sites '(0, 1, 2)' and '(3, 4)' must belong to different site arrays.
622
-    """
623 580
     @deprecate_args
624 581
     def modes(self, energy=0, args=(), *, params=None):
625 582
         """Return mode decomposition of the lead
... ...
@@ -704,6 +661,46 @@ class InfiniteSystemMixin(metaclass=abc.ABCMeta):
704 661
 
705 662
 
706 663
 class InfiniteSystem(System, InfiniteSystemMixin, metaclass=abc.ABCMeta):
664
+    """Abstract infinite low-level system.
665
+
666
+    An infinite system consists of an infinite series of identical cells.
667
+    Adjacent cells are connected by identical inter-cell hoppings.
668
+
669
+    Attributes
670
+    ----------
671
+    cell_size : integer
672
+        The number of sites in a single cell of the system.
673
+
674
+    Notes
675
+    -----
676
+    The system graph of an infinite systems contains a single cell, as well as
677
+    the part of the previous cell which is connected to it.  The first
678
+    `cell_size` sites form one complete single cell.  The remaining ``N`` sites
679
+    of the graph (``N`` equals ``graph.num_nodes - cell_size``) belong to the
680
+    previous cell.  They are included so that hoppings between cells can be
681
+    represented.  The N sites of the previous cell correspond to the first
682
+    ``N`` sites of the fully included cell.  When an ``InfiniteSystem`` is used
683
+    as a lead, ``N`` acts also as the number of interface sites to which it
684
+    must be connected.
685
+
686
+    The drawing shows three cells of an infinite system.  Each cell consists
687
+    of three sites.  Numbers denote sites which are included into the system
688
+    graph.  Stars denote sites which are not included.  Hoppings are included
689
+    in the graph if and only if they occur between two sites which are part of
690
+    the graph::
691
+
692
+            * 2 *
693
+        ... | | | ...
694
+            * 0 3
695
+            |/|/|
696
+            *-1-4
697
+
698
+        <-- order of cells
699
+
700
+    The numbering of sites in the drawing is one of the two valid ones for that
701
+    infinite system.  The other scheme has the numbers of site 0 and 1
702
+    exchanged, as well as of site 3 and 4.
703
+    """
707 704
 
708 705
     @deprecate_args
709 706
     def cell_hamiltonian(self, args=(), sparse=False, *, params=None):
... ...
@@ -730,6 +727,36 @@ class InfiniteSystem(System, InfiniteSystemMixin, metaclass=abc.ABCMeta):
730 727
 
731 728
 
732 729
 class InfiniteVectorizedSystem(VectorizedSystem, InfiniteSystemMixin, metaclass=abc.ABCMeta):
730
+    """Abstract vectorized infinite low-level system.
731
+
732
+    An infinite system consists of an infinite series of identical cells.
733
+    Adjacent cells are connected by identical inter-cell hoppings.
734
+
735
+    Attributes
736
+    ----------
737
+    cell_size : integer
738
+        The number of sites in a single cell of the system.
739
+
740
+    Notes
741
+    -----
742
+    Unlike `~kwant.system.InfiniteSystem`, vectorized infinite systems do
743
+    not explicitly store the sites in the previous unit cell; only the
744
+    sites in the fundamental domain are stored. Nevertheless, the
745
+    SiteArrays of `~kwant.system.InfiniteVectorizedSystem` are ordered
746
+    in an analogous way, in order to facilitate the representation of
747
+    inter-cell hoppings. The ordering is as follows. The *interface sites*
748
+    of a unit cell are the sites that have hoppings to the *next* unit cell
749
+    (along the symmetry direction). Interface sites are always in different
750
+    SiteArrays than non-interface sites, i.e. the sites in a given SiteArray
751
+    are either all interface sites, or all non-interface sites.
752
+    The SiteArrays consisting of interface sites always appear *before* the
753
+    SiteArrays consisting of non-interface sites in ``self.site_arrays``.
754
+    This is backwards compatible with `kwant.system.InfiniteSystem`.
755
+
756
+    For backwards compatibility, `~kwant.system.InfiniteVectorizedSystem`
757
+    maintains a ``graph``, that includes nodes for the sites
758
+    in the previous unit cell.
759
+    """
733 760
     cell_hamiltonian = _system.vectorized_cell_hamiltonian
734 761
     inter_cell_hopping = _system.vectorized_inter_cell_hopping
735 762