Esempio n. 1
0
                'energy': 1e-5,
                'bands': 5
            },
            eigensolver='dav')
bulk.set_calculator(calc)
e1 = bulk.get_potential_energy()
niter1 = calc.get_number_of_iterations()
equal(e0, e1, 5.0e-5)

energy_tolerance = 0.00004
niter_tolerance = 0
equal(e0, -6.97626, energy_tolerance)
equal(e1, -6.976265, energy_tolerance)

# band parallelization
if size % 2 == 0:
    calc = GPAW(h=h,
                nbands=2 * 8,
                kpts=(2, 2, 2),
                convergence={
                    'eigenstates': 7.2e-9,
                    'energy': 1e-5,
                    'bands': 5
                },
                parallel={'band': 2},
                eigensolver=Davidson(niter=3))
    bulk.set_calculator(calc)
    e3 = bulk.get_potential_energy()
    niter3 = calc.get_number_of_iterations()
    equal(e0, e3, 5.0e-5)
Esempio n. 2
0
from gpaw.eigensolvers.davidson import Davidson
from gpaw import GPAW, PoissonSolver, PW
import ase.io
from ase.units import Hartree, Bohr

system = ase.io.read("H.xyz")
system.center(vacuum=8.0 * Bohr)
calc = GPAW(
    txt='-',
    nbands=2,
    #mode=PW(450.0),
    eigensolver=Davidson(2),
    xc='oldLDA',
)

system.set_calculator(calc)
system.get_potential_energy()

system.set_calculator(calc)

Etot = system.get_potential_energy()
print("Cutoff = %18.10f Ha\n" % (450.0 / Hartree))
print("Etot = %18.10f Ha\n" % (Etot / Hartree))
1) Calculate the ground state of Diamond.
2) Calculate the band structure of diamond in order to obtain accurate KS band gap for Diamond.
3) Calculate ground state again, and calculate the potential discontinuity using accurate band gap.
4) Calculate band structure again, and apply the discontinuity to CBM.

Compare to reference.
"""

xc = 'GLLBSC'
gen('C',xcname=xc)
setup_paths.insert(0, '.')

# Calculate ground state
atoms = bulk('C', 'diamond', a=3.567)
calc = GPAW(h=0.15, kpts=(4,4,4), xc=xc, nbands = 6,
            eigensolver=Davidson(niter=2))
atoms.set_calculator(calc)
atoms.get_potential_energy()
calc.write('Cgs.gpw')

# Calculate accurate KS-band gap from band structure
points = ibz_points['fcc']

# CMB is in G-X
G = points['Gamma']
X = points['X']

#W = points['W']
#K = points['K']
#L = points['L']
#[W, L, G, X, W, K]
Esempio n. 4
0
from gpaw.mpi import world

xc = 'GLLBSC'
gen('C', xcname=xc)
setup_paths.insert(0, '.')

# Calculate ground state
atoms = bulk('C', 'diamond', a=3.567)
# We want sufficiently many grid points that the calculator
# can use wfs.world for the finegd, to test that part of the code.
calc = GPAW(h=0.2,
            kpts=(4, 4, 4),
            xc=xc,
            nbands=8,
            parallel=dict(domain=min(world.size, 2), band=1),
            eigensolver=Davidson(niter=4))
atoms.set_calculator(calc)
atoms.get_potential_energy()
calc.write('Cgs.gpw')

# Calculate accurate KS-band gap from band structure
calc = GPAW('Cgs.gpw',
            kpts={
                'path': 'GX',
                'npoints': 12
            },
            fixdensity=True,
            symmetry='off',
            nbands=8,
            convergence=dict(bands=6),
            eigensolver=Davidson(niter=4))
Esempio n. 5
0
 def calc(atoms):
     if atoms.get_initial_magnetic_moments().any():
         M = MixerSum
     else:
         M = Mixer
     atoms.calc.set(eigensolver=Davidson(), mixer=M(0.05, 5, 50))