Hi everyone, I am trying to implement a carbon nanotube lattice inside of Kwant and I am not sure if my approach is correct. The CNT is slightly different, I think, than the other examples of lattices I have seen implemented in Kwant. My approach, which I have used in the past in my own NEGF code, is to generate the atoms of a single unit cell (just a ring for a (10, 0) tube) and then translate them using the translation vector for the ring. For a (10, 0) tube oriented along the z-direction the vector would be approximately (0, 0, 4.26) Angstrom. So, we have a 3D structure, but really only one lattice translation vector. The problem I am observing in my implementation of this in Kwant is that the Polyatomic lattice code seems to expect three primitive vectors for a 3D structure. In the case of the CNT, this does not really apply. When I run my code (an example for the (10, 0) tube is pasted below) I get the following error when I try to get the 1st nearest neighbors of the lattice: File "C:\Python27\lib\site-packages\kwant\lattice.py", line 282, in neighbors shortest_hopping = sls[0].n_closest(sls[0](*([0] * sls[0].dim)).pos, File " C:\Python27\lib\site-packages\kwant\builder.py", line 155, in __call__ return Site(self, tag) File "C:\Python27\lib\site-packages\kwant\builder.py", line 71, in __new__ raise t(msg.format(repr(tag), repr(family), v)) ValueError: Tag (0, 0, 0) is not allowed for site family kwant.lattice.Monatomic([[0.0, 0.0, 4.26]], [3.86624196507323, 0.6123525697973589, -0.355], '0'): Dimensionality mismatch. Does anyone have any advice for how I might get around this? With shape functions I am able to successfully translate the CNT to create/plot a system inside of Kwant- the only issue I have is with defining hoppings right now. I'm thinking that it might be possible to manually define the hoppings inside of the unit cell, but I am not exactly sure how to go about it for a problem of this size. Hopefully the way I've described my problem makes some sense! I am really hoping to get this working in Kwant- my NEGF code served my purposes for a while, but it is really quite terrible compared to Kwant, haha. ##Code snip: import kwant t_vec = [(0,0,4.26)] #(10,0) translation vector #unit cell coordinates for (10, 0) coords = [(3.86624196507323, 0.6123525697973589, -0.355), (3.86624196507323, -0.6123525697973589, 0.355), (3.48778726384012, 1.7771163733490807, 1.775), (3.86624196507323, 0.6123525697973589, 2.485), (2.7679236443795503, 2.76792364437955, -0.355), (3.48778726384012, 1.7771163733490807, 0.355), (1.7771163733490811, 3.4877872638401195, 1.775), (2.7679236443795503, 2.76792364437955, 2.485), (0.6123525697973591, 3.86624196507323, -0.355), (1.7771163733490811, 3.4877872638401195, 0.355), (-0.6123525697973586, 3.86624196507323, 1.775), (0.6123525697973591, 3.86624196507323, 2.485), (-1.7771163733490805, 3.48778726384012, -0.355), (-0.6123525697973586, 3.86624196507323, 0.355), (-2.76792364437955, 2.7679236443795503, 1.775), (-1.7771163733490805, 3.48778726384012, 2.485), (-3.4877872638401195, 1.7771163733490811, -0.355), (-2.76792364437955, 2.7679236443795503, 0.355), (-3.8662419650732294, 0.6123525697973593, 1.775), (-3.4877872638401195, 1.7771163733490811, 2.485), (-3.86624196507323, -0.6123525697973583, -0.355), (-3.8662419650732294, 0.6123525697973593, 0.355), (-3.48778726384012, -1.7771163733490802, 1.775), (-3.86624196507323, -0.6123525697973583, 2.485), (-2.7679236443795507, -2.76792364437955, -0.355), (-3.48778726384012, -1.7771163733490802, 0.355), (-1.7771163733490813, -3.4877872638401195, 1.775), (-2.7679236443795507, -2.76792364437955, 2.485), (-0.6123525697973595, -3.8662419650732294, -0.355), (-1.7771163733490813, -3.4877872638401195, 0.355), (0.6123525697973581, -3.86624196507323, 1.775), (-0.6123525697973595, -3.8662419650732294, 2.485), (1.7771163733490802, -3.4877872638401204, -0.355), (0.6123525697973581, -3.86624196507323, 0.355), (2.7679236443795494, -2.7679236443795507, 1.775), (1.7771163733490802, -3.4877872638401204, 2.485), (3.4877872638401195, -1.7771163733490816, -0.355), (2.7679236443795494, -2.7679236443795507, 0.355), (3.8662419650732294, -0.6123525697973597, 1.775), (3.4877872638401195, -1.7771163733490816, 2.485)] nanotube = kwant.lattice.Polyatomic(t_vec,coords) print nanotube.neighbors(1) #this is the line which gives an error ##End code snip Any assistance that anyone could offer would be hugely appreciated! Thanks very much, Sam LaGasse
Hi Sam, If you want to define a nanotube in 3D, you have two options: * You can define a 3D lattice with one translation vector and a lot of atoms in a unit cell. This is easier but less elegant. * You can define your own subclass of kwant.Lattice.Polyatomic which overrides the position method and arranges the sites of a planar graphene lattice in 3D according to the nanotube shape. Such a lattice could be defined like CurvedLattice(prim_vecs, basis, pos_transform), where the last argument would specify how the site coordinates should be recalculated. I imagine something like this would work (untested): https://gitlab.com/snippets/8149 Alternatively you can define a 2D system (I believe such a question was raised in a previous thread in this mailing list). Best, Anton On Tue, Aug 11, 2015 at 8:17 AM, LaGasse, Samuel <SLaGasse@sunypoly.edu> wrote:
Hi everyone,
I am trying to implement a carbon nanotube lattice inside of Kwant and I am not sure if my approach is correct. The CNT is slightly different, I think, than the other examples of lattices I have seen implemented in Kwant.
My approach, which I have used in the past in my own NEGF code, is to generate the atoms of a single unit cell (just a ring for a (10, 0) tube) and then translate them using the translation vector for the ring. For a (10, 0) tube oriented along the z-direction the vector would be approximately (0, 0, 4.26) Angstrom.
So, we have a 3D structure, but really only one lattice translation vector.
The problem I am observing in my implementation of this in Kwant is that the Polyatomic lattice code seems to expect three primitive vectors for a 3D structure. In the case of the CNT, this does not really apply. When I run my code (an example for the (10, 0) tube is pasted below) I get the following error when I try to get the 1st nearest neighbors of the lattice:
File "C:\Python27\lib\site-packages\kwant\lattice.py", line 282, in neighbors shortest_hopping = sls[0].n_closest(sls[0](*([0] * sls[0].dim)).pos, File " C:\Python27\lib\site-packages\kwant\builder.py", line 155, in __call__ return Site(self, tag) File "C:\Python27\lib\site-packages\kwant\builder.py", line 71, in __new__ raise t(msg.format(repr(tag), repr(family), v)) ValueError: Tag (0, 0, 0) is not allowed for site family kwant.lattice.Monatomic([[0.0, 0.0, 4.26]], [3.86624196507323, 0.6123525697973589, -0.355], '0'): Dimensionality mismatch.
Does anyone have any advice for how I might get around this? With shape functions I am able to successfully translate the CNT to create/plot a system inside of Kwant- the only issue I have is with defining hoppings right now. I'm thinking that it might be possible to manually define the hoppings inside of the unit cell, but I am not exactly sure how to go about it for a problem of this size.
Hopefully the way I've described my problem makes some sense! I am really hoping to get this working in Kwant- my NEGF code served my purposes for a while, but it is really quite terrible compared to Kwant, haha.
##Code snip:
import kwant
t_vec = [(0,0,4.26)] #(10,0) translation vector
#unit cell coordinates for (10, 0)
coords = [(3.86624196507323, 0.6123525697973589, -0.355), (3.86624196507323, -0.6123525697973589, 0.355), (3.48778726384012, 1.7771163733490807, 1.775), (3.86624196507323, 0.6123525697973589, 2.485), (2.7679236443795503, 2.76792364437955, -0.355), (3.48778726384012, 1.7771163733490807, 0.355), (1.7771163733490811, 3.4877872638401195, 1.775), (2.7679236443795503, 2.76792364437955, 2.485), (0.6123525697973591, 3.86624196507323, -0.355), (1.7771163733490811, 3.4877872638401195, 0.355), (-0.6123525697973586, 3.86624196507323, 1.775), (0.6123525697973591, 3.86624196507323, 2.485), (-1.7771163733490805, 3.48778726384012, -0.355), (-0.6123525697973586, 3.86624196507323, 0.355), (-2.76792364437955, 2.7679236443795503, 1.775), (-1.7771163733490805, 3.48778726384012, 2.485), (-3.4877872638401195, 1.7771163733490811, -0.355), (-2.76792364437955, 2.7679236443795503, 0.355), (-3.8662419650732294, 0.6123525697973593, 1.775), (-3.4877872638401195, 1.7771163733490811, 2.485), (-3.86624196507323, -0.6123525697973583, -0.355), (-3.8662419650732294, 0.6123525697973593, 0.355), (-3.48778726384012, -1.7771163733490802, 1.775), (-3.86624196507323, -0.6123525697973583, 2.485), (-2.7679236443795507, -2.76792364437955, -0.355), (-3.48778726384012, -1.7771163733490802, 0.355), (-1.7771163733490813, -3.4877872638401195, 1.775), (-2.7679236443795507, -2.76792364437955, 2.485), (-0.6123525697973595, -3.8662419650732294, -0.355), (-1.7771163733490813, -3.4877872638401195, 0.355), (0.6123525697973581, -3.86624196507323, 1.775), (-0.6123525697973595, -3.8662419650732294, 2.485), (1.7771163733490802, -3.4877872638401204, -0.355), (0.6123525697973581, -3.86624196507323, 0.355), (2.7679236443795494, -2.7679236443795507, 1.775), (1.7771163733490802, -3.4877872638401204, 2.485), (3.4877872638401195, -1.7771163733490816, -0.355), (2.7679236443795494, -2.7679236443795507, 0.355), (3.8662419650732294, -0.6123525697973597, 1.775), (3.4877872638401195, -1.7771163733490816, 2.485)]
nanotube = kwant.lattice.Polyatomic(t_vec,coords) print nanotube.neighbors(1) #this is the line which gives an error
##End code snip
Any assistance that anyone could offer would be hugely appreciated!
Thanks very much,
Sam LaGasse
participants (2)
-
Anton Akhmerov
-
LaGasse, Samuel