root / ase / gui / neb.py @ 3
Historique | Voir | Annoter | Télécharger (687 octet)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
from math import sqrt |
3 |
|
4 |
import numpy as np |
5 |
|
6 |
from ase.neb import fit0 |
7 |
|
8 |
def NudgedElasticBand(images): |
9 |
N = images.repeat.prod() |
10 |
natoms = images.natoms // N |
11 |
|
12 |
R = images.P[:, :natoms] |
13 |
E = images.E |
14 |
F = images.F[:, :natoms] |
15 |
|
16 |
s, E, Sfit, Efit, lines = fit0(E, F, R) |
17 |
import pylab |
18 |
import matplotlib |
19 |
#matplotlib.use('GTK')
|
20 |
pylab.ion() |
21 |
x = 2.95
|
22 |
pylab.figure(figsize=(x * 2.5**0.5, x)) |
23 |
pylab.plot(s, E, 'o')
|
24 |
for x, y in lines: |
25 |
pylab.plot(x, y, '-g')
|
26 |
pylab.plot(Sfit, Efit, 'k-')
|
27 |
pylab.xlabel(u'path [Å]')
|
28 |
pylab.ylabel(u'energy [eV]')
|
29 |
pylab.title('Maximum: %.3f eV' % max(Efit)) |
30 |
pylab.show() |