18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

from ase.lattice.surface import fcc100, add_adsorbate<br />

from ase.constraints import FixAtoms<br />

from ase.calculators.emt import EMT<br />

from ase.optimize import QuasiNewton<br />

# 2x2-Al(001) surface with 3 layers and an<br />

# Au atom adsorbed in a hollow site:<br />

slab = fcc100(’Al’, size=(2, 2, 3))<br />

add_adsorbate(slab, ’Au’, 1.7, ’hollow’)<br />

slab.center(axis=2, vacuum=4.0)<br />

# Make sure the structure is correct:<br />

#view(slab)<br />

# Fix second and third layers:<br />

mask = [atom.tag > 1 for atom in slab]<br />

#print mask<br />

slab.set_constraint(FixAtoms(mask=mask))<br />

# Use EMT potential:<br />

slab.set_calculator(EMT())<br />

# Initial state:<br />

qn = QuasiNewton(slab, trajectory=’initial.traj’)<br />

qn.run(fmax=0.05)<br />

# Final state:<br />

slab[-1].x += slab.get_cell()[0, 0] / 2<br />

qn = QuasiNewton(slab, trajectory=’final.traj’)<br />

qn.run(fmax=0.05)<br />

Note: Notice how the tags are used to select the constrained atoms<br />

Now, do the NEB calculation:<br />

from ase.io import read<br />

from ase.constraints import FixAtoms<br />

from ase.calculators.emt import EMT<br />

from ase.neb import NEB<br />

from ase.optimize import BFGS<br />

initial = read(’initial.traj’)<br />

final = read(’final.traj’)<br />

constraint = FixAtoms(mask=[atom.tag > 1 for atom in initial])<br />

images = [initial]<br />

for i in range(3):<br />

image = initial.copy()<br />

image.set_calculator(EMT())<br />

image.set_constraint(constraint)<br />

images.append(image)<br />

images.append(final)<br />

neb = NEB(images)<br />

neb.interpolate()<br />

qn = BFGS(neb, trajectory=’neb.traj’)<br />

qn.run(fmax=0.05)<br />

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

6.2. <strong>ASE</strong> 35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!