def testSTM(calc):
    stm = SimpleStm(calc)
    stm.write_3D([1,0,0], f3dname) # single wf
    wf = stm.gd.integrate(stm.ldos)
##    print "wf=", wf

    if size == 1: # XXXX we have problem with reading plt in parallel
        stm2 = SimpleStm(f3dname)
        wf2 = stm2.gd.integrate(stm2.ldos)
        print('Integrals: written, read=', wf, wf2)
        equal(wf, wf2, 2.e-7)

##    print eigenvalue_string(calc)
    stm.write_3D(3.1, f3dname)
    wf2 = stm.gd.integrate(stm.ldos)
##    print "wf2=", wf2
    equal(wf2, 2, 0.12)

    return wf
예제 #2
0
def testSTM(calc):
    stm = SimpleStm(calc)
    stm.write_3D([1, 0, 0], f3dname)  # single wf
    wf = stm.gd.integrate(stm.ldos)
    ##    print "wf=", wf

    if size == 1:  # XXXX we have problem with reading plt in parallel
        stm2 = SimpleStm(f3dname)
        wf2 = stm2.gd.integrate(stm2.ldos)
        print('Integrals: written, read=', wf, wf2)
        equal(wf, wf2, 2.e-7)

##    print eigenvalue_string(calc)
    stm.write_3D(3.1, f3dname)
    wf2 = stm.gd.integrate(stm.ldos)
    ##    print "wf2=", wf2
    equal(wf2, 2, 0.12)

    return wf
    cf = GPAW(fname, txt=txt)
testSTM(cf)

# periodic system
if not load:
    BH.set_pbc(True)
    cp = GPAW(spinpol=True, nbands=3, h=.3, kpts=(2,1,1), txt=txt)
    BH.set_calculator(cp)
    e3 = BH.get_potential_energy()
    niter3 = cp.get_number_of_iterations()
    cp.write('BH-8kpts_wfs.gpw', 'all')
else:
    cp = GPAW('BH-8kpts_wfs.gpw', txt=txt)

stmp = SimpleStm(cp)

stmp.write_3D(-4., f3dname)
print(me + 'Integrals(occ): 2 * wf, bias=', 2 * wf, stmp.gd.integrate(stmp.ldos))
equal(2 * wf, stmp.gd.integrate(stmp.ldos), 0.02)

stmp.write_3D(+4., f3dname)
print(me + 'Integrals(unocc): 2 * wf, bias=', end=' ')
print(2 * wf, stmp.gd.integrate(stmp.ldos))
equal(2 * wf, stmp.gd.integrate(stmp.ldos), 0.02)

energy_tolerance = 0.0007
niter_tolerance = 0
equal(e1, -2.54026, energy_tolerance)
equal(e2, -1.51101, energy_tolerance)
equal(e3, -2.83573, energy_tolerance)
예제 #4
0
testSTM(cf)

# periodic system
if not load:
    BH.set_pbc(True)
    cp = GPAW(spinpol=True, nbands=3, h=.3, kpts=(2, 1, 1), txt=txt)
    BH.set_calculator(cp)
    e3 = BH.get_potential_energy()
    niter3 = cp.get_number_of_iterations()
    cp.write('BH-8kpts_wfs.gpw', 'all')
else:
    cp = GPAW('BH-8kpts_wfs.gpw', txt=txt)

stmp = SimpleStm(cp)

stmp.write_3D(-4., f3dname)
print(me + 'Integrals(occ): 2 * wf, bias=', 2 * wf,
      stmp.gd.integrate(stmp.ldos))
equal(2 * wf, stmp.gd.integrate(stmp.ldos), 0.02)

stmp.write_3D(+4., f3dname)
print(me + 'Integrals(unocc): 2 * wf, bias=', end=' ')
print(2 * wf, stmp.gd.integrate(stmp.ldos))
equal(2 * wf, stmp.gd.integrate(stmp.ldos), 0.02)

energy_tolerance = 0.0007
niter_tolerance = 0
equal(e1, -2.54026, energy_tolerance)
equal(e2, -1.51101, energy_tolerance)
equal(e3, -2.83573, energy_tolerance)