Self assembled functional nanomaterials: from ionic capsules to nanoporous molecular framework