Minimal varieties and harmonic maps in tori