A nanoscale pn junction in series with tunable Schottky barriers