Parametric Tetrahedral Lattice (Dual Extrusion)

I made an openSCAD program to generate a ball and stick model of diamond or silicon crystals.
The model is printed in layers, with each ball having a space for the connector to slot into.
They take quite a while to run (up to 10min per .stl) so I included 2 sets of pre-rendered models, one with thin and the other with thick connectors.
The files atom1.stl and connector1.stl are combined into a single dual colour model. Same with atom2 + connector2 etc.