Victor Regis wrote:

> I have a custom lattice that I generate outside of Kwant and I want
> specific sites to belong to specific sublattices.

Let’s first try to clarify the terminology a bit.

*** Site families ***

To Kwant’s builder, a site is an object that belongs to a "site family"
(an instance of a class derived from the SiteFamily abstract base class)
and is identified within this family by a "tag" object.  It’s that site
family that decides what a valid tag is, but it’s generally something
hashable, and often a tuple of integers.

One can easily create (exercise!) a site family that uses strings as
tags and then assign names to sites, like

sys[lat("Delft")] = ...
sys[lat("Grenoble")] = ...

Or one could create a site family that maps tuples of floats to sites.
(In that case one will have to be very careful in order to avoid
off-by-epsilon errors.)

The builder module and the rest of Kwant does not really care much about
site families.  The plotter requires that sites have a "pos" property,
but that’s about it.

*** Bravais lattices ***

Since Bravais lattices are commonly used in solid state physics, Kwant’s
lattice module implements them in terms of Kwant site families.

More specifically, it provides a site family class (MonatomicLattice)
that corresponds to a Bravais lattice with a basis made of a single
atom.

It also provides another class (PolyatomicLattice) that corresponds to
a Bravais lattice with a basis that is made up of multiple atoms.
Technically, we made the choice for this class *not* to be a Kwant site
family, but rather a collection of monatomic sublattices, each
represented by a separate MonatomicLattice instance.

So, in terms of Kwant, a "sublattice" corresponds specifically to an
instance of MonatomicLattice.  For example, if "honeycomb" is a graphene
lattice, and has two sublattices "a", and "b", then when writing

honeycomb.a(2, 3)

I’m using the MonatomicLattice (=sublattice) honeycomb.a to create
a site with the tag (2, 3).

> As a minimal reproducible example suppose I have a square lattice
> (evidently, this is a crystalline lattice and there are simple ways to
> do this in Kwant, but take this lattice just as the simplest example):
>
> lattice = np.array([[x,y] for x in range(20) for y in range(20)])
>
> And I set the system:
>
> def system(basis,size):
>     
>     syst = kwant.Builder() lat =
>     kwant.lattice.general([(0,size),(size,0)],basis = basis,norbs=1)
>
>     #then the onsite and hoppings etc
>
>     return syst.finalized()
>
> I know that lat is automatically split into 400 sublattices (one for
> each lattice site) but what I want is, for example, to make every
> other site be of sublattice family "b" and the rest of "a" and things
> along those lines.

Your variable "lattice" is not used in the remainder of the snippet.

Note that in your example you are creating either a MonatomicLattice or
a PolyatomicLattice.  This depends on the lentgh of the parameter
"basis".  But you are not creating 400 sublattices unless the basis
contains a sequence of 400 coordinates.

> In short, I want to make a lattice.general lattice from a custom basis
> of N-atoms and I want to specify which sites belong to which
> sublattices.

I’m not sure what you want to achieve and for what purpose.  Could you
please try to reformulate your question more precisely after reading my
explanations above?

If all you want to do is to have some sites (of some Bravais lattice)
belong to one site family, and some to another, what you could do is
create multiple Kwant lattices with the same parameters (but with
different names, since otherwise the lattices will be considered
identical), and then create sites as you wish from these lattices.

Hope this helps
Christoph

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to