root / ase / examples / Pt_island.py @ 1
Historique | Voir | Annoter | Télécharger (2,16 ko)
1 |
import numpy as np |
---|---|
2 |
from math import sqrt |
3 |
from ase import Atom, Atoms |
4 |
from ase.optimize import QuasiNewton, FIRE |
5 |
from ase.constraints import FixAtoms |
6 |
from ase.neb import NEB |
7 |
from ase.io import write, PickleTrajectory |
8 |
from ase.calculators.emt import ASAP |
9 |
|
10 |
# Distance between Cu atoms on a (100) surface:
|
11 |
d = 2.74
|
12 |
h1 = d * sqrt(3) / 2 |
13 |
h2 = d * sqrt(2.0 / 3) |
14 |
initial = Atoms(symbols='Pt',
|
15 |
positions=[(0, 0, 0)],#(1.37,0.79,2.24),(2.74,1.58,4.48),(0,0,6.72),(1.37,0.79,8.96),(2.74,1.58,11.2)], |
16 |
cell=([(d,0,0),(d/2,h1,0),(d/2,h1/3,-h2)]), |
17 |
pbc=(True, True, True)) |
18 |
initial *= (7, 8, 6) # 5x5 (100) surface-cell |
19 |
cell = initial.get_cell() |
20 |
cell[2] = (0, 0, 22) |
21 |
initial.set_cell(cell) |
22 |
#initial.set_pbc((True,True,False))
|
23 |
# Approximate height of Ag atom on Cu(100) surfece:
|
24 |
h0 = 2.2373
|
25 |
initial += Atom('Pt', (10.96, 11.074, h0)) |
26 |
initial += Atom('Pt', (13.7, 11.074, h0)) |
27 |
initial += Atom('Pt', (9.59, 8.701, h0)) |
28 |
initial += Atom('Pt', (12.33, 8.701, h0)) |
29 |
initial += Atom('Pt', (15.07, 8.701, h0)) |
30 |
initial += Atom('Pt', (10.96, 6.328, h0)) |
31 |
initial += Atom('Pt', (13.7, 6.328, h0)) |
32 |
|
33 |
if 0: |
34 |
view(initial) |
35 |
|
36 |
# Make band:
|
37 |
images = [initial.copy() for i in range(7)] |
38 |
neb = NEB(images) |
39 |
|
40 |
# Set constraints and calculator:
|
41 |
indices = np.compress(initial.positions[:, 2] < -5.0, range(len(initial))) |
42 |
constraint = FixAtoms(indices) |
43 |
for image in images: |
44 |
image.set_calculator(ASAP()) |
45 |
image.constraints.append(constraint) |
46 |
|
47 |
# Displace last image:
|
48 |
for i in xrange(1,8,1): |
49 |
images[-1].positions[-i] += (d/2, -h1/3, 0) |
50 |
|
51 |
write('initial.traj', images[0]) |
52 |
# Relax height of Ag atom for initial and final states:
|
53 |
for image in [images[0], images[-1]]: |
54 |
QuasiNewton(image).run(fmax=0.01)
|
55 |
|
56 |
if 0: |
57 |
write('initial.pckl', image[0]) |
58 |
write('finial.pckl', image[-1]) |
59 |
# Interpolate positions between initial and final states:
|
60 |
neb.interpolate() |
61 |
|
62 |
for image in images: |
63 |
print image.positions[-1], image.get_potential_energy() |
64 |
|
65 |
traj = PickleTrajectory('mep.traj', 'w') |
66 |
|
67 |
dyn = FIRE(neb, dt=0.1)
|
68 |
#dyn = MDMin(neb, dt=0.1)
|
69 |
#dyn = QuasiNewton(neb)
|
70 |
dyn.attach(neb.writer(traj)) |
71 |
dyn.run(fmax=0.01,steps=150) |
72 |
|
73 |
for image in images: |
74 |
print image.positions[-1], image.get_potential_energy() |