Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to write a special hexagonal lattice generator, with several kinds of boundary conditions, such as helical BC, periodic BC, and I find it hard to verify whether it works correctly. I tried to draw them using 2-dimensional network drawing (using networkx) and as I expected, it was a total mess. Right now I have to work out the adjacency matrix beforehand and verify the generated network with the calculated adjacency matrix. It's fine with the regular lattice, but if I introduce some random perturbation on the lattice, this approach is very tiresome. It would be a lot easier if I could see the network drawn correctly.

Is it possible to correctly visualize (probably in 3D?) lattice with various boundary conditions? Or in other software tools? Is there a convenient way to test this kind of network generator?


share|improve this question
Hexagonal or hexahedral? – Bill Barth Jan 3 '13 at 13:08
I would say honeycomb lattice to avoid ambiguity. – wdg Jan 4 '13 at 13:43
Maybe a picture of what you're trying to do would be helpful. I can't tell from your description if you're talking about a 2D or 3D lattice. If you're only interested in a flat, 2D hexagonal lattice, then color-coding the nodes on the boundaries with the same boundary conditions might be the easiest way to see what's going on. E.g. interior lattice points are black, and boundary points which are identified through the same periodic boundary condition are red. Etc. Etc. You could draw the lattice with graphviz or something similar. – Bill Barth Jan 6 '13 at 17:00

Creating lattice (and other periodic) structures is a major issue in molecular simulations. Therefore, if you can translate your points into something that can be parsed by a viewer such as VMD or PyMol, you should be able to generate a view that can tell you if everything is working as expected. (This assumes, of course, that you build more than one periodic "cell" of your lattice.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.