File: atom.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 (30 lines) | stat: -rw-r--r-- 562 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from ase import Atom, Atoms

m = Atoms('H2')
a = m[0]
b = Atom('H')
for c in [a, b]:
    assert c.x == 0
    c.z = 24.0
    assert c.position[2] == 24.0
    assert c.symbol == 'H'
    c.number = 92
    assert c.symbol == 'U'
    c.symbol = 'Fe'
    assert c.number == 26
    c.tag = 42
    assert c.tag == 42
    c.momentum = (1,2,3)
assert m[0].tag == 42
momenta = m.get_momenta()
m = Atoms('LiH')
for a in m:
    print(a.symbol)
for a in m:  
    if a.symbol == 'H':
        a.z = 0.75
assert m.get_distance(0, 1) == 0.75
a = m.pop()
m += a
del m[:1]
print(m)