Esempio n. 1
0
from ase.utils.geometry import get_layers, cut, stack

np.set_printoptions(suppress=True)

al = crystal('Al', [(0, 0, 0)], spacegroup=225, cellpar=4.05)

# Cut out slab of 5 Al(001) layers
al001 = cut(al, nlayers=5)
correct_pos = np.array([[0., 0., 0.], [0., 0.5, 0.2], [0.5, 0., 0.2],
                        [0.5, 0.5, 0.], [0., 0., 0.4], [0., 0.5, 0.6],
                        [0.5, 0., 0.6], [0.5, 0.5, 0.4], [0., 0., 0.8],
                        [0.5, 0.5, 0.8]])
assert np.allclose(correct_pos, al001.get_scaled_positions())

# Check layers along 001
tags, levels = get_layers(al001, (0, 0, 1))
assert np.allclose(tags, [0, 1, 1, 0, 2, 3, 3, 2, 4, 4])
assert np.allclose(levels, [0., 2.025, 4.05, 6.075, 8.1])

# Check layers along 101
tags, levels = get_layers(al001, (1, 0, 1))
assert np.allclose(tags, [0, 1, 5, 3, 2, 4, 8, 7, 6, 9])
assert np.allclose(
    levels,
    [0.000, 0.752, 1.504, 1.880, 2.256, 2.632, 3.008, 3.384, 4.136, 4.888],
    atol=0.001)

# Check layers along 111
tags, levels = get_layers(al001, (1, 1, 1))
assert np.allclose(tags, [0, 2, 2, 4, 1, 5, 5, 6, 3, 7])
assert np.allclose(levels,
Esempio n. 2
0
from jlgh import *
import numpy as np
import ase.lattice.surface as surf
from ase.constraints import FixAtoms
from ase.utils.geometry import get_layers

Pd_latconst = 3.937211
slab = surf.fcc100("Pd", a=Pd_latconst, size=[1, 1, 4], vacuum=10)
slab.set_constraint(FixAtoms(indices=[il[0] for il in enumerate(get_layers(slab, (0, 0, 1))[0]) if il[1] < 2]))

h0 = max([at.position[2] for at in slab]) / slab.cell[2][2]

sites = [Site(name="hollow", pos=[0.5, 0.5, h0])]

E_2x2 = -56199.75241886

base_cell = BaseCell(slab, site_list=sites, energy=E_2x2 / 4.0)


Oatoms = ase.Atoms("O", positions=[[0.0, 0.0, 1.0]])
Oads = Adsorbate("O", Oatoms, center=[0.0, 0.0, 0.0], binding_energy=-439.4812229)

V_O_O_1NN_defs = [("O@hollow.(0,0,0)", "O@hollow.(1,0,0)"), ("O@hollow.(0,0,0)", "O@hollow.(0,1,0)")]
V_O_O_1NN = ClusterGroup("V_O_O_1NN", 0.3, V_O_O_1NN_defs)

V_O_O_2NN_defs = [("O@hollow.(0,0,0)", "O@hollow.(1,1,0)"), ("O@hollow.(0,0,0)", "O@hollow.(1,-1,0)")]
V_O_O_2NN = ClusterGroup("V_O_O_2NN", 0.07, V_O_O_2NN_defs)

enes_defs = [
    (-57077.82959288, ("O@hollow.(0,0,0)", "O@hollow.(1,0,0)")),
    (-57078.30630942, ("O@hollow.(0,0,0)", "O@hollow.(1,1,0)")),
Esempio n. 3
0
        [0.0, 0.0, 0.0],
        [0.0, 0.5, 0.2],
        [0.5, 0.0, 0.2],
        [0.5, 0.5, 0.0],
        [0.0, 0.0, 0.4],
        [0.0, 0.5, 0.6],
        [0.5, 0.0, 0.6],
        [0.5, 0.5, 0.4],
        [0.0, 0.0, 0.8],
        [0.5, 0.5, 0.8],
    ]
)
assert np.allclose(correct_pos, al001.get_scaled_positions())

# Check layers along 001
tags, levels = get_layers(al001, (0, 0, 1))
assert np.allclose(tags, [0, 1, 1, 0, 2, 3, 3, 2, 4, 4])
assert np.allclose(levels, [0.0, 2.025, 4.05, 6.075, 8.1])

# Check layers along 101
tags, levels = get_layers(al001, (1, 0, 1))
assert np.allclose(tags, [0, 1, 5, 3, 2, 4, 8, 7, 6, 9])
assert np.allclose(levels, [0.000, 0.752, 1.504, 1.880, 2.256, 2.632, 3.008, 3.384, 4.136, 4.888], atol=0.001)

# Check layers along 111
tags, levels = get_layers(al001, (1, 1, 1))
assert np.allclose(tags, [0, 2, 2, 4, 1, 5, 5, 6, 3, 7])
assert np.allclose(levels, [0.000, 1.102, 1.929, 2.205, 2.756, 3.031, 3.858, 4.960], atol=0.001)


# Cut out slab of three Al(111) layers
Esempio n. 4
0
from jlgh import *
import numpy as np
import ase.lattice.surface as surf
from ase.io.castep import read_cell
from ase.visualize import view
from ase.constraints import FixAtoms
from ase.utils.geometry import get_layers

atoms = read_cell('Pd_O_O_NO_CO_0000.cell')
atoms.calc = None

Pd_latconst = 3.937211

slab = surf.fcc100('Pd',a = Pd_latconst,size = [1,1,4],vacuum = 10)
slab.set_constraint(FixAtoms(indices = [ il[0] for il
                        in enumerate(get_layers(slab,(0,0,1))[0])
                        if il[1] < 2]))

h0 = max([at.position[2] for at in slab]) / slab.cell[2][2]

sites = [ Site(name='hollow', pos=[.5,.5,h0]),
          Site(name='top', pos=[.0,.0,h0]),
          Site(name='br1', pos=[.5,.0,h0]),
          Site(name='br2', pos=[.0,.5,h0]),
         ]

ucell = SurfUnitCell(slab,sites_list=sites)

COatoms = ase.Atoms('CO',positions=[[0.0,0.0,1.0],[0.0,0.0,2.0]])
NOatoms = ase.Atoms('NO',positions=[[0.0,0.0,1.0],[0.0,0.0,2.0]])
NO2atoms = ase.Atoms('NO2',positions=[[0.0,0.0,1.0],[-0.5,0.0,1.5],[0.5,0.0,1.5]],)