1d lattice with arbitrary distribution of sites
Posted: 04 May 2022, 10:58
Hi! I have a question concerning how to build a simple 1d lattice where sites of two types alternate in an arbitrary fashion: let's say for concreteness that I have two types of sites labeled "s_1" and "s_2", and I want to create a finite chain of length 5 so that the sites alternate as ["s_1","s_1","s_2","s_1","s_2"]. I can think of two approaches to get the job done, but both seem more like a workaround rather that what one would logically do.
1) The chain consists of a single large unit cell. Then we can inizialize the lattice implementing
where site_list is the list used to specify the arbitrary alternation of sites and n is just the number of times the unit cell is repeated (which has nothing to do with the length of the chain, in this case n=1 if we want L=5). This approach seems somewhat unnatural, since this is not how one would normally think of unit cells and it also makes the definition of couplings/observables awkward.
2) I define a regular lattice consisting of "s_1" only and then I use the IrregularLattice class to insert the "s_2" sites in the appropriate positions. This second approach seems more reasonable and it is what I would go for, but I am wondering if there is something even simpler that I am missing. For instance, I thought there would be a way to initialize the whole lattice (and not just the unit cell) by directly imputing the list of sites, but I did not find anything like that in the documentation. Do you know if such a feature exists and I am just missing it?
1) The chain consists of a single large unit cell. Then we can inizialize the lattice implementing
Code: Select all
def __init__(self, n, site_list,**kwargs):
site_1=site_1()
site_2=site_2()
sites = [site_1 if s == "s_1" else site_2 for s in site_list]
super(supersite_chain_arbitrary, self).__init__([n], sites, **kwargs)
Code: Select all
["s_1","s_1","s_2","s_1","s_2"]
2) I define a regular lattice consisting of "s_1" only and then I use the IrregularLattice class to insert the "s_2" sites in the appropriate positions. This second approach seems more reasonable and it is what I would go for, but I am wondering if there is something even simpler that I am missing. For instance, I thought there would be a way to initialize the whole lattice (and not just the unit cell) by directly imputing the list of sites, but I did not find anything like that in the documentation. Do you know if such a feature exists and I am just missing it?