File: md.py

package info (click to toggle)
python-ase 3.17.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,340 kB
  • sloc: python: 117,348; makefile: 91
file content (21 lines) | stat: -rw-r--r-- 587 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from ase import Atoms
from ase.calculators.emt import EMT
from ase.md import VelocityVerlet
from ase.io import Trajectory

a = 3.6
b = a / 2
fcc = Atoms('Cu', positions=[(0, 0, 0)],
            cell=[(0, b, b), (b, 0, b), (b, b, 0)],
            pbc=1)
fcc *= (2, 1, 1)
fcc.set_calculator(EMT())
fcc.set_momenta([(0.9, 0.0, 0.0), (-0.9, 0, 0)])
md = VelocityVerlet(fcc, timestep=0.1)
def f():
    print(fcc.get_potential_energy(), fcc.get_total_energy())
md.attach(f)
md.attach(Trajectory('Cu2.traj', 'w', fcc).write, interval=3)
md.run(steps=20)
fcc2 = Trajectory('Cu2.traj', 'r')[-1]