Christoph Groth wrote:

> A long time ago Maciej Zwierzycki wrote:
>
> > In any case I'd be grateful for some illumination. Why isn't the
> > "perfect" wire behaving as it should?  Where is the imperfection if
> > it's not visible in the structure?
>
> What is debatable is whether it was a wise choice to make sublattices
> the site families, especially since the user does not create them
> directly when making a polyatomic lattice.  This could be actually
> changed, I guess even in a practically backwards-compatible way.

Here is an idea about how problems similar to yours might be avoided in
the future.  It seems to me that turning polyatomic lattices into site
arrays may be neither necessary nor desirable.

Things would have been less confusing for you had you assigned different
names to ‘lat’ and ‘lat2’ using the ‘name’ option of
‘kwant.lattice.general’.  Then you would have immediately got the error
message

  “Builder does not interrupt the lead, this lead cannot be attached.”

However, that ‘name’ option is not widely used and probably often not
known.

We could make assigning a name to a lattice a requirement.  But this
would needlessly complicate most simple scripts that happily use
a single lattice.

So what we could do instead is warn whenever a lattice object is created
explicitly that is identical to an already existing one, but unnamed.

(Technically, a registry of existing lattices that does not prevent them
from being garbage collected can be realized using the weakref module of
the standard library.)

Christoph

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

Reply via email to