Statistiques
| Révision :

root / ase / test / replay.py @ 13

Historique | Voir | Annoter | Télécharger (934 octet)

1
from math import sqrt
2
from ase import Atoms, Atom
3
from ase.constraints import FixAtoms
4
from ase.calculators.emt import EMT
5
from ase.optimize import QuasiNewton
6
from ase.io import read
7
from ase.vibrations import Vibrations
8

    
9
# Distance between Cu atoms on a (100) surface:
10
d = 3.6 / sqrt(2)
11
a = Atoms('Cu',
12
          positions=[(0, 0, 0)],
13
          cell=(d, d, 1.0),
14
          pbc=(True, True, False))
15
a *= (2, 2, 1)  # 2x2 (100) surface-cell
16

    
17
# Approximate height of Ag atom on Cu(100) surfece:
18
h0 = 2.0
19
a += Atom('Ag', (d / 2, d / 2, h0))
20

    
21
if 0:
22
    view(a)
23

    
24
constraint = FixAtoms(range(len(a) - 1))
25
a.set_calculator(EMT())
26
a.set_constraint(constraint)
27
dyn1 = QuasiNewton(a, trajectory='AgCu1.traj', logfile='AgCu1.log')
28
dyn1.run(fmax=0.1)
29

    
30
a = read('AgCu1.traj')
31
a.set_calculator(EMT())
32
print a.constraints
33
dyn2 = QuasiNewton(a, trajectory='AgCu2.traj', logfile='AgCu2.log')
34
dyn2.replay_trajectory('AgCu1.traj')
35
dyn2.run(fmax=0.01)