File: symbols.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 (22 lines) | stat: -rw-r--r-- 559 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
22
from ase.build import molecule
from ase.symbols import Symbols

atoms = molecule('CH3CH2OH')
print(atoms.symbols)
atoms.symbols[0] = 'X'
atoms.symbols[2:4] = 'Pu'
atoms.numbers[6:8] = 79

assert atoms.numbers[0] == 0
assert (atoms.numbers[2:4] == 94).all()
assert sum(atoms.symbols == 'Au') == 2
assert (atoms.symbols[6:8] == 'Au').all()
assert (atoms.symbols[:3] == 'XCPu').all()

print(atoms)
print(atoms.numbers)

assert atoms.get_chemical_symbols()
string = str(atoms.symbols)
symbols = Symbols.fromsymbols(string)
assert (symbols == atoms.symbols).all()