Simulation of nanostructures