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.

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

z = 1.8<br />

d = 1.10 # N2 bond length<br />

# Molecular state parallel to the surface:<br />

slab += Atoms(’2N’, [(x, y, z), (x + sqrt3 * d / 2, y + d / 2, z)])<br />

# Use the EMT calculator for the forces and energies:<br />

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

# We don’t want to worry about the Cu degrees of freedom:<br />

mask = [atom.symbol == ’Cu’ for atom in slab]<br />

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

relax = QuasiNewton(slab)<br />

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

print ’initial state:’, slab.get_potential_energy()<br />

write(’N2.traj’, slab)<br />

# Now the final state.<br />

# Move the second N atom to a neighboring hollow site:<br />

slab[-1].set_position((x + a, y, z))<br />

relax.run()<br />

print ’final state: ’, slab.get_potential_energy()<br />

write(’2N.traj’, slab)<br />

import numpy as np<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 QuasiNewton<br />

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

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

configs = [initial.copy() for i in range(8)] + [final]<br />

constraint = FixAtoms(mask=[atom.symbol != ’N’ for atom in initial])<br />

for config in configs:<br />

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

config.set_constraint(constraint)<br />

band = NEB(configs)<br />

band.interpolate()<br />

# Create a quickmin object:<br />

relax = QuasiNewton(band)<br />

relax.run(steps=20)<br />

e0 = initial.get_potential_energy()<br />

for config in configs:<br />

d = config[-2].position - config[-1].position<br />

print np.linalg.norm(d), config.get_potential_energy() - e0<br />

6.2.8 Dissociation using ANEB<br />

from ase import *<br />

# XXX This cannot be converted to ase 3, since we lack ANEB<br />

raise NotImplementedError<br />

32 Chapter 6. Tutorials

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

Saved successfully!

Ooh no, something went wrong!