n = 5 molecule = [0,1] wf_u = [kpt.psit_nG[n] for kpt in calc_mol.wfs.kpt_u] p_uai = [dict([(molecule[a], P_ni[n]) for a, P_ni in kpt.P_ani.items()]) for kpt in calc_mol.wfs.kpt_u] # Excited state calculations #-------------------------------------------- calc_1 = GPAW(nbands=8, h=0.2, xc='PBE', spinpol=True, convergence={'energy': 100, 'density': 100, #'eigenstates': 1.0e-9, 'bands': -1}) CO.set_calculator(calc_1) weights = {0: [0.,0.,0.,1.], 1: [0.,0.,0.,-1.]} lumo = dscf.MolecularOrbital(calc_1, weights=weights) dscf.dscf_calculation(calc_1, [[1.0, lumo, 1]], CO) E_es1 = CO.get_potential_energy() niter_es1 = calc_1.get_number_of_iterations() calc_1.write('dscf_CO_es1.gpw', mode='all') calc_2 = GPAW(nbands=8, h=0.2, xc='PBE', spinpol=True, convergence={'energy': 100, 'density': 100, #'eigenstates': 1.0e-9, 'bands': -1}) CO.set_calculator(calc_2) lumo = dscf.AEOrbital(calc_2, wf_u, p_uai) dscf.dscf_calculation(calc_2, [[1.0, lumo, 1]], CO) E_es2 = CO.get_potential_energy() niter_es2 = calc_2.get_number_of_iterations()
}) CO = molecule('CO') CO.center(vacuum=3) CO.set_calculator(calc) E_gs = CO.get_potential_energy() # Excited state calculation calc_es = GPAW(mode='lcao', basis='dzp', nbands=8, h=0.2, xc='PBE', spinpol=True, convergence={ 'energy': 100, 'density': 1e-3, 'bands': -1 }) CO.set_calculator(calc_es) lumo = dscf.MolecularOrbital(calc, weights={0: [0, 0, 0, 1], 1: [0, 0, 0, -1]}) dscf.dscf_calculation(calc_es, [[1.0, lumo, 1]], CO) E_es = CO.get_potential_energy() dE = E_es - E_gs print(dE) equal(dE, 5.7595110076, 0.011)