예제 #1
0
from cStringIO import StringIO

L = 10.0
txt=None
txt='-'

N2 = molecule('N2')
N2.set_cell([L, L, L])
#N2.set_pbc(True)
N2.center()

try:
    calc = GPAW('N2_wfs.gpw', 
                txt=txt, 
                parallel={'domain': world.size})
    calc.converge_wave_functions()
except:
    calc = GPAW(h=0.25,
                nbands=-5,
                spinpol=True,
                xc='PBE',
                txt=txt,
                eigensolver='cg',
                parallel={'domain': world.size})
    N2.set_calculator(calc)
    E0 = N2.get_potential_energy()
    calc.write('N2_wfs.gpw', 'all')

# selections
for obj in [KSSingles, LrTDDFT]:
    # selection using state numbers
예제 #2
0
load = False

# usual calculation
fname = 'Be2.gpw'
if not load:
    xco = HybridXC(xc)
    cocc = GPAW(h=0.3,
                eigensolver='rmm-diis',
                xc=xco,
                nbands=nbands,
                convergence={'eigenstates': 1e-4},
                txt=txt)
    cocc.calculate(loa)
else:
    cocc = GPAW(fname)
    cocc.converge_wave_functions()
fo_n = 1. * cocc.get_occupation_numbers()
eo_n = 1. * cocc.get_eigenvalues()

if unocc:
    # apply Fock opeartor also to unoccupied orbitals
    xcu = HybridXC(xc, unocc=True)
    cunocc = GPAW(h=0.3,
                  eigensolver='rmm-diis',
                  xc=xcu,
                  nbands=nbands,
                  convergence={'eigenstates': 1e-4},
                  txt=txt)
    cunocc.calculate(loa)

    parprint('     HF occ          HF unocc      diff')
예제 #3
0
from ase import Atom, Atoms
from ase.units import Bohr
from ase.parallel import parprint
from gpaw import GPAW
from gpaw.test import equal
from gpaw.grid_descriptor import GridDescriptor
from gpaw.analyse.expandyl import AngularIntegral, ExpandYl
import gpaw.mpi as mpi

fname = 'H2.gpw'
donot = ''
donot = 'donot'
try:
    calc = GPAW(fname + donot, txt=None)
    H2 = calc.get_atoms()
    calc.converge_wave_functions()
except:
    R = 0.7  # approx. experimental bond length
    a = 2.
    c = 3.
    H2 = Atoms([
        Atom('H', (a / 2, a / 2, (c - R) / 2)),
        Atom('H', (a / 2, a / 2, (c + R) / 2))
    ],
               cell=(a, a, c),
               pbc=True)
    calc = GPAW(
        gpts=(12, 12, 16),
        nbands=2,
        kpts=(1, 1, 2),
        convergence={'eigenstates': 1.e-6},
예제 #4
0
txt = None
xc = "PBE0"
nbands = 4

unocc = True
load = False

# usual calculation
fname = "Be2.gpw"
if not load:
    xco = HybridXC(xc)
    cocc = GPAW(h=0.3, eigensolver="rmm-diis", xc=xco, nbands=nbands, convergence={"eigenstates": 1e-4}, txt=txt)
    cocc.calculate(loa)
else:
    cocc = GPAW(fname)
    cocc.converge_wave_functions()
fo_n = 1.0 * cocc.get_occupation_numbers()
eo_n = 1.0 * cocc.get_eigenvalues()

if unocc:
    # apply Fock opeartor also to unoccupied orbitals
    xcu = HybridXC(xc, unocc=True)
    cunocc = GPAW(h=0.3, eigensolver="rmm-diis", xc=xcu, nbands=nbands, convergence={"eigenstates": 1e-4}, txt=txt)
    cunocc.calculate(loa)

    parprint("     HF occ          HF unocc      diff")
    parprint(
        "Energy %10.4f   %10.4f %10.4f"
        % (
            cocc.get_potential_energy(),
            cunocc.get_potential_energy(),