Exemplo n.º 1
0
def generate_database(dbfile, rc):
    np.random.seed(123)
    db = connect(dbfile)

    rcov = covalent_radii[atomic_numbers['C']]
    lc = 2 * np.sqrt(3) * rcov
    slab = Graphene(symbol='C', latticeconstant=[lc, 12.]).repeat((3, 3, 1))
    slab.center()

    kwargs = {
        'maximum_angular_momenta': mam,
        'use_spline': False,
        'Hamiltonian_SlaterKosterFiles_Suffix': '"_no_repulsion.skf"'
    }
    calc = DftbPlusCalc(slab, **kwargs)
    slab.set_calculator(calc)
    e_ref_slab = slab.get_potential_energy()
    f_ref_slab = slab.get_forces()

    m = molecule('N2')
    m.positions += np.array([2.5, 3., 7.5])

    for i in range(10):
        print('Generating structure %d' % i)
        n2 = m.copy()
        for i, axis in enumerate('xyz'):
            angle = np.random.random() * 180.
            n2.rotate(angle, axis, center='COP')

        calc = DftbPlusCalc(n2, **kwargs)
        n2.set_calculator(calc)
        e_ref_n2 = n2.get_potential_energy()
        f_ref_n2 = n2.get_forces()

        atoms = slab + n2
        calc = DftbPlusCalc(atoms, **kwargs)
        atoms.set_calculator(calc)
        e = atoms.get_potential_energy()
        f = atoms.get_forces()

        e_rep, f_rep = calculate_target_repulsion(atoms, rc)
        finalize(atoms, energy=e + e_rep, forces=f + f_rep, stress=None)

        e_dft_ref = convert_array([e_ref_slab, e_ref_n2])
        f_dft_ref = convert_array(np.vstack((f_ref_slab, f_ref_n2)))
        db.write(atoms, relaxed=1, e_dft_ref=e_dft_ref, f_dft_ref=f_dft_ref)

    return
Exemplo n.º 2
0
# 5 x 5 supercell of graphene
index1 = 5
index2 = 5
a = 2.45
c = 3.355

gra = Graphene(symbol='C',
               latticeconstant={
                   'a': a,
                   'c': c
               },
               size=(index1, index2, 1),
               pbc=(1, 1, 0))

gra.center(vacuum=15.0, axis=2)
gra.center()

# Starting position of the projectile with an impact point at the
# center of a hexagon
projpos = [[gra[15].position[0], gra[15].position[1] + 1.41245, 25.0]]

H = Atoms('H', cell=gra.cell, positions=projpos)

# Combine target and projectile
atoms = gra + H
atoms.set_pbc(True)

# Specify the charge state of the projectile, either
# 0 (neutral) or 1 (singly charged ion)
charge = 0  # default for neutral projectile
Exemplo n.º 3
0
import numpy as np

from ase.lattice.hexagonal import Graphene
from ase.parallel import parprint as pp

from gpaw import GPAW
from gpaw.response.df import DielectricFunction
from gpaw.mpi import world

system = Graphene(symbol='C',
                  latticeconstant={'a': 2.45,'c': 1.0},
                  size=(1,1,1))
system.pbc = (1, 1, 0)
system.center(axis=2, vacuum=4.0)

nkpts = 5


communicator = world.new_communicator(np.array([world.rank]))
gpwname = 'dump.graphene.gpw'

if world.rank == 0:
    calc = GPAW(mode='pw',
                kpts=(nkpts, nkpts, 1),
                communicator=communicator,
                xc='oldLDA',
                nbands=len(system) * 6,
                txt='gpaw.graphene.txt')
    system.set_calculator(calc)
    system.get_potential_energy()
    calc.write(gpwname, mode='all')
from ase.lattice.hexagonal import Graphene

# import ase.io as io
# from ase import Atoms, Atom
from ase.visualize import view
from ase.parallel import parprint as pp

from gpaw import GPAW, PW, restart
from gpaw.response.df import DielectricFunction
from gpaw.mpi import world
from gpaw.version import version
from ase.lattice import bulk

system = Graphene(symbol="C", latticeconstant={"a": 2.45, "c": 1.0}, size=(1, 1, 1))
system.pbc = (1, 1, 0)
system.center(axis=2, vacuum=4.0)

nkpts = 5


communicator = world.new_communicator(np.array([world.rank]))
gpwname = "dump.graphene.gpw"

if world.rank == 0:
    calc = GPAW(
        mode="pw",
        kpts=(nkpts, nkpts, 1),
        communicator=communicator,
        xc="oldLDA",
        nbands=len(system) * 6,
        txt="gpaw.graphene.txt",
Exemplo n.º 5
0
                eigensolver='rmm-diis',
                occupations=FermiDirac(0.001),
                kpts={
                    'size': (6, 6, 1),
                    'gamma': True
                })

    layer = Graphene(symbol='B',
                     latticeconstant={
                         'a': 2.5,
                         'c': 1.0
                     },
                     size=(1, 1, 1))
    layer[0].symbol = 'N'
    layer.pbc = (1, 1, 0)
    layer.center(axis=2, vacuum=4.0)

    layer.set_calculator(calc)
    layer.get_potential_energy()

    nbecut = 50
    from ase.units import Bohr, Hartree
    vol = layer.get_volume() / Bohr**3
    nbands = int(vol * (nbecut / Hartree)**1.5 * 2**0.5 / 3 / np.pi**2)
    calc.diagonalize_full_hamiltonian(nbands)
    calc.write('hBN.gpw', mode='all')

gw = G0W0('hBN.gpw',
          'gw-hBN',
          ecut=50,
          domega0=0.1,