def _generate(symbol, xc, configuration, projectors, radii, scalar_relativistic, alpha, r0, nderiv0, pseudize, rcore, core_hole, output): if isinstance(output, str): output = open(output, 'w') aea = AllElectronAtom(symbol, xc, configuration=configuration, log=output) gen = PAWSetupGenerator(aea, projectors, scalar_relativistic, core_hole, fd=output) gen.construct_shape_function(alpha, radii, eps=1e-10) gen.calculate_core_density() gen.find_local_potential(r0, nderiv0) gen.add_waves(radii) gen.pseudize(pseudize[0], pseudize[1], rcore=rcore) gen.construct_projectors(rcore) return gen
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
from gpaw.atom.aeatom import AllElectronAtom, c from gpaw.test import equal Z = 79 # gold atom kwargs = dict(alpha2=150 * Z**2, ngauss=100) # Test Schroedinger equation: aea = AllElectronAtom(Z, log=None) aea.initialize(**kwargs) errors = [] for channel in aea.channels: channel.solve(-Z) for n in range(7): e = channel.e_n[n] e0 = -0.5 * Z**2 / (n + channel.l + 1)**2 errors.append(abs(e / e0 - 1)) equal(max(errors), 0, 2.0e-5) # Test Dirac equation: aea = AllElectronAtom(Z, dirac=True, log=None) aea.initialize(**kwargs) errors = [] for channel in aea.channels: channel.solve(-Z) for n in range(7): e = channel.e_n[n] if channel.k > 0: n += 1 e0 = (1 +
from __future__ import print_function from gpaw.atom.aeatom import AllElectronAtom, c from gpaw.test import equal Z = 79 # gold atom kwargs = dict(ngpts=5000, alpha2=1000 * Z**2, ngauss=200) # Test Schroedinger equation: aea = AllElectronAtom(Z, log=None) aea.initialize(**kwargs) errors = [] for channel in aea.channels: channel.solve(-Z) for n in range(7): e = channel.e_n[n] e0 = -0.5 * Z**2 / (n + channel.l + 1)**2 errors.append(abs(e / e0 - 1)) print(max(errors)) equal(max(errors), 0, 2.0e-5) # Test Dirac equation: aea = AllElectronAtom(Z, dirac=True, log=None) aea.initialize(**kwargs) errors = [] for channel in aea.channels: channel.solve(-Z) for n in range(7): e = channel.e_n[n] if channel.k > 0:
symbol = args[0] 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}))
# 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)