File: findsym.py

package info (click to toggle)
python-ase 3.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,192 kB
  • ctags: 8,112
  • sloc: python: 93,375; sh: 99; makefile: 94
file content (33 lines) | stat: -rw-r--r-- 991 bytes parent folder | download | duplicates (4)
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
31
32
33
def write_findsym(fileobj, images):
    symbols = images[0].get_chemical_symbols()
    natoms = len(symbols)

    for atoms in images:
        formula = atoms.get_chemical_symbols()
        accuracy = 1.0e-4

        # Write Comment
        fileobj.write('%s\n' % formula)
        fileobj.write('%f   accuracy\n' % accuracy)
        fileobj.write('1    vectors in cartesian coordinates\n')

        # Write cartesian coordinates of vectors
        for x, y, z in atoms.cell:
            fileobj.write('%22.15f %22.15f %22.15f\n' % (x, y, z))

        fileobj.write('1    no known centering\n')

        fileobj.write('1 0 0 \n')
        fileobj.write('0 1 0 \n')
        fileobj.write('0 0 1 \n')

        fileobj.write('%d\n' % natoms)

        numbers = atoms.get_atomic_numbers()
        for n in numbers:
            fileobj.write('%d ' % (n))

        fileobj.write('\n')

        for x, y, z in atoms.get_positions():
            fileobj.write('%22.15f %22.15f %22.15f\n' % (x, y, z))