def wan(calc): centers = [([0.125, 0.125, 0.125], 0, 1.5), ([0.125, 0.625, 0.125], 0, 1.5), ([0.125, 0.125, 0.625], 0, 1.5), ([0.625, 0.125, 0.125], 0, 1.5)] w = Wannier(4, calc, nbands=4, verbose=False, initialwannier=centers) w.localize() x = w.get_functional_value() centers = (w.get_centers(1) * k) % 1 c = (centers - 0.125) * 2 #print w.get_radii() # broken! XXX assert abs(c.round() - c).max() < 0.03 c = c.round().astype(int).tolist() c.sort() assert c == [[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]] if 0: from ase.visualize import view from ase import Atoms watoms = calc.atoms + Atoms(symbols='X4', scaled_positions=centers, cell=calc.atoms.cell) view(watoms) return x
from ase.dft.wannier import Wannier from gpaw import GPAW from gpaw.mpi import world calc = GPAW('Si-PBE.gpw', txt=None, parallel={'domain': world.size}) calc.wfs.ibz2bz(calc.atoms) initial = [[(0.125, 0.125, 0.125), 0, 1.5], [(0.125, 0.625, 0.125), 0, 1.5], [(0.125, 0.125, 0.625), 0, 1.5], [(0.625, 0.125, 0.125), 0, 1.5]] w = Wannier(4, calc, #fixedenergy=0.0, nbands=8, verbose=1, initialwannier=initial) w.localize() w.save('rotations.pckl')