コード例 #1
0
                           '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()
calc_2.write('dscf_CO_es2.gpw', mode='all')

equal(E_es1, E_gs+5.8, 0.1)
equal(E_es1, E_es2, 0.001)

energy_tolerance = 0.001
niter_tolerance = 2
print(E_gs, niter_gs)
print(E_es1, niter_es1)
print(E_es2, niter_es2)
equal(E_gs, -15.1924620949, energy_tolerance)
equal(E_es1, -9.36671359062, energy_tolerance)
コード例 #2
0
ファイル: homo.py プロジェクト: thonmaker/gpaw
slab = fcc111('Pt', size=(1, 2, 3), orthogonal=True)
add_adsorbate(slab, 'C', 2.0, 'ontop')
add_adsorbate(slab, 'O', 3.15, 'ontop')
slab.center(axis=2, vacuum=4.0)

view(slab)

molecule = slab.copy()

del molecule[:-2]

# Molecule
molecule.set_calculator(c_mol)
molecule.get_potential_energy()

# H**o wavefunction
wf_u = [kpt.psit_nG[4] for kpt in c_mol.wfs.kpt_u]

# H**o projector overlaps
mol = range(len(slab))[-2:]
p_uai = [
    dict([(mol[a], P_ni[4]) for a, P_ni in kpt.P_ani.items()])
    for kpt in c_mol.wfs.kpt_u
]

# Slab with adsorbed molecule
slab.set_calculator(calc)
orbital = dscf.AEOrbital(calc, wf_u, p_uai, Estart=-100.0, Eend=0.0)
dscf.dscf_calculation(calc, [[-1.0, orbital, 1]], slab)
slab.get_potential_energy()
コード例 #3
0
ファイル: lumo.py プロジェクト: Huaguiyuan/gpawDFT
]

band_k = []
for k in range(len(c_mol.wfs.weight_k)):

    wf1 = reshape(wf1_k[k], -1)
    wf2 = reshape(wf2_k[k], -1)
    p1 = abs(dot(wf1, lumo))
    p2 = abs(dot(wf2, lumo))
    if p1 > p2:
        band_k.append(5)
    else:
        band_k.append(6)

#Lumo wavefunction
wf_u = [kpt.psit_nG[band_k[kpt.k]] for kpt in c_mol.wfs.kpt_u]

#Lumo projector overlaps
mol = range(len(slab))[-2:]
p_uai = [
    dict([(mol[a], P_ni[band_k[kpt.k]]) for a, P_ni in kpt.P_ani.items()])
    for kpt in c_mol.wfs.kpt_u
]

#   Slab with adsorbed molecule
#-----------------------------------
slab.set_calculator(calc)
orbital = dscf.AEOrbital(calc, wf_u, p_uai)
dscf.dscf_calculation(calc, [[1.0, orbital, 1]], slab)
slab.get_potential_energy()