I am trying to simulate a honeycomb lattice, I.e, each particle interacts with each of it's 3 neighbors. I want to represent in array such that it is automated. I.e, if any atom is picked at random, code should evaluate some parameter based on connected neighbors.
I can think of it in this way:
- initialize n*n array.
- every particle interacts with particles next to it on right and left sides
- particle on odd row and odd column interact with it's bottom particle
- particle on odd row and even column interact with it's top particle
- particle on even row and odd column interact with it's top particle
- particle on even row and even column interact with it's bottom particle
The equivalence is shown below in the pictures.
Is there a better method to represent the same?