Turn salt cube by clicking on the screen (left or right, above or below the cube). Such cubic table salt crystals are sodium (blue) chloride (green). The cubic shape results from the organization of sodium (Na+) and chloride (Cl–) ions within the crystal.
Computes where each voxel (3D pixel) lies as a xyz point, and translates to the xy points on our 2D screen. Every other atom is sodium (blue and smaller), coded by numbering all atoms and computing odd vs. even with the mod function. I tried to shade the sides, but this could be much improved. Extra notes on the cubic structure: The square packing results from the attraction between opposite charges, repulsion of same charges, and the size of the ions. The positive ions are strongly attracted to the negative ions, and are trying to surround themselves with as many ions of the opposite charge as possible. The negatively charged ions are also strongly repelling from one another and are trying to surround themselves with positively charged ions. This balance of attraction and repulsion results in a very stable and structured arrangement of ions where each ion has 6 immediate neighbors of opposite charge.