def ip(symbol, fd, setup): xc = 'LDA' aea = AllElectronAtom(symbol, log=fd) aea.initialize() aea.run() aea.refine() aea.scalar_relativistic = True aea.refine() energy = aea.ekin + aea.eH + aea.eZ + aea.exc eigs = [] for l, channel in enumerate(aea.channels): n = l + 1 for e, f in zip(channel.e_n, channel.f_n): if f == 0: break eigs.append((e, n, l)) n += 1 e0, n0, l0 = max(eigs) aea = AllElectronAtom(symbol, log=fd) aea.add(n0, l0, -1) aea.initialize() aea.run() aea.refine() aea.scalar_relativistic = True aea.refine() IP = aea.ekin + aea.eH + aea.eZ + aea.exc - energy IP *= Ha s = create_setup(symbol, type=setup, xc=xc) f_ln = defaultdict(list) for l, f in zip(s.l_j, s.f_j): if f: f_ln[l].append(f) f_sln = [[f_ln[l] for l in range(1 + max(f_ln))]] calc = AtomPAW(symbol, f_sln, xc=xc, txt=fd, setups=setup) energy = calc.results['energy'] # eps_n = calc.wfs.kpt_u[0].eps_n f_sln[0][l0][-1] -= 1 calc = AtomPAW(symbol, f_sln, xc=xc, charge=1, txt=fd, setups=setup) IP2 = calc.results['energy'] - energy return IP, IP2
kwargs = {'xc': opt.xc_functional} aea = AEA(symbol, **kwargs) aea.run() gen = Generator(aea) gen.generate() if opt.plot: gen.plot() if __name__ == '__main__': #main() aea = AllElectronAtom('H') #aea.add(2, 1, 0) #aea.initialize() aea.run() #g = PAWSetupGenerator(aea, [(1, 0, 0.8)], 1) g = PAWSetupGenerator(aea, [], 0, 0.8) g.generate() #g.plot() setup = g.make_paw_setup() from ase.data.molecules import molecule from gpaw import GPAW a = molecule('H', pbc=1, magmoms=[0]) a.center(vacuum=2) a.set_calculator( GPAW(setups={0: setup})) a.get_potential_energy()
# creates: paw_note.pdf import subprocess import matplotlib.pyplot as plt from gpaw.atom.aeatom import AllElectronAtom ae = AllElectronAtom('Pt') ae.run() ae.plot_wave_functions(show=False) rcut = 2.5 lim = [0, 3.5, -2, 4] plt.plot([rcut, rcut], lim[2:], 'k--', label='_nolegend_') plt.axis(lim) plt.text(0.6, 2, '[Pt] = [Xe]4f$^{14}$5d$^9$6s$^1$') plt.savefig('Pt.png', dpi=80) try: subprocess.run( 'pdflatex -interaction=nonstopmode paw_note > /dev/null && ' 'bibtex paw_note > /dev/null && ' 'pdflatex -interaction=nonstopmode paw_note > /dev/null && ' 'pdflatex -interaction=nonstopmode paw_note > /dev/null && ' 'cp paw_note.pdf ..', shell=True, check=True) except subprocess.CalledProcessError: subprocess.run('echo "No pdflatex" > paw_note.pdf; cp paw_note.pdf ..', shell=True)