from model import pick_elements
species = [el1]
pick_elements(model, species)

from ase.calculators.lammps import LAMMPS
calc = LAMMPS(parameters=model.parameters, files=model.files)

from ase.lattice.surface import *

if surf == "10m10":
    myorth = True
else:
    myorth = False

if el1 != 'Mg':
    atoms=surface(el1, struct, surf, size=mysize, a=lp, c=None, vacuum=vac, orthogonal=myorth)
else:
    c=lp*sqrt(8./3)*catoi
    atoms=surface(el1, struct, surf, size=mysize, a=lp, c=c, vacuum=vac, orthogonal=myorth)

atoms.set_pbc((True, True, True))    

atoms.set_calculator(calc)
# eV/A^2 to mJ/m^2
un=16021.765

# unrelaxed
#
print "orig"
n1=atoms.get_number_of_atoms()
ene1 = atoms.get_potential_energy()
Example #2
0
from ase import *
from math import *
from ase.io import *
from ase.lattice.surface import *
lattice = read('POSCAR')
s1 = surface(lattice, (1, 1, 1), 1)
s1.center(vacuum=10, axis=2)
write('POSCAR-11.vasp', s1)
Example #3
0
metal = 'Pt'
# if you have a metal alloy, specify it here
metal2 = None

# your OPTIMIZED lattice constant
# for alloys, the setup will use your optimized trajectory directly
a = 3.989

vacuum = 7.0
layers = 4
if metal2:
    bulk = io.read('../Bulk/bulk.traj'
                   )  # TODO: change this path to the optimized bulk.traj alloy
    if metal == 'Mo':
        slab = surface(bulk, (1, 1, 0), layers, vacuum=vacuum)
    else:
        slab = surface(bulk, (1, 1, 1), layers, vacuum=vacuum)
else:
    if metal == 'Mo':
        slab = bcc110(metal, a=a, size=(2, 2, layers), vacuum=vacuum)
    else:
        slab = fcc111(metal, a=a, size=(2, 2, layers), vacuum=vacuum)

# mask for atoms with z-axis less than 10 A
# set constraint to Fix Atoms

# TODO: check to make sure that only the bottom two layers are fixed
mask = [atom.z < 10.0 for atom in slab]
slab.set_constraint(FixAtoms(mask=mask))
from ase.calculators.lammps import LAMMPS
calc = LAMMPS(parameters=model.parameters, files=model.files)

from ase.lattice.surface import *

if surf == "10m10":
    myorth = True
else:
    myorth = False

if el1 != 'Mg':
    atoms = surface(el1,
                    struct,
                    surf,
                    size=mysize,
                    a=lp,
                    c=None,
                    vacuum=vac,
                    orthogonal=myorth)
else:
    c = lp * sqrt(8. / 3) * catoi
    atoms = surface(el1,
                    struct,
                    surf,
                    size=mysize,
                    a=lp,
                    c=c,
                    vacuum=vac,
                    orthogonal=myorth)

atoms.set_pbc((True, True, True))
# run this from the directory where you finished the lattice optimization

metal = 'Pt'
# if you have a metal alloy, specify it here
metal2 = None

# your OPTIMIZED lattice constant
# for alloys, the setup will use your optimized trajectory directly
a = 3.989    

vacuum = 7.0
layers = 4
if metal2:
    bulk = io.read('../Bulk/bulk.traj')    # TODO: change this path to the optimized bulk.traj alloy
    if metal == 'Mo':
        slab = surface(bulk, (1,1,0), layers, vacuum=vacuum)
    else:
        slab = surface(bulk, (1,1,1), layers, vacuum=vacuum)
else:
    if metal == 'Mo':
        slab = bcc110(metal, a=a, size=(2,2,layers), vacuum=vacuum)
    else:
        slab = fcc111(metal, a=a, size=(2,2,layers), vacuum=vacuum)

# mask for atoms with z-axis less than 10 A
# set constraint to Fix Atoms

# TODO: check to make sure that only the bottom two layers are fixed
mask = [atom.z<10.0 for atom in slab]
slab.set_constraint(FixAtoms(mask=mask))