Atom('H', (d * cos(t), d * sin(t), 0))], cell=(a, a, a), pbc=False) H2O.center() calc = GPAW(nbands=10, h=0.2, setups={'O': 'hch1s'}) H2O.set_calculator(calc) e = H2O.get_potential_energy() niter = calc.get_number_of_iterations() calc.write('h2o.gpw') else: calc = GPAW('h2o.gpw') calc.initialize_positions() from gpaw.xas import RecursionMethod if 1: r = RecursionMethod(calc) r.run(400) r.write('h2o.pckl') else: r = RecursionMethod(filename='h2o.pckl') if 0: from pylab import * x = -30 + 40 * np.arange(300) / 300.0 for n in range(50, 401, 50): y = r.get_spectra(x, imax=n) plot(x, y[0], label=str(n)) legend() show()
calc = GPAW('si.gpw') import gpaw.mpi as mpi if mpi.size == 1: xas = XAS(calc) x, y = xas.get_spectra() else: x = np.linspace(0, 10, 50) k = 2 calc.set(kpts=(k, k, k)) calc.initialize() calc.set_positions(si) assert calc.wfs.dtype == complex r = RecursionMethod(calc) r.run(40) if mpi.size == 1: z = r.get_spectra(x) if 0: import pylab as p p.plot(x, y[0]) p.plot(x, sum(y)) p.plot(x, z[0]) p.show() # 2p corehole gen('Si', name='hch2p', corehole=(2, 1, 0.5)) calc = GPAW(nbands=None, h=0.25,
Atom('H', (d * cos(t), d * sin(t), 0)) ], cell=(a, a, a), pbc=False) H2O.center() calc = GPAW(nbands=10, h=0.2, setups={'O': 'hch1s'}, eigensolver=Davidson(4), mixer=Mixer(0.5), xc='oldLDA', poissonsolver=PoissonSolver(use_charge_center=True)) H2O.set_calculator(calc) e = H2O.get_potential_energy() niter = calc.get_number_of_iterations() calc.write('h2o.gpw') from gpaw.xas import RecursionMethod if 1: r = RecursionMethod(calc) r.run(400) r.write('h2o.pckl') else: r = RecursionMethod(filename='h2o.pckl') print(e, niter) energy_tolerance = 0.0002 niter_tolerance = 0 equal(e, -17.97647788354092, energy_tolerance)
calc = GPAW('si.gpw') import gpaw.mpi as mpi if mpi.size == 1: xas = XAS(calc) x, y = xas.get_spectra() else: x = np.linspace(0, 10, 50) k = 2 calc.set(kpts=(k, k, k)) calc.initialize() calc.set_positions(si) assert calc.wfs.dtype == complex r = RecursionMethod(calc) r.run(40) if mpi.size == 1: z = r.get_spectra(x) if 0: import pylab as p p.plot(x, y[0]) p.plot(x, sum(y)) p.plot(x, z[0]) p.show() # 2p corehole gen('Si', name='hch2p', corehole=(2, 1, 0.5), gpernode=30) calc = GPAW(nbands=None, h=0.25,
cell=(a, a, a), pbc=False) H2O.center() calc = GPAW(nbands=10, h=0.2, setups={'O': 'hch1s'}) H2O.set_calculator(calc) e = H2O.get_potential_energy() niter = calc.get_number_of_iterations() calc.write('h2o.gpw') else: calc = GPAW('h2o.gpw') calc.initialize_positions() from gpaw.xas import RecursionMethod if 1: r = RecursionMethod(calc) r.run(400) r.write('h2o.pckl') else: r = RecursionMethod(filename='h2o.pckl') if 0: from pylab import * x = -30 + 40 * np.arange(300) / 300.0 for n in range(50, 401, 50): y = r.get_spectra(x, imax=n) plot(x, y[0], label=str(n)) legend() show()