File: formats.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (23 lines) | stat: -rw-r--r-- 454 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
23
# creates: formats.csv
from ase.formula import Formula

formulas = ['H2O', 'SiC', 'MoS2', 'AB2', 'BN', 'SiO2']
formats = [
    'hill',
    'metal',
    'abc',
    'reduce',
    'ab2',
    'a2b',
    'periodic',
    'latex',
    'html',
    'rest',
]


with open('formats.csv', 'w') as fd:
    print(', '.join(formats), file=fd)
    for f in formulas:
        formula = Formula(f)
        print(', '.join(formula.format(fmt) for fmt in formats), file=fd)