I think it works for me because I’m not use textures (or different RenderState) for the molecular structure.
I tested your code at
(but with tens of thousands of cubes) and I could see it working well.
I think based on this code, I need to develop a class that can handle shapes such as spheres and capsules easily (for the component of molecules).