Self-assembly of functional nanoscale materials