Free-energy functional method for inverse problem of self assembly.