Mesoscopic structure prediction of nanoparticle assembly and coassembly: theoretical foundation.