from __future__ import print_function from numpy import around from gpaw import GPAW from gpaw.wannier import LocFun calc = GPAW('CO.gpw', txt=None) locfun = LocFun() locfun.localize(calc, M=8, ortho=True, verbose=True) print(around(locfun.U_nn, 1)) # non ortho # O_s O_py O_pz O_px C_s C_py C_pz C_px # s1 [[-0.9 0. 0.4 0. -0.5 0. -0.5 0. ] # s2 [ 0.5 0. 0.8 0. -0.6 0. -0.2 0. ] # pi [ 0. -0.4 0. 0.7 0. -0.3 0. 0.5] # pi [ 0. -0.7 0. -0.4 0. -0.5 0. -0.3] # s3 [ 0. 0. 0.4 0. 0.6 0. -0.8 0. ] # pi* [ 0. -0.2 0. -0.5 0. 0.2 0. 0.8] # pi* [ 0. -0.5 0. 0.2 0. 0.8 0. -0.2] # s4 [-0.2 0. -0.1 0. -0.2 -0. 0.2 0. ]] # ortho # O_s O_py O_pz O_px C_s C_py C_pz C_px # s1 [[-0.7 0. 0.1 0. -0.5 0. -0.4 0. ] # s2 [ 0.5 0. 0.7 0. -0.5 0. -0.1 0. ] # pi [ 0. -0.4 0. 0.7 0. -0.3 0. 0.5] # pi [ 0. -0.7 0. -0.4 0. -0.5 0. -0.3] # s3 [-0.1 0. 0.5 0. 0.7 0. -0.5 0. ] # pi* [ 0. -0.2 0. -0.5 0. 0.2 0. 0.8] # pi* [ 0. -0.5 0. 0.2 0. 0.8 0. -0.2] # s4 [-0.5 0. 0.5 0. 0.2 0. 0.7 0. ]]
from numpy import around from gpaw import GPAW from gpaw.wannier import LocFun calc = GPAW('CO.gpw', txt=None) locfun = LocFun() locfun.localize(calc, M=8, ortho=True, verbose=True) print around(locfun.U_nn, 1) # non ortho # O_s O_py O_pz O_px C_s C_py C_pz C_px # s1 [[-0.9 0. 0.4 0. -0.5 0. -0.5 0. ] # s2 [ 0.5 0. 0.8 0. -0.6 0. -0.2 0. ] # pi [ 0. -0.4 0. 0.7 0. -0.3 0. 0.5] # pi [ 0. -0.7 0. -0.4 0. -0.5 0. -0.3] # s3 [ 0. 0. 0.4 0. 0.6 0. -0.8 0. ] # pi* [ 0. -0.2 0. -0.5 0. 0.2 0. 0.8] # pi* [ 0. -0.5 0. 0.2 0. 0.8 0. -0.2] # s4 [-0.2 0. -0.1 0. -0.2 -0. 0.2 0. ]] # ortho # O_s O_py O_pz O_px C_s C_py C_pz C_px # s1 [[-0.7 0. 0.1 0. -0.5 0. -0.4 0. ] # s2 [ 0.5 0. 0.7 0. -0.5 0. -0.1 0. ] # pi [ 0. -0.4 0. 0.7 0. -0.3 0. 0.5] # pi [ 0. -0.7 0. -0.4 0. -0.5 0. -0.3] # s3 [-0.1 0. 0.5 0. 0.7 0. -0.5 0. ] # pi* [ 0. -0.2 0. -0.5 0. 0.2 0. 0.8] # pi* [ 0. -0.5 0. 0.2 0. 0.8 0. -0.2] # s4 [-0.5 0. 0.5 0. 0.2 0. 0.7 0. ]]
from ase import * from gpaw import * from gpaw.coulomb import get_vxc, HF from gpaw.wannier import LocFun if not os.path.isfile('H2O.gpw'): calc = GPAW(nbands=9) atoms = molecule('H2O', calculator=calc) atoms.center(vacuum=2.4) atoms.get_potential_energy() calc.write('H2O.gpw', mode='all') atoms, calc = restart('H2O.gpw', txt=None) calc.initialize_positions() calc.hamiltonian.poisson.initialize() locfun = LocFun() locfun.localize(calc, ortho=True) H = locfun.get_hamiltonian(calc) U = locfun.U_nn xc = get_vxc(calc, spin=0, U=U) hf = HF(calc) F = hf.apply(calc, 0) Fcore = np.zeros((calc.wfs.nbands, calc.wfs.nbands), float) hf.atomic_val_core(calc, Fcore, u=0) Fcore *= Hartree os.remove('H2O.gpw')